react-native-google-mobile-ads 4.1.2 → 5.0.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 (49) hide show
  1. package/RNGoogleMobileAds.podspec +16 -9
  2. package/__tests__/consent.test.ts +17 -9
  3. package/android/build.gradle +4 -3
  4. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsAppOpenModule.java +2 -5
  5. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsCommon.java +13 -2
  6. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsConsentModule.java +100 -171
  7. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsInterstitialModule.java +6 -5
  8. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsRewardedModule.java +3 -4
  9. package/docs/common-reasons-for-ads-not-showing.mdx +92 -0
  10. package/docs/european-user-consent.mdx +43 -161
  11. package/docs/index.mdx +3 -3
  12. package/docs/migrating-to-v5.mdx +54 -0
  13. package/docs.json +3 -1
  14. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m +1 -2
  15. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +1 -1
  16. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.m +6 -2
  17. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.h +0 -1
  18. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.m +71 -126
  19. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m +1 -2
  20. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.m +1 -2
  21. package/ios_config.sh +8 -0
  22. package/lib/commonjs/AdsConsent.js +29 -100
  23. package/lib/commonjs/AdsConsent.js.map +1 -1
  24. package/lib/commonjs/AdsConsentStatus.js +4 -3
  25. package/lib/commonjs/AdsConsentStatus.js.map +1 -1
  26. package/lib/commonjs/validateAdRequestOptions.js +8 -0
  27. package/lib/commonjs/validateAdRequestOptions.js.map +1 -1
  28. package/lib/commonjs/version.js +1 -1
  29. package/lib/commonjs/version.js.map +1 -1
  30. package/lib/module/AdsConsent.js +30 -100
  31. package/lib/module/AdsConsent.js.map +1 -1
  32. package/lib/module/AdsConsentStatus.js +4 -3
  33. package/lib/module/AdsConsentStatus.js.map +1 -1
  34. package/lib/module/validateAdRequestOptions.js +8 -0
  35. package/lib/module/validateAdRequestOptions.js.map +1 -1
  36. package/lib/module/version.js +1 -1
  37. package/lib/module/version.js.map +1 -1
  38. package/lib/typescript/AdsConsentStatus.d.ts +10 -6
  39. package/lib/typescript/index.d.ts +1 -1
  40. package/lib/typescript/types/AdsConsent.interface.d.ts +37 -204
  41. package/lib/typescript/types/RequestOptions.d.ts +8 -0
  42. package/lib/typescript/version.d.ts +1 -1
  43. package/package.json +5 -3
  44. package/src/AdsConsent.ts +36 -135
  45. package/src/AdsConsentStatus.ts +11 -6
  46. package/src/types/AdsConsent.interface.ts +37 -214
  47. package/src/types/RequestOptions.ts +7 -0
  48. package/src/validateAdRequestOptions.ts +7 -0
  49. package/src/version.ts +1 -1
@@ -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 =
package/ios_config.sh CHANGED
@@ -102,6 +102,14 @@ if [[ ${_SEARCH_RESULT} ]]; then
102
102
  _PLIST_ENTRY_TYPES+=("string")
103
103
  _PLIST_ENTRY_VALUES+=("$_IOS_APP_ID")
104
104
  fi
105
+
106
+ # config.user_tracking_usage_description
107
+ _USER_TRACKING_USAGE_DESCRIPTION=$(getJsonKeyValue "$_JSON_OUTPUT_RAW" "user_tracking_usage_description")
108
+ if [[ $_USER_TRACKING_USAGE_DESCRIPTION ]]; then
109
+ _PLIST_ENTRY_KEYS+=("NSUserTrackingUsageDescription")
110
+ _PLIST_ENTRY_TYPES+=("string")
111
+ _PLIST_ENTRY_VALUES+=("$_USER_TRACKING_USAGE_DESCRIPTION")
112
+ fi
105
113
  else
106
114
  _PLIST_ENTRY_KEYS+=("google_mobile_ads_json_raw")
107
115
  _PLIST_ENTRY_TYPES+=("string")
@@ -11,8 +11,6 @@ var _reactNative = require("react-native");
11
11
 
12
12
  var _AdsConsentDebugGeography = require("./AdsConsentDebugGeography");
13
13
 
14
- var _AdsConsentStatus = require("./AdsConsentStatus");
15
-
16
14
  /*
17
15
  * Copyright (c) 2016-present Invertase Limited & Contributors
18
16
  *
@@ -33,126 +31,57 @@ const native = _reactNative.NativeModules.RNGoogleMobileAdsConsentModule;
33
31
  const AdsConsent = {
34
32
  /**
35
33
  *
36
- * @param publisherIds
37
- * @returns {*}
38
- */
39
- requestInfoUpdate(publisherIds) {
40
- if (!(0, _common.isArray)(publisherIds)) {
41
- throw new Error("AdsConsent.requestInfoUpdate(*) 'publisherIds' expected an array of string values.");
42
- }
43
-
44
- if (publisherIds.length === 0) {
45
- throw new Error("AdsConsent.requestInfoUpdate(*) 'publisherIds' list of publisher IDs cannot be empty.");
46
- }
47
-
48
- for (let i = 0; i < publisherIds.length; i++) {
49
- if (!(0, _common.isString)(publisherIds[i])) {
50
- throw new Error(`AdsConsent.requestInfoUpdate(*) 'publisherIds[${i}]' expected a string value.`);
51
- }
52
- }
53
-
54
- return native.requestInfoUpdate(publisherIds);
55
- },
56
-
57
- /**
58
- *
59
- * @param options
60
- * @returns {*}
34
+ * @param {Object} [options]
35
+ * @param {AdsConsentDebugGeography} [options.debugGeography]
36
+ * @param {Boolean} [options.tagForUnderAgeOfConsent]
37
+ * @param {Array<String>} [options.testDeviceIdentifiers]
38
+ * @returns {{ status: Number, isConsentFormAvailable: Boolean }}
61
39
  */
62
- showForm(options) {
63
- if (!(0, _common.isUndefined)(options) && !(0, _common.isObject)(options)) {
64
- throw new Error("AdsConsent.showForm(*) 'options' expected an object value.");
65
- }
66
-
67
- if (!(0, _common.isValidUrl)(options.privacyPolicy)) {
68
- throw new Error("AdsConsent.showForm(*) 'options.privacyPolicy' expected a valid HTTP or HTTPS URL.");
69
- }
70
-
71
- if ((0, _common.hasOwnProperty)(options, 'withPersonalizedAds') && !(0, _common.isBoolean)(options.withPersonalizedAds)) {
72
- throw new Error("AdsConsent.showForm(*) 'options.withPersonalizedAds' expected a boolean value.");
73
- }
40
+ requestInfoUpdate() {
41
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
74
42
 
75
- if ((0, _common.hasOwnProperty)(options, 'withNonPersonalizedAds') && !(0, _common.isBoolean)(options.withNonPersonalizedAds)) {
76
- throw new Error("AdsConsent.showForm(*) 'options.withNonPersonalizedAds' expected a boolean value.");
43
+ if (!(0, _common.isObject)(options)) {
44
+ throw new Error("AdsConsent.requestInfoUpdate(*) 'options' expected an object value.");
77
45
  }
78
46
 
79
- if ((0, _common.hasOwnProperty)(options, 'withAdFree') && !(0, _common.isBoolean)(options.withAdFree)) {
80
- throw new Error("AdsConsent.showForm(*) 'options.withAdFree' expected a boolean value.");
47
+ if ((0, _common.hasOwnProperty)(options, 'debugGeography') && options.debugGeography !== _AdsConsentDebugGeography.AdsConsentDebugGeography.DISABLED && options.debugGeography !== _AdsConsentDebugGeography.AdsConsentDebugGeography.EEA && options.debugGeography !== _AdsConsentDebugGeography.AdsConsentDebugGeography.NOT_EEA) {
48
+ throw new Error("AdsConsent.requestInfoUpdate(*) 'options.debugGeography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.");
81
49
  }
82
50
 
83
- if (!options.withPersonalizedAds && !options.withNonPersonalizedAds && !options.withAdFree) {
84
- throw new Error("AdsConsent.showForm(*) 'options' form requires at least one option to be enabled.");
51
+ if ((0, _common.hasOwnProperty)(options, 'tagForUnderAgeOfConsent') && !(0, _common.isBoolean)(options.tagForUnderAgeOfConsent)) {
52
+ throw new Error("AdsConsent.requestInfoUpdate(*) 'options.tagForUnderAgeOfConsent' expected a boolean value.");
85
53
  }
86
54
 
87
- return native.showForm(options);
88
- },
89
-
90
- /**
91
- *
92
- */
93
- getAdProviders() {
94
- return native.getAdProviders();
95
- },
96
-
97
- /**
98
- *
99
- * @param geography
100
- */
101
- setDebugGeography(geography) {
102
- if (geography !== _AdsConsentDebugGeography.AdsConsentDebugGeography.DISABLED && geography !== _AdsConsentDebugGeography.AdsConsentDebugGeography.EEA && geography !== _AdsConsentDebugGeography.AdsConsentDebugGeography.NOT_EEA) {
103
- throw new Error("AdsConsent.setDebugGeography(*) 'geography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.");
104
- }
105
-
106
- return native.setDebugGeography(geography);
107
- },
55
+ if ((0, _common.hasOwnProperty)(options, 'testDeviceIdentifiers')) {
56
+ if (!(0, _common.isArray)(options.testDeviceIdentifiers)) {
57
+ throw new Error("AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.");
58
+ }
108
59
 
109
- /**
110
- *
111
- */
112
- getStatus() {
113
- return native.getStatus();
114
- },
60
+ for (const deviceId of (_options$testDeviceId = options.testDeviceIdentifiers) !== null && _options$testDeviceId !== void 0 ? _options$testDeviceId : []) {
61
+ var _options$testDeviceId;
115
62
 
116
- /**
117
- *
118
- * @param status
119
- */
120
- setStatus(status) {
121
- if (status !== _AdsConsentStatus.AdsConsentStatus.UNKNOWN && status !== _AdsConsentStatus.AdsConsentStatus.NON_PERSONALIZED && status !== _AdsConsentStatus.AdsConsentStatus.PERSONALIZED) {
122
- throw new Error("AdsConsent.setStatus(*) 'status' expected one of AdsConsentStatus.UNKNOWN, AdsConsentStatus.NON_PERSONALIZED or AdsConsentStatus.PERSONALIZED.");
63
+ if (!(0, _common.isString)(deviceId)) {
64
+ throw new Error("AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.");
65
+ }
66
+ }
123
67
  }
124
68
 
125
- return native.setStatus(status);
69
+ return native.requestInfoUpdate(options);
126
70
  },
127
71
 
128
72
  /**
129
73
  *
130
- * @param tag
74
+ * @returns {{ status: Number }}
131
75
  */
132
- setTagForUnderAgeOfConsent(tag) {
133
- if (!(0, _common.isBoolean)(tag)) {
134
- throw new Error("AdsConsent.setTagForUnderAgeOfConsent(*) 'tag' expected a boolean value.");
135
- }
136
-
137
- return native.setTagForUnderAgeOfConsent(tag);
76
+ showForm() {
77
+ return native.showForm();
138
78
  },
139
79
 
140
80
  /**
141
81
  *
142
- * @param deviceIds
143
82
  */
144
- addTestDevices(deviceIds) {
145
- if (!(0, _common.isArray)(deviceIds)) {
146
- throw new Error("AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.");
147
- }
148
-
149
- for (let i = 0; i < deviceIds.length; i++) {
150
- if (!(0, _common.isString)(deviceIds[i])) {
151
- throw new Error("AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.");
152
- }
153
- }
154
-
155
- return native.addTestDevices(deviceIds);
83
+ reset() {
84
+ return native.reset();
156
85
  }
157
86
 
158
87
  };
@@ -1 +1 @@
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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P,CAAiBC,MAAjB,CAAP;AACD,GA1H4C;;AA4H7C;AACF;AACA;AACA;AACEK,EAAAA,0BAA0B,CAACC,GAAD,EAAM;AAC9B,QAAI,CAAC,uBAAUA,GAAV,CAAL,EAAqB;AACnB,YAAM,IAAIxB,KAAJ,CAAU,0EAAV,CAAN;AACD;;AAED,WAAON,MAAM,CAAC6B,0BAAP,CAAkCC,GAAlC,CAAP;AACD,GAtI4C;;AAwI7C;AACF;AACA;AACA;AACEC,EAAAA,cAAc,CAACC,SAAD,EAAY;AACxB,QAAI,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"]}
1
+ {"version":3,"sources":["AdsConsent.ts"],"names":["native","NativeModules","RNGoogleMobileAdsConsentModule","AdsConsent","requestInfoUpdate","options","Error","debugGeography","AdsConsentDebugGeography","DISABLED","EEA","NOT_EEA","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CAAP;AACD,GAnD4C;;AAqD7C;AACF;AACA;AACA;AACEU,EAAAA,QAAQ,GAAG;AACT,WAAOf,MAAM,CAACe,QAAP,EAAP;AACD,GA3D4C;;AA6D7C;AACF;AACA;AACEC,EAAAA,KAAK,GAAG;AACN,WAAOhB,MAAM,CAACgB,KAAP,EAAP;AACD;;AAlE4C,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 { hasOwnProperty, isArray, isBoolean, isObject, isString } from './common';\nimport { NativeModules } from 'react-native';\nimport { AdsConsentDebugGeography } from './AdsConsentDebugGeography';\nimport { AdsConsentInterface } from './types/AdsConsent.interface';\n\nconst native = NativeModules.RNGoogleMobileAdsConsentModule;\n\nexport const AdsConsent: AdsConsentInterface = {\n /**\n *\n * @param {Object} [options]\n * @param {AdsConsentDebugGeography} [options.debugGeography]\n * @param {Boolean} [options.tagForUnderAgeOfConsent]\n * @param {Array<String>} [options.testDeviceIdentifiers]\n * @returns {{ status: Number, isConsentFormAvailable: Boolean }}\n */\n requestInfoUpdate(options = {}) {\n if (!isObject(options)) {\n throw new Error(\"AdsConsent.requestInfoUpdate(*) 'options' expected an object value.\");\n }\n\n if (\n hasOwnProperty(options, 'debugGeography') &&\n options.debugGeography !== AdsConsentDebugGeography.DISABLED &&\n options.debugGeography !== AdsConsentDebugGeography.EEA &&\n options.debugGeography !== AdsConsentDebugGeography.NOT_EEA\n ) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'options.debugGeography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.\",\n );\n }\n\n if (\n hasOwnProperty(options, 'tagForUnderAgeOfConsent') &&\n !isBoolean(options.tagForUnderAgeOfConsent)\n ) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'options.tagForUnderAgeOfConsent' expected a boolean value.\",\n );\n }\n\n if (hasOwnProperty(options, 'testDeviceIdentifiers')) {\n if (!isArray(options.testDeviceIdentifiers)) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.\",\n );\n }\n\n for (const deviceId of options.testDeviceIdentifiers ?? []) {\n if (!isString(deviceId)) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.\",\n );\n }\n }\n }\n\n return native.requestInfoUpdate(options);\n },\n\n /**\n *\n * @returns {{ status: Number }}\n */\n showForm() {\n return native.showForm();\n },\n\n /**\n *\n */\n reset() {\n return native.reset();\n },\n};\n"]}
@@ -29,8 +29,9 @@ let AdsConsentStatus;
29
29
  exports.AdsConsentStatus = AdsConsentStatus;
30
30
 
31
31
  (function (AdsConsentStatus) {
32
- AdsConsentStatus[AdsConsentStatus["UNKNOWN"] = 0] = "UNKNOWN";
33
- AdsConsentStatus[AdsConsentStatus["NON_PERSONALIZED"] = 1] = "NON_PERSONALIZED";
34
- AdsConsentStatus[AdsConsentStatus["PERSONALIZED"] = 2] = "PERSONALIZED";
32
+ AdsConsentStatus["UNKNOWN"] = "UNKNOWN";
33
+ AdsConsentStatus["REQUIRED"] = "REQUIRED";
34
+ AdsConsentStatus["NOT_REQUIRED"] = "NOT_REQUIRED";
35
+ AdsConsentStatus["OBTAINED"] = "OBTAINED";
35
36
  })(AdsConsentStatus || (exports.AdsConsentStatus = AdsConsentStatus = {}));
36
37
  //# sourceMappingURL=AdsConsentStatus.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["AdsConsentStatus.ts"],"names":["AdsConsentStatus"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;IACYA,gB;;;WAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;GAAAA,gB,gCAAAA,gB","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\n/**\n * AdsConsentStatus enum.\n */\nexport enum AdsConsentStatus {\n /**\n * The consent status is unknown and the user must provide consent to show ads if they are within the EEA or location is also unknown.\n */\n UNKNOWN = 0,\n\n /**\n * The user has accepted non-personalized ads.\n */\n NON_PERSONALIZED = 1,\n\n /**\n * The user has accepted personalized ads.\n */\n PERSONALIZED = 2,\n}\n"]}
1
+ {"version":3,"sources":["AdsConsentStatus.ts"],"names":["AdsConsentStatus"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;IACYA,gB;;;WAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,gCAAAA,gB","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\n/**\n * AdsConsentStatus enum.\n */\nexport enum AdsConsentStatus {\n /**\n * Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it.\n */\n UNKNOWN = 'UNKNOWN',\n\n /**\n * User consent required but not yet obtained.\n */\n REQUIRED = 'REQUIRED',\n\n /**\n * User consent not required.\n */\n NOT_REQUIRED = 'NOT_REQUIRED',\n\n /**\n * User consent already obtained.\n */\n OBTAINED = 'OBTAINED',\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","serverSideVerificationOptions","ssvOptions","userId","customData"],"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,oCAA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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;AACD;;AAEDG,IAAAA,MAAM,CAACC,OAAP,CAAeN,OAAO,CAACI,aAAvB,EAAsCG,OAAtC,CAA8C,QAAkB;AAAA,UAAjB,CAACC,GAAD,EAAMC,KAAN,CAAiB;;AAC9D,UAAI,CAAC,sBAASA,KAAT,CAAL,EAAsB;AACpB,cAAM,IAAIP,KAAJ,CAAW,mEAAkEM,GAAI,GAAjF,CAAN;AACD;AACF,KAJD;AAMAP,IAAAA,GAAG,CAACG,aAAJ,GAAoBJ,OAAO,CAACI,aAA5B;AACD;;AAED,MAAIJ,OA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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.2';
8
+ const version = '5.0.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.2';\n"]}
1
+ {"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '5.0.0';\n"]}
@@ -14,134 +14,64 @@
14
14
  * limitations under the License.
15
15
  *
16
16
  */
17
- import { hasOwnProperty, isArray, isBoolean, isObject, isString, isUndefined, isValidUrl } from './common';
17
+ import { hasOwnProperty, isArray, isBoolean, isObject, isString } from './common';
18
18
  import { NativeModules } from 'react-native';
19
19
  import { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
20
- import { AdsConsentStatus } from './AdsConsentStatus';
21
20
  const native = NativeModules.RNGoogleMobileAdsConsentModule;
22
21
  export const AdsConsent = {
23
22
  /**
24
23
  *
25
- * @param publisherIds
26
- * @returns {*}
24
+ * @param {Object} [options]
25
+ * @param {AdsConsentDebugGeography} [options.debugGeography]
26
+ * @param {Boolean} [options.tagForUnderAgeOfConsent]
27
+ * @param {Array<String>} [options.testDeviceIdentifiers]
28
+ * @returns {{ status: Number, isConsentFormAvailable: Boolean }}
27
29
  */
28
- requestInfoUpdate(publisherIds) {
29
- if (!isArray(publisherIds)) {
30
- throw new Error("AdsConsent.requestInfoUpdate(*) 'publisherIds' expected an array of string values.");
31
- }
32
-
33
- if (publisherIds.length === 0) {
34
- throw new Error("AdsConsent.requestInfoUpdate(*) 'publisherIds' list of publisher IDs cannot be empty.");
35
- }
36
-
37
- for (let i = 0; i < publisherIds.length; i++) {
38
- if (!isString(publisherIds[i])) {
39
- throw new Error(`AdsConsent.requestInfoUpdate(*) 'publisherIds[${i}]' expected a string value.`);
40
- }
41
- }
30
+ requestInfoUpdate() {
31
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
42
32
 
43
- return native.requestInfoUpdate(publisherIds);
44
- },
45
-
46
- /**
47
- *
48
- * @param options
49
- * @returns {*}
50
- */
51
- showForm(options) {
52
- if (!isUndefined(options) && !isObject(options)) {
53
- throw new Error("AdsConsent.showForm(*) 'options' expected an object value.");
33
+ if (!isObject(options)) {
34
+ throw new Error("AdsConsent.requestInfoUpdate(*) 'options' expected an object value.");
54
35
  }
55
36
 
56
- if (!isValidUrl(options.privacyPolicy)) {
57
- throw new Error("AdsConsent.showForm(*) 'options.privacyPolicy' expected a valid HTTP or HTTPS URL.");
37
+ if (hasOwnProperty(options, 'debugGeography') && options.debugGeography !== AdsConsentDebugGeography.DISABLED && options.debugGeography !== AdsConsentDebugGeography.EEA && options.debugGeography !== AdsConsentDebugGeography.NOT_EEA) {
38
+ throw new Error("AdsConsent.requestInfoUpdate(*) 'options.debugGeography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.");
58
39
  }
59
40
 
60
- if (hasOwnProperty(options, 'withPersonalizedAds') && !isBoolean(options.withPersonalizedAds)) {
61
- throw new Error("AdsConsent.showForm(*) 'options.withPersonalizedAds' expected a boolean value.");
62
- }
63
-
64
- if (hasOwnProperty(options, 'withNonPersonalizedAds') && !isBoolean(options.withNonPersonalizedAds)) {
65
- throw new Error("AdsConsent.showForm(*) 'options.withNonPersonalizedAds' expected a boolean value.");
66
- }
67
-
68
- if (hasOwnProperty(options, 'withAdFree') && !isBoolean(options.withAdFree)) {
69
- throw new Error("AdsConsent.showForm(*) 'options.withAdFree' expected a boolean value.");
70
- }
71
-
72
- if (!options.withPersonalizedAds && !options.withNonPersonalizedAds && !options.withAdFree) {
73
- throw new Error("AdsConsent.showForm(*) 'options' form requires at least one option to be enabled.");
74
- }
75
-
76
- return native.showForm(options);
77
- },
78
-
79
- /**
80
- *
81
- */
82
- getAdProviders() {
83
- return native.getAdProviders();
84
- },
85
-
86
- /**
87
- *
88
- * @param geography
89
- */
90
- setDebugGeography(geography) {
91
- if (geography !== AdsConsentDebugGeography.DISABLED && geography !== AdsConsentDebugGeography.EEA && geography !== AdsConsentDebugGeography.NOT_EEA) {
92
- throw new Error("AdsConsent.setDebugGeography(*) 'geography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.");
41
+ if (hasOwnProperty(options, 'tagForUnderAgeOfConsent') && !isBoolean(options.tagForUnderAgeOfConsent)) {
42
+ throw new Error("AdsConsent.requestInfoUpdate(*) 'options.tagForUnderAgeOfConsent' expected a boolean value.");
93
43
  }
94
44
 
95
- return native.setDebugGeography(geography);
96
- },
45
+ if (hasOwnProperty(options, 'testDeviceIdentifiers')) {
46
+ if (!isArray(options.testDeviceIdentifiers)) {
47
+ throw new Error("AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.");
48
+ }
97
49
 
98
- /**
99
- *
100
- */
101
- getStatus() {
102
- return native.getStatus();
103
- },
50
+ for (const deviceId of (_options$testDeviceId = options.testDeviceIdentifiers) !== null && _options$testDeviceId !== void 0 ? _options$testDeviceId : []) {
51
+ var _options$testDeviceId;
104
52
 
105
- /**
106
- *
107
- * @param status
108
- */
109
- setStatus(status) {
110
- if (status !== AdsConsentStatus.UNKNOWN && status !== AdsConsentStatus.NON_PERSONALIZED && status !== AdsConsentStatus.PERSONALIZED) {
111
- throw new Error("AdsConsent.setStatus(*) 'status' expected one of AdsConsentStatus.UNKNOWN, AdsConsentStatus.NON_PERSONALIZED or AdsConsentStatus.PERSONALIZED.");
53
+ if (!isString(deviceId)) {
54
+ throw new Error("AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.");
55
+ }
56
+ }
112
57
  }
113
58
 
114
- return native.setStatus(status);
59
+ return native.requestInfoUpdate(options);
115
60
  },
116
61
 
117
62
  /**
118
63
  *
119
- * @param tag
64
+ * @returns {{ status: Number }}
120
65
  */
121
- setTagForUnderAgeOfConsent(tag) {
122
- if (!isBoolean(tag)) {
123
- throw new Error("AdsConsent.setTagForUnderAgeOfConsent(*) 'tag' expected a boolean value.");
124
- }
125
-
126
- return native.setTagForUnderAgeOfConsent(tag);
66
+ showForm() {
67
+ return native.showForm();
127
68
  },
128
69
 
129
70
  /**
130
71
  *
131
- * @param deviceIds
132
72
  */
133
- addTestDevices(deviceIds) {
134
- if (!isArray(deviceIds)) {
135
- throw new Error("AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.");
136
- }
137
-
138
- for (let i = 0; i < deviceIds.length; i++) {
139
- if (!isString(deviceIds[i])) {
140
- throw new Error("AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.");
141
- }
142
- }
143
-
144
- return native.addTestDevices(deviceIds);
73
+ reset() {
74
+ return native.reset();
145
75
  }
146
76
 
147
77
  };
@@ -1 +1 @@
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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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.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"]}
1
+ {"version":3,"sources":["AdsConsent.ts"],"names":["hasOwnProperty","isArray","isBoolean","isObject","isString","NativeModules","AdsConsentDebugGeography","native","RNGoogleMobileAdsConsentModule","AdsConsent","requestInfoUpdate","options","Error","debugGeography","DISABLED","EEA","NOT_EEA","tagForUnderAgeOfConsent","testDeviceIdentifiers","deviceId","showForm","reset"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,cAAT,EAAyBC,OAAzB,EAAkCC,SAAlC,EAA6CC,QAA7C,EAAuDC,QAAvD,QAAuE,UAAvE;AACA,SAASC,aAAT,QAA8B,cAA9B;A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GAAG;AACT,WAAOb,MAAM,CAACa,QAAP,EAAP;AACD,GA3D4C;;AA6D7C;AACF;AACA;AACEC,EAAAA,KAAK,GAAG;AACN,WAAOd,MAAM,CAACc,KAAP,EAAP;AACD;;AAlE4C,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 { hasOwnProperty, isArray, isBoolean, isObject, isString } from './common';\nimport { NativeModules } from 'react-native';\nimport { AdsConsentDebugGeography } from './AdsConsentDebugGeography';\nimport { AdsConsentInterface } from './types/AdsConsent.interface';\n\nconst native = NativeModules.RNGoogleMobileAdsConsentModule;\n\nexport const AdsConsent: AdsConsentInterface = {\n /**\n *\n * @param {Object} [options]\n * @param {AdsConsentDebugGeography} [options.debugGeography]\n * @param {Boolean} [options.tagForUnderAgeOfConsent]\n * @param {Array<String>} [options.testDeviceIdentifiers]\n * @returns {{ status: Number, isConsentFormAvailable: Boolean }}\n */\n requestInfoUpdate(options = {}) {\n if (!isObject(options)) {\n throw new Error(\"AdsConsent.requestInfoUpdate(*) 'options' expected an object value.\");\n }\n\n if (\n hasOwnProperty(options, 'debugGeography') &&\n options.debugGeography !== AdsConsentDebugGeography.DISABLED &&\n options.debugGeography !== AdsConsentDebugGeography.EEA &&\n options.debugGeography !== AdsConsentDebugGeography.NOT_EEA\n ) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'options.debugGeography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.\",\n );\n }\n\n if (\n hasOwnProperty(options, 'tagForUnderAgeOfConsent') &&\n !isBoolean(options.tagForUnderAgeOfConsent)\n ) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'options.tagForUnderAgeOfConsent' expected a boolean value.\",\n );\n }\n\n if (hasOwnProperty(options, 'testDeviceIdentifiers')) {\n if (!isArray(options.testDeviceIdentifiers)) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.\",\n );\n }\n\n for (const deviceId of options.testDeviceIdentifiers ?? []) {\n if (!isString(deviceId)) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.\",\n );\n }\n }\n }\n\n return native.requestInfoUpdate(options);\n },\n\n /**\n *\n * @returns {{ status: Number }}\n */\n showForm() {\n return native.showForm();\n },\n\n /**\n *\n */\n reset() {\n return native.reset();\n },\n};\n"]}
@@ -21,8 +21,9 @@
21
21
  export let AdsConsentStatus;
22
22
 
23
23
  (function (AdsConsentStatus) {
24
- AdsConsentStatus[AdsConsentStatus["UNKNOWN"] = 0] = "UNKNOWN";
25
- AdsConsentStatus[AdsConsentStatus["NON_PERSONALIZED"] = 1] = "NON_PERSONALIZED";
26
- AdsConsentStatus[AdsConsentStatus["PERSONALIZED"] = 2] = "PERSONALIZED";
24
+ AdsConsentStatus["UNKNOWN"] = "UNKNOWN";
25
+ AdsConsentStatus["REQUIRED"] = "REQUIRED";
26
+ AdsConsentStatus["NOT_REQUIRED"] = "NOT_REQUIRED";
27
+ AdsConsentStatus["OBTAINED"] = "OBTAINED";
27
28
  })(AdsConsentStatus || (AdsConsentStatus = {}));
28
29
  //# sourceMappingURL=AdsConsentStatus.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["AdsConsentStatus.ts"],"names":["AdsConsentStatus"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAYA,gBAAZ;;WAAYA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;AAAAA,EAAAA,gB,CAAAA,gB;GAAAA,gB,KAAAA,gB","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\n/**\n * AdsConsentStatus enum.\n */\nexport enum AdsConsentStatus {\n /**\n * The consent status is unknown and the user must provide consent to show ads if they are within the EEA or location is also unknown.\n */\n UNKNOWN = 0,\n\n /**\n * The user has accepted non-personalized ads.\n */\n NON_PERSONALIZED = 1,\n\n /**\n * The user has accepted personalized ads.\n */\n PERSONALIZED = 2,\n}\n"]}
1
+ {"version":3,"sources":["AdsConsentStatus.ts"],"names":["AdsConsentStatus"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAYA,gBAAZ;;WAAYA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,KAAAA,gB","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\n/**\n * AdsConsentStatus enum.\n */\nexport enum AdsConsentStatus {\n /**\n * Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it.\n */\n UNKNOWN = 'UNKNOWN',\n\n /**\n * User consent required but not yet obtained.\n */\n REQUIRED = 'REQUIRED',\n\n /**\n * User consent not required.\n */\n NOT_REQUIRED = 'NOT_REQUIRED',\n\n /**\n * User consent already obtained.\n */\n OBTAINED = 'OBTAINED',\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