react-native-google-mobile-ads 4.1.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 (373) hide show
  1. package/LICENSE +32 -0
  2. package/README.md +65 -0
  3. package/RNGoogleMobileAds.podspec +42 -0
  4. package/__tests__/consent.test.ts +25 -0
  5. package/__tests__/googleMobileAds.test.ts +63 -0
  6. package/__tests__/interstitial.test.ts +53 -0
  7. package/__tests__/requestOptions.test.tsx +4 -0
  8. package/__tests__/rewarded.test.tsx +4 -0
  9. package/__tests__/showOptions.test.tsx +4 -0
  10. package/android/.editorconfig +10 -0
  11. package/android/app-json.gradle +69 -0
  12. package/android/build.gradle +98 -0
  13. package/android/lint.xml +5 -0
  14. package/android/settings.gradle +1 -0
  15. package/android/src/main/AndroidManifest.xml +17 -0
  16. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeAppModule.java +169 -0
  17. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsAppOpenModule.java +161 -0
  18. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsBannerAdViewManager.java +209 -0
  19. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsCommon.java +256 -0
  20. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsConsentModule.java +226 -0
  21. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsEvent.java +72 -0
  22. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsInterstitialModule.java +159 -0
  23. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.java +143 -0
  24. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsPackage.java +48 -0
  25. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsRewardedModule.java +177 -0
  26. package/android/src/main/java/io/invertase/googlemobileads/common/RCTConvert.java +111 -0
  27. package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeApp.java +34 -0
  28. package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeEvent.java +41 -0
  29. package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeEventEmitter.java +150 -0
  30. package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeInitProvider.java +77 -0
  31. package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeJSON.java +107 -0
  32. package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeMeta.java +92 -0
  33. package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeModule.java +96 -0
  34. package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativePreferences.java +86 -0
  35. package/android/src/main/java/io/invertase/googlemobileads/common/SharedUtils.java +427 -0
  36. package/android/src/main/java/io/invertase/googlemobileads/common/TaskExecutorService.java +124 -0
  37. package/android/src/main/java/io/invertase/googlemobileads/interfaces/ContextProvider.java +30 -0
  38. package/android/src/main/java/io/invertase/googlemobileads/interfaces/NativeError.java +28 -0
  39. package/android/src/main/java/io/invertase/googlemobileads/interfaces/NativeEvent.java +26 -0
  40. package/babel.config.js +18 -0
  41. package/docs/displaying-ads.mdx +319 -0
  42. package/docs/european-user-consent.mdx +258 -0
  43. package/docs/img/logo_admob_192px.svg +19 -0
  44. package/docs/index.mdx +168 -0
  45. package/docs.json +9 -0
  46. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.h +29 -0
  47. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m +98 -0
  48. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.h +23 -0
  49. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.m +153 -0
  50. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +60 -0
  51. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.m +201 -0
  52. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.h +26 -0
  53. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.m +179 -0
  54. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.h +32 -0
  55. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.m +57 -0
  56. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.h +25 -0
  57. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m +124 -0
  58. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.h +24 -0
  59. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.m +104 -0
  60. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.h +25 -0
  61. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.m +173 -0
  62. package/ios/RNGoogleMobileAds/common/RNAppModule.h +24 -0
  63. package/ios/RNGoogleMobileAds/common/RNAppModule.m +158 -0
  64. package/ios/RNGoogleMobileAds/common/RNJSON.h +34 -0
  65. package/ios/RNGoogleMobileAds/common/RNJSON.m +93 -0
  66. package/ios/RNGoogleMobileAds/common/RNMeta.h +30 -0
  67. package/ios/RNGoogleMobileAds/common/RNMeta.m +61 -0
  68. package/ios/RNGoogleMobileAds/common/RNPreferences.h +44 -0
  69. package/ios/RNGoogleMobileAds/common/RNPreferences.m +94 -0
  70. package/ios/RNGoogleMobileAds/common/RNRCTEventEmitter.h +73 -0
  71. package/ios/RNGoogleMobileAds/common/RNRCTEventEmitter.m +150 -0
  72. package/ios/RNGoogleMobileAds/common/RNSharedUtils.h +48 -0
  73. package/ios/RNGoogleMobileAds/common/RNSharedUtils.m +56 -0
  74. package/ios/RNGoogleMobileAds.xcodeproj/project.pbxproj +377 -0
  75. package/ios/RNGoogleMobileAds.xcodeproj/xcshareddata/IDETemplateMacros.plist +24 -0
  76. package/ios_config.sh +140 -0
  77. package/jest.config.js +6 -0
  78. package/jest.setup.ts +29 -0
  79. package/lib/commonjs/AdEventType.js +34 -0
  80. package/lib/commonjs/AdEventType.js.map +1 -0
  81. package/lib/commonjs/AdsConsent.js +160 -0
  82. package/lib/commonjs/AdsConsent.js.map +1 -0
  83. package/lib/commonjs/AdsConsentDebugGeography.js +38 -0
  84. package/lib/commonjs/AdsConsentDebugGeography.js.map +1 -0
  85. package/lib/commonjs/AdsConsentStatus.js +36 -0
  86. package/lib/commonjs/AdsConsentStatus.js.map +1 -0
  87. package/lib/commonjs/BannerAdSize.js +38 -0
  88. package/lib/commonjs/BannerAdSize.js.map +1 -0
  89. package/lib/commonjs/MaxAdContentRating.js +33 -0
  90. package/lib/commonjs/MaxAdContentRating.js.map +1 -0
  91. package/lib/commonjs/MobileAds.js +67 -0
  92. package/lib/commonjs/MobileAds.js.map +1 -0
  93. package/lib/commonjs/RewardedAdEventType.js +31 -0
  94. package/lib/commonjs/RewardedAdEventType.js.map +1 -0
  95. package/lib/commonjs/TestIds.js +47 -0
  96. package/lib/commonjs/TestIds.js.map +1 -0
  97. package/lib/commonjs/ads/AppOpenAd.js +96 -0
  98. package/lib/commonjs/ads/AppOpenAd.js.map +1 -0
  99. package/lib/commonjs/ads/BannerAd.js +128 -0
  100. package/lib/commonjs/ads/BannerAd.js.map +1 -0
  101. package/lib/commonjs/ads/InterstitialAd.js +163 -0
  102. package/lib/commonjs/ads/InterstitialAd.js.map +1 -0
  103. package/lib/commonjs/ads/MobileAd.js +90 -0
  104. package/lib/commonjs/ads/MobileAd.js.map +1 -0
  105. package/lib/commonjs/ads/RewardedAd.js +169 -0
  106. package/lib/commonjs/ads/RewardedAd.js.map +1 -0
  107. package/lib/commonjs/common/Base64.js +121 -0
  108. package/lib/commonjs/common/Base64.js.map +1 -0
  109. package/lib/commonjs/common/MutatableParams.js +46 -0
  110. package/lib/commonjs/common/MutatableParams.js.map +1 -0
  111. package/lib/commonjs/common/ReferenceBase.js +59 -0
  112. package/lib/commonjs/common/ReferenceBase.js.map +1 -0
  113. package/lib/commonjs/common/deeps.js +101 -0
  114. package/lib/commonjs/common/deeps.js.map +1 -0
  115. package/lib/commonjs/common/id.js +82 -0
  116. package/lib/commonjs/common/id.js.map +1 -0
  117. package/lib/commonjs/common/index.js +212 -0
  118. package/lib/commonjs/common/index.js.map +1 -0
  119. package/lib/commonjs/common/path.js +144 -0
  120. package/lib/commonjs/common/path.js.map +1 -0
  121. package/lib/commonjs/common/promise.js +70 -0
  122. package/lib/commonjs/common/promise.js.map +1 -0
  123. package/lib/commonjs/common/serialize.js +52 -0
  124. package/lib/commonjs/common/serialize.js.map +1 -0
  125. package/lib/commonjs/common/validate.js +239 -0
  126. package/lib/commonjs/common/validate.js.map +1 -0
  127. package/lib/commonjs/declarations.d.js +2 -0
  128. package/lib/commonjs/declarations.d.js.map +1 -0
  129. package/lib/commonjs/index.js +143 -0
  130. package/lib/commonjs/index.js.map +1 -0
  131. package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js +76 -0
  132. package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -0
  133. package/lib/commonjs/internal/Module.js +60 -0
  134. package/lib/commonjs/internal/Module.js.map +1 -0
  135. package/lib/commonjs/internal/NativeError.js +70 -0
  136. package/lib/commonjs/internal/NativeError.js.map +1 -0
  137. package/lib/commonjs/internal/SharedEventEmitter.js +31 -0
  138. package/lib/commonjs/internal/SharedEventEmitter.js.map +1 -0
  139. package/lib/commonjs/internal/constants.js +30 -0
  140. package/lib/commonjs/internal/constants.js.map +1 -0
  141. package/lib/commonjs/internal/index.js +49 -0
  142. package/lib/commonjs/internal/index.js.map +1 -0
  143. package/lib/commonjs/internal/registry/nativeModule.js +231 -0
  144. package/lib/commonjs/internal/registry/nativeModule.js.map +1 -0
  145. package/lib/commonjs/types/AdEventListener.js +6 -0
  146. package/lib/commonjs/types/AdEventListener.js.map +1 -0
  147. package/lib/commonjs/types/AdShowOptions.js +2 -0
  148. package/lib/commonjs/types/AdShowOptions.js.map +1 -0
  149. package/lib/commonjs/types/AdapterStatus.js +18 -0
  150. package/lib/commonjs/types/AdapterStatus.js.map +1 -0
  151. package/lib/commonjs/types/AdsConsent.interface.js +6 -0
  152. package/lib/commonjs/types/AdsConsent.interface.js.map +1 -0
  153. package/lib/commonjs/types/BannerAdProps.js +6 -0
  154. package/lib/commonjs/types/BannerAdProps.js.map +1 -0
  155. package/lib/commonjs/types/GoogleMobileAdsNativeModule.js +6 -0
  156. package/lib/commonjs/types/GoogleMobileAdsNativeModule.js.map +1 -0
  157. package/lib/commonjs/types/MobileAd.interface.js +6 -0
  158. package/lib/commonjs/types/MobileAd.interface.js.map +1 -0
  159. package/lib/commonjs/types/MobileAdsModule.interface.js +6 -0
  160. package/lib/commonjs/types/MobileAdsModule.interface.js.map +1 -0
  161. package/lib/commonjs/types/Module.interface.js +2 -0
  162. package/lib/commonjs/types/Module.interface.js.map +1 -0
  163. package/lib/commonjs/types/RequestConfiguration.js +6 -0
  164. package/lib/commonjs/types/RequestConfiguration.js.map +1 -0
  165. package/lib/commonjs/types/RequestOptions.js +2 -0
  166. package/lib/commonjs/types/RequestOptions.js.map +1 -0
  167. package/lib/commonjs/types/RewardedAdReward.js +2 -0
  168. package/lib/commonjs/types/RewardedAdReward.js.map +1 -0
  169. package/lib/commonjs/validateAdRequestConfiguration.js +69 -0
  170. package/lib/commonjs/validateAdRequestConfiguration.js.map +1 -0
  171. package/lib/commonjs/validateAdRequestOptions.js +158 -0
  172. package/lib/commonjs/validateAdRequestOptions.js.map +1 -0
  173. package/lib/commonjs/validateAdShowOptions.js +47 -0
  174. package/lib/commonjs/validateAdShowOptions.js.map +1 -0
  175. package/lib/commonjs/version.js +10 -0
  176. package/lib/commonjs/version.js.map +1 -0
  177. package/lib/module/AdEventType.js +26 -0
  178. package/lib/module/AdEventType.js.map +1 -0
  179. package/lib/module/AdsConsent.js +148 -0
  180. package/lib/module/AdsConsent.js.map +1 -0
  181. package/lib/module/AdsConsentDebugGeography.js +30 -0
  182. package/lib/module/AdsConsentDebugGeography.js.map +1 -0
  183. package/lib/module/AdsConsentStatus.js +28 -0
  184. package/lib/module/AdsConsentStatus.js.map +1 -0
  185. package/lib/module/BannerAdSize.js +30 -0
  186. package/lib/module/BannerAdSize.js.map +1 -0
  187. package/lib/module/MaxAdContentRating.js +25 -0
  188. package/lib/module/MaxAdContentRating.js.map +1 -0
  189. package/lib/module/MobileAds.js +53 -0
  190. package/lib/module/MobileAds.js.map +1 -0
  191. package/lib/module/RewardedAdEventType.js +23 -0
  192. package/lib/module/RewardedAdEventType.js.map +1 -0
  193. package/lib/module/TestIds.js +38 -0
  194. package/lib/module/TestIds.js.map +1 -0
  195. package/lib/module/ads/AppOpenAd.js +81 -0
  196. package/lib/module/ads/AppOpenAd.js.map +1 -0
  197. package/lib/module/ads/BannerAd.js +108 -0
  198. package/lib/module/ads/BannerAd.js.map +1 -0
  199. package/lib/module/ads/InterstitialAd.js +149 -0
  200. package/lib/module/ads/InterstitialAd.js.map +1 -0
  201. package/lib/module/ads/MobileAd.js +94 -0
  202. package/lib/module/ads/MobileAd.js.map +1 -0
  203. package/lib/module/ads/RewardedAd.js +155 -0
  204. package/lib/module/ads/RewardedAd.js.map +1 -0
  205. package/lib/module/common/Base64.js +106 -0
  206. package/lib/module/common/Base64.js.map +1 -0
  207. package/lib/module/common/MutatableParams.js +52 -0
  208. package/lib/module/common/MutatableParams.js.map +1 -0
  209. package/lib/module/common/ReferenceBase.js +50 -0
  210. package/lib/module/common/ReferenceBase.js.map +1 -0
  211. package/lib/module/common/deeps.js +91 -0
  212. package/lib/module/common/deeps.js.map +1 -0
  213. package/lib/module/common/id.js +74 -0
  214. package/lib/module/common/id.js.map +1 -0
  215. package/lib/module/common/index.js +109 -0
  216. package/lib/module/common/index.js.map +1 -0
  217. package/lib/module/common/path.js +120 -0
  218. package/lib/module/common/path.js.map +1 -0
  219. package/lib/module/common/promise.js +60 -0
  220. package/lib/module/common/promise.js.map +1 -0
  221. package/lib/module/common/serialize.js +41 -0
  222. package/lib/module/common/serialize.js.map +1 -0
  223. package/lib/module/common/validate.js +197 -0
  224. package/lib/module/common/validate.js.map +1 -0
  225. package/lib/module/declarations.d.js +2 -0
  226. package/lib/module/declarations.d.js.map +1 -0
  227. package/lib/module/index.js +33 -0
  228. package/lib/module/index.js.map +1 -0
  229. package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js +83 -0
  230. package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -0
  231. package/lib/module/internal/Module.js +64 -0
  232. package/lib/module/internal/Module.js.map +1 -0
  233. package/lib/module/internal/NativeError.js +61 -0
  234. package/lib/module/internal/NativeError.js.map +1 -0
  235. package/lib/module/internal/SharedEventEmitter.js +20 -0
  236. package/lib/module/internal/SharedEventEmitter.js.map +1 -0
  237. package/lib/module/internal/constants.js +20 -0
  238. package/lib/module/internal/constants.js.map +1 -0
  239. package/lib/module/internal/index.js +21 -0
  240. package/lib/module/internal/index.js.map +1 -0
  241. package/lib/module/internal/registry/nativeModule.js +215 -0
  242. package/lib/module/internal/registry/nativeModule.js.map +1 -0
  243. package/lib/module/types/AdEventListener.js +2 -0
  244. package/lib/module/types/AdEventListener.js.map +1 -0
  245. package/lib/module/types/AdShowOptions.js +2 -0
  246. package/lib/module/types/AdShowOptions.js.map +1 -0
  247. package/lib/module/types/AdapterStatus.js +10 -0
  248. package/lib/module/types/AdapterStatus.js.map +1 -0
  249. package/lib/module/types/AdsConsent.interface.js +2 -0
  250. package/lib/module/types/AdsConsent.interface.js.map +1 -0
  251. package/lib/module/types/BannerAdProps.js +2 -0
  252. package/lib/module/types/BannerAdProps.js.map +1 -0
  253. package/lib/module/types/GoogleMobileAdsNativeModule.js +2 -0
  254. package/lib/module/types/GoogleMobileAdsNativeModule.js.map +1 -0
  255. package/lib/module/types/MobileAd.interface.js +2 -0
  256. package/lib/module/types/MobileAd.interface.js.map +1 -0
  257. package/lib/module/types/MobileAdsModule.interface.js +2 -0
  258. package/lib/module/types/MobileAdsModule.interface.js.map +1 -0
  259. package/lib/module/types/Module.interface.js +2 -0
  260. package/lib/module/types/Module.interface.js.map +1 -0
  261. package/lib/module/types/RequestConfiguration.js +2 -0
  262. package/lib/module/types/RequestConfiguration.js.map +1 -0
  263. package/lib/module/types/RequestOptions.js +2 -0
  264. package/lib/module/types/RequestOptions.js.map +1 -0
  265. package/lib/module/types/RewardedAdReward.js +2 -0
  266. package/lib/module/types/RewardedAdReward.js.map +1 -0
  267. package/lib/module/validateAdRequestConfiguration.js +60 -0
  268. package/lib/module/validateAdRequestConfiguration.js.map +1 -0
  269. package/lib/module/validateAdRequestOptions.js +150 -0
  270. package/lib/module/validateAdRequestOptions.js.map +1 -0
  271. package/lib/module/validateAdShowOptions.js +39 -0
  272. package/lib/module/validateAdShowOptions.js.map +1 -0
  273. package/lib/module/version.js +3 -0
  274. package/lib/module/version.js.map +1 -0
  275. package/lib/typescript/AdEventType.d.ts +47 -0
  276. package/lib/typescript/AdsConsent.d.ts +2 -0
  277. package/lib/typescript/AdsConsentDebugGeography.d.ts +19 -0
  278. package/lib/typescript/AdsConsentStatus.d.ts +17 -0
  279. package/lib/typescript/BannerAdSize.d.ts +34 -0
  280. package/lib/typescript/MaxAdContentRating.d.ts +18 -0
  281. package/lib/typescript/MobileAds.d.ts +11 -0
  282. package/lib/typescript/RewardedAdEventType.d.ts +46 -0
  283. package/lib/typescript/TestIds.d.ts +6 -0
  284. package/lib/typescript/ads/AppOpenAd.d.ts +11 -0
  285. package/lib/typescript/ads/BannerAd.d.ts +3 -0
  286. package/lib/typescript/ads/InterstitialAd.d.ts +78 -0
  287. package/lib/typescript/ads/MobileAd.d.ts +32 -0
  288. package/lib/typescript/ads/RewardedAd.d.ts +84 -0
  289. package/lib/typescript/common/Base64.d.ts +14 -0
  290. package/lib/typescript/common/MutatableParams.d.ts +9 -0
  291. package/lib/typescript/common/ReferenceBase.d.ts +11 -0
  292. package/lib/typescript/common/deeps.d.ts +18 -0
  293. package/lib/typescript/common/id.d.ts +11 -0
  294. package/lib/typescript/common/index.d.ts +28 -0
  295. package/lib/typescript/common/path.d.ts +43 -0
  296. package/lib/typescript/common/promise.d.ts +13 -0
  297. package/lib/typescript/common/serialize.d.ts +5 -0
  298. package/lib/typescript/common/validate.d.ts +90 -0
  299. package/lib/typescript/index.d.ts +14 -0
  300. package/lib/typescript/internal/GoogleMobileAdsNativeEventEmitter.d.ts +12 -0
  301. package/lib/typescript/internal/Module.d.ts +13 -0
  302. package/lib/typescript/internal/NativeError.d.ts +26 -0
  303. package/lib/typescript/internal/SharedEventEmitter.d.ts +2 -0
  304. package/lib/typescript/internal/constants.d.ts +3 -0
  305. package/lib/typescript/internal/index.d.ts +4 -0
  306. package/lib/typescript/internal/registry/nativeModule.d.ts +15 -0
  307. package/lib/typescript/types/AdEventListener.d.ts +11 -0
  308. package/lib/typescript/types/AdShowOptions.d.ts +12 -0
  309. package/lib/typescript/types/AdapterStatus.d.ts +18 -0
  310. package/lib/typescript/types/AdsConsent.interface.d.ts +286 -0
  311. package/lib/typescript/types/BannerAdProps.d.ts +66 -0
  312. package/lib/typescript/types/GoogleMobileAdsNativeModule.d.ts +14 -0
  313. package/lib/typescript/types/MobileAd.interface.d.ts +64 -0
  314. package/lib/typescript/types/MobileAdsModule.interface.d.ts +38 -0
  315. package/lib/typescript/types/Module.interface.d.ts +14 -0
  316. package/lib/typescript/types/RequestConfiguration.d.ts +36 -0
  317. package/lib/typescript/types/RequestOptions.d.ts +106 -0
  318. package/lib/typescript/types/RewardedAdReward.d.ts +13 -0
  319. package/lib/typescript/validateAdRequestConfiguration.d.ts +2 -0
  320. package/lib/typescript/validateAdRequestOptions.d.ts +2 -0
  321. package/lib/typescript/validateAdShowOptions.d.ts +2 -0
  322. package/lib/typescript/version.d.ts +1 -0
  323. package/package.json +143 -0
  324. package/react-native.config.js +19 -0
  325. package/src/AdEventType.ts +68 -0
  326. package/src/AdsConsent.ts +191 -0
  327. package/src/AdsConsentDebugGeography.ts +38 -0
  328. package/src/AdsConsentStatus.ts +36 -0
  329. package/src/BannerAdSize.ts +59 -0
  330. package/src/MaxAdContentRating.ts +38 -0
  331. package/src/MobileAds.ts +84 -0
  332. package/src/RewardedAdEventType.ts +64 -0
  333. package/src/TestIds.ts +39 -0
  334. package/src/ads/AppOpenAd.ts +85 -0
  335. package/src/ads/BannerAd.tsx +126 -0
  336. package/src/ads/InterstitialAd.ts +156 -0
  337. package/src/ads/MobileAd.ts +101 -0
  338. package/src/ads/RewardedAd.ts +161 -0
  339. package/src/common/Base64.ts +114 -0
  340. package/src/common/MutatableParams.ts +50 -0
  341. package/src/common/ReferenceBase.ts +45 -0
  342. package/src/common/deeps.ts +88 -0
  343. package/src/common/id.ts +74 -0
  344. package/src/common/index.ts +103 -0
  345. package/src/common/path.ts +114 -0
  346. package/src/common/promise.ts +66 -0
  347. package/src/common/serialize.ts +43 -0
  348. package/src/common/validate.ts +205 -0
  349. package/src/declarations.d.ts +3 -0
  350. package/src/index.ts +35 -0
  351. package/src/internal/GoogleMobileAdsNativeEventEmitter.ts +81 -0
  352. package/src/internal/Module.ts +58 -0
  353. package/src/internal/NativeError.ts +56 -0
  354. package/src/internal/SharedEventEmitter.ts +22 -0
  355. package/src/internal/constants.ts +43 -0
  356. package/src/internal/index.ts +21 -0
  357. package/src/internal/registry/nativeModule.ts +226 -0
  358. package/src/types/AdEventListener.ts +16 -0
  359. package/src/types/AdShowOptions.ts +12 -0
  360. package/src/types/AdapterStatus.ts +20 -0
  361. package/src/types/AdsConsent.interface.ts +306 -0
  362. package/src/types/BannerAdProps.ts +73 -0
  363. package/src/types/GoogleMobileAdsNativeModule.ts +15 -0
  364. package/src/types/MobileAd.interface.ts +69 -0
  365. package/src/types/MobileAdsModule.interface.ts +43 -0
  366. package/src/types/Module.interface.ts +16 -0
  367. package/src/types/RequestConfiguration.ts +40 -0
  368. package/src/types/RequestOptions.ts +113 -0
  369. package/src/types/RewardedAdReward.ts +14 -0
  370. package/src/validateAdRequestConfiguration.ts +71 -0
  371. package/src/validateAdRequestOptions.ts +168 -0
  372. package/src/validateAdShowOptions.ts +41 -0
  373. package/src/version.ts +2 -0
package/ios_config.sh ADDED
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Copyright (c) 2016-present Invertase Limited & Contributors
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this library except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+ set -e
18
+
19
+ _MAX_LOOKUPS=2;
20
+ _SEARCH_RESULT=''
21
+ _RN_ROOT_EXISTS=''
22
+ _CURRENT_LOOKUPS=1
23
+ _PROJECT_ABBREVIATION="RNGoogleMobileAds"
24
+ _JSON_ROOT="'react-native-google-mobile-ads'"
25
+ _JSON_FILE_NAME='app.json'
26
+ _JSON_OUTPUT_BASE64='e30=' # { }
27
+ _CURRENT_SEARCH_DIR=${PROJECT_DIR}
28
+ _PLIST_BUDDY=/usr/libexec/PlistBuddy
29
+ _TARGET_PLIST="${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}"
30
+ _DSYM_PLIST="${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist"
31
+
32
+ # plist arrays
33
+ _PLIST_ENTRY_KEYS=()
34
+ _PLIST_ENTRY_TYPES=()
35
+ _PLIST_ENTRY_VALUES=()
36
+
37
+ function setPlistValue {
38
+ echo "info: setting plist entry '$1' of type '$2' in file '$4'"
39
+ ${_PLIST_BUDDY} -c "Add :$1 $2 '$3'" $4 || echo "info: '$1' already exists"
40
+ }
41
+
42
+ function getJsonKeyValue () {
43
+ if [[ ${_RN_ROOT_EXISTS} ]]; then
44
+ ruby -e "require 'rubygems';require 'json'; output=JSON.parse('$1'); puts output[$_JSON_ROOT]['$2']"
45
+ else
46
+ echo ""
47
+ fi;
48
+ }
49
+
50
+ function jsonBoolToYesNo () {
51
+ if [[ $1 == "false" ]]; then
52
+ echo "NO"
53
+ elif [[ $1 == "true" ]]; then
54
+ echo "YES"
55
+ else echo "NO"
56
+ fi
57
+ }
58
+
59
+ echo "info: -> ${_PROJECT_ABBREVIATION} build script started"
60
+ echo "info: 1) Locating ${_JSON_FILE_NAME} file:"
61
+
62
+ if [[ -z ${_CURRENT_SEARCH_DIR} ]]; then
63
+ _CURRENT_SEARCH_DIR=$(pwd)
64
+ fi;
65
+
66
+ while true; do
67
+ _CURRENT_SEARCH_DIR=$(dirname "$_CURRENT_SEARCH_DIR")
68
+ if [[ "$_CURRENT_SEARCH_DIR" == "/" ]] || [[ ${_CURRENT_LOOKUPS} -gt ${_MAX_LOOKUPS} ]]; then break; fi;
69
+ echo "info: ($_CURRENT_LOOKUPS of $_MAX_LOOKUPS) Searching in '$_CURRENT_SEARCH_DIR' for a ${_JSON_FILE_NAME} file."
70
+ _SEARCH_RESULT=$(find "$_CURRENT_SEARCH_DIR" -maxdepth 2 -name ${_JSON_FILE_NAME} -print | head -n 1)
71
+ if [[ ${_SEARCH_RESULT} ]]; then
72
+ echo "info: ${_JSON_FILE_NAME} found at $_SEARCH_RESULT"
73
+ break;
74
+ fi;
75
+ _CURRENT_LOOKUPS=$((_CURRENT_LOOKUPS+1))
76
+ done
77
+
78
+ if [[ ${_SEARCH_RESULT} ]]; then
79
+ _JSON_OUTPUT_RAW=$(cat "${_SEARCH_RESULT}")
80
+ _RN_ROOT_EXISTS=$(ruby -e "require 'rubygems';require 'json'; output=JSON.parse('$_JSON_OUTPUT_RAW'); puts output[$_JSON_ROOT]" || echo '')
81
+
82
+ if [[ ${_RN_ROOT_EXISTS} ]]; then
83
+ _JSON_OUTPUT_BASE64=$(python -c 'import json,sys,base64;print(base64.b64encode(json.dumps(json.loads(open('"'${_SEARCH_RESULT}'"').read())['${_JSON_ROOT}'])))' || echo "e30=")
84
+ fi
85
+
86
+ _PLIST_ENTRY_KEYS+=("google_mobile_ads_json_raw")
87
+ _PLIST_ENTRY_TYPES+=("string")
88
+ _PLIST_ENTRY_VALUES+=("$_JSON_OUTPUT_BASE64")
89
+
90
+ # config.delay_app_measurement_init
91
+ _DELAY_APP_MEASUREMENT=$(getJsonKeyValue "$_JSON_OUTPUT_RAW" "delay_app_measurement_init")
92
+ if [[ $_DELAY_APP_MEASUREMENT == "true" ]]; then
93
+ _PLIST_ENTRY_KEYS+=("GADDelayAppMeasurementInit")
94
+ _PLIST_ENTRY_TYPES+=("bool")
95
+ _PLIST_ENTRY_VALUES+=("YES")
96
+ fi
97
+
98
+ # config.ios_app_id
99
+ _IOS_APP_ID=$(getJsonKeyValue "$_JSON_OUTPUT_RAW" "ios_app_id")
100
+ if [[ $_IOS_APP_ID ]]; then
101
+ _PLIST_ENTRY_KEYS+=("GADApplicationIdentifier")
102
+ _PLIST_ENTRY_TYPES+=("string")
103
+ _PLIST_ENTRY_VALUES+=("$_IOS_APP_ID")
104
+ fi
105
+ else
106
+ _PLIST_ENTRY_KEYS+=("google_mobile_ads_json_raw")
107
+ _PLIST_ENTRY_TYPES+=("string")
108
+ _PLIST_ENTRY_VALUES+=("$_JSON_OUTPUT_BASE64")
109
+ echo "warning: A ${_JSON_FILE_NAME} file was not found, whilst this file is optional it is recommended to include it to auto-configure services."
110
+ fi;
111
+
112
+ echo "info: 2) Injecting Info.plist entries: "
113
+
114
+ # Log out the keys we're adding
115
+ for i in "${!_PLIST_ENTRY_KEYS[@]}"; do
116
+ echo " -> $i) ${_PLIST_ENTRY_KEYS[$i]}" "${_PLIST_ENTRY_TYPES[$i]}" "${_PLIST_ENTRY_VALUES[$i]}"
117
+ done
118
+
119
+ for plist in "${_TARGET_PLIST}" "${_DSYM_PLIST}" ; do
120
+ if [[ -f "${plist}" ]]; then
121
+
122
+ # paths with spaces break the call to setPlistValue. temporarily modify
123
+ # the shell internal field separator variable (IFS), which normally
124
+ # includes spaces, to consist only of line breaks
125
+ oldifs=$IFS
126
+ IFS="
127
+ "
128
+
129
+ for i in "${!_PLIST_ENTRY_KEYS[@]}"; do
130
+ setPlistValue "${_PLIST_ENTRY_KEYS[$i]}" "${_PLIST_ENTRY_TYPES[$i]}" "${_PLIST_ENTRY_VALUES[$i]}" "${plist}"
131
+ done
132
+
133
+ # restore the original internal field separator value
134
+ IFS=$oldifs
135
+ else
136
+ echo "warning: A Info.plist build output file was not found (${plist})"
137
+ fi
138
+ done
139
+
140
+ echo "info: <- ${_PROJECT_ABBREVIATION} build script finished"
package/jest.config.js ADDED
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ preset: 'react-native',
3
+ modulePathIgnorePatterns: ['<rootDir>/example/node_modules', '<rootDir>/lib/'],
4
+ setupFiles: ['./jest.setup.ts'],
5
+ testRegex: '(/^__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$',
6
+ };
package/jest.setup.ts ADDED
@@ -0,0 +1,29 @@
1
+ import * as ReactNative from 'react-native';
2
+
3
+ jest.doMock('react-native', () => {
4
+ return Object.setPrototypeOf(
5
+ {
6
+ Platform: {
7
+ OS: 'android',
8
+ select: () => {},
9
+ },
10
+ NativeModules: {
11
+ ...ReactNative.NativeModules,
12
+ RNAppModule: {
13
+ addListener: jest.fn(),
14
+ removeListeners: jest.fn(),
15
+ },
16
+ RNGoogleMobileAdsModule: {
17
+ addListener: jest.fn(),
18
+ removeListeners: jest.fn(),
19
+ eventsAddListener: jest.fn(),
20
+ eventsNotifyReady: jest.fn(),
21
+ },
22
+ RNGoogleMobileAdsInterstitialModule: {},
23
+ RNGoogleMobileAdsRewardedModule: {},
24
+ RNGoogleMobileAdsConsentModule: {},
25
+ },
26
+ },
27
+ ReactNative,
28
+ );
29
+ });
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AdEventType = void 0;
7
+
8
+ /*
9
+ * Copyright (c) 2016-present Invertase Limited & Contributors
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this library except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ *
23
+ */
24
+ let AdEventType;
25
+ exports.AdEventType = AdEventType;
26
+
27
+ (function (AdEventType) {
28
+ AdEventType["LOADED"] = "loaded";
29
+ AdEventType["ERROR"] = "error";
30
+ AdEventType["OPENED"] = "opened";
31
+ AdEventType["CLICKED"] = "clicked";
32
+ AdEventType["CLOSED"] = "closed";
33
+ })(AdEventType || (exports.AdEventType = AdEventType = {}));
34
+ //# sourceMappingURL=AdEventType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["AdEventType.ts"],"names":["AdEventType"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAEYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","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\nexport enum AdEventType {\n /**\n * When an ad has loaded. At this point, the ad is ready to be shown to the user.\n *\n * #### Example\n *\n * ```js\n * import { AdEventType } from 'react-native-google-mobile-ads';\n *\n * advert.onAdEvent((type,error,data) => {\n * if (type === AdEventType.LOADED) {\n * advert.show();\n * }\n * });\n * ```\n */\n LOADED = 'loaded',\n\n /**\n * The ad has thrown an error. See the error parameter the listener callback for more information.\n *\n * #### Example\n *\n * ```js\n * import { AdEventType } from 'react-native-google-mobile-ads';\n *\n * advert.onAdEvent((type, error, data) => {\n * if (type === AdEventType.ERROR) {\n * console.log('Ad error:', error);\n * }\n * });\n * ```\n */\n ERROR = 'error',\n\n /**\n * The ad opened and is currently visible to the user. This event is fired after the `show()`\n * method has been called.\n */\n OPENED = 'opened',\n\n /**\n * The user clicked the advert.\n */\n CLICKED = 'clicked',\n\n /**\n * The user closed the ad and has returned back to your application.\n */\n CLOSED = 'closed',\n}\n"]}
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AdsConsent = void 0;
7
+
8
+ var _common = require("./common");
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _AdsConsentDebugGeography = require("./AdsConsentDebugGeography");
13
+
14
+ var _AdsConsentStatus = require("./AdsConsentStatus");
15
+
16
+ /*
17
+ * Copyright (c) 2016-present Invertase Limited & Contributors
18
+ *
19
+ * Licensed under the Apache License, Version 2.0 (the "License");
20
+ * you may not use this library except in compliance with the License.
21
+ * You may obtain a copy of the License at
22
+ *
23
+ * http://www.apache.org/licenses/LICENSE-2.0
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software
26
+ * distributed under the License is distributed on an "AS IS" BASIS,
27
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ * See the License for the specific language governing permissions and
29
+ * limitations under the License.
30
+ *
31
+ */
32
+ const native = _reactNative.NativeModules.RNGoogleAdsConsentModule;
33
+ const AdsConsent = {
34
+ /**
35
+ *
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 {*}
61
+ */
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
+ }
74
+
75
+ if ((0, _common.hasOwnProperty)(options, 'withNonPersonalizedAds') && !(0, _common.isBoolean)(options.withNonPersonalizedAds)) {
76
+ throw new Error("AdsConsent.showForm(*) 'options.withNonPersonalizedAds' expected a boolean value.");
77
+ }
78
+
79
+ if ((0, _common.hasOwnProperty)(options, 'withAdFree') && !(0, _common.isBoolean)(options.withAdFree)) {
80
+ throw new Error("AdsConsent.showForm(*) 'options.withAdFree' expected a boolean value.");
81
+ }
82
+
83
+ if (!options.withPersonalizedAds && !options.withNonPersonalizedAds && !options.withAdFree) {
84
+ throw new Error("AdsConsent.showForm(*) 'options' form requires at least one option to be enabled.");
85
+ }
86
+
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
+ },
108
+
109
+ /**
110
+ *
111
+ */
112
+ getStatus() {
113
+ return native.getStatus();
114
+ },
115
+
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.");
123
+ }
124
+
125
+ return native.setStatus(status);
126
+ },
127
+
128
+ /**
129
+ *
130
+ * @param tag
131
+ */
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);
138
+ },
139
+
140
+ /**
141
+ *
142
+ * @param deviceIds
143
+ */
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);
156
+ }
157
+
158
+ };
159
+ exports.AdsConsent = AdsConsent;
160
+ //# sourceMappingURL=AdsConsent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["AdsConsent.ts"],"names":["native","NativeModules","RNGoogleAdsConsentModule","AdsConsent","requestInfoUpdate","publisherIds","Error","length","i","showForm","options","privacyPolicy","withPersonalizedAds","withNonPersonalizedAds","withAdFree","getAdProviders","setDebugGeography","geography","AdsConsentDebugGeography","DISABLED","EEA","NOT_EEA","getStatus","setStatus","status","AdsConsentStatus","UNKNOWN","NON_PERSONALIZED","PERSONALIZED","setTagForUnderAgeOfConsent","tag","addTestDevices","deviceIds"],"mappings":"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","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\n hasOwnProperty,\n isArray,\n isBoolean,\n isObject,\n isString,\n isUndefined,\n isValidUrl,\n} from './common';\nimport { NativeModules } from 'react-native';\nimport { AdsConsentDebugGeography } from './AdsConsentDebugGeography';\nimport { AdsConsentStatus } from './AdsConsentStatus';\nimport { AdsConsentInterface } from './types/AdsConsent.interface';\n\nconst native = NativeModules.RNGoogleAdsConsentModule;\n\nexport const AdsConsent: AdsConsentInterface = {\n /**\n *\n * @param publisherIds\n * @returns {*}\n */\n requestInfoUpdate(publisherIds) {\n if (!isArray(publisherIds)) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'publisherIds' expected an array of string values.\",\n );\n }\n\n if (publisherIds.length === 0) {\n throw new Error(\n \"AdsConsent.requestInfoUpdate(*) 'publisherIds' list of publisher IDs cannot be empty.\",\n );\n }\n\n for (let i = 0; i < publisherIds.length; i++) {\n if (!isString(publisherIds[i])) {\n throw new Error(\n `AdsConsent.requestInfoUpdate(*) 'publisherIds[${i}]' expected a string value.`,\n );\n }\n }\n\n return native.requestInfoUpdate(publisherIds);\n },\n\n /**\n *\n * @param options\n * @returns {*}\n */\n showForm(options) {\n if (!isUndefined(options) && !isObject(options)) {\n throw new Error(\"AdsConsent.showForm(*) 'options' expected an object value.\");\n }\n\n if (!isValidUrl(options.privacyPolicy)) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.privacyPolicy' expected a valid HTTP or HTTPS URL.\",\n );\n }\n\n if (hasOwnProperty(options, 'withPersonalizedAds') && !isBoolean(options.withPersonalizedAds)) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.withPersonalizedAds' expected a boolean value.\",\n );\n }\n\n if (\n hasOwnProperty(options, 'withNonPersonalizedAds') &&\n !isBoolean(options.withNonPersonalizedAds)\n ) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options.withNonPersonalizedAds' expected a boolean value.\",\n );\n }\n\n if (hasOwnProperty(options, 'withAdFree') && !isBoolean(options.withAdFree)) {\n throw new Error(\"AdsConsent.showForm(*) 'options.withAdFree' expected a boolean value.\");\n }\n\n if (!options.withPersonalizedAds && !options.withNonPersonalizedAds && !options.withAdFree) {\n throw new Error(\n \"AdsConsent.showForm(*) 'options' form requires at least one option to be enabled.\",\n );\n }\n\n return native.showForm(options);\n },\n\n /**\n *\n */\n getAdProviders() {\n return native.getAdProviders();\n },\n\n /**\n *\n * @param geography\n */\n setDebugGeography(geography) {\n if (\n geography !== AdsConsentDebugGeography.DISABLED &&\n geography !== AdsConsentDebugGeography.EEA &&\n geography !== AdsConsentDebugGeography.NOT_EEA\n ) {\n throw new Error(\n \"AdsConsent.setDebugGeography(*) 'geography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA or AdsConsentDebugGeography.NOT_EEA.\",\n );\n }\n\n return native.setDebugGeography(geography);\n },\n\n /**\n *\n */\n getStatus() {\n return native.getStatus();\n },\n\n /**\n *\n * @param status\n */\n setStatus(status) {\n if (\n status !== AdsConsentStatus.UNKNOWN &&\n status !== AdsConsentStatus.NON_PERSONALIZED &&\n status !== AdsConsentStatus.PERSONALIZED\n ) {\n throw new Error(\n \"AdsConsent.setStatus(*) 'status' expected one of AdsConsentStatus.UNKNOWN, AdsConsentStatus.NON_PERSONALIZED or AdsConsentStatus.PERSONALIZED.\",\n );\n }\n\n return native.setStatus(status);\n },\n\n /**\n *\n * @param tag\n */\n setTagForUnderAgeOfConsent(tag) {\n if (!isBoolean(tag)) {\n throw new Error(\"AdsConsent.setTagForUnderAgeOfConsent(*) 'tag' expected a boolean value.\");\n }\n\n return native.setTagForUnderAgeOfConsent(tag);\n },\n\n /**\n *\n * @param deviceIds\n */\n addTestDevices(deviceIds) {\n if (!isArray(deviceIds)) {\n throw new Error(\n \"AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.\",\n );\n }\n\n for (let i = 0; i < deviceIds.length; i++) {\n if (!isString(deviceIds[i])) {\n throw new Error(\n \"AdsConsent.addTestDevices(*) 'deviceIds' expected an array of string values.\",\n );\n }\n }\n\n return native.addTestDevices(deviceIds);\n },\n};\n"]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AdsConsentDebugGeography = void 0;
7
+
8
+ /*
9
+ * Copyright (c) 2016-present Invertase Limited & Contributors
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this library except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ *
23
+ */
24
+
25
+ /**
26
+ * AdsConsentDebugGeography enum.
27
+ *
28
+ * Used to set a mock location when testing the `AdsConsent` helper.
29
+ */
30
+ let AdsConsentDebugGeography;
31
+ exports.AdsConsentDebugGeography = AdsConsentDebugGeography;
32
+
33
+ (function (AdsConsentDebugGeography) {
34
+ AdsConsentDebugGeography[AdsConsentDebugGeography["DISABLED"] = 0] = "DISABLED";
35
+ AdsConsentDebugGeography[AdsConsentDebugGeography["EEA"] = 1] = "EEA";
36
+ AdsConsentDebugGeography[AdsConsentDebugGeography["NOT_EEA"] = 2] = "NOT_EEA";
37
+ })(AdsConsentDebugGeography || (exports.AdsConsentDebugGeography = AdsConsentDebugGeography = {}));
38
+ //# sourceMappingURL=AdsConsentDebugGeography.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["AdsConsentDebugGeography.ts"],"names":["AdsConsentDebugGeography"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;IACYA,wB;;;WAAAA,wB;AAAAA,EAAAA,wB,CAAAA,wB;AAAAA,EAAAA,wB,CAAAA,wB;AAAAA,EAAAA,wB,CAAAA,wB;GAAAA,wB,wCAAAA,wB","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 * AdsConsentDebugGeography enum.\n *\n * Used to set a mock location when testing the `AdsConsent` helper.\n */\nexport enum AdsConsentDebugGeography {\n /**\n * Disable any debug geography.\n */\n DISABLED = 0,\n\n /**\n * Sets the location to within the EEA.\n */\n EEA = 1,\n\n /**\n * Sets the location to outside of the EEA.\n */\n NOT_EEA = 2,\n}\n"]}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AdsConsentStatus = void 0;
7
+
8
+ /*
9
+ * Copyright (c) 2016-present Invertase Limited & Contributors
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this library except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ *
23
+ */
24
+
25
+ /**
26
+ * AdsConsentStatus enum.
27
+ */
28
+ let AdsConsentStatus;
29
+ exports.AdsConsentStatus = AdsConsentStatus;
30
+
31
+ (function (AdsConsentStatus) {
32
+ AdsConsentStatus[AdsConsentStatus["UNKNOWN"] = 0] = "UNKNOWN";
33
+ AdsConsentStatus[AdsConsentStatus["NON_PERSONALIZED"] = 1] = "NON_PERSONALIZED";
34
+ AdsConsentStatus[AdsConsentStatus["PERSONALIZED"] = 2] = "PERSONALIZED";
35
+ })(AdsConsentStatus || (exports.AdsConsentStatus = AdsConsentStatus = {}));
36
+ //# sourceMappingURL=AdsConsentStatus.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BannerAdSize = void 0;
7
+
8
+ /*
9
+ * Copyright (c) 2016-present Invertase Limited & Contributors
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this library except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ *
23
+ *
24
+ */
25
+ let BannerAdSize;
26
+ exports.BannerAdSize = BannerAdSize;
27
+
28
+ (function (BannerAdSize) {
29
+ BannerAdSize["BANNER"] = "BANNER";
30
+ BannerAdSize["FULL_BANNER"] = "FULL_BANNER";
31
+ BannerAdSize["LARGE_BANNER"] = "LARGE_BANNER";
32
+ BannerAdSize["LEADERBOARD"] = "LEADERBOARD";
33
+ BannerAdSize["MEDIUM_RECTANGLE"] = "MEDIUM_RECTANGLE";
34
+ BannerAdSize["ADAPTIVE_BANNER"] = "ADAPTIVE_BANNER";
35
+ BannerAdSize["FLUID"] = "FLUID";
36
+ BannerAdSize["WIDE_SKYSCRAPER"] = "WIDE_SKYSCRAPER";
37
+ })(BannerAdSize || (exports.BannerAdSize = BannerAdSize = {}));
38
+ //# sourceMappingURL=BannerAdSize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["BannerAdSize.ts"],"names":["BannerAdSize"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAEYA,Y;;;WAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;GAAAA,Y,4BAAAA,Y","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\nexport enum BannerAdSize {\n /**\n * Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels).\n */\n BANNER = 'BANNER',\n\n /**\n * Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels).\n */\n FULL_BANNER = 'FULL_BANNER',\n\n /**\n * Large banner ad size (320x100 density-independent pixels).\n */\n LARGE_BANNER = 'LARGE_BANNER',\n\n /**\n * Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels).\n */\n LEADERBOARD = 'LEADERBOARD',\n\n /**\n * Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels).\n */\n MEDIUM_RECTANGLE = 'MEDIUM_RECTANGLE',\n\n /**\n * A (next generation) dynamically sized banner that is full-width and auto-height.\n */\n ADAPTIVE_BANNER = 'ADAPTIVE_BANNER',\n\n /**\n * A dynamically sized banner that matches its parent's width and expands/contracts its height to match the ad's content after loading completes.\n */\n FLUID = 'FLUID',\n\n /**\n * IAB wide skyscraper ad size (160x600 density-independent pixels). This size is currently not supported by the Google Mobile Ads network; this is intended for mediation ad networks only.\n */\n WIDE_SKYSCRAPER = 'WIDE_SKYSCRAPER',\n}\n"]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MaxAdContentRating = void 0;
7
+
8
+ /*
9
+ * Copyright (c) 2016-present Invertase Limited & Contributors
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this library except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ *
23
+ */
24
+ let MaxAdContentRating;
25
+ exports.MaxAdContentRating = MaxAdContentRating;
26
+
27
+ (function (MaxAdContentRating) {
28
+ MaxAdContentRating["G"] = "G";
29
+ MaxAdContentRating["PG"] = "PG";
30
+ MaxAdContentRating["T"] = "T";
31
+ MaxAdContentRating["MA"] = "MA";
32
+ })(MaxAdContentRating || (exports.MaxAdContentRating = MaxAdContentRating = {}));
33
+ //# sourceMappingURL=MaxAdContentRating.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["MaxAdContentRating.ts"],"names":["MaxAdContentRating"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAEYA,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB","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\nexport enum MaxAdContentRating {\n /**\n * \"General audiences.\" Content suitable for all audiences, including families and children.\n */\n G = 'G',\n\n /**\n * \"Parental guidance.\" Content suitable for most audiences with parental guidance, including topics like non-realistic, cartoonish violence.\n */\n PG = 'PG',\n\n /**\n * T: \"Teen.\" Content suitable for teen and older audiences, including topics such as general health, social networks, scary imagery, and fight sports.\n */\n T = 'T',\n\n /**\n * \"Mature audiences.\" Content suitable only for mature audiences; includes topics such as alcohol, gambling, sexual content, and weapons.\n */\n MA = 'MA',\n}\n"]}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.MobileAds = void 0;
7
+
8
+ var _internal = require("./internal");
9
+
10
+ var _validateAdRequestConfiguration = require("./validateAdRequestConfiguration");
11
+
12
+ var _version = require("./version");
13
+
14
+ const namespace = 'google_mobile_ads';
15
+ const nativeModuleName = ['RNGoogleMobileAdsModule', 'RNGoogleMobileAdsAppOpenModule', 'RNGoogleMobileAdsInterstitialModule', 'RNGoogleMobileAdsRewardedModule'];
16
+
17
+ class MobileAdsModule extends _internal.Module {
18
+ constructor(app, config) {
19
+ super(app, config);
20
+ this.emitter.addListener('google_mobile_ads_app_open_event', event => {
21
+ this.emitter.emit(`google_mobile_ads_app_open_event:${event.adUnitId}:${event.requestId}`, event);
22
+ });
23
+ this.emitter.addListener('google_mobile_ads_interstitial_event', event => {
24
+ this.emitter.emit(`google_mobile_ads_interstitial_event:${event.adUnitId}:${event.requestId}`, event);
25
+ });
26
+ this.emitter.addListener('google_mobile_ads_rewarded_event', event => {
27
+ this.emitter.emit(`google_mobile_ads_rewarded_event:${event.adUnitId}:${event.requestId}`, event);
28
+ });
29
+ }
30
+
31
+ initialize() {
32
+ return this.native.initialize();
33
+ }
34
+
35
+ setRequestConfiguration(requestConfiguration) {
36
+ let config;
37
+
38
+ try {
39
+ config = (0, _validateAdRequestConfiguration.validateAdRequestConfiguration)(requestConfiguration);
40
+ } catch (e) {
41
+ if (e instanceof Error) {
42
+ throw new Error(`googleMobileAds.setRequestConfiguration(*) ${e.message}`);
43
+ }
44
+ }
45
+
46
+ return this.native.setRequestConfiguration(config);
47
+ }
48
+
49
+ }
50
+
51
+ const MobileAdsInstance = new MobileAdsModule({
52
+ name: 'AppName'
53
+ }, {
54
+ version: _version.version,
55
+ namespace,
56
+ nativeModuleName,
57
+ nativeEvents: ['google_mobile_ads_app_open_event', 'google_mobile_ads_interstitial_event', 'google_mobile_ads_rewarded_event']
58
+ });
59
+
60
+ const MobileAds = () => {
61
+ return MobileAdsInstance;
62
+ };
63
+
64
+ exports.MobileAds = MobileAds;
65
+ var _default = MobileAds;
66
+ exports.default = _default;
67
+ //# sourceMappingURL=MobileAds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["MobileAds.ts"],"names":["namespace","nativeModuleName","MobileAdsModule","Module","constructor","app","config","emitter","addListener","event","emit","adUnitId","requestId","initialize","native","setRequestConfiguration","requestConfiguration","e","Error","message","MobileAdsInstance","name","version","nativeEvents","MobileAds"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAKA,MAAMA,SAAS,GAAG,mBAAlB;AAEA,MAAMC,gBAAgB,GAAG,CACvB,yBADuB,EAEvB,gCAFuB,EAGvB,qCAHuB,EAIvB,iCAJuB,CAAzB;;AAYA,MAAMC,eAAN,SAA8BC,gBAA9B,CAAyE;AACvEC,EAAAA,WAAW,CAACC,GAAD,EAAWC,MAAX,EAA2B;AACpC,UAAMD,GAAN,EAAWC,MAAX;AAEA,SAAKC,OAAL,CAAaC,WAAb,CAAyB,kCAAzB,EAA8DC,KAAD,IAAkB;AAC7E,WAAKF,OAAL,CAAaG,IAAb,CACG,oCAAmCD,KAAK,CAACE,QAAS,IAAGF,KAAK,CAACG,SAAU,EADxE,EAEEH,KAFF;AAID,KALD;AAOA,SAAKF,OAAL,CAAaC,WAAb,CAAyB,sCAAzB,EAAkEC,KAAD,IAAkB;AACjF,WAAKF,OAAL,CAAaG,IAAb,CACG,wCAAuCD,KAAK,CAACE,QAAS,IAAGF,KAAK,CAACG,SAAU,EAD5E,EAEEH,KAFF;AAID,KALD;AAOA,SAAKF,OAAL,CAAaC,WAAb,CAAyB,kCAAzB,EAA8DC,KAAD,IAAkB;AAC7E,WAAKF,OAAL,CAAaG,IAAb,CACG,oCAAmCD,KAAK,CAACE,QAAS,IAAGF,KAAK,CAACG,SAAU,EADxE,EAEEH,KAFF;AAID,KALD;AAMD;;AAEDI,EAAAA,UAAU,GAAG;AACX,WAAO,KAAKC,MAAL,CAAYD,UAAZ,EAAP;AACD;;AAEDE,EAAAA,uBAAuB,CAACC,oBAAD,EAA6C;AAClE,QAAIV,MAAJ;;AACA,QAAI;AACFA,MAAAA,MAAM,GAAG,oEAA+BU,oBAA/B,CAAT;AACD,KAFD,CAEE,OAAOC,CAAP,EAAU;AACV,UAAIA,CAAC,YAAYC,KAAjB,EAAwB;AACtB,cAAM,IAAIA,KAAJ,CAAW,8CAA6CD,CAAC,CAACE,OAAQ,EAAlE,CAAN;AACD;AACF;;AAED,WAAO,KAAKL,MAAL,CAAYC,uBAAZ,CAAoCT,MAApC,CAAP;AACD;;AAzCsE;;AA4CzE,MAAMc,iBAAiB,GAAG,IAAIlB,eAAJ,CACxB;AAAEmB,EAAAA,IAAI,EAAE;AAAR,CADwB,EAExB;AACEC,EAAAA,OAAO,EAAPA,gBADF;AAEEtB,EAAAA,SAFF;AAGEC,EAAAA,gBAHF;AAIEsB,EAAAA,YAAY,EAAE,CACZ,kCADY,EAEZ,sCAFY,EAGZ,kCAHY;AAJhB,CAFwB,CAA1B;;AAcO,MAAMC,SAAS,GAAG,MAAM;AAC7B,SAAOJ,iBAAP;AACD,CAFM;;;eAIQI,S","sourcesContent":["import { Module } from './internal';\nimport { validateAdRequestConfiguration } from './validateAdRequestConfiguration';\nimport { version } from './version';\nimport { MobileAdsModuleInterface } from './types/MobileAdsModule.interface';\nimport { RequestConfiguration } from './types/RequestConfiguration';\nimport { App, Config } from './types/Module.interface';\n\nconst namespace = 'google_mobile_ads';\n\nconst nativeModuleName = [\n 'RNGoogleMobileAdsModule',\n 'RNGoogleMobileAdsAppOpenModule',\n 'RNGoogleMobileAdsInterstitialModule',\n 'RNGoogleMobileAdsRewardedModule',\n];\n\ntype Event = {\n adUnitId: string;\n requestId: number;\n};\n\nclass MobileAdsModule extends Module implements MobileAdsModuleInterface {\n constructor(app: App, config: Config) {\n super(app, config);\n\n this.emitter.addListener('google_mobile_ads_app_open_event', (event: Event) => {\n this.emitter.emit(\n `google_mobile_ads_app_open_event:${event.adUnitId}:${event.requestId}`,\n event,\n );\n });\n\n this.emitter.addListener('google_mobile_ads_interstitial_event', (event: Event) => {\n this.emitter.emit(\n `google_mobile_ads_interstitial_event:${event.adUnitId}:${event.requestId}`,\n event,\n );\n });\n\n this.emitter.addListener('google_mobile_ads_rewarded_event', (event: Event) => {\n this.emitter.emit(\n `google_mobile_ads_rewarded_event:${event.adUnitId}:${event.requestId}`,\n event,\n );\n });\n }\n\n initialize() {\n return this.native.initialize();\n }\n\n setRequestConfiguration(requestConfiguration: RequestConfiguration) {\n let config;\n try {\n config = validateAdRequestConfiguration(requestConfiguration);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`googleMobileAds.setRequestConfiguration(*) ${e.message}`);\n }\n }\n\n return this.native.setRequestConfiguration(config);\n }\n}\n\nconst MobileAdsInstance = new MobileAdsModule(\n { name: 'AppName' },\n {\n version,\n namespace,\n nativeModuleName,\n nativeEvents: [\n 'google_mobile_ads_app_open_event',\n 'google_mobile_ads_interstitial_event',\n 'google_mobile_ads_rewarded_event',\n ],\n },\n);\n\nexport const MobileAds = () => {\n return MobileAdsInstance;\n};\n\nexport default MobileAds;\n"]}