react-native-google-mobile-ads 4.1.0 → 4.2.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.
Files changed (32) hide show
  1. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsAppOpenModule.java +2 -5
  2. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsCommon.java +13 -2
  3. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsInterstitialModule.java +6 -5
  4. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsRewardedModule.java +3 -4
  5. package/docs/common-reasons-for-ads-not-showing.mdx +92 -0
  6. package/docs/index.mdx +1 -1
  7. package/docs.json +2 -1
  8. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m +1 -2
  9. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +1 -1
  10. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.m +6 -2
  11. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m +1 -2
  12. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.m +1 -2
  13. package/lib/commonjs/AdsConsent.js +1 -1
  14. package/lib/commonjs/AdsConsent.js.map +1 -1
  15. package/lib/commonjs/validateAdRequestOptions.js +8 -0
  16. package/lib/commonjs/validateAdRequestOptions.js.map +1 -1
  17. package/lib/commonjs/version.js +1 -1
  18. package/lib/commonjs/version.js.map +1 -1
  19. package/lib/module/AdsConsent.js +1 -1
  20. package/lib/module/AdsConsent.js.map +1 -1
  21. package/lib/module/validateAdRequestOptions.js +8 -0
  22. package/lib/module/validateAdRequestOptions.js.map +1 -1
  23. package/lib/module/version.js +1 -1
  24. package/lib/module/version.js.map +1 -1
  25. package/lib/typescript/index.d.ts +1 -1
  26. package/lib/typescript/types/RequestOptions.d.ts +8 -0
  27. package/lib/typescript/version.d.ts +1 -1
  28. package/package.json +1 -1
  29. package/src/AdsConsent.ts +1 -1
  30. package/src/types/RequestOptions.ts +7 -0
  31. package/src/validateAdRequestOptions.ts +7 -0
  32. package/src/version.ts +1 -1
@@ -17,6 +17,7 @@ package io.invertase.googlemobileads;
17
17
  *
18
18
  */
19
19
 
20
+ import static io.invertase.googlemobileads.ReactNativeGoogleMobileAdsCommon.buildAdRequest;
20
21
  import static io.invertase.googlemobileads.ReactNativeGoogleMobileAdsCommon.getCodeAndMessageFromAdError;
21
22
  import static io.invertase.googlemobileads.ReactNativeGoogleMobileAdsCommon.sendAdEvent;
22
23
  import static io.invertase.googlemobileads.ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_APP_OPEN;
@@ -34,7 +35,6 @@ import com.facebook.react.bridge.ReactApplicationContext;
34
35
  import com.facebook.react.bridge.ReactMethod;
35
36
  import com.facebook.react.bridge.ReadableMap;
36
37
  import com.facebook.react.bridge.WritableMap;
37
- import com.google.android.gms.ads.AdRequest;
38
38
  import com.google.android.gms.ads.FullScreenContentCallback;
39
39
  import com.google.android.gms.ads.LoadAdError;
40
40
  import com.google.android.gms.ads.appopen.AppOpenAd;
@@ -67,9 +67,6 @@ public class ReactNativeGoogleMobileAdsAppOpenModule extends ReactNativeModule {
67
67
  }
68
68
  currentActivity.runOnUiThread(
69
69
  () -> {
70
- AdRequest.Builder adRequestBuilder = new AdRequest.Builder();
71
- AdRequest adRequest = adRequestBuilder.build();
72
-
73
70
  AppOpenAd.AppOpenAdLoadCallback appOpenAdLoadCallback =
74
71
  new AppOpenAd.AppOpenAdLoadCallback() {
75
72
 
@@ -115,7 +112,7 @@ public class ReactNativeGoogleMobileAdsAppOpenModule extends ReactNativeModule {
115
112
  AppOpenAd.load(
116
113
  currentActivity,
117
114
  adUnitId,
118
- adRequest,
115
+ buildAdRequest(adRequestOptions),
119
116
  AppOpenAd.APP_OPEN_AD_ORIENTATION_PORTRAIT,
120
117
  appOpenAdLoadCallback);
121
118
  });
@@ -31,6 +31,7 @@ import com.google.ads.mediation.admob.AdMobAdapter;
31
31
  import com.google.android.gms.ads.AdError;
32
32
  import com.google.android.gms.ads.AdRequest;
33
33
  import com.google.android.gms.ads.AdSize;
34
+ import com.google.android.gms.ads.admanager.AdManagerAdRequest;
34
35
  import io.invertase.googlemobileads.common.ReactNativeEventEmitter;
35
36
  import java.util.ArrayList;
36
37
  import java.util.Map;
@@ -130,8 +131,8 @@ public class ReactNativeGoogleMobileAdsCommon {
130
131
  return map;
131
132
  }
132
133
 
133
- public static AdRequest buildAdRequest(ReadableMap adRequestOptions) {
134
- AdRequest.Builder builder = new AdRequest.Builder();
134
+ public static AdManagerAdRequest buildAdRequest(ReadableMap adRequestOptions) {
135
+ AdManagerAdRequest.Builder builder = new AdManagerAdRequest.Builder();
135
136
  Bundle extras = new Bundle();
136
137
 
137
138
  if (adRequestOptions.hasKey("requestNonPersonalizedAdsOnly")
@@ -177,6 +178,16 @@ public class ReactNativeGoogleMobileAdsCommon {
177
178
  builder.setRequestAgent(Objects.requireNonNull(adRequestOptions.getString("requestAgent")));
178
179
  }
179
180
 
181
+ if (adRequestOptions.hasKey("customTargeting")) {
182
+ Map<String, Object> customTargeting = adRequestOptions.getMap("customTargeting").toHashMap();
183
+
184
+ for (Map.Entry<String, Object> entry : customTargeting.entrySet()) {
185
+ String key = entry.getKey();
186
+ String value = (String) entry.getValue();
187
+ builder.addCustomTargeting(key, value);
188
+ }
189
+ }
190
+
180
191
  return builder.build();
181
192
  }
182
193
 
@@ -17,6 +17,7 @@ package io.invertase.googlemobileads;
17
17
  *
18
18
  */
19
19
 
20
+ import static io.invertase.googlemobileads.ReactNativeGoogleMobileAdsCommon.buildAdRequest;
20
21
  import static io.invertase.googlemobileads.ReactNativeGoogleMobileAdsCommon.getCodeAndMessageFromAdError;
21
22
  import static io.invertase.googlemobileads.ReactNativeGoogleMobileAdsCommon.sendAdEvent;
22
23
  import static io.invertase.googlemobileads.ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_CLICKED;
@@ -35,7 +36,6 @@ import com.facebook.react.bridge.ReactApplicationContext;
35
36
  import com.facebook.react.bridge.ReactMethod;
36
37
  import com.facebook.react.bridge.ReadableMap;
37
38
  import com.facebook.react.bridge.WritableMap;
38
- import com.google.android.gms.ads.AdRequest;
39
39
  import com.google.android.gms.ads.FullScreenContentCallback;
40
40
  import com.google.android.gms.ads.LoadAdError;
41
41
  import com.google.android.gms.ads.interstitial.InterstitialAd;
@@ -69,9 +69,6 @@ public class ReactNativeGoogleMobileAdsInterstitialModule extends ReactNativeMod
69
69
  }
70
70
  currentActivity.runOnUiThread(
71
71
  () -> {
72
- AdRequest.Builder adRequestBuilder = new AdRequest.Builder();
73
- AdRequest adRequest = adRequestBuilder.build();
74
-
75
72
  InterstitialAdLoadCallback interstitialAdLoadCallback =
76
73
  new InterstitialAdLoadCallback() {
77
74
 
@@ -114,7 +111,11 @@ public class ReactNativeGoogleMobileAdsInterstitialModule extends ReactNativeMod
114
111
  }
115
112
  };
116
113
 
117
- InterstitialAd.load(currentActivity, adUnitId, adRequest, interstitialAdLoadCallback);
114
+ InterstitialAd.load(
115
+ currentActivity,
116
+ adUnitId,
117
+ buildAdRequest(adRequestOptions),
118
+ interstitialAdLoadCallback);
118
119
  });
119
120
  }
120
121
 
@@ -1,5 +1,6 @@
1
1
  package io.invertase.googlemobileads;
2
2
 
3
+ import static io.invertase.googlemobileads.ReactNativeGoogleMobileAdsCommon.buildAdRequest;
3
4
  import static io.invertase.googlemobileads.ReactNativeGoogleMobileAdsCommon.getCodeAndMessageFromAdError;
4
5
  import static io.invertase.googlemobileads.ReactNativeGoogleMobileAdsCommon.sendAdEvent;
5
6
  import static io.invertase.googlemobileads.ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_CLOSED;
@@ -18,7 +19,6 @@ import com.facebook.react.bridge.ReactApplicationContext;
18
19
  import com.facebook.react.bridge.ReactMethod;
19
20
  import com.facebook.react.bridge.ReadableMap;
20
21
  import com.facebook.react.bridge.WritableMap;
21
- import com.google.android.gms.ads.AdRequest;
22
22
  import com.google.android.gms.ads.FullScreenContentCallback;
23
23
  import com.google.android.gms.ads.LoadAdError;
24
24
  import com.google.android.gms.ads.OnUserEarnedRewardListener;
@@ -64,8 +64,6 @@ public class ReactNativeGoogleMobileAdsRewardedModule extends ReactNativeModule
64
64
  }
65
65
  activity.runOnUiThread(
66
66
  () -> {
67
- AdRequest adRequest = new AdRequest.Builder().build();
68
-
69
67
  RewardedAdLoadCallback rewardedAdLoadCallback =
70
68
  new RewardedAdLoadCallback() {
71
69
  @Override
@@ -129,7 +127,8 @@ public class ReactNativeGoogleMobileAdsRewardedModule extends ReactNativeModule
129
127
  }
130
128
  };
131
129
 
132
- RewardedAd.load(activity, adUnitId, adRequest, rewardedAdLoadCallback);
130
+ RewardedAd.load(
131
+ activity, adUnitId, buildAdRequest(adRequestOptions), rewardedAdLoadCallback);
133
132
  });
134
133
  }
135
134
 
@@ -0,0 +1,92 @@
1
+ # Common reasons for ads not showing
2
+
3
+ Use the following guide to understand common reasons why apps show few or no ads.
4
+
5
+ ## Did you recently create your AdMob account?
6
+
7
+ Your account must be approved before ad requests will succeed.
8
+ When you first sign up for AdMob, your account is reviewed before it’s approved.
9
+ This typically takes less than 24 hours, but in rare cases can take up to 2 weeks.
10
+ You'll be notified of approval or rejection via email after review.
11
+
12
+ ## Is your app or ad unit new?
13
+
14
+ New apps and ad units take some time to activate.
15
+ Here are common reasons you may not see live impressions immediately:
16
+ - It usually takes at least an hour after you create an app or ad unit
17
+ - Sometimes it can take a few days for ads to appear in new apps or ad units
18
+ - New iOS apps will not show Google ads until they’re listed in the Apple App Store
19
+
20
+ ## Test ads not showing up
21
+
22
+ If you set up an app-ads.txt file for your app, you need to also include this line in your app-ads.txt file in order to load ads using the demo ad units:
23
+ `google.com, pub-3940256099942544, DIRECT, f08c47fec0942fa0`
24
+
25
+ - Set up app-ads.txt [iOS](https://developers.google.com/admob/ios/app-ads), [Android](https://developers.google.com/admob/android/app-ads)
26
+ - Enabling test ads [iOS](https://developers.google.com/admob/ios/test-ads), [Android](https://developers.google.com/admob/android/test-ads)
27
+
28
+ Alternatively, you can enable test devices and use your own ad unit IDs instead.
29
+
30
+ ### Enable test devices
31
+
32
+ If you want to do more rigorous testing with production-looking ads, configure your device as a test device and use your own ad unit IDs that you've created in the AdMob UI.
33
+ Test devices can either be added in the AdMob UI or programmatically using the Google Mobile Ads SDK.
34
+
35
+ Follow the steps below to add your device as a test device.
36
+
37
+ #### Add your test device in the AdMob UI
38
+ For a simple, non-programmatic way to add a test device and test new or existing app builds, use the AdMob UI.
39
+ [Learn how](https://support.google.com/admob/answer/9691433).
40
+
41
+ #### Add your test device programmatically
42
+
43
+ If you want to test ads in your app as you're developing, follow the steps below to programmatically register your test device.
44
+
45
+ 1. Load your ads-integrated app and make an ad request.
46
+
47
+ 2. For **iOS** follow step 3, for **Android** skip to step 4.
48
+
49
+ 3. Check the console for a message that looks like this:
50
+
51
+ ```
52
+ GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers =
53
+ @[ @"2077ef9a63d2b398840261c8221a0c9b" ]; // Sample device ID
54
+ ```
55
+
56
+ Copy your test device ID to your clipboard.
57
+
58
+ 4. Check the logcat output for a message that looks like the one below, which shows you your device ID and how to add it as a test device:
59
+
60
+ ```
61
+ I/Ads: Use RequestConfiguration.Builder.setTestDeviceIds(Arrays.asList("33BE2250B43518CCDA7DE426D04EE231"))
62
+ to get test ads on this device."
63
+ ```
64
+
65
+ Copy your test device ID to your clipboard.
66
+
67
+ 5. Modify your code to set the test device ID through testDeviceIdentifiers
68
+
69
+ ```js
70
+ import mobileAds from 'react-native-google-mobile-ads';
71
+
72
+ mobileAds()
73
+ .setRequestConfiguration({
74
+ // An array of test device IDs to add to the allow list.
75
+ testDeviceIdentifiers: ["2077ef9a63d2b398840261c8221a0c9b", "EMULATOR"]
76
+ })
77
+ .then(() => {
78
+ // Request config successfully set!
79
+ });
80
+ ```
81
+
82
+ 5. Re-run your app. If the ad is a Google ad, you'll see a Test Ad label centered at the top of the ad.
83
+ Ads with this Test Ad label are safe to click. Requests, impressions, and clicks on test ads will not show up in your account's reports.
84
+
85
+ ## Emulator vs real device
86
+
87
+ In some cases ads won't show up on an emulator but will show up while testing on a real device.
88
+
89
+ ## Extra links
90
+
91
+ - Mobile Ads SDK [iOS](https://developers.google.com/admob/ios/quick-start), [Android](https://developers.google.com/admob/android/quick-start)
92
+ - [Common reasons for ads not showing](https://support.google.com/admob/answer/9469204)
package/docs/index.mdx CHANGED
@@ -94,7 +94,7 @@ mobileAds()
94
94
  tagForUnderAgeOfConsent: true,
95
95
 
96
96
  // An array of test device IDs to whitelist.
97
- testDeviceIdentifiers: ["EMULATOR"];
97
+ testDeviceIdentifiers: ["EMULATOR"]
98
98
  })
99
99
  .then(() => {
100
100
  // Request config successfully set!
package/docs.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "sidebar": [
5
5
  ["Installation", "/"],
6
6
  ["Displaying Ads", "/displaying-ads"],
7
- ["European User Consent", "/european-user-consent"]
7
+ ["European User Consent", "/european-user-consent"],
8
+ ["Common Reasons For Ads Not Showing", "/common-reasons-for-ads-not-showing"]
8
9
  ]
9
10
  }
@@ -43,9 +43,8 @@ RCT_EXPORT_METHOD(appOpenLoad
43
43
  : (NSString *)adUnitId
44
44
  : (NSDictionary *)adRequestOptions) {
45
45
  self.appOpenAd = nil;
46
- GADRequest *request = [GADRequest request];
47
46
  [GADAppOpenAd loadWithAdUnitID:adUnitId
48
- request:request
47
+ request:[RNGoogleMobileAdsCommon buildAdRequest:adRequestOptions]
49
48
  orientation:UIInterfaceOrientationPortrait
50
49
  completionHandler:^(GADAppOpenAd *_Nullable appOpenAd, NSError *_Nullable error) {
51
50
  if (error) {
@@ -21,7 +21,7 @@
21
21
 
22
22
  @interface RNGoogleMobileAdsCommon : NSObject
23
23
 
24
- + (GADRequest *)buildAdRequest:(NSDictionary *)adRequestOptions;
24
+ + (GAMRequest *)buildAdRequest:(NSDictionary *)adRequestOptions;
25
25
 
26
26
  + (NSDictionary *)getCodeAndMessageFromAdError:(NSError *)error;
27
27
 
@@ -44,8 +44,8 @@ NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD = @"rewarded_earn
44
44
 
45
45
  @implementation RNGoogleMobileAdsCommon
46
46
 
47
- + (GADRequest *)buildAdRequest:(NSDictionary *)adRequestOptions {
48
- GADRequest *request = [GADRequest request];
47
+ + (GAMRequest *)buildAdRequest:(NSDictionary *)adRequestOptions {
48
+ GAMRequest *request = [GAMRequest request];
49
49
  NSMutableDictionary *extras = [@{} mutableCopy];
50
50
 
51
51
  if (adRequestOptions[@"requestNonPersonalizedAdsOnly"] &&
@@ -83,6 +83,10 @@ NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD = @"rewarded_earn
83
83
  request.requestAgent = adRequestOptions[@"requestAgent"];
84
84
  }
85
85
 
86
+ if (adRequestOptions[@"customTargeting"]) {
87
+ request.customTargeting = adRequestOptions[@"customTargeting"];
88
+ }
89
+
86
90
  return request;
87
91
  }
88
92
 
@@ -68,9 +68,8 @@ RCT_EXPORT_METHOD(interstitialLoad
68
68
  : (nonnull NSNumber *)requestId
69
69
  : (NSString *)adUnitId
70
70
  : (NSDictionary *)adRequestOptions) {
71
- GADRequest *request = [GADRequest request];
72
71
  [GADInterstitialAd loadWithAdUnitID:adUnitId
73
- request:request
72
+ request:[RNGoogleMobileAdsCommon buildAdRequest:adRequestOptions]
74
73
  completionHandler:^(GADInterstitialAd *ad, NSError *error) {
75
74
  if (error) {
76
75
  NSDictionary *codeAndMessage =
@@ -68,9 +68,8 @@ RCT_EXPORT_METHOD(rewardedLoad
68
68
  : (nonnull NSNumber *)requestId
69
69
  : (NSString *)adUnitId
70
70
  : (NSDictionary *)adRequestOptions) {
71
- GADRequest *request = [GADRequest request];
72
71
  [GADRewardedAd loadWithAdUnitID:adUnitId
73
- request:request
72
+ request:[RNGoogleMobileAdsCommon buildAdRequest:adRequestOptions]
74
73
  completionHandler:^(GADRewardedAd *ad, NSError *error) {
75
74
  if (error) {
76
75
  NSDictionary *codeAndMessage =
@@ -29,7 +29,7 @@ var _AdsConsentStatus = require("./AdsConsentStatus");
29
29
  * limitations under the License.
30
30
  *
31
31
  */
32
- const native = _reactNative.NativeModules.RNGoogleAdsConsentModule;
32
+ const native = _reactNative.NativeModules.RNGoogleMobileAdsConsentModule;
33
33
  const AdsConsent = {
34
34
  /**
35
35
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["AdsConsent.ts"],"names":["native","NativeModules","RNGoogleAdsConsentModule","AdsConsent","requestInfoUpdate","publisherIds","Error","length","i","showForm","options","privacyPolicy","withPersonalizedAds","withNonPersonalizedAds","withAdFree","getAdProviders","setDebugGeography","geography","AdsConsentDebugGeography","DISABLED","EEA","NOT_EEA","getStatus","setStatus","status","AdsConsentStatus","UNKNOWN","NON_PERSONALIZED","PERSONALIZED","setTagForUnderAgeOfConsent","tag","addTestDevices","deviceIds"],"mappings":";;;;;;;AAiBA;;AASA;;AACA;;AACA;;AA5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBA,MAAMA,MAAM,GAAGC,2BAAcC,wBAA7B;AAEO,MAAMC,UAA+B,GAAG;AAC7C;AACF;AACA;AACA;AACA;AACEC,EAAAA,iBAAiB,CAACC,YAAD,EAAe;AAC9B,QAAI,CAAC,qBAAQA,YAAR,CAAL,EAA4B;AAC1B,YAAM,IAAIC,KAAJ,CACJ,oFADI,CAAN;AAGD;;AAED,QAAID,YAAY,CAACE,MAAb,KAAwB,CAA5B,EAA+B;AAC7B,YAAM,IAAID,KAAJ,CACJ,uFADI,CAAN;AAGD;;AAED,SAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,YAAY,CAACE,MAAjC,EAAyCC,CAAC,EAA1C,EAA8C;AAC5C,UAAI,CAAC,sB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CAAC,sBAASwB,SAAS,CAACxB,CAAD,CAAlB,CAAL,EAA6B;AAC3B,cAAM,IAAIF,KAAJ,CACJ,8EADI,CAAN;AAGD;AACF;;AAED,WAAON,MAAM,CAAC+B,cAAP,CAAsBC,SAAtB,CAAP;AACD;;AA5J4C,CAAxC","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\n hasOwnProperty,\n isArray,\n isBoolean,\n isObject,\n isString,\n isUndefined,\n isValidUrl,\n} from './common';\nimport { NativeModules } from 'react-native';\nimport { AdsConsentDebugGeography } from './AdsConsentDebugGeography';\nimport { AdsConsentStatus } from './AdsConsentStatus';\nimport { AdsConsentInterface } from './types/AdsConsent.interface';\n\nconst native = NativeModules.RNGoogleAdsConsentModule;\n\nexport const AdsConsent: AdsConsentInterface = {\n /**\n *\n * @param publisherIds\n * @returns {*}\n */\n requestInfoUpdate(publisherIds) {\n if (!isArray(publisherIds)) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'publisherIds' expected an array of string values.\",\n );\n }\n\n if (publisherIds.length === 0) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'publisherIds' list of publisher IDs cannot be empty.\",\n );\n }\n\n for (let i = 0; i < publisherIds.length; i++) {\n if (!isString(publisherIds[i])) {\n throw new Error(\n `AdsConsent.requestInfoUpdate(*) 'publisherIds[${i}]' expected a string value.`,\n );\n }\n }\n\n return native.requestInfoUpdate(publisherIds);\n },\n\n /**\n *\n * @param options\n * @returns {*}\n */\n showForm(options) {\n if (!isUndefined(options) && !isObject(options)) {\n throw new Error(\"AdsConsent.showForm(*) 'options' expected an object value.\");\n }\n\n if (!isValidUrl(options.privacyPolicy)) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.privacyPolicy' expected a valid HTTP or HTTPS URL.\",\n );\n }\n\n if (hasOwnProperty(options, 'withPersonalizedAds') && !isBoolean(options.withPersonalizedAds)) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.withPersonalizedAds' expected a boolean value.\",\n );\n }\n\n if (\n hasOwnProperty(options, 'withNonPersonalizedAds') &&\n !isBoolean(options.withNonPersonalizedAds)\n ) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.withNonPersonalizedAds' expected a boolean value.\",\n );\n }\n\n if (hasOwnProperty(options, 'withAdFree') && !isBoolean(options.withAdFree)) {\n throw new Error(\"AdsConsent.showForm(*) 'options.withAdFree' expected a boolean value.\");\n }\n\n if (!options.withPersonalizedAds && !options.withNonPersonalizedAds && !options.withAdFree) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options' form requires at least one option to be enabled.\",\n );\n }\n\n return native.showForm(options);\n },\n\n /**\n *\n */\n getAdProviders() {\n return native.getAdProviders();\n },\n\n /**\n *\n * @param geography\n */\n setDebugGeography(geography) {\n if (\n geography !== AdsConsentDebugGeography.DISABLED &&\n geography !== AdsConsentDebugGeography.EEA &&\n geography !== AdsConsentDebugGeography.NOT_EEA\n ) {\n throw new Error(\n \"AdsConsent.setDebugGeography(*) 'geography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.\",\n );\n }\n\n return native.setDebugGeography(geography);\n },\n\n /**\n *\n */\n getStatus() {\n return native.getStatus();\n },\n\n /**\n *\n * @param status\n */\n setStatus(status) {\n if (\n status !== AdsConsentStatus.UNKNOWN &&\n status !== AdsConsentStatus.NON_PERSONALIZED &&\n status !== AdsConsentStatus.PERSONALIZED\n ) {\n throw new Error(\n \"AdsConsent.setStatus(*) 'status' expected one of AdsConsentStatus.UNKNOWN, AdsConsentStatus.NON_PERSONALIZED or AdsConsentStatus.PERSONALIZED.\",\n );\n }\n\n return native.setStatus(status);\n },\n\n /**\n *\n * @param tag\n */\n setTagForUnderAgeOfConsent(tag) {\n if (!isBoolean(tag)) {\n throw new Error(\"AdsConsent.setTagForUnderAgeOfConsent(*) 'tag' expected a boolean value.\");\n }\n\n return native.setTagForUnderAgeOfConsent(tag);\n },\n\n /**\n *\n * @param deviceIds\n */\n addTestDevices(deviceIds) {\n if (!isArray(deviceIds)) {\n throw new Error(\n \"AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.\",\n );\n }\n\n for (let i = 0; i < deviceIds.length; i++) {\n if (!isString(deviceIds[i])) {\n throw new Error(\n \"AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.\",\n );\n }\n }\n\n return native.addTestDevices(deviceIds);\n },\n};\n"]}
1
+ {"version":3,"sources":["AdsConsent.ts"],"names":["native","NativeModules","RNGoogleMobileAdsConsentModule","AdsConsent","requestInfoUpdate","publisherIds","Error","length","i","showForm","options","privacyPolicy","withPersonalizedAds","withNonPersonalizedAds","withAdFree","getAdProviders","setDebugGeography","geography","AdsConsentDebugGeography","DISABLED","EEA","NOT_EEA","getStatus","setStatus","status","AdsConsentStatus","UNKNOWN","NON_PERSONALIZED","PERSONALIZED","setTagForUnderAgeOfConsent","tag","addTestDevices","deviceIds"],"mappings":";;;;;;;AAiBA;;AASA;;AACA;;AACA;;AA5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBA,MAAMA,MAAM,GAAGC,2BAAcC,8BAA7B;AAEO,MAAMC,UAA+B,GAAG;AAC7C;AACF;AACA;AACA;AACA;AACEC,EAAAA,iBAAiB,CAACC,YAAD,EAAe;AAC9B,QAAI,CAAC,qBAAQA,YAAR,CAAL,EAA4B;AAC1B,YAAM,IAAIC,KAAJ,CACJ,oFADI,CAAN;AAGD;;AAED,QAAID,YAAY,CA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AI,CAAC,qBAAQA,SAAR,CAAL,EAAyB;AACvB,YAAM,IAAI1B,KAAJ,CACJ,8EADI,CAAN;AAGD;;AAED,SAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGwB,SAAS,CAACzB,MAA9B,EAAsCC,CAAC,EAAvC,EAA2C;AACzC,UAAI,CAAC,sBAASwB,SAAS,CAACxB,CAAD,CAAlB,CAAL,EAA6B;AAC3B,cAAM,IAAIF,KAAJ,CACJ,8EADI,CAAN;AAGD;AACF;;AAED,WAAON,MAAM,CAAC+B,cAAP,CAAsBC,SAAtB,CAAP;AACD;;AA5J4C,CAAxC","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\n hasOwnProperty,\n isArray,\n isBoolean,\n isObject,\n isString,\n isUndefined,\n isValidUrl,\n} from './common';\nimport { NativeModules } from 'react-native';\nimport { AdsConsentDebugGeography } from './AdsConsentDebugGeography';\nimport { AdsConsentStatus } from './AdsConsentStatus';\nimport { AdsConsentInterface } from './types/AdsConsent.interface';\n\nconst native = NativeModules.RNGoogleMobileAdsConsentModule;\n\nexport const AdsConsent: AdsConsentInterface = {\n /**\n *\n * @param publisherIds\n * @returns {*}\n */\n requestInfoUpdate(publisherIds) {\n if (!isArray(publisherIds)) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'publisherIds' expected an array of string values.\",\n );\n }\n\n if (publisherIds.length === 0) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'publisherIds' list of publisher IDs cannot be empty.\",\n );\n }\n\n for (let i = 0; i < publisherIds.length; i++) {\n if (!isString(publisherIds[i])) {\n throw new Error(\n `AdsConsent.requestInfoUpdate(*) 'publisherIds[${i}]' expected a string value.`,\n );\n }\n }\n\n return native.requestInfoUpdate(publisherIds);\n },\n\n /**\n *\n * @param options\n * @returns {*}\n */\n showForm(options) {\n if (!isUndefined(options) && !isObject(options)) {\n throw new Error(\"AdsConsent.showForm(*) 'options' expected an object value.\");\n }\n\n if (!isValidUrl(options.privacyPolicy)) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.privacyPolicy' expected a valid HTTP or HTTPS URL.\",\n );\n }\n\n if (hasOwnProperty(options, 'withPersonalizedAds') && !isBoolean(options.withPersonalizedAds)) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.withPersonalizedAds' expected a boolean value.\",\n );\n }\n\n if (\n hasOwnProperty(options, 'withNonPersonalizedAds') &&\n !isBoolean(options.withNonPersonalizedAds)\n ) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.withNonPersonalizedAds' expected a boolean value.\",\n );\n }\n\n if (hasOwnProperty(options, 'withAdFree') && !isBoolean(options.withAdFree)) {\n throw new Error(\"AdsConsent.showForm(*) 'options.withAdFree' expected a boolean value.\");\n }\n\n if (!options.withPersonalizedAds && !options.withNonPersonalizedAds && !options.withAdFree) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options' form requires at least one option to be enabled.\",\n );\n }\n\n return native.showForm(options);\n },\n\n /**\n *\n */\n getAdProviders() {\n return native.getAdProviders();\n },\n\n /**\n *\n * @param geography\n */\n setDebugGeography(geography) {\n if (\n geography !== AdsConsentDebugGeography.DISABLED &&\n geography !== AdsConsentDebugGeography.EEA &&\n geography !== AdsConsentDebugGeography.NOT_EEA\n ) {\n throw new Error(\n \"AdsConsent.setDebugGeography(*) 'geography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.\",\n );\n }\n\n return native.setDebugGeography(geography);\n },\n\n /**\n *\n */\n getStatus() {\n return native.getStatus();\n },\n\n /**\n *\n * @param status\n */\n setStatus(status) {\n if (\n status !== AdsConsentStatus.UNKNOWN &&\n status !== AdsConsentStatus.NON_PERSONALIZED &&\n status !== AdsConsentStatus.PERSONALIZED\n ) {\n throw new Error(\n \"AdsConsent.setStatus(*) 'status' expected one of AdsConsentStatus.UNKNOWN, AdsConsentStatus.NON_PERSONALIZED or AdsConsentStatus.PERSONALIZED.\",\n );\n }\n\n return native.setStatus(status);\n },\n\n /**\n *\n * @param tag\n */\n setTagForUnderAgeOfConsent(tag) {\n if (!isBoolean(tag)) {\n throw new Error(\"AdsConsent.setTagForUnderAgeOfConsent(*) 'tag' expected a boolean value.\");\n }\n\n return native.setTagForUnderAgeOfConsent(tag);\n },\n\n /**\n *\n * @param deviceIds\n */\n addTestDevices(deviceIds) {\n if (!isArray(deviceIds)) {\n throw new Error(\n \"AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.\",\n );\n }\n\n for (let i = 0; i < deviceIds.length; i++) {\n if (!isString(deviceIds[i])) {\n throw new Error(\n \"AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.\",\n );\n }\n }\n\n return native.addTestDevices(deviceIds);\n },\n};\n"]}
@@ -153,6 +153,14 @@ function validateAdRequestOptions(options) {
153
153
  out.serverSideVerificationOptions = options.serverSideVerificationOptions;
154
154
  }
155
155
 
156
+ if (options.customTargeting) {
157
+ if (!(0, _common.isObject)(options.customTargeting)) {
158
+ throw new Error("'options.customTargeting' expected an object of key/value pairs");
159
+ }
160
+
161
+ out.customTargeting = options.customTargeting;
162
+ }
163
+
156
164
  return out;
157
165
  }
158
166
  //# sourceMappingURL=validateAdRequestOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["validateAdRequestOptions.ts"],"names":["validateAdRequestOptions","options","out","Error","requestNonPersonalizedAdsOnly","networkExtras","Object","entries","forEach","key","value","keywords","i","length","keyword","contentUrl","location","error","latitude","longitude","locationAccuracy","requestAgent","serverSideVerification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,EAAuD;AACrD,YAAM,IAAIrB,KAAJ,CAAU,wEAAV,CAAN;AACD;;AAED,QAAIoB,UAAU,CAACE,UAAX,IAAyB,CAAC,sBAASF,UAAU,CAACE,UAApB,CAA9B,EAA+D;AAC7D,YAAM,IAAItB,KAAJ,CAAU,4EAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACoB,6BAAJ,GAAoCrB,OAAO,CAACqB,6BAA5C;AACD;;AAED,SAAOpB,GAAP;AACD","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\n hasOwnProperty,\n isArray,\n isBoolean,\n isNumber,\n isObject,\n isString,\n isUndefined,\n isValidUrl,\n} from './common';\nimport { RequestOptions } from './types/RequestOptions';\n\nexport function validateAdRequestOptions(options?: RequestOptions) {\n const out: RequestOptions = {};\n\n if (isUndefined(options)) {\n return out;\n }\n\n if (!isObject(options)) {\n throw new Error(\"'options' expected an object value\");\n }\n\n if (hasOwnProperty(options, 'requestNonPersonalizedAdsOnly')) {\n if (!isBoolean(options.requestNonPersonalizedAdsOnly)) {\n throw new Error(\"'options.requestNonPersonalizedAdsOnly' expected a boolean value\");\n }\n\n out.requestNonPersonalizedAdsOnly = options.requestNonPersonalizedAdsOnly;\n }\n\n if (options.networkExtras) {\n if (!isObject(options.networkExtras)) {\n throw new Error(\"'options.networkExtras' expected an object of key/value pairs\");\n }\n\n Object.entries(options.networkExtras).forEach(([key, value]) => {\n if (!isString(value)) {\n throw new Error(`'options.networkExtras' expected a string value for object key \"${key}\"`);\n }\n });\n\n out.networkExtras = options.networkExtras;\n }\n\n if (options.keywords) {\n if (!isArray(options.keywords)) {\n throw new Error(\"'options.keywords' expected an array containing string values\");\n }\n\n for (let i = 0; i < options.keywords.length; i++) {\n const keyword = options.keywords[i];\n\n if (!isString(keyword)) {\n throw new Error(\"'options.keywords' expected an array containing string values\");\n }\n }\n\n out.keywords = options.keywords;\n }\n\n if (options.contentUrl) {\n if (!isString(options.contentUrl)) {\n throw new Error(\"'options.contentUrl' expected a string value\");\n }\n\n if (!isValidUrl(options.contentUrl)) {\n throw new Error(\"'options.contentUrl' expected a valid HTTP or HTTPS url.\");\n }\n\n if (options.contentUrl.length > 512) {\n throw new Error(\"'options.contentUrl' maximum length of a content URL is 512 characters.\");\n }\n\n out.contentUrl = options.contentUrl;\n }\n\n if (options.location) {\n const error = new Error(\n \"'options.location' expected an array value containing a latitude & longitude number value.\",\n );\n\n if (!isArray(options.location)) {\n throw error;\n }\n\n const [latitude, longitude] = options.location;\n\n if (!isNumber(latitude) || !isNumber(longitude)) {\n throw error;\n }\n\n if (latitude < -90 || latitude > 90) {\n throw new Error(\n `'options.location' latitude value must be a number between -90 and 90, but was: ${latitude}`,\n );\n }\n\n if (longitude < -180 || longitude > 180) {\n throw new Error(\n `'options.location' longitude value must be a number between -180 and 180, but was: ${latitude}`,\n );\n }\n\n out.location = [latitude, longitude];\n }\n\n if (hasOwnProperty(options, 'locationAccuracy')) {\n if (!isNumber(options.locationAccuracy)) {\n throw new Error(\"'options.locationAccuracy' expected a number value.\");\n }\n\n if (isNumber(options.locationAccuracy) && options.locationAccuracy < 0) {\n throw new Error(\"'options.locationAccuracy' expected a number greater than 0.\");\n }\n\n out.locationAccuracy = options.locationAccuracy;\n } else {\n out.locationAccuracy = 5;\n }\n\n if (options.requestAgent) {\n if (!isString(options.requestAgent)) {\n throw new Error(\"'options.requestAgent' expected a string value\");\n }\n\n out.requestAgent = options.requestAgent;\n }\n\n if (options.serverSideVerificationOptions) {\n if (!isObject(options.serverSideVerificationOptions)) {\n throw new Error(\n \"'options.serverSideVerificationOptions' expected an object of key/value pairs\",\n );\n }\n\n const ssvOptions = options.serverSideVerificationOptions;\n\n if (ssvOptions.userId && !isString(ssvOptions.userId)) {\n throw new Error(\"'options.serverSideVerificationOptions.userId' expected a string value\");\n }\n\n if (ssvOptions.customData && !isString(ssvOptions.customData)) {\n throw new Error(\"'options.serverSideVerificationOptions.customData' expected a string value\");\n }\n\n out.serverSideVerificationOptions = options.serverSideVerificationOptions;\n }\n\n return out;\n}\n"]}
1
+ {"version":3,"sources":["validateAdRequestOptions.ts"],"names":["validateAdRequestOptions","options","out","Error","requestNonPersonalizedAdsOnly","networkExtras","Object","entries","forEach","key","value","keywords","i","length","keyword","contentUrl","location","error","latitude","longitude","locationAccuracy","requestAgent","serverSideVerificationOptions","ssvOptions","userId","customData","customTargeting"],"mappings":";;;;;;;AAiBA;;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAcO,SAASA,wBAAT,CAAkCC,OAAlC,EAA4D;AACjE,QAAMC,GAAmB,GAAG,EAA5B;;AAEA,MAAI,yBAAYD,OAAZ,CAAJ,EAA0B;AACxB,WAAOC,GAAP;AACD;;AAED,MAAI,CAAC,sBAASD,OAAT,CAAL,EAAwB;AACtB,UAAM,IAAIE,KAAJ,CAAU,oCAAV,CAAN;AACD;;AAED,MAAI,4BAAeF,OAAf,EAAwB,+BAAxB,CAAJ,EAA8D;AAC5D,QAAI,CAAC,uBAAUA,OAAO,CAACG,6BAAlB,CAAL,EAAuD;AACrD,YAAM,IAAID,KAAJ,CAAU,kEAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACE,6BAAJ,GAAoCH,OAAO,CAACG,6BAA5C;AACD;;AAED,MAAIH,OAAO,CAACI,aAAZ,EAA2B;AACzB,QAAI,CAAC,sBAASJ,OAAO,CAACI,aAAjB,CAAL,EAAsC;AACpC,YAAM,IAAIF,KAAJ,CAAU,+DAAV,CAAN;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,CAACoB,YAAZ,EAA0B;AACxB,QAAI,CAAC,sBAASpB,OAAO,CAACoB,YAAjB,CAAL,EAAqC;AACnC,YAAM,IAAIlB,KAAJ,CAAU,gDAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACmB,YAAJ,GAAmBpB,OAAO,CAACoB,YAA3B;AACD;;AAED,MAAIpB,OAAO,CAACqB,6BAAZ,EAA2C;AACzC,QAAI,CAAC,sBAASrB,OAAO,CAACqB,6BAAjB,CAAL,EAAsD;AACpD,YAAM,IAAInB,KAAJ,CACJ,+EADI,CAAN;AAGD;;AAED,UAAMoB,UAAU,GAAGtB,OAAO,CAACqB,6BAA3B;;AAEA,QAAIC,UAAU,CAACC,MAAX,IAAqB,CAAC,sBAASD,UAAU,CAACC,MAApB,CAA1B,EAAuD;AACrD,YAAM,IAAIrB,KAAJ,CAAU,wEAAV,CAAN;AACD;;AAED,QAAIoB,UAAU,CAACE,UAAX,IAAyB,CAAC,sBAASF,UAAU,CAACE,UAApB,CAA9B,EAA+D;AAC7D,YAAM,IAAItB,KAAJ,CAAU,4EAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACoB,6BAAJ,GAAoCrB,OAAO,CAACqB,6BAA5C;AACD;;AAED,MAAIrB,OAAO,CAACyB,eAAZ,EAA6B;AAC3B,QAAI,CAAC,sBAASzB,OAAO,CAACyB,eAAjB,CAAL,EAAwC;AACtC,YAAM,IAAIvB,KAAJ,CAAU,iEAAV,CAAN;AACD;;AACDD,IAAAA,GAAG,CAACwB,eAAJ,GAAsBzB,OAAO,CAACyB,eAA9B;AACD;;AAED,SAAOxB,GAAP;AACD","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\n hasOwnProperty,\n isArray,\n isBoolean,\n isNumber,\n isObject,\n isString,\n isUndefined,\n isValidUrl,\n} from './common';\nimport { RequestOptions } from './types/RequestOptions';\n\nexport function validateAdRequestOptions(options?: RequestOptions) {\n const out: RequestOptions = {};\n\n if (isUndefined(options)) {\n return out;\n }\n\n if (!isObject(options)) {\n throw new Error(\"'options' expected an object value\");\n }\n\n if (hasOwnProperty(options, 'requestNonPersonalizedAdsOnly')) {\n if (!isBoolean(options.requestNonPersonalizedAdsOnly)) {\n throw new Error(\"'options.requestNonPersonalizedAdsOnly' expected a boolean value\");\n }\n\n out.requestNonPersonalizedAdsOnly = options.requestNonPersonalizedAdsOnly;\n }\n\n if (options.networkExtras) {\n if (!isObject(options.networkExtras)) {\n throw new Error(\"'options.networkExtras' expected an object of key/value pairs\");\n }\n\n Object.entries(options.networkExtras).forEach(([key, value]) => {\n if (!isString(value)) {\n throw new Error(`'options.networkExtras' expected a string value for object key \"${key}\"`);\n }\n });\n\n out.networkExtras = options.networkExtras;\n }\n\n if (options.keywords) {\n if (!isArray(options.keywords)) {\n throw new Error(\"'options.keywords' expected an array containing string values\");\n }\n\n for (let i = 0; i < options.keywords.length; i++) {\n const keyword = options.keywords[i];\n\n if (!isString(keyword)) {\n throw new Error(\"'options.keywords' expected an array containing string values\");\n }\n }\n\n out.keywords = options.keywords;\n }\n\n if (options.contentUrl) {\n if (!isString(options.contentUrl)) {\n throw new Error(\"'options.contentUrl' expected a string value\");\n }\n\n if (!isValidUrl(options.contentUrl)) {\n throw new Error(\"'options.contentUrl' expected a valid HTTP or HTTPS url.\");\n }\n\n if (options.contentUrl.length > 512) {\n throw new Error(\"'options.contentUrl' maximum length of a content URL is 512 characters.\");\n }\n\n out.contentUrl = options.contentUrl;\n }\n\n if (options.location) {\n const error = new Error(\n \"'options.location' expected an array value containing a latitude & longitude number value.\",\n );\n\n if (!isArray(options.location)) {\n throw error;\n }\n\n const [latitude, longitude] = options.location;\n\n if (!isNumber(latitude) || !isNumber(longitude)) {\n throw error;\n }\n\n if (latitude < -90 || latitude > 90) {\n throw new Error(\n `'options.location' latitude value must be a number between -90 and 90, but was: ${latitude}`,\n );\n }\n\n if (longitude < -180 || longitude > 180) {\n throw new Error(\n `'options.location' longitude value must be a number between -180 and 180, but was: ${latitude}`,\n );\n }\n\n out.location = [latitude, longitude];\n }\n\n if (hasOwnProperty(options, 'locationAccuracy')) {\n if (!isNumber(options.locationAccuracy)) {\n throw new Error(\"'options.locationAccuracy' expected a number value.\");\n }\n\n if (isNumber(options.locationAccuracy) && options.locationAccuracy < 0) {\n throw new Error(\"'options.locationAccuracy' expected a number greater than 0.\");\n }\n\n out.locationAccuracy = options.locationAccuracy;\n } else {\n out.locationAccuracy = 5;\n }\n\n if (options.requestAgent) {\n if (!isString(options.requestAgent)) {\n throw new Error(\"'options.requestAgent' expected a string value\");\n }\n\n out.requestAgent = options.requestAgent;\n }\n\n if (options.serverSideVerificationOptions) {\n if (!isObject(options.serverSideVerificationOptions)) {\n throw new Error(\n \"'options.serverSideVerificationOptions' expected an object of key/value pairs\",\n );\n }\n\n const ssvOptions = options.serverSideVerificationOptions;\n\n if (ssvOptions.userId && !isString(ssvOptions.userId)) {\n throw new Error(\"'options.serverSideVerificationOptions.userId' expected a string value\");\n }\n\n if (ssvOptions.customData && !isString(ssvOptions.customData)) {\n throw new Error(\"'options.serverSideVerificationOptions.customData' expected a string value\");\n }\n\n out.serverSideVerificationOptions = options.serverSideVerificationOptions;\n }\n\n if (options.customTargeting) {\n if (!isObject(options.customTargeting)) {\n throw new Error(\"'options.customTargeting' expected an object of key/value pairs\");\n }\n out.customTargeting = options.customTargeting;\n }\n\n return out;\n}\n"]}
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // generated by genversion
8
- const version = '4.1.0';
8
+ const version = '4.2.0';
9
9
  exports.version = version;
10
10
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '4.1.0';\n"]}
1
+ {"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '4.2.0';\n"]}
@@ -18,7 +18,7 @@ import { hasOwnProperty, isArray, isBoolean, isObject, isString, isUndefined, is
18
18
  import { NativeModules } from 'react-native';
19
19
  import { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
20
20
  import { AdsConsentStatus } from './AdsConsentStatus';
21
- const native = NativeModules.RNGoogleAdsConsentModule;
21
+ const native = NativeModules.RNGoogleMobileAdsConsentModule;
22
22
  export const AdsConsent = {
23
23
  /**
24
24
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["AdsConsent.ts"],"names":["hasOwnProperty","isArray","isBoolean","isObject","isString","isUndefined","isValidUrl","NativeModules","AdsConsentDebugGeography","AdsConsentStatus","native","RNGoogleAdsConsentModule","AdsConsent","requestInfoUpdate","publisherIds","Error","length","i","showForm","options","privacyPolicy","withPersonalizedAds","withNonPersonalizedAds","withAdFree","getAdProviders","setDebugGeography","geography","DISABLED","EEA","NOT_EEA","getStatus","setStatus","status","UNKNOWN","NON_PERSONALIZED","PERSONALIZED","setTagForUnderAgeOfConsent","tag","addTestDevices","deviceIds"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SACEA,cADF,EAEEC,OAFF,EAGEC,SAHF,EAIEC,QAJF,EAKEC,QALF,EAMEC,WANF,EAOEC,UAPF,QAQO,UARP;AASA,SAASC,aAAT,QAA8B,cAA9B;AACA,SAASC,wBAAT,QAAyC,4BAAzC;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A,YAAM,IAAIpB,KAAJ,CACJ,gJADI,CAAN;AAGD;;AAED,WAAOL,MAAM,CAACqB,SAAP,CAAiBC,MAAjB,CAAP;AACD,GA1H4C;;AA4H7C;AACF;AACA;AACA;AACEI,EAAAA,0BAA0B,CAACC,GAAD,EAAM;AAC9B,QAAI,CAACnC,SAAS,CAACmC,GAAD,CAAd,EAAqB;AACnB,YAAM,IAAItB,KAAJ,CAAU,0EAAV,CAAN;AACD;;AAED,WAAOL,MAAM,CAAC0B,0BAAP,CAAkCC,GAAlC,CAAP;AACD,GAtI4C;;AAwI7C;AACF;AACA;AACA;AACEC,EAAAA,cAAc,CAACC,SAAD,EAAY;AACxB,QAAI,CAACtC,OAAO,CAACsC,SAAD,CAAZ,EAAyB;AACvB,YAAM,IAAIxB,KAAJ,CACJ,8EADI,CAAN;AAGD;;AAED,SAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGsB,SAAS,CAACvB,MAA9B,EAAsCC,CAAC,EAAvC,EAA2C;AACzC,UAAI,CAACb,QAAQ,CAACmC,SAAS,CAACtB,CAAD,CAAV,CAAb,EAA6B;AAC3B,cAAM,IAAIF,KAAJ,CACJ,8EADI,CAAN;AAGD;AACF;;AAED,WAAOL,MAAM,CAAC4B,cAAP,CAAsBC,SAAtB,CAAP;AACD;;AA5J4C,CAAxC","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\n hasOwnProperty,\n isArray,\n isBoolean,\n isObject,\n isString,\n isUndefined,\n isValidUrl,\n} from './common';\nimport { NativeModules } from 'react-native';\nimport { AdsConsentDebugGeography } from './AdsConsentDebugGeography';\nimport { AdsConsentStatus } from './AdsConsentStatus';\nimport { AdsConsentInterface } from './types/AdsConsent.interface';\n\nconst native = NativeModules.RNGoogleAdsConsentModule;\n\nexport const AdsConsent: AdsConsentInterface = {\n /**\n *\n * @param publisherIds\n * @returns {*}\n */\n requestInfoUpdate(publisherIds) {\n if (!isArray(publisherIds)) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'publisherIds' expected an array of string values.\",\n );\n }\n\n if (publisherIds.length === 0) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'publisherIds' list of publisher IDs cannot be empty.\",\n );\n }\n\n for (let i = 0; i < publisherIds.length; i++) {\n if (!isString(publisherIds[i])) {\n throw new Error(\n `AdsConsent.requestInfoUpdate(*) 'publisherIds[${i}]' expected a string value.`,\n );\n }\n }\n\n return native.requestInfoUpdate(publisherIds);\n },\n\n /**\n *\n * @param options\n * @returns {*}\n */\n showForm(options) {\n if (!isUndefined(options) && !isObject(options)) {\n throw new Error(\"AdsConsent.showForm(*) 'options' expected an object value.\");\n }\n\n if (!isValidUrl(options.privacyPolicy)) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.privacyPolicy' expected a valid HTTP or HTTPS URL.\",\n );\n }\n\n if (hasOwnProperty(options, 'withPersonalizedAds') && !isBoolean(options.withPersonalizedAds)) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.withPersonalizedAds' expected a boolean value.\",\n );\n }\n\n if (\n hasOwnProperty(options, 'withNonPersonalizedAds') &&\n !isBoolean(options.withNonPersonalizedAds)\n ) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.withNonPersonalizedAds' expected a boolean value.\",\n );\n }\n\n if (hasOwnProperty(options, 'withAdFree') && !isBoolean(options.withAdFree)) {\n throw new Error(\"AdsConsent.showForm(*) 'options.withAdFree' expected a boolean value.\");\n }\n\n if (!options.withPersonalizedAds && !options.withNonPersonalizedAds && !options.withAdFree) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options' form requires at least one option to be enabled.\",\n );\n }\n\n return native.showForm(options);\n },\n\n /**\n *\n */\n getAdProviders() {\n return native.getAdProviders();\n },\n\n /**\n *\n * @param geography\n */\n setDebugGeography(geography) {\n if (\n geography !== AdsConsentDebugGeography.DISABLED &&\n geography !== AdsConsentDebugGeography.EEA &&\n geography !== AdsConsentDebugGeography.NOT_EEA\n ) {\n throw new Error(\n \"AdsConsent.setDebugGeography(*) 'geography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.\",\n );\n }\n\n return native.setDebugGeography(geography);\n },\n\n /**\n *\n */\n getStatus() {\n return native.getStatus();\n },\n\n /**\n *\n * @param status\n */\n setStatus(status) {\n if (\n status !== AdsConsentStatus.UNKNOWN &&\n status !== AdsConsentStatus.NON_PERSONALIZED &&\n status !== AdsConsentStatus.PERSONALIZED\n ) {\n throw new Error(\n \"AdsConsent.setStatus(*) 'status' expected one of AdsConsentStatus.UNKNOWN, AdsConsentStatus.NON_PERSONALIZED or AdsConsentStatus.PERSONALIZED.\",\n );\n }\n\n return native.setStatus(status);\n },\n\n /**\n *\n * @param tag\n */\n setTagForUnderAgeOfConsent(tag) {\n if (!isBoolean(tag)) {\n throw new Error(\"AdsConsent.setTagForUnderAgeOfConsent(*) 'tag' expected a boolean value.\");\n }\n\n return native.setTagForUnderAgeOfConsent(tag);\n },\n\n /**\n *\n * @param deviceIds\n */\n addTestDevices(deviceIds) {\n if (!isArray(deviceIds)) {\n throw new Error(\n \"AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.\",\n );\n }\n\n for (let i = 0; i < deviceIds.length; i++) {\n if (!isString(deviceIds[i])) {\n throw new Error(\n \"AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.\",\n );\n }\n }\n\n return native.addTestDevices(deviceIds);\n },\n};\n"]}
1
+ {"version":3,"sources":["AdsConsent.ts"],"names":["hasOwnProperty","isArray","isBoolean","isObject","isString","isUndefined","isValidUrl","NativeModules","AdsConsentDebugGeography","AdsConsentStatus","native","RNGoogleMobileAdsConsentModule","AdsConsent","requestInfoUpdate","publisherIds","Error","length","i","showForm","options","privacyPolicy","withPersonalizedAds","withNonPersonalizedAds","withAdFree","getAdProviders","setDebugGeography","geography","DISABLED","EEA","NOT_EEA","getStatus","setStatus","status","UNKNOWN","NON_PERSONALIZED","PERSONALIZED","setTagForUnderAgeOfConsent","tag","addTestDevices","deviceIds"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SACEA,cADF,EAEEC,OAFF,EAGEC,SAHF,EAIEC,QAJF,EAKEC,QALF,EAMEC,WANF,EAOEC,UAPF,QAQO,UARP;AASA,SAASC,aAAT,QAA8B,cAA9B;AACA,SAASC,wBAAT,QAAyC,4BAAzC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAGA,MAAMC,MAAM,GAAGH,aAAa,CAACI,8BAA7B;AAEA,OAAO,MAAMC,UAA+B,GAAG;AAC7C;AACF;AACA;AACA;AACA;AACEC,EAAAA,iBAAiB,CAACC,YAAD,EAAe;AAC9B,QAAI,CAACb,OAAO,CAACa,YAAD,CAAZ,EAA4B;AAC1B,YAAM,IAAIC,KAAJ,CACJ,oFADI,CAAN;AAGD;;AAED,QAAID,YAAY,CAACE,MAAb,KAAwB,CAA5B,EAA+B;AAC7B,YAAM,IAAID,KAAJ,CACJ,uFADI,CAAN;AAGD;;AAED,SAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,YAAY,CAACE,MAAjC,EAAyCC,CAAC,EAA1C,EAA8C;AAC5C,UAAI,CAACb,QAAQ,CAACU,YAAY,CAACG,CAAD,CAAb,CAAb,EAAgC;AAC9B,cAAM,IAAIF,KAAJ,CACH,iDAAgDE,CAAE,6BAD/C,CAAN;AAGD;AACF;;AAED,WAAOP,MAAM,CAACG,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SAAS,CAACtB,CAAD,CAAV,CAAb,EAA6B;AAC3B,cAAM,IAAIF,KAAJ,CACJ,8EADI,CAAN;AAGD;AACF;;AAED,WAAOL,MAAM,CAAC4B,cAAP,CAAsBC,SAAtB,CAAP;AACD;;AA5J4C,CAAxC","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\n hasOwnProperty,\n isArray,\n isBoolean,\n isObject,\n isString,\n isUndefined,\n isValidUrl,\n} from './common';\nimport { NativeModules } from 'react-native';\nimport { AdsConsentDebugGeography } from './AdsConsentDebugGeography';\nimport { AdsConsentStatus } from './AdsConsentStatus';\nimport { AdsConsentInterface } from './types/AdsConsent.interface';\n\nconst native = NativeModules.RNGoogleMobileAdsConsentModule;\n\nexport const AdsConsent: AdsConsentInterface = {\n /**\n *\n * @param publisherIds\n * @returns {*}\n */\n requestInfoUpdate(publisherIds) {\n if (!isArray(publisherIds)) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'publisherIds' expected an array of string values.\",\n );\n }\n\n if (publisherIds.length === 0) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'publisherIds' list of publisher IDs cannot be empty.\",\n );\n }\n\n for (let i = 0; i < publisherIds.length; i++) {\n if (!isString(publisherIds[i])) {\n throw new Error(\n `AdsConsent.requestInfoUpdate(*) 'publisherIds[${i}]' expected a string value.`,\n );\n }\n }\n\n return native.requestInfoUpdate(publisherIds);\n },\n\n /**\n *\n * @param options\n * @returns {*}\n */\n showForm(options) {\n if (!isUndefined(options) && !isObject(options)) {\n throw new Error(\"AdsConsent.showForm(*) 'options' expected an object value.\");\n }\n\n if (!isValidUrl(options.privacyPolicy)) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.privacyPolicy' expected a valid HTTP or HTTPS URL.\",\n );\n }\n\n if (hasOwnProperty(options, 'withPersonalizedAds') && !isBoolean(options.withPersonalizedAds)) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.withPersonalizedAds' expected a boolean value.\",\n );\n }\n\n if (\n hasOwnProperty(options, 'withNonPersonalizedAds') &&\n !isBoolean(options.withNonPersonalizedAds)\n ) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.withNonPersonalizedAds' expected a boolean value.\",\n );\n }\n\n if (hasOwnProperty(options, 'withAdFree') && !isBoolean(options.withAdFree)) {\n throw new Error(\"AdsConsent.showForm(*) 'options.withAdFree' expected a boolean value.\");\n }\n\n if (!options.withPersonalizedAds && !options.withNonPersonalizedAds && !options.withAdFree) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options' form requires at least one option to be enabled.\",\n );\n }\n\n return native.showForm(options);\n },\n\n /**\n *\n */\n getAdProviders() {\n return native.getAdProviders();\n },\n\n /**\n *\n * @param geography\n */\n setDebugGeography(geography) {\n if (\n geography !== AdsConsentDebugGeography.DISABLED &&\n geography !== AdsConsentDebugGeography.EEA &&\n geography !== AdsConsentDebugGeography.NOT_EEA\n ) {\n throw new Error(\n \"AdsConsent.setDebugGeography(*) 'geography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.\",\n );\n }\n\n return native.setDebugGeography(geography);\n },\n\n /**\n *\n */\n getStatus() {\n return native.getStatus();\n },\n\n /**\n *\n * @param status\n */\n setStatus(status) {\n if (\n status !== AdsConsentStatus.UNKNOWN &&\n status !== AdsConsentStatus.NON_PERSONALIZED &&\n status !== AdsConsentStatus.PERSONALIZED\n ) {\n throw new Error(\n \"AdsConsent.setStatus(*) 'status' expected one of AdsConsentStatus.UNKNOWN, AdsConsentStatus.NON_PERSONALIZED or AdsConsentStatus.PERSONALIZED.\",\n );\n }\n\n return native.setStatus(status);\n },\n\n /**\n *\n * @param tag\n */\n setTagForUnderAgeOfConsent(tag) {\n if (!isBoolean(tag)) {\n throw new Error(\"AdsConsent.setTagForUnderAgeOfConsent(*) 'tag' expected a boolean value.\");\n }\n\n return native.setTagForUnderAgeOfConsent(tag);\n },\n\n /**\n *\n * @param deviceIds\n */\n addTestDevices(deviceIds) {\n if (!isArray(deviceIds)) {\n throw new Error(\n \"AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.\",\n );\n }\n\n for (let i = 0; i < deviceIds.length; i++) {\n if (!isString(deviceIds[i])) {\n throw new Error(\n \"AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.\",\n );\n }\n }\n\n return native.addTestDevices(deviceIds);\n },\n};\n"]}
@@ -145,6 +145,14 @@ export function validateAdRequestOptions(options) {
145
145
  out.serverSideVerificationOptions = options.serverSideVerificationOptions;
146
146
  }
147
147
 
148
+ if (options.customTargeting) {
149
+ if (!isObject(options.customTargeting)) {
150
+ throw new Error("'options.customTargeting' expected an object of key/value pairs");
151
+ }
152
+
153
+ out.customTargeting = options.customTargeting;
154
+ }
155
+
148
156
  return out;
149
157
  }
150
158
  //# sourceMappingURL=validateAdRequestOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["validateAdRequestOptions.ts"],"names":["hasOwnProperty","isArray","isBoolean","isNumber","isObject","isString","isUndefined","isValidUrl","validateAdRequestOptions","options","out","Error","requestNonPersonalizedAdsOnly","networkExtras","Object","entries","forEach","key","value","keywords","i","length","keyword","contentUrl","location","error","latitude","longitude","locationAccuracy","requestAgent","serverSideVerificationOptions","ssvOptions","userId","customData"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SACEA,cADF,EAEEC,OAFF,EAGEC,SAHF,EAIEC,QAJF,EAKEC,QALF,EAM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,CAAC0B,UAAU,CAACC,MAAZ,CAAlC,EAAuD;AACrD,YAAM,IAAIrB,KAAJ,CAAU,wEAAV,CAAN;AACD;;AAED,QAAIoB,UAAU,CAACE,UAAX,IAAyB,CAAC5B,QAAQ,CAAC0B,UAAU,CAACE,UAAZ,CAAtC,EAA+D;AAC7D,YAAM,IAAItB,KAAJ,CAAU,4EAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACoB,6BAAJ,GAAoCrB,OAAO,CAACqB,6BAA5C;AACD;;AAED,SAAOpB,GAAP;AACD","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\n hasOwnProperty,\n isArray,\n isBoolean,\n isNumber,\n isObject,\n isString,\n isUndefined,\n isValidUrl,\n} from './common';\nimport { RequestOptions } from './types/RequestOptions';\n\nexport function validateAdRequestOptions(options?: RequestOptions) {\n const out: RequestOptions = {};\n\n if (isUndefined(options)) {\n return out;\n }\n\n if (!isObject(options)) {\n throw new Error(\"'options' expected an object value\");\n }\n\n if (hasOwnProperty(options, 'requestNonPersonalizedAdsOnly')) {\n if (!isBoolean(options.requestNonPersonalizedAdsOnly)) {\n throw new Error(\"'options.requestNonPersonalizedAdsOnly' expected a boolean value\");\n }\n\n out.requestNonPersonalizedAdsOnly = options.requestNonPersonalizedAdsOnly;\n }\n\n if (options.networkExtras) {\n if (!isObject(options.networkExtras)) {\n throw new Error(\"'options.networkExtras' expected an object of key/value pairs\");\n }\n\n Object.entries(options.networkExtras).forEach(([key, value]) => {\n if (!isString(value)) {\n throw new Error(`'options.networkExtras' expected a string value for object key \"${key}\"`);\n }\n });\n\n out.networkExtras = options.networkExtras;\n }\n\n if (options.keywords) {\n if (!isArray(options.keywords)) {\n throw new Error(\"'options.keywords' expected an array containing string values\");\n }\n\n for (let i = 0; i < options.keywords.length; i++) {\n const keyword = options.keywords[i];\n\n if (!isString(keyword)) {\n throw new Error(\"'options.keywords' expected an array containing string values\");\n }\n }\n\n out.keywords = options.keywords;\n }\n\n if (options.contentUrl) {\n if (!isString(options.contentUrl)) {\n throw new Error(\"'options.contentUrl' expected a string value\");\n }\n\n if (!isValidUrl(options.contentUrl)) {\n throw new Error(\"'options.contentUrl' expected a valid HTTP or HTTPS url.\");\n }\n\n if (options.contentUrl.length > 512) {\n throw new Error(\"'options.contentUrl' maximum length of a content URL is 512 characters.\");\n }\n\n out.contentUrl = options.contentUrl;\n }\n\n if (options.location) {\n const error = new Error(\n \"'options.location' expected an array value containing a latitude & longitude number value.\",\n );\n\n if (!isArray(options.location)) {\n throw error;\n }\n\n const [latitude, longitude] = options.location;\n\n if (!isNumber(latitude) || !isNumber(longitude)) {\n throw error;\n }\n\n if (latitude < -90 || latitude > 90) {\n throw new Error(\n `'options.location' latitude value must be a number between -90 and 90, but was: ${latitude}`,\n );\n }\n\n if (longitude < -180 || longitude > 180) {\n throw new Error(\n `'options.location' longitude value must be a number between -180 and 180, but was: ${latitude}`,\n );\n }\n\n out.location = [latitude, longitude];\n }\n\n if (hasOwnProperty(options, 'locationAccuracy')) {\n if (!isNumber(options.locationAccuracy)) {\n throw new Error(\"'options.locationAccuracy' expected a number value.\");\n }\n\n if (isNumber(options.locationAccuracy) && options.locationAccuracy < 0) {\n throw new Error(\"'options.locationAccuracy' expected a number greater than 0.\");\n }\n\n out.locationAccuracy = options.locationAccuracy;\n } else {\n out.locationAccuracy = 5;\n }\n\n if (options.requestAgent) {\n if (!isString(options.requestAgent)) {\n throw new Error(\"'options.requestAgent' expected a string value\");\n }\n\n out.requestAgent = options.requestAgent;\n }\n\n if (options.serverSideVerificationOptions) {\n if (!isObject(options.serverSideVerificationOptions)) {\n throw new Error(\n \"'options.serverSideVerificationOptions' expected an object of key/value pairs\",\n );\n }\n\n const ssvOptions = options.serverSideVerificationOptions;\n\n if (ssvOptions.userId && !isString(ssvOptions.userId)) {\n throw new Error(\"'options.serverSideVerificationOptions.userId' expected a string value\");\n }\n\n if (ssvOptions.customData && !isString(ssvOptions.customData)) {\n throw new Error(\"'options.serverSideVerificationOptions.customData' expected a string value\");\n }\n\n out.serverSideVerificationOptions = options.serverSideVerificationOptions;\n }\n\n return out;\n}\n"]}
1
+ {"version":3,"sources":["validateAdRequestOptions.ts"],"names":["hasOwnProperty","isArray","isBoolean","isNumber","isObject","isString","isUndefined","isValidUrl","validateAdRequestOptions","options","out","Error","requestNonPersonalizedAdsOnly","networkExtras","Object","entries","forEach","key","value","keywords","i","length","keyword","contentUrl","location","error","latitude","longitude","locationAccuracy","requestAgent","serverSideVerificationOptions","ssvOptions","userId","customData","customTargeting"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SACEA,cADF,EAEEC,OAFF,EAGEC,SAHF,EAIEC,QAJF,EAKEC,QALF,EAMEC,QANF,EAOEC,WAPF,EAQEC,UARF,QASO,UATP;AAYA,OAAO,SAASC,wBAAT,CAAkCC,OAAlC,EAA4D;AACjE,QAAMC,GAAmB,GAAG,EAA5B;;AAEA,MAAIJ,WAAW,CAACG,OAAD,CAAf,EAA0B;AACxB,WAAOC,GAAP;AACD;;AAED,MAAI,CAACN,QAAQ,CAACK,OAAD,CAAb,EAAwB;AACtB,UAAM,IAAIE,KAAJ,CAAU,oCAAV,CAAN;AACD;;AAED,MAAIX,cAAc,CAACS,OAAD,EAAU,+BAAV,CAAlB,EAA8D;AAC5D,QAAI,CAACP,SAAS,CAACO,OAAO,CAACG,6BAAT,CAAd,EAAuD;AACrD,YAAM,IAAID,KAAJ,CAAU,kEAAV,CAAN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EAAV,CAAN;AACD;;AACDD,IAAAA,GAAG,CAACwB,eAAJ,GAAsBzB,OAAO,CAACyB,eAA9B;AACD;;AAED,SAAOxB,GAAP;AACD","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\n hasOwnProperty,\n isArray,\n isBoolean,\n isNumber,\n isObject,\n isString,\n isUndefined,\n isValidUrl,\n} from './common';\nimport { RequestOptions } from './types/RequestOptions';\n\nexport function validateAdRequestOptions(options?: RequestOptions) {\n const out: RequestOptions = {};\n\n if (isUndefined(options)) {\n return out;\n }\n\n if (!isObject(options)) {\n throw new Error(\"'options' expected an object value\");\n }\n\n if (hasOwnProperty(options, 'requestNonPersonalizedAdsOnly')) {\n if (!isBoolean(options.requestNonPersonalizedAdsOnly)) {\n throw new Error(\"'options.requestNonPersonalizedAdsOnly' expected a boolean value\");\n }\n\n out.requestNonPersonalizedAdsOnly = options.requestNonPersonalizedAdsOnly;\n }\n\n if (options.networkExtras) {\n if (!isObject(options.networkExtras)) {\n throw new Error(\"'options.networkExtras' expected an object of key/value pairs\");\n }\n\n Object.entries(options.networkExtras).forEach(([key, value]) => {\n if (!isString(value)) {\n throw new Error(`'options.networkExtras' expected a string value for object key \"${key}\"`);\n }\n });\n\n out.networkExtras = options.networkExtras;\n }\n\n if (options.keywords) {\n if (!isArray(options.keywords)) {\n throw new Error(\"'options.keywords' expected an array containing string values\");\n }\n\n for (let i = 0; i < options.keywords.length; i++) {\n const keyword = options.keywords[i];\n\n if (!isString(keyword)) {\n throw new Error(\"'options.keywords' expected an array containing string values\");\n }\n }\n\n out.keywords = options.keywords;\n }\n\n if (options.contentUrl) {\n if (!isString(options.contentUrl)) {\n throw new Error(\"'options.contentUrl' expected a string value\");\n }\n\n if (!isValidUrl(options.contentUrl)) {\n throw new Error(\"'options.contentUrl' expected a valid HTTP or HTTPS url.\");\n }\n\n if (options.contentUrl.length > 512) {\n throw new Error(\"'options.contentUrl' maximum length of a content URL is 512 characters.\");\n }\n\n out.contentUrl = options.contentUrl;\n }\n\n if (options.location) {\n const error = new Error(\n \"'options.location' expected an array value containing a latitude & longitude number value.\",\n );\n\n if (!isArray(options.location)) {\n throw error;\n }\n\n const [latitude, longitude] = options.location;\n\n if (!isNumber(latitude) || !isNumber(longitude)) {\n throw error;\n }\n\n if (latitude < -90 || latitude > 90) {\n throw new Error(\n `'options.location' latitude value must be a number between -90 and 90, but was: ${latitude}`,\n );\n }\n\n if (longitude < -180 || longitude > 180) {\n throw new Error(\n `'options.location' longitude value must be a number between -180 and 180, but was: ${latitude}`,\n );\n }\n\n out.location = [latitude, longitude];\n }\n\n if (hasOwnProperty(options, 'locationAccuracy')) {\n if (!isNumber(options.locationAccuracy)) {\n throw new Error(\"'options.locationAccuracy' expected a number value.\");\n }\n\n if (isNumber(options.locationAccuracy) && options.locationAccuracy < 0) {\n throw new Error(\"'options.locationAccuracy' expected a number greater than 0.\");\n }\n\n out.locationAccuracy = options.locationAccuracy;\n } else {\n out.locationAccuracy = 5;\n }\n\n if (options.requestAgent) {\n if (!isString(options.requestAgent)) {\n throw new Error(\"'options.requestAgent' expected a string value\");\n }\n\n out.requestAgent = options.requestAgent;\n }\n\n if (options.serverSideVerificationOptions) {\n if (!isObject(options.serverSideVerificationOptions)) {\n throw new Error(\n \"'options.serverSideVerificationOptions' expected an object of key/value pairs\",\n );\n }\n\n const ssvOptions = options.serverSideVerificationOptions;\n\n if (ssvOptions.userId && !isString(ssvOptions.userId)) {\n throw new Error(\"'options.serverSideVerificationOptions.userId' expected a string value\");\n }\n\n if (ssvOptions.customData && !isString(ssvOptions.customData)) {\n throw new Error(\"'options.serverSideVerificationOptions.customData' expected a string value\");\n }\n\n out.serverSideVerificationOptions = options.serverSideVerificationOptions;\n }\n\n if (options.customTargeting) {\n if (!isObject(options.customTargeting)) {\n throw new Error(\"'options.customTargeting' expected an object of key/value pairs\");\n }\n out.customTargeting = options.customTargeting;\n }\n\n return out;\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  // generated by genversion
2
- export const version = '4.1.0';
2
+ export const version = '4.2.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '4.1.0';\n"]}
1
+ {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '4.2.0';\n"]}
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "4.1.0";
1
+ export declare const SDK_VERSION = "4.2.0";
2
2
  export { default, MobileAds } from './MobileAds';
3
3
  export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
4
4
  export { AdsConsentStatus } from './AdsConsentStatus';
@@ -61,6 +61,14 @@ export interface RequestOptions {
61
61
  * Max length of 512.
62
62
  */
63
63
  contentUrl?: string;
64
+ /**
65
+ * key-value pairs used for custom targeting
66
+ *
67
+ * Takes an array of string key/value pairs.
68
+ */
69
+ customTargeting?: {
70
+ [key: string]: string;
71
+ };
64
72
  /**
65
73
  * The latitude and longitude location of the user.
66
74
  *
@@ -1 +1 @@
1
- export declare const version = "4.1.0";
1
+ export declare const version = "4.2.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-google-mobile-ads",
3
- "version": "4.1.0",
3
+ "version": "4.2.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/AdsConsent.ts CHANGED
@@ -29,7 +29,7 @@ import { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
29
29
  import { AdsConsentStatus } from './AdsConsentStatus';
30
30
  import { AdsConsentInterface } from './types/AdsConsent.interface';
31
31
 
32
- const native = NativeModules.RNGoogleAdsConsentModule;
32
+ const native = NativeModules.RNGoogleMobileAdsConsentModule;
33
33
 
34
34
  export const AdsConsent: AdsConsentInterface = {
35
35
  /**
@@ -65,6 +65,13 @@ export interface RequestOptions {
65
65
  */
66
66
  contentUrl?: string;
67
67
 
68
+ /**
69
+ * key-value pairs used for custom targeting
70
+ *
71
+ * Takes an array of string key/value pairs.
72
+ */
73
+ customTargeting?: { [key: string]: string };
74
+
68
75
  /**
69
76
  * The latitude and longitude location of the user.
70
77
  *
@@ -164,5 +164,12 @@ export function validateAdRequestOptions(options?: RequestOptions) {
164
164
  out.serverSideVerificationOptions = options.serverSideVerificationOptions;
165
165
  }
166
166
 
167
+ if (options.customTargeting) {
168
+ if (!isObject(options.customTargeting)) {
169
+ throw new Error("'options.customTargeting' expected an object of key/value pairs");
170
+ }
171
+ out.customTargeting = options.customTargeting;
172
+ }
173
+
167
174
  return out;
168
175
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '4.1.0';
2
+ export const version = '4.2.0';