react-native-google-mobile-ads 14.5.0 → 14.7.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 (86) hide show
  1. package/README.md +14 -14
  2. package/__tests__/consent.test.ts +1 -1
  3. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeAppModule.java +0 -28
  4. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt +13 -0
  5. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.h +13 -2
  6. package/ios/RNGoogleMobileAds/{RNGoogleMobileAdsConsentModule.m → RNGoogleMobileAdsConsentModule.mm} +114 -27
  7. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.mm +17 -0
  8. package/ios/RNGoogleMobileAds/common/{RNAppModule.m → RNAppModule.mm} +0 -76
  9. package/ios/RNGoogleMobileAds/common/RNSharedUtils.h +0 -4
  10. package/ios/RNGoogleMobileAds/common/{RNSharedUtils.m → RNSharedUtils.mm} +0 -21
  11. package/lib/commonjs/AdsConsent.js +17 -17
  12. package/lib/commonjs/AdsConsent.js.map +1 -1
  13. package/lib/commonjs/common/constants.js +4 -3
  14. package/lib/commonjs/common/constants.js.map +1 -1
  15. package/lib/commonjs/index.js +34 -8
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/commonjs/specs/modules/NativeConsentModule.js +69 -0
  18. package/lib/commonjs/specs/modules/NativeConsentModule.js.map +1 -0
  19. package/lib/commonjs/specs/modules/NativeGoogleMobileAdsModule.js.map +1 -1
  20. package/lib/commonjs/types/index.js +0 -11
  21. package/lib/commonjs/types/index.js.map +1 -1
  22. package/lib/commonjs/version.js +1 -1
  23. package/lib/module/AdsConsent.js +4 -5
  24. package/lib/module/AdsConsent.js.map +1 -1
  25. package/lib/module/common/constants.js +3 -3
  26. package/lib/module/common/constants.js.map +1 -1
  27. package/lib/module/index.js +1 -3
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/module/specs/modules/NativeConsentModule.js +70 -0
  30. package/lib/module/specs/modules/NativeConsentModule.js.map +1 -0
  31. package/lib/module/specs/modules/NativeGoogleMobileAdsModule.js.map +1 -1
  32. package/lib/module/types/index.js +0 -1
  33. package/lib/module/types/index.js.map +1 -1
  34. package/lib/module/version.js +1 -1
  35. package/lib/typescript/AdsConsent.d.ts +1 -1
  36. package/lib/typescript/AdsConsent.d.ts.map +1 -1
  37. package/lib/typescript/index.d.ts +2 -4
  38. package/lib/typescript/index.d.ts.map +1 -1
  39. package/lib/typescript/{types/AdsConsent.interface.d.ts → specs/modules/NativeConsentModule.d.ts} +253 -168
  40. package/lib/typescript/specs/modules/NativeConsentModule.d.ts.map +1 -0
  41. package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts +6 -0
  42. package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts.map +1 -1
  43. package/lib/typescript/types/index.d.ts +0 -1
  44. package/lib/typescript/types/index.d.ts.map +1 -1
  45. package/lib/typescript/version.d.ts +1 -1
  46. package/package.json +5 -5
  47. package/src/AdsConsent.ts +21 -23
  48. package/src/common/constants.ts +2 -2
  49. package/src/index.ts +9 -3
  50. package/src/{types/AdsConsent.interface.ts → specs/modules/NativeConsentModule.ts} +266 -168
  51. package/src/specs/modules/NativeGoogleMobileAdsModule.ts +7 -0
  52. package/src/types/index.ts +0 -1
  53. package/src/version.ts +1 -1
  54. package/ios/RNGoogleMobileAds/common/RNJSON.h +0 -34
  55. package/ios/RNGoogleMobileAds/common/RNJSON.m +0 -93
  56. package/ios/RNGoogleMobileAds/common/RNMeta.h +0 -30
  57. package/ios/RNGoogleMobileAds/common/RNMeta.m +0 -61
  58. package/ios/RNGoogleMobileAds/common/RNPreferences.h +0 -44
  59. package/ios/RNGoogleMobileAds/common/RNPreferences.m +0 -94
  60. package/lib/commonjs/AdsConsentDebugGeography.js +0 -34
  61. package/lib/commonjs/AdsConsentDebugGeography.js.map +0 -1
  62. package/lib/commonjs/AdsConsentPrivacyOptionsRequirementStatus.js +0 -32
  63. package/lib/commonjs/AdsConsentPrivacyOptionsRequirementStatus.js.map +0 -1
  64. package/lib/commonjs/AdsConsentStatus.js +0 -33
  65. package/lib/commonjs/AdsConsentStatus.js.map +0 -1
  66. package/lib/commonjs/types/AdsConsent.interface.js +0 -6
  67. package/lib/commonjs/types/AdsConsent.interface.js.map +0 -1
  68. package/lib/module/AdsConsentDebugGeography.js +0 -29
  69. package/lib/module/AdsConsentDebugGeography.js.map +0 -1
  70. package/lib/module/AdsConsentPrivacyOptionsRequirementStatus.js +0 -27
  71. package/lib/module/AdsConsentPrivacyOptionsRequirementStatus.js.map +0 -1
  72. package/lib/module/AdsConsentStatus.js +0 -28
  73. package/lib/module/AdsConsentStatus.js.map +0 -1
  74. package/lib/module/types/AdsConsent.interface.js +0 -2
  75. package/lib/module/types/AdsConsent.interface.js.map +0 -1
  76. package/lib/typescript/AdsConsentDebugGeography.d.ts +0 -20
  77. package/lib/typescript/AdsConsentDebugGeography.d.ts.map +0 -1
  78. package/lib/typescript/AdsConsentPrivacyOptionsRequirementStatus.d.ts +0 -18
  79. package/lib/typescript/AdsConsentPrivacyOptionsRequirementStatus.d.ts.map +0 -1
  80. package/lib/typescript/AdsConsentStatus.d.ts +0 -22
  81. package/lib/typescript/AdsConsentStatus.d.ts.map +0 -1
  82. package/lib/typescript/types/AdsConsent.interface.d.ts.map +0 -1
  83. package/src/AdsConsentDebugGeography.ts +0 -38
  84. package/src/AdsConsentPrivacyOptionsRequirementStatus.ts +0 -36
  85. package/src/AdsConsentStatus.ts +0 -41
  86. /package/ios/RNGoogleMobileAds/common/{RNRCTEventEmitter.m → RNRCTEventEmitter.mm} +0 -0
package/src/index.ts CHANGED
@@ -21,11 +21,17 @@ import { version } from './version';
21
21
  export const SDK_VERSION = version;
22
22
 
23
23
  export { default, MobileAds } from './MobileAds';
24
- export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
24
+ export {
25
+ AdsConsentDebugGeography,
26
+ AdsConsentInfo,
27
+ AdsConsentInfoOptions,
28
+ AdsConsentInterface,
29
+ AdsConsentPrivacyOptionsRequirementStatus,
30
+ AdsConsentStatus,
31
+ AdsConsentUserChoices,
32
+ } from './specs/modules/NativeConsentModule';
25
33
  export { AdsConsentPurposes } from './AdsConsentPurposes';
26
34
  export { AdsConsentSpecialFeatures } from './AdsConsentSpecialFeatures';
27
- export { AdsConsentStatus } from './AdsConsentStatus';
28
- export { AdsConsentPrivacyOptionsRequirementStatus } from './AdsConsentPrivacyOptionsRequirementStatus';
29
35
  export { MaxAdContentRating } from './MaxAdContentRating';
30
36
  export { TestIds } from './TestIds';
31
37
  export { AdEventType } from './AdEventType';
@@ -1,212 +1,98 @@
1
- import { TCModel } from '@iabtcf/core';
2
- import { AdsConsentDebugGeography } from '../AdsConsentDebugGeography';
3
- import { AdsConsentStatus } from '../AdsConsentStatus';
4
- import { AdsConsentPrivacyOptionsRequirementStatus } from '../AdsConsentPrivacyOptionsRequirementStatus';
5
-
6
1
  /**
7
- * Under the Google [EU User Consent Policy](https://www.google.com/about/company/consentstaging.html), you must make certain disclosures to your users in the European Economic Area (EEA)
8
- * and obtain their consent to use cookies or other local storage, where legally required, and to use personal data
9
- * (such as AdID) to serve ads. This policy reflects the requirements of the EU ePrivacy Directive and the
10
- * General Data Protection Regulation (GDPR).
2
+ * Copyright (c) 2016-present Invertase Limited & Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this library except in compliance with the License.
6
+ * You may obtain a copy of the License at
11
7
  *
12
- * It is recommended that you determine the status of a user's consent at every app launch. The user consent status is held
13
- * on the device until a condition changes which requires the user to consent again, such as a change in publishers.
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
14
15
  *
15
- * For more information, see [here](https://developers.google.com/admob/ump/android/quick-start#delay_app_measurement_optional).
16
16
  */
17
17
 
18
- export interface AdsConsentInterface {
19
- /**
20
- * Requests user consent information.
21
- *
22
- * The response from this method provides information about consent form availability and consent status.
23
- *
24
- * #### Example
25
- *
26
- * ```js
27
- * import { AdsConsent } from 'react-native-google-mobile-ads';
28
- *
29
- * const consentInfo = await AdsConsent.requestInfoUpdate();
30
- * console.log('A consent form is available:', consentInfo.isConsentFormAvailable);
31
- * console.log('User consent status:', consentInfo.status);
32
- * ```
33
- * @param options An AdsConsentInfoOptions interface.
34
- */
35
- requestInfoUpdate(options?: AdsConsentInfoOptions): Promise<AdsConsentInfo>;
18
+ import { TurboModule, TurboModuleRegistry } from 'react-native';
19
+ import { TCModel } from '@iabtcf/core';
36
20
 
21
+ /**
22
+ * AdsConsentDebugGeography enum.
23
+ *
24
+ * Used to set a mock location when testing the `AdsConsent` helper.
25
+ */
26
+ export enum AdsConsentDebugGeography {
37
27
  /**
38
- * Shows a Google-rendered user consent form.
39
- *
40
- * #### Example
41
- *
42
- * ```js
43
- * import { AdsConsent, AdsConsentStatus } from 'react-native-google-mobile-ads';
44
- *
45
- * async function requestConsent() {
46
- * const consentInfo = await AdsConsent.requestInfoUpdate();
47
- *
48
- * // Check if user requires consent
49
- * if (
50
- * consentInfo.isConsentFormAvailable &&
51
- * (consentInfo.status === AdsConsentStatus.UNKNOWN ||
52
- * consentInfo.status === AdsConsentStatus.REQUIRED)) {
53
- * // Show a Google-rendered form
54
- * const formResult = await AdsConsent.showForm();
55
- *
56
- * console.log('User consent obtained: ', formResult.status === AdsConsentStatus.OBTAINED);
57
- * }
58
- * }
59
- *
60
- * ```
28
+ * Disable any debug geography.
61
29
  */
62
- showForm(): Promise<AdsConsentInfo>;
30
+ DISABLED = 0,
63
31
 
64
32
  /**
65
- * Presents a privacy options form if privacyOptionsRequirementStatus is required.
33
+ * Geography appears as in EEA for debug devices.
66
34
  */
67
- showPrivacyOptionsForm(): Promise<AdsConsentInfo>;
35
+ EEA = 1,
68
36
 
69
37
  /**
70
- * Loads a consent form and immediately presents it if consentStatus is required.
71
- *
72
- * This method is intended for the use case of showing a form if needed when the app starts.
38
+ * @deprecated Use `OTHER`.
73
39
  */
74
- loadAndShowConsentFormIfRequired(): Promise<AdsConsentInfo>;
40
+ NOT_EEA = 2,
75
41
 
76
42
  /**
77
- * Returns the UMP Consent Information from the last known session.
78
- *
79
- * #### Example
80
- *
81
- * ```js
82
- * import { AdsConsent } from '@invertase/react-native-google-ads';
83
- *
84
- * const consentInfo = await AdsConsent.getConsentInfo();
85
- * ```
43
+ * Geography appears as in a regulated US State.
86
44
  */
87
- getConsentInfo(): Promise<AdsConsentInfo>;
45
+ REGULATED_US_STATE = 3,
88
46
 
89
47
  /**
90
- * Helper method to call the UMP SDK methods to request consent information and load/present a
91
- * consent form if necessary.
48
+ * Geography appears as in a region with no regulation in force.
92
49
  */
93
- gatherConsent(): Promise<AdsConsentInfo>;
50
+ OTHER = 4,
51
+ }
94
52
 
53
+ /**
54
+ * AdsConsentStatus enum.
55
+ */
56
+ export enum AdsConsentStatus {
95
57
  /**
96
- * Returns the value stored under the `IABTCF_TCString` key
97
- * in NSUserDefaults (iOS) / SharedPreferences (Android) as
98
- * defined by the IAB Europe Transparency & Consent Framework.
99
- *
100
- * More information available here:
101
- * https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#in-app-details
102
- *
103
- * #### Example
104
- *
105
- * ```js
106
- * import { AdsConsent } from '@invertase/react-native-google-ads';
107
- *
108
- * const tcString = await AdsConsent.getTCString();
109
- * ```
58
+ * Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it.
110
59
  */
111
- getTCString(): Promise<string>;
60
+ UNKNOWN = 'UNKNOWN',
112
61
 
113
62
  /**
114
- * Returns the TC Model of the saved IAB TCF 2.0 String.
115
- *
116
- * #### Example
117
- *
118
- * ```js
119
- * import { AdsConsent } from '@invertase/react-native-google-ads';
120
- *
121
- * const tcModel = await AdsConsent.getTCModel();
122
- * ```
63
+ * User consent required but not yet obtained.
123
64
  */
124
- getTCModel(): Promise<TCModel>;
65
+ REQUIRED = 'REQUIRED',
125
66
 
126
67
  /**
127
- * Returns the value stored under the `IABTCF_gdprApplies` key
128
- * in NSUserDefaults (iOS) / SharedPreferences (Android) as
129
- * defined by the IAB Europe Transparency & Consent Framework.
130
- *
131
- * More information available here:
132
- * https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#in-app-details
133
- *
134
- * #### Example
135
- *
136
- * ```js
137
- * import { AdsConsent } from '@invertase/react-native-google-ads';
138
- *
139
- * await AdsConsent.requestInfoUpdate();
140
- * const gdprApplies = await AdsConsent.getGdprApplies();
141
- * ```
68
+ * User consent not required.
142
69
  */
143
- getGdprApplies(): Promise<boolean>;
70
+ NOT_REQUIRED = 'NOT_REQUIRED',
144
71
 
145
72
  /**
146
- * Returns the value stored under the `IABTCF_PurposeConsents` key
147
- * in NSUserDefaults (iOS) / SharedPreferences (Android) as
148
- * defined by the IAB Europe Transparency & Consent Framework.
149
- *
150
- * More information available here:
151
- * https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#in-app-details
152
- *
153
- * #### Example
154
- *
155
- * ```js
156
- * import { AdsConsent } from '@invertase/react-native-google-ads';
157
- *
158
- * await AdsConsent.requestInfoUpdate();
159
- * const purposeConsents = await AdsConsent.getPurposeConsents();
160
- * const hasConsentForPurposeOne = purposeConsents.startsWith("1");
161
- * ```
73
+ * User consent already obtained.
162
74
  */
163
- getPurposeConsents(): Promise<string>;
75
+ OBTAINED = 'OBTAINED',
76
+ }
164
77
 
78
+ /**
79
+ * AdsConsentPrivacyOptionsRequirementStatus enum.
80
+ */
81
+ export enum AdsConsentPrivacyOptionsRequirementStatus {
165
82
  /**
166
- * Returns the value stored under the `IABTCF_PurposeLegitimateInterests` key
167
- * in NSUserDefaults (iOS) / SharedPreferences (Android) as
168
- * defined by the IAB Europe Transparency & Consent Framework.
169
- *
170
- * More information available here:
171
- * https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#in-app-details
172
- *
173
- * #### Example
174
- *
175
- * ```js
176
- * import { AdsConsent } from '@invertase/react-native-google-ads';
177
- *
178
- * await AdsConsent.requestInfoUpdate();
179
- * const purposeLegitimateInterests = await AdsConsent.getPurposeLegitimateInterests();
180
- * const hasLegitimateInterestForPurposeTwo = purposeLegitimateInterests.split("")[1] === "1";
181
- * ```
83
+ * Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it.
182
84
  */
183
- getPurposeLegitimateInterests(): Promise<string>;
85
+ UNKNOWN = 'UNKNOWN',
184
86
 
185
87
  /**
186
- * Provides information about a user's consent choices.
187
- *
188
- * #### Example
189
- *
190
- * ```js
191
- * import { AdsConsent } from '@invertase/react-native-google-ads';
192
- *
193
- * const { storeAndAccessInformationOnDevice } = await AdsConsent.getUserChoices();
194
- * ```
88
+ * User consent required but not yet obtained.
195
89
  */
196
- getUserChoices(): Promise<AdsConsentUserChoices>;
90
+ REQUIRED = 'REQUIRED',
197
91
 
198
92
  /**
199
- * Resets the UMP SDK state.
200
- *
201
- * #### Example
202
- *
203
- * ```js
204
- * import { AdsConsent } from '@invertase/react-native-google-ads';
205
- *
206
- * AdsConsent.reset();
207
- * ```
93
+ * User consent not required.
208
94
  */
209
- reset(): void;
95
+ NOT_REQUIRED = 'NOT_REQUIRED',
210
96
  }
211
97
 
212
98
  /**
@@ -433,3 +319,215 @@ export interface AdsConsentUserChoices {
433
319
  */
434
320
  usePreciseGeolocationData: boolean;
435
321
  }
322
+
323
+ export interface AdsConsentInterface {
324
+ /**
325
+ * Requests user consent information.
326
+ *
327
+ * The response from this method provides information about consent form availability and consent status.
328
+ *
329
+ * #### Example
330
+ *
331
+ * ```js
332
+ * import { AdsConsent } from 'react-native-google-mobile-ads';
333
+ *
334
+ * const consentInfo = await AdsConsent.requestInfoUpdate();
335
+ * console.log('A consent form is available:', consentInfo.isConsentFormAvailable);
336
+ * console.log('User consent status:', consentInfo.status);
337
+ * ```
338
+ * @param options An AdsConsentInfoOptions interface.
339
+ */
340
+ requestInfoUpdate(options?: AdsConsentInfoOptions): Promise<AdsConsentInfo>;
341
+
342
+ /**
343
+ * Shows a Google-rendered user consent form.
344
+ *
345
+ * #### Example
346
+ *
347
+ * ```js
348
+ * import { AdsConsent, AdsConsentStatus } from 'react-native-google-mobile-ads';
349
+ *
350
+ * async function requestConsent() {
351
+ * const consentInfo = await AdsConsent.requestInfoUpdate();
352
+ *
353
+ * // Check if user requires consent
354
+ * if (
355
+ * consentInfo.isConsentFormAvailable &&
356
+ * (consentInfo.status === AdsConsentStatus.UNKNOWN ||
357
+ * consentInfo.status === AdsConsentStatus.REQUIRED)) {
358
+ * // Show a Google-rendered form
359
+ * const formResult = await AdsConsent.showForm();
360
+ *
361
+ * console.log('User consent obtained: ', formResult.status === AdsConsentStatus.OBTAINED);
362
+ * }
363
+ * }
364
+ *
365
+ * ```
366
+ */
367
+ showForm(): Promise<AdsConsentInfo>;
368
+
369
+ /**
370
+ * Presents a privacy options form if privacyOptionsRequirementStatus is required.
371
+ */
372
+ showPrivacyOptionsForm(): Promise<AdsConsentInfo>;
373
+
374
+ /**
375
+ * Loads a consent form and immediately presents it if consentStatus is required.
376
+ *
377
+ * This method is intended for the use case of showing a form if needed when the app starts.
378
+ */
379
+ loadAndShowConsentFormIfRequired(): Promise<AdsConsentInfo>;
380
+
381
+ /**
382
+ * Returns the UMP Consent Information from the last known session.
383
+ *
384
+ * #### Example
385
+ *
386
+ * ```js
387
+ * import { AdsConsent } from '@invertase/react-native-google-ads';
388
+ *
389
+ * const consentInfo = await AdsConsent.getConsentInfo();
390
+ * ```
391
+ */
392
+ getConsentInfo(): Promise<AdsConsentInfo>;
393
+
394
+ /**
395
+ * Helper method to call the UMP SDK methods to request consent information and load/present a
396
+ * consent form if necessary.
397
+ */
398
+ gatherConsent(): Promise<AdsConsentInfo>;
399
+
400
+ /**
401
+ * Returns the value stored under the `IABTCF_TCString` key
402
+ * in NSUserDefaults (iOS) / SharedPreferences (Android) as
403
+ * defined by the IAB Europe Transparency & Consent Framework.
404
+ *
405
+ * More information available here:
406
+ * https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#in-app-details
407
+ *
408
+ * #### Example
409
+ *
410
+ * ```js
411
+ * import { AdsConsent } from '@invertase/react-native-google-ads';
412
+ *
413
+ * const tcString = await AdsConsent.getTCString();
414
+ * ```
415
+ */
416
+ getTCString(): Promise<string>;
417
+
418
+ /**
419
+ * Returns the TC Model of the saved IAB TCF 2.0 String.
420
+ *
421
+ * #### Example
422
+ *
423
+ * ```js
424
+ * import { AdsConsent } from '@invertase/react-native-google-ads';
425
+ *
426
+ * const tcModel = await AdsConsent.getTCModel();
427
+ * ```
428
+ */
429
+ getTCModel(): Promise<TCModel>;
430
+
431
+ /**
432
+ * Returns the value stored under the `IABTCF_gdprApplies` key
433
+ * in NSUserDefaults (iOS) / SharedPreferences (Android) as
434
+ * defined by the IAB Europe Transparency & Consent Framework.
435
+ *
436
+ * More information available here:
437
+ * https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#in-app-details
438
+ *
439
+ * #### Example
440
+ *
441
+ * ```js
442
+ * import { AdsConsent } from '@invertase/react-native-google-ads';
443
+ *
444
+ * await AdsConsent.requestInfoUpdate();
445
+ * const gdprApplies = await AdsConsent.getGdprApplies();
446
+ * ```
447
+ */
448
+ getGdprApplies(): Promise<boolean>;
449
+
450
+ /**
451
+ * Returns the value stored under the `IABTCF_PurposeConsents` key
452
+ * in NSUserDefaults (iOS) / SharedPreferences (Android) as
453
+ * defined by the IAB Europe Transparency & Consent Framework.
454
+ *
455
+ * More information available here:
456
+ * https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#in-app-details
457
+ *
458
+ * #### Example
459
+ *
460
+ * ```js
461
+ * import { AdsConsent } from '@invertase/react-native-google-ads';
462
+ *
463
+ * await AdsConsent.requestInfoUpdate();
464
+ * const purposeConsents = await AdsConsent.getPurposeConsents();
465
+ * const hasConsentForPurposeOne = purposeConsents.startsWith("1");
466
+ * ```
467
+ */
468
+ getPurposeConsents(): Promise<string>;
469
+
470
+ /**
471
+ * Returns the value stored under the `IABTCF_PurposeLegitimateInterests` key
472
+ * in NSUserDefaults (iOS) / SharedPreferences (Android) as
473
+ * defined by the IAB Europe Transparency & Consent Framework.
474
+ *
475
+ * More information available here:
476
+ * https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#in-app-details
477
+ *
478
+ * #### Example
479
+ *
480
+ * ```js
481
+ * import { AdsConsent } from '@invertase/react-native-google-ads';
482
+ *
483
+ * await AdsConsent.requestInfoUpdate();
484
+ * const purposeLegitimateInterests = await AdsConsent.getPurposeLegitimateInterests();
485
+ * const hasLegitimateInterestForPurposeTwo = purposeLegitimateInterests.split("")[1] === "1";
486
+ * ```
487
+ */
488
+ getPurposeLegitimateInterests(): Promise<string>;
489
+
490
+ /**
491
+ * Provides information about a user's consent choices.
492
+ *
493
+ * #### Example
494
+ *
495
+ * ```js
496
+ * import { AdsConsent } from '@invertase/react-native-google-ads';
497
+ *
498
+ * const { storeAndAccessInformationOnDevice } = await AdsConsent.getUserChoices();
499
+ * ```
500
+ */
501
+ getUserChoices(): Promise<AdsConsentUserChoices>;
502
+
503
+ /**
504
+ * Resets the UMP SDK state.
505
+ *
506
+ * #### Example
507
+ *
508
+ * ```js
509
+ * import { AdsConsent } from '@invertase/react-native-google-ads';
510
+ *
511
+ * AdsConsent.reset();
512
+ * ```
513
+ */
514
+ reset(): void;
515
+ }
516
+
517
+ export interface Spec extends TurboModule {
518
+ requestInfoUpdate(options?: AdsConsentInfoOptions): Promise<AdsConsentInfo>;
519
+ showForm(): Promise<AdsConsentInfo>;
520
+ showPrivacyOptionsForm(): Promise<AdsConsentInfo>;
521
+ loadAndShowConsentFormIfRequired(): Promise<AdsConsentInfo>;
522
+ getConsentInfo(): Promise<AdsConsentInfo>;
523
+ gatherConsent(): Promise<AdsConsentInfo>;
524
+ getTCString(): Promise<string>;
525
+ getTCModel(): Promise<TCModel>;
526
+ getGdprApplies(): Promise<boolean>;
527
+ getPurposeConsents(): Promise<string>;
528
+ getPurposeLegitimateInterests(): Promise<string>;
529
+ getUserChoices(): Promise<AdsConsentUserChoices>;
530
+ reset(): void;
531
+ }
532
+
533
+ export default TurboModuleRegistry.getEnforcing<Spec>('RNGoogleMobileAdsConsentModule');
@@ -22,6 +22,13 @@ import { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
22
22
  import { AdapterStatus } from '../../types';
23
23
 
24
24
  export interface Spec extends TurboModule {
25
+ readonly getConstants: () => {
26
+ REVENUE_PRECISION_ESTIMATED: number;
27
+ REVENUE_PRECISION_PRECISE: number;
28
+ REVENUE_PRECISION_PUBLISHER_PROVIDED: number;
29
+ REVENUE_PRECISION_UNKNOWN: number;
30
+ };
31
+
25
32
  initialize(): Promise<AdapterStatus[]>;
26
33
  setRequestConfiguration(requestConfiguration?: UnsafeObject): Promise<void>;
27
34
  openAdInspector(): Promise<void>;
@@ -18,7 +18,6 @@
18
18
  export * from './AdapterStatus';
19
19
  export * from './AdEventListener';
20
20
  export * from './AdEventsListener';
21
- export * from './AdsConsent.interface';
22
21
  export * from './AdShowOptions';
23
22
  export * from './AdStates';
24
23
  export * from './BannerAdProps';
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '14.5.0';
2
+ export const version = '14.7.0';
@@ -1,34 +0,0 @@
1
- /**
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- #import <Foundation/Foundation.h>
19
-
20
- @interface RNJSON : NSObject
21
-
22
- - (BOOL)contains:(NSString *)key;
23
-
24
- - (BOOL)getBooleanValue:(NSString *)key defaultValue:(BOOL)defaultValue;
25
-
26
- - (NSString *)getStringValue:(NSString *)key defaultValue:(NSString *)defaultValue;
27
-
28
- - (NSDictionary *)getAll;
29
-
30
- - (NSString *)getRawJSON;
31
-
32
- + (RNJSON *)shared;
33
-
34
- @end
@@ -1,93 +0,0 @@
1
- /**
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- #import "RNJSON.h"
19
-
20
- @interface RNJSON ()
21
- @property(nonatomic, strong) NSDictionary *googleMobileAdsJson;
22
- @end
23
-
24
- @implementation RNJSON
25
-
26
- + (instancetype)shared {
27
- static dispatch_once_t once;
28
- static RNJSON *sharedInstance;
29
-
30
- dispatch_once(&once, ^{
31
- sharedInstance = [[RNJSON alloc] init];
32
- NSString *__nullable googleMobileAdsJsonRaw =
33
- [[NSBundle mainBundle].infoDictionary valueForKey:@"googleMobileAds_json_raw"];
34
-
35
- if (googleMobileAdsJsonRaw == nil) {
36
- sharedInstance.googleMobileAdsJson = [NSDictionary dictionary];
37
- return;
38
- }
39
-
40
- NSData *data = [[NSData alloc] initWithBase64EncodedString:googleMobileAdsJsonRaw options:0];
41
-
42
- if (data == nil) {
43
- sharedInstance.googleMobileAdsJson = [NSDictionary dictionary];
44
- return;
45
- }
46
-
47
- NSError *jsonError = nil;
48
- NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data
49
- options:0
50
- error:&jsonError];
51
- if (jsonError != nil) {
52
- sharedInstance.googleMobileAdsJson = [NSDictionary dictionary];
53
- return;
54
- }
55
-
56
- sharedInstance.googleMobileAdsJson = dictionary;
57
- });
58
-
59
- return sharedInstance;
60
- }
61
-
62
- - (BOOL)contains:(NSString *)key {
63
- return [_googleMobileAdsJson valueForKey:key] != nil;
64
- }
65
-
66
- - (BOOL)getBooleanValue:(NSString *)key defaultValue:(BOOL)defaultValue {
67
- if ([_googleMobileAdsJson valueForKey:key] == nil) return defaultValue;
68
- NSNumber *boolean = [_googleMobileAdsJson valueForKey:key];
69
- return [boolean boolValue];
70
- }
71
-
72
- - (NSString *)getStringValue:(NSString *)key defaultValue:(NSString *)defaultValue {
73
- if ([_googleMobileAdsJson valueForKey:key] == nil) return defaultValue;
74
- NSString *string = [_googleMobileAdsJson valueForKey:key];
75
- return string;
76
- }
77
-
78
- - (NSDictionary *)getAll {
79
- return [[NSDictionary alloc] initWithDictionary:_googleMobileAdsJson copyItems:YES];
80
- }
81
-
82
- - (NSString *)getRawJSON {
83
- NSString *__nullable googleMobileAdsJsonRaw =
84
- [[NSBundle mainBundle].infoDictionary valueForKey:@"googleMobileAds_json_raw"];
85
- if (googleMobileAdsJsonRaw == nil) {
86
- return @"{}";
87
- }
88
-
89
- NSData *data = [[NSData alloc] initWithBase64EncodedString:googleMobileAdsJsonRaw options:0];
90
- return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
91
- ;
92
- }
93
- @end
@@ -1,30 +0,0 @@
1
- /**
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- #import <Foundation/Foundation.h>
19
-
20
- @interface RNMeta : NSObject
21
-
22
- + (BOOL)contains:(NSString *)key;
23
-
24
- + (BOOL)getBooleanValue:(NSString *)key defaultValue:(BOOL)defaultValue;
25
-
26
- + (NSString *)getStringValue:(NSString *)key defaultValue:(NSString *)defaultValue;
27
-
28
- + (NSDictionary *)getAll;
29
-
30
- @end