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.
@@ -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;;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,YAA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AAP;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","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;A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016-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"]}
@@ -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.2.0';
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.2.0';\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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G4C;;AA0G7C;AACF;AACA;AACA;AACEC,EAAAA,SAAS,CAACC,MAAD,EAAS;AAChB,QACEA,MAAM,KAAKvB,gBAAgB,CAACwB,OAA5B,IACAD,MAAM,KAAKvB,gBAAgB,CAACyB,gBAD5B,IAEAF,MAAM,KAAKvB,gBAAgB,CAAC0B,YAH9B,EAIE;AACA,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.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;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[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"]}
@@ -1,3 +1,3 @@
1
1
  // generated by genversion
2
- export const version = '4.2.0';
2
+ export const version = '5.0.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.2.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 = '5.0.0';\n"]}
@@ -3,15 +3,19 @@
3
3
  */
4
4
  export declare enum AdsConsentStatus {
5
5
  /**
6
- * 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.
6
+ * Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it.
7
7
  */
8
- UNKNOWN = 0,
8
+ UNKNOWN = "UNKNOWN",
9
9
  /**
10
- * The user has accepted non-personalized ads.
10
+ * User consent required but not yet obtained.
11
11
  */
12
- NON_PERSONALIZED = 1,
12
+ REQUIRED = "REQUIRED",
13
13
  /**
14
- * The user has accepted personalized ads.
14
+ * User consent not required.
15
15
  */
16
- PERSONALIZED = 2
16
+ NOT_REQUIRED = "NOT_REQUIRED",
17
+ /**
18
+ * User consent already obtained.
19
+ */
20
+ OBTAINED = "OBTAINED"
17
21
  }
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "4.2.0";
1
+ export declare const SDK_VERSION = "5.0.0";
2
2
  export { default, MobileAds } from './MobileAds';
3
3
  export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
4
4
  export { AdsConsentStatus } from './AdsConsentStatus';