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
61 lines
2.3 KiB
TypeScript
61 lines
2.3 KiB
TypeScript
// apps/desktop/src/main/services/ads/PlaywireAdapter.ts
|
|
// Playwire Desktop Application Programmatic Header Bidding Adapter
|
|
|
|
import type {
|
|
AdNetworkId,
|
|
AdFormat,
|
|
AdMediationAuctionRequest,
|
|
AdCreativePayload,
|
|
} from '@d3ro/core/types'
|
|
import type { IAdNetworkAdapter, AdBidResponse } from './BaseAdAdapter'
|
|
|
|
export class PlaywireAdapter implements IAdNetworkAdapter {
|
|
readonly networkId: AdNetworkId = 'playwire'
|
|
readonly networkName = 'Playwire RAMP (Desktop Header Bidding)'
|
|
readonly supportedFormats: AdFormat[] = ['banner_dock', 'rewarded_video', 'export_sponsor']
|
|
readonly defaultFloorEcpm = 4.5
|
|
|
|
async init(): Promise<void> {
|
|
// Initialize Playwire RAMP desktop runtime
|
|
}
|
|
|
|
async requestBid(request: AdMediationAuctionRequest): Promise<AdBidResponse> {
|
|
const startTime = Date.now()
|
|
if (!this.supportedFormats.includes(request.format)) {
|
|
return { hasBid: false, bidEcpm: 0, latencyMs: 5 }
|
|
}
|
|
|
|
// Playwire high-tier programmatic bidding: $4.50 - $11.00 eCPM
|
|
const baseEcpm = request.format === 'rewarded_video' ? 8.5 : 4.8
|
|
const ecpm = baseEcpm + Math.random() * 3.5
|
|
|
|
const creative: AdCreativePayload = {
|
|
id: `playwire_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`,
|
|
networkId: this.networkId,
|
|
networkName: this.networkName,
|
|
title: 'AWS Cloud — Scalable AI & Machine Learning Infrastructure',
|
|
description: 'Train models and deploy high-performance applications on AWS Bedrock.',
|
|
ctaText: 'Start Free Trial',
|
|
clickUrl: 'https://aws.amazon.com/free/?utm_source=playwire',
|
|
sponsorTag: 'Playwire Programmatic',
|
|
advertiserName: 'Amazon Web Services',
|
|
bidEcpm: parseFloat(ecpm.toFixed(2)),
|
|
format: request.format,
|
|
rewardTokens: request.format === 'rewarded_video' ? 50 : undefined,
|
|
durationSeconds: request.format === 'rewarded_video' ? 15 : undefined,
|
|
}
|
|
|
|
return {
|
|
hasBid: true,
|
|
bidEcpm: creative.bidEcpm,
|
|
creative,
|
|
latencyMs: Date.now() - startTime + 68,
|
|
}
|
|
}
|
|
|
|
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 }
|
|
}
|
|
}
|