capacitor-levelplay/dist/esm/web.js
CRT 7a187f5dd1 0.3.0 API design: banners, native ad templates, impression data, adInfoChanged, placement capping and rewards, segments, dynamic user id
docs/design-0.3.md maps every feature to the exact LevelPlay 9.6.1 Android and iOS
classes (read from the AAR and xcframework headers), describes the WebView overlay,
error codes, platform gaps, Capacitor 7 findings and the test plan. definitions.ts
and web.ts carry the new typed API; native bridges follow in phase 2.
2026-10-10 03:19:02 +08:00

104 lines
No EOL
3.3 KiB
JavaScript

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) {
throw this.unimplemented('LevelPlay is not available on the web.');
}
async getSdkVersion() {
return { sdkVersion: 'web' };
}
async setConsent(_options) {
/* nothing to forward */
}
async setMetaData(_options) {
/* nothing to forward */
}
async requestTrackingAuthorization() {
return { status: 'unavailable' };
}
async getTrackingAuthorizationStatus() {
return { status: 'unavailable' };
}
async loadRewarded(_options) {
/* never fills */
}
async showRewarded(_options) {
return Object.assign({}, LevelPlayWeb.NO_FILL);
}
async loadInterstitial(_options) {
/* never fills */
}
async showInterstitial(_options) {
return Object.assign({}, LevelPlayWeb.NO_FILL);
}
async isReady() {
return { ready: false };
}
async launchTestSuite() {
throw this.unimplemented('LevelPlay is not available on the web.');
}
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,
rewarded: false,
error: { code: -1, message: 'LevelPlay is not available on the web' },
};
//# sourceMappingURL=web.js.map