@octane-xplat/ads 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -46
- package/package.json +6 -6
- package/src/BannerAd.macos.tsrx +8 -9
- package/src/BannerAd.tsrx +48 -45
- package/src/BannerAd.web.tsrx +7 -7
- package/src/ads.macos.ts +7 -7
- package/src/ads.ts +54 -53
- package/src/ads.web.ts +7 -7
- package/src/native-elements.d.ts +3 -3
- package/src/props.ts +18 -18
- package/src/types.ts +44 -44
- package/types/generated/.tsrx-typegen-manifest.json +0 -10
- package/types/generated/BannerAd.macos.d.ts +0 -3
- package/types/generated/BannerAd.web.d.ts +0 -3
- package/types/generated/ads.linux.d.ts +0 -1
- package/types/generated/ads.macos.d.ts +0 -2
- package/types/generated/ads.web.d.ts +0 -3
- package/types/generated/ads.windows.d.ts +0 -1
- package/types/generated/index.macos.d.ts +0 -4
- package/types/generated/index.web.d.ts +0 -4
- package/types/generated/index.windows.d.ts +0 -4
- package/types/generated/native-elements.d.ts +0 -7
package/README.md
CHANGED
|
@@ -1,49 +1,5 @@
|
|
|
1
1
|
# @octane-xplat/ads
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Web and desktop report `supported: false`.
|
|
3
|
+
[Documentation](https://octane-xplat.goddardai.org/package-ads).
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Install in an existing Xplat app:
|
|
9
|
-
|
|
10
|
-
```sh
|
|
11
|
-
bun add @octane-xplat/ads
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Before launching, configure the AdMob **app ID** in the native host:
|
|
15
|
-
`GADApplicationIdentifier` in `App_Resources/iOS/Info.plist`, or
|
|
16
|
-
`com.google.android.gms.ads.APPLICATION_ID` in the Android manifest's
|
|
17
|
-
application metadata. An app ID identifies the app; an **ad unit ID** identifies
|
|
18
|
-
an ad placement. Follow the [NativeScript plugin setup](https://docs.nativescript.org/plugins/google-mobile-ads)
|
|
19
|
-
for the remaining platform and consent configuration. Installing the package
|
|
20
|
-
does not complete that setup.
|
|
21
|
-
|
|
22
|
-
Finish the app's consent flow before initializing ads. For iOS tracking, see
|
|
23
|
-
[tracking authorization](../tracking-transparency/README.md) and request from an
|
|
24
|
-
explicit app action. An unavailable ATT gate on another platform is not app
|
|
25
|
-
consent. Initialize once after that flow:
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
import { ads } from '@octane-xplat/ads'
|
|
29
|
-
|
|
30
|
-
if (ads.supported) await ads.initialize()
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Render this component from a phone screen after initialization. Supply an ad
|
|
34
|
-
unit for the current platform; use your provider's test unit while developing:
|
|
35
|
-
|
|
36
|
-
```tsx
|
|
37
|
-
import { BannerAd } from '@octane-xplat/ads'
|
|
38
|
-
|
|
39
|
-
export function SponsorBanner({ adUnitId }: { adUnitId: string }) {
|
|
40
|
-
return <BannerAd adUnitId={adUnitId} size="anchoredAdaptive" />
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
A test banner should appear after loading. If it does not, check app ID,
|
|
45
|
-
ad unit platform, SDK errors, and network access before trying a production ad.
|
|
46
|
-
Fullscreen ads have a separate load lifecycle: wait for a loaded event before
|
|
47
|
-
showing one. The package does not wrap AppOpenAd; calling that factory throws.
|
|
48
|
-
See the [public contracts](https://github.com/octane-xplat/octane-xplat/blob/main/packages/ads/src/types.ts)
|
|
49
|
-
for the available formats and events.
|
|
5
|
+
[API reference](https://octane-xplat.goddardai.org/api-ads).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octane-xplat/ads",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Google AdMob ads for Octane xplat — banner, interstitial, rewarded, app-open via @nativescript/google-mobile-ads",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"android",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"@nativescript-community/octane": "0.2.5",
|
|
58
58
|
"@nativescript/core": "9.1.3",
|
|
59
59
|
"@nativescript/types": "9.1.4",
|
|
60
|
-
"@tsrx/typescript-plugin": "0.4.11",
|
|
61
60
|
"octane": "0.16.3",
|
|
62
|
-
"tsrx-typegen": "0.
|
|
63
|
-
"typescript": "
|
|
61
|
+
"tsrx-typegen": "0.6.1",
|
|
62
|
+
"typescript": "7.1.0-beta",
|
|
63
|
+
"@tsrx/content-mapper": "0.1.2"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@nativescript-community/octane": ">=0.2.1 <1",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@nativescript/google-mobile-ads": "5.0.4",
|
|
86
|
-
"@octane-xplat/jsx": "0.
|
|
87
|
-
"@octane-xplat/platform": "0.
|
|
86
|
+
"@octane-xplat/jsx": "0.20.0",
|
|
87
|
+
"@octane-xplat/platform": "0.20.0"
|
|
88
88
|
}
|
|
89
89
|
}
|
package/src/BannerAd.macos.tsrx
CHANGED
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
// reports once via onAdEvent error, matching the web leaf's honest contract.
|
|
4
4
|
import { useEffect } from 'octane'
|
|
5
5
|
import type { BannerAdProps } from './props'
|
|
6
|
-
import type { JSX } from 'octane/jsx-runtime'
|
|
7
6
|
|
|
8
|
-
export function BannerAd(props: BannerAdProps):
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export function BannerAd(props: BannerAdProps): unknown @{
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
props.onAdEvent?.({
|
|
10
|
+
type: 'error',
|
|
11
|
+
error: new Error('unsupported: AdMob is not available on macOS'),
|
|
12
|
+
})
|
|
13
|
+
}, [])
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
<masonview style={props.style} className={props.className} />
|
|
17
16
|
}
|
package/src/BannerAd.tsrx
CHANGED
|
@@ -8,53 +8,56 @@ import type { BannerAdProps } from './props'
|
|
|
8
8
|
registerElement('xplatbannerad', NativeBannerAd)
|
|
9
9
|
|
|
10
10
|
const SIZES: Record<string, any> = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
banner: () => (BannerAdSize as any).BANNER,
|
|
12
|
+
largeBanner: () => (BannerAdSize as any).LARGE_BANNER,
|
|
13
|
+
mediumRectangle: () => (BannerAdSize as any).MEDIUM_RECTANGLE,
|
|
14
|
+
fullBanner: () => (BannerAdSize as any).FULL_BANNER,
|
|
15
|
+
leaderboard: () => (BannerAdSize as any).LEADERBOARD,
|
|
16
|
+
adaptiveBanner: () => (BannerAdSize as any).getCurrentOrientationAnchoredAdaptiveBannerAdSize?.(),
|
|
17
|
+
anchoredAdaptive: () =>
|
|
18
|
+
(BannerAdSize as any).getCurrentOrientationAnchoredAdaptiveBannerAdSize?.(),
|
|
19
|
+
fluid: () => (BannerAdSize as any).FLUID,
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/** AdMob banner — the plugin view owns its own load() on mount. */
|
|
23
23
|
export function BannerAd(props: BannerAdProps): unknown @{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
24
|
+
const host = useRef<any>(null)
|
|
25
|
+
const bindHost = useCallback((v: any) => {
|
|
26
|
+
host.current = v
|
|
27
|
+
}, [])
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const v = host.current
|
|
31
|
+
|
|
32
|
+
if (!v) {
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (props.onAdEvent) {
|
|
37
|
+
v.onAdEvent((type: any, error?: any, data?: any) =>
|
|
38
|
+
props.onAdEvent?.({ type: String(type) as any, error, reward: data }),
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const bag = isAndroid ? props.android : props.ios
|
|
43
|
+
|
|
44
|
+
if (bag) {
|
|
45
|
+
Object.assign(v, bag)
|
|
46
|
+
}
|
|
47
|
+
}, [])
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const v = host.current
|
|
51
|
+
|
|
52
|
+
if (v && props.size) {
|
|
53
|
+
v.size = SIZES[props.size]?.() ?? (BannerAdSize as any).BANNER
|
|
54
|
+
}
|
|
55
|
+
}, [props.size])
|
|
56
|
+
|
|
57
|
+
<xplatbannerad
|
|
58
|
+
ref={bindHost}
|
|
59
|
+
unitId={props.adUnitId}
|
|
60
|
+
style={props.style}
|
|
61
|
+
className={props.className}
|
|
62
|
+
/>
|
|
60
63
|
}
|
package/src/BannerAd.web.tsrx
CHANGED
|
@@ -6,12 +6,12 @@ import type { BannerAdProps } from './props'
|
|
|
6
6
|
import type { JSX } from 'octane/jsx-runtime'
|
|
7
7
|
|
|
8
8
|
export function BannerAd(props: BannerAdProps): JSX.Element @{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
props.onAdEvent?.({
|
|
11
|
+
type: 'error',
|
|
12
|
+
error: new Error('unsupported: AdMob is not available on web'),
|
|
13
|
+
})
|
|
14
|
+
}, [])
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
<div style={props.style} className={props.className} />
|
|
17
17
|
}
|
package/src/ads.macos.ts
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
import type { Ads } from './types'
|
|
5
5
|
|
|
6
6
|
const unsupported = () => {
|
|
7
|
-
|
|
7
|
+
throw new Error('unsupported: AdMob is not available on macOS')
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const ads: Ads = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
supported: false,
|
|
12
|
+
initialize: async () => {},
|
|
13
|
+
createInterstitial: unsupported,
|
|
14
|
+
createRewardedAd: unsupported,
|
|
15
|
+
createRewardedInterstitialAd: unsupported,
|
|
16
|
+
createAppOpenAd: unsupported,
|
|
17
17
|
}
|
package/src/ads.ts
CHANGED
|
@@ -1,72 +1,73 @@
|
|
|
1
1
|
// Ads — native leaf over @nativescript/google-mobile-ads. Banner lives in
|
|
2
2
|
// BannerAd.tsrx (a view); this service owns SDK init + fullscreen formats.
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
InterstitialAd,
|
|
5
|
+
MobileAds,
|
|
6
|
+
RewardedAd,
|
|
7
|
+
RewardedInterstitialAd,
|
|
8
8
|
} from '@nativescript/google-mobile-ads'
|
|
9
9
|
|
|
10
10
|
import type { AdEventListener, Ads, LoadedAd } from './types'
|
|
11
11
|
|
|
12
12
|
const EVENT: Record<string, string> = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
loaded: 'loaded',
|
|
14
|
+
failed_to_load: 'failed_to_load',
|
|
15
|
+
load_failed: 'failed_to_load',
|
|
16
|
+
opened: 'opened',
|
|
17
|
+
closed: 'closed',
|
|
18
|
+
clicked: 'clicked',
|
|
19
|
+
impression: 'impression',
|
|
20
|
+
earned_reward: 'earned_reward',
|
|
21
|
+
error: 'error',
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function wrap<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
T extends {
|
|
26
|
+
adUnitId: string
|
|
27
|
+
loaded: boolean
|
|
28
|
+
load(): void
|
|
29
|
+
onAdEvent(l: any): void
|
|
30
|
+
show(o?: any): void
|
|
31
|
+
},
|
|
32
32
|
>(ad: T): LoadedAd {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
return {
|
|
34
|
+
adUnitId: ad.adUnitId,
|
|
35
|
+
get loaded() {
|
|
36
|
+
return ad.loaded
|
|
37
|
+
},
|
|
38
|
+
load: () => ad.load(),
|
|
39
|
+
onAdEvent: (listener: AdEventListener) =>
|
|
40
|
+
ad.onAdEvent((type: any, error?: any, data?: any) =>
|
|
41
|
+
listener({
|
|
42
|
+
type: (EVENT[String(type)] ?? String(type)) as any,
|
|
43
|
+
error: error instanceof Error ? error : error ? new Error(String(error)) : undefined,
|
|
44
|
+
reward: data ? { amount: data.amount ?? 0, type: data.type ?? '' } : undefined,
|
|
45
|
+
}),
|
|
46
|
+
),
|
|
47
|
+
show: (options) => ad.show(options),
|
|
48
|
+
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/** Google Mobile Ads service — see Ads for the contract. */
|
|
52
52
|
export const ads: Ads = {
|
|
53
|
-
|
|
53
|
+
supported: true,
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
await (m.initalize?.() ?? m.initialize?.())
|
|
59
|
-
},
|
|
55
|
+
async initialize(): Promise<void> {
|
|
56
|
+
// The plugin's method is spelled `initalize` upstream — try both.
|
|
57
|
+
const m = MobileAds as any
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
59
|
+
await (m.initalize?.() ?? m.initialize?.())
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
createInterstitial: (adUnitId, requestOptions) =>
|
|
63
|
+
wrap(InterstitialAd.createForAdRequest(adUnitId, requestOptions as any)),
|
|
64
|
+
createRewardedAd: (adUnitId, requestOptions) =>
|
|
65
|
+
wrap(RewardedAd.createForAdRequest(adUnitId, requestOptions as any)),
|
|
66
|
+
createRewardedInterstitialAd: (adUnitId, requestOptions) =>
|
|
67
|
+
wrap(RewardedInterstitialAd.createForAdRequest(adUnitId, requestOptions as any)),
|
|
68
|
+
// Upstream ships no AppOpenAd wrapper — the format is a documented gap,
|
|
69
|
+
// not silently aliased to interstitial.
|
|
70
|
+
createAppOpenAd: () => {
|
|
71
|
+
throw new Error('unsupported: @nativescript/google-mobile-ads has no AppOpenAd')
|
|
72
|
+
},
|
|
72
73
|
}
|
package/src/ads.web.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
import type { Ads } from './types'
|
|
4
4
|
|
|
5
5
|
const unsupported = () => {
|
|
6
|
-
|
|
6
|
+
throw new Error('unsupported: AdMob is not available on web')
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
/** Google Mobile Ads service — see Ads for the contract. */
|
|
10
10
|
export const ads: Ads = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
supported: false,
|
|
12
|
+
initialize: async () => {},
|
|
13
|
+
createInterstitial: unsupported,
|
|
14
|
+
createRewardedAd: unsupported,
|
|
15
|
+
createRewardedInterstitialAd: unsupported,
|
|
16
|
+
createAppOpenAd: unsupported,
|
|
17
17
|
}
|
package/src/native-elements.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Attributes } from '@octane-xplat/jsx/intrinsics'
|
|
2
2
|
|
|
3
3
|
declare module '@octane-xplat/jsx/intrinsics' {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
interface NativeElements<TElement> {
|
|
5
|
+
xplatbannerad: Attributes<TElement, { unitId?: string }>
|
|
6
|
+
}
|
|
7
7
|
}
|
package/src/props.ts
CHANGED
|
@@ -4,22 +4,22 @@ import type { AdEventListener, BannerAdSizeType } from './types'
|
|
|
4
4
|
* in the permissions seam; requestOptions carries request-level flags
|
|
5
5
|
* (tagForChildDirectedTreatment etc.) straight through to the SDK. */
|
|
6
6
|
export interface BannerAdProps {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
/** Class list applied to the banner container. */
|
|
8
|
+
className?: any
|
|
9
|
+
/** Inline style (string CSS or object). */
|
|
10
|
+
style?: any
|
|
11
|
+
/** Console ad-unit id for this banner slot. */
|
|
12
|
+
adUnitId: string
|
|
13
|
+
/** Banner format — 'anchoredAdaptive' resolves a device-fitting height. */
|
|
14
|
+
size?: BannerAdSizeType
|
|
15
|
+
/** Request-level flags forwarded to the ad request (e.g. test-device ids). */
|
|
16
|
+
requestOptions?: Record<string, unknown>
|
|
17
|
+
/** Lifecycle listener for this banner. */
|
|
18
|
+
onAdEvent?: AdEventListener
|
|
19
|
+
/** Platform escape hatches, applied after the shared props. */
|
|
20
|
+
ios?: Record<string, any>
|
|
21
|
+
/** Platform escape hatch — same bag contract as `ios`. */
|
|
22
|
+
android?: Record<string, any>
|
|
23
|
+
/** Platform escape hatch — same bag contract as `ios`. */
|
|
24
|
+
web?: Record<string, any>
|
|
25
25
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/** Ad lifecycle event kinds — Google Mobile Ads event vocabulary normalized
|
|
2
2
|
* to shared spellings. */
|
|
3
3
|
export type AdEventType =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
| 'loaded'
|
|
5
|
+
| 'failed_to_load'
|
|
6
|
+
| 'opened'
|
|
7
|
+
| 'closed'
|
|
8
|
+
| 'clicked'
|
|
9
|
+
| 'impression'
|
|
10
|
+
| 'earned_reward'
|
|
11
|
+
| 'error'
|
|
12
12
|
|
|
13
13
|
/** One ad lifecycle event delivered to a LoadedAd listener. */
|
|
14
14
|
export interface AdEvent {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
/** Which lifecycle transition fired. */
|
|
16
|
+
type: AdEventType
|
|
17
|
+
/** The underlying error for 'failed_to_load'/'error'. */
|
|
18
|
+
error?: Error
|
|
19
|
+
/** Earned reward payload for 'earned_reward' (rewarded formats only). */
|
|
20
|
+
reward?: { amount: number; type: string }
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/** Callback for ad lifecycle events. */
|
|
@@ -26,44 +26,44 @@ export type AdEventListener = (event: AdEvent) => void
|
|
|
26
26
|
/** Handle for a created fullscreen/rewarded ad — load() then show().
|
|
27
27
|
* Fullscreen ads are one-shot: after 'closed', create a new one. */
|
|
28
28
|
export interface LoadedAd {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
/** Console ad-unit id this ad belongs to. */
|
|
30
|
+
readonly adUnitId: string
|
|
31
|
+
/** True once 'loaded' has fired and show() can present. */
|
|
32
|
+
readonly loaded: boolean
|
|
33
|
+
/** Request the ad content. */
|
|
34
|
+
load(): void
|
|
35
|
+
/** Attach a lifecycle listener (loaded/opened/closed/…). */
|
|
36
|
+
onAdEvent(listener: AdEventListener): void
|
|
37
|
+
/** Present the ad once loaded. */
|
|
38
|
+
show(options?: Record<string, unknown>): void
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/** Banner format vocabulary — GAM/AdMob size spellings including the
|
|
42
42
|
* adaptive anchored variants that resolve to real heights per device. */
|
|
43
43
|
export type BannerAdSizeType =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
| 'banner'
|
|
45
|
+
| 'largeBanner'
|
|
46
|
+
| 'mediumRectangle'
|
|
47
|
+
| 'fullBanner'
|
|
48
|
+
| 'leaderboard'
|
|
49
|
+
| 'adaptiveBanner'
|
|
50
|
+
| 'anchoredAdaptive'
|
|
51
|
+
| 'fluid'
|
|
52
52
|
|
|
53
53
|
/** Google Mobile Ads façade; `supported` is false on non-mobile leaves. */
|
|
54
54
|
export interface Ads {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
/** Google Mobile Ads SDK exists on this leaf (false off mobile). */
|
|
56
|
+
readonly supported: boolean
|
|
57
|
+
/** Initialize the Google Mobile Ads SDK — call once at app start. */
|
|
58
|
+
initialize(): Promise<void>
|
|
59
|
+
/** Create a fullscreen interstitial ad — call load() then show() on the handle. */
|
|
60
|
+
createInterstitial(adUnitId: string, requestOptions?: Record<string, unknown>): LoadedAd
|
|
61
|
+
/** Create a rewarded video ad — call load() then show() on the handle. */
|
|
62
|
+
createRewardedAd(adUnitId: string, requestOptions?: Record<string, unknown>): LoadedAd
|
|
63
|
+
/** Create a rewarded interstitial ad — call load() then show() on the handle. */
|
|
64
|
+
createRewardedInterstitialAd(adUnitId: string, requestOptions?: Record<string, unknown>): LoadedAd
|
|
65
|
+
/** Create a app-open ad — call load() then show() on the handle. */
|
|
66
|
+
createAppOpenAd(adUnitId: string, requestOptions?: Record<string, unknown>): LoadedAd
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
export declare const ads: Ads
|
|
@@ -2,18 +2,8 @@
|
|
|
2
2
|
"version": 1,
|
|
3
3
|
"files": [
|
|
4
4
|
"BannerAd.d.ts",
|
|
5
|
-
"BannerAd.macos.d.ts",
|
|
6
|
-
"BannerAd.web.d.ts",
|
|
7
5
|
"ads.d.ts",
|
|
8
|
-
"ads.linux.d.ts",
|
|
9
|
-
"ads.macos.d.ts",
|
|
10
|
-
"ads.web.d.ts",
|
|
11
|
-
"ads.windows.d.ts",
|
|
12
6
|
"index.d.ts",
|
|
13
|
-
"index.macos.d.ts",
|
|
14
|
-
"index.web.d.ts",
|
|
15
|
-
"index.windows.d.ts",
|
|
16
|
-
"native-elements.d.ts",
|
|
17
7
|
"props.d.ts",
|
|
18
8
|
"types.d.ts"
|
|
19
9
|
]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ads } from './ads.web.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ads } from './ads.web.js';
|