react-native-google-mobile-ads 4.2.0 → 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.
- package/RNGoogleMobileAds.podspec +16 -9
- package/__tests__/consent.test.ts +17 -9
- package/android/build.gradle +4 -3
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsConsentModule.java +100 -171
- package/docs/european-user-consent.mdx +43 -161
- package/docs/index.mdx +3 -3
- package/docs/migrating-to-v5.mdx +54 -0
- package/docs.json +2 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.h +0 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.m +71 -126
- package/ios_config.sh +8 -0
- package/lib/commonjs/AdsConsent.js +29 -100
- package/lib/commonjs/AdsConsent.js.map +1 -1
- package/lib/commonjs/AdsConsentStatus.js +4 -3
- package/lib/commonjs/AdsConsentStatus.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/AdsConsent.js +30 -100
- package/lib/module/AdsConsent.js.map +1 -1
- package/lib/module/AdsConsentStatus.js +4 -3
- package/lib/module/AdsConsentStatus.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/AdsConsentStatus.d.ts +10 -6
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/types/AdsConsent.interface.d.ts +37 -204
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +5 -3
- package/src/AdsConsent.ts +36 -135
- package/src/AdsConsentStatus.ts +11 -6
- package/src/types/AdsConsent.interface.ts +37 -214
- package/src/version.ts +1 -1
|
@@ -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
|
|
37
|
-
* @
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
63
|
-
|
|
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 (
|
|
76
|
-
throw new Error("AdsConsent.
|
|
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, '
|
|
80
|
-
throw new Error("AdsConsent.
|
|
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 (
|
|
84
|
-
throw new Error("AdsConsent.
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
69
|
+
return native.requestInfoUpdate(options);
|
|
126
70
|
},
|
|
127
71
|
|
|
128
72
|
/**
|
|
129
73
|
*
|
|
130
|
-
* @
|
|
74
|
+
* @returns {{ status: Number }}
|
|
131
75
|
*/
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
145
|
-
|
|
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","
|
|
1
|
+
{"version":3,"sources":["AdsConsent.ts"],"names":["native","NativeModules","RNGoogleMobileAdsConsentModule","AdsConsent","requestInfoUpdate","options","Error","debugGeography","AdsConsentDebugGeography","DISABLED","EEA","NOT_EEA","tagForUnderAgeOfConsent","testDeviceIdentifiers","deviceId","showForm","reset"],"mappings":";;;;;;;AAiBA;;AACA;;AACA;;AAnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA,MAAMA,MAAM,GAAGC,2BAAcC,8BAA7B;AAEO,MAAMC,UAA+B,GAAG;AAC7C;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,iBAAiB,GAAe;AAAA,QAAdC,OAAc,uEAAJ,EAAI;;AAC9B,QAAI,CAAC,sBAASA,OAAT,CAAL,EAAwB;AACtB,YAAM,IAAIC,KAAJ,CAAU,qEAAV,CAAN;AACD;;AAED,QACE,4BAAeD,OAAf,EAAwB,gBAAxB,KACAA,OAAO,CAACE,cAAR,KAA2BC,mDAAyBC,QADpD,IAEAJ,OAAO,CAACE,cAAR,KAA2BC,mDAAyBE,GAFpD,IAGAL,OAAO,CAACE,cAAR,KAA2BC,mDAAyBG,OAJtD,EAKE;AACA,YAAM,IAAIL,KAAJ,CACJ,+KADI,CAAN;AAGD;;AAED,QACE,4BAAeD,OAAf,EAAwB,yBAAxB,KACA,CAAC,uBAAUA,OAAO,CAACO,uBAAlB,CAFH,EAGE;AACA,YAAM,IAAIN,KAAJ,CACJ,6FADI,CAAN;AAGD;;AAED,QAAI,4BAAeD,OAAf,EAAwB,uBAAxB,CAAJ,EAAsD;AACpD,UAAI,CAAC,qBAAQA,OAAO,CAACQ,qBAAhB,CAAL,EAA6C;AAC3C,cAAM,IAAIP,KAAJ,CACJ,qGADI,CAAN;AAGD;;AAED,WAAK,MAAMQ,QAAX,6BAAuBT,OAAO,CAACQ,qBAA/B,yEAAwD,EAAxD,EAA4D;AAAA;;AAC1D,YAAI,CAAC,sBAASC,QAAT,CAAL,EAAyB;AACvB,gBAAM,IAAIR,KAAJ,CACJ,qGADI,CAAN;AAGD;AACF;AACF;;AAED,WAAON,MAAM,CAACI,iBAAP,CAAyBC,OAAzB,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[
|
|
33
|
-
AdsConsentStatus[
|
|
34
|
-
AdsConsentStatus[
|
|
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,
|
|
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"]}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '
|
|
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"]}
|
package/lib/module/AdsConsent.js
CHANGED
|
@@ -14,134 +14,64 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
|
-
import { hasOwnProperty, isArray, isBoolean, isObject, isString
|
|
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
|
|
26
|
-
* @
|
|
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(
|
|
29
|
-
|
|
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
|
-
|
|
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 (
|
|
57
|
-
throw new Error("AdsConsent.
|
|
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, '
|
|
61
|
-
throw new Error("AdsConsent.
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
59
|
+
return native.requestInfoUpdate(options);
|
|
115
60
|
},
|
|
116
61
|
|
|
117
62
|
/**
|
|
118
63
|
*
|
|
119
|
-
* @
|
|
64
|
+
* @returns {{ status: Number }}
|
|
120
65
|
*/
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
|
|
134
|
-
|
|
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","
|
|
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;AACA,SAASC,wBAAT,QAAyC,4BAAzC;AAGA,MAAMC,MAAM,GAAGF,aAAa,CAACG,8BAA7B;AAEA,OAAO,MAAMC,UAA+B,GAAG;AAC7C;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,iBAAiB,GAAe;AAAA,QAAdC,OAAc,uEAAJ,EAAI;;AAC9B,QAAI,CAACR,QAAQ,CAACQ,OAAD,CAAb,EAAwB;AACtB,YAAM,IAAIC,KAAJ,CAAU,qEAAV,CAAN;AACD;;AAED,QACEZ,cAAc,CAACW,OAAD,EAAU,gBAAV,CAAd,IACAA,OAAO,CAACE,cAAR,KAA2BP,wBAAwB,CAACQ,QADpD,IAEAH,OAAO,CAACE,cAAR,KAA2BP,wBAAwB,CAACS,GAFpD,IAGAJ,OAAO,CAACE,cAAR,KAA2BP,wBAAwB,CAACU,OAJtD,EAKE;AACA,YAAM,IAAIJ,KAAJ,CACJ,+KADI,CAAN;AAGD;;AAED,QACEZ,cAAc,CAACW,OAAD,EAAU,yBAAV,CAAd,IACA,CAACT,SAAS,CAACS,OAAO,CAACM,uBAAT,CAFZ,EAGE;AACA,YAAM,IAAIL,KAAJ,CACJ,6FADI,CAAN;AAGD;;AAED,QAAIZ,cAAc,CAACW,OAAD,EAAU,uBAAV,CAAlB,EAAsD;AACpD,UAAI,CAACV,OAAO,CAACU,OAAO,CAACO,qBAAT,CAAZ,EAA6C;AAC3C,cAAM,IAAIN,KAAJ,CACJ,qGADI,CAAN;AAGD;;AAED,WAAK,MAAMO,QAAX,6BAAuBR,OAAO,CAACO,qBAA/B,yEAAwD,EAAxD,EAA4D;AAAA;;AAC1D,YAAI,CAACd,QAAQ,CAACe,QAAD,CAAb,EAAyB;AACvB,gBAAM,IAAIP,KAAJ,CACJ,qGADI,CAAN;AAGD;AACF;AACF;;AAED,WAAOL,MAAM,CAACG,iBAAP,CAAyBC,OAAzB,CAAP;AACD,GAnD4C;;AAqD7C;AACF;AACA;AACA;AACES,EAAAA,QAAQ,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[
|
|
25
|
-
AdsConsentStatus[
|
|
26
|
-
AdsConsentStatus[
|
|
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,
|
|
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"]}
|
package/lib/module/version.js
CHANGED
|
@@ -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 = '
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '5.0.0';\n"]}
|
|
@@ -3,15 +3,19 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare enum AdsConsentStatus {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it.
|
|
7
7
|
*/
|
|
8
|
-
UNKNOWN =
|
|
8
|
+
UNKNOWN = "UNKNOWN",
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* User consent required but not yet obtained.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
REQUIRED = "REQUIRED",
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* User consent not required.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
NOT_REQUIRED = "NOT_REQUIRED",
|
|
17
|
+
/**
|
|
18
|
+
* User consent already obtained.
|
|
19
|
+
*/
|
|
20
|
+
OBTAINED = "OBTAINED"
|
|
17
21
|
}
|