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
@@ -0,0 +1,109 @@
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
+ import { Platform } from 'react-native';
18
+ import * as Base64 from './Base64';
19
+ import { isString } from './validate';
20
+ export * from './id';
21
+ export * from './path';
22
+ export * from './promise';
23
+ export * from './validate';
24
+ export { Base64 };
25
+ export { ReferenceBase } from './ReferenceBase';
26
+ export function getDataUrlParts(dataUrlString) {
27
+ const isBase64 = dataUrlString.includes(';base64');
28
+ let [mediaType, base64String] = dataUrlString.split(',');
29
+
30
+ if (!mediaType || !base64String) {
31
+ return {
32
+ base64String: undefined,
33
+ mediaType: undefined
34
+ };
35
+ }
36
+
37
+ mediaType = mediaType.replace('data:', '').replace(';base64', '');
38
+
39
+ if (base64String && base64String.includes('%')) {
40
+ base64String = decodeURIComponent(base64String);
41
+ }
42
+
43
+ if (!isBase64) {
44
+ base64String = Base64.btoa(base64String);
45
+ }
46
+
47
+ return {
48
+ base64String,
49
+ mediaType
50
+ };
51
+ }
52
+ export function once(fn, context) {
53
+ let onceResult;
54
+ let ranOnce = false;
55
+ return function onceInner() {
56
+ if (!ranOnce) {
57
+ ranOnce = true;
58
+
59
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
60
+ args[_key] = arguments[_key];
61
+ }
62
+
63
+ onceResult = fn.apply(context || this, args);
64
+ }
65
+
66
+ return onceResult;
67
+ };
68
+ }
69
+ export function isError(value) {
70
+ if (Object.prototype.toString.call(value) === '[object Error]') {
71
+ return true;
72
+ }
73
+
74
+ return value instanceof Error;
75
+ }
76
+ export function hasOwnProperty(target, property) {
77
+ return Object.hasOwnProperty.call(target, property);
78
+ }
79
+ /**
80
+ * Remove a trailing forward slash from a string if it exists
81
+ *
82
+ * @param string
83
+ * @returns {*}
84
+ */
85
+
86
+ export function stripTrailingSlash(string) {
87
+ if (!isString(string)) {
88
+ return string;
89
+ }
90
+
91
+ return string.endsWith('/') ? string.slice(0, -1) : string;
92
+ }
93
+ export const isIOS = Platform.OS === 'ios';
94
+ export const isAndroid = Platform.OS === 'android';
95
+ export function tryJSONParse(string) {
96
+ try {
97
+ return string && JSON.parse(string);
98
+ } catch (jsonError) {
99
+ return string;
100
+ }
101
+ }
102
+ export function tryJSONStringify(data) {
103
+ try {
104
+ return JSON.stringify(data);
105
+ } catch (jsonError) {
106
+ return null;
107
+ }
108
+ }
109
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":["Platform","Base64","isString","ReferenceBase","getDataUrlParts","dataUrlString","isBase64","includes","mediaType","base64String","split","undefined","replace","decodeURIComponent","btoa","once","fn","context","onceResult","ranOnce","onceInner","args","apply","isError","value","Object","prototype","toString","call","Error","hasOwnProperty","target","property","stripTrailingSlash","string","endsWith","slice","isIOS","OS","isAndroid","tryJSONParse","JSON","parse","jsonError","tryJSONStringify","data","stringify"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,QAAT,QAAyB,cAAzB;AACA,OAAO,KAAKC,MAAZ,MAAwB,UAAxB;AACA,SAASC,QAAT,QAAyB,YAAzB;AAEA,cAAc,MAAd;AACA,cAAc,QAAd;AACA,cAAc,WAAd;AACA,cAAc,YAAd;AAEA,SAASD,MAAT;AACA,SAASE,aAAT,QAA8B,iBAA9B;AAEA,OAAO,SAASC,eAAT,CAAyBC,aAAzB,EAA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B,MAA0C,gBAA9C,EAAgE;AAC9D,WAAO,IAAP;AACD;;AAED,SAAOA,KAAK,YAAYK,KAAxB;AACD;AAED,OAAO,SAASC,cAAT,CAAwBC,MAAxB,EAAyCC,QAAzC,EAAgE;AACrE,SAAOP,MAAM,CAACK,cAAP,CAAsBF,IAAtB,CAA2BG,MAA3B,EAAmCC,QAAnC,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA4BC,MAA5B,EAA4C;AACjD,MAAI,CAAChC,QAAQ,CAACgC,MAAD,CAAb,EAAuB;AACrB,WAAOA,MAAP;AACD;;AACD,SAAOA,MAAM,CAACC,QAAP,CAAgB,GAAhB,IAAuBD,MAAM,CAACE,KAAP,CAAa,CAAb,EAAgB,CAAC,CAAjB,CAAvB,GAA6CF,MAApD;AACD;AAED,OAAO,MAAMG,KAAK,GAAGrC,QAAQ,CAACsC,EAAT,KAAgB,KAA9B;AAEP,OAAO,MAAMC,SAAS,GAAGvC,QAAQ,CAACsC,EAAT,KAAgB,SAAlC;AAEP,OAAO,SAASE,YAAT,CAAsBN,MAAtB,EAAsC;AAC3C,MAAI;AACF,WAAOA,MAAM,IAAIO,IAAI,CAACC,KAAL,CAAWR,MAAX,CAAjB;AACD,GAFD,CAEE,OAAOS,SAAP,EAAkB;AAClB,WAAOT,MAAP;AACD;AACF;AAED,OAAO,SAASU,gBAAT,CAA0BC,IAA1B,EAAyC;AAC9C,MAAI;AACF,WAAOJ,IAAI,CAACK,SAAL,CAAeD,IAAf,CAAP;AACD,GAFD,CAEE,OAAOF,SAAP,EAAkB;AAClB,WAAO,IAAP;AACD;AACF","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 { Platform } from 'react-native';\nimport * as Base64 from './Base64';\nimport { isString } from './validate';\n\nexport * from './id';\nexport * from './path';\nexport * from './promise';\nexport * from './validate';\n\nexport { Base64 };\nexport { ReferenceBase } from './ReferenceBase';\n\nexport function getDataUrlParts(dataUrlString: string) {\n const isBase64 = dataUrlString.includes(';base64');\n let [mediaType, base64String] = dataUrlString.split(',');\n if (!mediaType || !base64String) {\n return { base64String: undefined, mediaType: undefined };\n }\n mediaType = mediaType.replace('data:', '').replace(';base64', '');\n if (base64String && base64String.includes('%')) {\n base64String = decodeURIComponent(base64String);\n }\n if (!isBase64) {\n base64String = Base64.btoa(base64String);\n }\n return { base64String, mediaType };\n}\n\nexport function once<T>(fn: () => void, context: unknown): (this: T, ...args: []) => void {\n let onceResult: unknown;\n let ranOnce = false;\n\n return function onceInner(...args: []) {\n if (!ranOnce) {\n ranOnce = true;\n onceResult = fn.apply(context || this, args);\n }\n\n return onceResult;\n };\n}\n\nexport function isError(value: unknown) {\n if (Object.prototype.toString.call(value) === '[object Error]') {\n return true;\n }\n\n return value instanceof Error;\n}\n\nexport function hasOwnProperty(target: unknown, property: PropertyKey) {\n return Object.hasOwnProperty.call(target, property);\n}\n\n/**\n * Remove a trailing forward slash from a string if it exists\n *\n * @param string\n * @returns {*}\n */\nexport function stripTrailingSlash(string: string) {\n if (!isString(string)) {\n return string;\n }\n return string.endsWith('/') ? string.slice(0, -1) : string;\n}\n\nexport const isIOS = Platform.OS === 'ios';\n\nexport const isAndroid = Platform.OS === 'android';\n\nexport function tryJSONParse(string: string) {\n try {\n return string && JSON.parse(string);\n } catch (jsonError) {\n return string;\n }\n}\n\nexport function tryJSONStringify(data: unknown) {\n try {\n return JSON.stringify(data);\n } catch (jsonError) {\n return null;\n }\n}\n"]}
@@ -0,0 +1,120 @@
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
+ /**
19
+ * Returns the next parent of the path e.g. /foo/bar/car -> /foo/bar
20
+ */
21
+ export function pathParent(path) {
22
+ if (path.length === 0) {
23
+ return null;
24
+ }
25
+
26
+ const index = path.lastIndexOf('/');
27
+
28
+ if (index <= 0) {
29
+ return null;
30
+ }
31
+
32
+ return path.slice(0, index);
33
+ }
34
+ /**
35
+ * Joins a parent and a child path
36
+ */
37
+
38
+ export function pathChild(path, childPath) {
39
+ const canonicalChildPath = pathPieces(childPath).join('/');
40
+
41
+ if (path.length === 0) {
42
+ return canonicalChildPath;
43
+ }
44
+
45
+ return `${path}/${canonicalChildPath}`;
46
+ }
47
+ /**
48
+ * Returns the last component of a path, e.g /foo/bar.jpeg -> bar.jpeg
49
+ */
50
+
51
+ export function pathLastComponent(path) {
52
+ const index = path.lastIndexOf('/', path.length - 2);
53
+
54
+ if (index === -1) {
55
+ return path;
56
+ }
57
+
58
+ return path.slice(index + 1);
59
+ }
60
+ /**
61
+ * Returns all none empty pieces of the path
62
+ * @param path
63
+ * @returns {*}
64
+ */
65
+
66
+ export function pathPieces(path) {
67
+ return path.split('/').filter($ => $.length > 0);
68
+ }
69
+ /**
70
+ * Returns whether a given path is empty
71
+ * @param path
72
+ * @returns {boolean}
73
+ */
74
+
75
+ export function pathIsEmpty(path) {
76
+ return !pathPieces(path).length;
77
+ }
78
+ /**
79
+ * Converts a given path to a URL encoded string
80
+ * @param path
81
+ * @returns {string|string}
82
+ */
83
+
84
+ export function pathToUrlEncodedString(path) {
85
+ const pieces = pathPieces(path);
86
+ let pathString = '';
87
+
88
+ for (let i = 0; i < pieces.length; i++) {
89
+ pathString += `/${encodeURIComponent(String(pieces[i]))}`;
90
+ }
91
+
92
+ return pathString || '/';
93
+ } // eslint-disable-next-line no-control-regex
94
+
95
+ export const INVALID_PATH_REGEX = /[[\].#$\u0000-\u001F\u007F]/;
96
+ /**
97
+ * Ensures a given path is a valid Firebase path
98
+ * @param path
99
+ * @returns {boolean}
100
+ */
101
+
102
+ export function isValidPath(path) {
103
+ return typeof path === 'string' && path.length !== 0 && !INVALID_PATH_REGEX.test(path);
104
+ }
105
+ /**
106
+ * Converts a file path to a standardized string path
107
+ * @param path
108
+ * @returns {*}
109
+ */
110
+
111
+ export function toFilePath(path) {
112
+ let _filePath = path.replace('file://', '');
113
+
114
+ if (_filePath.includes('%')) {
115
+ _filePath = decodeURIComponent(_filePath);
116
+ }
117
+
118
+ return _filePath;
119
+ }
120
+ //# sourceMappingURL=path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["path.ts"],"names":["pathParent","path","length","index","lastIndexOf","slice","pathChild","childPath","canonicalChildPath","pathPieces","join","pathLastComponent","split","filter","$","pathIsEmpty","pathToUrlEncodedString","pieces","pathString","i","encodeURIComponent","String","INVALID_PATH_REGEX","isValidPath","test","toFilePath","_filePath","replace","includes","decodeURIComponent"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,SAASA,UAAT,CAAoBC,IAApB,EAAkC;AACvC,MAAIA,IAAI,CAACC,MAAL,KAAgB,CAApB,EAAuB;AACrB,WAAO,IAAP;AACD;;AAED,QAAMC,KAAK,GAAGF,IAAI,CAACG,WAAL,CAAiB,GAAjB,CAAd;;AACA,MAAID,KAAK,IAAI,CAAb,EAAgB;AACd,WAAO,IAAP;AACD;;AAED,SAAOF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AC,EAApC,EAAwC;AACtCD,IAAAA,UAAU,IAAK,IAAGE,kBAAkB,CAACC,MAAM,CAACJ,MAAM,CAACE,CAAD,CAAP,CAAP,CAAoB,EAAxD;AACD;;AACD,SAAOD,UAAU,IAAI,GAArB;AACD,C,CAED;;AACA,OAAO,MAAMI,kBAAkB,GAAG,6BAA3B;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,WAAT,CAAqBtB,IAArB,EAAoC;AACzC,SAAO,OAAOA,IAAP,KAAgB,QAAhB,IAA4BA,IAAI,CAACC,MAAL,KAAgB,CAA5C,IAAiD,CAACoB,kBAAkB,CAACE,IAAnB,CAAwBvB,IAAxB,CAAzD;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASwB,UAAT,CAAoBxB,IAApB,EAAkC;AACvC,MAAIyB,SAAS,GAAGzB,IAAI,CAAC0B,OAAL,CAAa,SAAb,EAAwB,EAAxB,CAAhB;;AACA,MAAID,SAAS,CAACE,QAAV,CAAmB,GAAnB,CAAJ,EAA6B;AAC3BF,IAAAA,SAAS,GAAGG,kBAAkB,CAACH,SAAD,CAA9B;AACD;;AACD,SAAOA,SAAP;AACD","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\n/**\n * Returns the next parent of the path e.g. /foo/bar/car -> /foo/bar\n */\nexport function pathParent(path: string) {\n if (path.length === 0) {\n return null;\n }\n\n const index = path.lastIndexOf('/');\n if (index <= 0) {\n return null;\n }\n\n return path.slice(0, index);\n}\n\n/**\n * Joins a parent and a child path\n */\nexport function pathChild(path: string, childPath: string) {\n const canonicalChildPath = pathPieces(childPath).join('/');\n\n if (path.length === 0) {\n return canonicalChildPath;\n }\n\n return `${path}/${canonicalChildPath}`;\n}\n\n/**\n * Returns the last component of a path, e.g /foo/bar.jpeg -> bar.jpeg\n */\nexport function pathLastComponent(path: string) {\n const index = path.lastIndexOf('/', path.length - 2);\n if (index === -1) {\n return path;\n }\n\n return path.slice(index + 1);\n}\n\n/**\n * Returns all none empty pieces of the path\n * @param path\n * @returns {*}\n */\nexport function pathPieces(path: string) {\n return path.split('/').filter($ => $.length > 0);\n}\n\n/**\n * Returns whether a given path is empty\n * @param path\n * @returns {boolean}\n */\nexport function pathIsEmpty(path: string) {\n return !pathPieces(path).length;\n}\n\n/**\n * Converts a given path to a URL encoded string\n * @param path\n * @returns {string|string}\n */\nexport function pathToUrlEncodedString(path: string) {\n const pieces = pathPieces(path);\n let pathString = '';\n for (let i = 0; i < pieces.length; i++) {\n pathString += `/${encodeURIComponent(String(pieces[i]))}`;\n }\n return pathString || '/';\n}\n\n// eslint-disable-next-line no-control-regex\nexport const INVALID_PATH_REGEX = /[[\\].#$\\u0000-\\u001F\\u007F]/;\n\n/**\n * Ensures a given path is a valid Firebase path\n * @param path\n * @returns {boolean}\n */\nexport function isValidPath(path: unknown) {\n return typeof path === 'string' && path.length !== 0 && !INVALID_PATH_REGEX.test(path);\n}\n\n/**\n * Converts a file path to a standardized string path\n * @param path\n * @returns {*}\n */\nexport function toFilePath(path: string) {\n let _filePath = path.replace('file://', '');\n if (_filePath.includes('%')) {\n _filePath = decodeURIComponent(_filePath);\n }\n return _filePath;\n}\n"]}
@@ -0,0 +1,60 @@
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
+ import { isFunction } from './validate';
18
+ /**
19
+ *
20
+ */
21
+
22
+ export function promiseDefer() {
23
+ const deferred = {
24
+ promise: null,
25
+ resolve: () => {},
26
+ reject: () => {}
27
+ };
28
+ deferred.promise = new Promise((resolve, reject) => {
29
+ deferred.resolve = resolve;
30
+ deferred.reject = reject;
31
+ });
32
+ return deferred;
33
+ }
34
+ /**
35
+ * @param promise
36
+ * @param callback
37
+ */
38
+
39
+ export function promiseWithOptionalCallback(promise, callback) {
40
+ if (!isFunction(callback)) {
41
+ return promise;
42
+ }
43
+
44
+ return promise.then(result => {
45
+ if (callback && callback.length === 1) {
46
+ callback(null);
47
+ } else if (callback) {
48
+ callback(null, result);
49
+ }
50
+
51
+ return result;
52
+ }).catch(error => {
53
+ if (callback) {
54
+ callback(error);
55
+ }
56
+
57
+ return Promise.reject(error);
58
+ });
59
+ }
60
+ //# sourceMappingURL=promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["promise.ts"],"names":["isFunction","promiseDefer","deferred","promise","resolve","reject","Promise","promiseWithOptionalCallback","callback","then","result","length","catch","error"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,UAAT,QAA2B,YAA3B;AAEA;AACA;AACA;;AACA,OAAO,SAASC,YAAT,GAAwB;AAC7B,QAAMC,QAIL,GAAG;AAAEC,IAAAA,OAAO,EAAE,IAAX;AAAiBC,IAAAA,OAAO,EAAE,MAAM,CAAE,CAAlC;AAAoCC,IAAAA,MAAM,EAAE,MAAM,CAAE;AAApD,GAJJ;AAMAH,EAAAA,QAAQ,CAACC,OAAT,GAAmB,IAAIG,OAAJ,CAAY,CAACF,OAAD,EAAUC,MAAV,KAAqB;AAClDH,IAAAA,QAAQ,CAACE,OAAT,GAAmBA,OAAnB;AACAF,IAAAA,QAAQ,CAACG,MAAT,GAAkBA,MAAlB;AACD,GAHkB,CAAnB;AAKA,SAAOH,QAAP;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASK,2BAAT,CACLJ,OADK,EAELK,QAFK,EAGL;AACA,MAAI,CAACR,UAAU,CAACQ,QAAD,CAAf,EAA2B;AACzB,WAAOL,OAAP;AACD;;AAED,SAAOA,OAAO,CACXM,IADI,CACCC,MAAM,IAAI;AACd,QAAIF,QAAQ,IAAIA,QAAQ,CAACG,MAAT,KAAoB,CAApC,EAAuC;AACrCH,MAAAA,QAAQ,CAAC,IAAD,CAAR;AACD,KAFD,MAEO,IAAIA,QAAJ,EAAc;AACnBA,MAAAA,QAAQ,CAAC,IAAD,EAAOE,MAAP,CAAR;AACD;;AAED,WAAOA,MAAP;AACD,GATI,EAUJE,KAVI,CAUEC,KAAK,IAAI;AACd,QAAIL,QAAJ,EAAc;AACZA,MAAAA,QAAQ,CAACK,KAAD,CAAR;AACD;;AACD,WAAOP,OAAO,CAACD,MAAR,CAAeQ,KAAf,CAAP;AACD,GAfI,CAAP;AAgBD","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 { isFunction } from './validate';\n\n/**\n *\n */\nexport function promiseDefer() {\n const deferred: {\n promise: Promise<unknown> | null;\n resolve: (value: unknown) => void;\n reject: (value: unknown) => void;\n } = { promise: null, resolve: () => {}, reject: () => {} };\n\n deferred.promise = new Promise((resolve, reject) => {\n deferred.resolve = resolve;\n deferred.reject = reject;\n });\n\n return deferred;\n}\n\n/**\n * @param promise\n * @param callback\n */\nexport function promiseWithOptionalCallback(\n promise: Promise<unknown>,\n callback: (a: unknown, b?: unknown) => void,\n) {\n if (!isFunction(callback)) {\n return promise;\n }\n\n return promise\n .then(result => {\n if (callback && callback.length === 1) {\n callback(null);\n } else if (callback) {\n callback(null, result);\n }\n\n return result;\n })\n .catch(error => {\n if (callback) {\n callback(error);\n }\n return Promise.reject(error);\n });\n}\n"]}
@@ -0,0 +1,41 @@
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
+ import { tryJSONParse, tryJSONStringify } from './index';
18
+ import { isObject } from './validate';
19
+ export function serializeType(value) {
20
+ if (isObject(value)) {
21
+ return {
22
+ type: 'object',
23
+ value: serializeObject(value)
24
+ };
25
+ }
26
+
27
+ return {
28
+ type: typeof value,
29
+ value
30
+ };
31
+ }
32
+ export function serializeObject(object) {
33
+ if (!isObject(object)) {
34
+ return object;
35
+ } // json stringify then parse it calls toString on Objects / Classes
36
+ // that support it i.e new Date() becomes a ISO string.
37
+
38
+
39
+ return tryJSONParse(tryJSONStringify(object) || '');
40
+ }
41
+ //# sourceMappingURL=serialize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["serialize.ts"],"names":["tryJSONParse","tryJSONStringify","isObject","serializeType","value","type","serializeObject","object"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,YAAT,EAAuBC,gBAAvB,QAA+C,SAA/C;AACA,SAASC,QAAT,QAAyB,YAAzB;AAEA,OAAO,SAASC,aAAT,CAAuBC,KAAvB,EAAuC;AAC5C,MAAIF,QAAQ,CAACE,KAAD,CAAZ,EAAqB;AACnB,WAAO;AACLC,MAAAA,IAAI,EAAE,QADD;AAELD,MAAAA,KAAK,EAAEE,eAAe,CAACF,KAAD;AAFjB,KAAP;AAID;;AAED,SAAO;AACLC,IAAAA,IAAI,EAAE,OAAOD,KADR;AAELA,IAAAA;AAFK,GAAP;AAID;AAED,OAAO,SAASE,eAAT,CAAyBC,MAAzB,EAA0C;AAC/C,MAAI,CAACL,QAAQ,CAACK,MAAD,CAAb,EAAuB;AACrB,WAAOA,MAAP;AACD,GAH8C,CAK/C;AACA;;;AACA,SAAOP,YAAY,CAACC,gBAAgB,CAACM,MAAD,CAAhB,IAA4B,EAA7B,CAAnB;AACD","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport { tryJSONParse, tryJSONStringify } from './index';\nimport { isObject } from './validate';\n\nexport function serializeType(value: unknown) {\n if (isObject(value)) {\n return {\n type: 'object',\n value: serializeObject(value),\n };\n }\n\n return {\n type: typeof value,\n value,\n };\n}\n\nexport function serializeObject(object: unknown) {\n if (!isObject(object)) {\n return object;\n }\n\n // json stringify then parse it calls toString on Objects / Classes\n // that support it i.e new Date() becomes a ISO string.\n return tryJSONParse(tryJSONStringify(object) || '');\n}\n"]}
@@ -0,0 +1,197 @@
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
+ import { Platform } from 'react-native';
18
+ const AlphaNumericUnderscore = /^[a-zA-Z0-9_]+$/;
19
+ export function objectKeyValuesAreStrings(object) {
20
+ if (!isObject(object)) {
21
+ return false;
22
+ }
23
+
24
+ const entries = Object.entries(object);
25
+
26
+ for (let i = 0; i < entries.length; i++) {
27
+ const [key, value] = entries[i];
28
+
29
+ if (!isString(key) || !isString(value)) {
30
+ return false;
31
+ }
32
+ }
33
+
34
+ return true;
35
+ }
36
+ /**
37
+ * Simple is null check.
38
+ *
39
+ * @param value
40
+ * @returns {boolean}
41
+ */
42
+
43
+ export function isNull(value) {
44
+ return value === null;
45
+ }
46
+ /**
47
+ * Simple is object check.
48
+ *
49
+ * @param value
50
+ * @returns {boolean}
51
+ */
52
+
53
+ export function isObject(value) {
54
+ return value ? typeof value === 'object' && !Array.isArray(value) && !isNull(value) : false;
55
+ }
56
+ /**
57
+ * Simple is date check
58
+ * https://stackoverflow.com/a/44198641
59
+ * @param value
60
+ * @returns {boolean}
61
+ */
62
+
63
+ export function isDate(value) {
64
+ // use the global isNaN() and not Number.isNaN() since it will validate an Invalid Date
65
+ return value && Object.prototype.toString.call(value) === '[object Date]' && !isNaN(value);
66
+ }
67
+ /**
68
+ * Simple is function check
69
+ *
70
+ * @param value
71
+ * @returns {*|boolean}
72
+ */
73
+
74
+ export function isFunction(value) {
75
+ return value ? typeof value === 'function' : false;
76
+ }
77
+ /**
78
+ * Simple is string check
79
+ * @param value
80
+ * @return {boolean}
81
+ */
82
+
83
+ export function isString(value) {
84
+ return typeof value === 'string';
85
+ }
86
+ /**
87
+ * Simple is number check
88
+ * @param value
89
+ * @return {boolean}
90
+ */
91
+
92
+ export function isNumber(value) {
93
+ return typeof value === 'number';
94
+ }
95
+ /**
96
+ * Simple finite check
97
+ * @param value
98
+ * @returns {boolean}
99
+ */
100
+
101
+ export function isFinite(value) {
102
+ return Number.isFinite(value);
103
+ }
104
+ /**
105
+ * Simple integer check
106
+ * @param value
107
+ * @returns {boolean}
108
+ */
109
+
110
+ export function isInteger(value) {
111
+ return Number.isInteger(value);
112
+ }
113
+ /**
114
+ * Simple is boolean check
115
+ *
116
+ * @param value
117
+ * @return {boolean}
118
+ */
119
+
120
+ export function isBoolean(value) {
121
+ return typeof value === 'boolean';
122
+ }
123
+ /**
124
+ *
125
+ * @param value
126
+ * @returns {arg is Array<unknown>}
127
+ */
128
+
129
+ export function isArray(value) {
130
+ return Array.isArray(value);
131
+ }
132
+ /**
133
+ *
134
+ * @param value
135
+ * @returns {boolean}
136
+ */
137
+
138
+ export function isUndefined(value) {
139
+ return typeof value === 'undefined';
140
+ }
141
+ /**
142
+ * /^[a-zA-Z0-9_]+$/
143
+ *
144
+ * @param value
145
+ * @returns {boolean}
146
+ */
147
+
148
+ export function isAlphaNumericUnderscore(value) {
149
+ return AlphaNumericUnderscore.test(value);
150
+ }
151
+ /**
152
+ * URL test
153
+ * @param url
154
+ * @returns {boolean}
155
+ */
156
+
157
+ const IS_VALID_URL_REGEX = /^(http|https):\/\/[^ "]+$/;
158
+ export function isValidUrl(url) {
159
+ return IS_VALID_URL_REGEX.test(url);
160
+ }
161
+ /**
162
+ * Array includes
163
+ *
164
+ * @param value
165
+ * @param oneOf
166
+ * @returns {boolean}
167
+ */
168
+
169
+ export function isOneOf(value) {
170
+ let oneOf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
171
+
172
+ if (!isArray(oneOf)) {
173
+ return false;
174
+ }
175
+
176
+ return oneOf.includes(value);
177
+ }
178
+ export function noop() {// noop-🐈
179
+ }
180
+ export function validateOptionalNativeDependencyExists(firebaseJsonKey, apiName, nativeFnExists) {
181
+ if (nativeFnExists) {
182
+ return;
183
+ }
184
+
185
+ let errorMessage = "You attempted to use an optional API that's not enabled natively. \n\n To enable ";
186
+ errorMessage += apiName;
187
+ errorMessage += ` please set the 'react-native' -> '${firebaseJsonKey}' key to true in your firebase.json file`;
188
+
189
+ if (Platform.OS === 'android') {
190
+ errorMessage += ' and rebuild your Android app.';
191
+ } else {
192
+ errorMessage += ', re-run pod install and rebuild your iOS app. ' + "If you're not using Pods then make sure you've have downloaded the necessary Firebase iOS SDK dependencies for this API.";
193
+ }
194
+
195
+ throw new Error(errorMessage);
196
+ }
197
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["validate.ts"],"names":["Platform","AlphaNumericUnderscore","objectKeyValuesAreStrings","object","isObject","entries","Object","i","length","key","value","isString","isNull","Array","isArray","isDate","prototype","toString","call","isNaN","isFunction","isNumber","isFinite","Number","isInteger","isBoolean","isUndefined","isAlphaNumericUnderscore","test","IS_VALID_URL_REGEX","isValidUrl","url","isOneOf","oneOf","includes","noop","validateOptionalNativeDependencyExists","firebaseJsonKey","apiName","nativeFnExists","errorMessage","OS","Error"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,QAAT,QAAyB,cAAzB;AAEA,MAAMC,sBAAsB,GAAG,iBAA/B;AAEA,OAAO,SAASC,yBAAT,CAAmCC,MAAnC,EAAoE;AACzE,MAAI,CAACC,QAAQ,CAACD,MAAD,CAAb,EAAuB;AACrB,WAAO,KAAP;AACD;;AAED,QAAME,OAAO,GAAGC,MAAM,CAACD,OAAP,CAAeF,MAAf,CAAhB;;AAEA,OAAK,IAAII,CAAC,GAAG,CAAb,EAAgBA,CA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ED,OAAO,SAASC,sCAAT,CACLC,eADK,EAELC,OAFK,EAGLC,cAHK,EAIL;AACA,MAAIA,cAAJ,EAAoB;AAClB;AACD;;AACD,MAAIC,YAAY,GACd,mFADF;AAGAA,EAAAA,YAAY,IAAIF,OAAhB;AACAE,EAAAA,YAAY,IAAK,sCAAqCH,eAAgB,0CAAtE;;AAEA,MAAIrC,QAAQ,CAACyC,EAAT,KAAgB,SAApB,EAA+B;AAC7BD,IAAAA,YAAY,IAAI,gCAAhB;AACD,GAFD,MAEO;AACLA,IAAAA,YAAY,IACV,oDACA,0HAFF;AAGD;;AAED,QAAM,IAAIE,KAAJ,CAAUF,YAAV,CAAN;AACD","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport { Platform } from 'react-native';\n\nconst AlphaNumericUnderscore = /^[a-zA-Z0-9_]+$/;\n\nexport function objectKeyValuesAreStrings(object: Record<string, unknown>) {\n if (!isObject(object)) {\n return false;\n }\n\n const entries = Object.entries(object);\n\n for (let i = 0; i < entries.length; i++) {\n const [key, value] = entries[i];\n if (!isString(key) || !isString(value)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Simple is null check.\n *\n * @param value\n * @returns {boolean}\n */\nexport function isNull(value: unknown) {\n return value === null;\n}\n\n/**\n * Simple is object check.\n *\n * @param value\n * @returns {boolean}\n */\nexport function isObject(value: unknown) {\n return value ? typeof value === 'object' && !Array.isArray(value) && !isNull(value) : false;\n}\n\n/**\n * Simple is date check\n * https://stackoverflow.com/a/44198641\n * @param value\n * @returns {boolean}\n */\nexport function isDate(value: number) {\n // use the global isNaN() and not Number.isNaN() since it will validate an Invalid Date\n return value && Object.prototype.toString.call(value) === '[object Date]' && !isNaN(value);\n}\n\n/**\n * Simple is function check\n *\n * @param value\n * @returns {*|boolean}\n */\nexport function isFunction(value: unknown) {\n return value ? typeof value === 'function' : false;\n}\n\n/**\n * Simple is string check\n * @param value\n * @return {boolean}\n */\nexport function isString(value: unknown) {\n return typeof value === 'string';\n}\n\n/**\n * Simple is number check\n * @param value\n * @return {boolean}\n */\nexport function isNumber(value: unknown): value is number {\n return typeof value === 'number';\n}\n\n/**\n * Simple finite check\n * @param value\n * @returns {boolean}\n */\nexport function isFinite(value: unknown) {\n return Number.isFinite(value);\n}\n\n/**\n * Simple integer check\n * @param value\n * @returns {boolean}\n */\nexport function isInteger(value: unknown) {\n return Number.isInteger(value);\n}\n\n/**\n * Simple is boolean check\n *\n * @param value\n * @return {boolean}\n */\nexport function isBoolean(value: unknown) {\n return typeof value === 'boolean';\n}\n\n/**\n *\n * @param value\n * @returns {arg is Array<unknown>}\n */\nexport function isArray(value: unknown) {\n return Array.isArray(value);\n}\n\n/**\n *\n * @param value\n * @returns {boolean}\n */\nexport function isUndefined(value: unknown): value is undefined {\n return typeof value === 'undefined';\n}\n\n/**\n * /^[a-zA-Z0-9_]+$/\n *\n * @param value\n * @returns {boolean}\n */\nexport function isAlphaNumericUnderscore(value: string) {\n return AlphaNumericUnderscore.test(value);\n}\n\n/**\n * URL test\n * @param url\n * @returns {boolean}\n */\nconst IS_VALID_URL_REGEX = /^(http|https):\\/\\/[^ \"]+$/;\nexport function isValidUrl(url: string) {\n return IS_VALID_URL_REGEX.test(url);\n}\n\n/**\n * Array includes\n *\n * @param value\n * @param oneOf\n * @returns {boolean}\n */\nexport function isOneOf(value: unknown, oneOf: unknown[] = []) {\n if (!isArray(oneOf)) {\n return false;\n }\n return oneOf.includes(value);\n}\n\nexport function noop() {\n // noop-🐈\n}\n\nexport function validateOptionalNativeDependencyExists(\n firebaseJsonKey: string,\n apiName: string,\n nativeFnExists: boolean,\n) {\n if (nativeFnExists) {\n return;\n }\n let errorMessage =\n \"You attempted to use an optional API that's not enabled natively. \\n\\n To enable \";\n\n errorMessage += apiName;\n errorMessage += ` please set the 'react-native' -> '${firebaseJsonKey}' key to true in your firebase.json file`;\n\n if (Platform.OS === 'android') {\n errorMessage += ' and rebuild your Android app.';\n } else {\n errorMessage +=\n ', re-run pod install and rebuild your iOS app. ' +\n \"If you're not using Pods then make sure you've have downloaded the necessary Firebase iOS SDK dependencies for this API.\";\n }\n\n throw new Error(errorMessage);\n}\n"]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=declarations.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -0,0 +1,33 @@
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
+ import { version } from './version'; // import { SDK_VERSION } from 'react-native-google-mobile-ads';
18
+
19
+ export const SDK_VERSION = version;
20
+ export { default, MobileAds } from './MobileAds';
21
+ export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
22
+ export { AdsConsentStatus } from './AdsConsentStatus';
23
+ export { MaxAdContentRating } from './MaxAdContentRating';
24
+ export { TestIds } from './TestIds';
25
+ export { AdEventType } from './AdEventType';
26
+ export { BannerAdSize } from './BannerAdSize';
27
+ export { RewardedAdEventType } from './RewardedAdEventType';
28
+ export { AdsConsent } from './AdsConsent';
29
+ export { AppOpenAd } from './ads/AppOpenAd';
30
+ export { InterstitialAd } from './ads/InterstitialAd';
31
+ export { RewardedAd } from './ads/RewardedAd';
32
+ export { BannerAd } from './ads/BannerAd';
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":["version","SDK_VERSION","default","MobileAds","AdsConsentDebugGeography","AdsConsentStatus","MaxAdContentRating","TestIds","AdEventType","BannerAdSize","RewardedAdEventType","AdsConsent","AppOpenAd","InterstitialAd","RewardedAd","BannerAd"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,OAAT,QAAwB,WAAxB,C,CAEA;;AACA,OAAO,MAAMC,WAAW,GAAGD,OAApB;AAEP,SAASE,OAAT,EAAkBC,SAAlB,QAAmC,aAAnC;AACA,SAASC,wBAAT,QAAyC,4BAAzC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AACA,SAASC,OAAT,QAAwB,WAAxB;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,cAAT,QAA+B,sBAA/B;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,QAAT,QAAyB,gBAAzB","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 { version } from './version';\n\n// import { SDK_VERSION } from 'react-native-google-mobile-ads';\nexport const SDK_VERSION = version;\n\nexport { default, MobileAds } from './MobileAds';\nexport { AdsConsentDebugGeography } from './AdsConsentDebugGeography';\nexport { AdsConsentStatus } from './AdsConsentStatus';\nexport { MaxAdContentRating } from './MaxAdContentRating';\nexport { TestIds } from './TestIds';\nexport { AdEventType } from './AdEventType';\nexport { BannerAdSize } from './BannerAdSize';\nexport { RewardedAdEventType } from './RewardedAdEventType';\nexport { AdsConsent } from './AdsConsent';\nexport { AppOpenAd } from './ads/AppOpenAd';\nexport { InterstitialAd } from './ads/InterstitialAd';\nexport { RewardedAd } from './ads/RewardedAd';\nexport { BannerAd } from './ads/BannerAd';\n"]}