diff --git a/.gitignore b/.gitignore
index e830da5..0373d8e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,3 @@ android/.idea/
*.iml
.DS_Store
-
-# Example app keeps its Xcode project
-!example-app/ios/App/App.xcodeproj/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index faadba9..be04f3c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,56 +6,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
## [Unreleased]
-## [0.3.0] - 2026-10-10
-
-Banners, native ads, impression-level revenue, segments, dynamic user id, placement capping and Capacitor 7 support.
-Fully backwards compatible with 0.2.x.
-
-### Added (API)
-- `docs/design-0.3.md`: banner, native ad, impression data, placement, segment and dynamic user id design with the
- exact LevelPlay 9.6.1 Android / iOS mappings, overlay positioning, error codes, Capacitor 7 findings, test plan.
-- TypeScript API (`@since 0.3.0`): `getCapabilities`, `setSegment`, `setDynamicUserId`, `isPlacementCapped`,
- `getReward`, `createBanner` / `loadBanner` / `showBanner` / `hideBanner` / `setBannerLayout` / `destroyBanner`,
- `loadNativeAd` / `showNativeAd` / `setNativeAdRect` / `hideNativeAd` / `destroyNativeAd`; events `adInfoChanged`,
- `impressionData`, `banner*` and `nativeAd*`.
-- `AdInfo` gains optional `ab`, `segmentName`, `encryptedCPM`, `creativeId`, `conversionValue` (iOS) and `adSize`.
-- Web stubs for every new method.
-
-### Added (Android)
-- Banners in a pass-through overlay above the WebView: presets, `ADAPTIVE` (width in dp = CSS px, recreated on
- rotation), `CUSTOM` sizes, top / bottom / center with offsets, safe area from the WebView's on-screen rect and the
- window insets, several banners by id, every `banner*` event.
-- Native ads with the plugin's `small` and `medium` templates (colours, corner radius, fonts) and `nativeAd*` events.
-- `impressionData` from per-ad listeners, queued (max 100) until the first JS listener; `adInfoChanged`;
- `getCapabilities`, `setSegment`, `setDynamicUserId`, `isPlacementCapped`, `getReward`.
-- `AdInfo` fields `ab`, `segmentName`, `encryptedCPM`, `creativeId`, `adSize` on Android.
-- JVM unit tests for the overlay geometry and argument validation (`bun run verify:android`).
-- `BannerSize` `CUSTOM` with `customSize`, `NativeAdTemplateStyle` fonts, banner ids in `LEVELPLAY_DEMO`.
-
-### Added (iOS)
-- Banners in a pass-through overlay inside the WebView: presets, `ADAPTIVE` (width in pt = CSS px, recreated when the
- safe-area width changes), `CUSTOM` sizes, top / bottom / center with offsets, safe area, several banners by id, every
- `banner*` event.
-- Native ads with the plugin's `small` and `medium` templates built in code (`ISNativeAdView` binding; colours, corner
- radius, system or web-asset fonts) and `nativeAd*` events.
-- `impressionData` from per-ad delegates (with `conversionValue`), queued (max 100) until the first JS listener;
- native impressions synthesised; `adInfoChanged`; `getCapabilities`, `setSegment`, `setDynamicUserId`,
- `isPlacementCapped`, `getReward`; cleanup of banners and native ads when the plugin is released.
-- `AdInfo` fields `ab`, `segmentName`, `encryptedCPM`, `creativeId`, `conversionValue`, `adSize` on iOS.
-
-### Added (tooling and docs)
-- `bun run test`: `bun test` for the web stub (unimplemented rejections vs no-ops), `LEVELPLAY_DEMO` and the exports,
- plus a compile-only check of the public API (`tsc -p test`); `verify` runs it.
-- `example-app/`: a minimal Capacitor 8 app (HTML + TypeScript, esbuild) with the demo ids and buttons for every
- format, segments and an impression log; Android and iOS (SPM) platforms committed. Not part of the npm package.
-- README: banners, native ads (style options), impression data, segments / user id / placements, error codes,
- limitations, example app, Capacitor 7.
-
-### Changed
-- Capacitor 7 support: `peerDependencies` `@capacitor/core >=7.0.0`; `Package.swift` depends on `capacitor-swift-pm`
- `"7.0.0"..<"9.0.0"`; iOS deployment target 14.0 in `Package.swift` and the podspec (was 15.0); Android
- `minSdkVersion` fallback 23 (was 24). Checked by building a Capacitor 7.6.9 app for Android and the iOS simulator.
-
## [0.2.1] - 2026-10-10
### Changed
@@ -97,8 +47,7 @@ First public release on npm. No behaviour changes to the native bridges since 0.
`closed` `rewarded`. Show calls resolve after close with `{ shown, rewarded, reward?, error? }`.
- `LEVELPLAY_DEMO`: Unity's public demo app keys and ad unit ids.
-[Unreleased]: https://git.crt.fyi/CRT/capacitor-levelplay/compare/v0.3.0...main
-[0.3.0]: https://git.crt.fyi/CRT/capacitor-levelplay/compare/v0.2.1...v0.3.0
+[Unreleased]: https://git.crt.fyi/CRT/capacitor-levelplay/compare/v0.2.1...main
[0.2.1]: https://git.crt.fyi/CRT/capacitor-levelplay/compare/v0.2.0...v0.2.1
[0.2.0]: https://git.crt.fyi/CRT/capacitor-levelplay/compare/v0.1.0...v0.2.0
[0.1.0]: https://git.crt.fyi/CRT/capacitor-levelplay/releases/tag/v0.1.0
diff --git a/CapacitorLevelplay.podspec b/CapacitorLevelplay.podspec
index 1f267c2..dce024f 100644
--- a/CapacitorLevelplay.podspec
+++ b/CapacitorLevelplay.podspec
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
s.author = package['author']
s.source = { :git => "#{repo}.git", :tag => "v#{s.version}" }
s.source_files = 'ios/Sources/**/*.{swift,h,m}'
- s.ios.deployment_target = '14.0'
+ s.ios.deployment_target = '15.0'
s.dependency 'Capacitor'
# Unity LevelPlay SDK (ironSource), https://cocoapods.org/pods/IronSourceSDK
s.dependency 'IronSourceSDK', '~> 9.6.1'
diff --git a/Package.swift b/Package.swift
index e47a5c6..f529980 100644
--- a/Package.swift
+++ b/Package.swift
@@ -3,14 +3,14 @@ import PackageDescription
let package = Package(
name: "CapacitorLevelplay",
- platforms: [.iOS(.v14)],
+ platforms: [.iOS(.v15)],
products: [
.library(
name: "CapacitorLevelplay",
targets: ["LevelPlayPlugin"])
],
dependencies: [
- .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", "7.0.0"..<"9.0.0"),
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
// Official Unity LevelPlay SDK (binary xcframework + Ad Quality), https://github.com/ironsource-mobile/LevelPlay-Swift-Package
.package(url: "https://github.com/ironsource-mobile/LevelPlay-Swift-Package.git", "9.6.1"..<"10.0.0")
],
diff --git a/README.md b/README.md
index 15ee513..6a907d9 100644
--- a/README.md
+++ b/README.md
@@ -2,13 +2,12 @@
[](https://www.npmjs.com/package/capacitor-levelplay)
[](LICENSE)
-[](https://capacitorjs.com)
+[](https://capacitorjs.com)
[](https://docs.unity.com/en-us/grow/levelplay)
-Capacitor 7 and 8 plugin for [Unity LevelPlay](https://docs.unity.com/en-us/grow/levelplay) (formerly ironSource)
-mediation: **rewarded**, **interstitial**, **banner** and **native** ads on Android and iOS, plus impression-level
-revenue data, built on LevelPlay's current **ad-unit API** (`LevelPlay.init`, `LevelPlayRewardedAd` / `LPMRewardedAd`,
-`LevelPlayInterstitialAd` / `LPMInterstitialAd`, `LevelPlayBannerAdView` / `LPMBannerAdView`, `LevelPlayNativeAd`).
+Capacitor 8 plugin for [Unity LevelPlay](https://docs.unity.com/en-us/grow/levelplay) (formerly ironSource) mediation:
+**rewarded** and **interstitial** ads on Android and iOS, built on LevelPlay's current **ad-unit API**
+(`LevelPlay.init`, `LevelPlayRewardedAd` / `LPMRewardedAd`, `LevelPlayInterstitialAd` / `LPMInterstitialAd`).
```ts
import { LevelPlay } from 'capacitor-levelplay';
@@ -29,10 +28,8 @@ if (result.rewarded) grantCoins(result.reward!.amount);
- [Android setup](#android-setup)
- [Quick start](#quick-start)
- [Usage guide](#usage-guide)
-- [Example app](#example-app)
- [Mediation adapters](#mediation-adapters)
- [Privacy and consent](#privacy-and-consent)
-- [Limitations](#limitations)
- [Troubleshooting](#troubleshooting)
- [FAQ](#faq)
- [API reference](#api)
@@ -55,35 +52,26 @@ if (result.rewarded) grantCoins(result.reward!.amount);
adapters during development.
- **Typed events** (`loaded`, `loadFailed`, `displayed`, `displayFailed`, `clicked`, `closed`, `rewarded`) with ad
info including impression revenue.
-- **Banners** (0.3.0): standard sizes, adaptive (follows the safe-area width and rotation), and custom sizes; placed at
- the top, bottom or centre with offsets, inside the safe area, in a pass-through overlay above the WebView (touches
- beside a banner reach the page). Several banners at once, addressed by `bannerId`.
-- **Native ads** (0.3.0): the plugin's `small` and `medium` templates, styled from JS (colours, corner radius, fonts)
- and placed over any rectangle of the page, typically a placeholder element's `getBoundingClientRect()`.
-- **Impression-level revenue** (0.3.0): `impressionData` for rewarded, interstitial, banner and native ads, queued
- (up to 100) until the first listener so early impressions are not lost; `adInfoChanged` for full-screen ads.
-- **Segments, dynamic user id, placement capping and rewards** (0.3.0): `setSegment`, `setDynamicUserId`,
- `isPlacementCapped`, `getReward`.
-- **Capabilities** (0.3.0): `getCapabilities()` tells what the current platform supports.
- **Demo ids** (`LEVELPLAY_DEMO`) from Unity's public sample apps for test ads during development.
- Web stub: on the web nothing is ever ready and shows resolve `{ shown: false }`, so the same game code runs in a
browser.
+Banners and native ads are not supported.
+
## Compatibility
| | Version |
|---|---|
-| Capacitor | 7 and 8 (`@capacitor/core` >= 7.0.0) |
+| Capacitor | 8 (`@capacitor/core` >= 8.0.0) |
| Unity LevelPlay SDK | 9.6.1 (Android `com.unity3d.ads-mediation:mediation-sdk:9.6.1`; iOS `LevelPlay-Swift-Package` 9.6.1 up to < 10, or the `IronSourceSDK ~> 9.6.1` pod) |
-| iOS | 14.0+ deployment target (Capacitor 7 default; Capacitor 8 apps use 15.0) |
-| Xcode | 16+ for Capacitor 7, 26+ for Capacitor 8; tested with Xcode 27 (which needs an app target of iOS 15.0+) |
-| Android | minSdk 23+, compileSdk / targetSdk 35 (Capacitor 7) or 36 (Capacitor 8), taken from the app's `variables.gradle` |
+| iOS | 15.0+ deployment target |
+| Xcode | 26+ (Capacitor 8 requirement); tested with Xcode 27 |
+| Android | minSdk 24, compileSdk / targetSdk 36 (Capacitor 8 defaults, overridable from `variables.gradle`) |
| Java | JDK 21 for Gradle builds |
-| Node.js | 20+ (Capacitor 7 CLI), 22+ (Capacitor 8 CLI) |
+| Node.js | 22+ (Capacitor 8 CLI) |
| Plugin | Capacitor | LevelPlay SDK |
|---|---|---|
-| 0.3.x | 7, 8 | 9.6.1 |
| 0.2.x | 8 | 9.6.1 |
| 0.1.x | 8 | 9.6.1 |
@@ -104,7 +92,7 @@ pnpm add capacitor-levelplay && pnpm cap sync
### Swift Package Manager (default)
-Capacitor 8 projects (and Capacitor 7 projects created with `--packagemanager SPM`) need nothing extra: `npx cap sync` adds the plugin to `CapApp-SPM/Package.swift`
+Capacitor 8 projects created with SPM need nothing extra: `npx cap sync` adds the plugin to `CapApp-SPM/Package.swift`
and Xcode resolves the LevelPlay package (a binary xcframework, roughly 27 MB) on the next build.
### CocoaPods (alternative)
@@ -179,7 +167,7 @@ ext {
}
```
-Gradle in Capacitor 7 and 8 projects needs **JDK 21** (see [Troubleshooting](#android-build-fails-with-unsupported-class-file-major-version)).
+Gradle in Capacitor 8 projects needs **JDK 21** (see [Troubleshooting](#android-build-fails-with-unsupported-class-file-major-version)).
## Quick start
@@ -306,128 +294,6 @@ Every event carries `{ format: 'rewarded' | 'interstitial', adUnitId, adInfo? }`
`isReady({ format, adUnitId })` returns the native `isAdReady()` for that ad unit. It is `false` for an ad unit that was
never loaded. Use it to enable or disable a "watch video" button.
-### Banners
-
-A banner is created hidden, then loaded and shown. `createBanner` resolves the banner's size and on-screen frame (CSS
-px, relative to the WebView viewport), so the page can leave room for it.
-
-```ts
-const banner = await LevelPlay.createBanner({
- adUnitId: ids.banner,
- bannerId: 'main', // optional; defaults to adUnitId
- size: 'ADAPTIVE', // BANNER 320x50, LARGE 320x90, MEDIUM_RECTANGLE 300x250, LEADERBOARD 728x90, ADAPTIVE, CUSTOM
- position: 'bottom', // 'top' | 'bottom' | 'center'
- offsetY: 0, // CSS px, away from the edge
- respectSafeArea: true, // default: stays clear of notches, status bar, navigation bar and home indicator
-});
-document.body.style.paddingBottom = `${banner.frame.height}px`;
-
-await LevelPlay.addListener('bannerLoaded', (e) => console.log('banner', e.bannerId, e.frame));
-await LevelPlay.addListener('bannerLoadFailed', (e) => console.warn('banner failed', e.error.code));
-await LevelPlay.loadBanner({ bannerId: 'main' }); // once per banner object; the SDK refreshes and retries by itself
-await LevelPlay.showBanner({ bannerId: 'main' });
-
-await LevelPlay.setBannerLayout({ bannerId: 'main', position: 'top' }); // move it
-await LevelPlay.hideBanner({ bannerId: 'main' }); // hidden banners pause auto refresh
-await LevelPlay.destroyBanner({ bannerId: 'main' });
-```
-
-- `ADAPTIVE` uses the safe-area width (or `adaptiveWidth` in CSS px) and is recreated and reloaded automatically when
- that width changes, for example on rotation, keeping its id, position and visibility.
-- `CUSTOM` takes `customSize: { width, height }` in CSS px.
-- Banner events: `bannerLoaded`, `bannerLoadFailed`, `bannerDisplayed`, `bannerDisplayFailed`, `bannerClicked`,
- `bannerExpanded`, `bannerCollapsed`, `bannerLeftApplication`, all with `{ bannerId, adUnitId, adInfo?, frame? }`.
-
-| Top and bottom (Android) | Rotated, adaptive (Android) |
-|---|---|
-|  |  |
-
-### Native ads
-
-Native ads are drawn by the plugin's templates (`small`: a row at least 90 px tall, no media; `medium`: with a media
-view, about 300 x 350) and placed over a
-rectangle of the page, usually a placeholder element. Check `getCapabilities()` first.
-
-```ts
-const caps = await LevelPlay.getCapabilities();
-if (caps.nativeAd && caps.nativeAdTemplates.includes('small')) {
- const slot = document.getElementById('native-slot')!; // e.g. a 90 px tall div
-
- await LevelPlay.addListener('nativeAdLoaded', async (e) => {
- const r = slot.getBoundingClientRect();
- await LevelPlay.showNativeAd({ nativeAdId: e.nativeAdId, rect: { x: r.left, y: r.top, width: r.width, height: r.height } });
- });
- await LevelPlay.addListener('nativeAdLoadFailed', (e) => console.warn('native failed', e.error.code));
-
- await LevelPlay.loadNativeAd({
- nativeAdId: 'feed-1',
- template: 'small',
- placementName: 'Feed', // optional
- style: {
- backgroundColor: '#ffffff',
- titleColor: '#111111',
- bodyColor: '#555555',
- callToActionBackgroundColor: '#2f6fed',
- callToActionTextColor: '#ffffff',
- cornerRadius: 8,
- titleFont: { family: 'fonts/Inter-SemiBold.ttf', size: 15 }, // a web asset path or a system family
- bodyFont: { size: 13 },
- callToActionFont: { family: 'Helvetica', size: 14 },
- },
- });
-}
-
-// keep it on the placeholder while the page scrolls or resizes
-await LevelPlay.setNativeAdRect({ nativeAdId: 'feed-1', rect: { x: 16, y: 420, width: 343, height: 90 } });
-await LevelPlay.hideNativeAd({ nativeAdId: 'feed-1' });
-await LevelPlay.destroyNativeAd({ nativeAdId: 'feed-1' });
-```
-
-Style options (`NativeAdTemplateStyle`): `backgroundColor`, `titleColor`, `bodyColor`, `callToActionBackgroundColor`,
-`callToActionTextColor` (`#RRGGBB` or `#RRGGBBAA`), `cornerRadius` (CSS px), and `titleFont`, `bodyFont`, `callToActionFont`
-(`{ family?, size? }`; a `.ttf` / `.otf` path is read from the app's web assets, anything else is a system font family;
-a missing font falls back to the system font). The template texts "Ad" and "Open" can be localised with the app
-resources `levelplay_native_ad_badge` and `levelplay_native_ad_cta_fallback` (Android `strings.xml`, iOS
-`Localizable.strings`).
-
-Native events: `nativeAdLoaded`, `nativeAdLoadFailed`, `nativeAdImpression`, `nativeAdClicked`, all with
-`{ nativeAdId, placementName?, adInfo? }`.
-
-### Impression-level revenue
-
-```ts
-await LevelPlay.addListener('impressionData', (d) => {
- // d.adFormat as the SDK reports it ('Rewarded Video', 'Interstitial', 'Banner', 'nativead' ...); d.revenue in USD
- analytics.logAdImpression({ network: d.adNetwork, format: d.adFormat, revenue: d.revenue ?? 0, currency: 'USD' });
-});
-```
-
-Impressions that happen before the first listener (for example a banner shown during app start) are queued, up to 100,
-and delivered in order when the first `impressionData` listener is added. `d.allData` carries every raw field of the
-SDK's impression object. `adInfoChanged` fires when the ad info of a loaded rewarded or interstitial ad changes.
-
-### Segments, user id, placements
-
-```ts
-await LevelPlay.setSegment({ segmentName: 'whales', level: 12, isPaying: true, iapTotal: 49.99, customParameters: { cohort: 'b' } });
-await LevelPlay.setDynamicUserId({ userId: 'player-123' }); // { valid } ; used for server-to-server rewards
-
-const { capped } = await LevelPlay.isPlacementCapped({ format: 'rewarded', placementName: 'Shop' });
-const reward = await LevelPlay.getReward({ adUnitId: ids.rewarded, placementName: 'Shop' }); // { name, amount }
-await LevelPlay.showRewarded({ adUnitId: ids.rewarded, placementName: 'Shop' });
-```
-
-`setSegment` takes at most 5 custom parameters, keys and values 1-32 letters and digits (SDK limits); invalid input
-rejects with `INVALID_ARGUMENT` instead of being dropped silently by the SDK.
-
-### Error codes
-
-Calls reject with a `code`: `INVALID_ARGUMENT`, `NOT_INITIALIZED` (banner / native before `initialize()`),
-`ALREADY_EXISTS` (banner id in use), `NOT_FOUND` (unknown banner or native id), `NOT_LOADED` (`showNativeAd` before
-`nativeAdLoaded`), `UNSUPPORTED`, `NO_ACTIVITY` (Android) / `NO_VIEW_CONTROLLER` (iOS), `UNIMPLEMENTED` (web).
-`hideBanner` and the `destroy*` calls resolve for unknown ids. Ad load and show errors arrive in events as
-`{ code, message }` with the SDK's code (509 is "no fill").
-
### Integration Test Suite
The [Integration Test Suite](https://docs.unity.com/en-us/grow/levelplay/sdk/android/integration-test-suite) shows every
@@ -465,26 +331,15 @@ await LevelPlay.setMetaData({ key: 'is_deviceid_optout', value: 'true' });
([Mediation-Demo-Apps](https://github.com/ironsource-mobile/Mediation-Demo-Apps)). They serve test ads; never ship
them.
-| Platform | App key | Rewarded | Interstitial | Banner |
-|---|---|---|---|---|
-| Android | `25b63cf85` | `syz3d8ekts22q0or` | `h3xw38h9214adgxo` | `4fpetq4lhe5lsw3e` |
-| iOS | `8545d445` | `qwouvdrkuwivay5q` | `wmgt0712uuux8ju4` | `iep3rxsyp9na3rw8` |
-
-The sample apps have no native ad unit; native ads load with the app key's default placement.
+| Platform | App key | Rewarded | Interstitial |
+|---|---|---|---|
+| Android | `25b63cf85` | `syz3d8ekts22q0or` | `h3xw38h9214adgxo` |
+| iOS | `8545d445` | `qwouvdrkuwivay5q` | `wmgt0712uuux8ju4` |
### Web
LevelPlay has no web SDK. On the web `initialize` and `launchTestSuite` reject as unimplemented, `isReady` is always
-`false` and shows resolve `{ shown: false, rewarded: false, error: { code: -1, ... } }`. `getCapabilities()` reports
-nothing supported; `createBanner`, `showBanner`, `setBannerLayout`, `loadNativeAd` and `showNativeAd` reject as
-unimplemented; `setSegment`, `loadBanner`, hide and destroy calls are no-ops; `setDynamicUserId` resolves
-`{ valid: false }`, `isPlacementCapped` `{ capped: false }` and `getReward` `{ name: '', amount: 0 }`.
-
-## Example app
-
-[`example-app/`](example-app/) is a minimal Capacitor 8 app (HTML + TypeScript) that uses the plugin from this
-repository with the demo ids: initialize, rewarded, interstitial, banner top / bottom / hide / destroy, native small /
-medium, segment and an impression log. See its [README](example-app/README.md) for the steps.
+`false` and shows resolve `{ shown: false, rewarded: false, error: { code: -1, ... } }`.
## Mediation adapters
@@ -597,21 +452,6 @@ if (status === 'notDetermined') await LevelPlay.requestTrackingAuthorization();
await LevelPlay.initialize({ appKey });
```
-## Limitations
-
-- **Native ads need per-network setup.** Only networks that serve native ads through LevelPlay fill them, and each
- needs its adapter and a native ad configuration in the dashboard. The public demo app key has no native
- configuration on Android (508 "No Native Ad configurations found"); on iOS it filled from ironSource Ads in testing.
-- **Native ads use the plugin's templates.** Custom native layouts in HTML are not possible: the SDK requires its own
- native views (and the network's privacy icon) to record impressions and clicks.
-- **`loadBanner` is one-shot** per banner object (an SDK rule in 9.6.1): a second call is ignored and the SDK retries
- on its refresh interval. To retry right away, `destroyBanner` + `createBanner` + `loadBanner`.
-- **`-ObjC` is required on iOS**, also for the new APIs: without it `setSegment` crashes with an unrecognized selector.
-- **No `adInfoChanged` for banners and native ads**: the SDK only reports it for rewarded and interstitial ads.
-- **`lifetimeRevenue` is not typed** in `ImpressionData`; read it from `allData.lifetimeRevenue` when present.
-- **Overlay ads**: banners and native ads are native views above the WebView, so CSS cannot clip, transform or
- animate them; move them with `setBannerLayout` / `setNativeAdRect` and hide them under your own modals.
-
## Troubleshooting
### Loads fail with 509 "No fill"
@@ -664,21 +504,16 @@ legacy `IronSource.*` placement API is not used.
Yes. Every call takes an `adUnitId`, and the plugin keeps one native ad object per id.
**Does it support banners or native ads?**
-Yes, since 0.3.0: banners in every LevelPlay size (including adaptive and custom sizes) and native ads in two
-templates. See [Banners](#banners) and [Native ads](#native-ads).
-
-**Does it work with Capacitor 7?**
-Yes, since 0.3.0 (`@capacitor/core` >= 7.0.0). Android and iOS (Swift Package Manager) builds were checked with a
-Capacitor 7.6.9 app.
+No. It focuses on full-screen formats.
**How is this different from `capacitor-levelplay-ads`?**
-Both are Capacitor plugins for LevelPlay and both use the ad-unit API. The differences, as of `capacitor-levelplay-ads`
+Both are Capacitor 8 plugins for LevelPlay and both use the ad-unit API. The differences, as of `capacitor-levelplay-ads`
0.1.42:
| | `capacitor-levelplay` | `capacitor-levelplay-ads` |
|---|---|---|
| iOS integration | SPM first: `Package.swift` depends on `LevelPlay-Swift-Package`; podspec as alternative | CocoaPods first; its `Package.swift` does not depend on the SDK (SDK code is compiled out unless you add a package yourself) |
-| Formats | rewarded, interstitial, banner, native (templates) | banner, rewarded, interstitial |
+| Formats | rewarded, interstitial | banner, rewarded, interstitial |
| Ad units | any number per format side by side, addressed by `adUnitId` | one ad object per format at a time |
| Show result | promise resolves after close with `{ shown, rewarded, reward }` | outcome via events |
| Consent | GDPR / CCPA / COPPA flags; bring your own CMP | built-in consent flows (own consent modal, optional Usercentrics / InMobi CMP) |
@@ -707,22 +542,6 @@ covered by Unity's terms.
* [`isReady(...)`](#isready)
* [`launchTestSuite()`](#launchtestsuite)
* [`validateIntegration()`](#validateintegration)
-* [`getCapabilities()`](#getcapabilities)
-* [`setSegment(...)`](#setsegment)
-* [`setDynamicUserId(...)`](#setdynamicuserid)
-* [`isPlacementCapped(...)`](#isplacementcapped)
-* [`getReward(...)`](#getreward)
-* [`createBanner(...)`](#createbanner)
-* [`loadBanner(...)`](#loadbanner)
-* [`showBanner(...)`](#showbanner)
-* [`hideBanner(...)`](#hidebanner)
-* [`setBannerLayout(...)`](#setbannerlayout)
-* [`destroyBanner(...)`](#destroybanner)
-* [`loadNativeAd(...)`](#loadnativead)
-* [`showNativeAd(...)`](#shownativead)
-* [`setNativeAdRect(...)`](#setnativeadrect)
-* [`hideNativeAd(...)`](#hidenativead)
-* [`destroyNativeAd(...)`](#destroynativead)
* [`addListener('loaded', ...)`](#addlistenerloaded-)
* [`addListener('loadFailed', ...)`](#addlistenerloadfailed-)
* [`addListener('displayed', ...)`](#addlistenerdisplayed-)
@@ -730,20 +549,6 @@ covered by Unity's terms.
* [`addListener('clicked', ...)`](#addlistenerclicked-)
* [`addListener('closed', ...)`](#addlistenerclosed-)
* [`addListener('rewarded', ...)`](#addlistenerrewarded-)
-* [`addListener('adInfoChanged', ...)`](#addlisteneradinfochanged-)
-* [`addListener('impressionData', ...)`](#addlistenerimpressiondata-)
-* [`addListener('bannerLoaded', ...)`](#addlistenerbannerloaded-)
-* [`addListener('bannerLoadFailed', ...)`](#addlistenerbannerloadfailed-)
-* [`addListener('bannerDisplayed', ...)`](#addlistenerbannerdisplayed-)
-* [`addListener('bannerDisplayFailed', ...)`](#addlistenerbannerdisplayfailed-)
-* [`addListener('bannerClicked', ...)`](#addlistenerbannerclicked-)
-* [`addListener('bannerExpanded', ...)`](#addlistenerbannerexpanded-)
-* [`addListener('bannerCollapsed', ...)`](#addlistenerbannercollapsed-)
-* [`addListener('bannerLeftApplication', ...)`](#addlistenerbannerleftapplication-)
-* [`addListener('nativeAdLoaded', ...)`](#addlistenernativeadloaded-)
-* [`addListener('nativeAdLoadFailed', ...)`](#addlistenernativeadloadfailed-)
-* [`addListener('nativeAdImpression', ...)`](#addlistenernativeadimpression-)
-* [`addListener('nativeAdClicked', ...)`](#addlistenernativeadclicked-)
* [`removeAllListeners()`](#removealllisteners)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)
@@ -753,8 +558,7 @@ covered by Unity's terms.
-Unity LevelPlay ads (ad-unit API): rewarded, interstitial and (since 0.3.0) banner and native ads, impression-level
-revenue, segments and placement capping.
+Unity LevelPlay rewarded and interstitial ads (ad-unit API).
### initialize(...)
@@ -988,314 +792,6 @@ Write the LevelPlay integration helper report to the native log (Xcode console;
--------------------
-### getCapabilities()
-
-```typescript
-getCapabilities() => Promise
-```
-
-What this platform supports (banners, native ad templates, impression data, `adInfoChanged`). Works before init.
-Web: everything `false`.
-
-**Returns:** Promise<Capabilities>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### setSegment(...)
-
-```typescript
-setSegment(options: SegmentOptions) => Promise
-```
-
-Set the user segment (`LevelPlay.setSegment` with a `LevelPlaySegment` / `LPMSegment`). Call it before
-`initialize()` so the first ad requests use it; later calls apply to the following requests. Rejects with
-`INVALID_ARGUMENT` when `customParameters` break the SDK limits. Web: no-op.
-
-| Param | Type |
-| ------------- | --------------------------------------------------------- |
-| **`options`** | SegmentOptions |
-
-**Since:** 0.3.0
-
---------------------
-
-
-### setDynamicUserId(...)
-
-```typescript
-setDynamicUserId(options: DynamicUserIdOptions) => Promise
-```
-
-Set or change the dynamic user id used in server-to-server reward callbacks (`LevelPlay.setDynamicUserId` on
-both platforms). Set it before `showRewarded()`. Web: resolves `{ valid: false }`.
-
-| Param | Type |
-| ------------- | --------------------------------------------------------------------- |
-| **`options`** | DynamicUserIdOptions |
-
-**Returns:** Promise<DynamicUserIdResult>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### isPlacementCapped(...)
-
-```typescript
-isPlacementCapped(options: PlacementCappedOptions) => Promise
-```
-
-Whether a rewarded or interstitial placement is capped right now (static
-`LevelPlayRewardedAd.isPlacementCapped` / `LevelPlayInterstitialAd.isPlacementCapped` on Android,
-`LPMRewardedAd.isPlacementCapped:` / `LPMInterstitialAd.isPlacementCapped:` on iOS). Works without a loaded ad.
-Web: `{ capped: false }`.
-
-| Param | Type |
-| ------------- | ------------------------------------------------------------------------- |
-| **`options`** | PlacementCappedOptions |
-
-**Returns:** Promise<PlacementCappedResult>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### getReward(...)
-
-```typescript
-getReward(options: GetRewardOptions) => Promise
-```
-
-The reward configured for a rewarded ad unit or one of its placements (`LevelPlayRewardedAd.getReward(placement)` /
-`LPMRewardedAd getReward(placementName:)`), for "watch a video for N coins" buttons. The SDK returns
-`{ name: '', amount: 0 }` when it has no reward configuration (for example before init). Web: the same empty
-reward.
-
-| Param | Type |
-| ------------- | ------------------------------------------------------------- |
-| **`options`** | GetRewardOptions |
-
-**Returns:** Promise<Reward>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### createBanner(...)
-
-```typescript
-createBanner(options: CreateBannerOptions) => Promise
-```
-
-Create a banner (`LevelPlayBannerAdView` / `LPMBannerAdView`) for the ad unit and attach it, hidden, in a
-pass-through overlay above the WebView. Requires a finished `initialize()` (`NOT_INITIALIZED` otherwise). Rejects
-with `ALREADY_EXISTS` when `bannerId` is in use; destroy it first. Does not load: call `loadBanner()`.
-Web: rejects as unimplemented.
-
-| Param | Type |
-| ------------- | ------------------------------------------------------------------- |
-| **`options`** | CreateBannerOptions |
-
-**Returns:** Promise<BannerResult>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### loadBanner(...)
-
-```typescript
-loadBanner(options: BannerIdOptions) => Promise
-```
-
-Load the banner (`loadAd()` / `loadAdWithViewController:`). The outcome arrives as `bannerLoaded` or
-`bannerLoadFailed`; after the first load the SDK refreshes the banner on the dashboard interval. The SDK accepts
-one load per banner object: calling it again has no effect (Android logs "Banner load already called"), so to retry
-right away after `bannerLoadFailed`, destroy the banner and create it again. Web: no-op.
-
-| Param | Type |
-| ------------- | ----------------------------------------------------------- |
-| **`options`** | BannerIdOptions |
-
-**Since:** 0.3.0
-
---------------------
-
-
-### showBanner(...)
-
-```typescript
-showBanner(options: BannerIdOptions) => Promise
-```
-
-Make the banner visible and resume auto refresh (`resumeAutoRefresh`). Can be called before the load finished;
-the creative appears when it arrives. Web: rejects as unimplemented.
-
-| Param | Type |
-| ------------- | ----------------------------------------------------------- |
-| **`options`** | BannerIdOptions |
-
-**Returns:** Promise<BannerResult>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### hideBanner(...)
-
-```typescript
-hideBanner(options: BannerIdOptions) => Promise
-```
-
-Hide the banner and pause auto refresh (`pauseAutoRefresh`) so hidden banners do not burn impressions. The view
-stays attached; `showBanner()` brings it back. Web: no-op.
-
-| Param | Type |
-| ------------- | ----------------------------------------------------------- |
-| **`options`** | BannerIdOptions |
-
-**Since:** 0.3.0
-
---------------------
-
-
-### setBannerLayout(...)
-
-```typescript
-setBannerLayout(options: SetBannerLayoutOptions) => Promise
-```
-
-Move a banner (position, offsets, safe area). Resolves with the new frame. Web: rejects as unimplemented.
-
-| Param | Type |
-| ------------- | ------------------------------------------------------------------------- |
-| **`options`** | SetBannerLayoutOptions |
-
-**Returns:** Promise<BannerResult>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### destroyBanner(...)
-
-```typescript
-destroyBanner(options: BannerIdOptions) => Promise
-```
-
-Remove the banner from the screen and `destroy()` it. A destroyed banner cannot be reused; create a new one.
-Resolves also for unknown ids. Web: no-op.
-
-| Param | Type |
-| ------------- | ----------------------------------------------------------- |
-| **`options`** | BannerIdOptions |
-
-**Since:** 0.3.0
-
---------------------
-
-
-### loadNativeAd(...)
-
-```typescript
-loadNativeAd(options: LoadNativeAdOptions) => Promise
-```
-
-Load a native ad into a slot. Following the SDK rule "one native ad object per load", it destroys the slot's
-previous ad (hiding it if shown), builds a new `LevelPlayNativeAd` with the placement and loads it. The outcome
-arrives as `nativeAdLoaded` or `nativeAdLoadFailed`. Requires a finished `initialize()`. Rejects with
-`UNSUPPORTED` when `getCapabilities().nativeAd` is `false` or the template is not listed there. Web: rejects as
-unimplemented.
-
-| Param | Type |
-| ------------- | ------------------------------------------------------------------- |
-| **`options`** | LoadNativeAdOptions |
-
-**Since:** 0.3.0
-
---------------------
-
-
-### showNativeAd(...)
-
-```typescript
-showNativeAd(options: NativeAdRectOptions) => Promise
-```
-
-Render the loaded native ad into its template, register the asset views with the SDK
-(`NativeAdLayout.registerNativeAdViews` / `ISNativeAdView registerNativeAdViews:`) and place it at `rect` above the
-WebView. Rejects with `NOT_LOADED` before `nativeAdLoaded`. The impression is reported by `nativeAdImpression`.
-Web: rejects as unimplemented.
-
-| Param | Type |
-| ------------- | ------------------------------------------------------------------- |
-| **`options`** | NativeAdRectOptions |
-
-**Since:** 0.3.0
-
---------------------
-
-
-### setNativeAdRect(...)
-
-```typescript
-setNativeAdRect(options: NativeAdRectOptions) => Promise
-```
-
-Move or resize a shown native ad, for example after the placeholder element moved. Web: no-op.
-
-| Param | Type |
-| ------------- | ------------------------------------------------------------------- |
-| **`options`** | NativeAdRectOptions |
-
-**Since:** 0.3.0
-
---------------------
-
-
-### hideNativeAd(...)
-
-```typescript
-hideNativeAd(options: NativeAdIdOptions) => Promise
-```
-
-Hide a shown native ad (the view stays registered; `showNativeAd()` shows it again). Web: no-op.
-
-| Param | Type |
-| ------------- | --------------------------------------------------------------- |
-| **`options`** | NativeAdIdOptions |
-
-**Since:** 0.3.0
-
---------------------
-
-
-### destroyNativeAd(...)
-
-```typescript
-destroyNativeAd(options: NativeAdIdOptions) => Promise
-```
-
-Remove the native ad view and `destroyAd()` it. Resolves also for unknown ids. Web: no-op.
-
-| Param | Type |
-| ------------- | --------------------------------------------------------------- |
-| **`options`** | NativeAdIdOptions |
-
-**Since:** 0.3.0
-
---------------------
-
-
### addListener('loaded', ...)
```typescript
@@ -1436,290 +932,6 @@ Rewarded only: the user earned the reward. Can fire before or after `closed`.
--------------------
-### addListener('adInfoChanged', ...)
-
-```typescript
-addListener(eventName: 'adInfoChanged', listenerFunc: (event: AdEvent) => void) => Promise
-```
-
-Rewarded and interstitial: the SDK reloaded the ad in the background and its ad info (network, revenue ...)
-changed (`onAdInfoChanged` / `didChangeAdInfo:`). Banners and native ads have no such callback in SDK 9.6.1.
-
-| Param | Type |
-| ------------------ | --------------------------------------------------------------- |
-| **`eventName`** | 'adInfoChanged' |
-| **`listenerFunc`** | (event: AdEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('impressionData', ...)
-
-```typescript
-addListener(eventName: 'impressionData', listenerFunc: (event: ImpressionData) => void) => Promise
-```
-
-Impression-level revenue data for every rewarded, interstitial and banner impression (per-ad
-`setImpressionDataListener` / `setImpressionDataDelegate:`, attached by the plugin to every ad object it creates),
-plus native ad impressions synthesised from the native ad info (`adFormat: 'nativead'`, `adInfo` fields only).
-Add the listener at any time, also before `initialize()`; nothing is delivered before the first ad shows.
-
-| Param | Type |
-| ------------------ | ----------------------------------------------------------------------------- |
-| **`eventName`** | 'impressionData' |
-| **`listenerFunc`** | (event: ImpressionData) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('bannerLoaded', ...)
-
-```typescript
-addListener(eventName: 'bannerLoaded', listenerFunc: (event: BannerEvent) => void) => Promise
-```
-
-A banner loaded or refreshed with a new creative.
-
-| Param | Type |
-| ------------------ | ----------------------------------------------------------------------- |
-| **`eventName`** | 'bannerLoaded' |
-| **`listenerFunc`** | (event: BannerEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('bannerLoadFailed', ...)
-
-```typescript
-addListener(eventName: 'bannerLoadFailed', listenerFunc: (event: BannerErrorEvent) => void) => Promise
-```
-
-A banner load (or refresh) failed. The SDK keeps retrying on its refresh interval.
-
-| Param | Type |
-| ------------------ | --------------------------------------------------------------------------------- |
-| **`eventName`** | 'bannerLoadFailed' |
-| **`listenerFunc`** | (event: BannerErrorEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('bannerDisplayed', ...)
-
-```typescript
-addListener(eventName: 'bannerDisplayed', listenerFunc: (event: BannerEvent) => void) => Promise
-```
-
-A banner creative was displayed on screen (impression).
-
-| Param | Type |
-| ------------------ | ----------------------------------------------------------------------- |
-| **`eventName`** | 'bannerDisplayed' |
-| **`listenerFunc`** | (event: BannerEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('bannerDisplayFailed', ...)
-
-```typescript
-addListener(eventName: 'bannerDisplayFailed', listenerFunc: (event: BannerErrorEvent) => void) => Promise
-```
-
-A banner creative failed to display.
-
-| Param | Type |
-| ------------------ | --------------------------------------------------------------------------------- |
-| **`eventName`** | 'bannerDisplayFailed' |
-| **`listenerFunc`** | (event: BannerErrorEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('bannerClicked', ...)
-
-```typescript
-addListener(eventName: 'bannerClicked', listenerFunc: (event: BannerEvent) => void) => Promise
-```
-
-The user clicked a banner.
-
-| Param | Type |
-| ------------------ | ----------------------------------------------------------------------- |
-| **`eventName`** | 'bannerClicked' |
-| **`listenerFunc`** | (event: BannerEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('bannerExpanded', ...)
-
-```typescript
-addListener(eventName: 'bannerExpanded', listenerFunc: (event: BannerEvent) => void) => Promise
-```
-
-A banner opened full screen (for example an expandable creative). Pause the game.
-
-| Param | Type |
-| ------------------ | ----------------------------------------------------------------------- |
-| **`eventName`** | 'bannerExpanded' |
-| **`listenerFunc`** | (event: BannerEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('bannerCollapsed', ...)
-
-```typescript
-addListener(eventName: 'bannerCollapsed', listenerFunc: (event: BannerEvent) => void) => Promise
-```
-
-A banner returned to its normal size. Resume the game.
-
-| Param | Type |
-| ------------------ | ----------------------------------------------------------------------- |
-| **`eventName`** | 'bannerCollapsed' |
-| **`listenerFunc`** | (event: BannerEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('bannerLeftApplication', ...)
-
-```typescript
-addListener(eventName: 'bannerLeftApplication', listenerFunc: (event: BannerEvent) => void) => Promise
-```
-
-A banner click sent the user out of the app (browser or store).
-
-| Param | Type |
-| ------------------ | ----------------------------------------------------------------------- |
-| **`eventName`** | 'bannerLeftApplication' |
-| **`listenerFunc`** | (event: BannerEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('nativeAdLoaded', ...)
-
-```typescript
-addListener(eventName: 'nativeAdLoaded', listenerFunc: (event: NativeAdEvent) => void) => Promise
-```
-
-A native ad loaded and can be shown with `showNativeAd()`.
-
-| Param | Type |
-| ------------------ | --------------------------------------------------------------------------- |
-| **`eventName`** | 'nativeAdLoaded' |
-| **`listenerFunc`** | (event: NativeAdEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('nativeAdLoadFailed', ...)
-
-```typescript
-addListener(eventName: 'nativeAdLoadFailed', listenerFunc: (event: NativeAdErrorEvent) => void) => Promise
-```
-
-A native ad failed to load. Load again later (the plugin already destroyed the failed ad object).
-
-| Param | Type |
-| ------------------ | ------------------------------------------------------------------------------------- |
-| **`eventName`** | 'nativeAdLoadFailed' |
-| **`listenerFunc`** | (event: NativeAdErrorEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('nativeAdImpression', ...)
-
-```typescript
-addListener(eventName: 'nativeAdImpression', listenerFunc: (event: NativeAdEvent) => void) => Promise
-```
-
-A shown native ad recorded its impression (first pixel visible).
-
-| Param | Type |
-| ------------------ | --------------------------------------------------------------------------- |
-| **`eventName`** | 'nativeAdImpression' |
-| **`listenerFunc`** | (event: NativeAdEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
-### addListener('nativeAdClicked', ...)
-
-```typescript
-addListener(eventName: 'nativeAdClicked', listenerFunc: (event: NativeAdEvent) => void) => Promise
-```
-
-The user clicked a native ad.
-
-| Param | Type |
-| ------------------ | --------------------------------------------------------------------------- |
-| **`eventName`** | 'nativeAdClicked' |
-| **`listenerFunc`** | (event: NativeAdEvent) => void |
-
-**Returns:** Promise<PluginListenerHandle>
-
-**Since:** 0.3.0
-
---------------------
-
-
### removeAllListeners()
```typescript
@@ -1838,39 +1050,20 @@ Error reported by the SDK (load / display failures) or by the plugin.
Subset of the native `LevelPlayAdInfo` (Android) / `LPMAdInfo` (iOS) that is useful in JavaScript.
Fields the SDK does not report are omitted.
-| Prop | Type | Description | Since |
-| --------------------- | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
-| **`adId`** | string | Unique id of this ad. | 0.1.0 |
-| **`adUnitId`** | string | Ad unit id. | 0.1.0 |
-| **`adUnitName`** | string | Ad unit name from the dashboard. | 0.1.0 |
-| **`adFormat`** | string | Ad format as reported by the SDK. | 0.1.0 |
-| **`placementName`** | string | Placement name of the show call, when one was used. | 0.1.0 |
-| **`adNetwork`** | string | Name of the mediated network that served the ad. | 0.1.0 |
-| **`instanceName`** | string | Mediation instance name. | 0.1.0 |
-| **`instanceId`** | string | Mediation instance id. | 0.1.0 |
-| **`country`** | string | Country code of the impression. | 0.1.0 |
-| **`auctionId`** | string | Auction id. | 0.1.0 |
-| **`revenue`** | number | Impression revenue in USD as reported by the SDK (may be absent or 0 before display). | 0.1.0 |
-| **`precision`** | string | Revenue precision as reported by the SDK. | 0.1.0 |
-| **`ab`** | string | A/B test group of the user (`ab`). | 0.3.0 |
-| **`segmentName`** | string | Segment name of the user, see `setSegment()`. | 0.3.0 |
-| **`encryptedCPM`** | string | Encrypted CPM (`encryptedCPM`). | 0.3.0 |
-| **`creativeId`** | string | Creative id of the served ad, when the network reports one. | 0.3.0 |
-| **`conversionValue`** | number | iOS only: SKAdNetwork conversion value (`LPMAdInfo.conversionValue`). Android's `LevelPlayAdInfo` has no such field in SDK 9.6.1, so it is always absent there. | 0.3.0 |
-| **`adSize`** | AdSizeInfo | Size of the ad. Banners only (`LevelPlayAdInfo.getAdSize()` / `LPMAdInfo.adSize`). | 0.3.0 |
-
-
-#### AdSizeInfo
-
-A resolved ad size as reported by the SDK (`LevelPlayAdSize` / `LPMAdSize`). Width and height are in dp on Android
-and points on iOS, which equal CSS px in the WebView at the default zoom.
-
-| Prop | Type | Description | Since |
-| ----------------- | -------------------- | ---------------------------------------------------------------- | ----- |
-| **`width`** | number | Width in CSS px (dp / pt). | 0.3.0 |
-| **`height`** | number | Height in CSS px (dp / pt). | 0.3.0 |
-| **`description`** | string | SDK description of the size, for example `BANNER` or `ADAPTIVE`. | 0.3.0 |
-| **`isAdaptive`** | boolean | `true` for an adaptive size. | 0.3.0 |
+| Prop | Type | Description | Since |
+| ------------------- | ------------------- | ------------------------------------------------------------------------------------- | ----- |
+| **`adId`** | string | Unique id of this ad. | 0.1.0 |
+| **`adUnitId`** | string | Ad unit id. | 0.1.0 |
+| **`adUnitName`** | string | Ad unit name from the dashboard. | 0.1.0 |
+| **`adFormat`** | string | Ad format as reported by the SDK. | 0.1.0 |
+| **`placementName`** | string | Placement name of the show call, when one was used. | 0.1.0 |
+| **`adNetwork`** | string | Name of the mediated network that served the ad. | 0.1.0 |
+| **`instanceName`** | string | Mediation instance name. | 0.1.0 |
+| **`instanceId`** | string | Mediation instance id. | 0.1.0 |
+| **`country`** | string | Country code of the impression. | 0.1.0 |
+| **`auctionId`** | string | Auction id. | 0.1.0 |
+| **`revenue`** | number | Impression revenue in USD as reported by the SDK (may be absent or 0 before display). | 0.1.0 |
+| **`precision`** | string | Revenue precision as reported by the SDK. | 0.1.0 |
#### ShowOptions
@@ -1900,199 +1093,6 @@ Options for `isReady()`: `adUnitId` (see AdUnitOptions<
| **`format`** | AdFormat | Format of the ad unit. | 0.1.0 |
-#### Capabilities
-
-Result of `getCapabilities()`: what this platform build of the plugin can do. Check it instead of the platform
-name, so the same game code runs on Android, iOS and the web.
-
-| Prop | Type | Description | Since |
-| ----------------------- | ------------------------------- | ------------------------------------------------------------------------------- | ----- |
-| **`banner`** | boolean | Banner ads (`createBanner()` and friends) are available. | 0.3.0 |
-| **`nativeAd`** | boolean | Native ads (`loadNativeAd()` and friends) are available. | 0.3.0 |
-| **`nativeAdTemplates`** | NativeAdTemplate[] | Native ad templates this platform can render. Empty when `nativeAd` is `false`. | 0.3.0 |
-| **`impressionData`** | boolean | The `impressionData` event is delivered. | 0.3.0 |
-| **`adInfoChanged`** | boolean | The `adInfoChanged` event is delivered (rewarded and interstitial only). | 0.3.0 |
-
-
-#### SegmentOptions
-
-Options for `setSegment()` (`LevelPlaySegment` / `LPMSegment`). Omitted fields are not sent.
-
-| Prop | Type | Description | Since |
-| ---------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
-| **`segmentName`** | string | Segment name. | 0.3.0 |
-| **`level`** | number | User level (integer). | 0.3.0 |
-| **`isPaying`** | boolean | The user has paid in the app. | 0.3.0 |
-| **`userCreationDate`** | number | When the user was created, in milliseconds since the Unix epoch (`Date.now()` style). | 0.3.0 |
-| **`iapTotal`** | number | Total in-app purchase amount of the user (USD). | 0.3.0 |
-| **`customParameters`** | { [key: string]: string; } | Custom segment parameters. SDK 9.6.1 limits: at most 5 pairs; keys and values 1-32 characters, letters and digits only (`^[a-zA-Z0-9]*$`). The plugin rejects with `INVALID_ARGUMENT` instead of letting the SDK silently drop pairs. | 0.3.0 |
-
-
-#### DynamicUserIdResult
-
-Result of `setDynamicUserId()`.
-
-| Prop | Type | Description | Since |
-| ----------- | -------------------- | ------------------------------------------------------------------------------------------- | ----- |
-| **`valid`** | boolean | The SDK accepted the id (`LevelPlay.setDynamicUserId` returns a boolean on both platforms). | 0.3.0 |
-
-
-#### DynamicUserIdOptions
-
-Options for `setDynamicUserId()`.
-
-| Prop | Type | Description | Since |
-| ------------ | ------------------- | ----------------------------------------------------------------------------------------------- | ----- |
-| **`userId`** | string | Dynamic user id, forwarded in server-to-server reward callbacks. Can change during the session. | 0.3.0 |
-
-
-#### PlacementCappedResult
-
-Result of `isPlacementCapped()`.
-
-| Prop | Type | Description | Since |
-| ------------ | -------------------- | ------------------------------------------------------------------------------------ | ----- |
-| **`capped`** | boolean | `true` when the placement reached its capping or pacing limit; showing it now fails. | 0.3.0 |
-
-
-#### PlacementCappedOptions
-
-Options for `isPlacementCapped()`.
-
-| Prop | Type | Description | Since |
-| ------------------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----- |
-| **`format`** | AdFormat | Format of the placement. LevelPlay 9.6.1 has capping checks for rewarded and interstitial only. | 0.3.0 |
-| **`placementName`** | string | Placement name from the LevelPlay dashboard. | 0.3.0 |
-
-
-#### GetRewardOptions
-
-Options for `getReward()`: `adUnitId` (see AdUnitOptions) plus an optional placement.
-
-| Prop | Type | Description | Since |
-| ------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------- | ----- |
-| **`placementName`** | string | Placement whose reward to read. Its reward takes precedence over the ad unit reward. Omit for the ad unit reward. | 0.3.0 |
-
-
-#### BannerResult
-
-Result of `createBanner()`, `showBanner()` and `setBannerLayout()`.
-
-| Prop | Type | Description | Since |
-| -------------- | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
-| **`bannerId`** | string | The banner id. | 0.3.0 |
-| **`adSize`** | AdSizeInfo | Requested ad size (the creative may be smaller for adaptive sizes; it is centred in this frame). | 0.3.0 |
-| **`frame`** | Rect | Where the banner frame is (or will be, while hidden) in CSS px, relative to the WebView viewport. Use it to pad game UI away from the banner. | 0.3.0 |
-| **`visible`** | boolean | The banner view is currently visible. | 0.3.0 |
-
-
-#### Rect
-
-A rectangle in CSS px, relative to the top-left corner of the WebView viewport (the same space as
-`element.getBoundingClientRect()` without page scroll).
-
-| Prop | Type | Description | Since |
-| ------------ | ------------------- | -------------------- | ----- |
-| **`x`** | number | Left edge in CSS px. | 0.3.0 |
-| **`y`** | number | Top edge in CSS px. | 0.3.0 |
-| **`width`** | number | Width in CSS px. | 0.3.0 |
-| **`height`** | number | Height in CSS px. | 0.3.0 |
-
-
-#### CreateBannerOptions
-
-Options for `createBanner()`.
-
-| Prop | Type | Description | Default | Since |
-| ------------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | ----- |
-| **`bannerId`** | string | Plugin-side id of this banner, used by every other banner method and in banner events. Lets one ad unit back several banners. Defaults to `adUnitId`. | | 0.3.0 |
-| **`size`** | BannerSize | Size preset. | 'ADAPTIVE' | 0.3.0 |
-| **`customSize`** | BannerCustomSize | `CUSTOM` only: the banner size. When `customSize` is set and `size` is omitted, `size` defaults to `CUSTOM`. | | 0.3.0 |
-| **`adaptiveWidth`** | number | `ADAPTIVE` only: width in CSS px to compute the adaptive size for. Defaults to the width of the WebView's safe area; in that case the plugin recreates and reloads the banner automatically when that width changes (rotation, split screen, window resize), keeping its id, layout and visibility. A fixed `adaptiveWidth` is never recreated. | | 0.3.0 |
-| **`placementName`** | string | Placement name (reporting only for banners). Applied through the banner config before the first load. | | 0.3.0 |
-| **`bidFloor`** | number | Bid floor in USD (`LevelPlayBannerAdView.Config.Builder.setBidFloor` / `LPMBannerAdViewConfigBuilder set(bidFloor:)`). | | 0.3.0 |
-
-
-#### BannerCustomSize
-
-Width and height of a `CUSTOM` banner, in CSS px (dp on Android, points on iOS).
-
-| Prop | Type | Description | Since |
-| ------------ | ------------------- | ------------------------------------ | ----- |
-| **`width`** | number | Width in CSS px (positive integer). | 0.3.0 |
-| **`height`** | number | Height in CSS px (positive integer). | 0.3.0 |
-
-
-#### BannerIdOptions
-
-Identifies one banner created with `createBanner()`.
-
-| Prop | Type | Description | Since |
-| -------------- | ------------------- | ------------------------------------------------------------------------------------ | ----- |
-| **`bannerId`** | string | Plugin-side banner id passed to `createBanner()` (defaults to the ad unit id there). | 0.3.0 |
-
-
-#### SetBannerLayoutOptions
-
-Options for `setBannerLayout()`: `bannerId` plus the layout fields (see BannerLayoutOptions).
-
-
-#### LoadNativeAdOptions
-
-Options for `loadNativeAd()`.
-
-| Prop | Type | Description | Default | Since |
-| ------------------- | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ----- |
-| **`placementName`** | string | Placement name. LevelPlay 9.6.1 native ads are addressed by placement only (`LevelPlayNativeAd.Builder .withPlacementName` / `LevelPlayNativeAdBuilder withPlacementName:`); there is no ad unit id for native ads in this SDK version. Omit it for the default placement. | | 0.3.0 |
-| **`template`** | NativeAdTemplate | Template used when the ad is shown. | 'medium' | 0.3.0 |
-| **`style`** | NativeAdTemplateStyle | Template styling. | | 0.3.0 |
-
-
-#### NativeAdTemplateStyle
-
-Optional styling of a native ad template. Colours are CSS hex strings (`#RRGGBB` or `#RRGGBBAA`).
-
-| Prop | Type | Description | Default | Since |
-| --------------------------------- | ----------------------------------------------------- | ---------------------------------------- | -------------- | ----- |
-| **`backgroundColor`** | string | Template background. | | 0.3.0 |
-| **`titleColor`** | string | Title text colour. | | 0.3.0 |
-| **`bodyColor`** | string | Body and advertiser text colour. | | 0.3.0 |
-| **`callToActionBackgroundColor`** | string | Call-to-action button background. | | 0.3.0 |
-| **`callToActionTextColor`** | string | Call-to-action button text colour. | | 0.3.0 |
-| **`cornerRadius`** | number | Corner radius of the template in CSS px. | 0 | 0.3.0 |
-| **`titleFont`** | NativeAdFont | Title font. | | 0.3.0 |
-| **`bodyFont`** | NativeAdFont | Body and advertiser font. | | 0.3.0 |
-| **`callToActionFont`** | NativeAdFont | Call-to-action button font. | | 0.3.0 |
-
-
-#### NativeAdFont
-
-A font of a native ad template text. Omitted fields keep the template default (system font).
-
-| Prop | Type | Description | Since |
-| ------------ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
-| **`family`** | string | Font family. Either a system family name (Android: `sans-serif`, `sans-serif-medium`, `serif`, `monospace` ...; iOS: a `UIFont` family or PostScript name such as `Avenir Next` or `Menlo-Bold`), or the path of a `.ttf` / `.otf` file inside the app's web assets, relative to the web root (for example `fonts/Inter-Bold.ttf`, the same file the page loads with `@font-face`). Unknown families fall back to the system font. | 0.3.0 |
-| **`size`** | number | Font size in CSS px (dp / pt; not scaled by the system font size setting, like text in the WebView). | 0.3.0 |
-
-
-#### NativeAdRectOptions
-
-Options for `showNativeAd()` and `setNativeAdRect()`.
-
-| Prop | Type | Description | Since |
-| ---------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ----- |
-| **`rect`** | Rect | Where the template goes, in CSS px relative to the WebView viewport (for example a placeholder element's `getBoundingClientRect()`). | 0.3.0 |
-
-
-#### NativeAdIdOptions
-
-Identifies one native ad slot.
-
-| Prop | Type | Description | Since |
-| ---------------- | ------------------- | ------------------------------------- | ----- |
-| **`nativeAdId`** | string | Plugin-side id of the native ad slot. | 0.3.0 |
-
-
#### PluginListenerHandle
| Prop | Type |
@@ -2129,96 +1129,6 @@ Payload of the `rewarded` event: the AdEvent fields plus
| **`reward`** | Reward | The reward earned. | 0.1.0 |
-#### ImpressionData
-
-Impression-level revenue data (`LevelPlayImpressionData` on Android, `LPMImpressionData` on iOS). Every field the
-SDK 9.6.1 data class exposes is mapped; fields the SDK leaves empty are omitted.
-
-Not available in SDK 9.6.1 on either platform: `lifetimeRevenue` (removed from the impression data class). If the
-server ever sends extra keys they are still visible in `allData`.
-
-| Prop | Type | Description | Since |
-| --------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
-| **`adFormat`** | string | Which ad format produced the impression, as the SDK reports it (for example `Rewarded Video`, `Interstitial`, `Banner`, or `nativead` for impressions synthesised from native ad info). | 0.3.0 |
-| **`auctionId`** | string | Auction id. | 0.3.0 |
-| **`adUnitId`** | string | Mediation ad unit id (`mediationAdUnitId`). | 0.3.0 |
-| **`adUnitName`** | string | Mediation ad unit name (`mediationAdUnitName`). | 0.3.0 |
-| **`adNetwork`** | string | Mediated network that served the ad. | 0.3.0 |
-| **`instanceName`** | string | Mediation instance name. | 0.3.0 |
-| **`instanceId`** | string | Mediation instance id. | 0.3.0 |
-| **`country`** | string | Country code. | 0.3.0 |
-| **`placement`** | string | Placement name of the impression. | 0.3.0 |
-| **`revenue`** | number | Revenue of this impression in USD. | 0.3.0 |
-| **`precision`** | string | Revenue precision (for example `BID`, `RATE`, `ESTIMATED`). | 0.3.0 |
-| **`ab`** | string | A/B test group. | 0.3.0 |
-| **`segmentName`** | string | Segment name, see `setSegment()`. | 0.3.0 |
-| **`encryptedCPM`** | string | Encrypted CPM (`encryptedCPM` on Android, `encryptedCpm` on iOS). | 0.3.0 |
-| **`creativeId`** | string | Creative id. | 0.3.0 |
-| **`conversionValue`** | number | iOS only: SKAdNetwork conversion value. | 0.3.0 |
-| **`allData`** | { [key: string]: unknown; } | The raw `allData` map of the SDK (`getAllData()` JSON on Android, `allData` dictionary on iOS). Keys and value types are SDK defined and may change between SDK versions. | 0.3.0 |
-
-
-#### BannerEvent
-
-Payload of the `banner*` events.
-
-| Prop | Type | Description | Since |
-| -------------- | ----------------------------------------- | -------------------------------------------------------------- | ----- |
-| **`bannerId`** | string | Banner that fired the event. | 0.3.0 |
-| **`adUnitId`** | string | Ad unit of the banner. | 0.3.0 |
-| **`adInfo`** | AdInfo | Ad info, when the SDK provides it (not on `bannerLoadFailed`). | 0.3.0 |
-| **`frame`** | Rect | Current frame of the banner in CSS px. | 0.3.0 |
-
-
-#### BannerErrorEvent
-
-Payload of `bannerLoadFailed` and `bannerDisplayFailed`.
-
-| Prop | Type | Description | Since |
-| ----------- | ------------------------------------------- | ---------------- | ----- |
-| **`error`** | AdError | What went wrong. | 0.3.0 |
-
-
-#### NativeAdEvent
-
-Payload of the `nativeAd*` events.
-
-| Prop | Type | Description | Since |
-| ------------------- | ----------------------------------------------------- | ---------------------------------------------------------------- | ----- |
-| **`nativeAdId`** | string | Native ad slot that fired the event. | 0.3.0 |
-| **`placementName`** | string | Placement passed to `loadNativeAd()`, if any. | 0.3.0 |
-| **`adInfo`** | NativeAdInfo | Ad info, when the SDK provides it (not on `nativeAdLoadFailed`). | 0.3.0 |
-
-
-#### NativeAdInfo
-
-Ad info of a native ad (`AdInfo` on Android / `ISAdInfo` on iOS: the older ironSource info type, which has no ad
-unit, ad id or placement fields).
-
-| Prop | Type | Description | Since |
-| --------------------- | ------------------- | --------------------------------------- | ----- |
-| **`auctionId`** | string | Auction id. | 0.3.0 |
-| **`adNetwork`** | string | Mediated network that served the ad. | 0.3.0 |
-| **`instanceName`** | string | Mediation instance name. | 0.3.0 |
-| **`instanceId`** | string | Mediation instance id. | 0.3.0 |
-| **`country`** | string | Country code. | 0.3.0 |
-| **`revenue`** | number | Impression revenue in USD. | 0.3.0 |
-| **`precision`** | string | Revenue precision. | 0.3.0 |
-| **`ab`** | string | A/B test group. | 0.3.0 |
-| **`segmentName`** | string | Segment name. | 0.3.0 |
-| **`encryptedCPM`** | string | Encrypted CPM. | 0.3.0 |
-| **`conversionValue`** | number | iOS only: SKAdNetwork conversion value. | 0.3.0 |
-
-
-#### NativeAdErrorEvent
-
-Payload of `nativeAdLoadFailed`.
-
-| Prop | Type | Description | Since |
-| ----------- | ------------------------------------------- | ---------------- | ----- |
-| **`error`** | AdError | What went wrong. | 0.3.0 |
-
-
### Type Aliases
@@ -2231,41 +1141,10 @@ iOS App Tracking Transparency status. `unavailable` on Android, on the web and o
#### AdFormat
-Full-screen ad formats (`loadRewarded` / `loadInterstitial` family and the `loaded` ... `rewarded` events).
-Banners and native ads have their own methods and `banner*` / `nativeAd*` events (since 0.3.0), so this union
-stays unchanged for 0.2.x code.
+Full-screen ad formats supported by this plugin. Banners and native ads are intentionally not exposed.
'rewarded' | 'interstitial'
-
-#### NativeAdTemplate
-
-Native ad template rendered by the plugin (the LevelPlay SDK ships no template views; the plugin provides its own
-layouts, like Unity's Flutter and React Native wrappers do).
-
-- `small`: icon, title, advertiser, body, call to action; no media view. Recommended 300 x 175 or a row at least
- 90 px tall.
-- `medium`: the `small` assets plus a media view. Recommended 300 x 350.
-
-'small' | 'medium'
-
-
-#### BannerSize
-
-Banner size presets, named after the SDK constants (`LevelPlayAdSize.BANNER` / `LPMAdSize.bannerSize()` ...).
-
-- `BANNER`: 320 x 50
-- `LARGE`: 320 x 90
-- `MEDIUM_RECTANGLE`: 300 x 250
-- `LEADERBOARD`: 728 x 90 (tablets)
-- `ADAPTIVE`: `LevelPlayAdSize.createAdaptiveAdSize(context, width)` / `LPMAdSize.createAdaptiveAdSize(withWidth:)`;
- the SDK picks the height (and BANNER or LEADERBOARD as fallback) for the given width. Requires a finished
- `initialize()`.
-- `CUSTOM`: `LevelPlayAdSize.createCustomSize(width, height)` / `LPMAdSize.customSizeWithWidth:height:` with
- `customSize`. Few networks fill custom sizes; prefer a preset or `ADAPTIVE`.
-
-'BANNER' | 'LARGE' | 'MEDIUM_RECTANGLE' | 'LEADERBOARD' | 'ADAPTIVE' | 'CUSTOM'
-
## Contributing
diff --git a/android/build.gradle b/android/build.gradle
index 4b8facd..1863736 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -25,7 +25,7 @@ android {
namespace = "fyi.crt.capacitor.levelplay"
compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
defaultConfig {
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
versionCode 1
versionName "1.0"
diff --git a/android/src/main/java/fyi/crt/capacitor/levelplay/BannerManager.java b/android/src/main/java/fyi/crt/capacitor/levelplay/BannerManager.java
deleted file mode 100644
index 3bd2617..0000000
--- a/android/src/main/java/fyi/crt/capacitor/levelplay/BannerManager.java
+++ /dev/null
@@ -1,405 +0,0 @@
-package fyi.crt.capacitor.levelplay;
-
-import android.app.Activity;
-import android.os.Handler;
-import android.os.Looper;
-import android.view.View;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import com.getcapacitor.JSObject;
-import com.unity3d.mediation.LevelPlayAdError;
-import com.unity3d.mediation.LevelPlayAdInfo;
-import com.unity3d.mediation.LevelPlayAdSize;
-import com.unity3d.mediation.banner.LevelPlayBannerAdView;
-import com.unity3d.mediation.banner.LevelPlayBannerAdViewListener;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * Banners (design §3, §6): LevelPlayBannerAdView instances keyed by bannerId, laid out in the OverlayHost.
- * Main thread only; SDK callbacks are re-posted to the main thread.
- */
-final class BannerManager {
-
- interface Host {
- @Nullable
- Activity activity();
-
- /** The overlay, attached on first use; null when the WebView has no parent. */
- @Nullable
- OverlayHost overlay();
-
- boolean initialized();
-
- void emit(String event, JSObject data);
-
- com.unity3d.mediation.impression.LevelPlayImpressionDataListener impressionListener();
- }
-
- /** Owner decision Q4: adaptive banners follow safe-area width changes after the layout settled. */
- private static final long ADAPTIVE_RECREATE_DELAY_MS = 250;
-
- private final Host host;
- private final Handler main = new Handler(Looper.getMainLooper());
- private final Map slots = new LinkedHashMap<>();
- private final Runnable adaptiveCheck = this::recreateChangedAdaptive;
-
- BannerManager(Host host) {
- this.host = host;
- }
-
- private static final class Slot {
-
- final String bannerId;
- final String adUnitId;
- final String size;
- @Nullable
- final Integer fixedAdaptiveWidth;
- final int customWidth;
- final int customHeight;
- @Nullable
- final String placementName;
- @Nullable
- final Double bidFloor;
- String position = "bottom";
- double offsetX;
- double offsetY;
- boolean respectSafeArea = true;
-
- LevelPlayBannerAdView view;
- LevelPlayAdSize adSize;
- /** CSS px width the adaptive size was computed for. */
- int adaptiveWidthUsed;
- boolean visible;
- boolean loadRequested;
- double[] frame = OverlayMath.rect(0, 0, 0, 0);
-
- Slot(
- String bannerId,
- String adUnitId,
- String size,
- @Nullable Integer fixedAdaptiveWidth,
- int customWidth,
- int customHeight,
- @Nullable String placementName,
- @Nullable Double bidFloor
- ) {
- this.bannerId = bannerId;
- this.adUnitId = adUnitId;
- this.size = size;
- this.fixedAdaptiveWidth = fixedAdaptiveWidth;
- this.customWidth = customWidth;
- this.customHeight = customHeight;
- this.placementName = placementName;
- this.bidFloor = bidFloor;
- }
- }
-
- // ---------------------------------------------------------------------------------------------- API
-
- JSObject create(JSObject o) throws CallError {
- String adUnitId = o.getString("adUnitId");
- if (adUnitId == null || adUnitId.isEmpty()) throw CallError.invalid("adUnitId is required");
- String bannerId = nonEmpty(o.getString("bannerId"), adUnitId);
- JSObject custom = o.getJSObject("customSize");
- String size = o.getString("size");
- if (size == null) size = custom != null ? "CUSTOM" : "ADAPTIVE";
- if (!OverlayMath.isBannerSize(size)) throw CallError.invalid("Unknown banner size '" + size + "'");
- int cw = 0, ch = 0;
- if ("CUSTOM".equals(size)) {
- if (custom == null) throw CallError.invalid("size CUSTOM needs customSize { width, height }");
- cw = positiveInt(custom, "customSize.width", "width");
- ch = positiveInt(custom, "customSize.height", "height");
- }
- Integer fixedWidth = null;
- if (o.has("adaptiveWidth") && !o.isNull("adaptiveWidth")) {
- fixedWidth = positiveInt(o, "adaptiveWidth", "adaptiveWidth");
- }
- Double bidFloor = null;
- if (o.has("bidFloor") && !o.isNull("bidFloor")) {
- Object v = o.opt("bidFloor");
- if (!(v instanceof Number) || ((Number) v).doubleValue() < 0) throw CallError.invalid("bidFloor must be a number >= 0");
- bidFloor = ((Number) v).doubleValue();
- }
- String placement = o.getString("placementName");
- if (placement != null && placement.isEmpty()) placement = null;
-
- Slot s = new Slot(bannerId, adUnitId, size, fixedWidth, cw, ch, placement, bidFloor);
- applyLayout(s, o);
-
- if (!host.initialized()) throw new CallError("NOT_INITIALIZED", "Call initialize() and wait for it before createBanner()");
- if (slots.containsKey(bannerId)) throw new CallError("ALREADY_EXISTS", "Banner '" + bannerId + "' already exists; destroy it first");
- Activity activity = host.activity();
- if (activity == null) throw new CallError("NO_ACTIVITY", "No activity to attach the banner to");
- OverlayHost overlay = host.overlay();
- if (overlay == null) throw new CallError("NO_ACTIVITY", "The WebView is not attached to a view hierarchy");
-
- buildView(s, activity, overlay);
- slots.put(bannerId, s);
- relayout(s, overlay);
- return result(s);
- }
-
- void load(String bannerId) throws CallError {
- Slot s = require(bannerId);
- s.loadRequested = true;
- s.view.loadAd();
- }
-
- JSObject show(String bannerId) throws CallError {
- Slot s = require(bannerId);
- OverlayHost overlay = host.overlay();
- s.visible = true;
- s.view.setVisibility(View.VISIBLE);
- s.view.bringToFront();
- s.view.resumeAutoRefresh();
- if (overlay != null) relayout(s, overlay);
- return result(s);
- }
-
- void hide(String bannerId) {
- Slot s = slots.get(bannerId);
- if (s == null) return;
- s.visible = false;
- s.view.setVisibility(View.GONE);
- s.view.pauseAutoRefresh();
- }
-
- JSObject setLayout(JSObject o) throws CallError {
- Slot s = require(o.getString("bannerId"));
- applyLayout(s, o);
- OverlayHost overlay = host.overlay();
- if (overlay != null) relayout(s, overlay);
- return result(s);
- }
-
- void destroy(String bannerId) {
- Slot s = slots.remove(bannerId);
- if (s != null) destroyView(s);
- }
-
- void destroyAll() {
- main.removeCallbacks(adaptiveCheck);
- for (Slot s : new ArrayList<>(slots.values())) destroyView(s);
- slots.clear();
- }
-
- boolean isEmpty() {
- return slots.isEmpty();
- }
-
- /** Overlay layout pass: re-place every banner and schedule the adaptive width check (Q4). */
- void onLayoutChanged(OverlayHost overlay) {
- boolean adaptiveChanged = false;
- for (Slot s : slots.values()) {
- relayout(s, overlay);
- if (followsWidth(s) && currentAdaptiveWidth(s, overlay) != s.adaptiveWidthUsed) adaptiveChanged = true;
- }
- main.removeCallbacks(adaptiveCheck);
- if (adaptiveChanged) main.postDelayed(adaptiveCheck, ADAPTIVE_RECREATE_DELAY_MS);
- }
-
- // ---------------------------------------------------------------------------------------------- internals
-
- private Slot require(@Nullable String bannerId) throws CallError {
- if (bannerId == null || bannerId.isEmpty()) throw CallError.invalid("bannerId is required");
- Slot s = slots.get(bannerId);
- if (s == null) throw CallError.notFound("Banner", bannerId);
- return s;
- }
-
- private static void applyLayout(Slot s, JSObject o) throws CallError {
- if (o.has("position") && !o.isNull("position")) {
- String p = o.getString("position");
- if (!OverlayMath.isPosition(p)) throw CallError.invalid("position must be 'top', 'bottom' or 'center'");
- s.position = p;
- }
- if (o.has("offsetX") && !o.isNull("offsetX")) s.offsetX = finite(o, "offsetX");
- if (o.has("offsetY") && !o.isNull("offsetY")) s.offsetY = finite(o, "offsetY");
- if (o.has("respectSafeArea") && !o.isNull("respectSafeArea")) {
- Object v = o.opt("respectSafeArea");
- if (!(v instanceof Boolean)) throw CallError.invalid("respectSafeArea must be a boolean");
- s.respectSafeArea = (Boolean) v;
- }
- }
-
- private static double finite(JSObject o, String key) throws CallError {
- Object v = o.opt(key);
- if (!(v instanceof Number)) throw CallError.invalid(key + " must be a number");
- double d = ((Number) v).doubleValue();
- if (Double.isNaN(d) || Double.isInfinite(d)) throw CallError.invalid(key + " must be finite");
- return d;
- }
-
- private static int positiveInt(JSObject o, String label, String key) throws CallError {
- Object v = o.opt(key);
- if (!(v instanceof Number)) throw CallError.invalid(label + " must be a positive number");
- double d = ((Number) v).doubleValue();
- if (!(d >= 1) || Double.isInfinite(d)) throw CallError.invalid(label + " must be a positive number");
- return (int) Math.round(d);
- }
-
- private static String nonEmpty(@Nullable String v, String fallback) {
- return v == null || v.isEmpty() ? fallback : v;
- }
-
- private static boolean followsWidth(Slot s) {
- return "ADAPTIVE".equals(s.size) && s.fixedAdaptiveWidth == null;
- }
-
- private static double[] area(Slot s, OverlayHost overlay) {
- return s.respectSafeArea ? overlay.safeAreaCss() : overlay.webViewCss();
- }
-
- private static int currentAdaptiveWidth(Slot s, OverlayHost overlay) {
- return (int) Math.floor(area(s, overlay)[2]);
- }
-
- @Nullable
- private LevelPlayAdSize resolveSize(Slot s, Activity activity, OverlayHost overlay) {
- switch (s.size) {
- case "BANNER":
- return LevelPlayAdSize.BANNER;
- case "LARGE":
- return LevelPlayAdSize.LARGE;
- case "MEDIUM_RECTANGLE":
- return LevelPlayAdSize.MEDIUM_RECTANGLE;
- case "LEADERBOARD":
- return LevelPlayAdSize.LEADERBOARD;
- case "CUSTOM":
- return LevelPlayAdSize.createCustomSize(s.customWidth, s.customHeight);
- default: {
- // The SDK width unit is dp (bytecode of createAdaptiveAdSize, design §3.2), i.e. CSS px.
- int width = s.fixedAdaptiveWidth != null ? s.fixedAdaptiveWidth : currentAdaptiveWidth(s, overlay);
- s.adaptiveWidthUsed = width;
- return LevelPlayAdSize.createAdaptiveAdSize(activity, width > 0 ? width : null);
- }
- }
- }
-
- private void buildView(Slot s, Activity activity, OverlayHost overlay) throws CallError {
- LevelPlayAdSize size = resolveSize(s, activity, overlay);
- if (size == null) throw new CallError("NOT_INITIALIZED", "The SDK returned no adaptive size (initialize() not finished)");
- LevelPlayBannerAdView.Config.Builder b = new LevelPlayBannerAdView.Config.Builder().setAdSize(size);
- if (s.bidFloor != null) b.setBidFloor(s.bidFloor);
- if (s.placementName != null) b.setPlacementName(s.placementName);
- LevelPlayBannerAdView v = new LevelPlayBannerAdView(activity, s.adUnitId, b.build());
- v.setBannerListener(new Listener(s, v));
- v.setImpressionDataListener(host.impressionListener());
- v.setVisibility(s.visible ? View.VISIBLE : View.GONE);
- s.view = v;
- s.adSize = size;
- overlay.add(v);
- }
-
- private void relayout(Slot s, OverlayHost overlay) {
- s.frame = OverlayMath.bannerFrame(area(s, overlay), s.adSize.getWidth(), s.adSize.getHeight(), s.position, s.offsetX, s.offsetY);
- overlay.place(s.view, s.frame);
- }
-
- private void destroyView(Slot s) {
- OverlayHost overlay = host.overlay();
- s.view.destroy();
- if (overlay != null) overlay.remove(s.view);
- }
-
- /** Q4: recreate adaptive banners whose safe-area width changed; keeps id, layout, visibility; reloads if loaded. */
- private void recreateChangedAdaptive() {
- Activity activity = host.activity();
- OverlayHost overlay = host.overlay();
- if (activity == null || overlay == null) return;
- for (Slot s : slots.values()) {
- if (!followsWidth(s) || currentAdaptiveWidth(s, overlay) == s.adaptiveWidthUsed) continue;
- if (currentAdaptiveWidth(s, overlay) <= 0) continue;
- destroyView(s);
- try {
- buildView(s, activity, overlay);
- } catch (CallError e) {
- continue;
- }
- relayout(s, overlay);
- if (s.loadRequested) s.view.loadAd();
- if (!s.visible) s.view.pauseAutoRefresh();
- }
- }
-
- private JSObject result(Slot s) {
- JSObject r = new JSObject();
- r.put("bannerId", s.bannerId);
- r.put("adSize", Mappers.adSize(s.adSize));
- r.put("frame", Mappers.rect(s.frame));
- r.put("visible", s.visible);
- return r;
- }
-
- private JSObject event(Slot s, @Nullable LevelPlayAdInfo info) {
- JSObject o = new JSObject();
- o.put("bannerId", s.bannerId);
- o.put("adUnitId", s.adUnitId);
- if (info != null) o.put("adInfo", Mappers.adInfo(info));
- o.put("frame", Mappers.rect(s.frame));
- return o;
- }
-
- /** One listener per view: callbacks of a view that was replaced (Q4) or destroyed are dropped. */
- private final class Listener implements LevelPlayBannerAdViewListener {
-
- private final Slot slot;
- private final LevelPlayBannerAdView view;
-
- Listener(Slot slot, LevelPlayBannerAdView view) {
- this.slot = slot;
- this.view = view;
- }
-
- private void post(String name, @Nullable LevelPlayAdInfo info, @Nullable LevelPlayAdError error) {
- main.post(() -> {
- if (slot.view != view || slots.get(slot.bannerId) != slot) return;
- JSObject o = event(slot, info);
- if (error != null) o.put("error", Mappers.error(error.getErrorCode(), error.getErrorMessage()));
- host.emit(name, o);
- });
- }
-
- @Override
- public void onAdLoaded(@NonNull LevelPlayAdInfo adInfo) {
- post("bannerLoaded", adInfo, null);
- }
-
- @Override
- public void onAdLoadFailed(@NonNull LevelPlayAdError error) {
- post("bannerLoadFailed", null, error);
- }
-
- @Override
- public void onAdDisplayed(@NonNull LevelPlayAdInfo adInfo) {
- post("bannerDisplayed", adInfo, null);
- }
-
- @Override
- public void onAdDisplayFailed(@NonNull LevelPlayAdInfo adInfo, @NonNull LevelPlayAdError error) {
- post("bannerDisplayFailed", adInfo, error);
- }
-
- @Override
- public void onAdClicked(@NonNull LevelPlayAdInfo adInfo) {
- post("bannerClicked", adInfo, null);
- }
-
- @Override
- public void onAdExpanded(@NonNull LevelPlayAdInfo adInfo) {
- post("bannerExpanded", adInfo, null);
- }
-
- @Override
- public void onAdCollapsed(@NonNull LevelPlayAdInfo adInfo) {
- post("bannerCollapsed", adInfo, null);
- }
-
- @Override
- public void onAdLeftApplication(@NonNull LevelPlayAdInfo adInfo) {
- post("bannerLeftApplication", adInfo, null);
- }
- }
-}
diff --git a/android/src/main/java/fyi/crt/capacitor/levelplay/CallError.java b/android/src/main/java/fyi/crt/capacitor/levelplay/CallError.java
deleted file mode 100644
index bb1205c..0000000
--- a/android/src/main/java/fyi/crt/capacitor/levelplay/CallError.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package fyi.crt.capacitor.levelplay;
-
-/** A promise rejection with one of the plugin's string codes (INVALID_ARGUMENT, NOT_FOUND ...). */
-final class CallError extends Exception {
-
- final String code;
-
- CallError(String code, String message) {
- super(message);
- this.code = code;
- }
-
- static CallError invalid(String message) {
- return new CallError("INVALID_ARGUMENT", message);
- }
-
- static CallError notFound(String what, String id) {
- return new CallError("NOT_FOUND", what + " '" + id + "' not found");
- }
-}
diff --git a/android/src/main/java/fyi/crt/capacitor/levelplay/LevelPlayPlugin.java b/android/src/main/java/fyi/crt/capacitor/levelplay/LevelPlayPlugin.java
index 051bc9d..8d0d3da 100644
--- a/android/src/main/java/fyi/crt/capacitor/levelplay/LevelPlayPlugin.java
+++ b/android/src/main/java/fyi/crt/capacitor/levelplay/LevelPlayPlugin.java
@@ -1,7 +1,6 @@
package fyi.crt.capacitor.levelplay;
import android.app.Activity;
-import android.content.res.Configuration;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.NonNull;
@@ -19,34 +18,24 @@ import com.unity3d.mediation.LevelPlayInitError;
import com.unity3d.mediation.LevelPlayInitListener;
import com.unity3d.mediation.LevelPlayInitRequest;
import com.unity3d.mediation.LevelPlayPrivacySettings;
-import com.unity3d.mediation.impression.LevelPlayImpressionDataListener;
import com.unity3d.mediation.interstitial.LevelPlayInterstitialAd;
import com.unity3d.mediation.interstitial.LevelPlayInterstitialAdListener;
import com.unity3d.mediation.rewarded.LevelPlayReward;
import com.unity3d.mediation.rewarded.LevelPlayRewardedAd;
import com.unity3d.mediation.rewarded.LevelPlayRewardedAdListener;
-import com.unity3d.mediation.segment.LevelPlaySegment;
-import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import org.json.JSONArray;
/**
- * Capacitor bridge for the Unity LevelPlay SDK (ad-unit API: LevelPlayRewardedAd / LevelPlayInterstitialAd /
- * LevelPlayBannerAdView, plus LevelPlayNativeAd). Every SDK call and every view operation runs on the main thread;
- * plugin state is only touched there.
+ * Capacitor bridge for the Unity LevelPlay SDK (ad-unit API: LevelPlayRewardedAd / LevelPlayInterstitialAd).
+ * Rewarded and interstitial only. Every SDK call runs on the main thread; plugin state is only touched there.
*/
@CapacitorPlugin(name = "LevelPlay")
public class LevelPlayPlugin extends Plugin {
private static final long LATE_REWARD_GRACE_MS = 1000;
- /** Impressions kept while no JS impressionData listener exists (owner decision Q2); the oldest is dropped. */
- static final int IMPRESSION_QUEUE_CAP = 100;
- static final String EVENT_IMPRESSION = "impressionData";
private enum InitState {
IDLE,
@@ -59,43 +48,6 @@ public class LevelPlayPlugin extends Plugin {
private final List pendingInits = new ArrayList<>();
private final Map rewarded = new HashMap<>();
private final Map interstitials = new HashMap<>();
- private final ArrayDeque impressionQueue = new ArrayDeque<>();
- @Nullable
- private OverlayHost overlay;
- private final BannerManager banners = new BannerManager(new BannerManager.Host() {
- @Nullable
- @Override
- public Activity activity() {
- return getActivity();
- }
-
- @Nullable
- @Override
- public OverlayHost overlay() {
- return LevelPlayPlugin.this.overlay();
- }
-
- @Override
- public boolean initialized() {
- return initState == InitState.DONE;
- }
-
- @Override
- public void emit(String event, JSObject data) {
- notifyListeners(event, data);
- }
-
- @Override
- public LevelPlayImpressionDataListener impressionListener() {
- return impressionListener;
- }
- });
-
- /** Attached to every rewarded, interstitial and banner object (per-ad listeners, owner decision Q1). */
- final LevelPlayImpressionDataListener impressionListener = data -> {
- JSObject o = Mappers.impression(data);
- main.post(() -> emitImpression(o));
- };
// ---------------------------------------------------------------------------------------------- init / settings
@@ -315,303 +267,6 @@ public class LevelPlayPlugin extends Plugin {
});
}
- // ---------------------------------------------------------------------------------------------- 0.3.0: capabilities, user
-
- @PluginMethod
- public void getCapabilities(PluginCall call) {
- JSObject r = new JSObject();
- r.put("banner", true);
- r.put("nativeAd", true);
- r.put("nativeAdTemplates", new JSONArray().put("small").put("medium"));
- r.put("impressionData", true);
- r.put("adInfoChanged", true);
- call.resolve(r);
- }
-
- @PluginMethod
- public void setSegment(PluginCall call) {
- JSObject o = call.getData();
- LevelPlaySegment segment = new LevelPlaySegment();
- try {
- String name = o.getString("segmentName");
- if (name != null) segment.setSegmentName(name);
- Number level = number(o, "level");
- if (level != null) {
- if (level.doubleValue() != Math.rint(level.doubleValue())) throw CallError.invalid("level must be an integer");
- segment.setLevel(level.intValue());
- }
- if (o.has("isPaying")) {
- Object paying = o.opt("isPaying");
- if (!(paying instanceof Boolean)) throw CallError.invalid("isPaying must be a boolean");
- segment.setPaying((Boolean) paying);
- }
- Number created = number(o, "userCreationDate");
- if (created != null) segment.setUserCreationDate(created.longValue());
- Number iap = number(o, "iapTotal");
- if (iap != null) segment.setIapTotal(iap.doubleValue());
- JSObject custom = o.getJSObject("customParameters");
- if (custom == null && o.has("customParameters") && !o.isNull("customParameters")) {
- throw CallError.invalid("customParameters must be an object of strings");
- }
- if (custom != null) {
- Map params = new LinkedHashMap<>();
- Iterator keys = custom.keys();
- while (keys.hasNext()) {
- String k = keys.next();
- params.put(k, custom.opt(k));
- }
- String err = OverlayMath.customParamsError(params);
- if (err != null) throw CallError.invalid(err);
- for (Map.Entry e : params.entrySet()) segment.setCustom(e.getKey(), (String) e.getValue());
- }
- } catch (CallError e) {
- reject(call, e);
- return;
- }
- main.post(() -> {
- LevelPlay.setSegment(segment);
- call.resolve();
- });
- }
-
- @Nullable
- private static Number number(JSObject o, String key) throws CallError {
- if (!o.has(key) || o.isNull(key)) return null;
- Object v = o.opt(key);
- if (!(v instanceof Number)) throw CallError.invalid(key + " must be a number");
- double d = ((Number) v).doubleValue();
- if (Double.isNaN(d) || Double.isInfinite(d)) throw CallError.invalid(key + " must be finite");
- return (Number) v;
- }
-
- @PluginMethod
- public void setDynamicUserId(PluginCall call) {
- String userId = call.getString("userId");
- if (userId == null || userId.isEmpty()) {
- call.reject("userId is required", "INVALID_ARGUMENT");
- return;
- }
- main.post(() -> {
- JSObject r = new JSObject();
- r.put("valid", LevelPlay.setDynamicUserId(userId));
- call.resolve(r);
- });
- }
-
- @PluginMethod
- public void isPlacementCapped(PluginCall call) {
- String format = call.getString("format");
- String placement = call.getString("placementName");
- if (!"rewarded".equals(format) && !"interstitial".equals(format)) {
- call.reject("format must be 'rewarded' or 'interstitial'", "INVALID_ARGUMENT");
- return;
- }
- if (placement == null || placement.isEmpty()) {
- call.reject("placementName is required", "INVALID_ARGUMENT");
- return;
- }
- main.post(() -> {
- boolean capped = "interstitial".equals(format)
- ? LevelPlayInterstitialAd.isPlacementCapped(placement)
- : LevelPlayRewardedAd.isPlacementCapped(placement);
- JSObject r = new JSObject();
- r.put("capped", capped);
- call.resolve(r);
- });
- }
-
- @PluginMethod
- public void getReward(PluginCall call) {
- String adUnitId = requireAdUnit(call);
- if (adUnitId == null) return;
- String placement = call.getString("placementName");
- main.post(() -> {
- LevelPlayRewardedAd ad = rewardedHolder(adUnitId).ad;
- LevelPlayReward r = placement != null && !placement.isEmpty() ? ad.getReward(placement) : ad.getReward();
- call.resolve(Mappers.reward(r));
- });
- }
-
- // ---------------------------------------------------------------------------------------------- 0.3.0: banners
-
- @PluginMethod
- public void createBanner(PluginCall call) {
- JSObject o = call.getData();
- onMain(call, () -> call.resolve(banners.create(o)));
- }
-
- @PluginMethod
- public void loadBanner(PluginCall call) {
- String id = call.getString("bannerId");
- onMain(call, () -> {
- banners.load(id);
- call.resolve();
- });
- }
-
- @PluginMethod
- public void showBanner(PluginCall call) {
- String id = call.getString("bannerId");
- onMain(call, () -> call.resolve(banners.show(id)));
- }
-
- @PluginMethod
- public void hideBanner(PluginCall call) {
- String id = call.getString("bannerId");
- onMain(call, () -> {
- banners.hide(id);
- call.resolve();
- });
- }
-
- @PluginMethod
- public void setBannerLayout(PluginCall call) {
- JSObject o = call.getData();
- onMain(call, () -> call.resolve(banners.setLayout(o)));
- }
-
- @PluginMethod
- public void destroyBanner(PluginCall call) {
- String id = call.getString("bannerId");
- onMain(call, () -> {
- banners.destroy(id);
- call.resolve();
- });
- }
-
- // ---------------------------------------------------------------------------------------------- 0.3.0: native ads
-
- private final NativeAdManager nativeAds = new NativeAdManager(new NativeAdManager.Host() {
- @Nullable
- @Override
- public Activity activity() {
- return getActivity();
- }
-
- @Nullable
- @Override
- public OverlayHost overlay() {
- return LevelPlayPlugin.this.overlay();
- }
-
- @Override
- public boolean initialized() {
- return initState == InitState.DONE;
- }
-
- @Override
- public void emit(String event, JSObject data) {
- notifyListeners(event, data);
- }
-
- @Override
- public void impression(JSObject data) {
- emitImpression(data);
- }
- });
-
- @PluginMethod
- public void loadNativeAd(PluginCall call) {
- JSObject o = call.getData();
- onMain(call, () -> {
- nativeAds.load(o);
- call.resolve();
- });
- }
-
- @PluginMethod
- public void showNativeAd(PluginCall call) {
- String id = call.getString("nativeAdId");
- JSObject rect = call.getObject("rect");
- onMain(call, () -> {
- nativeAds.show(id, rect);
- call.resolve();
- });
- }
-
- @PluginMethod
- public void setNativeAdRect(PluginCall call) {
- String id = call.getString("nativeAdId");
- JSObject rect = call.getObject("rect");
- onMain(call, () -> {
- nativeAds.setRect(id, rect);
- call.resolve();
- });
- }
-
- @PluginMethod
- public void hideNativeAd(PluginCall call) {
- String id = call.getString("nativeAdId");
- onMain(call, () -> {
- nativeAds.hide(id);
- call.resolve();
- });
- }
-
- @PluginMethod
- public void destroyNativeAd(PluginCall call) {
- String id = call.getString("nativeAdId");
- onMain(call, () -> {
- nativeAds.destroy(id);
- call.resolve();
- });
- }
-
- // ---------------------------------------------------------------------------------------------- overlay, lifecycle
-
- /** Main thread. The pass-through overlay above the WebView, attached on first use (design §6.2). */
- @Nullable
- private OverlayHost overlay() {
- if (overlay == null && bridge != null) overlay = OverlayHost.attach(bridge.getWebView(), this::onOverlayLayoutChanged);
- return overlay;
- }
-
- private void onOverlayLayoutChanged() {
- if (overlay == null) return;
- banners.onLayoutChanged(overlay);
- nativeAds.onLayoutChanged(overlay);
- }
-
- @Override
- protected void handleOnConfigurationChanged(Configuration newConfig) {
- super.handleOnConfigurationChanged(newConfig);
- main.post(() -> {
- if (overlay != null) overlay.postRelayout();
- });
- }
-
- @Override
- protected void handleOnDestroy() {
- super.handleOnDestroy();
- Runnable cleanup = () -> {
- banners.destroyAll();
- nativeAds.destroyAll();
- if (overlay != null) {
- overlay.detach();
- overlay = null;
- }
- };
- if (Looper.myLooper() == Looper.getMainLooper()) cleanup.run();
- else main.post(cleanup);
- }
-
- private interface MainTask {
- void run() throws CallError;
- }
-
- /** Runs on the main thread; a CallError rejects the call with its code. */
- private void onMain(PluginCall call, MainTask task) {
- main.post(() -> {
- try {
- task.run();
- } catch (CallError e) {
- reject(call, e);
- } catch (RuntimeException e) {
- call.reject(e.getMessage() != null ? e.getMessage() : e.toString(), "ERROR", e);
- }
- });
- }
-
// ---------------------------------------------------------------------------------------------- helpers
@Nullable
@@ -642,45 +297,35 @@ public class LevelPlayPlugin extends Plugin {
}
private static JSObject info(@Nullable LevelPlayAdInfo i) {
- return Mappers.adInfo(i);
+ JSObject o = new JSObject();
+ if (i == null) return o;
+ o.put("adId", i.getAdId());
+ o.put("adUnitId", i.getAdUnitId());
+ o.put("adUnitName", i.getAdUnitName());
+ o.put("adFormat", i.getAdFormat());
+ o.put("placementName", i.getPlacementName());
+ o.put("adNetwork", i.getAdNetwork());
+ o.put("instanceName", i.getInstanceName());
+ o.put("instanceId", i.getInstanceId());
+ o.put("country", i.getCountry());
+ o.put("auctionId", i.getAuctionId());
+ o.put("precision", i.getPrecision());
+ o.put("revenue", i.getRevenue());
+ return o;
}
private static JSObject error(int code, String message) {
- return Mappers.error(code, message);
+ JSObject e = new JSObject();
+ e.put("code", code);
+ e.put("message", message);
+ return e;
}
private static JSObject reward(LevelPlayReward r) {
- return Mappers.reward(r);
- }
-
- static void reject(PluginCall call, CallError e) {
- call.reject(e.getMessage(), e.code);
- }
-
- // ---------------------------------------------------------------------------------------------- impression data
-
- /** Main thread. Sends directly when a JS listener exists, otherwise queues (capped). */
- private void emitImpression(JSObject o) {
- if (hasListeners(EVENT_IMPRESSION)) {
- notifyListeners(EVENT_IMPRESSION, o);
- return;
- }
- impressionQueue.addLast(o);
- while (impressionQueue.size() > IMPRESSION_QUEUE_CAP) impressionQueue.removeFirst();
- }
-
- private void flushImpressions() {
- while (!impressionQueue.isEmpty() && hasListeners(EVENT_IMPRESSION)) {
- notifyListeners(EVENT_IMPRESSION, impressionQueue.removeFirst());
- }
- }
-
- /** Same as Plugin.addListener, then flushes impressions queued before the first impressionData listener. */
- @Override
- @PluginMethod(returnType = PluginMethod.RETURN_NONE)
- public void addListener(PluginCall call) {
- super.addListener(call);
- if (EVENT_IMPRESSION.equals(call.getString("eventName"))) main.post(this::flushImpressions);
+ JSObject o = new JSObject();
+ o.put("name", r.getName());
+ o.put("amount", r.getAmount());
+ return o;
}
private JSObject event(String format, String adUnitId, @Nullable LevelPlayAdInfo adInfo) {
@@ -706,7 +351,6 @@ public class LevelPlayPlugin extends Plugin {
this.adUnitId = adUnitId;
this.ad = new LevelPlayRewardedAd(adUnitId);
this.ad.setListener(this);
- this.ad.setImpressionDataListener(impressionListener);
}
void begin(PluginCall c) {
@@ -792,9 +436,7 @@ public class LevelPlayPlugin extends Plugin {
}
@Override
- public void onAdInfoChanged(@NonNull LevelPlayAdInfo adInfo) {
- main.post(() -> notifyListeners("adInfoChanged", event("rewarded", adUnitId, adInfo)));
- }
+ public void onAdInfoChanged(@NonNull LevelPlayAdInfo adInfo) {}
}
private final class InterstitialHolder implements LevelPlayInterstitialAdListener {
@@ -809,7 +451,6 @@ public class LevelPlayPlugin extends Plugin {
this.adUnitId = adUnitId;
this.ad = new LevelPlayInterstitialAd(adUnitId);
this.ad.setListener(this);
- this.ad.setImpressionDataListener(impressionListener);
}
void begin(PluginCall c) {
@@ -879,8 +520,6 @@ public class LevelPlayPlugin extends Plugin {
}
@Override
- public void onAdInfoChanged(@NonNull LevelPlayAdInfo adInfo) {
- main.post(() -> notifyListeners("adInfoChanged", event("interstitial", adUnitId, adInfo)));
- }
+ public void onAdInfoChanged(@NonNull LevelPlayAdInfo adInfo) {}
}
}
diff --git a/android/src/main/java/fyi/crt/capacitor/levelplay/Mappers.java b/android/src/main/java/fyi/crt/capacitor/levelplay/Mappers.java
deleted file mode 100644
index 3a792d3..0000000
--- a/android/src/main/java/fyi/crt/capacitor/levelplay/Mappers.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package fyi.crt.capacitor.levelplay;
-
-import androidx.annotation.Nullable;
-import com.getcapacitor.JSObject;
-import com.ironsource.mediationsdk.adunit.adapter.utility.AdInfo;
-import com.unity3d.mediation.LevelPlayAdInfo;
-import com.unity3d.mediation.LevelPlayAdSize;
-import com.unity3d.mediation.impression.LevelPlayImpressionData;
-import com.unity3d.mediation.rewarded.LevelPlayReward;
-
-/** SDK objects to the JSON shapes of src/definitions.ts. Null SDK values are omitted (JSONObject.put(k, null) removes k). */
-final class Mappers {
-
- private Mappers() {}
-
- static JSObject adInfo(@Nullable LevelPlayAdInfo i) {
- JSObject o = new JSObject();
- if (i == null) return o;
- o.put("adId", i.getAdId());
- o.put("adUnitId", i.getAdUnitId());
- o.put("adUnitName", i.getAdUnitName());
- o.put("adFormat", i.getAdFormat());
- o.put("placementName", i.getPlacementName());
- o.put("adNetwork", i.getAdNetwork());
- o.put("instanceName", i.getInstanceName());
- o.put("instanceId", i.getInstanceId());
- o.put("country", i.getCountry());
- o.put("auctionId", i.getAuctionId());
- o.put("precision", i.getPrecision());
- o.put("revenue", i.getRevenue());
- o.put("ab", i.getAb());
- o.put("segmentName", i.getSegmentName());
- o.put("encryptedCPM", i.getEncryptedCPM());
- o.put("creativeId", i.getCreativeId());
- LevelPlayAdSize size = i.getAdSize();
- if (size != null) o.put("adSize", adSize(size));
- return o;
- }
-
- static JSObject adSize(LevelPlayAdSize s) {
- JSObject o = new JSObject();
- o.put("width", s.getWidth());
- o.put("height", s.getHeight());
- o.put("description", s.getDescription());
- o.put("isAdaptive", s.isAdaptive());
- return o;
- }
-
- static JSObject impression(LevelPlayImpressionData d) {
- JSObject o = new JSObject();
- o.put("adFormat", d.getAdFormat());
- o.put("auctionId", d.getAuctionId());
- o.put("adUnitId", d.getMediationAdUnitId());
- o.put("adUnitName", d.getMediationAdUnitName());
- o.put("adNetwork", d.getAdNetwork());
- o.put("instanceName", d.getInstanceName());
- o.put("instanceId", d.getInstanceId());
- o.put("country", d.getCountry());
- o.put("placement", d.getPlacement());
- Double revenue = d.getRevenue();
- if (revenue != null) o.put("revenue", revenue.doubleValue());
- o.put("precision", d.getPrecision());
- o.put("ab", d.getAb());
- o.put("segmentName", d.getSegmentName());
- o.put("encryptedCPM", d.getEncryptedCPM());
- o.put("creativeId", d.getCreativeId());
- if (d.getAllData() != null) o.put("allData", d.getAllData());
- return o;
- }
-
- /** Native ads use the older ironSource AdInfo (no ad unit, ad id or placement). */
- static JSObject nativeAdInfo(@Nullable AdInfo i) {
- JSObject o = new JSObject();
- if (i == null) return o;
- o.put("auctionId", i.getAuctionId());
- o.put("adNetwork", i.getAdNetwork());
- o.put("instanceName", i.getInstanceName());
- o.put("instanceId", i.getInstanceId());
- o.put("country", i.getCountry());
- o.put("revenue", i.getRevenue());
- o.put("precision", i.getPrecision());
- o.put("ab", i.getAb());
- o.put("segmentName", i.getSegmentName());
- o.put("encryptedCPM", i.getEncryptedCPM());
- return o;
- }
-
- /** impressionData synthesised from a native ad impression (no per-ad impression listener for native ads in 9.6.1). */
- static JSObject nativeImpression(@Nullable AdInfo i) {
- JSObject o = nativeAdInfo(i);
- o.put("adFormat", "nativead");
- return o;
- }
-
- static JSObject error(int code, @Nullable String message) {
- JSObject e = new JSObject();
- e.put("code", code);
- e.put("message", message != null ? message : "");
- return e;
- }
-
- static JSObject reward(@Nullable LevelPlayReward r) {
- JSObject o = new JSObject();
- o.put("name", r != null && r.getName() != null ? r.getName() : "");
- o.put("amount", r != null ? r.getAmount() : 0);
- return o;
- }
-
- static JSObject rect(double[] r) {
- JSObject o = new JSObject();
- o.put("x", r[0]);
- o.put("y", r[1]);
- o.put("width", r[2]);
- o.put("height", r[3]);
- return o;
- }
-}
diff --git a/android/src/main/java/fyi/crt/capacitor/levelplay/NativeAdManager.java b/android/src/main/java/fyi/crt/capacitor/levelplay/NativeAdManager.java
deleted file mode 100644
index 1542f62..0000000
--- a/android/src/main/java/fyi/crt/capacitor/levelplay/NativeAdManager.java
+++ /dev/null
@@ -1,254 +0,0 @@
-package fyi.crt.capacitor.levelplay;
-
-import android.app.Activity;
-import android.os.Handler;
-import android.os.Looper;
-import android.view.View;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import com.getcapacitor.JSObject;
-import com.ironsource.mediationsdk.ads.nativead.LevelPlayNativeAd;
-import com.ironsource.mediationsdk.ads.nativead.LevelPlayNativeAdListener;
-import com.ironsource.mediationsdk.ads.nativead.NativeAdLayout;
-import com.ironsource.mediationsdk.adunit.adapter.utility.AdInfo;
-import com.ironsource.mediationsdk.logger.IronSourceError;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * Native ads (design §4): one LevelPlayNativeAd per load and slot, rendered into the plugin's templates and placed in
- * the OverlayHost at a WebView-local CSS rect. Main thread only; SDK callbacks are re-posted to the main thread.
- */
-final class NativeAdManager {
-
- interface Host {
- @Nullable
- Activity activity();
-
- @Nullable
- OverlayHost overlay();
-
- boolean initialized();
-
- void emit(String event, JSObject data);
-
- /** impressionData synthesised from the native ad info (no per-ad impression listener for native ads). */
- void impression(JSObject data);
- }
-
- private final Host host;
- private final Handler main = new Handler(Looper.getMainLooper());
- private final Map slots = new LinkedHashMap<>();
-
- NativeAdManager(Host host) {
- this.host = host;
- }
-
- private static final class Slot {
-
- final String id;
- @Nullable
- final String placementName;
- final String template;
- final NativeAdStyle style;
- @Nullable
- LevelPlayNativeAd ad;
- boolean loaded;
- @Nullable
- NativeAdLayout view;
- @Nullable
- double[] rect;
- boolean visible;
-
- Slot(String id, @Nullable String placementName, String template, NativeAdStyle style) {
- this.id = id;
- this.placementName = placementName;
- this.template = template;
- this.style = style;
- }
- }
-
- // ---------------------------------------------------------------------------------------------- API
-
- void load(JSObject o) throws CallError {
- String id = requireId(o.getString("nativeAdId"));
- String template = o.getString("template", "medium");
- if (!"small".equals(template) && !"medium".equals(template)) {
- throw new CallError("UNSUPPORTED", "Template '" + template + "' is not supported (small, medium)");
- }
- NativeAdStyle style = NativeAdStyle.parse(o.getJSObject("style"));
- String placement = o.getString("placementName");
- if (placement != null && placement.isEmpty()) placement = null;
- if (!host.initialized()) throw new CallError("NOT_INITIALIZED", "Call initialize() and wait for it before loadNativeAd()");
- Activity activity = host.activity();
- if (activity == null) throw new CallError("NO_ACTIVITY", "No activity to load the native ad with");
-
- // "Destroy the ad object and create a new one for every new load" (Unity).
- Slot old = slots.remove(id);
- if (old != null) destroySlot(old);
-
- Slot s = new Slot(id, placement, template, style);
- LevelPlayNativeAd.Builder b = new LevelPlayNativeAd.Builder().withActivity(activity).withListener(new Listener(s));
- if (placement != null) b.withPlacementName(placement);
- s.ad = b.build();
- slots.put(id, s);
- s.ad.loadAd();
- }
-
- void show(String nativeAdId, @Nullable JSObject rect) throws CallError {
- Slot s = require(nativeAdId);
- double[] r = parseRect(rect);
- if (!s.loaded || s.ad == null) throw new CallError("NOT_LOADED", "Native ad '" + nativeAdId + "' is not loaded");
- OverlayHost overlay = host.overlay();
- Activity activity = host.activity();
- if (overlay == null || activity == null) throw new CallError("NO_ACTIVITY", "No activity / WebView to show the native ad in");
- if (s.view == null) {
- s.view = NativeAdTemplate.build(activity, s.template, s.style, s.ad);
- s.view.setVisibility(View.GONE);
- overlay.add(s.view);
- }
- s.rect = r;
- s.visible = true;
- place(s, overlay);
- s.view.setVisibility(View.VISIBLE);
- s.view.bringToFront();
- }
-
- void setRect(String nativeAdId, @Nullable JSObject rect) throws CallError {
- Slot s = require(nativeAdId);
- s.rect = parseRect(rect);
- OverlayHost overlay = host.overlay();
- if (overlay != null && s.view != null) place(s, overlay);
- }
-
- void hide(String nativeAdId) throws CallError {
- Slot s = require(nativeAdId);
- s.visible = false;
- if (s.view != null) s.view.setVisibility(View.GONE);
- }
-
- void destroy(@Nullable String nativeAdId) {
- if (nativeAdId == null) return;
- Slot s = slots.remove(nativeAdId);
- if (s != null) destroySlot(s);
- }
-
- void destroyAll() {
- for (Slot s : new ArrayList<>(slots.values())) destroySlot(s);
- slots.clear();
- }
-
- void onLayoutChanged(OverlayHost overlay) {
- for (Slot s : slots.values()) if (s.view != null && s.rect != null) place(s, overlay);
- }
-
- // ---------------------------------------------------------------------------------------------- internals
-
- private static String requireId(@Nullable String id) throws CallError {
- if (id == null || id.isEmpty()) throw CallError.invalid("nativeAdId is required");
- return id;
- }
-
- private Slot require(@Nullable String id) throws CallError {
- Slot s = slots.get(requireId(id));
- if (s == null) throw CallError.notFound("Native ad", id);
- return s;
- }
-
- private static double[] parseRect(@Nullable JSObject r) throws CallError {
- if (r == null) throw CallError.invalid("rect { x, y, width, height } is required");
- double[] out = new double[4];
- String[] keys = { "x", "y", "width", "height" };
- for (int i = 0; i < 4; i++) {
- Object v = r.opt(keys[i]);
- if (!(v instanceof Number)) throw CallError.invalid("rect." + keys[i] + " must be a number");
- double d = ((Number) v).doubleValue();
- if (Double.isNaN(d) || Double.isInfinite(d)) throw CallError.invalid("rect." + keys[i] + " must be finite");
- out[i] = d;
- }
- if (out[2] < 0 || out[3] < 0) throw CallError.invalid("rect width and height must be >= 0");
- return out;
- }
-
- /** Native rects are taken literally (the page laid them out), only clamped to the WebView (design §6.3). */
- private static void place(Slot s, OverlayHost overlay) {
- if (s.view == null || s.rect == null) return;
- overlay.place(s.view, OverlayMath.intersect(s.rect, overlay.webViewCss()));
- }
-
- private void destroySlot(Slot s) {
- if (s.view != null) {
- OverlayHost overlay = host.overlay();
- if (overlay != null) overlay.remove(s.view);
- s.view = null;
- }
- if (s.ad != null) {
- s.ad.destroyAd();
- s.ad = null;
- }
- s.loaded = false;
- }
-
- private JSObject event(Slot s, @Nullable AdInfo info) {
- JSObject o = new JSObject();
- o.put("nativeAdId", s.id);
- if (s.placementName != null) o.put("placementName", s.placementName);
- if (info != null) o.put("adInfo", Mappers.nativeAdInfo(info));
- return o;
- }
-
- /** One listener per load; callbacks of an ad object that was replaced or destroyed are dropped. */
- private final class Listener implements LevelPlayNativeAdListener {
-
- private final Slot slot;
-
- Listener(Slot slot) {
- this.slot = slot;
- }
-
- private boolean current(@Nullable LevelPlayNativeAd ad) {
- return slots.get(slot.id) == slot && slot.ad != null && slot.ad == ad;
- }
-
- @Override
- public void onAdLoaded(@NonNull LevelPlayNativeAd ad, @NonNull AdInfo adInfo) {
- main.post(() -> {
- if (!current(ad)) return;
- slot.loaded = true;
- host.emit("nativeAdLoaded", event(slot, adInfo));
- });
- }
-
- @Override
- public void onAdLoadFailed(@NonNull LevelPlayNativeAd ad, @NonNull IronSourceError error) {
- main.post(() -> {
- if (!current(ad)) return;
- // The failed ad object is destroyed; the slot stays (NOT_LOADED) until the next loadNativeAd().
- slot.ad.destroyAd();
- slot.ad = null;
- slot.loaded = false;
- JSObject o = event(slot, null);
- o.put("error", Mappers.error(error.getErrorCode(), error.getErrorMessage()));
- host.emit("nativeAdLoadFailed", o);
- });
- }
-
- @Override
- public void onAdImpression(@NonNull LevelPlayNativeAd ad, @NonNull AdInfo adInfo) {
- main.post(() -> {
- if (!current(ad)) return;
- host.emit("nativeAdImpression", event(slot, adInfo));
- host.impression(Mappers.nativeImpression(adInfo));
- });
- }
-
- @Override
- public void onAdClicked(@NonNull LevelPlayNativeAd ad, @NonNull AdInfo adInfo) {
- main.post(() -> {
- if (!current(ad)) return;
- host.emit("nativeAdClicked", event(slot, adInfo));
- });
- }
- }
-}
diff --git a/android/src/main/java/fyi/crt/capacitor/levelplay/NativeAdStyle.java b/android/src/main/java/fyi/crt/capacitor/levelplay/NativeAdStyle.java
deleted file mode 100644
index 828ece8..0000000
--- a/android/src/main/java/fyi/crt/capacitor/levelplay/NativeAdStyle.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package fyi.crt.capacitor.levelplay;
-
-import androidx.annotation.Nullable;
-import com.getcapacitor.JSObject;
-
-/** Parsed NativeAdTemplateStyle (src/definitions.ts). Colours are ARGB; sizes are CSS px (dp). */
-final class NativeAdStyle {
-
- static final class Font {
-
- @Nullable
- final String family;
-
- @Nullable
- final Double size;
-
- Font(@Nullable String family, @Nullable Double size) {
- this.family = family;
- this.size = size;
- }
- }
-
- int backgroundColor = 0xFFFFFFFF;
- int titleColor = 0xFF202124;
- int bodyColor = 0xFF5F6368;
- int callToActionBackgroundColor = 0xFF1A73E8;
- int callToActionTextColor = 0xFFFFFFFF;
- double cornerRadius = 0;
- Font titleFont = new Font(null, null);
- Font bodyFont = new Font(null, null);
- Font callToActionFont = new Font(null, null);
-
- static NativeAdStyle parse(@Nullable JSObject o) throws CallError {
- NativeAdStyle s = new NativeAdStyle();
- if (o == null) return s;
- s.backgroundColor = color(o, "backgroundColor", s.backgroundColor);
- s.titleColor = color(o, "titleColor", s.titleColor);
- s.bodyColor = color(o, "bodyColor", s.bodyColor);
- s.callToActionBackgroundColor = color(o, "callToActionBackgroundColor", s.callToActionBackgroundColor);
- s.callToActionTextColor = color(o, "callToActionTextColor", s.callToActionTextColor);
- if (o.has("cornerRadius") && !o.isNull("cornerRadius")) {
- Object v = o.opt("cornerRadius");
- if (!(v instanceof Number) || !(((Number) v).doubleValue() >= 0)) throw CallError.invalid("style.cornerRadius must be >= 0");
- s.cornerRadius = ((Number) v).doubleValue();
- }
- s.titleFont = font(o, "titleFont");
- s.bodyFont = font(o, "bodyFont");
- s.callToActionFont = font(o, "callToActionFont");
- return s;
- }
-
- private static int color(JSObject o, String key, int fallback) throws CallError {
- if (!o.has(key) || o.isNull(key)) return fallback;
- Integer c = OverlayMath.parseColor(o.optString(key, null));
- if (c == null) throw CallError.invalid("style." + key + " must be #RRGGBB or #RRGGBBAA");
- return c;
- }
-
- private static Font font(JSObject o, String key) throws CallError {
- if (!o.has(key) || o.isNull(key)) return new Font(null, null);
- JSObject f = o.getJSObject(key);
- if (f == null) throw CallError.invalid("style." + key + " must be an object { family?, size? }");
- String family = f.getString("family");
- if (family != null && family.trim().isEmpty()) family = null;
- Double size = null;
- if (f.has("size") && !f.isNull("size")) {
- Object v = f.opt("size");
- if (!(v instanceof Number) || !(((Number) v).doubleValue() > 0) || Double.isInfinite(((Number) v).doubleValue())) {
- throw CallError.invalid("style." + key + ".size must be a positive number");
- }
- size = ((Number) v).doubleValue();
- }
- return new Font(family, size);
- }
-}
diff --git a/android/src/main/java/fyi/crt/capacitor/levelplay/NativeAdTemplate.java b/android/src/main/java/fyi/crt/capacitor/levelplay/NativeAdTemplate.java
deleted file mode 100644
index 6e4f6d9..0000000
--- a/android/src/main/java/fyi/crt/capacitor/levelplay/NativeAdTemplate.java
+++ /dev/null
@@ -1,328 +0,0 @@
-package fyi.crt.capacitor.levelplay;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Typeface;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.GradientDrawable;
-import android.net.Uri;
-import android.os.Handler;
-import android.os.Looper;
-import android.text.TextUtils;
-import android.util.Log;
-import android.util.TypedValue;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import androidx.annotation.Nullable;
-import com.ironsource.mediationsdk.ads.nativead.LevelPlayMediaView;
-import com.ironsource.mediationsdk.ads.nativead.LevelPlayNativeAd;
-import com.ironsource.mediationsdk.ads.nativead.NativeAdLayout;
-import com.ironsource.mediationsdk.ads.nativead.interfaces.NativeAdDataInterface;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * The plugin's own native ad templates (the SDK ships none, design §4.1), built in code so every style value applies
- * directly. Both draw an "Ad" badge and keep the bottom-left corner free for the network's privacy / AdChoices icon.
- *
- * - small: [icon] [title / Ad + advertiser / body] [CTA], one row; fits rows from about 90 px tall.
- * - medium: [icon] [title / Ad + advertiser], body, media view (fills the rest), CTA aligned right.
- */
-final class NativeAdTemplate {
-
- private static final String TAG = "LevelPlay";
- private static final int BADGE_BG = 0xFFFFC107;
- private static final int BADGE_TEXT = 0xFF202124;
- private static final Map ASSET_FONTS = new HashMap<>();
- private static final ExecutorService IO = Executors.newSingleThreadExecutor();
-
- private NativeAdTemplate() {}
-
- /** The template's asset views, created and styled but not filled. */
- static final class Views {
-
- final NativeAdLayout root;
- final TextView title;
- final TextView advertiser;
- final TextView body;
- final ImageView icon;
- final Button cta;
-
- @Nullable
- final LevelPlayMediaView media;
-
- Views(NativeAdLayout root, TextView title, TextView advertiser, TextView body, ImageView icon, Button cta, @Nullable LevelPlayMediaView media) {
- this.root = root;
- this.title = title;
- this.advertiser = advertiser;
- this.body = body;
- this.icon = icon;
- this.cta = cta;
- this.media = media;
- }
- }
-
- /** Renders a loaded ad: create, fill from the ad's assets, hand the views to the SDK and register them. */
- static NativeAdLayout build(Context ctx, String template, NativeAdStyle style, LevelPlayNativeAd ad) {
- Views v = create(ctx, template, style);
- fill(v, ad.getTitle(), ad.getAdvertiser(), ad.getBody(), ad.getCallToAction(), ad.getIcon());
- v.root.setTitleView(v.title);
- v.root.setAdvertiserView(v.advertiser);
- v.root.setBodyView(v.body);
- v.root.setIconView(v.icon);
- v.root.setCallToActionView(v.cta);
- if (v.media != null) v.root.setMediaView(v.media);
- v.root.registerNativeAdViews(ad);
- return v.root;
- }
-
- static Views create(Context ctx, String template, NativeAdStyle style) {
- boolean medium = "medium".equals(template);
- NativeAdLayout root = new NativeAdLayout(ctx);
- GradientDrawable bg = new GradientDrawable();
- bg.setColor(style.backgroundColor);
- bg.setCornerRadius(dp(ctx, style.cornerRadius));
- root.setBackground(bg);
- root.setClipToOutline(true);
- // The template consumes touches inside its bounds so taps between asset views do not reach the game.
- root.setClickable(true);
-
- ImageView icon = new ImageView(ctx);
- icon.setScaleType(ImageView.ScaleType.CENTER_CROP);
- GradientDrawable iconBg = new GradientDrawable();
- iconBg.setCornerRadius(dp(ctx, 6));
- iconBg.setColor(0x14000000);
- icon.setBackground(iconBg);
- icon.setClipToOutline(true);
-
- TextView title = text(ctx, style.titleColor, 15, style.titleFont, true);
- title.setMaxLines(medium ? 2 : 1);
-
- TextView badge = text(ctx, BADGE_TEXT, 10, style.bodyFont, true);
- badge.setText(R.string.levelplay_native_ad_badge);
- badge.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
- GradientDrawable badgeBg = new GradientDrawable();
- badgeBg.setColor(BADGE_BG);
- badgeBg.setCornerRadius(dp(ctx, 3));
- badge.setBackground(badgeBg);
- int bp = (int) dp(ctx, 4);
- badge.setPadding(bp, 0, bp, 0);
-
- TextView advertiser = text(ctx, style.bodyColor, 12, style.bodyFont, false);
- advertiser.setMaxLines(1);
-
- TextView body = text(ctx, style.bodyColor, 12, style.bodyFont, false);
- body.setMaxLines(2);
-
- Button cta = new Button(ctx);
- cta.setAllCaps(false);
- cta.setStateListAnimator(null);
- cta.setMinWidth(0);
- cta.setMinimumWidth(0);
- cta.setMinHeight(0);
- cta.setMinimumHeight(0);
- cta.setSingleLine(true);
- cta.setEllipsize(TextUtils.TruncateAt.END);
- cta.setTextColor(style.callToActionTextColor);
- applyFont(ctx, cta, style.callToActionFont, 13, true);
- GradientDrawable ctaBg = new GradientDrawable();
- ctaBg.setColor(style.callToActionBackgroundColor);
- ctaBg.setCornerRadius(dp(ctx, 6));
- cta.setBackground(ctaBg);
- int cp = (int) dp(ctx, 12);
- cta.setPadding(cp, 0, cp, 0);
- cta.setGravity(Gravity.CENTER);
-
- // Badge + advertiser row.
- LinearLayout adRow = new LinearLayout(ctx);
- adRow.setOrientation(LinearLayout.HORIZONTAL);
- adRow.setGravity(Gravity.CENTER_VERTICAL);
- adRow.addView(badge, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
- LinearLayout.LayoutParams advLp = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1);
- advLp.leftMargin = (int) dp(ctx, 6);
- adRow.addView(advertiser, advLp);
-
- LevelPlayMediaView media = null;
- int pad = (int) dp(ctx, medium ? 10 : 8);
- if (medium) {
- LinearLayout col = new LinearLayout(ctx);
- col.setOrientation(LinearLayout.VERTICAL);
- col.setPadding(pad, pad, pad, pad);
-
- LinearLayout header = new LinearLayout(ctx);
- header.setOrientation(LinearLayout.HORIZONTAL);
- header.setGravity(Gravity.CENTER_VERTICAL);
- int is = (int) dp(ctx, 40);
- header.addView(icon, new LinearLayout.LayoutParams(is, is));
- LinearLayout texts = new LinearLayout(ctx);
- texts.setOrientation(LinearLayout.VERTICAL);
- texts.addView(title);
- texts.addView(adRow);
- LinearLayout.LayoutParams tLp = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1);
- tLp.leftMargin = (int) dp(ctx, 8);
- header.addView(texts, tLp);
- col.addView(header);
-
- LinearLayout.LayoutParams bodyLp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- bodyLp.topMargin = (int) dp(ctx, 6);
- col.addView(body, bodyLp);
-
- media = new LevelPlayMediaView(ctx);
- LinearLayout.LayoutParams mLp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1);
- mLp.topMargin = (int) dp(ctx, 8);
- col.addView(media, mLp);
-
- // CTA on the right: the bottom-left corner stays free for the AdChoices icon.
- LinearLayout.LayoutParams ctaLp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, (int) dp(ctx, 36));
- ctaLp.topMargin = (int) dp(ctx, 8);
- ctaLp.gravity = Gravity.END;
- col.addView(cta, ctaLp);
- root.addView(col, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
- } else {
- LinearLayout row = new LinearLayout(ctx);
- row.setOrientation(LinearLayout.HORIZONTAL);
- row.setGravity(Gravity.CENTER_VERTICAL);
- row.setPadding(pad, pad, pad, pad);
- int is = (int) dp(ctx, 48);
- row.addView(icon, new LinearLayout.LayoutParams(is, is));
- LinearLayout texts = new LinearLayout(ctx);
- texts.setOrientation(LinearLayout.VERTICAL);
- texts.addView(title);
- texts.addView(adRow);
- texts.addView(body);
- LinearLayout.LayoutParams tLp = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1);
- tLp.leftMargin = (int) dp(ctx, 8);
- tLp.rightMargin = (int) dp(ctx, 8);
- row.addView(texts, tLp);
- row.addView(cta, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, (int) dp(ctx, 36)));
- root.addView(row, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
- }
-
- return new Views(root, title, advertiser, body, icon, cta, media);
- }
-
- static void fill(
- Views v,
- @Nullable String title,
- @Nullable String advertiser,
- @Nullable String body,
- @Nullable String callToAction,
- @Nullable NativeAdDataInterface.Image icon
- ) {
- setOrHide(v.title, title);
- setOrHide(v.advertiser, advertiser);
- setOrHide(v.body, body);
- if (callToAction != null && !callToAction.isEmpty()) v.cta.setText(callToAction);
- else v.cta.setText(R.string.levelplay_native_ad_cta_fallback);
- bindIcon(v.icon, icon);
- }
-
- private static TextView text(Context ctx, int color, double defaultSize, NativeAdStyle.Font font, boolean bold) {
- TextView t = new TextView(ctx);
- t.setTextColor(color);
- t.setEllipsize(TextUtils.TruncateAt.END);
- t.setIncludeFontPadding(false);
- applyFont(ctx, t, font, defaultSize, bold);
- return t;
- }
-
- private static void applyFont(Context ctx, TextView t, NativeAdStyle.Font font, double defaultSize, boolean bold) {
- // CSS px = dp, and like WebView text it ignores the system font scale.
- t.setTextSize(TypedValue.COMPLEX_UNIT_DIP, (float) (font.size != null ? font.size : defaultSize));
- Typeface tf = typeface(ctx, font.family, bold);
- t.setTypeface(tf);
- }
-
- /** System family name, or a .ttf / .otf file in the web assets (Capacitor copies the web dir to assets/public). */
- static Typeface typeface(Context ctx, @Nullable String family, boolean bold) {
- int style = bold ? Typeface.BOLD : Typeface.NORMAL;
- if (family == null) return Typeface.defaultFromStyle(style);
- String lower = family.toLowerCase(java.util.Locale.ROOT);
- if (lower.endsWith(".ttf") || lower.endsWith(".otf")) {
- String path = family;
- while (path.startsWith("/")) path = path.substring(1);
- if (path.startsWith("./")) path = path.substring(2);
- String asset = "public/" + path;
- synchronized (ASSET_FONTS) {
- Typeface cached = ASSET_FONTS.get(asset);
- if (cached != null) return cached;
- try {
- Typeface tf = Typeface.createFromAsset(ctx.getAssets(), asset);
- ASSET_FONTS.put(asset, tf);
- return tf;
- } catch (RuntimeException e) {
- Log.w(TAG, "Native ad font not found in assets: " + asset + "; using the system font");
- return Typeface.defaultFromStyle(style);
- }
- }
- }
- return Typeface.create(family, style);
- }
-
- private static void setOrHide(TextView v, @Nullable String text) {
- if (text == null || text.trim().isEmpty()) {
- v.setText("");
- v.setVisibility(View.GONE);
- } else {
- v.setText(text);
- v.setVisibility(View.VISIBLE);
- }
- }
-
- private static void bindIcon(ImageView icon, @Nullable NativeAdDataInterface.Image image) {
- if (image == null) {
- icon.setVisibility(View.GONE);
- return;
- }
- Drawable d = image.getDrawable();
- if (d != null) {
- icon.setImageDrawable(d);
- return;
- }
- Uri uri = image.getUri();
- if (uri == null || uri.getScheme() == null || !uri.getScheme().startsWith("http")) {
- icon.setVisibility(View.GONE);
- return;
- }
- // Some adapters only give a URL: fetch it off the main thread.
- Handler main = new Handler(Looper.getMainLooper());
- String url = uri.toString();
- IO.execute(() -> {
- Bitmap bmp = null;
- HttpURLConnection c = null;
- try {
- c = (HttpURLConnection) new URL(url).openConnection();
- c.setConnectTimeout(10000);
- c.setReadTimeout(10000);
- try (InputStream in = c.getInputStream()) {
- bmp = BitmapFactory.decodeStream(in);
- }
- } catch (Exception e) {
- Log.w(TAG, "Native ad icon download failed: " + e);
- } finally {
- if (c != null) c.disconnect();
- }
- Bitmap result = bmp;
- main.post(() -> {
- if (result != null) icon.setImageBitmap(result);
- else icon.setVisibility(View.GONE);
- });
- });
- }
-
- static float dp(Context ctx, double v) {
- return (float) (v * ctx.getResources().getDisplayMetrics().density);
- }
-}
diff --git a/android/src/main/java/fyi/crt/capacitor/levelplay/OverlayHost.java b/android/src/main/java/fyi/crt/capacitor/levelplay/OverlayHost.java
deleted file mode 100644
index 1a367ca..0000000
--- a/android/src/main/java/fyi/crt/capacitor/levelplay/OverlayHost.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package fyi.crt.capacitor.levelplay;
-
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-import androidx.annotation.Nullable;
-import androidx.core.graphics.Insets;
-import androidx.core.view.ViewCompat;
-import androidx.core.view.WindowInsetsCompat;
-
-/**
- * Plugin-owned, pass-through FrameLayout above the WebView (design §6.2). It is a sibling of the WebView in the
- * WebView's parent, added right after it so it draws on top. It is neither clickable nor focusable and has no touch
- * listener, so touches outside its (visible) children fall through to the WebView.
- *
- * Public geometry is CSS px relative to the WebView's top-left corner (1 CSS px = 1 dp in a Capacitor WebView).
- * Children are positioned with FrameLayout margins measured from the WebView's offset inside the host, so the host
- * does not need to share the WebView's bounds (Capacitor 8 may pad the parent; Capacitor 7 may set WebView margins).
- * Main thread only.
- */
-final class OverlayHost {
-
- interface Listener {
- /** The WebView or the host moved / resized, or the window insets changed. Called posted, never mid-layout. */
- void onOverlayLayoutChanged();
- }
-
- final FrameLayout view;
- private final View webView;
- private final Listener listener;
- private final float density;
- private boolean relayoutPosted;
- private final View.OnLayoutChangeListener layoutListener = (v, l, t, r, b, ol, ot, or, ob) -> {
- if (l != ol || t != ot || r != or || b != ob) postRelayout();
- };
- private final Runnable relayout = () -> {
- relayoutPosted = false;
- listenerRelayout();
- };
-
- private OverlayHost(View webView, ViewGroup parent, Listener listener) {
- this.webView = webView;
- this.listener = listener;
- this.density = webView.getResources().getDisplayMetrics().density;
- view = new FrameLayout(webView.getContext());
- view.setClickable(false);
- view.setFocusable(false);
- view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
- view.setClipChildren(true);
- int index = parent.indexOfChild(webView) + 1;
- parent.addView(view, index, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
- webView.addOnLayoutChangeListener(layoutListener);
- view.addOnLayoutChangeListener(layoutListener);
- // Insets are only observed; returning them unconsumed keeps Capacitor's own handling on the WebView intact.
- ViewCompat.setOnApplyWindowInsetsListener(view, (v, insets) -> {
- postRelayout();
- return insets;
- });
- }
-
- /** Attaches a host next to the WebView, or returns null when the WebView has no parent ViewGroup yet. */
- @Nullable
- static OverlayHost attach(@Nullable View webView, Listener listener) {
- if (webView == null || !(webView.getParent() instanceof ViewGroup)) return null;
- return new OverlayHost(webView, (ViewGroup) webView.getParent(), listener);
- }
-
- void detach() {
- webView.removeOnLayoutChangeListener(layoutListener);
- view.removeOnLayoutChangeListener(layoutListener);
- ViewCompat.setOnApplyWindowInsetsListener(view, null);
- view.removeCallbacks(relayout);
- view.removeAllViews();
- if (view.getParent() instanceof ViewGroup) ((ViewGroup) view.getParent()).removeView(view);
- }
-
- void postRelayout() {
- if (relayoutPosted) return;
- relayoutPosted = true;
- view.post(relayout);
- }
-
- private void listenerRelayout() {
- listener.onOverlayLayoutChanged();
- }
-
- float density() {
- return density;
- }
-
- int toPx(double css) {
- return (int) Math.round(css * density);
- }
-
- /** The WebView's own rect in CSS px (origin 0, 0). */
- double[] webViewCss() {
- return OverlayMath.rect(0, 0, webView.getWidth() / (double) density, webView.getHeight() / (double) density);
- }
-
- /** WebView rect ∩ (window − system bars − display cutout), in WebView-local CSS px (design §6.3). */
- double[] safeAreaCss() {
- int[] loc = new int[2];
- webView.getLocationInWindow(loc);
- View root = webView.getRootView();
- int il = 0, it = 0, ir = 0, ib = 0;
- WindowInsetsCompat insets = ViewCompat.getRootWindowInsets(webView);
- if (insets != null) {
- Insets i = insets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout());
- il = i.left;
- it = i.top;
- ir = i.right;
- ib = i.bottom;
- }
- return OverlayMath.safeAreaCss(
- loc[0],
- loc[1],
- webView.getWidth(),
- webView.getHeight(),
- root.getWidth(),
- root.getHeight(),
- il,
- it,
- ir,
- ib,
- density
- );
- }
-
- /** Adds a child (hidden or not, as the caller set it) on top of the other overlay children. */
- void add(View child) {
- if (child.getParent() instanceof ViewGroup) ((ViewGroup) child.getParent()).removeView(child);
- view.addView(child, new FrameLayout.LayoutParams(0, 0));
- }
-
- void remove(View child) {
- if (child.getParent() == view) view.removeView(child);
- }
-
- /** Places a child at a WebView-local CSS rect. */
- void place(View child, double[] css) {
- int[] wv = new int[2];
- int[] host = new int[2];
- webView.getLocationInWindow(wv);
- view.getLocationInWindow(host);
- int left = wv[0] - host[0] + toPx(css[0]);
- int top = wv[1] - host[1] + toPx(css[1]);
- int w = Math.max(0, toPx(css[2]));
- int h = Math.max(0, toPx(css[3]));
- ViewGroup.LayoutParams raw = child.getLayoutParams();
- FrameLayout.LayoutParams lp = raw instanceof FrameLayout.LayoutParams ? (FrameLayout.LayoutParams) raw : new FrameLayout.LayoutParams(w, h);
- if (lp.width == w && lp.height == h && lp.leftMargin == left && lp.topMargin == top && raw == lp) return;
- lp.width = w;
- lp.height = h;
- lp.leftMargin = left;
- lp.topMargin = top;
- lp.gravity = android.view.Gravity.TOP | android.view.Gravity.LEFT;
- child.setLayoutParams(lp);
- }
-}
diff --git a/android/src/main/java/fyi/crt/capacitor/levelplay/OverlayMath.java b/android/src/main/java/fyi/crt/capacitor/levelplay/OverlayMath.java
deleted file mode 100644
index f596580..0000000
--- a/android/src/main/java/fyi/crt/capacitor/levelplay/OverlayMath.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package fyi.crt.capacitor.levelplay;
-
-import java.util.Map;
-import java.util.regex.Pattern;
-
-/**
- * Pure helpers (no Android, no SDK types) for overlay geometry and argument validation, unit tested on the JVM.
- * Rects are {@code double[]{x, y, width, height}}.
- */
-final class OverlayMath {
-
- /** LevelPlaySegment.setCustom limits read from the 9.6.1 bytecode: 1-32 chars, letters and digits, at most 5. */
- static final int MAX_CUSTOM_PARAMS = 5;
- static final int MAX_CUSTOM_LENGTH = 32;
- private static final Pattern ALNUM = Pattern.compile("^[a-zA-Z0-9]+$");
- private static final Pattern HEX_COLOR = Pattern.compile("^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$");
-
- private OverlayMath() {}
-
- static double[] rect(double x, double y, double w, double h) {
- return new double[] { x, y, w, h };
- }
-
- /** Intersection of two rects; an empty intersection has zero width / height at the clamped origin. */
- static double[] intersect(double[] a, double[] b) {
- double l = Math.max(a[0], b[0]);
- double t = Math.max(a[1], b[1]);
- double r = Math.min(a[0] + a[2], b[0] + b[2]);
- double btm = Math.min(a[1] + a[3], b[1] + b[3]);
- return rect(l, t, Math.max(0, r - l), Math.max(0, btm - t));
- }
-
- /**
- * Safe area of the WebView in WebView-local CSS px: the WebView's on-screen rect (window px) intersected with the
- * window minus the system insets (window px), shifted to the WebView origin and divided by the density.
- */
- static double[] safeAreaCss(
- int wvLeft,
- int wvTop,
- int wvWidth,
- int wvHeight,
- int windowWidth,
- int windowHeight,
- int insetLeft,
- int insetTop,
- int insetRight,
- int insetBottom,
- float density
- ) {
- double[] web = rect(wvLeft, wvTop, wvWidth, wvHeight);
- double[] safe = rect(insetLeft, insetTop, windowWidth - insetLeft - insetRight, windowHeight - insetTop - insetBottom);
- double[] s = intersect(web, safe);
- return rect((s[0] - wvLeft) / density, (s[1] - wvTop) / density, s[2] / density, s[3] / density);
- }
-
- /** Banner frame inside {@code area} (design §6.4): centred horizontally, anchored top / bottom / center. */
- static double[] bannerFrame(double[] area, double width, double height, String position, double offsetX, double offsetY) {
- double x = area[0] + (area[2] - width) / 2 + offsetX;
- double y;
- switch (position) {
- case "top":
- y = area[1] + offsetY;
- break;
- case "center":
- y = area[1] + (area[3] - height) / 2 + offsetY;
- break;
- default:
- y = area[1] + area[3] - height + offsetY;
- break;
- }
- return rect(x, y, width, height);
- }
-
- static boolean isPosition(String p) {
- return "top".equals(p) || "bottom".equals(p) || "center".equals(p);
- }
-
- static boolean isBannerSize(String s) {
- switch (s) {
- case "BANNER":
- case "LARGE":
- case "MEDIUM_RECTANGLE":
- case "LEADERBOARD":
- case "ADAPTIVE":
- case "CUSTOM":
- return true;
- default:
- return false;
- }
- }
-
- /** Error message for segment custom parameters that break the SDK limits, or null when they are fine. */
- static String customParamsError(Map params) {
- if (params.size() > MAX_CUSTOM_PARAMS) {
- return "customParameters: at most " + MAX_CUSTOM_PARAMS + " pairs (got " + params.size() + ")";
- }
- for (Map.Entry e : params.entrySet()) {
- String k = e.getKey();
- if (!validToken(k)) return "customParameters: key '" + k + "' must be 1-32 letters or digits";
- Object v = e.getValue();
- if (!(v instanceof String)) return "customParameters: value of '" + k + "' must be a string";
- if (!validToken((String) v)) return "customParameters: value of '" + k + "' must be 1-32 letters or digits";
- }
- return null;
- }
-
- private static boolean validToken(String s) {
- return s != null && s.length() >= 1 && s.length() <= MAX_CUSTOM_LENGTH && ALNUM.matcher(s).matches();
- }
-
- /** CSS {@code #RRGGBB} / {@code #RRGGBBAA} to Android ARGB, or null when malformed. */
- static Integer parseColor(String css) {
- if (css == null || !HEX_COLOR.matcher(css).matches()) return null;
- long v = Long.parseLong(css.substring(1), 16);
- if (css.length() == 7) return (int) (0xFF000000L | v);
- long rgb = v >>> 8;
- long a = v & 0xFF;
- return (int) ((a << 24) | rgb);
- }
-}
diff --git a/android/src/main/res/values/strings.xml b/android/src/main/res/values/strings.xml
deleted file mode 100644
index 3add140..0000000
--- a/android/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- Ad
- Open
-
diff --git a/android/src/test/java/fyi/crt/capacitor/levelplay/OverlayMathTest.java b/android/src/test/java/fyi/crt/capacitor/levelplay/OverlayMathTest.java
deleted file mode 100644
index 6f2c766..0000000
--- a/android/src/test/java/fyi/crt/capacitor/levelplay/OverlayMathTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package fyi.crt.capacitor.levelplay;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.junit.Test;
-
-public class OverlayMathTest {
-
- private static final double EPS = 1e-9;
-
- @Test
- public void intersectOverlapsAndEmpty() {
- assertArrayEquals(new double[] { 10, 20, 90, 80 }, OverlayMath.intersect(OverlayMath.rect(0, 0, 100, 100), OverlayMath.rect(10, 20, 200, 200)), EPS);
- double[] none = OverlayMath.intersect(OverlayMath.rect(0, 0, 10, 10), OverlayMath.rect(20, 20, 5, 5));
- assertEquals(0, none[2], EPS);
- assertEquals(0, none[3], EPS);
- }
-
- @Test
- public void safeAreaEdgeToEdgeWebView() {
- // 1080 x 2400 window at density 2.625; WebView covers the window; status bar 63 px, nav bar 126 px.
- double[] s = OverlayMath.safeAreaCss(0, 0, 1080, 2400, 1080, 2400, 0, 63, 0, 126, 2.625f);
- assertArrayEquals(new double[] { 0, 24, 1080 / 2.625, (2400 - 63 - 126) / 2.625 }, s, EPS);
- }
-
- @Test
- public void safeAreaWebViewAlreadyInset() {
- // Capacitor native insets handling: the WebView itself sits between the bars, so the safe area is all of it.
- double[] s = OverlayMath.safeAreaCss(0, 63, 1080, 2211, 1080, 2400, 0, 63, 0, 126, 2.625f);
- assertArrayEquals(new double[] { 0, 0, 1080 / 2.625, 2211 / 2.625 }, s, EPS);
- }
-
- @Test
- public void safeAreaLandscapeCutout() {
- // Landscape with a 100 px cutout on the left and a 120 px nav bar on the right; density 2.
- double[] s = OverlayMath.safeAreaCss(0, 0, 2400, 1080, 2400, 1080, 100, 50, 120, 0, 2f);
- assertArrayEquals(new double[] { 50, 25, (2400 - 220) / 2.0, (1080 - 50) / 2.0 }, s, EPS);
- }
-
- @Test
- public void bannerFramePositions() {
- double[] area = OverlayMath.rect(0, 24, 411, 800);
- assertArrayEquals(new double[] { 45.5, 24, 320, 50 }, OverlayMath.bannerFrame(area, 320, 50, "top", 0, 0), EPS);
- assertArrayEquals(new double[] { 45.5, 774, 320, 50 }, OverlayMath.bannerFrame(area, 320, 50, "bottom", 0, 0), EPS);
- assertArrayEquals(new double[] { 45.5, 399, 320, 50 }, OverlayMath.bannerFrame(area, 320, 50, "center", 0, 0), EPS);
- assertArrayEquals(new double[] { 55.5, 764, 320, 50 }, OverlayMath.bannerFrame(area, 320, 50, "bottom", 10, -10), EPS);
- }
-
- @Test
- public void positionsAndSizes() {
- assertTrue(OverlayMath.isPosition("top"));
- assertFalse(OverlayMath.isPosition("left"));
- assertTrue(OverlayMath.isBannerSize("CUSTOM"));
- assertTrue(OverlayMath.isBannerSize("ADAPTIVE"));
- assertFalse(OverlayMath.isBannerSize("SMART"));
- }
-
- @Test
- public void customParams() {
- Map ok = new LinkedHashMap<>();
- ok.put("tier", "gold");
- ok.put("ab1", "B");
- assertNull(OverlayMath.customParamsError(ok));
-
- Map badChar = new LinkedHashMap<>();
- badChar.put("my-key", "x");
- assertNotNull(OverlayMath.customParamsError(badChar));
-
- Map empty = new LinkedHashMap<>();
- empty.put("k", "");
- assertNotNull(OverlayMath.customParamsError(empty));
-
- Map tooLong = new LinkedHashMap<>();
- tooLong.put("k", "123456789012345678901234567890123");
- assertNotNull(OverlayMath.customParamsError(tooLong));
-
- Map notString = new LinkedHashMap<>();
- notString.put("k", 5);
- assertNotNull(OverlayMath.customParamsError(notString));
-
- Map six = new LinkedHashMap<>();
- for (int i = 0; i < 6; i++) six.put("k" + i, "v");
- assertNotNull(OverlayMath.customParamsError(six));
- }
-
- @Test
- public void colors() {
- assertEquals(Integer.valueOf(0xFF112233), OverlayMath.parseColor("#112233"));
- assertEquals(Integer.valueOf(0x80112233), OverlayMath.parseColor("#11223380"));
- assertNull(OverlayMath.parseColor("112233"));
- assertNull(OverlayMath.parseColor("#12345"));
- assertNull(OverlayMath.parseColor("red"));
- assertNull(OverlayMath.parseColor(null));
- }
-}
diff --git a/dist/docs.json b/dist/docs.json
index 094cfd3..8ab1068 100644
--- a/dist/docs.json
+++ b/dist/docs.json
@@ -2,7 +2,7 @@
"api": {
"name": "LevelPlayPlugin",
"slug": "levelplayplugin",
- "docs": "Unity LevelPlay ads (ad-unit API): rewarded, interstitial and (since 0.3.0) banner and native ads, impression-level\nrevenue, segments and placement capping.",
+ "docs": "Unity LevelPlay rewarded and interstitial ads (ad-unit API).",
"tags": [
{
"text": "0.1.0",
@@ -279,374 +279,6 @@
"complexTypes": [],
"slug": "validateintegration"
},
- {
- "name": "getCapabilities",
- "signature": "() => Promise",
- "parameters": [],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "What this platform supports (banners, native ad templates, impression data, `adInfoChanged`). Works before init.\nWeb: everything `false`.",
- "complexTypes": [
- "Capabilities"
- ],
- "slug": "getcapabilities"
- },
- {
- "name": "setSegment",
- "signature": "(options: SegmentOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "SegmentOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Set the user segment (`LevelPlay.setSegment` with a `LevelPlaySegment` / `LPMSegment`). Call it before\n`initialize()` so the first ad requests use it; later calls apply to the following requests. Rejects with\n`INVALID_ARGUMENT` when `customParameters` break the SDK limits. Web: no-op.",
- "complexTypes": [
- "SegmentOptions"
- ],
- "slug": "setsegment"
- },
- {
- "name": "setDynamicUserId",
- "signature": "(options: DynamicUserIdOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "DynamicUserIdOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Set or change the dynamic user id used in server-to-server reward callbacks (`LevelPlay.setDynamicUserId` on\nboth platforms). Set it before `showRewarded()`. Web: resolves `{ valid: false }`.",
- "complexTypes": [
- "DynamicUserIdResult",
- "DynamicUserIdOptions"
- ],
- "slug": "setdynamicuserid"
- },
- {
- "name": "isPlacementCapped",
- "signature": "(options: PlacementCappedOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "PlacementCappedOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Whether a rewarded or interstitial placement is capped right now (static\n`LevelPlayRewardedAd.isPlacementCapped` / `LevelPlayInterstitialAd.isPlacementCapped` on Android,\n`LPMRewardedAd.isPlacementCapped:` / `LPMInterstitialAd.isPlacementCapped:` on iOS). Works without a loaded ad.\nWeb: `{ capped: false }`.",
- "complexTypes": [
- "PlacementCappedResult",
- "PlacementCappedOptions"
- ],
- "slug": "isplacementcapped"
- },
- {
- "name": "getReward",
- "signature": "(options: GetRewardOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "GetRewardOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "The reward configured for a rewarded ad unit or one of its placements (`LevelPlayRewardedAd.getReward(placement)` /\n`LPMRewardedAd getReward(placementName:)`), for \"watch a video for N coins\" buttons. The SDK returns\n`{ name: '', amount: 0 }` when it has no reward configuration (for example before init). Web: the same empty\nreward.",
- "complexTypes": [
- "Reward",
- "GetRewardOptions"
- ],
- "slug": "getreward"
- },
- {
- "name": "createBanner",
- "signature": "(options: CreateBannerOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "CreateBannerOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Create a banner (`LevelPlayBannerAdView` / `LPMBannerAdView`) for the ad unit and attach it, hidden, in a\npass-through overlay above the WebView. Requires a finished `initialize()` (`NOT_INITIALIZED` otherwise). Rejects\nwith `ALREADY_EXISTS` when `bannerId` is in use; destroy it first. Does not load: call `loadBanner()`.\nWeb: rejects as unimplemented.",
- "complexTypes": [
- "BannerResult",
- "CreateBannerOptions"
- ],
- "slug": "createbanner"
- },
- {
- "name": "loadBanner",
- "signature": "(options: BannerIdOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "BannerIdOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Load the banner (`loadAd()` / `loadAdWithViewController:`). The outcome arrives as `bannerLoaded` or\n`bannerLoadFailed`; after the first load the SDK refreshes the banner on the dashboard interval. The SDK accepts\none load per banner object: calling it again has no effect (Android logs \"Banner load already called\"), so to retry\nright away after `bannerLoadFailed`, destroy the banner and create it again. Web: no-op.",
- "complexTypes": [
- "BannerIdOptions"
- ],
- "slug": "loadbanner"
- },
- {
- "name": "showBanner",
- "signature": "(options: BannerIdOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "BannerIdOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Make the banner visible and resume auto refresh (`resumeAutoRefresh`). Can be called before the load finished;\nthe creative appears when it arrives. Web: rejects as unimplemented.",
- "complexTypes": [
- "BannerResult",
- "BannerIdOptions"
- ],
- "slug": "showbanner"
- },
- {
- "name": "hideBanner",
- "signature": "(options: BannerIdOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "BannerIdOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Hide the banner and pause auto refresh (`pauseAutoRefresh`) so hidden banners do not burn impressions. The view\nstays attached; `showBanner()` brings it back. Web: no-op.",
- "complexTypes": [
- "BannerIdOptions"
- ],
- "slug": "hidebanner"
- },
- {
- "name": "setBannerLayout",
- "signature": "(options: SetBannerLayoutOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "SetBannerLayoutOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Move a banner (position, offsets, safe area). Resolves with the new frame. Web: rejects as unimplemented.",
- "complexTypes": [
- "BannerResult",
- "SetBannerLayoutOptions"
- ],
- "slug": "setbannerlayout"
- },
- {
- "name": "destroyBanner",
- "signature": "(options: BannerIdOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "BannerIdOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Remove the banner from the screen and `destroy()` it. A destroyed banner cannot be reused; create a new one.\nResolves also for unknown ids. Web: no-op.",
- "complexTypes": [
- "BannerIdOptions"
- ],
- "slug": "destroybanner"
- },
- {
- "name": "loadNativeAd",
- "signature": "(options: LoadNativeAdOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "LoadNativeAdOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Load a native ad into a slot. Following the SDK rule \"one native ad object per load\", it destroys the slot's\nprevious ad (hiding it if shown), builds a new `LevelPlayNativeAd` with the placement and loads it. The outcome\narrives as `nativeAdLoaded` or `nativeAdLoadFailed`. Requires a finished `initialize()`. Rejects with\n`UNSUPPORTED` when `getCapabilities().nativeAd` is `false` or the template is not listed there. Web: rejects as\nunimplemented.",
- "complexTypes": [
- "LoadNativeAdOptions"
- ],
- "slug": "loadnativead"
- },
- {
- "name": "showNativeAd",
- "signature": "(options: NativeAdRectOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "NativeAdRectOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Render the loaded native ad into its template, register the asset views with the SDK\n(`NativeAdLayout.registerNativeAdViews` / `ISNativeAdView registerNativeAdViews:`) and place it at `rect` above the\nWebView. Rejects with `NOT_LOADED` before `nativeAdLoaded`. The impression is reported by `nativeAdImpression`.\nWeb: rejects as unimplemented.",
- "complexTypes": [
- "NativeAdRectOptions"
- ],
- "slug": "shownativead"
- },
- {
- "name": "setNativeAdRect",
- "signature": "(options: NativeAdRectOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "NativeAdRectOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Move or resize a shown native ad, for example after the placeholder element moved. Web: no-op.",
- "complexTypes": [
- "NativeAdRectOptions"
- ],
- "slug": "setnativeadrect"
- },
- {
- "name": "hideNativeAd",
- "signature": "(options: NativeAdIdOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "NativeAdIdOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Hide a shown native ad (the view stays registered; `showNativeAd()` shows it again). Web: no-op.",
- "complexTypes": [
- "NativeAdIdOptions"
- ],
- "slug": "hidenativead"
- },
- {
- "name": "destroyNativeAd",
- "signature": "(options: NativeAdIdOptions) => Promise",
- "parameters": [
- {
- "name": "options",
- "docs": "",
- "type": "NativeAdIdOptions"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Remove the native ad view and `destroyAd()` it. Resolves also for unknown ids. Web: no-op.",
- "complexTypes": [
- "NativeAdIdOptions"
- ],
- "slug": "destroynativead"
- },
{
"name": "addListener",
"signature": "(eventName: 'loaded', listenerFunc: (event: AdEvent) => void) => Promise",
@@ -850,412 +482,6 @@
],
"slug": "addlistenerrewarded-"
},
- {
- "name": "addListener",
- "signature": "(eventName: 'adInfoChanged', listenerFunc: (event: AdEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'adInfoChanged'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: AdEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Rewarded and interstitial: the SDK reloaded the ad in the background and its ad info (network, revenue ...)\nchanged (`onAdInfoChanged` / `didChangeAdInfo:`). Banners and native ads have no such callback in SDK 9.6.1.",
- "complexTypes": [
- "PluginListenerHandle",
- "AdEvent"
- ],
- "slug": "addlisteneradinfochanged-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'impressionData', listenerFunc: (event: ImpressionData) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'impressionData'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: ImpressionData) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "Impression-level revenue data for every rewarded, interstitial and banner impression (per-ad\n`setImpressionDataListener` / `setImpressionDataDelegate:`, attached by the plugin to every ad object it creates),\nplus native ad impressions synthesised from the native ad info (`adFormat: 'nativead'`, `adInfo` fields only).\nAdd the listener at any time, also before `initialize()`; nothing is delivered before the first ad shows.",
- "complexTypes": [
- "PluginListenerHandle",
- "ImpressionData"
- ],
- "slug": "addlistenerimpressiondata-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'bannerLoaded', listenerFunc: (event: BannerEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'bannerLoaded'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: BannerEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "A banner loaded or refreshed with a new creative.",
- "complexTypes": [
- "PluginListenerHandle",
- "BannerEvent"
- ],
- "slug": "addlistenerbannerloaded-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'bannerLoadFailed', listenerFunc: (event: BannerErrorEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'bannerLoadFailed'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: BannerErrorEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "A banner load (or refresh) failed. The SDK keeps retrying on its refresh interval.",
- "complexTypes": [
- "PluginListenerHandle",
- "BannerErrorEvent"
- ],
- "slug": "addlistenerbannerloadfailed-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'bannerDisplayed', listenerFunc: (event: BannerEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'bannerDisplayed'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: BannerEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "A banner creative was displayed on screen (impression).",
- "complexTypes": [
- "PluginListenerHandle",
- "BannerEvent"
- ],
- "slug": "addlistenerbannerdisplayed-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'bannerDisplayFailed', listenerFunc: (event: BannerErrorEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'bannerDisplayFailed'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: BannerErrorEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "A banner creative failed to display.",
- "complexTypes": [
- "PluginListenerHandle",
- "BannerErrorEvent"
- ],
- "slug": "addlistenerbannerdisplayfailed-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'bannerClicked', listenerFunc: (event: BannerEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'bannerClicked'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: BannerEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "The user clicked a banner.",
- "complexTypes": [
- "PluginListenerHandle",
- "BannerEvent"
- ],
- "slug": "addlistenerbannerclicked-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'bannerExpanded', listenerFunc: (event: BannerEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'bannerExpanded'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: BannerEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "A banner opened full screen (for example an expandable creative). Pause the game.",
- "complexTypes": [
- "PluginListenerHandle",
- "BannerEvent"
- ],
- "slug": "addlistenerbannerexpanded-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'bannerCollapsed', listenerFunc: (event: BannerEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'bannerCollapsed'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: BannerEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "A banner returned to its normal size. Resume the game.",
- "complexTypes": [
- "PluginListenerHandle",
- "BannerEvent"
- ],
- "slug": "addlistenerbannercollapsed-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'bannerLeftApplication', listenerFunc: (event: BannerEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'bannerLeftApplication'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: BannerEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "A banner click sent the user out of the app (browser or store).",
- "complexTypes": [
- "PluginListenerHandle",
- "BannerEvent"
- ],
- "slug": "addlistenerbannerleftapplication-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'nativeAdLoaded', listenerFunc: (event: NativeAdEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'nativeAdLoaded'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: NativeAdEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "A native ad loaded and can be shown with `showNativeAd()`.",
- "complexTypes": [
- "PluginListenerHandle",
- "NativeAdEvent"
- ],
- "slug": "addlistenernativeadloaded-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'nativeAdLoadFailed', listenerFunc: (event: NativeAdErrorEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'nativeAdLoadFailed'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: NativeAdErrorEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "A native ad failed to load. Load again later (the plugin already destroyed the failed ad object).",
- "complexTypes": [
- "PluginListenerHandle",
- "NativeAdErrorEvent"
- ],
- "slug": "addlistenernativeadloadfailed-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'nativeAdImpression', listenerFunc: (event: NativeAdEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'nativeAdImpression'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: NativeAdEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "A shown native ad recorded its impression (first pixel visible).",
- "complexTypes": [
- "PluginListenerHandle",
- "NativeAdEvent"
- ],
- "slug": "addlistenernativeadimpression-"
- },
- {
- "name": "addListener",
- "signature": "(eventName: 'nativeAdClicked', listenerFunc: (event: NativeAdEvent) => void) => Promise",
- "parameters": [
- {
- "name": "eventName",
- "docs": "",
- "type": "'nativeAdClicked'"
- },
- {
- "name": "listenerFunc",
- "docs": "",
- "type": "(event: NativeAdEvent) => void"
- }
- ],
- "returns": "Promise",
- "tags": [
- {
- "name": "since",
- "text": "0.3.0"
- }
- ],
- "docs": "The user clicked a native ad.",
- "complexTypes": [
- "PluginListenerHandle",
- "NativeAdEvent"
- ],
- "slug": "addlistenernativeadclicked-"
- },
{
"name": "removeAllListeners",
"signature": "() => Promise",
@@ -1838,142 +1064,6 @@
"docs": "Revenue precision as reported by the SDK.",
"complexTypes": [],
"type": "string | undefined"
- },
- {
- "name": "ab",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "A/B test group of the user (`ab`).",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "segmentName",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Segment name of the user, see `setSegment()`.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "encryptedCPM",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Encrypted CPM (`encryptedCPM`).",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "creativeId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Creative id of the served ad, when the network reports one.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "conversionValue",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "iOS only: SKAdNetwork conversion value (`LPMAdInfo.conversionValue`). Android's `LevelPlayAdInfo` has no such\nfield in SDK 9.6.1, so it is always absent there.",
- "complexTypes": [],
- "type": "number | undefined"
- },
- {
- "name": "adSize",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Size of the ad. Banners only (`LevelPlayAdInfo.getAdSize()` / `LPMAdInfo.adSize`).",
- "complexTypes": [
- "AdSizeInfo"
- ],
- "type": "AdSizeInfo"
- }
- ]
- },
- {
- "name": "AdSizeInfo",
- "slug": "adsizeinfo",
- "docs": "A resolved ad size as reported by the SDK (`LevelPlayAdSize` / `LPMAdSize`). Width and height are in dp on Android\nand points on iOS, which equal CSS px in the WebView at the default zoom.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "width",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Width in CSS px (dp / pt).",
- "complexTypes": [],
- "type": "number"
- },
- {
- "name": "height",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Height in CSS px (dp / pt).",
- "complexTypes": [],
- "type": "number"
- },
- {
- "name": "description",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "SDK description of the size, for example `BANNER` or `ADAPTIVE`.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "isAdaptive",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "`true` for an adaptive size.",
- "complexTypes": [],
- "type": "boolean | undefined"
}
]
},
@@ -2057,893 +1147,6 @@
}
]
},
- {
- "name": "Capabilities",
- "slug": "capabilities",
- "docs": "Result of `getCapabilities()`: what this platform build of the plugin can do. Check it instead of the platform\nname, so the same game code runs on Android, iOS and the web.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "banner",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Banner ads (`createBanner()` and friends) are available.",
- "complexTypes": [],
- "type": "boolean"
- },
- {
- "name": "nativeAd",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Native ads (`loadNativeAd()` and friends) are available.",
- "complexTypes": [],
- "type": "boolean"
- },
- {
- "name": "nativeAdTemplates",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Native ad templates this platform can render. Empty when `nativeAd` is `false`.",
- "complexTypes": [
- "NativeAdTemplate"
- ],
- "type": "NativeAdTemplate[]"
- },
- {
- "name": "impressionData",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "The `impressionData` event is delivered.",
- "complexTypes": [],
- "type": "boolean"
- },
- {
- "name": "adInfoChanged",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "The `adInfoChanged` event is delivered (rewarded and interstitial only).",
- "complexTypes": [],
- "type": "boolean"
- }
- ]
- },
- {
- "name": "SegmentOptions",
- "slug": "segmentoptions",
- "docs": "Options for `setSegment()` (`LevelPlaySegment` / `LPMSegment`). Omitted fields are not sent.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "segmentName",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Segment name.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "level",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "User level (integer).",
- "complexTypes": [],
- "type": "number | undefined"
- },
- {
- "name": "isPaying",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "The user has paid in the app.",
- "complexTypes": [],
- "type": "boolean | undefined"
- },
- {
- "name": "userCreationDate",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "When the user was created, in milliseconds since the Unix epoch (`Date.now()` style).",
- "complexTypes": [],
- "type": "number | undefined"
- },
- {
- "name": "iapTotal",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Total in-app purchase amount of the user (USD).",
- "complexTypes": [],
- "type": "number | undefined"
- },
- {
- "name": "customParameters",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Custom segment parameters. SDK 9.6.1 limits: at most 5 pairs; keys and values 1-32 characters, letters and digits\nonly (`^[a-zA-Z0-9]*$`). The plugin rejects with `INVALID_ARGUMENT` instead of letting the SDK silently drop pairs.",
- "complexTypes": [],
- "type": "{ [key: string]: string; } | undefined"
- }
- ]
- },
- {
- "name": "DynamicUserIdResult",
- "slug": "dynamicuseridresult",
- "docs": "Result of `setDynamicUserId()`.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "valid",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "The SDK accepted the id (`LevelPlay.setDynamicUserId` returns a boolean on both platforms).",
- "complexTypes": [],
- "type": "boolean"
- }
- ]
- },
- {
- "name": "DynamicUserIdOptions",
- "slug": "dynamicuseridoptions",
- "docs": "Options for `setDynamicUserId()`.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "userId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Dynamic user id, forwarded in server-to-server reward callbacks. Can change during the session.",
- "complexTypes": [],
- "type": "string"
- }
- ]
- },
- {
- "name": "PlacementCappedResult",
- "slug": "placementcappedresult",
- "docs": "Result of `isPlacementCapped()`.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "capped",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "`true` when the placement reached its capping or pacing limit; showing it now fails.",
- "complexTypes": [],
- "type": "boolean"
- }
- ]
- },
- {
- "name": "PlacementCappedOptions",
- "slug": "placementcappedoptions",
- "docs": "Options for `isPlacementCapped()`.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "format",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Format of the placement. LevelPlay 9.6.1 has capping checks for rewarded and interstitial only.",
- "complexTypes": [
- "AdFormat"
- ],
- "type": "AdFormat"
- },
- {
- "name": "placementName",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Placement name from the LevelPlay dashboard.",
- "complexTypes": [],
- "type": "string"
- }
- ]
- },
- {
- "name": "GetRewardOptions",
- "slug": "getrewardoptions",
- "docs": "Options for `getReward()`: `adUnitId` (see AdUnitOptions) plus an optional placement.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "placementName",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Placement whose reward to read. Its reward takes precedence over the ad unit reward. Omit for the ad unit reward.",
- "complexTypes": [],
- "type": "string | undefined"
- }
- ]
- },
- {
- "name": "BannerResult",
- "slug": "bannerresult",
- "docs": "Result of `createBanner()`, `showBanner()` and `setBannerLayout()`.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "bannerId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "The banner id.",
- "complexTypes": [],
- "type": "string"
- },
- {
- "name": "adSize",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Requested ad size (the creative may be smaller for adaptive sizes; it is centred in this frame).",
- "complexTypes": [
- "AdSizeInfo"
- ],
- "type": "AdSizeInfo"
- },
- {
- "name": "frame",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Where the banner frame is (or will be, while hidden) in CSS px, relative to the WebView viewport. Use it to pad\ngame UI away from the banner.",
- "complexTypes": [
- "Rect"
- ],
- "type": "Rect"
- },
- {
- "name": "visible",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "The banner view is currently visible.",
- "complexTypes": [],
- "type": "boolean"
- }
- ]
- },
- {
- "name": "Rect",
- "slug": "rect",
- "docs": "A rectangle in CSS px, relative to the top-left corner of the WebView viewport (the same space as\n`element.getBoundingClientRect()` without page scroll).",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "x",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Left edge in CSS px.",
- "complexTypes": [],
- "type": "number"
- },
- {
- "name": "y",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Top edge in CSS px.",
- "complexTypes": [],
- "type": "number"
- },
- {
- "name": "width",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Width in CSS px.",
- "complexTypes": [],
- "type": "number"
- },
- {
- "name": "height",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Height in CSS px.",
- "complexTypes": [],
- "type": "number"
- }
- ]
- },
- {
- "name": "CreateBannerOptions",
- "slug": "createbanneroptions",
- "docs": "Options for `createBanner()`.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "bannerId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Plugin-side id of this banner, used by every other banner method and in banner events. Lets one ad unit back\nseveral banners. Defaults to `adUnitId`.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "size",
- "tags": [
- {
- "text": "'ADAPTIVE'",
- "name": "default"
- },
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Size preset.",
- "complexTypes": [
- "BannerSize"
- ],
- "type": "BannerSize"
- },
- {
- "name": "customSize",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "`CUSTOM` only: the banner size. When `customSize` is set and `size` is omitted, `size` defaults to `CUSTOM`.",
- "complexTypes": [
- "BannerCustomSize"
- ],
- "type": "BannerCustomSize"
- },
- {
- "name": "adaptiveWidth",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "`ADAPTIVE` only: width in CSS px to compute the adaptive size for. Defaults to the width of the WebView's safe\narea; in that case the plugin recreates and reloads the banner automatically when that width changes (rotation,\nsplit screen, window resize), keeping its id, layout and visibility. A fixed `adaptiveWidth` is never recreated.",
- "complexTypes": [],
- "type": "number | undefined"
- },
- {
- "name": "placementName",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Placement name (reporting only for banners). Applied through the banner config before the first load.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "bidFloor",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Bid floor in USD (`LevelPlayBannerAdView.Config.Builder.setBidFloor` / `LPMBannerAdViewConfigBuilder set(bidFloor:)`).",
- "complexTypes": [],
- "type": "number | undefined"
- }
- ]
- },
- {
- "name": "BannerCustomSize",
- "slug": "bannercustomsize",
- "docs": "Width and height of a `CUSTOM` banner, in CSS px (dp on Android, points on iOS).",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "width",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Width in CSS px (positive integer).",
- "complexTypes": [],
- "type": "number"
- },
- {
- "name": "height",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Height in CSS px (positive integer).",
- "complexTypes": [],
- "type": "number"
- }
- ]
- },
- {
- "name": "BannerIdOptions",
- "slug": "banneridoptions",
- "docs": "Identifies one banner created with `createBanner()`.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "bannerId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Plugin-side banner id passed to `createBanner()` (defaults to the ad unit id there).",
- "complexTypes": [],
- "type": "string"
- }
- ]
- },
- {
- "name": "SetBannerLayoutOptions",
- "slug": "setbannerlayoutoptions",
- "docs": "Options for `setBannerLayout()`: `bannerId` plus the layout fields (see BannerLayoutOptions).",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": []
- },
- {
- "name": "LoadNativeAdOptions",
- "slug": "loadnativeadoptions",
- "docs": "Options for `loadNativeAd()`.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "placementName",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Placement name. LevelPlay 9.6.1 native ads are addressed by placement only (`LevelPlayNativeAd.Builder\n.withPlacementName` / `LevelPlayNativeAdBuilder withPlacementName:`); there is no ad unit id for native ads in\nthis SDK version. Omit it for the default placement.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "template",
- "tags": [
- {
- "text": "'medium'",
- "name": "default"
- },
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Template used when the ad is shown.",
- "complexTypes": [
- "NativeAdTemplate"
- ],
- "type": "NativeAdTemplate"
- },
- {
- "name": "style",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Template styling.",
- "complexTypes": [
- "NativeAdTemplateStyle"
- ],
- "type": "NativeAdTemplateStyle"
- }
- ]
- },
- {
- "name": "NativeAdTemplateStyle",
- "slug": "nativeadtemplatestyle",
- "docs": "Optional styling of a native ad template. Colours are CSS hex strings (`#RRGGBB` or `#RRGGBBAA`).",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "backgroundColor",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Template background.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "titleColor",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Title text colour.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "bodyColor",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Body and advertiser text colour.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "callToActionBackgroundColor",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Call-to-action button background.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "callToActionTextColor",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Call-to-action button text colour.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "cornerRadius",
- "tags": [
- {
- "text": "0",
- "name": "default"
- },
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Corner radius of the template in CSS px.",
- "complexTypes": [],
- "type": "number | undefined"
- },
- {
- "name": "titleFont",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Title font.",
- "complexTypes": [
- "NativeAdFont"
- ],
- "type": "NativeAdFont"
- },
- {
- "name": "bodyFont",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Body and advertiser font.",
- "complexTypes": [
- "NativeAdFont"
- ],
- "type": "NativeAdFont"
- },
- {
- "name": "callToActionFont",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Call-to-action button font.",
- "complexTypes": [
- "NativeAdFont"
- ],
- "type": "NativeAdFont"
- }
- ]
- },
- {
- "name": "NativeAdFont",
- "slug": "nativeadfont",
- "docs": "A font of a native ad template text. Omitted fields keep the template default (system font).",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "family",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Font family. Either a system family name (Android: `sans-serif`, `sans-serif-medium`, `serif`, `monospace` ...;\niOS: a `UIFont` family or PostScript name such as `Avenir Next` or `Menlo-Bold`), or the path of a `.ttf` / `.otf`\nfile inside the app's web assets, relative to the web root (for example `fonts/Inter-Bold.ttf`, the same file the\npage loads with `@font-face`). Unknown families fall back to the system font.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "size",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Font size in CSS px (dp / pt; not scaled by the system font size setting, like text in the WebView).",
- "complexTypes": [],
- "type": "number | undefined"
- }
- ]
- },
- {
- "name": "NativeAdRectOptions",
- "slug": "nativeadrectoptions",
- "docs": "Options for `showNativeAd()` and `setNativeAdRect()`.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "rect",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Where the template goes, in CSS px relative to the WebView viewport (for example a placeholder element's\n`getBoundingClientRect()`).",
- "complexTypes": [
- "Rect"
- ],
- "type": "Rect"
- }
- ]
- },
- {
- "name": "NativeAdIdOptions",
- "slug": "nativeadidoptions",
- "docs": "Identifies one native ad slot.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "nativeAdId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Plugin-side id of the native ad slot.",
- "complexTypes": [],
- "type": "string"
- }
- ]
- },
{
"name": "PluginListenerHandle",
"slug": "pluginlistenerhandle",
@@ -3069,544 +1272,6 @@
"type": "Reward"
}
]
- },
- {
- "name": "ImpressionData",
- "slug": "impressiondata",
- "docs": "Impression-level revenue data (`LevelPlayImpressionData` on Android, `LPMImpressionData` on iOS). Every field the\nSDK 9.6.1 data class exposes is mapped; fields the SDK leaves empty are omitted.\n\nNot available in SDK 9.6.1 on either platform: `lifetimeRevenue` (removed from the impression data class). If the\nserver ever sends extra keys they are still visible in `allData`.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "adFormat",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Which ad format produced the impression, as the SDK reports it (for example `Rewarded Video`, `Interstitial`,\n`Banner`, or `nativead` for impressions synthesised from native ad info).",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "auctionId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Auction id.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "adUnitId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Mediation ad unit id (`mediationAdUnitId`).",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "adUnitName",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Mediation ad unit name (`mediationAdUnitName`).",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "adNetwork",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Mediated network that served the ad.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "instanceName",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Mediation instance name.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "instanceId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Mediation instance id.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "country",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Country code.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "placement",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Placement name of the impression.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "revenue",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Revenue of this impression in USD.",
- "complexTypes": [],
- "type": "number | undefined"
- },
- {
- "name": "precision",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Revenue precision (for example `BID`, `RATE`, `ESTIMATED`).",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "ab",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "A/B test group.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "segmentName",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Segment name, see `setSegment()`.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "encryptedCPM",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Encrypted CPM (`encryptedCPM` on Android, `encryptedCpm` on iOS).",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "creativeId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Creative id.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "conversionValue",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "iOS only: SKAdNetwork conversion value.",
- "complexTypes": [],
- "type": "number | undefined"
- },
- {
- "name": "allData",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "The raw `allData` map of the SDK (`getAllData()` JSON on Android, `allData` dictionary on iOS). Keys and value\ntypes are SDK defined and may change between SDK versions.",
- "complexTypes": [],
- "type": "{ [key: string]: unknown; } | undefined"
- }
- ]
- },
- {
- "name": "BannerEvent",
- "slug": "bannerevent",
- "docs": "Payload of the `banner*` events.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "bannerId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Banner that fired the event.",
- "complexTypes": [],
- "type": "string"
- },
- {
- "name": "adUnitId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Ad unit of the banner.",
- "complexTypes": [],
- "type": "string"
- },
- {
- "name": "adInfo",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Ad info, when the SDK provides it (not on `bannerLoadFailed`).",
- "complexTypes": [
- "AdInfo"
- ],
- "type": "AdInfo"
- },
- {
- "name": "frame",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Current frame of the banner in CSS px.",
- "complexTypes": [
- "Rect"
- ],
- "type": "Rect"
- }
- ]
- },
- {
- "name": "BannerErrorEvent",
- "slug": "bannererrorevent",
- "docs": "Payload of `bannerLoadFailed` and `bannerDisplayFailed`.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "error",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "What went wrong.",
- "complexTypes": [
- "AdError"
- ],
- "type": "AdError"
- }
- ]
- },
- {
- "name": "NativeAdEvent",
- "slug": "nativeadevent",
- "docs": "Payload of the `nativeAd*` events.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "nativeAdId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Native ad slot that fired the event.",
- "complexTypes": [],
- "type": "string"
- },
- {
- "name": "placementName",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Placement passed to `loadNativeAd()`, if any.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "adInfo",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Ad info, when the SDK provides it (not on `nativeAdLoadFailed`).",
- "complexTypes": [
- "NativeAdInfo"
- ],
- "type": "NativeAdInfo"
- }
- ]
- },
- {
- "name": "NativeAdInfo",
- "slug": "nativeadinfo",
- "docs": "Ad info of a native ad (`AdInfo` on Android / `ISAdInfo` on iOS: the older ironSource info type, which has no ad\nunit, ad id or placement fields).",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "auctionId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Auction id.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "adNetwork",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Mediated network that served the ad.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "instanceName",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Mediation instance name.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "instanceId",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Mediation instance id.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "country",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Country code.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "revenue",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Impression revenue in USD.",
- "complexTypes": [],
- "type": "number | undefined"
- },
- {
- "name": "precision",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Revenue precision.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "ab",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "A/B test group.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "segmentName",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Segment name.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "encryptedCPM",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "Encrypted CPM.",
- "complexTypes": [],
- "type": "string | undefined"
- },
- {
- "name": "conversionValue",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "iOS only: SKAdNetwork conversion value.",
- "complexTypes": [],
- "type": "number | undefined"
- }
- ]
- },
- {
- "name": "NativeAdErrorEvent",
- "slug": "nativeaderrorevent",
- "docs": "Payload of `nativeAdLoadFailed`.",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "methods": [],
- "properties": [
- {
- "name": "error",
- "tags": [
- {
- "text": "0.3.0",
- "name": "since"
- }
- ],
- "docs": "What went wrong.",
- "complexTypes": [
- "AdError"
- ],
- "type": "AdError"
- }
- ]
}
],
"enums": [],
@@ -3641,7 +1306,7 @@
{
"name": "AdFormat",
"slug": "adformat",
- "docs": "Full-screen ad formats (`loadRewarded` / `loadInterstitial` family and the `loaded` ... `rewarded` events).\nBanners and native ads have their own methods and `banner*` / `nativeAd*` events (since 0.3.0), so this union\nstays unchanged for 0.2.x code.",
+ "docs": "Full-screen ad formats supported by this plugin. Banners and native ads are intentionally not exposed.",
"types": [
{
"text": "'rewarded'",
@@ -3652,52 +1317,6 @@
"complexTypes": []
}
]
- },
- {
- "name": "NativeAdTemplate",
- "slug": "nativeadtemplate",
- "docs": "Native ad template rendered by the plugin (the LevelPlay SDK ships no template views; the plugin provides its own\nlayouts, like Unity's Flutter and React Native wrappers do).\n\n- `small`: icon, title, advertiser, body, call to action; no media view. Recommended 300 x 175 or a row at least\n 90 px tall.\n- `medium`: the `small` assets plus a media view. Recommended 300 x 350.",
- "types": [
- {
- "text": "'small'",
- "complexTypes": []
- },
- {
- "text": "'medium'",
- "complexTypes": []
- }
- ]
- },
- {
- "name": "BannerSize",
- "slug": "bannersize",
- "docs": "Banner size presets, named after the SDK constants (`LevelPlayAdSize.BANNER` / `LPMAdSize.bannerSize()` ...).\n\n- `BANNER`: 320 x 50\n- `LARGE`: 320 x 90\n- `MEDIUM_RECTANGLE`: 300 x 250\n- `LEADERBOARD`: 728 x 90 (tablets)\n- `ADAPTIVE`: `LevelPlayAdSize.createAdaptiveAdSize(context, width)` / `LPMAdSize.createAdaptiveAdSize(withWidth:)`;\n the SDK picks the height (and BANNER or LEADERBOARD as fallback) for the given width. Requires a finished\n `initialize()`.\n- `CUSTOM`: `LevelPlayAdSize.createCustomSize(width, height)` / `LPMAdSize.customSizeWithWidth:height:` with\n `customSize`. Few networks fill custom sizes; prefer a preset or `ADAPTIVE`.",
- "types": [
- {
- "text": "'BANNER'",
- "complexTypes": []
- },
- {
- "text": "'LARGE'",
- "complexTypes": []
- },
- {
- "text": "'MEDIUM_RECTANGLE'",
- "complexTypes": []
- },
- {
- "text": "'LEADERBOARD'",
- "complexTypes": []
- },
- {
- "text": "'ADAPTIVE'",
- "complexTypes": []
- },
- {
- "text": "'CUSTOM'",
- "complexTypes": []
- }
- ]
}
],
"pluginConfigs": []
diff --git a/dist/esm/definitions.d.ts b/dist/esm/definitions.d.ts
index 429ae74..d4fc256 100644
--- a/dist/esm/definitions.d.ts
+++ b/dist/esm/definitions.d.ts
@@ -1,8 +1,6 @@
import type { PluginListenerHandle } from '@capacitor/core';
/**
- * Full-screen ad formats (`loadRewarded` / `loadInterstitial` family and the `loaded` ... `rewarded` events).
- * Banners and native ads have their own methods and `banner*` / `nativeAd*` events (since 0.3.0), so this union
- * stays unchanged for 0.2.x code.
+ * Full-screen ad formats supported by this plugin. Banners and native ads are intentionally not exposed.
*
* @since 0.1.0
*/
@@ -279,75 +277,6 @@ export interface AdInfo {
* @since 0.1.0
*/
precision?: string;
- /**
- * A/B test group of the user (`ab`).
- *
- * @since 0.3.0
- */
- ab?: string;
- /**
- * Segment name of the user, see `setSegment()`.
- *
- * @since 0.3.0
- */
- segmentName?: string;
- /**
- * Encrypted CPM (`encryptedCPM`).
- *
- * @since 0.3.0
- */
- encryptedCPM?: string;
- /**
- * Creative id of the served ad, when the network reports one.
- *
- * @since 0.3.0
- */
- creativeId?: string;
- /**
- * iOS only: SKAdNetwork conversion value (`LPMAdInfo.conversionValue`). Android's `LevelPlayAdInfo` has no such
- * field in SDK 9.6.1, so it is always absent there.
- *
- * @since 0.3.0
- */
- conversionValue?: number;
- /**
- * Size of the ad. Banners only (`LevelPlayAdInfo.getAdSize()` / `LPMAdInfo.adSize`).
- *
- * @since 0.3.0
- */
- adSize?: AdSizeInfo;
-}
-/**
- * A resolved ad size as reported by the SDK (`LevelPlayAdSize` / `LPMAdSize`). Width and height are in dp on Android
- * and points on iOS, which equal CSS px in the WebView at the default zoom.
- *
- * @since 0.3.0
- */
-export interface AdSizeInfo {
- /**
- * Width in CSS px (dp / pt).
- *
- * @since 0.3.0
- */
- width: number;
- /**
- * Height in CSS px (dp / pt).
- *
- * @since 0.3.0
- */
- height: number;
- /**
- * SDK description of the size, for example `BANNER` or `ADAPTIVE`.
- *
- * @since 0.3.0
- */
- description?: string;
- /**
- * `true` for an adaptive size.
- *
- * @since 0.3.0
- */
- isAdaptive?: boolean;
}
/**
* Result of `showRewarded()` and `showInterstitial()`, resolved after the ad
@@ -459,802 +388,14 @@ export interface TrackingResult {
*/
status: TrackingStatus;
}
-/**
- * Result of `getCapabilities()`: what this platform build of the plugin can do. Check it instead of the platform
- * name, so the same game code runs on Android, iOS and the web.
- *
- * @since 0.3.0
- */
-export interface Capabilities {
- /**
- * Banner ads (`createBanner()` and friends) are available.
- *
- * @since 0.3.0
- */
- banner: boolean;
- /**
- * Native ads (`loadNativeAd()` and friends) are available.
- *
- * @since 0.3.0
- */
- nativeAd: boolean;
- /**
- * Native ad templates this platform can render. Empty when `nativeAd` is `false`.
- *
- * @since 0.3.0
- */
- nativeAdTemplates: NativeAdTemplate[];
- /**
- * The `impressionData` event is delivered.
- *
- * @since 0.3.0
- */
- impressionData: boolean;
- /**
- * The `adInfoChanged` event is delivered (rewarded and interstitial only).
- *
- * @since 0.3.0
- */
- adInfoChanged: boolean;
-}
-/**
- * A rectangle in CSS px, relative to the top-left corner of the WebView viewport (the same space as
- * `element.getBoundingClientRect()` without page scroll).
- *
- * @since 0.3.0
- */
-export interface Rect {
- /**
- * Left edge in CSS px.
- *
- * @since 0.3.0
- */
- x: number;
- /**
- * Top edge in CSS px.
- *
- * @since 0.3.0
- */
- y: number;
- /**
- * Width in CSS px.
- *
- * @since 0.3.0
- */
- width: number;
- /**
- * Height in CSS px.
- *
- * @since 0.3.0
- */
- height: number;
-}
-/**
- * Banner size presets, named after the SDK constants (`LevelPlayAdSize.BANNER` / `LPMAdSize.bannerSize()` ...).
- *
- * - `BANNER`: 320 x 50
- * - `LARGE`: 320 x 90
- * - `MEDIUM_RECTANGLE`: 300 x 250
- * - `LEADERBOARD`: 728 x 90 (tablets)
- * - `ADAPTIVE`: `LevelPlayAdSize.createAdaptiveAdSize(context, width)` / `LPMAdSize.createAdaptiveAdSize(withWidth:)`;
- * the SDK picks the height (and BANNER or LEADERBOARD as fallback) for the given width. Requires a finished
- * `initialize()`.
- * - `CUSTOM`: `LevelPlayAdSize.createCustomSize(width, height)` / `LPMAdSize.customSizeWithWidth:height:` with
- * `customSize`. Few networks fill custom sizes; prefer a preset or `ADAPTIVE`.
- *
- * @since 0.3.0
- */
-export type BannerSize = 'BANNER' | 'LARGE' | 'MEDIUM_RECTANGLE' | 'LEADERBOARD' | 'ADAPTIVE' | 'CUSTOM';
-/**
- * Width and height of a `CUSTOM` banner, in CSS px (dp on Android, points on iOS).
- *
- * @since 0.3.0
- */
-export interface BannerCustomSize {
- /**
- * Width in CSS px (positive integer).
- *
- * @since 0.3.0
- */
- width: number;
- /**
- * Height in CSS px (positive integer).
- *
- * @since 0.3.0
- */
- height: number;
-}
-/**
- * Vertical anchor of a banner inside the WebView's safe area. Banners are always horizontally centred; use
- * `offsetX` to move them sideways.
- *
- * @since 0.3.0
- */
-export type BannerPosition = 'top' | 'bottom' | 'center';
-/**
- * Identifies one banner created with `createBanner()`.
- *
- * @since 0.3.0
- */
-export interface BannerIdOptions {
- /**
- * Plugin-side banner id passed to `createBanner()` (defaults to the ad unit id there).
- *
- * @since 0.3.0
- */
- bannerId: string;
-}
-/**
- * Where a banner sits over the WebView.
- *
- * @since 0.3.0
- */
-export interface BannerLayoutOptions {
- /**
- * Vertical anchor.
- *
- * @default 'bottom'
- * @since 0.3.0
- */
- position?: BannerPosition;
- /**
- * Horizontal offset from the centred position in CSS px (positive moves right).
- *
- * @default 0
- * @since 0.3.0
- */
- offsetX?: number;
- /**
- * Vertical offset from the anchored position in CSS px (positive moves down).
- *
- * @default 0
- * @since 0.3.0
- */
- offsetY?: number;
- /**
- * Keep the banner inside the safe area (status bar, notch / display cutout, home indicator, navigation bar), measured
- * against the WebView's own on-screen rect. Set `false` to anchor to the raw WebView edges.
- *
- * @default true
- * @since 0.3.0
- */
- respectSafeArea?: boolean;
-}
-/**
- * Options for `createBanner()`.
- *
- * @since 0.3.0
- */
-export interface CreateBannerOptions extends AdUnitOptions, BannerLayoutOptions {
- /**
- * Plugin-side id of this banner, used by every other banner method and in banner events. Lets one ad unit back
- * several banners. Defaults to `adUnitId`.
- *
- * @since 0.3.0
- */
- bannerId?: string;
- /**
- * Size preset.
- *
- * @default 'ADAPTIVE'
- * @since 0.3.0
- */
- size?: BannerSize;
- /**
- * `CUSTOM` only: the banner size. When `customSize` is set and `size` is omitted, `size` defaults to `CUSTOM`.
- *
- * @since 0.3.0
- */
- customSize?: BannerCustomSize;
- /**
- * `ADAPTIVE` only: width in CSS px to compute the adaptive size for. Defaults to the width of the WebView's safe
- * area; in that case the plugin recreates and reloads the banner automatically when that width changes (rotation,
- * split screen, window resize), keeping its id, layout and visibility. A fixed `adaptiveWidth` is never recreated.
- *
- * @since 0.3.0
- */
- adaptiveWidth?: number;
- /**
- * Placement name (reporting only for banners). Applied through the banner config before the first load.
- *
- * @since 0.3.0
- */
- placementName?: string;
- /**
- * Bid floor in USD (`LevelPlayBannerAdView.Config.Builder.setBidFloor` / `LPMBannerAdViewConfigBuilder set(bidFloor:)`).
- *
- * @since 0.3.0
- */
- bidFloor?: number;
-}
-/**
- * Options for `setBannerLayout()`: `bannerId` plus the layout fields (see BannerLayoutOptions).
- *
- * @since 0.3.0
- */
-export interface SetBannerLayoutOptions extends BannerIdOptions, BannerLayoutOptions {
-}
-/**
- * Result of `createBanner()`, `showBanner()` and `setBannerLayout()`.
- *
- * @since 0.3.0
- */
-export interface BannerResult {
- /**
- * The banner id.
- *
- * @since 0.3.0
- */
- bannerId: string;
- /**
- * Requested ad size (the creative may be smaller for adaptive sizes; it is centred in this frame).
- *
- * @since 0.3.0
- */
- adSize: AdSizeInfo;
- /**
- * Where the banner frame is (or will be, while hidden) in CSS px, relative to the WebView viewport. Use it to pad
- * game UI away from the banner.
- *
- * @since 0.3.0
- */
- frame: Rect;
- /**
- * The banner view is currently visible.
- *
- * @since 0.3.0
- */
- visible: boolean;
-}
-/**
- * Payload of the `banner*` events.
- *
- * @since 0.3.0
- */
-export interface BannerEvent {
- /**
- * Banner that fired the event.
- *
- * @since 0.3.0
- */
- bannerId: string;
- /**
- * Ad unit of the banner.
- *
- * @since 0.3.0
- */
- adUnitId: string;
- /**
- * Ad info, when the SDK provides it (not on `bannerLoadFailed`).
- *
- * @since 0.3.0
- */
- adInfo?: AdInfo;
- /**
- * Current frame of the banner in CSS px.
- *
- * @since 0.3.0
- */
- frame?: Rect;
-}
-/**
- * Payload of `bannerLoadFailed` and `bannerDisplayFailed`.
- *
- * @since 0.3.0
- */
-export interface BannerErrorEvent extends BannerEvent {
- /**
- * What went wrong.
- *
- * @since 0.3.0
- */
- error: AdError;
-}
-/**
- * Native ad template rendered by the plugin (the LevelPlay SDK ships no template views; the plugin provides its own
- * layouts, like Unity's Flutter and React Native wrappers do).
- *
- * - `small`: icon, title, advertiser, body, call to action; no media view. Recommended 300 x 175 or a row at least
- * 90 px tall.
- * - `medium`: the `small` assets plus a media view. Recommended 300 x 350.
- *
- * @since 0.3.0
- */
-export type NativeAdTemplate = 'small' | 'medium';
-/**
- * Optional styling of a native ad template. Colours are CSS hex strings (`#RRGGBB` or `#RRGGBBAA`).
- *
- * @since 0.3.0
- */
-export interface NativeAdTemplateStyle {
- /**
- * Template background.
- *
- * @since 0.3.0
- */
- backgroundColor?: string;
- /**
- * Title text colour.
- *
- * @since 0.3.0
- */
- titleColor?: string;
- /**
- * Body and advertiser text colour.
- *
- * @since 0.3.0
- */
- bodyColor?: string;
- /**
- * Call-to-action button background.
- *
- * @since 0.3.0
- */
- callToActionBackgroundColor?: string;
- /**
- * Call-to-action button text colour.
- *
- * @since 0.3.0
- */
- callToActionTextColor?: string;
- /**
- * Corner radius of the template in CSS px.
- *
- * @default 0
- * @since 0.3.0
- */
- cornerRadius?: number;
- /**
- * Title font.
- *
- * @since 0.3.0
- */
- titleFont?: NativeAdFont;
- /**
- * Body and advertiser font.
- *
- * @since 0.3.0
- */
- bodyFont?: NativeAdFont;
- /**
- * Call-to-action button font.
- *
- * @since 0.3.0
- */
- callToActionFont?: NativeAdFont;
-}
-/**
- * A font of a native ad template text. Omitted fields keep the template default (system font).
- *
- * @since 0.3.0
- */
-export interface NativeAdFont {
- /**
- * Font family. Either a system family name (Android: `sans-serif`, `sans-serif-medium`, `serif`, `monospace` ...;
- * iOS: a `UIFont` family or PostScript name such as `Avenir Next` or `Menlo-Bold`), or the path of a `.ttf` / `.otf`
- * file inside the app's web assets, relative to the web root (for example `fonts/Inter-Bold.ttf`, the same file the
- * page loads with `@font-face`). Unknown families fall back to the system font.
- *
- * @since 0.3.0
- */
- family?: string;
- /**
- * Font size in CSS px (dp / pt; not scaled by the system font size setting, like text in the WebView).
- *
- * @since 0.3.0
- */
- size?: number;
-}
-/**
- * Identifies one native ad slot.
- *
- * @since 0.3.0
- */
-export interface NativeAdIdOptions {
- /**
- * Plugin-side id of the native ad slot.
- *
- * @since 0.3.0
- */
- nativeAdId: string;
-}
-/**
- * Options for `loadNativeAd()`.
- *
- * @since 0.3.0
- */
-export interface LoadNativeAdOptions extends NativeAdIdOptions {
- /**
- * Placement name. LevelPlay 9.6.1 native ads are addressed by placement only (`LevelPlayNativeAd.Builder
- * .withPlacementName` / `LevelPlayNativeAdBuilder withPlacementName:`); there is no ad unit id for native ads in
- * this SDK version. Omit it for the default placement.
- *
- * @since 0.3.0
- */
- placementName?: string;
- /**
- * Template used when the ad is shown.
- *
- * @default 'medium'
- * @since 0.3.0
- */
- template?: NativeAdTemplate;
- /**
- * Template styling.
- *
- * @since 0.3.0
- */
- style?: NativeAdTemplateStyle;
-}
-/**
- * Options for `showNativeAd()` and `setNativeAdRect()`.
- *
- * @since 0.3.0
- */
-export interface NativeAdRectOptions extends NativeAdIdOptions {
- /**
- * Where the template goes, in CSS px relative to the WebView viewport (for example a placeholder element's
- * `getBoundingClientRect()`).
- *
- * @since 0.3.0
- */
- rect: Rect;
-}
-/**
- * Ad info of a native ad (`AdInfo` on Android / `ISAdInfo` on iOS: the older ironSource info type, which has no ad
- * unit, ad id or placement fields).
- *
- * @since 0.3.0
- */
-export interface NativeAdInfo {
- /**
- * Auction id.
- *
- * @since 0.3.0
- */
- auctionId?: string;
- /**
- * Mediated network that served the ad.
- *
- * @since 0.3.0
- */
- adNetwork?: string;
- /**
- * Mediation instance name.
- *
- * @since 0.3.0
- */
- instanceName?: string;
- /**
- * Mediation instance id.
- *
- * @since 0.3.0
- */
- instanceId?: string;
- /**
- * Country code.
- *
- * @since 0.3.0
- */
- country?: string;
- /**
- * Impression revenue in USD.
- *
- * @since 0.3.0
- */
- revenue?: number;
- /**
- * Revenue precision.
- *
- * @since 0.3.0
- */
- precision?: string;
- /**
- * A/B test group.
- *
- * @since 0.3.0
- */
- ab?: string;
- /**
- * Segment name.
- *
- * @since 0.3.0
- */
- segmentName?: string;
- /**
- * Encrypted CPM.
- *
- * @since 0.3.0
- */
- encryptedCPM?: string;
- /**
- * iOS only: SKAdNetwork conversion value.
- *
- * @since 0.3.0
- */
- conversionValue?: number;
-}
-/**
- * Payload of the `nativeAd*` events.
- *
- * @since 0.3.0
- */
-export interface NativeAdEvent {
- /**
- * Native ad slot that fired the event.
- *
- * @since 0.3.0
- */
- nativeAdId: string;
- /**
- * Placement passed to `loadNativeAd()`, if any.
- *
- * @since 0.3.0
- */
- placementName?: string;
- /**
- * Ad info, when the SDK provides it (not on `nativeAdLoadFailed`).
- *
- * @since 0.3.0
- */
- adInfo?: NativeAdInfo;
-}
-/**
- * Payload of `nativeAdLoadFailed`.
- *
- * @since 0.3.0
- */
-export interface NativeAdErrorEvent extends NativeAdEvent {
- /**
- * What went wrong.
- *
- * @since 0.3.0
- */
- error: AdError;
-}
-/**
- * Impression-level revenue data (`LevelPlayImpressionData` on Android, `LPMImpressionData` on iOS). Every field the
- * SDK 9.6.1 data class exposes is mapped; fields the SDK leaves empty are omitted.
- *
- * Not available in SDK 9.6.1 on either platform: `lifetimeRevenue` (removed from the impression data class). If the
- * server ever sends extra keys they are still visible in `allData`.
- *
- * @since 0.3.0
- */
-export interface ImpressionData {
- /**
- * Which ad format produced the impression, as the SDK reports it (for example `Rewarded Video`, `Interstitial`,
- * `Banner`, or `nativead` for impressions synthesised from native ad info).
- *
- * @since 0.3.0
- */
- adFormat?: string;
- /**
- * Auction id.
- *
- * @since 0.3.0
- */
- auctionId?: string;
- /**
- * Mediation ad unit id (`mediationAdUnitId`).
- *
- * @since 0.3.0
- */
- adUnitId?: string;
- /**
- * Mediation ad unit name (`mediationAdUnitName`).
- *
- * @since 0.3.0
- */
- adUnitName?: string;
- /**
- * Mediated network that served the ad.
- *
- * @since 0.3.0
- */
- adNetwork?: string;
- /**
- * Mediation instance name.
- *
- * @since 0.3.0
- */
- instanceName?: string;
- /**
- * Mediation instance id.
- *
- * @since 0.3.0
- */
- instanceId?: string;
- /**
- * Country code.
- *
- * @since 0.3.0
- */
- country?: string;
- /**
- * Placement name of the impression.
- *
- * @since 0.3.0
- */
- placement?: string;
- /**
- * Revenue of this impression in USD.
- *
- * @since 0.3.0
- */
- revenue?: number;
- /**
- * Revenue precision (for example `BID`, `RATE`, `ESTIMATED`).
- *
- * @since 0.3.0
- */
- precision?: string;
- /**
- * A/B test group.
- *
- * @since 0.3.0
- */
- ab?: string;
- /**
- * Segment name, see `setSegment()`.
- *
- * @since 0.3.0
- */
- segmentName?: string;
- /**
- * Encrypted CPM (`encryptedCPM` on Android, `encryptedCpm` on iOS).
- *
- * @since 0.3.0
- */
- encryptedCPM?: string;
- /**
- * Creative id.
- *
- * @since 0.3.0
- */
- creativeId?: string;
- /**
- * iOS only: SKAdNetwork conversion value.
- *
- * @since 0.3.0
- */
- conversionValue?: number;
- /**
- * The raw `allData` map of the SDK (`getAllData()` JSON on Android, `allData` dictionary on iOS). Keys and value
- * types are SDK defined and may change between SDK versions.
- *
- * @since 0.3.0
- */
- allData?: {
- [key: string]: unknown;
- };
-}
-/**
- * Options for `isPlacementCapped()`.
- *
- * @since 0.3.0
- */
-export interface PlacementCappedOptions {
- /**
- * Format of the placement. LevelPlay 9.6.1 has capping checks for rewarded and interstitial only.
- *
- * @since 0.3.0
- */
- format: AdFormat;
- /**
- * Placement name from the LevelPlay dashboard.
- *
- * @since 0.3.0
- */
- placementName: string;
-}
-/**
- * Result of `isPlacementCapped()`.
- *
- * @since 0.3.0
- */
-export interface PlacementCappedResult {
- /**
- * `true` when the placement reached its capping or pacing limit; showing it now fails.
- *
- * @since 0.3.0
- */
- capped: boolean;
-}
-/**
- * Options for `getReward()`: `adUnitId` (see AdUnitOptions) plus an optional placement.
- *
- * @since 0.3.0
- */
-export interface GetRewardOptions extends AdUnitOptions {
- /**
- * Placement whose reward to read. Its reward takes precedence over the ad unit reward. Omit for the ad unit reward.
- *
- * @since 0.3.0
- */
- placementName?: string;
-}
-/**
- * Options for `setSegment()` (`LevelPlaySegment` / `LPMSegment`). Omitted fields are not sent.
- *
- * @since 0.3.0
- */
-export interface SegmentOptions {
- /**
- * Segment name.
- *
- * @since 0.3.0
- */
- segmentName?: string;
- /**
- * User level (integer).
- *
- * @since 0.3.0
- */
- level?: number;
- /**
- * The user has paid in the app.
- *
- * @since 0.3.0
- */
- isPaying?: boolean;
- /**
- * When the user was created, in milliseconds since the Unix epoch (`Date.now()` style).
- *
- * @since 0.3.0
- */
- userCreationDate?: number;
- /**
- * Total in-app purchase amount of the user (USD).
- *
- * @since 0.3.0
- */
- iapTotal?: number;
- /**
- * Custom segment parameters. SDK 9.6.1 limits: at most 5 pairs; keys and values 1-32 characters, letters and digits
- * only (`^[a-zA-Z0-9]*$`). The plugin rejects with `INVALID_ARGUMENT` instead of letting the SDK silently drop pairs.
- *
- * @since 0.3.0
- */
- customParameters?: {
- [key: string]: string;
- };
-}
-/**
- * Options for `setDynamicUserId()`.
- *
- * @since 0.3.0
- */
-export interface DynamicUserIdOptions {
- /**
- * Dynamic user id, forwarded in server-to-server reward callbacks. Can change during the session.
- *
- * @since 0.3.0
- */
- userId: string;
-}
-/**
- * Result of `setDynamicUserId()`.
- *
- * @since 0.3.0
- */
-export interface DynamicUserIdResult {
- /**
- * The SDK accepted the id (`LevelPlay.setDynamicUserId` returns a boolean on both platforms).
- *
- * @since 0.3.0
- */
- valid: boolean;
-}
/**
* Event names emitted by the plugin.
*
* @since 0.1.0
*/
-export type LevelPlayEventName = 'loaded' | 'loadFailed' | 'displayed' | 'displayFailed' | 'clicked' | 'closed' | 'rewarded' | 'adInfoChanged' | 'impressionData' | 'bannerLoaded' | 'bannerLoadFailed' | 'bannerDisplayed' | 'bannerDisplayFailed' | 'bannerClicked' | 'bannerExpanded' | 'bannerCollapsed' | 'bannerLeftApplication' | 'nativeAdLoaded' | 'nativeAdLoadFailed' | 'nativeAdImpression' | 'nativeAdClicked';
+export type LevelPlayEventName = 'loaded' | 'loadFailed' | 'displayed' | 'displayFailed' | 'clicked' | 'closed' | 'rewarded';
/**
- * Unity LevelPlay ads (ad-unit API): rewarded, interstitial and (since 0.3.0) banner and native ads, impression-level
- * revenue, segments and placement capping.
+ * Unity LevelPlay rewarded and interstitial ads (ad-unit API).
*
* @since 0.1.0
*/
@@ -1354,128 +495,6 @@ export interface LevelPlayPlugin {
* @since 0.1.0
*/
validateIntegration(): Promise;
- /**
- * What this platform supports (banners, native ad templates, impression data, `adInfoChanged`). Works before init.
- * Web: everything `false`.
- *
- * @since 0.3.0
- */
- getCapabilities(): Promise;
- /**
- * Set the user segment (`LevelPlay.setSegment` with a `LevelPlaySegment` / `LPMSegment`). Call it before
- * `initialize()` so the first ad requests use it; later calls apply to the following requests. Rejects with
- * `INVALID_ARGUMENT` when `customParameters` break the SDK limits. Web: no-op.
- *
- * @since 0.3.0
- */
- setSegment(options: SegmentOptions): Promise;
- /**
- * Set or change the dynamic user id used in server-to-server reward callbacks (`LevelPlay.setDynamicUserId` on
- * both platforms). Set it before `showRewarded()`. Web: resolves `{ valid: false }`.
- *
- * @since 0.3.0
- */
- setDynamicUserId(options: DynamicUserIdOptions): Promise;
- /**
- * Whether a rewarded or interstitial placement is capped right now (static
- * `LevelPlayRewardedAd.isPlacementCapped` / `LevelPlayInterstitialAd.isPlacementCapped` on Android,
- * `LPMRewardedAd.isPlacementCapped:` / `LPMInterstitialAd.isPlacementCapped:` on iOS). Works without a loaded ad.
- * Web: `{ capped: false }`.
- *
- * @since 0.3.0
- */
- isPlacementCapped(options: PlacementCappedOptions): Promise;
- /**
- * The reward configured for a rewarded ad unit or one of its placements (`LevelPlayRewardedAd.getReward(placement)` /
- * `LPMRewardedAd getReward(placementName:)`), for "watch a video for N coins" buttons. The SDK returns
- * `{ name: '', amount: 0 }` when it has no reward configuration (for example before init). Web: the same empty
- * reward.
- *
- * @since 0.3.0
- */
- getReward(options: GetRewardOptions): Promise;
- /**
- * Create a banner (`LevelPlayBannerAdView` / `LPMBannerAdView`) for the ad unit and attach it, hidden, in a
- * pass-through overlay above the WebView. Requires a finished `initialize()` (`NOT_INITIALIZED` otherwise). Rejects
- * with `ALREADY_EXISTS` when `bannerId` is in use; destroy it first. Does not load: call `loadBanner()`.
- * Web: rejects as unimplemented.
- *
- * @since 0.3.0
- */
- createBanner(options: CreateBannerOptions): Promise;
- /**
- * Load the banner (`loadAd()` / `loadAdWithViewController:`). The outcome arrives as `bannerLoaded` or
- * `bannerLoadFailed`; after the first load the SDK refreshes the banner on the dashboard interval. The SDK accepts
- * one load per banner object: calling it again has no effect (Android logs "Banner load already called"), so to retry
- * right away after `bannerLoadFailed`, destroy the banner and create it again. Web: no-op.
- *
- * @since 0.3.0
- */
- loadBanner(options: BannerIdOptions): Promise;
- /**
- * Make the banner visible and resume auto refresh (`resumeAutoRefresh`). Can be called before the load finished;
- * the creative appears when it arrives. Web: rejects as unimplemented.
- *
- * @since 0.3.0
- */
- showBanner(options: BannerIdOptions): Promise;
- /**
- * Hide the banner and pause auto refresh (`pauseAutoRefresh`) so hidden banners do not burn impressions. The view
- * stays attached; `showBanner()` brings it back. Web: no-op.
- *
- * @since 0.3.0
- */
- hideBanner(options: BannerIdOptions): Promise;
- /**
- * Move a banner (position, offsets, safe area). Resolves with the new frame. Web: rejects as unimplemented.
- *
- * @since 0.3.0
- */
- setBannerLayout(options: SetBannerLayoutOptions): Promise;
- /**
- * Remove the banner from the screen and `destroy()` it. A destroyed banner cannot be reused; create a new one.
- * Resolves also for unknown ids. Web: no-op.
- *
- * @since 0.3.0
- */
- destroyBanner(options: BannerIdOptions): Promise;
- /**
- * Load a native ad into a slot. Following the SDK rule "one native ad object per load", it destroys the slot's
- * previous ad (hiding it if shown), builds a new `LevelPlayNativeAd` with the placement and loads it. The outcome
- * arrives as `nativeAdLoaded` or `nativeAdLoadFailed`. Requires a finished `initialize()`. Rejects with
- * `UNSUPPORTED` when `getCapabilities().nativeAd` is `false` or the template is not listed there. Web: rejects as
- * unimplemented.
- *
- * @since 0.3.0
- */
- loadNativeAd(options: LoadNativeAdOptions): Promise;
- /**
- * Render the loaded native ad into its template, register the asset views with the SDK
- * (`NativeAdLayout.registerNativeAdViews` / `ISNativeAdView registerNativeAdViews:`) and place it at `rect` above the
- * WebView. Rejects with `NOT_LOADED` before `nativeAdLoaded`. The impression is reported by `nativeAdImpression`.
- * Web: rejects as unimplemented.
- *
- * @since 0.3.0
- */
- showNativeAd(options: NativeAdRectOptions): Promise;
- /**
- * Move or resize a shown native ad, for example after the placeholder element moved. Web: no-op.
- *
- * @since 0.3.0
- */
- setNativeAdRect(options: NativeAdRectOptions): Promise;
- /**
- * Hide a shown native ad (the view stays registered; `showNativeAd()` shows it again). Web: no-op.
- *
- * @since 0.3.0
- */
- hideNativeAd(options: NativeAdIdOptions): Promise;
- /**
- * Remove the native ad view and `destroyAd()` it. Resolves also for unknown ids. Web: no-op.
- *
- * @since 0.3.0
- */
- destroyNativeAd(options: NativeAdIdOptions): Promise;
/**
* An ad finished loading for the ad unit and can be shown.
*
@@ -1518,94 +537,6 @@ export interface LevelPlayPlugin {
* @since 0.1.0
*/
addListener(eventName: 'rewarded', listenerFunc: (event: AdRewardEvent) => void): Promise;
- /**
- * Rewarded and interstitial: the SDK reloaded the ad in the background and its ad info (network, revenue ...)
- * changed (`onAdInfoChanged` / `didChangeAdInfo:`). Banners and native ads have no such callback in SDK 9.6.1.
- *
- * @since 0.3.0
- */
- addListener(eventName: 'adInfoChanged', listenerFunc: (event: AdEvent) => void): Promise;
- /**
- * Impression-level revenue data for every rewarded, interstitial and banner impression (per-ad
- * `setImpressionDataListener` / `setImpressionDataDelegate:`, attached by the plugin to every ad object it creates),
- * plus native ad impressions synthesised from the native ad info (`adFormat: 'nativead'`, `adInfo` fields only).
- * Add the listener at any time, also before `initialize()`; nothing is delivered before the first ad shows.
- *
- * @since 0.3.0
- */
- addListener(eventName: 'impressionData', listenerFunc: (event: ImpressionData) => void): Promise;
- /**
- * A banner loaded or refreshed with a new creative.
- *
- * @since 0.3.0
- */
- addListener(eventName: 'bannerLoaded', listenerFunc: (event: BannerEvent) => void): Promise;
- /**
- * A banner load (or refresh) failed. The SDK keeps retrying on its refresh interval.
- *
- * @since 0.3.0
- */
- addListener(eventName: 'bannerLoadFailed', listenerFunc: (event: BannerErrorEvent) => void): Promise;
- /**
- * A banner creative was displayed on screen (impression).
- *
- * @since 0.3.0
- */
- addListener(eventName: 'bannerDisplayed', listenerFunc: (event: BannerEvent) => void): Promise;
- /**
- * A banner creative failed to display.
- *
- * @since 0.3.0
- */
- addListener(eventName: 'bannerDisplayFailed', listenerFunc: (event: BannerErrorEvent) => void): Promise;
- /**
- * The user clicked a banner.
- *
- * @since 0.3.0
- */
- addListener(eventName: 'bannerClicked', listenerFunc: (event: BannerEvent) => void): Promise;
- /**
- * A banner opened full screen (for example an expandable creative). Pause the game.
- *
- * @since 0.3.0
- */
- addListener(eventName: 'bannerExpanded', listenerFunc: (event: BannerEvent) => void): Promise;
- /**
- * A banner returned to its normal size. Resume the game.
- *
- * @since 0.3.0
- */
- addListener(eventName: 'bannerCollapsed', listenerFunc: (event: BannerEvent) => void): Promise;
- /**
- * A banner click sent the user out of the app (browser or store).
- *
- * @since 0.3.0
- */
- addListener(eventName: 'bannerLeftApplication', listenerFunc: (event: BannerEvent) => void): Promise;
- /**
- * A native ad loaded and can be shown with `showNativeAd()`.
- *
- * @since 0.3.0
- */
- addListener(eventName: 'nativeAdLoaded', listenerFunc: (event: NativeAdEvent) => void): Promise;
- /**
- * A native ad failed to load. Load again later (the plugin already destroyed the failed ad object).
- *
- * @since 0.3.0
- */
- addListener(eventName: 'nativeAdLoadFailed', listenerFunc: (event: NativeAdErrorEvent) => void): Promise;
- /**
- * A shown native ad recorded its impression (first pixel visible).
- *
- * @since 0.3.0
- */
- addListener(eventName: 'nativeAdImpression', listenerFunc: (event: NativeAdEvent) => void): Promise;
- /**
- * The user clicked a native ad.
- *
- * @since 0.3.0
- */
- addListener(eventName: 'nativeAdClicked', listenerFunc: (event: NativeAdEvent) => void): Promise;
/**
* Remove every listener of this plugin.
*
diff --git a/dist/esm/definitions.js.map b/dist/esm/definitions.js.map
index 571ed4a..6064034 100644
--- a/dist/esm/definitions.js.map
+++ b/dist/esm/definitions.js.map
@@ -1 +1 @@
-{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * Full-screen ad formats (`loadRewarded` / `loadInterstitial` family and the `loaded` ... `rewarded` events).\n * Banners and native ads have their own methods and `banner*` / `nativeAd*` events (since 0.3.0), so this union\n * stays unchanged for 0.2.x code.\n *\n * @since 0.1.0\n */\nexport type AdFormat = 'rewarded' | 'interstitial';\n\n/**\n * Options for `initialize()`.\n *\n * @since 0.1.0\n */\nexport interface InitOptions {\n /**\n * LevelPlay app key from the LevelPlay dashboard. Android and iOS apps have different keys.\n *\n * @since 0.1.0\n */\n appKey: string;\n /**\n * Optional user id. Needed for server-to-server reward callbacks and the Ad Quality user journey.\n *\n * @since 0.1.0\n */\n userId?: string;\n /**\n * Enable the LevelPlay Integration Test Suite: sets the `is_test_suite=enable` meta data before init.\n * Call `launchTestSuite()` after `initialize` resolves. Never ship this enabled.\n *\n * @default false\n * @since 0.1.0\n */\n testSuite?: boolean;\n /**\n * Turn on debug logs of the mediated ad network adapters (`LevelPlay.setAdaptersDebug(true)`). Development only.\n *\n * @default false\n * @since 0.1.0\n */\n adaptersDebug?: boolean;\n /**\n * Privacy signals applied right before init (LevelPlay recommends setting them before the SDK starts).\n * Same as calling `setConsent()` first.\n *\n * @since 0.1.0\n */\n consent?: ConsentOptions;\n}\n\n/**\n * Result of `initialize()` and `getSdkVersion()`.\n *\n * @since 0.1.0\n */\nexport interface InitResult {\n /**\n * Native LevelPlay SDK version, for example `9.6.1`. `web` on the web.\n *\n * @since 0.1.0\n */\n sdkVersion: string;\n}\n\n/**\n * Privacy signals forwarded to LevelPlay (`LevelPlayPrivacySettings` on Android, `LPMPrivacySettings` on iOS).\n * Omitted fields are left untouched.\n *\n * @since 0.1.0\n */\nexport interface ConsentOptions {\n /**\n * GDPR: `true` when the user consented to personalised ads and data processing, `false` when they did not.\n * For users in the EEA, UK and Switzerland pass `false` until a consent management platform (CMP) says otherwise.\n *\n * @since 0.1.0\n */\n gdprConsent?: boolean;\n /**\n * CCPA and other US state privacy laws: `true` when the user opted OUT of the sale or sharing of personal data\n * (\"do not sell\"), `false` otherwise.\n *\n * @since 0.1.0\n */\n ccpaDoNotSell?: boolean;\n /**\n * COPPA: `true` when the user must be treated as a child (child-directed treatment).\n *\n * @since 0.1.0\n */\n coppa?: boolean;\n}\n\n/**\n * Options for `setMetaData()`.\n *\n * @since 0.1.0\n */\nexport interface MetaDataOptions {\n /**\n * Meta data key, for example `is_deviceid_optout` or a network-specific flag from Unity's docs.\n *\n * @since 0.1.0\n */\n key: string;\n /**\n * Meta data value, always a string (for example `\"true\"`).\n *\n * @since 0.1.0\n */\n value: string;\n}\n\n/**\n * Identifies one ad unit.\n *\n * @since 0.1.0\n */\nexport interface AdUnitOptions {\n /**\n * Ad unit id from the LevelPlay dashboard (Ad units page). Android and iOS ad units have different ids.\n *\n * @since 0.1.0\n */\n adUnitId: string;\n}\n\n/**\n * Options for `showRewarded()` and `showInterstitial()`: `adUnitId` (see AdUnitOptions) plus an optional placement.\n *\n * @since 0.1.0\n */\nexport interface ShowOptions extends AdUnitOptions {\n /**\n * Optional placement name configured in the LevelPlay dashboard (capping, pacing and reward per placement).\n * Omit it to use the default placement.\n *\n * @since 0.1.0\n */\n placementName?: string;\n}\n\n/**\n * Options for `isReady()`: `adUnitId` (see AdUnitOptions) plus the format.\n *\n * @since 0.1.0\n */\nexport interface IsReadyOptions extends AdUnitOptions {\n /**\n * Format of the ad unit.\n *\n * @since 0.1.0\n */\n format: AdFormat;\n}\n\n/**\n * Result of `isReady()`.\n *\n * @since 0.1.0\n */\nexport interface IsReadyResult {\n /**\n * `true` when a loaded ad can be shown right now.\n *\n * @since 0.1.0\n */\n ready: boolean;\n}\n\n/**\n * The reward of a rewarded ad, as configured in the LevelPlay dashboard (per ad unit or placement).\n *\n * @since 0.1.0\n */\nexport interface Reward {\n /**\n * Name of the reward, for example `Coins`.\n *\n * @since 0.1.0\n */\n name: string;\n /**\n * Amount of the reward.\n *\n * @since 0.1.0\n */\n amount: number;\n}\n\n/**\n * Error reported by the SDK (load / display failures) or by the plugin.\n *\n * @since 0.1.0\n */\nexport interface AdError {\n /**\n * LevelPlay error code, for example `509` (no fill). `-1` is used by the plugin for \"Ad not ready\" and for the web\n * stub.\n *\n * @since 0.1.0\n */\n code: number;\n /**\n * Human readable message.\n *\n * @since 0.1.0\n */\n message: string;\n}\n\n/**\n * Subset of the native `LevelPlayAdInfo` (Android) / `LPMAdInfo` (iOS) that is useful in JavaScript.\n * Fields the SDK does not report are omitted.\n *\n * @since 0.1.0\n */\nexport interface AdInfo {\n /**\n * Unique id of this ad.\n *\n * @since 0.1.0\n */\n adId?: string;\n /**\n * Ad unit id.\n *\n * @since 0.1.0\n */\n adUnitId: string;\n /**\n * Ad unit name from the dashboard.\n *\n * @since 0.1.0\n */\n adUnitName?: string;\n /**\n * Ad format as reported by the SDK.\n *\n * @since 0.1.0\n */\n adFormat?: string;\n /**\n * Placement name of the show call, when one was used.\n *\n * @since 0.1.0\n */\n placementName?: string;\n /**\n * Name of the mediated network that served the ad.\n *\n * @since 0.1.0\n */\n adNetwork?: string;\n /**\n * Mediation instance name.\n *\n * @since 0.1.0\n */\n instanceName?: string;\n /**\n * Mediation instance id.\n *\n * @since 0.1.0\n */\n instanceId?: string;\n /**\n * Country code of the impression.\n *\n * @since 0.1.0\n */\n country?: string;\n /**\n * Auction id.\n *\n * @since 0.1.0\n */\n auctionId?: string;\n /**\n * Impression revenue in USD as reported by the SDK (may be absent or 0 before display).\n *\n * @since 0.1.0\n */\n revenue?: number;\n /**\n * Revenue precision as reported by the SDK.\n *\n * @since 0.1.0\n */\n precision?: string;\n /**\n * A/B test group of the user (`ab`).\n *\n * @since 0.3.0\n */\n ab?: string;\n /**\n * Segment name of the user, see `setSegment()`.\n *\n * @since 0.3.0\n */\n segmentName?: string;\n /**\n * Encrypted CPM (`encryptedCPM`).\n *\n * @since 0.3.0\n */\n encryptedCPM?: string;\n /**\n * Creative id of the served ad, when the network reports one.\n *\n * @since 0.3.0\n */\n creativeId?: string;\n /**\n * iOS only: SKAdNetwork conversion value (`LPMAdInfo.conversionValue`). Android's `LevelPlayAdInfo` has no such\n * field in SDK 9.6.1, so it is always absent there.\n *\n * @since 0.3.0\n */\n conversionValue?: number;\n /**\n * Size of the ad. Banners only (`LevelPlayAdInfo.getAdSize()` / `LPMAdInfo.adSize`).\n *\n * @since 0.3.0\n */\n adSize?: AdSizeInfo;\n}\n\n/**\n * A resolved ad size as reported by the SDK (`LevelPlayAdSize` / `LPMAdSize`). Width and height are in dp on Android\n * and points on iOS, which equal CSS px in the WebView at the default zoom.\n *\n * @since 0.3.0\n */\nexport interface AdSizeInfo {\n /**\n * Width in CSS px (dp / pt).\n *\n * @since 0.3.0\n */\n width: number;\n /**\n * Height in CSS px (dp / pt).\n *\n * @since 0.3.0\n */\n height: number;\n /**\n * SDK description of the size, for example `BANNER` or `ADAPTIVE`.\n *\n * @since 0.3.0\n */\n description?: string;\n /**\n * `true` for an adaptive size.\n *\n * @since 0.3.0\n */\n isAdaptive?: boolean;\n}\n\n/**\n * Result of `showRewarded()` and `showInterstitial()`, resolved after the ad\n * closed or failed to display.\n *\n * @since 0.1.0\n */\nexport interface ShowResult {\n /**\n * The ad was displayed (the `displayed` event fired).\n *\n * @since 0.1.0\n */\n shown: boolean;\n /**\n * Rewarded only: the reward callback fired for this show. Grant the reward only when this is `true`.\n * Always `false` for interstitials.\n *\n * @since 0.1.0\n */\n rewarded: boolean;\n /**\n * The reward, present when `rewarded` is `true`.\n *\n * @since 0.1.0\n */\n reward?: Reward;\n /**\n * Present when the ad was not ready (`code: -1`) or failed to display.\n *\n * @since 0.1.0\n */\n error?: AdError;\n /**\n * Info of the displayed ad.\n *\n * @since 0.1.0\n */\n adInfo?: AdInfo;\n}\n\n/**\n * Payload of the `loaded`, `displayed`, `clicked` and `closed` events.\n *\n * @since 0.1.0\n */\nexport interface AdEvent {\n /**\n * Format of the ad unit that fired the event.\n *\n * @since 0.1.0\n */\n format: AdFormat;\n /**\n * Ad unit that fired the event.\n *\n * @since 0.1.0\n */\n adUnitId: string;\n /**\n * Ad info, when the SDK provides it (not on `loadFailed`).\n *\n * @since 0.1.0\n */\n adInfo?: AdInfo;\n}\n\n/**\n * Payload of the `loadFailed` and `displayFailed` events: the AdEvent fields plus `error`.\n *\n * @since 0.1.0\n */\nexport interface AdErrorEvent extends AdEvent {\n /**\n * What went wrong.\n *\n * @since 0.1.0\n */\n error: AdError;\n}\n\n/**\n * Payload of the `rewarded` event: the AdEvent fields plus `reward`.\n *\n * @since 0.1.0\n */\nexport interface AdRewardEvent extends AdEvent {\n /**\n * The reward earned.\n *\n * @since 0.1.0\n */\n reward: Reward;\n}\n\n/**\n * iOS App Tracking Transparency status. `unavailable` on Android, on the web and on unknown future iOS values.\n *\n * @since 0.1.0\n */\nexport type TrackingStatus = 'authorized' | 'denied' | 'restricted' | 'notDetermined' | 'unavailable';\n\n/**\n * Result of `requestTrackingAuthorization()` and\n * `getTrackingAuthorizationStatus()`.\n *\n * @since 0.1.0\n */\nexport interface TrackingResult {\n /**\n * iOS App Tracking Transparency status. Always `unavailable` on Android and web.\n *\n * @since 0.1.0\n */\n status: TrackingStatus;\n}\n\n// ------------------------------------------------------------------------------------------------ 0.3.0: capabilities\n\n/**\n * Result of `getCapabilities()`: what this platform build of the plugin can do. Check it instead of the platform\n * name, so the same game code runs on Android, iOS and the web.\n *\n * @since 0.3.0\n */\nexport interface Capabilities {\n /**\n * Banner ads (`createBanner()` and friends) are available.\n *\n * @since 0.3.0\n */\n banner: boolean;\n /**\n * Native ads (`loadNativeAd()` and friends) are available.\n *\n * @since 0.3.0\n */\n nativeAd: boolean;\n /**\n * Native ad templates this platform can render. Empty when `nativeAd` is `false`.\n *\n * @since 0.3.0\n */\n nativeAdTemplates: NativeAdTemplate[];\n /**\n * The `impressionData` event is delivered.\n *\n * @since 0.3.0\n */\n impressionData: boolean;\n /**\n * The `adInfoChanged` event is delivered (rewarded and interstitial only).\n *\n * @since 0.3.0\n */\n adInfoChanged: boolean;\n}\n\n// ------------------------------------------------------------------------------------------------ 0.3.0: geometry\n\n/**\n * A rectangle in CSS px, relative to the top-left corner of the WebView viewport (the same space as\n * `element.getBoundingClientRect()` without page scroll).\n *\n * @since 0.3.0\n */\nexport interface Rect {\n /**\n * Left edge in CSS px.\n *\n * @since 0.3.0\n */\n x: number;\n /**\n * Top edge in CSS px.\n *\n * @since 0.3.0\n */\n y: number;\n /**\n * Width in CSS px.\n *\n * @since 0.3.0\n */\n width: number;\n /**\n * Height in CSS px.\n *\n * @since 0.3.0\n */\n height: number;\n}\n\n// ------------------------------------------------------------------------------------------------ 0.3.0: banners\n\n/**\n * Banner size presets, named after the SDK constants (`LevelPlayAdSize.BANNER` / `LPMAdSize.bannerSize()` ...).\n *\n * - `BANNER`: 320 x 50\n * - `LARGE`: 320 x 90\n * - `MEDIUM_RECTANGLE`: 300 x 250\n * - `LEADERBOARD`: 728 x 90 (tablets)\n * - `ADAPTIVE`: `LevelPlayAdSize.createAdaptiveAdSize(context, width)` / `LPMAdSize.createAdaptiveAdSize(withWidth:)`;\n * the SDK picks the height (and BANNER or LEADERBOARD as fallback) for the given width. Requires a finished\n * `initialize()`.\n * - `CUSTOM`: `LevelPlayAdSize.createCustomSize(width, height)` / `LPMAdSize.customSizeWithWidth:height:` with\n * `customSize`. Few networks fill custom sizes; prefer a preset or `ADAPTIVE`.\n *\n * @since 0.3.0\n */\nexport type BannerSize = 'BANNER' | 'LARGE' | 'MEDIUM_RECTANGLE' | 'LEADERBOARD' | 'ADAPTIVE' | 'CUSTOM';\n\n/**\n * Width and height of a `CUSTOM` banner, in CSS px (dp on Android, points on iOS).\n *\n * @since 0.3.0\n */\nexport interface BannerCustomSize {\n /**\n * Width in CSS px (positive integer).\n *\n * @since 0.3.0\n */\n width: number;\n /**\n * Height in CSS px (positive integer).\n *\n * @since 0.3.0\n */\n height: number;\n}\n\n/**\n * Vertical anchor of a banner inside the WebView's safe area. Banners are always horizontally centred; use\n * `offsetX` to move them sideways.\n *\n * @since 0.3.0\n */\nexport type BannerPosition = 'top' | 'bottom' | 'center';\n\n/**\n * Identifies one banner created with `createBanner()`.\n *\n * @since 0.3.0\n */\nexport interface BannerIdOptions {\n /**\n * Plugin-side banner id passed to `createBanner()` (defaults to the ad unit id there).\n *\n * @since 0.3.0\n */\n bannerId: string;\n}\n\n/**\n * Where a banner sits over the WebView.\n *\n * @since 0.3.0\n */\nexport interface BannerLayoutOptions {\n /**\n * Vertical anchor.\n *\n * @default 'bottom'\n * @since 0.3.0\n */\n position?: BannerPosition;\n /**\n * Horizontal offset from the centred position in CSS px (positive moves right).\n *\n * @default 0\n * @since 0.3.0\n */\n offsetX?: number;\n /**\n * Vertical offset from the anchored position in CSS px (positive moves down).\n *\n * @default 0\n * @since 0.3.0\n */\n offsetY?: number;\n /**\n * Keep the banner inside the safe area (status bar, notch / display cutout, home indicator, navigation bar), measured\n * against the WebView's own on-screen rect. Set `false` to anchor to the raw WebView edges.\n *\n * @default true\n * @since 0.3.0\n */\n respectSafeArea?: boolean;\n}\n\n/**\n * Options for `createBanner()`.\n *\n * @since 0.3.0\n */\nexport interface CreateBannerOptions extends AdUnitOptions, BannerLayoutOptions {\n /**\n * Plugin-side id of this banner, used by every other banner method and in banner events. Lets one ad unit back\n * several banners. Defaults to `adUnitId`.\n *\n * @since 0.3.0\n */\n bannerId?: string;\n /**\n * Size preset.\n *\n * @default 'ADAPTIVE'\n * @since 0.3.0\n */\n size?: BannerSize;\n /**\n * `CUSTOM` only: the banner size. When `customSize` is set and `size` is omitted, `size` defaults to `CUSTOM`.\n *\n * @since 0.3.0\n */\n customSize?: BannerCustomSize;\n /**\n * `ADAPTIVE` only: width in CSS px to compute the adaptive size for. Defaults to the width of the WebView's safe\n * area; in that case the plugin recreates and reloads the banner automatically when that width changes (rotation,\n * split screen, window resize), keeping its id, layout and visibility. A fixed `adaptiveWidth` is never recreated.\n *\n * @since 0.3.0\n */\n adaptiveWidth?: number;\n /**\n * Placement name (reporting only for banners). Applied through the banner config before the first load.\n *\n * @since 0.3.0\n */\n placementName?: string;\n /**\n * Bid floor in USD (`LevelPlayBannerAdView.Config.Builder.setBidFloor` / `LPMBannerAdViewConfigBuilder set(bidFloor:)`).\n *\n * @since 0.3.0\n */\n bidFloor?: number;\n}\n\n/**\n * Options for `setBannerLayout()`: `bannerId` plus the layout fields (see BannerLayoutOptions).\n *\n * @since 0.3.0\n */\nexport interface SetBannerLayoutOptions extends BannerIdOptions, BannerLayoutOptions {}\n\n/**\n * Result of `createBanner()`, `showBanner()` and `setBannerLayout()`.\n *\n * @since 0.3.0\n */\nexport interface BannerResult {\n /**\n * The banner id.\n *\n * @since 0.3.0\n */\n bannerId: string;\n /**\n * Requested ad size (the creative may be smaller for adaptive sizes; it is centred in this frame).\n *\n * @since 0.3.0\n */\n adSize: AdSizeInfo;\n /**\n * Where the banner frame is (or will be, while hidden) in CSS px, relative to the WebView viewport. Use it to pad\n * game UI away from the banner.\n *\n * @since 0.3.0\n */\n frame: Rect;\n /**\n * The banner view is currently visible.\n *\n * @since 0.3.0\n */\n visible: boolean;\n}\n\n/**\n * Payload of the `banner*` events.\n *\n * @since 0.3.0\n */\nexport interface BannerEvent {\n /**\n * Banner that fired the event.\n *\n * @since 0.3.0\n */\n bannerId: string;\n /**\n * Ad unit of the banner.\n *\n * @since 0.3.0\n */\n adUnitId: string;\n /**\n * Ad info, when the SDK provides it (not on `bannerLoadFailed`).\n *\n * @since 0.3.0\n */\n adInfo?: AdInfo;\n /**\n * Current frame of the banner in CSS px.\n *\n * @since 0.3.0\n */\n frame?: Rect;\n}\n\n/**\n * Payload of `bannerLoadFailed` and `bannerDisplayFailed`.\n *\n * @since 0.3.0\n */\nexport interface BannerErrorEvent extends BannerEvent {\n /**\n * What went wrong.\n *\n * @since 0.3.0\n */\n error: AdError;\n}\n\n// ------------------------------------------------------------------------------------------------ 0.3.0: native ads\n\n/**\n * Native ad template rendered by the plugin (the LevelPlay SDK ships no template views; the plugin provides its own\n * layouts, like Unity's Flutter and React Native wrappers do).\n *\n * - `small`: icon, title, advertiser, body, call to action; no media view. Recommended 300 x 175 or a row at least\n * 90 px tall.\n * - `medium`: the `small` assets plus a media view. Recommended 300 x 350.\n *\n * @since 0.3.0\n */\nexport type NativeAdTemplate = 'small' | 'medium';\n\n/**\n * Optional styling of a native ad template. Colours are CSS hex strings (`#RRGGBB` or `#RRGGBBAA`).\n *\n * @since 0.3.0\n */\nexport interface NativeAdTemplateStyle {\n /**\n * Template background.\n *\n * @since 0.3.0\n */\n backgroundColor?: string;\n /**\n * Title text colour.\n *\n * @since 0.3.0\n */\n titleColor?: string;\n /**\n * Body and advertiser text colour.\n *\n * @since 0.3.0\n */\n bodyColor?: string;\n /**\n * Call-to-action button background.\n *\n * @since 0.3.0\n */\n callToActionBackgroundColor?: string;\n /**\n * Call-to-action button text colour.\n *\n * @since 0.3.0\n */\n callToActionTextColor?: string;\n /**\n * Corner radius of the template in CSS px.\n *\n * @default 0\n * @since 0.3.0\n */\n cornerRadius?: number;\n /**\n * Title font.\n *\n * @since 0.3.0\n */\n titleFont?: NativeAdFont;\n /**\n * Body and advertiser font.\n *\n * @since 0.3.0\n */\n bodyFont?: NativeAdFont;\n /**\n * Call-to-action button font.\n *\n * @since 0.3.0\n */\n callToActionFont?: NativeAdFont;\n}\n\n/**\n * A font of a native ad template text. Omitted fields keep the template default (system font).\n *\n * @since 0.3.0\n */\nexport interface NativeAdFont {\n /**\n * Font family. Either a system family name (Android: `sans-serif`, `sans-serif-medium`, `serif`, `monospace` ...;\n * iOS: a `UIFont` family or PostScript name such as `Avenir Next` or `Menlo-Bold`), or the path of a `.ttf` / `.otf`\n * file inside the app's web assets, relative to the web root (for example `fonts/Inter-Bold.ttf`, the same file the\n * page loads with `@font-face`). Unknown families fall back to the system font.\n *\n * @since 0.3.0\n */\n family?: string;\n /**\n * Font size in CSS px (dp / pt; not scaled by the system font size setting, like text in the WebView).\n *\n * @since 0.3.0\n */\n size?: number;\n}\n\n/**\n * Identifies one native ad slot.\n *\n * @since 0.3.0\n */\nexport interface NativeAdIdOptions {\n /**\n * Plugin-side id of the native ad slot.\n *\n * @since 0.3.0\n */\n nativeAdId: string;\n}\n\n/**\n * Options for `loadNativeAd()`.\n *\n * @since 0.3.0\n */\nexport interface LoadNativeAdOptions extends NativeAdIdOptions {\n /**\n * Placement name. LevelPlay 9.6.1 native ads are addressed by placement only (`LevelPlayNativeAd.Builder\n * .withPlacementName` / `LevelPlayNativeAdBuilder withPlacementName:`); there is no ad unit id for native ads in\n * this SDK version. Omit it for the default placement.\n *\n * @since 0.3.0\n */\n placementName?: string;\n /**\n * Template used when the ad is shown.\n *\n * @default 'medium'\n * @since 0.3.0\n */\n template?: NativeAdTemplate;\n /**\n * Template styling.\n *\n * @since 0.3.0\n */\n style?: NativeAdTemplateStyle;\n}\n\n/**\n * Options for `showNativeAd()` and `setNativeAdRect()`.\n *\n * @since 0.3.0\n */\nexport interface NativeAdRectOptions extends NativeAdIdOptions {\n /**\n * Where the template goes, in CSS px relative to the WebView viewport (for example a placeholder element's\n * `getBoundingClientRect()`).\n *\n * @since 0.3.0\n */\n rect: Rect;\n}\n\n/**\n * Ad info of a native ad (`AdInfo` on Android / `ISAdInfo` on iOS: the older ironSource info type, which has no ad\n * unit, ad id or placement fields).\n *\n * @since 0.3.0\n */\nexport interface NativeAdInfo {\n /**\n * Auction id.\n *\n * @since 0.3.0\n */\n auctionId?: string;\n /**\n * Mediated network that served the ad.\n *\n * @since 0.3.0\n */\n adNetwork?: string;\n /**\n * Mediation instance name.\n *\n * @since 0.3.0\n */\n instanceName?: string;\n /**\n * Mediation instance id.\n *\n * @since 0.3.0\n */\n instanceId?: string;\n /**\n * Country code.\n *\n * @since 0.3.0\n */\n country?: string;\n /**\n * Impression revenue in USD.\n *\n * @since 0.3.0\n */\n revenue?: number;\n /**\n * Revenue precision.\n *\n * @since 0.3.0\n */\n precision?: string;\n /**\n * A/B test group.\n *\n * @since 0.3.0\n */\n ab?: string;\n /**\n * Segment name.\n *\n * @since 0.3.0\n */\n segmentName?: string;\n /**\n * Encrypted CPM.\n *\n * @since 0.3.0\n */\n encryptedCPM?: string;\n /**\n * iOS only: SKAdNetwork conversion value.\n *\n * @since 0.3.0\n */\n conversionValue?: number;\n}\n\n/**\n * Payload of the `nativeAd*` events.\n *\n * @since 0.3.0\n */\nexport interface NativeAdEvent {\n /**\n * Native ad slot that fired the event.\n *\n * @since 0.3.0\n */\n nativeAdId: string;\n /**\n * Placement passed to `loadNativeAd()`, if any.\n *\n * @since 0.3.0\n */\n placementName?: string;\n /**\n * Ad info, when the SDK provides it (not on `nativeAdLoadFailed`).\n *\n * @since 0.3.0\n */\n adInfo?: NativeAdInfo;\n}\n\n/**\n * Payload of `nativeAdLoadFailed`.\n *\n * @since 0.3.0\n */\nexport interface NativeAdErrorEvent extends NativeAdEvent {\n /**\n * What went wrong.\n *\n * @since 0.3.0\n */\n error: AdError;\n}\n\n// ------------------------------------------------------------------------------------------------ 0.3.0: revenue\n\n/**\n * Impression-level revenue data (`LevelPlayImpressionData` on Android, `LPMImpressionData` on iOS). Every field the\n * SDK 9.6.1 data class exposes is mapped; fields the SDK leaves empty are omitted.\n *\n * Not available in SDK 9.6.1 on either platform: `lifetimeRevenue` (removed from the impression data class). If the\n * server ever sends extra keys they are still visible in `allData`.\n *\n * @since 0.3.0\n */\nexport interface ImpressionData {\n /**\n * Which ad format produced the impression, as the SDK reports it (for example `Rewarded Video`, `Interstitial`,\n * `Banner`, or `nativead` for impressions synthesised from native ad info).\n *\n * @since 0.3.0\n */\n adFormat?: string;\n /**\n * Auction id.\n *\n * @since 0.3.0\n */\n auctionId?: string;\n /**\n * Mediation ad unit id (`mediationAdUnitId`).\n *\n * @since 0.3.0\n */\n adUnitId?: string;\n /**\n * Mediation ad unit name (`mediationAdUnitName`).\n *\n * @since 0.3.0\n */\n adUnitName?: string;\n /**\n * Mediated network that served the ad.\n *\n * @since 0.3.0\n */\n adNetwork?: string;\n /**\n * Mediation instance name.\n *\n * @since 0.3.0\n */\n instanceName?: string;\n /**\n * Mediation instance id.\n *\n * @since 0.3.0\n */\n instanceId?: string;\n /**\n * Country code.\n *\n * @since 0.3.0\n */\n country?: string;\n /**\n * Placement name of the impression.\n *\n * @since 0.3.0\n */\n placement?: string;\n /**\n * Revenue of this impression in USD.\n *\n * @since 0.3.0\n */\n revenue?: number;\n /**\n * Revenue precision (for example `BID`, `RATE`, `ESTIMATED`).\n *\n * @since 0.3.0\n */\n precision?: string;\n /**\n * A/B test group.\n *\n * @since 0.3.0\n */\n ab?: string;\n /**\n * Segment name, see `setSegment()`.\n *\n * @since 0.3.0\n */\n segmentName?: string;\n /**\n * Encrypted CPM (`encryptedCPM` on Android, `encryptedCpm` on iOS).\n *\n * @since 0.3.0\n */\n encryptedCPM?: string;\n /**\n * Creative id.\n *\n * @since 0.3.0\n */\n creativeId?: string;\n /**\n * iOS only: SKAdNetwork conversion value.\n *\n * @since 0.3.0\n */\n conversionValue?: number;\n /**\n * The raw `allData` map of the SDK (`getAllData()` JSON on Android, `allData` dictionary on iOS). Keys and value\n * types are SDK defined and may change between SDK versions.\n *\n * @since 0.3.0\n */\n allData?: { [key: string]: unknown };\n}\n\n// ------------------------------------------------------------------------------------------------ 0.3.0: placements\n\n/**\n * Options for `isPlacementCapped()`.\n *\n * @since 0.3.0\n */\nexport interface PlacementCappedOptions {\n /**\n * Format of the placement. LevelPlay 9.6.1 has capping checks for rewarded and interstitial only.\n *\n * @since 0.3.0\n */\n format: AdFormat;\n /**\n * Placement name from the LevelPlay dashboard.\n *\n * @since 0.3.0\n */\n placementName: string;\n}\n\n/**\n * Result of `isPlacementCapped()`.\n *\n * @since 0.3.0\n */\nexport interface PlacementCappedResult {\n /**\n * `true` when the placement reached its capping or pacing limit; showing it now fails.\n *\n * @since 0.3.0\n */\n capped: boolean;\n}\n\n/**\n * Options for `getReward()`: `adUnitId` (see AdUnitOptions) plus an optional placement.\n *\n * @since 0.3.0\n */\nexport interface GetRewardOptions extends AdUnitOptions {\n /**\n * Placement whose reward to read. Its reward takes precedence over the ad unit reward. Omit for the ad unit reward.\n *\n * @since 0.3.0\n */\n placementName?: string;\n}\n\n// ------------------------------------------------------------------------------------------------ 0.3.0: user\n\n/**\n * Options for `setSegment()` (`LevelPlaySegment` / `LPMSegment`). Omitted fields are not sent.\n *\n * @since 0.3.0\n */\nexport interface SegmentOptions {\n /**\n * Segment name.\n *\n * @since 0.3.0\n */\n segmentName?: string;\n /**\n * User level (integer).\n *\n * @since 0.3.0\n */\n level?: number;\n /**\n * The user has paid in the app.\n *\n * @since 0.3.0\n */\n isPaying?: boolean;\n /**\n * When the user was created, in milliseconds since the Unix epoch (`Date.now()` style).\n *\n * @since 0.3.0\n */\n userCreationDate?: number;\n /**\n * Total in-app purchase amount of the user (USD).\n *\n * @since 0.3.0\n */\n iapTotal?: number;\n /**\n * Custom segment parameters. SDK 9.6.1 limits: at most 5 pairs; keys and values 1-32 characters, letters and digits\n * only (`^[a-zA-Z0-9]*$`). The plugin rejects with `INVALID_ARGUMENT` instead of letting the SDK silently drop pairs.\n *\n * @since 0.3.0\n */\n customParameters?: { [key: string]: string };\n}\n\n/**\n * Options for `setDynamicUserId()`.\n *\n * @since 0.3.0\n */\nexport interface DynamicUserIdOptions {\n /**\n * Dynamic user id, forwarded in server-to-server reward callbacks. Can change during the session.\n *\n * @since 0.3.0\n */\n userId: string;\n}\n\n/**\n * Result of `setDynamicUserId()`.\n *\n * @since 0.3.0\n */\nexport interface DynamicUserIdResult {\n /**\n * The SDK accepted the id (`LevelPlay.setDynamicUserId` returns a boolean on both platforms).\n *\n * @since 0.3.0\n */\n valid: boolean;\n}\n\n/**\n * Event names emitted by the plugin.\n *\n * @since 0.1.0\n */\nexport type LevelPlayEventName =\n | 'loaded'\n | 'loadFailed'\n | 'displayed'\n | 'displayFailed'\n | 'clicked'\n | 'closed'\n | 'rewarded'\n | 'adInfoChanged'\n | 'impressionData'\n | 'bannerLoaded'\n | 'bannerLoadFailed'\n | 'bannerDisplayed'\n | 'bannerDisplayFailed'\n | 'bannerClicked'\n | 'bannerExpanded'\n | 'bannerCollapsed'\n | 'bannerLeftApplication'\n | 'nativeAdLoaded'\n | 'nativeAdLoadFailed'\n | 'nativeAdImpression'\n | 'nativeAdClicked';\n\n/**\n * Unity LevelPlay ads (ad-unit API): rewarded, interstitial and (since 0.3.0) banner and native ads, impression-level\n * revenue, segments and placement capping.\n *\n * @since 0.1.0\n */\nexport interface LevelPlayPlugin {\n /**\n * Initialise the LevelPlay SDK (`LevelPlay.init`). Resolves on init success, rejects with the init error\n * (code and message from the SDK) otherwise. Calling it again after a successful init resolves immediately;\n * concurrent calls share one init. Load ads only after this resolves.\n *\n * Set consent (and on iOS ask for ATT) before calling it.\n *\n * On the web it rejects as unimplemented.\n *\n * @since 0.1.0\n */\n initialize(options: InitOptions): Promise;\n\n /**\n * Native LevelPlay SDK version. Works before init.\n *\n * @since 0.1.0\n */\n getSdkVersion(): Promise;\n\n /**\n * Forward GDPR / CCPA / COPPA signals to LevelPlay. Call it before `initialize()` when you\n * can, and again whenever the user changes their choice.\n *\n * @since 0.1.0\n */\n setConsent(options: ConsentOptions): Promise;\n\n /**\n * Raw `LevelPlay.setMetaData(key, value)` for SDK or network-specific flags. Call it before init.\n *\n * @since 0.1.0\n */\n setMetaData(options: MetaDataOptions): Promise;\n\n /**\n * iOS: show the App Tracking Transparency prompt and resolve with the resulting status. Needs\n * `NSUserTrackingUsageDescription` in `Info.plist`. iOS only shows the prompt once; later calls resolve the stored\n * status. Call it before `initialize()`, while the app is active.\n *\n * Android and web: resolves `unavailable`.\n *\n * @since 0.1.0\n */\n requestTrackingAuthorization(): Promise;\n\n /**\n * Current App Tracking Transparency status without prompting (iOS). Android and web: `unavailable`.\n *\n * @since 0.1.0\n */\n getTrackingAuthorizationStatus(): Promise;\n\n /**\n * Start loading a rewarded ad for the ad unit. The native ad object is created on first use and reused for the\n * ad unit. Resolves once the request is issued; the outcome arrives as a `loaded` or `loadFailed` event.\n * Load the next ad after each show.\n *\n * @since 0.1.0\n */\n loadRewarded(options: AdUnitOptions): Promise;\n\n /**\n * Show a loaded rewarded ad. Resolves after the ad closed (or failed to display) with what happened. The reward\n * and close callbacks can arrive in either order on some networks, so the plugin waits up to 1 second after the close\n * for a late reward. Never rejects for \"not ready\": resolves `{ shown: false, rewarded: false, error }` instead.\n *\n * @since 0.1.0\n */\n showRewarded(options: ShowOptions): Promise;\n\n /**\n * Start loading an interstitial ad for the ad unit. Works like `loadRewarded()`.\n *\n * @since 0.1.0\n */\n loadInterstitial(options: AdUnitOptions): Promise;\n\n /**\n * Show a loaded interstitial. Resolves after it closed (or failed to display). Never rejects for \"not ready\".\n *\n * @since 0.1.0\n */\n showInterstitial(options: ShowOptions): Promise;\n\n /**\n * `isAdReady()` of the native ad object for this ad unit. `false` when the ad unit was never loaded.\n *\n * @since 0.1.0\n */\n isReady(options: IsReadyOptions): Promise;\n\n /**\n * Open the LevelPlay Integration Test Suite. Requires `initialize({ testSuite: true })` first.\n * Development builds only. Rejects on the web.\n *\n * @since 0.1.0\n */\n launchTestSuite(): Promise;\n\n /**\n * Write the LevelPlay integration helper report to the native log (Xcode console; Android logcat tag\n * `IntegrationHelper`): SDK, adapter and network SDK versions, each `VERIFIED` or not. Development only.\n *\n * @since 0.1.0\n */\n validateIntegration(): Promise;\n\n /**\n * What this platform supports (banners, native ad templates, impression data, `adInfoChanged`). Works before init.\n * Web: everything `false`.\n *\n * @since 0.3.0\n */\n getCapabilities(): Promise;\n\n /**\n * Set the user segment (`LevelPlay.setSegment` with a `LevelPlaySegment` / `LPMSegment`). Call it before\n * `initialize()` so the first ad requests use it; later calls apply to the following requests. Rejects with\n * `INVALID_ARGUMENT` when `customParameters` break the SDK limits. Web: no-op.\n *\n * @since 0.3.0\n */\n setSegment(options: SegmentOptions): Promise;\n\n /**\n * Set or change the dynamic user id used in server-to-server reward callbacks (`LevelPlay.setDynamicUserId` on\n * both platforms). Set it before `showRewarded()`. Web: resolves `{ valid: false }`.\n *\n * @since 0.3.0\n */\n setDynamicUserId(options: DynamicUserIdOptions): Promise;\n\n /**\n * Whether a rewarded or interstitial placement is capped right now (static\n * `LevelPlayRewardedAd.isPlacementCapped` / `LevelPlayInterstitialAd.isPlacementCapped` on Android,\n * `LPMRewardedAd.isPlacementCapped:` / `LPMInterstitialAd.isPlacementCapped:` on iOS). Works without a loaded ad.\n * Web: `{ capped: false }`.\n *\n * @since 0.3.0\n */\n isPlacementCapped(options: PlacementCappedOptions): Promise;\n\n /**\n * The reward configured for a rewarded ad unit or one of its placements (`LevelPlayRewardedAd.getReward(placement)` /\n * `LPMRewardedAd getReward(placementName:)`), for \"watch a video for N coins\" buttons. The SDK returns\n * `{ name: '', amount: 0 }` when it has no reward configuration (for example before init). Web: the same empty\n * reward.\n *\n * @since 0.3.0\n */\n getReward(options: GetRewardOptions): Promise;\n\n /**\n * Create a banner (`LevelPlayBannerAdView` / `LPMBannerAdView`) for the ad unit and attach it, hidden, in a\n * pass-through overlay above the WebView. Requires a finished `initialize()` (`NOT_INITIALIZED` otherwise). Rejects\n * with `ALREADY_EXISTS` when `bannerId` is in use; destroy it first. Does not load: call `loadBanner()`.\n * Web: rejects as unimplemented.\n *\n * @since 0.3.0\n */\n createBanner(options: CreateBannerOptions): Promise;\n\n /**\n * Load the banner (`loadAd()` / `loadAdWithViewController:`). The outcome arrives as `bannerLoaded` or\n * `bannerLoadFailed`; after the first load the SDK refreshes the banner on the dashboard interval. The SDK accepts\n * one load per banner object: calling it again has no effect (Android logs \"Banner load already called\"), so to retry\n * right away after `bannerLoadFailed`, destroy the banner and create it again. Web: no-op.\n *\n * @since 0.3.0\n */\n loadBanner(options: BannerIdOptions): Promise;\n\n /**\n * Make the banner visible and resume auto refresh (`resumeAutoRefresh`). Can be called before the load finished;\n * the creative appears when it arrives. Web: rejects as unimplemented.\n *\n * @since 0.3.0\n */\n showBanner(options: BannerIdOptions): Promise;\n\n /**\n * Hide the banner and pause auto refresh (`pauseAutoRefresh`) so hidden banners do not burn impressions. The view\n * stays attached; `showBanner()` brings it back. Web: no-op.\n *\n * @since 0.3.0\n */\n hideBanner(options: BannerIdOptions): Promise;\n\n /**\n * Move a banner (position, offsets, safe area). Resolves with the new frame. Web: rejects as unimplemented.\n *\n * @since 0.3.0\n */\n setBannerLayout(options: SetBannerLayoutOptions): Promise;\n\n /**\n * Remove the banner from the screen and `destroy()` it. A destroyed banner cannot be reused; create a new one.\n * Resolves also for unknown ids. Web: no-op.\n *\n * @since 0.3.0\n */\n destroyBanner(options: BannerIdOptions): Promise;\n\n /**\n * Load a native ad into a slot. Following the SDK rule \"one native ad object per load\", it destroys the slot's\n * previous ad (hiding it if shown), builds a new `LevelPlayNativeAd` with the placement and loads it. The outcome\n * arrives as `nativeAdLoaded` or `nativeAdLoadFailed`. Requires a finished `initialize()`. Rejects with\n * `UNSUPPORTED` when `getCapabilities().nativeAd` is `false` or the template is not listed there. Web: rejects as\n * unimplemented.\n *\n * @since 0.3.0\n */\n loadNativeAd(options: LoadNativeAdOptions): Promise;\n\n /**\n * Render the loaded native ad into its template, register the asset views with the SDK\n * (`NativeAdLayout.registerNativeAdViews` / `ISNativeAdView registerNativeAdViews:`) and place it at `rect` above the\n * WebView. Rejects with `NOT_LOADED` before `nativeAdLoaded`. The impression is reported by `nativeAdImpression`.\n * Web: rejects as unimplemented.\n *\n * @since 0.3.0\n */\n showNativeAd(options: NativeAdRectOptions): Promise;\n\n /**\n * Move or resize a shown native ad, for example after the placeholder element moved. Web: no-op.\n *\n * @since 0.3.0\n */\n setNativeAdRect(options: NativeAdRectOptions): Promise;\n\n /**\n * Hide a shown native ad (the view stays registered; `showNativeAd()` shows it again). Web: no-op.\n *\n * @since 0.3.0\n */\n hideNativeAd(options: NativeAdIdOptions): Promise;\n\n /**\n * Remove the native ad view and `destroyAd()` it. Resolves also for unknown ids. Web: no-op.\n *\n * @since 0.3.0\n */\n destroyNativeAd(options: NativeAdIdOptions): Promise;\n\n /**\n * An ad finished loading for the ad unit and can be shown.\n *\n * @since 0.1.0\n */\n addListener(eventName: 'loaded', listenerFunc: (event: AdEvent) => void): Promise;\n\n /**\n * Loading failed, for example `509` (no fill). Retry later with a backoff.\n *\n * @since 0.1.0\n */\n addListener(eventName: 'loadFailed', listenerFunc: (event: AdErrorEvent) => void): Promise;\n\n /**\n * The ad was displayed (impression). `adInfo.revenue` is available here.\n *\n * @since 0.1.0\n */\n addListener(eventName: 'displayed', listenerFunc: (event: AdEvent) => void): Promise;\n\n /**\n * The ad failed to display. The pending show call resolves with the same error.\n *\n * @since 0.1.0\n */\n addListener(\n eventName: 'displayFailed',\n listenerFunc: (event: AdErrorEvent) => void,\n ): Promise;\n\n /**\n * The user clicked the ad.\n *\n * @since 0.1.0\n */\n addListener(eventName: 'clicked', listenerFunc: (event: AdEvent) => void): Promise;\n\n /**\n * The ad was closed and the app is back in front.\n *\n * @since 0.1.0\n */\n addListener(eventName: 'closed', listenerFunc: (event: AdEvent) => void): Promise;\n\n /**\n * Rewarded only: the user earned the reward. Can fire before or after `closed`.\n *\n * @since 0.1.0\n */\n addListener(eventName: 'rewarded', listenerFunc: (event: AdRewardEvent) => void): Promise;\n\n /**\n * Rewarded and interstitial: the SDK reloaded the ad in the background and its ad info (network, revenue ...)\n * changed (`onAdInfoChanged` / `didChangeAdInfo:`). Banners and native ads have no such callback in SDK 9.6.1.\n *\n * @since 0.3.0\n */\n addListener(eventName: 'adInfoChanged', listenerFunc: (event: AdEvent) => void): Promise;\n\n /**\n * Impression-level revenue data for every rewarded, interstitial and banner impression (per-ad\n * `setImpressionDataListener` / `setImpressionDataDelegate:`, attached by the plugin to every ad object it creates),\n * plus native ad impressions synthesised from the native ad info (`adFormat: 'nativead'`, `adInfo` fields only).\n * Add the listener at any time, also before `initialize()`; nothing is delivered before the first ad shows.\n *\n * @since 0.3.0\n */\n addListener(eventName: 'impressionData', listenerFunc: (event: ImpressionData) => void): Promise;\n\n /**\n * A banner loaded or refreshed with a new creative.\n *\n * @since 0.3.0\n */\n addListener(eventName: 'bannerLoaded', listenerFunc: (event: BannerEvent) => void): Promise;\n\n /**\n * A banner load (or refresh) failed. The SDK keeps retrying on its refresh interval.\n *\n * @since 0.3.0\n */\n addListener(\n eventName: 'bannerLoadFailed',\n listenerFunc: (event: BannerErrorEvent) => void,\n ): Promise;\n\n /**\n * A banner creative was displayed on screen (impression).\n *\n * @since 0.3.0\n */\n addListener(eventName: 'bannerDisplayed', listenerFunc: (event: BannerEvent) => void): Promise;\n\n /**\n * A banner creative failed to display.\n *\n * @since 0.3.0\n */\n addListener(\n eventName: 'bannerDisplayFailed',\n listenerFunc: (event: BannerErrorEvent) => void,\n ): Promise;\n\n /**\n * The user clicked a banner.\n *\n * @since 0.3.0\n */\n addListener(eventName: 'bannerClicked', listenerFunc: (event: BannerEvent) => void): Promise;\n\n /**\n * A banner opened full screen (for example an expandable creative). Pause the game.\n *\n * @since 0.3.0\n */\n addListener(eventName: 'bannerExpanded', listenerFunc: (event: BannerEvent) => void): Promise;\n\n /**\n * A banner returned to its normal size. Resume the game.\n *\n * @since 0.3.0\n */\n addListener(eventName: 'bannerCollapsed', listenerFunc: (event: BannerEvent) => void): Promise;\n\n /**\n * A banner click sent the user out of the app (browser or store).\n *\n * @since 0.3.0\n */\n addListener(\n eventName: 'bannerLeftApplication',\n listenerFunc: (event: BannerEvent) => void,\n ): Promise;\n\n /**\n * A native ad loaded and can be shown with `showNativeAd()`.\n *\n * @since 0.3.0\n */\n addListener(eventName: 'nativeAdLoaded', listenerFunc: (event: NativeAdEvent) => void): Promise;\n\n /**\n * A native ad failed to load. Load again later (the plugin already destroyed the failed ad object).\n *\n * @since 0.3.0\n */\n addListener(\n eventName: 'nativeAdLoadFailed',\n listenerFunc: (event: NativeAdErrorEvent) => void,\n ): Promise;\n\n /**\n * A shown native ad recorded its impression (first pixel visible).\n *\n * @since 0.3.0\n */\n addListener(\n eventName: 'nativeAdImpression',\n listenerFunc: (event: NativeAdEvent) => void,\n ): Promise;\n\n /**\n * The user clicked a native ad.\n *\n * @since 0.3.0\n */\n addListener(eventName: 'nativeAdClicked', listenerFunc: (event: NativeAdEvent) => void): Promise;\n\n /**\n * Remove every listener of this plugin.\n *\n * @since 0.1.0\n */\n removeAllListeners(): Promise;\n}\n"]}
\ No newline at end of file
+{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * Full-screen ad formats supported by this plugin. Banners and native ads are intentionally not exposed.\n *\n * @since 0.1.0\n */\nexport type AdFormat = 'rewarded' | 'interstitial';\n\n/**\n * Options for `initialize()`.\n *\n * @since 0.1.0\n */\nexport interface InitOptions {\n /**\n * LevelPlay app key from the LevelPlay dashboard. Android and iOS apps have different keys.\n *\n * @since 0.1.0\n */\n appKey: string;\n /**\n * Optional user id. Needed for server-to-server reward callbacks and the Ad Quality user journey.\n *\n * @since 0.1.0\n */\n userId?: string;\n /**\n * Enable the LevelPlay Integration Test Suite: sets the `is_test_suite=enable` meta data before init.\n * Call `launchTestSuite()` after `initialize` resolves. Never ship this enabled.\n *\n * @default false\n * @since 0.1.0\n */\n testSuite?: boolean;\n /**\n * Turn on debug logs of the mediated ad network adapters (`LevelPlay.setAdaptersDebug(true)`). Development only.\n *\n * @default false\n * @since 0.1.0\n */\n adaptersDebug?: boolean;\n /**\n * Privacy signals applied right before init (LevelPlay recommends setting them before the SDK starts).\n * Same as calling `setConsent()` first.\n *\n * @since 0.1.0\n */\n consent?: ConsentOptions;\n}\n\n/**\n * Result of `initialize()` and `getSdkVersion()`.\n *\n * @since 0.1.0\n */\nexport interface InitResult {\n /**\n * Native LevelPlay SDK version, for example `9.6.1`. `web` on the web.\n *\n * @since 0.1.0\n */\n sdkVersion: string;\n}\n\n/**\n * Privacy signals forwarded to LevelPlay (`LevelPlayPrivacySettings` on Android, `LPMPrivacySettings` on iOS).\n * Omitted fields are left untouched.\n *\n * @since 0.1.0\n */\nexport interface ConsentOptions {\n /**\n * GDPR: `true` when the user consented to personalised ads and data processing, `false` when they did not.\n * For users in the EEA, UK and Switzerland pass `false` until a consent management platform (CMP) says otherwise.\n *\n * @since 0.1.0\n */\n gdprConsent?: boolean;\n /**\n * CCPA and other US state privacy laws: `true` when the user opted OUT of the sale or sharing of personal data\n * (\"do not sell\"), `false` otherwise.\n *\n * @since 0.1.0\n */\n ccpaDoNotSell?: boolean;\n /**\n * COPPA: `true` when the user must be treated as a child (child-directed treatment).\n *\n * @since 0.1.0\n */\n coppa?: boolean;\n}\n\n/**\n * Options for `setMetaData()`.\n *\n * @since 0.1.0\n */\nexport interface MetaDataOptions {\n /**\n * Meta data key, for example `is_deviceid_optout` or a network-specific flag from Unity's docs.\n *\n * @since 0.1.0\n */\n key: string;\n /**\n * Meta data value, always a string (for example `\"true\"`).\n *\n * @since 0.1.0\n */\n value: string;\n}\n\n/**\n * Identifies one ad unit.\n *\n * @since 0.1.0\n */\nexport interface AdUnitOptions {\n /**\n * Ad unit id from the LevelPlay dashboard (Ad units page). Android and iOS ad units have different ids.\n *\n * @since 0.1.0\n */\n adUnitId: string;\n}\n\n/**\n * Options for `showRewarded()` and `showInterstitial()`: `adUnitId` (see AdUnitOptions) plus an optional placement.\n *\n * @since 0.1.0\n */\nexport interface ShowOptions extends AdUnitOptions {\n /**\n * Optional placement name configured in the LevelPlay dashboard (capping, pacing and reward per placement).\n * Omit it to use the default placement.\n *\n * @since 0.1.0\n */\n placementName?: string;\n}\n\n/**\n * Options for `isReady()`: `adUnitId` (see AdUnitOptions) plus the format.\n *\n * @since 0.1.0\n */\nexport interface IsReadyOptions extends AdUnitOptions {\n /**\n * Format of the ad unit.\n *\n * @since 0.1.0\n */\n format: AdFormat;\n}\n\n/**\n * Result of `isReady()`.\n *\n * @since 0.1.0\n */\nexport interface IsReadyResult {\n /**\n * `true` when a loaded ad can be shown right now.\n *\n * @since 0.1.0\n */\n ready: boolean;\n}\n\n/**\n * The reward of a rewarded ad, as configured in the LevelPlay dashboard (per ad unit or placement).\n *\n * @since 0.1.0\n */\nexport interface Reward {\n /**\n * Name of the reward, for example `Coins`.\n *\n * @since 0.1.0\n */\n name: string;\n /**\n * Amount of the reward.\n *\n * @since 0.1.0\n */\n amount: number;\n}\n\n/**\n * Error reported by the SDK (load / display failures) or by the plugin.\n *\n * @since 0.1.0\n */\nexport interface AdError {\n /**\n * LevelPlay error code, for example `509` (no fill). `-1` is used by the plugin for \"Ad not ready\" and for the web\n * stub.\n *\n * @since 0.1.0\n */\n code: number;\n /**\n * Human readable message.\n *\n * @since 0.1.0\n */\n message: string;\n}\n\n/**\n * Subset of the native `LevelPlayAdInfo` (Android) / `LPMAdInfo` (iOS) that is useful in JavaScript.\n * Fields the SDK does not report are omitted.\n *\n * @since 0.1.0\n */\nexport interface AdInfo {\n /**\n * Unique id of this ad.\n *\n * @since 0.1.0\n */\n adId?: string;\n /**\n * Ad unit id.\n *\n * @since 0.1.0\n */\n adUnitId: string;\n /**\n * Ad unit name from the dashboard.\n *\n * @since 0.1.0\n */\n adUnitName?: string;\n /**\n * Ad format as reported by the SDK.\n *\n * @since 0.1.0\n */\n adFormat?: string;\n /**\n * Placement name of the show call, when one was used.\n *\n * @since 0.1.0\n */\n placementName?: string;\n /**\n * Name of the mediated network that served the ad.\n *\n * @since 0.1.0\n */\n adNetwork?: string;\n /**\n * Mediation instance name.\n *\n * @since 0.1.0\n */\n instanceName?: string;\n /**\n * Mediation instance id.\n *\n * @since 0.1.0\n */\n instanceId?: string;\n /**\n * Country code of the impression.\n *\n * @since 0.1.0\n */\n country?: string;\n /**\n * Auction id.\n *\n * @since 0.1.0\n */\n auctionId?: string;\n /**\n * Impression revenue in USD as reported by the SDK (may be absent or 0 before display).\n *\n * @since 0.1.0\n */\n revenue?: number;\n /**\n * Revenue precision as reported by the SDK.\n *\n * @since 0.1.0\n */\n precision?: string;\n}\n\n/**\n * Result of `showRewarded()` and `showInterstitial()`, resolved after the ad\n * closed or failed to display.\n *\n * @since 0.1.0\n */\nexport interface ShowResult {\n /**\n * The ad was displayed (the `displayed` event fired).\n *\n * @since 0.1.0\n */\n shown: boolean;\n /**\n * Rewarded only: the reward callback fired for this show. Grant the reward only when this is `true`.\n * Always `false` for interstitials.\n *\n * @since 0.1.0\n */\n rewarded: boolean;\n /**\n * The reward, present when `rewarded` is `true`.\n *\n * @since 0.1.0\n */\n reward?: Reward;\n /**\n * Present when the ad was not ready (`code: -1`) or failed to display.\n *\n * @since 0.1.0\n */\n error?: AdError;\n /**\n * Info of the displayed ad.\n *\n * @since 0.1.0\n */\n adInfo?: AdInfo;\n}\n\n/**\n * Payload of the `loaded`, `displayed`, `clicked` and `closed` events.\n *\n * @since 0.1.0\n */\nexport interface AdEvent {\n /**\n * Format of the ad unit that fired the event.\n *\n * @since 0.1.0\n */\n format: AdFormat;\n /**\n * Ad unit that fired the event.\n *\n * @since 0.1.0\n */\n adUnitId: string;\n /**\n * Ad info, when the SDK provides it (not on `loadFailed`).\n *\n * @since 0.1.0\n */\n adInfo?: AdInfo;\n}\n\n/**\n * Payload of the `loadFailed` and `displayFailed` events: the AdEvent fields plus `error`.\n *\n * @since 0.1.0\n */\nexport interface AdErrorEvent extends AdEvent {\n /**\n * What went wrong.\n *\n * @since 0.1.0\n */\n error: AdError;\n}\n\n/**\n * Payload of the `rewarded` event: the AdEvent fields plus `reward`.\n *\n * @since 0.1.0\n */\nexport interface AdRewardEvent extends AdEvent {\n /**\n * The reward earned.\n *\n * @since 0.1.0\n */\n reward: Reward;\n}\n\n/**\n * iOS App Tracking Transparency status. `unavailable` on Android, on the web and on unknown future iOS values.\n *\n * @since 0.1.0\n */\nexport type TrackingStatus = 'authorized' | 'denied' | 'restricted' | 'notDetermined' | 'unavailable';\n\n/**\n * Result of `requestTrackingAuthorization()` and\n * `getTrackingAuthorizationStatus()`.\n *\n * @since 0.1.0\n */\nexport interface TrackingResult {\n /**\n * iOS App Tracking Transparency status. Always `unavailable` on Android and web.\n *\n * @since 0.1.0\n */\n status: TrackingStatus;\n}\n\n/**\n * Event names emitted by the plugin.\n *\n * @since 0.1.0\n */\nexport type LevelPlayEventName =\n | 'loaded'\n | 'loadFailed'\n | 'displayed'\n | 'displayFailed'\n | 'clicked'\n | 'closed'\n | 'rewarded';\n\n/**\n * Unity LevelPlay rewarded and interstitial ads (ad-unit API).\n *\n * @since 0.1.0\n */\nexport interface LevelPlayPlugin {\n /**\n * Initialise the LevelPlay SDK (`LevelPlay.init`). Resolves on init success, rejects with the init error\n * (code and message from the SDK) otherwise. Calling it again after a successful init resolves immediately;\n * concurrent calls share one init. Load ads only after this resolves.\n *\n * Set consent (and on iOS ask for ATT) before calling it.\n *\n * On the web it rejects as unimplemented.\n *\n * @since 0.1.0\n */\n initialize(options: InitOptions): Promise;\n\n /**\n * Native LevelPlay SDK version. Works before init.\n *\n * @since 0.1.0\n */\n getSdkVersion(): Promise;\n\n /**\n * Forward GDPR / CCPA / COPPA signals to LevelPlay. Call it before `initialize()` when you\n * can, and again whenever the user changes their choice.\n *\n * @since 0.1.0\n */\n setConsent(options: ConsentOptions): Promise;\n\n /**\n * Raw `LevelPlay.setMetaData(key, value)` for SDK or network-specific flags. Call it before init.\n *\n * @since 0.1.0\n */\n setMetaData(options: MetaDataOptions): Promise;\n\n /**\n * iOS: show the App Tracking Transparency prompt and resolve with the resulting status. Needs\n * `NSUserTrackingUsageDescription` in `Info.plist`. iOS only shows the prompt once; later calls resolve the stored\n * status. Call it before `initialize()`, while the app is active.\n *\n * Android and web: resolves `unavailable`.\n *\n * @since 0.1.0\n */\n requestTrackingAuthorization(): Promise;\n\n /**\n * Current App Tracking Transparency status without prompting (iOS). Android and web: `unavailable`.\n *\n * @since 0.1.0\n */\n getTrackingAuthorizationStatus(): Promise;\n\n /**\n * Start loading a rewarded ad for the ad unit. The native ad object is created on first use and reused for the\n * ad unit. Resolves once the request is issued; the outcome arrives as a `loaded` or `loadFailed` event.\n * Load the next ad after each show.\n *\n * @since 0.1.0\n */\n loadRewarded(options: AdUnitOptions): Promise;\n\n /**\n * Show a loaded rewarded ad. Resolves after the ad closed (or failed to display) with what happened. The reward\n * and close callbacks can arrive in either order on some networks, so the plugin waits up to 1 second after the close\n * for a late reward. Never rejects for \"not ready\": resolves `{ shown: false, rewarded: false, error }` instead.\n *\n * @since 0.1.0\n */\n showRewarded(options: ShowOptions): Promise;\n\n /**\n * Start loading an interstitial ad for the ad unit. Works like `loadRewarded()`.\n *\n * @since 0.1.0\n */\n loadInterstitial(options: AdUnitOptions): Promise;\n\n /**\n * Show a loaded interstitial. Resolves after it closed (or failed to display). Never rejects for \"not ready\".\n *\n * @since 0.1.0\n */\n showInterstitial(options: ShowOptions): Promise;\n\n /**\n * `isAdReady()` of the native ad object for this ad unit. `false` when the ad unit was never loaded.\n *\n * @since 0.1.0\n */\n isReady(options: IsReadyOptions): Promise;\n\n /**\n * Open the LevelPlay Integration Test Suite. Requires `initialize({ testSuite: true })` first.\n * Development builds only. Rejects on the web.\n *\n * @since 0.1.0\n */\n launchTestSuite(): Promise;\n\n /**\n * Write the LevelPlay integration helper report to the native log (Xcode console; Android logcat tag\n * `IntegrationHelper`): SDK, adapter and network SDK versions, each `VERIFIED` or not. Development only.\n *\n * @since 0.1.0\n */\n validateIntegration(): Promise;\n\n /**\n * An ad finished loading for the ad unit and can be shown.\n *\n * @since 0.1.0\n */\n addListener(eventName: 'loaded', listenerFunc: (event: AdEvent) => void): Promise;\n\n /**\n * Loading failed, for example `509` (no fill). Retry later with a backoff.\n *\n * @since 0.1.0\n */\n addListener(eventName: 'loadFailed', listenerFunc: (event: AdErrorEvent) => void): Promise;\n\n /**\n * The ad was displayed (impression). `adInfo.revenue` is available here.\n *\n * @since 0.1.0\n */\n addListener(eventName: 'displayed', listenerFunc: (event: AdEvent) => void): Promise;\n\n /**\n * The ad failed to display. The pending show call resolves with the same error.\n *\n * @since 0.1.0\n */\n addListener(\n eventName: 'displayFailed',\n listenerFunc: (event: AdErrorEvent) => void,\n ): Promise;\n\n /**\n * The user clicked the ad.\n *\n * @since 0.1.0\n */\n addListener(eventName: 'clicked', listenerFunc: (event: AdEvent) => void): Promise;\n\n /**\n * The ad was closed and the app is back in front.\n *\n * @since 0.1.0\n */\n addListener(eventName: 'closed', listenerFunc: (event: AdEvent) => void): Promise;\n\n /**\n * Rewarded only: the user earned the reward. Can fire before or after `closed`.\n *\n * @since 0.1.0\n */\n addListener(eventName: 'rewarded', listenerFunc: (event: AdRewardEvent) => void): Promise;\n\n /**\n * Remove every listener of this plugin.\n *\n * @since 0.1.0\n */\n removeAllListeners(): Promise;\n}\n"]}
\ No newline at end of file
diff --git a/dist/esm/demo.d.ts b/dist/esm/demo.d.ts
index f2724ed..cb0883d 100644
--- a/dist/esm/demo.d.ts
+++ b/dist/esm/demo.d.ts
@@ -2,7 +2,6 @@
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
- * The sample apps have no native ad placement; native ads load with the default placement of the app key.
* Replace them with your own ids from the LevelPlay dashboard before release.
*/
export declare const LEVELPLAY_DEMO: {
@@ -10,12 +9,10 @@ export declare const LEVELPLAY_DEMO: {
readonly appKey: "25b63cf85";
readonly rewarded: "syz3d8ekts22q0or";
readonly interstitial: "h3xw38h9214adgxo";
- readonly banner: "4fpetq4lhe5lsw3e";
};
readonly ios: {
readonly appKey: "8545d445";
readonly rewarded: "qwouvdrkuwivay5q";
readonly interstitial: "wmgt0712uuux8ju4";
- readonly banner: "iep3rxsyp9na3rw8";
};
};
diff --git a/dist/esm/demo.js b/dist/esm/demo.js
index 59bf5ad..5173e38 100644
--- a/dist/esm/demo.js
+++ b/dist/esm/demo.js
@@ -2,7 +2,6 @@
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
- * The sample apps have no native ad placement; native ads load with the default placement of the app key.
* Replace them with your own ids from the LevelPlay dashboard before release.
*/
export const LEVELPLAY_DEMO = {
@@ -10,13 +9,11 @@ export const LEVELPLAY_DEMO = {
appKey: '25b63cf85',
rewarded: 'syz3d8ekts22q0or',
interstitial: 'h3xw38h9214adgxo',
- banner: '4fpetq4lhe5lsw3e',
},
ios: {
appKey: '8545d445',
rewarded: 'qwouvdrkuwivay5q',
interstitial: 'wmgt0712uuux8ju4',
- banner: 'iep3rxsyp9na3rw8',
},
};
//# sourceMappingURL=demo.js.map
\ No newline at end of file
diff --git a/dist/esm/demo.js.map b/dist/esm/demo.js.map
index 8ffd4da..6490be4 100644
--- a/dist/esm/demo.js.map
+++ b/dist/esm/demo.js.map
@@ -1 +1 @@
-{"version":3,"file":"demo.js","sourceRoot":"","sources":["../../src/demo.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE;QACP,MAAM,EAAE,WAAW;QACnB,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,kBAAkB;QAChC,MAAM,EAAE,kBAAkB;KAC3B;IACD,GAAG,EAAE;QACH,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,kBAAkB;QAChC,MAAM,EAAE,kBAAkB;KAC3B;CACO,CAAC","sourcesContent":["/**\n * Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps\n * (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and\n * `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.\n * The sample apps have no native ad placement; native ads load with the default placement of the app key.\n * Replace them with your own ids from the LevelPlay dashboard before release.\n */\nexport const LEVELPLAY_DEMO = {\n android: {\n appKey: '25b63cf85',\n rewarded: 'syz3d8ekts22q0or',\n interstitial: 'h3xw38h9214adgxo',\n banner: '4fpetq4lhe5lsw3e',\n },\n ios: {\n appKey: '8545d445',\n rewarded: 'qwouvdrkuwivay5q',\n interstitial: 'wmgt0712uuux8ju4',\n banner: 'iep3rxsyp9na3rw8',\n },\n} as const;\n"]}
\ No newline at end of file
+{"version":3,"file":"demo.js","sourceRoot":"","sources":["../../src/demo.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE;QACP,MAAM,EAAE,WAAW;QACnB,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,kBAAkB;KACjC;IACD,GAAG,EAAE;QACH,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,kBAAkB;KACjC;CACO,CAAC","sourcesContent":["/**\n * Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps\n * (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and\n * `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.\n * Replace them with your own ids from the LevelPlay dashboard before release.\n */\nexport const LEVELPLAY_DEMO = {\n android: {\n appKey: '25b63cf85',\n rewarded: 'syz3d8ekts22q0or',\n interstitial: 'h3xw38h9214adgxo',\n },\n ios: {\n appKey: '8545d445',\n rewarded: 'qwouvdrkuwivay5q',\n interstitial: 'wmgt0712uuux8ju4',\n },\n} as const;\n"]}
\ No newline at end of file
diff --git a/dist/esm/web.d.ts b/dist/esm/web.d.ts
index 955f59d..bcbb825 100644
--- a/dist/esm/web.d.ts
+++ b/dist/esm/web.d.ts
@@ -1,12 +1,8 @@
import { WebPlugin } from '@capacitor/core';
-import type { AdUnitOptions, BannerIdOptions, BannerResult, Capabilities, ConsentOptions, CreateBannerOptions, DynamicUserIdOptions, DynamicUserIdResult, GetRewardOptions, InitOptions, InitResult, IsReadyResult, LevelPlayPlugin, LoadNativeAdOptions, MetaDataOptions, NativeAdIdOptions, NativeAdRectOptions, PlacementCappedOptions, PlacementCappedResult, Reward, SegmentOptions, SetBannerLayoutOptions, ShowResult, TrackingResult } from './definitions';
+import type { AdUnitOptions, ConsentOptions, InitOptions, InitResult, IsReadyResult, LevelPlayPlugin, MetaDataOptions, ShowResult, TrackingResult } from './definitions';
/**
* Web stub. LevelPlay has no web SDK: init rejects with `unimplemented`, ads are never ready and every show resolves
* as "not shown" so callers can treat the web like a no-fill platform without special casing.
- *
- * 0.3.0: `getCapabilities()` reports nothing supported. Setters, loads of things that cannot exist, hide and destroy
- * are no-ops; calls that would have to return a native view (`createBanner`, `showBanner`, `setBannerLayout`,
- * `loadNativeAd`, `showNativeAd`) reject as unimplemented, like `initialize`.
*/
export declare class LevelPlayWeb extends WebPlugin implements LevelPlayPlugin {
private static readonly NO_FILL;
@@ -23,20 +19,4 @@ export declare class LevelPlayWeb extends WebPlugin implements LevelPlayPlugin {
isReady(): Promise;
launchTestSuite(): Promise;
validateIntegration(): Promise;
- getCapabilities(): Promise;
- setSegment(_options: SegmentOptions): Promise;
- setDynamicUserId(_options: DynamicUserIdOptions): Promise;
- isPlacementCapped(_options: PlacementCappedOptions): Promise;
- getReward(_options: GetRewardOptions): Promise;
- createBanner(_options: CreateBannerOptions): Promise;
- loadBanner(_options: BannerIdOptions): Promise;
- showBanner(_options: BannerIdOptions): Promise;
- hideBanner(_options: BannerIdOptions): Promise;
- setBannerLayout(_options: SetBannerLayoutOptions): Promise;
- destroyBanner(_options: BannerIdOptions): Promise;
- loadNativeAd(_options: LoadNativeAdOptions): Promise;
- showNativeAd(_options: NativeAdRectOptions): Promise;
- setNativeAdRect(_options: NativeAdRectOptions): Promise;
- hideNativeAd(_options: NativeAdIdOptions): Promise;
- destroyNativeAd(_options: NativeAdIdOptions): Promise;
}
diff --git a/dist/esm/web.js b/dist/esm/web.js
index d7200c5..ef4d816 100644
--- a/dist/esm/web.js
+++ b/dist/esm/web.js
@@ -2,10 +2,6 @@ import { WebPlugin } from '@capacitor/core';
/**
* Web stub. LevelPlay has no web SDK: init rejects with `unimplemented`, ads are never ready and every show resolves
* as "not shown" so callers can treat the web like a no-fill platform without special casing.
- *
- * 0.3.0: `getCapabilities()` reports nothing supported. Setters, loads of things that cannot exist, hide and destroy
- * are no-ops; calls that would have to return a native view (`createBanner`, `showBanner`, `setBannerLayout`,
- * `loadNativeAd`, `showNativeAd`) reject as unimplemented, like `initialize`.
*/
export class LevelPlayWeb extends WebPlugin {
async initialize(_options) {
@@ -47,54 +43,6 @@ export class LevelPlayWeb extends WebPlugin {
async validateIntegration() {
/* nothing to validate */
}
- async getCapabilities() {
- return { banner: false, nativeAd: false, nativeAdTemplates: [], impressionData: false, adInfoChanged: false };
- }
- async setSegment(_options) {
- /* nothing to forward */
- }
- async setDynamicUserId(_options) {
- return { valid: false };
- }
- async isPlacementCapped(_options) {
- return { capped: false };
- }
- async getReward(_options) {
- return { name: '', amount: 0 };
- }
- async createBanner(_options) {
- throw this.unimplemented('LevelPlay banners are not available on the web.');
- }
- async loadBanner(_options) {
- /* never fills */
- }
- async showBanner(_options) {
- throw this.unimplemented('LevelPlay banners are not available on the web.');
- }
- async hideBanner(_options) {
- /* nothing shown */
- }
- async setBannerLayout(_options) {
- throw this.unimplemented('LevelPlay banners are not available on the web.');
- }
- async destroyBanner(_options) {
- /* nothing to destroy */
- }
- async loadNativeAd(_options) {
- throw this.unimplemented('LevelPlay native ads are not available on the web.');
- }
- async showNativeAd(_options) {
- throw this.unimplemented('LevelPlay native ads are not available on the web.');
- }
- async setNativeAdRect(_options) {
- /* nothing shown */
- }
- async hideNativeAd(_options) {
- /* nothing shown */
- }
- async destroyNativeAd(_options) {
- /* nothing to destroy */
- }
}
LevelPlayWeb.NO_FILL = {
shown: false,
diff --git a/dist/esm/web.js.map b/dist/esm/web.js.map
index 42e39b5..006f397 100644
--- a/dist/esm/web.js.map
+++ b/dist/esm/web.js.map
@@ -1 +1 @@
-{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA6B5C;;;;;;;GAOG;AACH,MAAM,OAAO,YAAa,SAAQ,SAAS;IAOzC,KAAK,CAAC,UAAU,CAAC,QAAqB;QACpC,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAwB;QACvC,wBAAwB;IAC1B,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,QAAyB;QACzC,wBAAwB;IAC1B,CAAC;IAED,KAAK,CAAC,4BAA4B;QAChC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,8BAA8B;QAClC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAuB;QACxC,iBAAiB;IACnB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAuB;QACxC,yBAAY,YAAY,CAAC,OAAO,EAAG;IACrC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAuB;QAC5C,iBAAiB;IACnB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAuB;QAC5C,yBAAY,YAAY,CAAC,OAAO,EAAG;IACrC,CAAC;IAED,KAAK,CAAC,OAAO;QACX,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,yBAAyB;IAC3B,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAChH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAwB;QACvC,wBAAwB;IAC1B,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAA8B;QACnD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,QAAgC;QACtD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAA0B;QACxC,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAA6B;QAC9C,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAyB;QACxC,iBAAiB;IACnB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAyB;QACxC,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAyB;QACxC,mBAAmB;IACrB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,QAAgC;QACpD,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAAyB;QAC3C,wBAAwB;IAC1B,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAA6B;QAC9C,MAAM,IAAI,CAAC,aAAa,CAAC,oDAAoD,CAAC,CAAC;IACjF,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAA6B;QAC9C,MAAM,IAAI,CAAC,aAAa,CAAC,oDAAoD,CAAC,CAAC;IACjF,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,QAA6B;QACjD,mBAAmB;IACrB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAA2B;QAC5C,mBAAmB;IACrB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,QAA2B;QAC/C,wBAAwB;IAC1B,CAAC;;AAxHuB,oBAAO,GAAe;IAC5C,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,uCAAuC,EAAE;CACtE,CAAC","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n AdUnitOptions,\n BannerIdOptions,\n BannerResult,\n Capabilities,\n ConsentOptions,\n CreateBannerOptions,\n DynamicUserIdOptions,\n DynamicUserIdResult,\n GetRewardOptions,\n InitOptions,\n InitResult,\n IsReadyResult,\n LevelPlayPlugin,\n LoadNativeAdOptions,\n MetaDataOptions,\n NativeAdIdOptions,\n NativeAdRectOptions,\n PlacementCappedOptions,\n PlacementCappedResult,\n Reward,\n SegmentOptions,\n SetBannerLayoutOptions,\n ShowResult,\n TrackingResult,\n} from './definitions';\n\n/**\n * Web stub. LevelPlay has no web SDK: init rejects with `unimplemented`, ads are never ready and every show resolves\n * as \"not shown\" so callers can treat the web like a no-fill platform without special casing.\n *\n * 0.3.0: `getCapabilities()` reports nothing supported. Setters, loads of things that cannot exist, hide and destroy\n * are no-ops; calls that would have to return a native view (`createBanner`, `showBanner`, `setBannerLayout`,\n * `loadNativeAd`, `showNativeAd`) reject as unimplemented, like `initialize`.\n */\nexport class LevelPlayWeb extends WebPlugin implements LevelPlayPlugin {\n private static readonly NO_FILL: ShowResult = {\n shown: false,\n rewarded: false,\n error: { code: -1, message: 'LevelPlay is not available on the web' },\n };\n\n async initialize(_options: InitOptions): Promise {\n throw this.unimplemented('LevelPlay is not available on the web.');\n }\n\n async getSdkVersion(): Promise {\n return { sdkVersion: 'web' };\n }\n\n async setConsent(_options: ConsentOptions): Promise {\n /* nothing to forward */\n }\n\n async setMetaData(_options: MetaDataOptions): Promise {\n /* nothing to forward */\n }\n\n async requestTrackingAuthorization(): Promise {\n return { status: 'unavailable' };\n }\n\n async getTrackingAuthorizationStatus(): Promise {\n return { status: 'unavailable' };\n }\n\n async loadRewarded(_options: AdUnitOptions): Promise {\n /* never fills */\n }\n\n async showRewarded(_options: AdUnitOptions): Promise {\n return { ...LevelPlayWeb.NO_FILL };\n }\n\n async loadInterstitial(_options: AdUnitOptions): Promise {\n /* never fills */\n }\n\n async showInterstitial(_options: AdUnitOptions): Promise {\n return { ...LevelPlayWeb.NO_FILL };\n }\n\n async isReady(): Promise {\n return { ready: false };\n }\n\n async launchTestSuite(): Promise {\n throw this.unimplemented('LevelPlay is not available on the web.');\n }\n\n async validateIntegration(): Promise {\n /* nothing to validate */\n }\n\n async getCapabilities(): Promise {\n return { banner: false, nativeAd: false, nativeAdTemplates: [], impressionData: false, adInfoChanged: false };\n }\n\n async setSegment(_options: SegmentOptions): Promise {\n /* nothing to forward */\n }\n\n async setDynamicUserId(_options: DynamicUserIdOptions): Promise {\n return { valid: false };\n }\n\n async isPlacementCapped(_options: PlacementCappedOptions): Promise {\n return { capped: false };\n }\n\n async getReward(_options: GetRewardOptions): Promise {\n return { name: '', amount: 0 };\n }\n\n async createBanner(_options: CreateBannerOptions): Promise {\n throw this.unimplemented('LevelPlay banners are not available on the web.');\n }\n\n async loadBanner(_options: BannerIdOptions): Promise {\n /* never fills */\n }\n\n async showBanner(_options: BannerIdOptions): Promise {\n throw this.unimplemented('LevelPlay banners are not available on the web.');\n }\n\n async hideBanner(_options: BannerIdOptions): Promise {\n /* nothing shown */\n }\n\n async setBannerLayout(_options: SetBannerLayoutOptions): Promise {\n throw this.unimplemented('LevelPlay banners are not available on the web.');\n }\n\n async destroyBanner(_options: BannerIdOptions): Promise {\n /* nothing to destroy */\n }\n\n async loadNativeAd(_options: LoadNativeAdOptions): Promise {\n throw this.unimplemented('LevelPlay native ads are not available on the web.');\n }\n\n async showNativeAd(_options: NativeAdRectOptions): Promise {\n throw this.unimplemented('LevelPlay native ads are not available on the web.');\n }\n\n async setNativeAdRect(_options: NativeAdRectOptions): Promise {\n /* nothing shown */\n }\n\n async hideNativeAd(_options: NativeAdIdOptions): Promise {\n /* nothing shown */\n }\n\n async destroyNativeAd(_options: NativeAdIdOptions): Promise {\n /* nothing to destroy */\n }\n}\n"]}
\ No newline at end of file
+{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAc5C;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,SAAS;IAOzC,KAAK,CAAC,UAAU,CAAC,QAAqB;QACpC,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAwB;QACvC,wBAAwB;IAC1B,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,QAAyB;QACzC,wBAAwB;IAC1B,CAAC;IAED,KAAK,CAAC,4BAA4B;QAChC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,8BAA8B;QAClC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAuB;QACxC,iBAAiB;IACnB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAuB;QACxC,yBAAY,YAAY,CAAC,OAAO,EAAG;IACrC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAuB;QAC5C,iBAAiB;IACnB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAuB;QAC5C,yBAAY,YAAY,CAAC,OAAO,EAAG;IACrC,CAAC;IAED,KAAK,CAAC,OAAO;QACX,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,yBAAyB;IAC3B,CAAC;;AAxDuB,oBAAO,GAAe;IAC5C,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,uCAAuC,EAAE;CACtE,CAAC","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n AdUnitOptions,\n ConsentOptions,\n InitOptions,\n InitResult,\n IsReadyResult,\n LevelPlayPlugin,\n MetaDataOptions,\n ShowResult,\n TrackingResult,\n} from './definitions';\n\n/**\n * Web stub. LevelPlay has no web SDK: init rejects with `unimplemented`, ads are never ready and every show resolves\n * as \"not shown\" so callers can treat the web like a no-fill platform without special casing.\n */\nexport class LevelPlayWeb extends WebPlugin implements LevelPlayPlugin {\n private static readonly NO_FILL: ShowResult = {\n shown: false,\n rewarded: false,\n error: { code: -1, message: 'LevelPlay is not available on the web' },\n };\n\n async initialize(_options: InitOptions): Promise {\n throw this.unimplemented('LevelPlay is not available on the web.');\n }\n\n async getSdkVersion(): Promise {\n return { sdkVersion: 'web' };\n }\n\n async setConsent(_options: ConsentOptions): Promise {\n /* nothing to forward */\n }\n\n async setMetaData(_options: MetaDataOptions): Promise {\n /* nothing to forward */\n }\n\n async requestTrackingAuthorization(): Promise {\n return { status: 'unavailable' };\n }\n\n async getTrackingAuthorizationStatus(): Promise {\n return { status: 'unavailable' };\n }\n\n async loadRewarded(_options: AdUnitOptions): Promise {\n /* never fills */\n }\n\n async showRewarded(_options: AdUnitOptions): Promise {\n return { ...LevelPlayWeb.NO_FILL };\n }\n\n async loadInterstitial(_options: AdUnitOptions): Promise {\n /* never fills */\n }\n\n async showInterstitial(_options: AdUnitOptions): Promise {\n return { ...LevelPlayWeb.NO_FILL };\n }\n\n async isReady(): Promise {\n return { ready: false };\n }\n\n async launchTestSuite(): Promise {\n throw this.unimplemented('LevelPlay is not available on the web.');\n }\n\n async validateIntegration(): Promise {\n /* nothing to validate */\n }\n}\n"]}
\ No newline at end of file
diff --git a/dist/plugin.cjs.js b/dist/plugin.cjs.js
index c1eca96..2911d37 100644
--- a/dist/plugin.cjs.js
+++ b/dist/plugin.cjs.js
@@ -6,7 +6,6 @@ var core = require('@capacitor/core');
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
- * The sample apps have no native ad placement; native ads load with the default placement of the app key.
* Replace them with your own ids from the LevelPlay dashboard before release.
*/
const LEVELPLAY_DEMO = {
@@ -14,13 +13,11 @@ const LEVELPLAY_DEMO = {
appKey: '25b63cf85',
rewarded: 'syz3d8ekts22q0or',
interstitial: 'h3xw38h9214adgxo',
- banner: '4fpetq4lhe5lsw3e',
},
ios: {
appKey: '8545d445',
rewarded: 'qwouvdrkuwivay5q',
interstitial: 'wmgt0712uuux8ju4',
- banner: 'iep3rxsyp9na3rw8',
},
};
@@ -31,10 +28,6 @@ const LevelPlay = core.registerPlugin('LevelPlay', {
/**
* Web stub. LevelPlay has no web SDK: init rejects with `unimplemented`, ads are never ready and every show resolves
* as "not shown" so callers can treat the web like a no-fill platform without special casing.
- *
- * 0.3.0: `getCapabilities()` reports nothing supported. Setters, loads of things that cannot exist, hide and destroy
- * are no-ops; calls that would have to return a native view (`createBanner`, `showBanner`, `setBannerLayout`,
- * `loadNativeAd`, `showNativeAd`) reject as unimplemented, like `initialize`.
*/
class LevelPlayWeb extends core.WebPlugin {
async initialize(_options) {
@@ -76,54 +69,6 @@ class LevelPlayWeb extends core.WebPlugin {
async validateIntegration() {
/* nothing to validate */
}
- async getCapabilities() {
- return { banner: false, nativeAd: false, nativeAdTemplates: [], impressionData: false, adInfoChanged: false };
- }
- async setSegment(_options) {
- /* nothing to forward */
- }
- async setDynamicUserId(_options) {
- return { valid: false };
- }
- async isPlacementCapped(_options) {
- return { capped: false };
- }
- async getReward(_options) {
- return { name: '', amount: 0 };
- }
- async createBanner(_options) {
- throw this.unimplemented('LevelPlay banners are not available on the web.');
- }
- async loadBanner(_options) {
- /* never fills */
- }
- async showBanner(_options) {
- throw this.unimplemented('LevelPlay banners are not available on the web.');
- }
- async hideBanner(_options) {
- /* nothing shown */
- }
- async setBannerLayout(_options) {
- throw this.unimplemented('LevelPlay banners are not available on the web.');
- }
- async destroyBanner(_options) {
- /* nothing to destroy */
- }
- async loadNativeAd(_options) {
- throw this.unimplemented('LevelPlay native ads are not available on the web.');
- }
- async showNativeAd(_options) {
- throw this.unimplemented('LevelPlay native ads are not available on the web.');
- }
- async setNativeAdRect(_options) {
- /* nothing shown */
- }
- async hideNativeAd(_options) {
- /* nothing shown */
- }
- async destroyNativeAd(_options) {
- /* nothing to destroy */
- }
}
LevelPlayWeb.NO_FILL = {
shown: false,
diff --git a/dist/plugin.cjs.js.map b/dist/plugin.cjs.js.map
index f6c9e5c..4d13f30 100644
--- a/dist/plugin.cjs.js.map
+++ b/dist/plugin.cjs.js.map
@@ -1 +1 @@
-{"version":3,"file":"plugin.cjs.js","sources":["esm/demo.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps\n * (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and\n * `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.\n * The sample apps have no native ad placement; native ads load with the default placement of the app key.\n * Replace them with your own ids from the LevelPlay dashboard before release.\n */\nexport const LEVELPLAY_DEMO = {\n android: {\n appKey: '25b63cf85',\n rewarded: 'syz3d8ekts22q0or',\n interstitial: 'h3xw38h9214adgxo',\n banner: '4fpetq4lhe5lsw3e',\n },\n ios: {\n appKey: '8545d445',\n rewarded: 'qwouvdrkuwivay5q',\n interstitial: 'wmgt0712uuux8ju4',\n banner: 'iep3rxsyp9na3rw8',\n },\n};\n//# sourceMappingURL=demo.js.map","import { registerPlugin } from '@capacitor/core';\nconst LevelPlay = registerPlugin('LevelPlay', {\n web: () => import('./web').then((m) => new m.LevelPlayWeb()),\n});\nexport * from './definitions';\nexport { LEVELPLAY_DEMO } from './demo';\nexport { LevelPlay };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\n/**\n * Web stub. LevelPlay has no web SDK: init rejects with `unimplemented`, ads are never ready and every show resolves\n * as \"not shown\" so callers can treat the web like a no-fill platform without special casing.\n *\n * 0.3.0: `getCapabilities()` reports nothing supported. Setters, loads of things that cannot exist, hide and destroy\n * are no-ops; calls that would have to return a native view (`createBanner`, `showBanner`, `setBannerLayout`,\n * `loadNativeAd`, `showNativeAd`) reject as unimplemented, like `initialize`.\n */\nexport class LevelPlayWeb extends WebPlugin {\n async initialize(_options) {\n throw this.unimplemented('LevelPlay is not available on the web.');\n }\n async getSdkVersion() {\n return { sdkVersion: 'web' };\n }\n async setConsent(_options) {\n /* nothing to forward */\n }\n async setMetaData(_options) {\n /* nothing to forward */\n }\n async requestTrackingAuthorization() {\n return { status: 'unavailable' };\n }\n async getTrackingAuthorizationStatus() {\n return { status: 'unavailable' };\n }\n async loadRewarded(_options) {\n /* never fills */\n }\n async showRewarded(_options) {\n return Object.assign({}, LevelPlayWeb.NO_FILL);\n }\n async loadInterstitial(_options) {\n /* never fills */\n }\n async showInterstitial(_options) {\n return Object.assign({}, LevelPlayWeb.NO_FILL);\n }\n async isReady() {\n return { ready: false };\n }\n async launchTestSuite() {\n throw this.unimplemented('LevelPlay is not available on the web.');\n }\n async validateIntegration() {\n /* nothing to validate */\n }\n async getCapabilities() {\n return { banner: false, nativeAd: false, nativeAdTemplates: [], impressionData: false, adInfoChanged: false };\n }\n async setSegment(_options) {\n /* nothing to forward */\n }\n async setDynamicUserId(_options) {\n return { valid: false };\n }\n async isPlacementCapped(_options) {\n return { capped: false };\n }\n async getReward(_options) {\n return { name: '', amount: 0 };\n }\n async createBanner(_options) {\n throw this.unimplemented('LevelPlay banners are not available on the web.');\n }\n async loadBanner(_options) {\n /* never fills */\n }\n async showBanner(_options) {\n throw this.unimplemented('LevelPlay banners are not available on the web.');\n }\n async hideBanner(_options) {\n /* nothing shown */\n }\n async setBannerLayout(_options) {\n throw this.unimplemented('LevelPlay banners are not available on the web.');\n }\n async destroyBanner(_options) {\n /* nothing to destroy */\n }\n async loadNativeAd(_options) {\n throw this.unimplemented('LevelPlay native ads are not available on the web.');\n }\n async showNativeAd(_options) {\n throw this.unimplemented('LevelPlay native ads are not available on the web.');\n }\n async setNativeAdRect(_options) {\n /* nothing shown */\n }\n async hideNativeAd(_options) {\n /* nothing shown */\n }\n async destroyNativeAd(_options) {\n /* nothing to destroy */\n }\n}\nLevelPlayWeb.NO_FILL = {\n shown: false,\n rewarded: false,\n error: { code: -1, message: 'LevelPlay is not available on the web' },\n};\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG;AAC9B,IAAI,OAAO,EAAE;AACb,QAAQ,MAAM,EAAE,WAAW;AAC3B,QAAQ,QAAQ,EAAE,kBAAkB;AACpC,QAAQ,YAAY,EAAE,kBAAkB;AACxC,QAAQ,MAAM,EAAE,kBAAkB;AAClC,KAAK;AACL,IAAI,GAAG,EAAE;AACT,QAAQ,MAAM,EAAE,UAAU;AAC1B,QAAQ,QAAQ,EAAE,kBAAkB;AACpC,QAAQ,YAAY,EAAE,kBAAkB;AACxC,QAAQ,MAAM,EAAE,kBAAkB;AAClC,KAAK;AACL;;ACnBK,MAAC,SAAS,GAAGA,mBAAc,CAAC,WAAW,EAAE;AAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;AAChE,CAAC;;ACFD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,YAAY,SAASC,cAAS,CAAC;AAC5C,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC;AAC1E,IAAI;AACJ,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE;AACpC,IAAI;AACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B;AACA,IAAI;AACJ,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;AAChC;AACA,IAAI;AACJ,IAAI,MAAM,4BAA4B,GAAG;AACzC,QAAQ,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE;AACxC,IAAI;AACJ,IAAI,MAAM,8BAA8B,GAAG;AAC3C,QAAQ,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE;AACxC,IAAI;AACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC;AACA,IAAI;AACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC;AACtD,IAAI;AACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;AACrC;AACA,IAAI;AACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;AACrC,QAAQ,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC;AACtD,IAAI;AACJ,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;AAC/B,IAAI;AACJ,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC;AAC1E,IAAI;AACJ,IAAI,MAAM,mBAAmB,GAAG;AAChC;AACA,IAAI;AACJ,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE;AACrH,IAAI;AACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B;AACA,IAAI;AACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;AACrC,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;AAC/B,IAAI;AACJ,IAAI,MAAM,iBAAiB,CAAC,QAAQ,EAAE;AACtC,QAAQ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;AAChC,IAAI;AACJ,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;AAC9B,QAAQ,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;AACtC,IAAI;AACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC;AACnF,IAAI;AACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B;AACA,IAAI;AACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC;AACnF,IAAI;AACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B;AACA,IAAI;AACJ,IAAI,MAAM,eAAe,CAAC,QAAQ,EAAE;AACpC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC;AACnF,IAAI;AACJ,IAAI,MAAM,aAAa,CAAC,QAAQ,EAAE;AAClC;AACA,IAAI;AACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,oDAAoD,CAAC;AACtF,IAAI;AACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,oDAAoD,CAAC;AACtF,IAAI;AACJ,IAAI,MAAM,eAAe,CAAC,QAAQ,EAAE;AACpC;AACA,IAAI;AACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC;AACA,IAAI;AACJ,IAAI,MAAM,eAAe,CAAC,QAAQ,EAAE;AACpC;AACA,IAAI;AACJ;AACA,YAAY,CAAC,OAAO,GAAG;AACvB,IAAI,KAAK,EAAE,KAAK;AAChB,IAAI,QAAQ,EAAE,KAAK;AACnB,IAAI,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,uCAAuC,EAAE;AACzE,CAAC;;;;;;;;"}
\ No newline at end of file
+{"version":3,"file":"plugin.cjs.js","sources":["esm/demo.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps\n * (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and\n * `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.\n * Replace them with your own ids from the LevelPlay dashboard before release.\n */\nexport const LEVELPLAY_DEMO = {\n android: {\n appKey: '25b63cf85',\n rewarded: 'syz3d8ekts22q0or',\n interstitial: 'h3xw38h9214adgxo',\n },\n ios: {\n appKey: '8545d445',\n rewarded: 'qwouvdrkuwivay5q',\n interstitial: 'wmgt0712uuux8ju4',\n },\n};\n//# sourceMappingURL=demo.js.map","import { registerPlugin } from '@capacitor/core';\nconst LevelPlay = registerPlugin('LevelPlay', {\n web: () => import('./web').then((m) => new m.LevelPlayWeb()),\n});\nexport * from './definitions';\nexport { LEVELPLAY_DEMO } from './demo';\nexport { LevelPlay };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\n/**\n * Web stub. LevelPlay has no web SDK: init rejects with `unimplemented`, ads are never ready and every show resolves\n * as \"not shown\" so callers can treat the web like a no-fill platform without special casing.\n */\nexport class LevelPlayWeb extends WebPlugin {\n async initialize(_options) {\n throw this.unimplemented('LevelPlay is not available on the web.');\n }\n async getSdkVersion() {\n return { sdkVersion: 'web' };\n }\n async setConsent(_options) {\n /* nothing to forward */\n }\n async setMetaData(_options) {\n /* nothing to forward */\n }\n async requestTrackingAuthorization() {\n return { status: 'unavailable' };\n }\n async getTrackingAuthorizationStatus() {\n return { status: 'unavailable' };\n }\n async loadRewarded(_options) {\n /* never fills */\n }\n async showRewarded(_options) {\n return Object.assign({}, LevelPlayWeb.NO_FILL);\n }\n async loadInterstitial(_options) {\n /* never fills */\n }\n async showInterstitial(_options) {\n return Object.assign({}, LevelPlayWeb.NO_FILL);\n }\n async isReady() {\n return { ready: false };\n }\n async launchTestSuite() {\n throw this.unimplemented('LevelPlay is not available on the web.');\n }\n async validateIntegration() {\n /* nothing to validate */\n }\n}\nLevelPlayWeb.NO_FILL = {\n shown: false,\n rewarded: false,\n error: { code: -1, message: 'LevelPlay is not available on the web' },\n};\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,cAAc,GAAG;AAC9B,IAAI,OAAO,EAAE;AACb,QAAQ,MAAM,EAAE,WAAW;AAC3B,QAAQ,QAAQ,EAAE,kBAAkB;AACpC,QAAQ,YAAY,EAAE,kBAAkB;AACxC,KAAK;AACL,IAAI,GAAG,EAAE;AACT,QAAQ,MAAM,EAAE,UAAU;AAC1B,QAAQ,QAAQ,EAAE,kBAAkB;AACpC,QAAQ,YAAY,EAAE,kBAAkB;AACxC,KAAK;AACL;;AChBK,MAAC,SAAS,GAAGA,mBAAc,CAAC,WAAW,EAAE;AAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;AAChE,CAAC;;ACFD;AACA;AACA;AACA;AACO,MAAM,YAAY,SAASC,cAAS,CAAC;AAC5C,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC;AAC1E,IAAI;AACJ,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE;AACpC,IAAI;AACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B;AACA,IAAI;AACJ,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;AAChC;AACA,IAAI;AACJ,IAAI,MAAM,4BAA4B,GAAG;AACzC,QAAQ,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE;AACxC,IAAI;AACJ,IAAI,MAAM,8BAA8B,GAAG;AAC3C,QAAQ,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE;AACxC,IAAI;AACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC;AACA,IAAI;AACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC;AACtD,IAAI;AACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;AACrC;AACA,IAAI;AACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;AACrC,QAAQ,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC;AACtD,IAAI;AACJ,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;AAC/B,IAAI;AACJ,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC;AAC1E,IAAI;AACJ,IAAI,MAAM,mBAAmB,GAAG;AAChC;AACA,IAAI;AACJ;AACA,YAAY,CAAC,OAAO,GAAG;AACvB,IAAI,KAAK,EAAE,KAAK;AAChB,IAAI,QAAQ,EAAE,KAAK;AACnB,IAAI,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,uCAAuC,EAAE;AACzE,CAAC;;;;;;;;"}
\ No newline at end of file
diff --git a/dist/plugin.js b/dist/plugin.js
index 2a7ae65..10e684f 100644
--- a/dist/plugin.js
+++ b/dist/plugin.js
@@ -5,7 +5,6 @@ var capacitorLevelPlay = (function (exports, core) {
* Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps
* (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and
* `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.
- * The sample apps have no native ad placement; native ads load with the default placement of the app key.
* Replace them with your own ids from the LevelPlay dashboard before release.
*/
const LEVELPLAY_DEMO = {
@@ -13,13 +12,11 @@ var capacitorLevelPlay = (function (exports, core) {
appKey: '25b63cf85',
rewarded: 'syz3d8ekts22q0or',
interstitial: 'h3xw38h9214adgxo',
- banner: '4fpetq4lhe5lsw3e',
},
ios: {
appKey: '8545d445',
rewarded: 'qwouvdrkuwivay5q',
interstitial: 'wmgt0712uuux8ju4',
- banner: 'iep3rxsyp9na3rw8',
},
};
@@ -30,10 +27,6 @@ var capacitorLevelPlay = (function (exports, core) {
/**
* Web stub. LevelPlay has no web SDK: init rejects with `unimplemented`, ads are never ready and every show resolves
* as "not shown" so callers can treat the web like a no-fill platform without special casing.
- *
- * 0.3.0: `getCapabilities()` reports nothing supported. Setters, loads of things that cannot exist, hide and destroy
- * are no-ops; calls that would have to return a native view (`createBanner`, `showBanner`, `setBannerLayout`,
- * `loadNativeAd`, `showNativeAd`) reject as unimplemented, like `initialize`.
*/
class LevelPlayWeb extends core.WebPlugin {
async initialize(_options) {
@@ -75,54 +68,6 @@ var capacitorLevelPlay = (function (exports, core) {
async validateIntegration() {
/* nothing to validate */
}
- async getCapabilities() {
- return { banner: false, nativeAd: false, nativeAdTemplates: [], impressionData: false, adInfoChanged: false };
- }
- async setSegment(_options) {
- /* nothing to forward */
- }
- async setDynamicUserId(_options) {
- return { valid: false };
- }
- async isPlacementCapped(_options) {
- return { capped: false };
- }
- async getReward(_options) {
- return { name: '', amount: 0 };
- }
- async createBanner(_options) {
- throw this.unimplemented('LevelPlay banners are not available on the web.');
- }
- async loadBanner(_options) {
- /* never fills */
- }
- async showBanner(_options) {
- throw this.unimplemented('LevelPlay banners are not available on the web.');
- }
- async hideBanner(_options) {
- /* nothing shown */
- }
- async setBannerLayout(_options) {
- throw this.unimplemented('LevelPlay banners are not available on the web.');
- }
- async destroyBanner(_options) {
- /* nothing to destroy */
- }
- async loadNativeAd(_options) {
- throw this.unimplemented('LevelPlay native ads are not available on the web.');
- }
- async showNativeAd(_options) {
- throw this.unimplemented('LevelPlay native ads are not available on the web.');
- }
- async setNativeAdRect(_options) {
- /* nothing shown */
- }
- async hideNativeAd(_options) {
- /* nothing shown */
- }
- async destroyNativeAd(_options) {
- /* nothing to destroy */
- }
}
LevelPlayWeb.NO_FILL = {
shown: false,
diff --git a/dist/plugin.js.map b/dist/plugin.js.map
index 426dd5d..9ae7346 100644
--- a/dist/plugin.js.map
+++ b/dist/plugin.js.map
@@ -1 +1 @@
-{"version":3,"file":"plugin.js","sources":["esm/demo.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps\n * (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and\n * `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.\n * The sample apps have no native ad placement; native ads load with the default placement of the app key.\n * Replace them with your own ids from the LevelPlay dashboard before release.\n */\nexport const LEVELPLAY_DEMO = {\n android: {\n appKey: '25b63cf85',\n rewarded: 'syz3d8ekts22q0or',\n interstitial: 'h3xw38h9214adgxo',\n banner: '4fpetq4lhe5lsw3e',\n },\n ios: {\n appKey: '8545d445',\n rewarded: 'qwouvdrkuwivay5q',\n interstitial: 'wmgt0712uuux8ju4',\n banner: 'iep3rxsyp9na3rw8',\n },\n};\n//# sourceMappingURL=demo.js.map","import { registerPlugin } from '@capacitor/core';\nconst LevelPlay = registerPlugin('LevelPlay', {\n web: () => import('./web').then((m) => new m.LevelPlayWeb()),\n});\nexport * from './definitions';\nexport { LEVELPLAY_DEMO } from './demo';\nexport { LevelPlay };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\n/**\n * Web stub. LevelPlay has no web SDK: init rejects with `unimplemented`, ads are never ready and every show resolves\n * as \"not shown\" so callers can treat the web like a no-fill platform without special casing.\n *\n * 0.3.0: `getCapabilities()` reports nothing supported. Setters, loads of things that cannot exist, hide and destroy\n * are no-ops; calls that would have to return a native view (`createBanner`, `showBanner`, `setBannerLayout`,\n * `loadNativeAd`, `showNativeAd`) reject as unimplemented, like `initialize`.\n */\nexport class LevelPlayWeb extends WebPlugin {\n async initialize(_options) {\n throw this.unimplemented('LevelPlay is not available on the web.');\n }\n async getSdkVersion() {\n return { sdkVersion: 'web' };\n }\n async setConsent(_options) {\n /* nothing to forward */\n }\n async setMetaData(_options) {\n /* nothing to forward */\n }\n async requestTrackingAuthorization() {\n return { status: 'unavailable' };\n }\n async getTrackingAuthorizationStatus() {\n return { status: 'unavailable' };\n }\n async loadRewarded(_options) {\n /* never fills */\n }\n async showRewarded(_options) {\n return Object.assign({}, LevelPlayWeb.NO_FILL);\n }\n async loadInterstitial(_options) {\n /* never fills */\n }\n async showInterstitial(_options) {\n return Object.assign({}, LevelPlayWeb.NO_FILL);\n }\n async isReady() {\n return { ready: false };\n }\n async launchTestSuite() {\n throw this.unimplemented('LevelPlay is not available on the web.');\n }\n async validateIntegration() {\n /* nothing to validate */\n }\n async getCapabilities() {\n return { banner: false, nativeAd: false, nativeAdTemplates: [], impressionData: false, adInfoChanged: false };\n }\n async setSegment(_options) {\n /* nothing to forward */\n }\n async setDynamicUserId(_options) {\n return { valid: false };\n }\n async isPlacementCapped(_options) {\n return { capped: false };\n }\n async getReward(_options) {\n return { name: '', amount: 0 };\n }\n async createBanner(_options) {\n throw this.unimplemented('LevelPlay banners are not available on the web.');\n }\n async loadBanner(_options) {\n /* never fills */\n }\n async showBanner(_options) {\n throw this.unimplemented('LevelPlay banners are not available on the web.');\n }\n async hideBanner(_options) {\n /* nothing shown */\n }\n async setBannerLayout(_options) {\n throw this.unimplemented('LevelPlay banners are not available on the web.');\n }\n async destroyBanner(_options) {\n /* nothing to destroy */\n }\n async loadNativeAd(_options) {\n throw this.unimplemented('LevelPlay native ads are not available on the web.');\n }\n async showNativeAd(_options) {\n throw this.unimplemented('LevelPlay native ads are not available on the web.');\n }\n async setNativeAdRect(_options) {\n /* nothing shown */\n }\n async hideNativeAd(_options) {\n /* nothing shown */\n }\n async destroyNativeAd(_options) {\n /* nothing to destroy */\n }\n}\nLevelPlayWeb.NO_FILL = {\n shown: false,\n rewarded: false,\n error: { code: -1, message: 'LevelPlay is not available on the web' },\n};\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;IACA;IACA;AACY,UAAC,cAAc,GAAG;IAC9B,IAAI,OAAO,EAAE;IACb,QAAQ,MAAM,EAAE,WAAW;IAC3B,QAAQ,QAAQ,EAAE,kBAAkB;IACpC,QAAQ,YAAY,EAAE,kBAAkB;IACxC,QAAQ,MAAM,EAAE,kBAAkB;IAClC,KAAK;IACL,IAAI,GAAG,EAAE;IACT,QAAQ,MAAM,EAAE,UAAU;IAC1B,QAAQ,QAAQ,EAAE,kBAAkB;IACpC,QAAQ,YAAY,EAAE,kBAAkB;IACxC,QAAQ,MAAM,EAAE,kBAAkB;IAClC,KAAK;IACL;;ACnBK,UAAC,SAAS,GAAGA,mBAAc,CAAC,WAAW,EAAE;IAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;IAChE,CAAC;;ICFD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACO,MAAM,YAAY,SAASC,cAAS,CAAC;IAC5C,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC;IAC1E,IAAI;IACJ,IAAI,MAAM,aAAa,GAAG;IAC1B,QAAQ,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE;IACpC,IAAI;IACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B;IACA,IAAI;IACJ,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;IAChC;IACA,IAAI;IACJ,IAAI,MAAM,4BAA4B,GAAG;IACzC,QAAQ,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE;IACxC,IAAI;IACJ,IAAI,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE;IACxC,IAAI;IACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC;IACA,IAAI;IACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC;IACtD,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IACrC;IACA,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IACrC,QAAQ,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC;IACtD,IAAI;IACJ,IAAI,MAAM,OAAO,GAAG;IACpB,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;IAC/B,IAAI;IACJ,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC;IAC1E,IAAI;IACJ,IAAI,MAAM,mBAAmB,GAAG;IAChC;IACA,IAAI;IACJ,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE;IACrH,IAAI;IACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B;IACA,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IACrC,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;IAC/B,IAAI;IACJ,IAAI,MAAM,iBAAiB,CAAC,QAAQ,EAAE;IACtC,QAAQ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;IAChC,IAAI;IACJ,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;IAC9B,QAAQ,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;IACtC,IAAI;IACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC;IACnF,IAAI;IACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B;IACA,IAAI;IACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC;IACnF,IAAI;IACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B;IACA,IAAI;IACJ,IAAI,MAAM,eAAe,CAAC,QAAQ,EAAE;IACpC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC;IACnF,IAAI;IACJ,IAAI,MAAM,aAAa,CAAC,QAAQ,EAAE;IAClC;IACA,IAAI;IACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,oDAAoD,CAAC;IACtF,IAAI;IACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,oDAAoD,CAAC;IACtF,IAAI;IACJ,IAAI,MAAM,eAAe,CAAC,QAAQ,EAAE;IACpC;IACA,IAAI;IACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC;IACA,IAAI;IACJ,IAAI,MAAM,eAAe,CAAC,QAAQ,EAAE;IACpC;IACA,IAAI;IACJ;IACA,YAAY,CAAC,OAAO,GAAG;IACvB,IAAI,KAAK,EAAE,KAAK;IAChB,IAAI,QAAQ,EAAE,KAAK;IACnB,IAAI,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,uCAAuC,EAAE;IACzE,CAAC;;;;;;;;;;;;"}
\ No newline at end of file
+{"version":3,"file":"plugin.js","sources":["esm/demo.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Public demo app keys and ad unit ids from Unity's official LevelPlay sample apps\n * (https://github.com/ironsource-mobile/Mediation-Demo-Apps: `Android/Kotlin/.../DemoActivity.kt` and\n * `iOS/Swift SPM/LevelPlayDemo/DemoViewController.swift`). They serve test ads and are safe for development only.\n * Replace them with your own ids from the LevelPlay dashboard before release.\n */\nexport const LEVELPLAY_DEMO = {\n android: {\n appKey: '25b63cf85',\n rewarded: 'syz3d8ekts22q0or',\n interstitial: 'h3xw38h9214adgxo',\n },\n ios: {\n appKey: '8545d445',\n rewarded: 'qwouvdrkuwivay5q',\n interstitial: 'wmgt0712uuux8ju4',\n },\n};\n//# sourceMappingURL=demo.js.map","import { registerPlugin } from '@capacitor/core';\nconst LevelPlay = registerPlugin('LevelPlay', {\n web: () => import('./web').then((m) => new m.LevelPlayWeb()),\n});\nexport * from './definitions';\nexport { LEVELPLAY_DEMO } from './demo';\nexport { LevelPlay };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\n/**\n * Web stub. LevelPlay has no web SDK: init rejects with `unimplemented`, ads are never ready and every show resolves\n * as \"not shown\" so callers can treat the web like a no-fill platform without special casing.\n */\nexport class LevelPlayWeb extends WebPlugin {\n async initialize(_options) {\n throw this.unimplemented('LevelPlay is not available on the web.');\n }\n async getSdkVersion() {\n return { sdkVersion: 'web' };\n }\n async setConsent(_options) {\n /* nothing to forward */\n }\n async setMetaData(_options) {\n /* nothing to forward */\n }\n async requestTrackingAuthorization() {\n return { status: 'unavailable' };\n }\n async getTrackingAuthorizationStatus() {\n return { status: 'unavailable' };\n }\n async loadRewarded(_options) {\n /* never fills */\n }\n async showRewarded(_options) {\n return Object.assign({}, LevelPlayWeb.NO_FILL);\n }\n async loadInterstitial(_options) {\n /* never fills */\n }\n async showInterstitial(_options) {\n return Object.assign({}, LevelPlayWeb.NO_FILL);\n }\n async isReady() {\n return { ready: false };\n }\n async launchTestSuite() {\n throw this.unimplemented('LevelPlay is not available on the web.');\n }\n async validateIntegration() {\n /* nothing to validate */\n }\n}\nLevelPlayWeb.NO_FILL = {\n shown: false,\n rewarded: false,\n error: { code: -1, message: 'LevelPlay is not available on the web' },\n};\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;IACA;AACY,UAAC,cAAc,GAAG;IAC9B,IAAI,OAAO,EAAE;IACb,QAAQ,MAAM,EAAE,WAAW;IAC3B,QAAQ,QAAQ,EAAE,kBAAkB;IACpC,QAAQ,YAAY,EAAE,kBAAkB;IACxC,KAAK;IACL,IAAI,GAAG,EAAE;IACT,QAAQ,MAAM,EAAE,UAAU;IAC1B,QAAQ,QAAQ,EAAE,kBAAkB;IACpC,QAAQ,YAAY,EAAE,kBAAkB;IACxC,KAAK;IACL;;AChBK,UAAC,SAAS,GAAGA,mBAAc,CAAC,WAAW,EAAE;IAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;IAChE,CAAC;;ICFD;IACA;IACA;IACA;IACO,MAAM,YAAY,SAASC,cAAS,CAAC;IAC5C,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC;IAC1E,IAAI;IACJ,IAAI,MAAM,aAAa,GAAG;IAC1B,QAAQ,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE;IACpC,IAAI;IACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B;IACA,IAAI;IACJ,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;IAChC;IACA,IAAI;IACJ,IAAI,MAAM,4BAA4B,GAAG;IACzC,QAAQ,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE;IACxC,IAAI;IACJ,IAAI,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE;IACxC,IAAI;IACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC;IACA,IAAI;IACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC;IACtD,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IACrC;IACA,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IACrC,QAAQ,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC;IACtD,IAAI;IACJ,IAAI,MAAM,OAAO,GAAG;IACpB,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;IAC/B,IAAI;IACJ,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wCAAwC,CAAC;IAC1E,IAAI;IACJ,IAAI,MAAM,mBAAmB,GAAG;IAChC;IACA,IAAI;IACJ;IACA,YAAY,CAAC,OAAO,GAAG;IACvB,IAAI,KAAK,EAAE,KAAK;IAChB,IAAI,QAAQ,EAAE,KAAK;IACnB,IAAI,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,uCAAuC,EAAE;IACzE,CAAC;;;;;;;;;;;;"}
\ No newline at end of file
diff --git a/docs/design-0.3.md b/docs/design-0.3.md
deleted file mode 100644
index 7b53a3e..0000000
--- a/docs/design-0.3.md
+++ /dev/null
@@ -1,590 +0,0 @@
-# capacitor-levelplay 0.3.0 · API design
-
-Status: phase 3. `src/definitions.ts` and `src/web.ts` carry the new API; the Android bridge (phase 2, §15) and the
-iOS bridge (phase 3, §16) implement all of it. The owner's answers to the open questions are recorded in §14.
-
-Scope (owner approved): banners, native ads (template overlay), impression-level revenue, `adInfoChanged`, placement
-capping and reward lookup, segments, dynamic user id, full backwards compatibility with 0.2.x, and a Capacitor 7
-compatibility study.
-
-## 0. Sources and method
-
-Every native name below was read from the SDK binaries of **LevelPlay 9.6.1**, not only from the docs:
-
-- **Android**: `com.unity3d.ads-mediation:mediation-sdk:9.6.1` AAR from Maven Central, `classes.jar` listed with
- `javap -public` (JDK 21). The AAR manifest declares `minSdkVersion="19"`.
-- **iOS**: `IronSource.xcframework` (`CFBundleShortVersionString` 9.6.1, `MinimumOSVersion` 12.0) from the
- `LevelPlay-Swift-Package` SPM checkout, `ios-arm64/IronSource.framework/Headers/*.h`. `IronSource.h` defines
- `MEDIATION_SDK_VERSION = @"9.6.1"`. The framework ships no `.swiftinterface`; Swift names come from
- `NS_SWIFT_NAME` annotations and the ObjC importer.
-- Unity docs (behaviour, not names): `docs.unity.com/en-us/grow/levelplay/sdk/{android,ios}/banner-integration`,
- `.../android/native-ads-integration`, `.../flutter/native-ads-integration`.
-- Capacitor: `@capacitor/android` and `@capacitor/ios` 7.6.9 and 8.5.3 npm tarballs, diffed.
-
-Notation: `A:` Android (package `com.unity3d.mediation` unless a full name is given), `I:` iOS (header file name).
-
-## 1. Compatibility rules for 0.3.0
-
-- No existing method, option, event or type is renamed or removed. `AdFormat` stays `'rewarded' | 'interstitial'`
- (widening it would break exhaustive `switch` statements in 0.2.x code), so banners and native ads get their own
- methods and their own event names (`banner*`, `nativeAd*`) instead of reusing `loaded`, `clicked` ...
-- `AdInfo` only gains optional fields. `LevelPlayEventName` only gains members.
-- Existing events keep their payloads; `adInfoChanged` and `impressionData` are new names.
-- Reject codes reuse the existing string style (`INVALID_ARGUMENT`, `NO_VIEW_CONTROLLER`).
-
-## 2. Capabilities
-
-`getCapabilities(): Promise` → `{ banner, nativeAd, nativeAdTemplates, impressionData, adInfoChanged }`.
-
-| | Android | iOS | Web |
-|---|---|---|---|
-| `banner` | true | true | false |
-| `nativeAd` | true | true | false |
-| `nativeAdTemplates` | `['small','medium']` | `['small','medium']` | `[]` |
-| `impressionData` | true | true | false |
-| `adInfoChanged` | true | true | false |
-
-It is the honest switch the owner asked for: if a platform implementation ever has to drop a feature (for example
-templates do not pass review on one OS), the flag goes `false` and the methods reject `UNSUPPORTED`, without an API
-change.
-
-## 3. Banners
-
-### 3.1 TS API
-
-```ts
-createBanner({ adUnitId, bannerId?, size?: 'BANNER'|'LARGE'|'MEDIUM_RECTANGLE'|'LEADERBOARD'|'ADAPTIVE'|'CUSTOM',
- customSize?: { width, height }, adaptiveWidth?, placementName?, bidFloor?, position?: 'top'|'bottom'|'center',
- offsetX?, offsetY?, respectSafeArea? }): Promise
-loadBanner({ bannerId }): Promise
-showBanner({ bannerId }): Promise
-hideBanner({ bannerId }): Promise
-setBannerLayout({ bannerId, position?, offsetX?, offsetY?, respectSafeArea? }): Promise
-destroyBanner({ bannerId }): Promise
-// BannerResult = { bannerId, adSize: { width, height, description?, isAdaptive? }, frame: Rect, visible }
-```
-
-Defaults: `bannerId = adUnitId`, `size = 'ADAPTIVE'` (`'CUSTOM'` when only `customSize` is given), `position = 'bottom'`, offsets 0, `respectSafeArea = true`.
-Several banners can exist at once, keyed by `bannerId` (one ad unit may back several banners).
-
-Typical flow: `createBanner` → `loadBanner` → `showBanner` (immediately, or on `bannerLoaded`) → `hideBanner` during
-gameplay → `showBanner` → `destroyBanner` when leaving the screen.
-
-### 3.2 Native mapping
-
-| Plugin | Android (`com.unity3d.mediation.banner`) | iOS |
-|---|---|---|
-| view class | `LevelPlayBannerAdView extends FrameLayout`, ctor `(Context, String adUnitId, LevelPlayBannerAdView.Config)` | `LPMBannerAdView : UIView`, `initWithAdUnitId:config:` (LPMBannerAdView.h) |
-| config | `LevelPlayBannerAdView.Config.Builder().setAdSize(LevelPlayAdSize).setBidFloor(double).setPlacementName(String).build()` | `LPMBannerAdViewConfigBuilder` `set(adSize:)`, `set(bidFloor:)` (NSNumber), `set(placementName:)`, `build()` |
-| `BANNER` | `LevelPlayAdSize.BANNER` | `LPMAdSize.bannerSize()` |
-| `LARGE` | `LevelPlayAdSize.LARGE` | `LPMAdSize.largeSize()` |
-| `MEDIUM_RECTANGLE` | `LevelPlayAdSize.MEDIUM_RECTANGLE` | `LPMAdSize.mediumRectangleSize()` |
-| `LEADERBOARD` | `LevelPlayAdSize.LEADERBOARD` | `LPMAdSize.leaderBoardSize()` |
-| `ADAPTIVE` | `LevelPlayAdSize.createAdaptiveAdSize(Context, Integer width)` | `LPMAdSize.createAdaptiveAdSize(withWidth: CGFloat)` (nullable: `nil` before init) |
-| `CUSTOM` (Q5) | `LevelPlayAdSize.createCustomSize(int width, int height)` (dp) | `LPMAdSize.customSizeWithWidth:height:` |
-| size readout | `getWidth()`, `getHeight()`, `getDescription()`, `isAdaptive()` | `width`, `height`, `sizeDescription`, `isAdaptive` |
-| listener | `setBannerListener(LevelPlayBannerAdViewListener)` | `setDelegate(LPMBannerAdViewDelegate)` |
-| impression data | `setImpressionDataListener(LevelPlayImpressionDataListener)` | `setImpressionDataDelegate:` |
-| load | `loadAd()` (Activity context from the ctor) | `loadAdWithViewController:` (`bridge.viewController`) |
-| show / hide | `setVisibility(VISIBLE/GONE)` + `resumeAutoRefresh()` / `pauseAutoRefresh()` | `isHidden` + `resumeAutoRefresh` / `pauseAutoRefresh` |
-| destroy | `destroy()` then remove from parent | `destroy` then `removeFromSuperview` |
-
-The SDK has no show / hide API; visibility is the host view's job. Unity's docs say pause / resume only matter when a
-refresh interval is set on the dashboard, and that a resumed banner completes the remaining refresh time. Android's
-`IronSourceError.ERROR_BN_RELOAD_SKIP_INVISIBLE` shows the SDK itself skips refreshes of invisible banners; pausing
-explicitly makes that deterministic on both platforms.
-
-Adaptive width units: the plugin passes CSS px. On Android 1 CSS px = 1 dp in a Capacitor WebView at default zoom,
-and the `Integer` width **is dp** (§14 Q3): in the bytecode, `createAdaptiveAdSize` (`com.ironsource.g1.a`) compares
-the width with the preset widths (320 / 728) and, for a `null` or negative width, falls back to
-`DisplayMetrics.widthPixels / density` rounded (`com.ironsource.e5`), i.e. the screen width in dp. Checked on the emulator (Pixel 9 Pro, density 3): an
-`ADAPTIVE` banner for 426 CSS px reports `adSize` 426 x 50 and its `LevelPlayBannerAdView` measures 1278 x 150 px.
-On iOS 1 CSS px = 1 pt.
-Both factories need a finished init (iOS returns `nil` before init, documented in LPMAdSize.h), so `createBanner`
-rejects `NOT_INITIALIZED` before `initialize()` resolved. Unity's docs also say to create banners only after init
-succeeded.
-
-### 3.3 Banner events
-
-| Event | Android `LevelPlayBannerAdViewListener` | iOS `LPMBannerAdViewDelegate` |
-|---|---|---|
-| `bannerLoaded` | `onAdLoaded(LevelPlayAdInfo)` | `didLoadAdWithAdInfo:` (required) |
-| `bannerLoadFailed` | `onAdLoadFailed(LevelPlayAdError)` | `didFailToLoadAdWithAdUnitId:error:` (required) |
-| `bannerDisplayed` | `onAdDisplayed` (default method) | `didDisplayAdWithAdInfo:` (optional) |
-| `bannerDisplayFailed` | `onAdDisplayFailed(LevelPlayAdInfo, LevelPlayAdError)` | `didFailToDisplayAdWithAdInfo:error:` |
-| `bannerClicked` | `onAdClicked` | `didClickAdWithAdInfo:` |
-| `bannerExpanded` | `onAdExpanded` | `didExpandAdWithAdInfo:` |
-| `bannerCollapsed` | `onAdCollapsed` | `didCollapseAdWithAdInfo:` |
-| `bannerLeftApplication` | `onAdLeftApplication` | `didLeaveAppWithAdInfo:` |
-
-Payload: `BannerEvent { bannerId, adUnitId, adInfo?, frame? }`, plus `error` for the two failure events. All eight
-callbacks exist on both platforms in 9.6.1. There is **no** `adInfoChanged` callback for banners on either platform.
-
-## 4. Native ads
-
-### 4.1 What 9.6.1 has
-
-- Android: `com.ironsource.mediationsdk.ads.nativead.LevelPlayNativeAd`, built with
- `new LevelPlayNativeAd.Builder().withPlacementName(String).withListener(LevelPlayNativeAdListener).withActivity(Activity).build()`;
- `loadAd()`, `destroyAd()`, asset getters `getTitle()`, `getAdvertiser()`, `getBody()`, `getCallToAction()`,
- `getIcon()` (`NativeAdDataInterface.Image`). Views: `NativeAdLayout extends FrameLayout` with `setTitleView`,
- `setAdvertiserView`, `setBodyView`, `setIconView`, `setCallToActionView`, `setMediaView(LevelPlayMediaView)`,
- `registerNativeAdViews(LevelPlayNativeAd)`. Listener (`LevelPlayNativeAdListener` = `NativeAdLoadListener` +
- `NativeAdInteractionListener`): `onAdLoaded(ad, AdInfo)`, `onAdLoadFailed(ad, IronSourceError)`,
- `onAdImpression(ad, AdInfo)`, `onAdClicked(ad, AdInfo)`. `AdInfo` is `com.ironsource.mediationsdk.adunit.adapter.utility.AdInfo`.
-- iOS: `LevelPlayNativeAd` (`initWithBuilder:`, `loadAd`, `destroyAd`, `setDelegate:`, asset properties `title`,
- `advertiser`, `body`, `callToAction`, `icon` (`ISNativeAdDataImage` with `image` / `url`)), `LevelPlayNativeAdBuilder`
- (`withViewController:`, `withPlacementName:`, `withDelegate:`, `build`), view `ISNativeAdView : UIView` with outlets
- `adAppIcon`, `adTitleView`, `adAdvertiserView`, `adBodyView`, `adMediaView` (`LevelPlayMediaView`),
- `adCallToActionView` and `registerNativeAdViews:`. Delegate `LevelPlayNativeAdDelegate` =
- `ISNativeAdLoadDelegate` (`didLoad:withAdInfo:`, `didFailToLoad:withError:`) + `ISNativeAdInteractionDelegate`
- (`didRecordImpression:withAdInfo:`, `didClick:withAdInfo:`), with `ISAdInfo`.
-
-Findings that shape the API:
-
-1. **No template views in the SDK on either platform.** There is no `LevelPlayNativeAdTemplate`, template type or
- template layout resource in the AAR (its `res/` has only `values/`) or in the iOS headers. Unity's Flutter and
- React Native wrappers ship their own XML (Android) and XIB (iOS) templates (`LevelPlayTemplateType.SMALL` /
- `MEDIUM`). This plugin does the same: it owns two programmatic layouts per platform, `small` (no media view) and
- `medium` (with `LevelPlayMediaView`). `nativeAdSupported` is therefore `true` on both platforms, with the
- rendering being the plugin's code.
-2. **Native ads have no ad unit id in 9.6.1.** Both builders take a placement name only. The API exposes
- `placementName`, not `adUnitId`, and says so.
-3. **One ad object per load.** Unity: "destroy the ad object and create a new one for every new load". So
- `loadNativeAd` replaces the slot's previous ad.
-4. **Native ad info is the old `AdInfo` / `ISAdInfo`** (auction id, network, instance, country, revenue, precision,
- ab, segment, encrypted CPM; iOS adds `conversion_value`). No ad unit, ad id or placement in it. Hence a separate
- `NativeAdInfo` type instead of reusing `AdInfo` (whose `adUnitId` is required).
-5. **No per-ad impression-data listener for native ads** (only banners, interstitials and rewarded have
- `setImpressionDataListener` / `setImpressionDataDelegate:`). See §5 for how `impressionData` still covers them.
-6. Policy from Unity's guide: the ad must be marked as an ad, and the privacy / AdChoices icon belongs in the bottom
- left. Both templates draw an "Ad" badge and leave the bottom-left corner free.
-
-### 4.2 TS API
-
-```ts
-loadNativeAd({ nativeAdId, placementName?, template?: 'small'|'medium', style?: NativeAdTemplateStyle }): Promise
-showNativeAd({ nativeAdId, rect: { x, y, width, height } }): Promise
-setNativeAdRect({ nativeAdId, rect }): Promise