react-native-google-mobile-ads 15.4.2 → 15.5.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/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsNativeModule.kt +11 -1
- package/docs/mediation.mdx +323 -0
- package/docs.json +1 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeModule.mm +22 -3
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeView.mm +1 -1
- package/lib/commonjs/NativeAdEventType.js +1 -0
- package/lib/commonjs/NativeAdEventType.js.map +1 -1
- package/lib/commonjs/ads/native-ad/NativeAd.js +3 -2
- package/lib/commonjs/ads/native-ad/NativeAd.js.map +1 -1
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsNativeModule.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/NativeAdEventType.js +1 -0
- package/lib/module/NativeAdEventType.js.map +1 -1
- package/lib/module/ads/native-ad/NativeAd.js +3 -3
- package/lib/module/ads/native-ad/NativeAd.js.map +1 -1
- package/lib/module/specs/modules/NativeGoogleMobileAdsNativeModule.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/NativeAdEventType.d.ts +4 -0
- package/lib/typescript/NativeAdEventType.d.ts.map +1 -1
- package/lib/typescript/ads/native-ad/NativeAd.d.ts +4 -2
- package/lib/typescript/ads/native-ad/NativeAd.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsNativeModule.d.ts +5 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsNativeModule.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/NativeAdEventType.ts +5 -0
- package/src/ads/native-ad/NativeAd.ts +10 -3
- package/src/specs/modules/NativeGoogleMobileAdsNativeModule.ts +6 -0
- package/src/version.ts +1 -1
package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsNativeModule.kt
CHANGED
|
@@ -184,6 +184,13 @@ class ReactNativeGoogleMobileAdsNativeModule(
|
|
|
184
184
|
.forNativeAd { nativeAd ->
|
|
185
185
|
this.nativeAd = nativeAd
|
|
186
186
|
nativeAd.mediaContent?.videoController?.videoLifecycleCallbacks = videoLifecycleCallbacks
|
|
187
|
+
nativeAd.setOnPaidEventListener { adValue ->
|
|
188
|
+
val revenueData = Arguments.createMap()
|
|
189
|
+
revenueData.putDouble("value", 1e-6 * adValue.valueMicros)
|
|
190
|
+
revenueData.putInt("precision", adValue.precisionType)
|
|
191
|
+
revenueData.putString("currency", adValue.currencyCode)
|
|
192
|
+
emitAdEvent("paid", revenueData)
|
|
193
|
+
}
|
|
187
194
|
loadedListener.onNativeAdLoaded(nativeAd)
|
|
188
195
|
}
|
|
189
196
|
.build()
|
|
@@ -196,9 +203,12 @@ class ReactNativeGoogleMobileAdsNativeModule(
|
|
|
196
203
|
nativeAd = null
|
|
197
204
|
}
|
|
198
205
|
|
|
199
|
-
private fun emitAdEvent(type: String) {
|
|
206
|
+
private fun emitAdEvent(type: String, eventData: ReadableMap? = null) {
|
|
200
207
|
val nativeAd = this.nativeAd ?: return
|
|
201
208
|
val payload = Arguments.createMap()
|
|
209
|
+
if (eventData != null) {
|
|
210
|
+
payload.merge(eventData)
|
|
211
|
+
}
|
|
202
212
|
payload.putString("responseId", nativeAd.responseInfo?.responseId)
|
|
203
213
|
payload.putString("type", type)
|
|
204
214
|
this@ReactNativeGoogleMobileAdsNativeModule.emitOnAdEvent(payload)
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# Mediation
|
|
2
|
+
|
|
3
|
+
AdMob Mediation is a feature lets you serve ads to your apps from multiple sources, including the AdMob Network and third-party ad sources, in one place.
|
|
4
|
+
AdMob Mediation helps maximize your fill rate and increase your monetization by sending ad requests to multiple networks to verify you find the best
|
|
5
|
+
available network to serve ads.
|
|
6
|
+
|
|
7
|
+
This guide walks you through configuring mediation using the `react-native-google-mobile-ads` library.
|
|
8
|
+
|
|
9
|
+
## Configure mediation in the AdMob UI
|
|
10
|
+
|
|
11
|
+
To configure mediation in the AdMob UI, complete the following steps:
|
|
12
|
+
|
|
13
|
+
1. Choose an ad source from the network details table ([Android](https://developers.google.com/admob/android/choose-networks#network_details) | [iOS](https://developers.google.com/admob/ios/choose-networks#network_details)).
|
|
14
|
+
2. Follow steps 1-2 of that ad source's integration guide.
|
|
15
|
+
|
|
16
|
+
## Install mediation adapters
|
|
17
|
+
|
|
18
|
+
For the Google Mobile Ads SDK to communicate with third-party ad networks, you need to include a mediation adapter for each network in your app. Each
|
|
19
|
+
adapter must be integrated in the Android and iOS layer of your application.
|
|
20
|
+
|
|
21
|
+
To choose the adapters you want to install, see Integrate open source and versioned adapters
|
|
22
|
+
([Android](https://developers.google.com/admob/android/choose-networks#integrate_open-source_and_versioned_adapters) | [iOS](https://developers.google.com/admob/ios/choose-networks#integrate_open-source_and_versioned_adapters)).
|
|
23
|
+
|
|
24
|
+
<Tabs groupId="framework" values={[{label: 'React Native', value: 'bare'}, {label: 'Expo', value: 'expo'}]}>
|
|
25
|
+
<TabItem value="bare">
|
|
26
|
+
|
|
27
|
+
Android
|
|
28
|
+
- Add the adapter's dependency to your app-level `android/app/build.gradle` file.
|
|
29
|
+
|
|
30
|
+
iOS
|
|
31
|
+
- Add the adapter's pod to your `ios/Podfile`.
|
|
32
|
+
|
|
33
|
+
</TabItem>
|
|
34
|
+
<TabItem value="expo">
|
|
35
|
+
|
|
36
|
+
Add native dependencies using the [`expo-build-properties`](https://docs.expo.dev/versions/latest/sdk/build-properties) plugin.
|
|
37
|
+
|
|
38
|
+
Install the plugin if you haven't already:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx expo install expo-build-properties
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Add the plugin to your `app.json` or `app.config.js` file, specifying the Android dependency or iOS pod for the adapter.
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
// app.json
|
|
48
|
+
{
|
|
49
|
+
"expo": {
|
|
50
|
+
"plugins": [
|
|
51
|
+
[
|
|
52
|
+
"expo-build-properties",
|
|
53
|
+
{
|
|
54
|
+
"android": {
|
|
55
|
+
"dependencies": [
|
|
56
|
+
// Example: Add the AppLovin mediation adapter for Android. Replace {X.Y.Z.A} with the specific adapter version you are integrating.
|
|
57
|
+
"com.google.ads.mediation:applovin:{X.Y.Z.A}"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"ios": {
|
|
61
|
+
"pods": [
|
|
62
|
+
{
|
|
63
|
+
// Example: Add the AppLovin mediation adapter for iOS.
|
|
64
|
+
"name": "GoogleMobileAdsMediationAppLovin"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Rebuild your development client to include the new native dependencies:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npx expo prebuild --clean
|
|
79
|
+
npx expo run:android
|
|
80
|
+
npx expo run:ios
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
</TabItem>
|
|
84
|
+
</Tabs>
|
|
85
|
+
|
|
86
|
+
## Verify your setup with ad inspector
|
|
87
|
+
|
|
88
|
+
To open the ad inspector from your React Native application, see [Ad inspector](https://docs.page/invertase/react-native-google-mobile-ads/ad-inspector) in the
|
|
89
|
+
`react-native-google-mobile-ads` documentation.
|
|
90
|
+
|
|
91
|
+
## Call Android / iOS code from React Native
|
|
92
|
+
|
|
93
|
+
A third-party mediation adapter might have specific Android or iOS APIs that aren't exposed to your Reach Native code. In these cases, you can create a custom "bridge" to expose that native functionality.
|
|
94
|
+
|
|
95
|
+
<Tabs groupId="framework" values={[{label: 'React Native', value: 'bare'}, {label: 'Expo', value: 'expo'}]}>
|
|
96
|
+
<TabItem value="bare">
|
|
97
|
+
|
|
98
|
+
This involves writing native code in both the Android and iOS layer.
|
|
99
|
+
|
|
100
|
+
**Android**
|
|
101
|
+
|
|
102
|
+
Create a `Module` class to contain your native logic and a `Package` class to register that module with your application.
|
|
103
|
+
|
|
104
|
+
1. Create the native module. This class contains the methods you want to call from JavaScript.
|
|
105
|
+
|
|
106
|
+
Example file: `android/app/src/main/java/com/your-app-name/`
|
|
107
|
+
|
|
108
|
+
The following example creates a **Module** class to use with the Google Mobile Ads mediation adapter for AppLovin:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
package com.your-app-name
|
|
112
|
+
|
|
113
|
+
import android.util.Log
|
|
114
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
115
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
116
|
+
import com.facebook.react.bridge.ReactMethod
|
|
117
|
+
// Import the necessary third-party SDKs.
|
|
118
|
+
import com.applovin.sdk.AppLovinPrivacySettings
|
|
119
|
+
|
|
120
|
+
class GoogleMobileAdsMediationAppLovinModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
121
|
+
|
|
122
|
+
// The React layer interfaces with the value of this API.
|
|
123
|
+
override fun getName() = "GoogleMobileAdsMediationAppLovin"
|
|
124
|
+
|
|
125
|
+
// This exposes the method to the React layer.
|
|
126
|
+
@ReactMethod
|
|
127
|
+
fun setHasUserConsent(hasUserConsent: Boolean) {
|
|
128
|
+
AppLovinPrivacySettings.setHasUserConsent(hasUserConsent)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
2. Create the package
|
|
134
|
+
|
|
135
|
+
This class registers your module so React Native can find it.
|
|
136
|
+
|
|
137
|
+
Example file: `android/app/src/main/java/com/your-app-name/`
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
package com.your-app-name
|
|
141
|
+
|
|
142
|
+
import com.facebook.react.ReactPackage
|
|
143
|
+
import com.facebook.react.bridge.NativeModule
|
|
144
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
145
|
+
import com.facebook.react.uimanager.ViewManager
|
|
146
|
+
import java.util.Collections
|
|
147
|
+
|
|
148
|
+
class GoogleMobileAdsMediationAppLovinPackage : ReactPackage {
|
|
149
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
150
|
+
return listOf(GoogleMobileAdsMediationAppLovinModule(reactContext))
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
154
|
+
return Collections.emptyList()
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
3. Register the package
|
|
160
|
+
|
|
161
|
+
Add your new package in your `MainApplication` file:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
override fun getPackages(): List<ReactPackage> =
|
|
165
|
+
PackageList(this).packages.apply {
|
|
166
|
+
// Add your custom package here.
|
|
167
|
+
add(GoogleMobileAdsMediationAppLovinPackage())
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**iOS**
|
|
172
|
+
|
|
173
|
+
Create a header (`.h`) and an implementation (`.m`) file. The following example creates an `GoogleMobileAdsMediationAppLovin` class:
|
|
174
|
+
|
|
175
|
+
Example file: `ios/GoogleMobileAdsMediationAppLovin.h`
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
#import <React/RCTBridgeModule.h>
|
|
179
|
+
|
|
180
|
+
@interface GoogleMobileAdsMediationAppLovin : NSObject <RCTBridgeModule>
|
|
181
|
+
@end
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Example file: `ios/GoogleMobileAdsMediationAppLovin.m`
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
#import "GoogleMobileAdsMediationAppLovin.h"
|
|
188
|
+
#import <Foundation/Foundation.h>
|
|
189
|
+
// Import the necessary third-party SDKs.
|
|
190
|
+
#import <AppLovinSDK/AppLovinSDK.h>
|
|
191
|
+
|
|
192
|
+
@implementation GoogleMobileAdsMediationAppLovin
|
|
193
|
+
|
|
194
|
+
// The React layer interfaces with the class name, e.g. GoogleMobileAdsMediationAppLovin, by default.
|
|
195
|
+
RCT_EXPORT_MODULE();
|
|
196
|
+
|
|
197
|
+
// This exports the method to the React layer.
|
|
198
|
+
RCT_EXPORT_METHOD(setHasUserConsent:(BOOL)hasUserConsent)
|
|
199
|
+
{
|
|
200
|
+
[ALPrivacySettings setHasUserConsent:hasUserConsent];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@end
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Import native modules**
|
|
207
|
+
|
|
208
|
+
In the JavaScript file where you want to call the native method, import `NativeModules` from the `react-native` library:
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
import { NativeModules } from 'react-native'
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
You can then access your module directly from the `NativeModules` object. The name you use here must exactly match the name
|
|
215
|
+
exposed by your native code.
|
|
216
|
+
|
|
217
|
+
The following example uses the `GoogleMobileAdsMediationAppLovin` sample class:
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
const { GoogleMobileAdsMediationAppLovin } = NativeModules
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Once you have the module object, you can work with your object just as you would in Javascript.
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
GoogleMobileAdsMediationAppLovin.setHasUserConsent(true)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
</TabItem>
|
|
230
|
+
<TabItem value="expo">
|
|
231
|
+
|
|
232
|
+
1. **Create an [Expo module](https://docs.expo.dev/modules/get-started/)** with the `create-expo-module` tool.
|
|
233
|
+
|
|
234
|
+
Run the following command from your project's root directory:
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
npx create-expo-module --local
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
When prompted, give your module a name. This will scaffold a new module in a modules/ directory at your project root.
|
|
241
|
+
|
|
242
|
+
2. **Add your native Android and iOS code**. The following example creates a module to use with the
|
|
243
|
+
Google Mobile Ads mediation adapter for AppLovin:
|
|
244
|
+
|
|
245
|
+
Android
|
|
246
|
+
|
|
247
|
+
Open the generated Kotlin file for your module and add your custom method. The module and package are already set up for you.
|
|
248
|
+
|
|
249
|
+
File: `modules/google-mobile-ads-mediation-applovin/android/src/main/java/.../GoogleMobileAdsMediationApplovinModule.kt`
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
// ... existing imports
|
|
253
|
+
import com.applovin.sdk.AppLovinPrivacySettings
|
|
254
|
+
|
|
255
|
+
class GoogleMobileAdsMediationApplovinModule : Module() {
|
|
256
|
+
override fun definition() = ModuleDefinition {
|
|
257
|
+
// ... existing definition
|
|
258
|
+
|
|
259
|
+
// Add your custom method here.
|
|
260
|
+
Function("setHasUserConsent") { hasUserConsent: Boolean ->
|
|
261
|
+
AppLovinPrivacySettings.setHasUserConsent(hasUserConsent)
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Then, add the dependency in your module's `build.gradle` file.
|
|
268
|
+
|
|
269
|
+
File: `modules/google-mobile-ads-mediation-applovin/android/build.gradle`
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
// Groovy
|
|
273
|
+
|
|
274
|
+
dependencies {
|
|
275
|
+
// Add the third-party SDK dependency. Replace {X.Y.Z.A} with the specific adapter version you are integrating.
|
|
276
|
+
implementation 'com.google.ads.mediation:applovin:{X.Y.Z.A}'
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
iOS
|
|
281
|
+
|
|
282
|
+
Open the generated Swift file for your module and add your custom method.
|
|
283
|
+
|
|
284
|
+
File: `modules/google-mobile-ads-mediation-applovin/ios/GoogleMobileAdsMediationApplovinModule.swift`
|
|
285
|
+
|
|
286
|
+
```
|
|
287
|
+
// ... existing imports
|
|
288
|
+
import AppLovinSDK
|
|
289
|
+
|
|
290
|
+
public class GoogleMobileAdsMediationApplovinModule: Module {
|
|
291
|
+
public func definition() -> ModuleDefinition {
|
|
292
|
+
// ... existing definition
|
|
293
|
+
|
|
294
|
+
// Add your custom method here
|
|
295
|
+
Function("setHasUserConsent") { (hasUserConsent: Bool) in
|
|
296
|
+
ALPrivacySettings.setHasUserConsent(hasUserConsent)
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Next, add the dependency in your module's `.podspec` file.
|
|
303
|
+
|
|
304
|
+
File: `modules/google-mobile-ads-mediation-applovin/google-mobile-ads-mediation-applovin.podspec`
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
# Add the third-party pod dependency.
|
|
308
|
+
s.dependency 'GoogleMobileAdsMediationAppLovin'
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
3. **Install and rebuild**. After creating the module and adding the code, install it in your project and rebuild your development client.
|
|
312
|
+
|
|
313
|
+
4. **Call the code from JavaScript**. You can now import and use the module directly in your code.
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
import { setHasUserConsent } from 'google-mobile-ads-mediation-applovin'
|
|
317
|
+
|
|
318
|
+
// Call your custom native method.
|
|
319
|
+
setHasUserConsent(true)
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
</TabItem>
|
|
323
|
+
</Tabs>
|
package/docs.json
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"Advanced Usage",
|
|
17
17
|
[
|
|
18
18
|
["Displaying Ads via Hook", "/displaying-ads-hook"],
|
|
19
|
+
["Mediation", "/mediation"],
|
|
19
20
|
["European User Consent", "/european-user-consent"],
|
|
20
21
|
["Ad Inspector", "/ad-inspector"],
|
|
21
22
|
["Impression-level ad revenue", "/impression-level-ad-revenue"],
|
|
@@ -213,6 +213,14 @@ RCT_EXPORT_METHOD(destroy
|
|
|
213
213
|
didReceiveNativeAd:(nonnull GADNativeAd *)nativeAd {
|
|
214
214
|
_nativeAd = nativeAd;
|
|
215
215
|
_nativeAd.delegate = self;
|
|
216
|
+
_nativeAd.paidEventHandler = ^(GADAdValue *_Nonnull adValue) {
|
|
217
|
+
NSDictionary *revenueData = @{
|
|
218
|
+
@"value" : adValue.value,
|
|
219
|
+
@"precision" : @(adValue.precision),
|
|
220
|
+
@"currency" : adValue.currencyCode ?: @""
|
|
221
|
+
};
|
|
222
|
+
[self emitAdEvent:@"paid" withData:revenueData];
|
|
223
|
+
};
|
|
216
224
|
if (nativeAd.mediaContent.hasVideoContent) {
|
|
217
225
|
nativeAd.mediaContent.videoController.delegate = self;
|
|
218
226
|
}
|
|
@@ -272,12 +280,19 @@ RCT_EXPORT_METHOD(destroy
|
|
|
272
280
|
[self emitAdEvent:@"video_unmuted"];
|
|
273
281
|
}
|
|
274
282
|
|
|
275
|
-
- (void)emitAdEvent:(NSString *)type {
|
|
283
|
+
- (void)emitAdEvent:(NSString *)type withData:(NSDictionary *)data {
|
|
276
284
|
if (_nativeModule == nil || _nativeAd == nil) {
|
|
277
285
|
return;
|
|
278
286
|
}
|
|
279
|
-
|
|
280
|
-
|
|
287
|
+
|
|
288
|
+
NSMutableDictionary *payload = [NSMutableDictionary dictionary];
|
|
289
|
+
if (data != nil) {
|
|
290
|
+
[payload addEntriesFromDictionary:data];
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
payload[@"responseId"] = _nativeAd.responseInfo.responseIdentifier;
|
|
294
|
+
payload[@"type"] = type;
|
|
295
|
+
|
|
281
296
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
282
297
|
[_nativeModule emitOnAdEvent:payload];
|
|
283
298
|
#else
|
|
@@ -285,6 +300,10 @@ RCT_EXPORT_METHOD(destroy
|
|
|
285
300
|
#endif
|
|
286
301
|
}
|
|
287
302
|
|
|
303
|
+
- (void)emitAdEvent:(NSString *)type {
|
|
304
|
+
[self emitAdEvent:type withData:nil];
|
|
305
|
+
}
|
|
306
|
+
|
|
288
307
|
@end
|
|
289
308
|
|
|
290
309
|
#endif
|
|
@@ -52,7 +52,7 @@ using namespace facebook::react;
|
|
|
52
52
|
|
|
53
53
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
54
54
|
if (self = [super initWithFrame:frame]) {
|
|
55
|
-
static const auto defaultProps = std::make_shared<const
|
|
55
|
+
static const auto defaultProps = std::make_shared<const RNGoogleMobileAdsNativeViewProps>();
|
|
56
56
|
_props = defaultProps;
|
|
57
57
|
|
|
58
58
|
_bridge = [RCTBridge currentBridge];
|
|
@@ -9,6 +9,7 @@ let NativeAdEventType = exports.NativeAdEventType = /*#__PURE__*/function (Nativ
|
|
|
9
9
|
NativeAdEventType["CLICKED"] = "clicked";
|
|
10
10
|
NativeAdEventType["OPENED"] = "opened";
|
|
11
11
|
NativeAdEventType["CLOSED"] = "closed";
|
|
12
|
+
NativeAdEventType["PAID"] = "paid";
|
|
12
13
|
NativeAdEventType["VIDEO_PLAYED"] = "video_played";
|
|
13
14
|
NativeAdEventType["VIDEO_PAUSED"] = "video_paused";
|
|
14
15
|
NativeAdEventType["VIDEO_ENDED"] = "video_ended";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeAdEventType","exports"],"sourceRoot":"../../src","sources":["NativeAdEventType.ts"],"mappings":";;;;;;IAAYA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["NativeAdEventType","exports"],"sourceRoot":"../../src","sources":["NativeAdEventType.ts"],"mappings":";;;;;;IAAYA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
@@ -61,12 +61,13 @@ class NativeAd {
|
|
|
61
61
|
}
|
|
62
62
|
onNativeAdEvent({
|
|
63
63
|
responseId,
|
|
64
|
-
type
|
|
64
|
+
type,
|
|
65
|
+
...data
|
|
65
66
|
}) {
|
|
66
67
|
if (this.responseId !== responseId) {
|
|
67
68
|
return;
|
|
68
69
|
}
|
|
69
|
-
this.eventEmitter.emit(type);
|
|
70
|
+
this.eventEmitter.emit(type, data);
|
|
70
71
|
}
|
|
71
72
|
addAdEventListener(type, listener) {
|
|
72
73
|
if (!(0, _common.isOneOf)(type, Object.values(_NativeAdEventType.NativeAdEventType))) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_EventEmitter","_interopRequireDefault","_NativeAdEventType","_common","_NativeGoogleMobileAdsNativeModule","_validateNativeAdRequestOptions","e","__esModule","default","NativeAd","constructor","adUnitId","props","responseId","advertiser","body","callToAction","headline","price","store","starRating","icon","images","mediaContent","extras","NativeGoogleMobileAdsNativeModule","nativeEventSubscription","onAdEvent","onNativeAdEvent","bind","eventEmitter","Platform","OS","NativeEventEmitter","addListener","EventEmitter","type","emit","addAdEventListener","listener","isOneOf","Object","values","NativeAdEventType","Error","isFunction","removeAllAdEventListeners","removeAllListeners","destroy","remove","createForAdRequest","requestOptions","isString","options","validateNativeAdRequestOptions","message","load","exports"],"sourceRoot":"../../../../src","sources":["ads/native-ad/NativeAd.ts"],"mappings":";;;;;;AAiBA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,kCAAA,GAAAH,sBAAA,CAAAF,OAAA;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_EventEmitter","_interopRequireDefault","_NativeAdEventType","_common","_NativeGoogleMobileAdsNativeModule","_validateNativeAdRequestOptions","e","__esModule","default","NativeAd","constructor","adUnitId","props","responseId","advertiser","body","callToAction","headline","price","store","starRating","icon","images","mediaContent","extras","NativeGoogleMobileAdsNativeModule","nativeEventSubscription","onAdEvent","onNativeAdEvent","bind","eventEmitter","Platform","OS","NativeEventEmitter","addListener","EventEmitter","type","data","emit","addAdEventListener","listener","isOneOf","Object","values","NativeAdEventType","Error","isFunction","removeAllAdEventListeners","removeAllListeners","destroy","remove","createForAdRequest","requestOptions","isString","options","validateNativeAdRequestOptions","message","load","exports"],"sourceRoot":"../../../../src","sources":["ads/native-ad/NativeAd.ts"],"mappings":";;;;;;AAiBA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,kCAAA,GAAAH,sBAAA,CAAAF,OAAA;AAQA,IAAAM,+BAAA,GAAAN,OAAA;AAAsF,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA9BtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACO,MAAMG,QAAQ,CAAC;EAkBZC,WAAWA,CAACC,QAAgB,EAAEC,KAAoB,EAAE;IAC1D,IAAI,CAACD,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACE,UAAU,GAAGD,KAAK,CAACC,UAAU;IAClC,IAAI,CAACC,UAAU,GAAGF,KAAK,CAACE,UAAU;IAClC,IAAI,CAACC,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AAG,MAAMa,0CAAiC,CAACgC,IAAI,CAAC9C,QAAQ,EAAE2C,OAAO,CAAC;IAE7E,OAAO,IAAI7C,QAAQ,CAACE,QAAQ,EAAEC,KAAK,CAAC;EACtC;AACF;AAAC8C,OAAA,CAAAjD,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../../src","sources":["specs/modules/NativeGoogleMobileAdsNativeModule.ts"],"mappings":";;;;;;AAkBA,IAAAA,YAAA,GAAAC,OAAA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../../src","sources":["specs/modules/NativeGoogleMobileAdsNativeModule.ts"],"mappings":";;;;;;AAkBA,IAAAA,YAAA,GAAAC,OAAA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAqEeC,gCAAmB,CAACC,YAAY,CAAO,+BAA+B,CAAC","ignoreList":[]}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -3,6 +3,7 @@ export let NativeAdEventType = /*#__PURE__*/function (NativeAdEventType) {
|
|
|
3
3
|
NativeAdEventType["CLICKED"] = "clicked";
|
|
4
4
|
NativeAdEventType["OPENED"] = "opened";
|
|
5
5
|
NativeAdEventType["CLOSED"] = "closed";
|
|
6
|
+
NativeAdEventType["PAID"] = "paid";
|
|
6
7
|
NativeAdEventType["VIDEO_PLAYED"] = "video_played";
|
|
7
8
|
NativeAdEventType["VIDEO_PAUSED"] = "video_paused";
|
|
8
9
|
NativeAdEventType["VIDEO_ENDED"] = "video_ended";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeAdEventType"],"sourceRoot":"../../src","sources":["NativeAdEventType.ts"],"mappings":"AAAA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["NativeAdEventType"],"sourceRoot":"../../src","sources":["NativeAdEventType.ts"],"mappings":"AAAA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
@@ -21,7 +21,6 @@ import { NativeAdEventType } from '../../NativeAdEventType';
|
|
|
21
21
|
import { isFunction, isOneOf, isString } from '../../common';
|
|
22
22
|
import NativeGoogleMobileAdsNativeModule from '../../specs/modules/NativeGoogleMobileAdsNativeModule';
|
|
23
23
|
import { validateNativeAdRequestOptions } from '../../validateNativeAdRequestOptions';
|
|
24
|
-
|
|
25
24
|
/**
|
|
26
25
|
* A class for loading Native Ads.
|
|
27
26
|
*/
|
|
@@ -55,12 +54,13 @@ export class NativeAd {
|
|
|
55
54
|
}
|
|
56
55
|
onNativeAdEvent({
|
|
57
56
|
responseId,
|
|
58
|
-
type
|
|
57
|
+
type,
|
|
58
|
+
...data
|
|
59
59
|
}) {
|
|
60
60
|
if (this.responseId !== responseId) {
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
|
-
this.eventEmitter.emit(type);
|
|
63
|
+
this.eventEmitter.emit(type, data);
|
|
64
64
|
}
|
|
65
65
|
addAdEventListener(type, listener) {
|
|
66
66
|
if (!isOneOf(type, Object.values(NativeAdEventType))) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","Platform","EventEmitter","NativeAdEventType","isFunction","isOneOf","isString","NativeGoogleMobileAdsNativeModule","validateNativeAdRequestOptions","NativeAd","constructor","adUnitId","props","responseId","advertiser","body","callToAction","headline","price","store","starRating","icon","images","mediaContent","extras","nativeEventSubscription","onAdEvent","onNativeAdEvent","bind","eventEmitter","OS","addListener","type","emit","addAdEventListener","listener","Object","values","Error","removeAllAdEventListeners","removeAllListeners","destroy","remove","createForAdRequest","requestOptions","options","e","message","load"],"sourceRoot":"../../../../src","sources":["ads/native-ad/NativeAd.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAA4BA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAC9E,OAAOC,YAAY,MAAM,oDAAoD;AAE7E,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,cAAc;AAC5D,OAAOC,iCAAiC,
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","Platform","EventEmitter","NativeAdEventType","isFunction","isOneOf","isString","NativeGoogleMobileAdsNativeModule","validateNativeAdRequestOptions","NativeAd","constructor","adUnitId","props","responseId","advertiser","body","callToAction","headline","price","store","starRating","icon","images","mediaContent","extras","nativeEventSubscription","onAdEvent","onNativeAdEvent","bind","eventEmitter","OS","addListener","type","data","emit","addAdEventListener","listener","Object","values","Error","removeAllAdEventListeners","removeAllListeners","destroy","remove","createForAdRequest","requestOptions","options","e","message","load"],"sourceRoot":"../../../../src","sources":["ads/native-ad/NativeAd.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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B,CAAC,CAAC;EAClC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,aAAaI,kBAAkBA,CAC7BjC,QAAgB,EAChBkC,cAAuC,EACpB;IACnB,IAAI,CAACvC,QAAQ,CAACK,QAAQ,CAAC,EAAE;MACvB,MAAM,IAAI4B,KAAK,CAAC,qEAAqE,CAAC;IACxF;IAEA,IAAIO,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI;MACFA,OAAO,GAAGtC,8BAA8B,CAACqC,cAAc,CAAC;IAC1D,CAAC,CAAC,OAAOE,CAAC,EAAE;MACV,IAAIA,CAAC,YAAYR,KAAK,EAAE;QACtB,MAAM,IAAIA,KAAK,CAAC,qCAAqCQ,CAAC,CAACC,OAAO,GAAG,CAAC;MACpE;IACF;IAEA,MAAMpC,KAAK,GAAG,MAAML,iCAAiC,CAAC0C,IAAI,CAACtC,QAAQ,EAAEmC,OAAO,CAAC;IAE7E,OAAO,IAAIrC,QAAQ,CAACE,QAAQ,EAAEC,KAAK,CAAC;EACtC;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../../src","sources":["specs/modules/NativeGoogleMobileAdsNativeModule.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../../src","sources":["specs/modules/NativeGoogleMobileAdsNativeModule.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,mBAAmB,QAAQ,cAAc;AAmDlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,+BAA+B,CAAC","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -15,6 +15,10 @@ export declare enum NativeAdEventType {
|
|
|
15
15
|
* Called when the user is about to return to the application after clicking on an ad.
|
|
16
16
|
*/
|
|
17
17
|
CLOSED = "closed",
|
|
18
|
+
/**
|
|
19
|
+
* Called when an ad is estimated to have earned money.
|
|
20
|
+
*/
|
|
21
|
+
PAID = "paid",
|
|
18
22
|
/**
|
|
19
23
|
* Called when the video controller has begun or resumed playing a video
|
|
20
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeAdEventType.d.ts","sourceRoot":"","sources":["../../src/NativeAdEventType.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B;;OAEG;IACH,UAAU,eAAe;IAEzB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,YAAY,iBAAiB;IAE7B;;OAEG;IACH,YAAY,iBAAiB;IAE7B;;OAEG;IACH,WAAW,gBAAgB;IAE3B;;OAEG;IACH,WAAW,gBAAgB;IAE3B;;OAEG;IACH,aAAa,kBAAkB;CAChC"}
|
|
1
|
+
{"version":3,"file":"NativeAdEventType.d.ts","sourceRoot":"","sources":["../../src/NativeAdEventType.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B;;OAEG;IACH,UAAU,eAAe;IAEzB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,YAAY,iBAAiB;IAE7B;;OAEG;IACH,YAAY,iBAAiB;IAE7B;;OAEG;IACH,WAAW,gBAAgB;IAE3B;;OAEG;IACH,WAAW,gBAAgB;IAE3B;;OAEG;IACH,aAAa,kBAAkB;CAChC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NativeAdEventType } from '../../NativeAdEventType';
|
|
2
|
-
import { NativeAdImage, NativeMediaContent } from '../../specs/modules/NativeGoogleMobileAdsNativeModule';
|
|
2
|
+
import { NativeAdImage, NativeAdPaidEventPayload, NativeMediaContent } from '../../specs/modules/NativeGoogleMobileAdsNativeModule';
|
|
3
3
|
import { NativeAdRequestOptions } from '../../types';
|
|
4
|
+
type NativeAdListenerPayload<EventType extends NativeAdEventType> = EventType extends NativeAdEventType.PAID ? NativeAdPaidEventPayload : never;
|
|
4
5
|
/**
|
|
5
6
|
* A class for loading Native Ads.
|
|
6
7
|
*/
|
|
@@ -22,7 +23,7 @@ export declare class NativeAd {
|
|
|
22
23
|
private eventEmitter;
|
|
23
24
|
private constructor();
|
|
24
25
|
private onNativeAdEvent;
|
|
25
|
-
addAdEventListener(type:
|
|
26
|
+
addAdEventListener<EventType extends NativeAdEventType>(type: EventType, listener: (payload: NativeAdListenerPayload<EventType>) => void): import("react-native").EmitterSubscription;
|
|
26
27
|
removeAllAdEventListeners(): void;
|
|
27
28
|
destroy(): void;
|
|
28
29
|
/**
|
|
@@ -43,4 +44,5 @@ export declare class NativeAd {
|
|
|
43
44
|
*/
|
|
44
45
|
static createForAdRequest(adUnitId: string, requestOptions?: NativeAdRequestOptions): Promise<NativeAd>;
|
|
45
46
|
}
|
|
47
|
+
export {};
|
|
46
48
|
//# sourceMappingURL=NativeAd.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeAd.d.ts","sourceRoot":"","sources":["../../../../src/ads/native-ad/NativeAd.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAA0C,EAExC,aAAa,
|
|
1
|
+
{"version":3,"file":"NativeAd.d.ts","sourceRoot":"","sources":["../../../../src/ads/native-ad/NativeAd.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAA0C,EAExC,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AYjE,yBAAyB;IAIzB,OAAO;IAMP;;;;;;;;;;;;;;;OAeG;WACU,kBAAkB,CAC7B,QAAQ,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,sBAAsB,GACtC,OAAO,CAAC,QAAQ,CAAC;CAkBrB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "15.
|
|
1
|
+
export declare const SDK_VERSION = "15.5.0";
|
|
2
2
|
export { default, MobileAds } from './MobileAds';
|
|
3
3
|
export { AdsConsentDebugGeography, AdsConsentInfo, AdsConsentInfoOptions, AdsConsentInterface, AdsConsentPrivacyOptionsRequirementStatus, AdsConsentStatus, AdsConsentUserChoices, } from './specs/modules/NativeConsentModule';
|
|
4
4
|
export { AdsConsentPurposes } from './AdsConsentPurposes';
|
|
@@ -27,6 +27,11 @@ export type NativeAdEventPayload = {
|
|
|
27
27
|
responseId: string;
|
|
28
28
|
type: string;
|
|
29
29
|
};
|
|
30
|
+
export type NativeAdPaidEventPayload = {
|
|
31
|
+
value: number;
|
|
32
|
+
precision: number;
|
|
33
|
+
currencyCode: string;
|
|
34
|
+
};
|
|
30
35
|
export interface Spec extends TurboModule {
|
|
31
36
|
load(adUnitId: string, requestOptions: UnsafeObject): Promise<NativeAdProps>;
|
|
32
37
|
destroy(responseId: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeGoogleMobileAdsNativeModule.d.ts","sourceRoot":"","sources":["../../../../src/specs/modules/NativeGoogleMobileAdsNativeModule.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EACV,MAAM,EACN,KAAK,EACL,YAAY,EACZ,YAAY,EACb,MAAM,2CAA2C,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IACpC,YAAY,EAAE,kBAAkB,CAAC;IACjC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,KAAK,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7E,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;CACxD;;AAED,wBAAuF"}
|
|
1
|
+
{"version":3,"file":"NativeGoogleMobileAdsNativeModule.d.ts","sourceRoot":"","sources":["../../../../src/specs/modules/NativeGoogleMobileAdsNativeModule.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EACV,MAAM,EACN,KAAK,EACL,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AAQ,CAAC,SAAS,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;CACxD;;AAED,wBAAuF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "15.
|
|
1
|
+
export declare const version = "15.5.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-google-mobile-ads",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.5.0",
|
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
|
5
5
|
"description": "React Native Google Mobile Ads is an easy way to monetize mobile apps with targeted, in-app advertising.",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
package/src/NativeAdEventType.ts
CHANGED
|
@@ -23,12 +23,16 @@ import { isFunction, isOneOf, isString } from '../../common';
|
|
|
23
23
|
import NativeGoogleMobileAdsNativeModule, {
|
|
24
24
|
NativeAdEventPayload,
|
|
25
25
|
NativeAdImage,
|
|
26
|
+
NativeAdPaidEventPayload,
|
|
26
27
|
NativeAdProps,
|
|
27
28
|
NativeMediaContent,
|
|
28
29
|
} from '../../specs/modules/NativeGoogleMobileAdsNativeModule';
|
|
29
30
|
import { NativeAdRequestOptions } from '../../types';
|
|
30
31
|
import { validateNativeAdRequestOptions } from '../../validateNativeAdRequestOptions';
|
|
31
32
|
|
|
33
|
+
type NativeAdListenerPayload<EventType extends NativeAdEventType> =
|
|
34
|
+
EventType extends NativeAdEventType.PAID ? NativeAdPaidEventPayload : never;
|
|
35
|
+
|
|
32
36
|
/**
|
|
33
37
|
* A class for loading Native Ads.
|
|
34
38
|
*/
|
|
@@ -84,14 +88,17 @@ export class NativeAd {
|
|
|
84
88
|
this.eventEmitter = new EventEmitter();
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
private onNativeAdEvent({ responseId, type }: NativeAdEventPayload) {
|
|
91
|
+
private onNativeAdEvent({ responseId, type, ...data }: NativeAdEventPayload) {
|
|
88
92
|
if (this.responseId !== responseId) {
|
|
89
93
|
return;
|
|
90
94
|
}
|
|
91
|
-
this.eventEmitter.emit(type);
|
|
95
|
+
this.eventEmitter.emit(type, data);
|
|
92
96
|
}
|
|
93
97
|
|
|
94
|
-
addAdEventListener
|
|
98
|
+
addAdEventListener<EventType extends NativeAdEventType>(
|
|
99
|
+
type: EventType,
|
|
100
|
+
listener: (payload: NativeAdListenerPayload<EventType>) => void,
|
|
101
|
+
) {
|
|
95
102
|
if (!isOneOf(type, Object.values(NativeAdEventType))) {
|
|
96
103
|
throw new Error(`NativeAd.addAdEventListener(*) 'type' expected a valid event type value.`);
|
|
97
104
|
}
|
|
@@ -55,6 +55,12 @@ export type NativeAdEventPayload = {
|
|
|
55
55
|
type: string;
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
+
export type NativeAdPaidEventPayload = {
|
|
59
|
+
value: number;
|
|
60
|
+
precision: number;
|
|
61
|
+
currencyCode: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
58
64
|
export interface Spec extends TurboModule {
|
|
59
65
|
load(adUnitId: string, requestOptions: UnsafeObject): Promise<NativeAdProps>;
|
|
60
66
|
destroy(responseId: string): void;
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '15.
|
|
2
|
+
export const version = '15.5.0';
|