Some checks failed
CI Pipeline / Code Quality & Typecheck (push) Waiting to run
CI Pipeline / Test Suite (macos-latest) (push) Blocked by required conditions
CI Pipeline / Test Suite (ubuntu-latest) (push) Blocked by required conditions
CI Pipeline / Test Suite (windows-latest) (push) Blocked by required conditions
CI Pipeline / Build Validation (admin) (push) Blocked by required conditions
CI Pipeline / Build Validation (desktop) (push) Blocked by required conditions
Deploy Landing Page / deploy (push) Blocked by required conditions
Deploy Landing Page / build (push) Waiting to run
Release & Packaging Pipeline / Build & Publish Admin Docker Image (push) Failing after 8s
Release & Code Signing CA Pipeline / build-and-sign-windows (push) Failing after 1m51s
Build macOS / Build & Package (macOS) (push) Failing after 4s
Build macOS / Build & Package (macOS)-1 (push) Failing after 5s
Release & Code Signing CA Pipeline / build-and-sign-macos (push) Failing after 3s
Release & Packaging Pipeline / Package macOS Desktop App (push) Failing after 4s
Release & Packaging Pipeline / Package Windows Desktop App (push) Failing after 2m28s
Release & Packaging Pipeline / Publish Official GitHub Release (push) Has been skipped
58 lines
2 KiB
TypeScript
58 lines
2 KiB
TypeScript
// apps/desktop/src/main/services/ads/InMobiAdapter.ts
|
|
// InMobi Programmatic Demand & Mobile/Hybrid Adapter
|
|
|
|
import type {
|
|
AdNetworkId,
|
|
AdFormat,
|
|
AdMediationAuctionRequest,
|
|
AdCreativePayload,
|
|
} from '@d3ro/core/types'
|
|
import type { IAdNetworkAdapter, AdBidResponse } from './BaseAdAdapter'
|
|
|
|
export class InMobiAdapter implements IAdNetworkAdapter {
|
|
readonly networkId: AdNetworkId = 'inmobi'
|
|
readonly networkName = 'InMobi (Programmatic Exchange)'
|
|
readonly supportedFormats: AdFormat[] = ['banner_dock', 'rewarded_video']
|
|
readonly defaultFloorEcpm = 2.8
|
|
|
|
async init(): Promise<void> {}
|
|
|
|
async requestBid(request: AdMediationAuctionRequest): Promise<AdBidResponse> {
|
|
const startTime = Date.now()
|
|
if (!this.supportedFormats.includes(request.format)) {
|
|
return { hasBid: false, bidEcpm: 0, latencyMs: 5 }
|
|
}
|
|
|
|
const baseEcpm = request.format === 'rewarded_video' ? 6.8 : 3.4
|
|
const ecpm = baseEcpm + Math.random() * 2.2
|
|
|
|
const creative: AdCreativePayload = {
|
|
id: `inmobi_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`,
|
|
networkId: this.networkId,
|
|
networkName: this.networkName,
|
|
title: 'NordVPN — Secure Your Data with Next-Gen Encryption',
|
|
description: 'Ultra-fast VPN protection across all your desktop and mobile devices.',
|
|
ctaText: 'Get 70% Off',
|
|
clickUrl: 'https://nordvpn.com?utm_source=inmobi',
|
|
sponsorTag: 'InMobi Exchange',
|
|
advertiserName: 'Nord Security',
|
|
bidEcpm: parseFloat(ecpm.toFixed(2)),
|
|
format: request.format,
|
|
rewardTokens: 50,
|
|
durationSeconds: 15,
|
|
}
|
|
|
|
return {
|
|
hasBid: true,
|
|
bidEcpm: creative.bidEcpm,
|
|
creative,
|
|
latencyMs: Date.now() - startTime + 50,
|
|
}
|
|
}
|
|
|
|
async reportImpression(adId: string): Promise<void> {}
|
|
async reportClick(adId: string): Promise<void> {}
|
|
async reportRewardCompletion(adId: string): Promise<{ success: boolean; tokenReward: number }> {
|
|
return { success: true, tokenReward: 50 }
|
|
}
|
|
}
|