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.
- package/LICENSE +32 -0
- package/README.md +65 -0
- package/RNGoogleMobileAds.podspec +42 -0
- package/__tests__/consent.test.ts +25 -0
- package/__tests__/googleMobileAds.test.ts +63 -0
- package/__tests__/interstitial.test.ts +53 -0
- package/__tests__/requestOptions.test.tsx +4 -0
- package/__tests__/rewarded.test.tsx +4 -0
- package/__tests__/showOptions.test.tsx +4 -0
- package/android/.editorconfig +10 -0
- package/android/app-json.gradle +69 -0
- package/android/build.gradle +98 -0
- package/android/lint.xml +5 -0
- package/android/settings.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +17 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeAppModule.java +169 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsAppOpenModule.java +161 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsBannerAdViewManager.java +209 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsCommon.java +256 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsConsentModule.java +226 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsEvent.java +72 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsInterstitialModule.java +159 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.java +143 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsPackage.java +48 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsRewardedModule.java +177 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/RCTConvert.java +111 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeApp.java +34 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeEvent.java +41 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeEventEmitter.java +150 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeInitProvider.java +77 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeJSON.java +107 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeMeta.java +92 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeModule.java +96 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativePreferences.java +86 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/SharedUtils.java +427 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/TaskExecutorService.java +124 -0
- package/android/src/main/java/io/invertase/googlemobileads/interfaces/ContextProvider.java +30 -0
- package/android/src/main/java/io/invertase/googlemobileads/interfaces/NativeError.java +28 -0
- package/android/src/main/java/io/invertase/googlemobileads/interfaces/NativeEvent.java +26 -0
- package/babel.config.js +18 -0
- package/docs/displaying-ads.mdx +319 -0
- package/docs/european-user-consent.mdx +258 -0
- package/docs/img/logo_admob_192px.svg +19 -0
- package/docs/index.mdx +168 -0
- package/docs.json +9 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.h +29 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m +98 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.h +23 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.m +153 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +60 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.m +201 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.h +26 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.m +179 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.h +32 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.m +57 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.h +25 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m +124 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.h +24 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.m +104 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.h +25 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.m +173 -0
- package/ios/RNGoogleMobileAds/common/RNAppModule.h +24 -0
- package/ios/RNGoogleMobileAds/common/RNAppModule.m +158 -0
- package/ios/RNGoogleMobileAds/common/RNJSON.h +34 -0
- package/ios/RNGoogleMobileAds/common/RNJSON.m +93 -0
- package/ios/RNGoogleMobileAds/common/RNMeta.h +30 -0
- package/ios/RNGoogleMobileAds/common/RNMeta.m +61 -0
- package/ios/RNGoogleMobileAds/common/RNPreferences.h +44 -0
- package/ios/RNGoogleMobileAds/common/RNPreferences.m +94 -0
- package/ios/RNGoogleMobileAds/common/RNRCTEventEmitter.h +73 -0
- package/ios/RNGoogleMobileAds/common/RNRCTEventEmitter.m +150 -0
- package/ios/RNGoogleMobileAds/common/RNSharedUtils.h +48 -0
- package/ios/RNGoogleMobileAds/common/RNSharedUtils.m +56 -0
- package/ios/RNGoogleMobileAds.xcodeproj/project.pbxproj +377 -0
- package/ios/RNGoogleMobileAds.xcodeproj/xcshareddata/IDETemplateMacros.plist +24 -0
- package/ios_config.sh +140 -0
- package/jest.config.js +6 -0
- package/jest.setup.ts +29 -0
- package/lib/commonjs/AdEventType.js +34 -0
- package/lib/commonjs/AdEventType.js.map +1 -0
- package/lib/commonjs/AdsConsent.js +160 -0
- package/lib/commonjs/AdsConsent.js.map +1 -0
- package/lib/commonjs/AdsConsentDebugGeography.js +38 -0
- package/lib/commonjs/AdsConsentDebugGeography.js.map +1 -0
- package/lib/commonjs/AdsConsentStatus.js +36 -0
- package/lib/commonjs/AdsConsentStatus.js.map +1 -0
- package/lib/commonjs/BannerAdSize.js +38 -0
- package/lib/commonjs/BannerAdSize.js.map +1 -0
- package/lib/commonjs/MaxAdContentRating.js +33 -0
- package/lib/commonjs/MaxAdContentRating.js.map +1 -0
- package/lib/commonjs/MobileAds.js +67 -0
- package/lib/commonjs/MobileAds.js.map +1 -0
- package/lib/commonjs/RewardedAdEventType.js +31 -0
- package/lib/commonjs/RewardedAdEventType.js.map +1 -0
- package/lib/commonjs/TestIds.js +47 -0
- package/lib/commonjs/TestIds.js.map +1 -0
- package/lib/commonjs/ads/AppOpenAd.js +96 -0
- package/lib/commonjs/ads/AppOpenAd.js.map +1 -0
- package/lib/commonjs/ads/BannerAd.js +128 -0
- package/lib/commonjs/ads/BannerAd.js.map +1 -0
- package/lib/commonjs/ads/InterstitialAd.js +163 -0
- package/lib/commonjs/ads/InterstitialAd.js.map +1 -0
- package/lib/commonjs/ads/MobileAd.js +90 -0
- package/lib/commonjs/ads/MobileAd.js.map +1 -0
- package/lib/commonjs/ads/RewardedAd.js +169 -0
- package/lib/commonjs/ads/RewardedAd.js.map +1 -0
- package/lib/commonjs/common/Base64.js +121 -0
- package/lib/commonjs/common/Base64.js.map +1 -0
- package/lib/commonjs/common/MutatableParams.js +46 -0
- package/lib/commonjs/common/MutatableParams.js.map +1 -0
- package/lib/commonjs/common/ReferenceBase.js +59 -0
- package/lib/commonjs/common/ReferenceBase.js.map +1 -0
- package/lib/commonjs/common/deeps.js +101 -0
- package/lib/commonjs/common/deeps.js.map +1 -0
- package/lib/commonjs/common/id.js +82 -0
- package/lib/commonjs/common/id.js.map +1 -0
- package/lib/commonjs/common/index.js +212 -0
- package/lib/commonjs/common/index.js.map +1 -0
- package/lib/commonjs/common/path.js +144 -0
- package/lib/commonjs/common/path.js.map +1 -0
- package/lib/commonjs/common/promise.js +70 -0
- package/lib/commonjs/common/promise.js.map +1 -0
- package/lib/commonjs/common/serialize.js +52 -0
- package/lib/commonjs/common/serialize.js.map +1 -0
- package/lib/commonjs/common/validate.js +239 -0
- package/lib/commonjs/common/validate.js.map +1 -0
- package/lib/commonjs/declarations.d.js +2 -0
- package/lib/commonjs/declarations.d.js.map +1 -0
- package/lib/commonjs/index.js +143 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js +76 -0
- package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -0
- package/lib/commonjs/internal/Module.js +60 -0
- package/lib/commonjs/internal/Module.js.map +1 -0
- package/lib/commonjs/internal/NativeError.js +70 -0
- package/lib/commonjs/internal/NativeError.js.map +1 -0
- package/lib/commonjs/internal/SharedEventEmitter.js +31 -0
- package/lib/commonjs/internal/SharedEventEmitter.js.map +1 -0
- package/lib/commonjs/internal/constants.js +30 -0
- package/lib/commonjs/internal/constants.js.map +1 -0
- package/lib/commonjs/internal/index.js +49 -0
- package/lib/commonjs/internal/index.js.map +1 -0
- package/lib/commonjs/internal/registry/nativeModule.js +231 -0
- package/lib/commonjs/internal/registry/nativeModule.js.map +1 -0
- package/lib/commonjs/types/AdEventListener.js +6 -0
- package/lib/commonjs/types/AdEventListener.js.map +1 -0
- package/lib/commonjs/types/AdShowOptions.js +2 -0
- package/lib/commonjs/types/AdShowOptions.js.map +1 -0
- package/lib/commonjs/types/AdapterStatus.js +18 -0
- package/lib/commonjs/types/AdapterStatus.js.map +1 -0
- package/lib/commonjs/types/AdsConsent.interface.js +6 -0
- package/lib/commonjs/types/AdsConsent.interface.js.map +1 -0
- package/lib/commonjs/types/BannerAdProps.js +6 -0
- package/lib/commonjs/types/BannerAdProps.js.map +1 -0
- package/lib/commonjs/types/GoogleMobileAdsNativeModule.js +6 -0
- package/lib/commonjs/types/GoogleMobileAdsNativeModule.js.map +1 -0
- package/lib/commonjs/types/MobileAd.interface.js +6 -0
- package/lib/commonjs/types/MobileAd.interface.js.map +1 -0
- package/lib/commonjs/types/MobileAdsModule.interface.js +6 -0
- package/lib/commonjs/types/MobileAdsModule.interface.js.map +1 -0
- package/lib/commonjs/types/Module.interface.js +2 -0
- package/lib/commonjs/types/Module.interface.js.map +1 -0
- package/lib/commonjs/types/RequestConfiguration.js +6 -0
- package/lib/commonjs/types/RequestConfiguration.js.map +1 -0
- package/lib/commonjs/types/RequestOptions.js +2 -0
- package/lib/commonjs/types/RequestOptions.js.map +1 -0
- package/lib/commonjs/types/RewardedAdReward.js +2 -0
- package/lib/commonjs/types/RewardedAdReward.js.map +1 -0
- package/lib/commonjs/validateAdRequestConfiguration.js +69 -0
- package/lib/commonjs/validateAdRequestConfiguration.js.map +1 -0
- package/lib/commonjs/validateAdRequestOptions.js +158 -0
- package/lib/commonjs/validateAdRequestOptions.js.map +1 -0
- package/lib/commonjs/validateAdShowOptions.js +47 -0
- package/lib/commonjs/validateAdShowOptions.js.map +1 -0
- package/lib/commonjs/version.js +10 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/AdEventType.js +26 -0
- package/lib/module/AdEventType.js.map +1 -0
- package/lib/module/AdsConsent.js +148 -0
- package/lib/module/AdsConsent.js.map +1 -0
- package/lib/module/AdsConsentDebugGeography.js +30 -0
- package/lib/module/AdsConsentDebugGeography.js.map +1 -0
- package/lib/module/AdsConsentStatus.js +28 -0
- package/lib/module/AdsConsentStatus.js.map +1 -0
- package/lib/module/BannerAdSize.js +30 -0
- package/lib/module/BannerAdSize.js.map +1 -0
- package/lib/module/MaxAdContentRating.js +25 -0
- package/lib/module/MaxAdContentRating.js.map +1 -0
- package/lib/module/MobileAds.js +53 -0
- package/lib/module/MobileAds.js.map +1 -0
- package/lib/module/RewardedAdEventType.js +23 -0
- package/lib/module/RewardedAdEventType.js.map +1 -0
- package/lib/module/TestIds.js +38 -0
- package/lib/module/TestIds.js.map +1 -0
- package/lib/module/ads/AppOpenAd.js +81 -0
- package/lib/module/ads/AppOpenAd.js.map +1 -0
- package/lib/module/ads/BannerAd.js +108 -0
- package/lib/module/ads/BannerAd.js.map +1 -0
- package/lib/module/ads/InterstitialAd.js +149 -0
- package/lib/module/ads/InterstitialAd.js.map +1 -0
- package/lib/module/ads/MobileAd.js +94 -0
- package/lib/module/ads/MobileAd.js.map +1 -0
- package/lib/module/ads/RewardedAd.js +155 -0
- package/lib/module/ads/RewardedAd.js.map +1 -0
- package/lib/module/common/Base64.js +106 -0
- package/lib/module/common/Base64.js.map +1 -0
- package/lib/module/common/MutatableParams.js +52 -0
- package/lib/module/common/MutatableParams.js.map +1 -0
- package/lib/module/common/ReferenceBase.js +50 -0
- package/lib/module/common/ReferenceBase.js.map +1 -0
- package/lib/module/common/deeps.js +91 -0
- package/lib/module/common/deeps.js.map +1 -0
- package/lib/module/common/id.js +74 -0
- package/lib/module/common/id.js.map +1 -0
- package/lib/module/common/index.js +109 -0
- package/lib/module/common/index.js.map +1 -0
- package/lib/module/common/path.js +120 -0
- package/lib/module/common/path.js.map +1 -0
- package/lib/module/common/promise.js +60 -0
- package/lib/module/common/promise.js.map +1 -0
- package/lib/module/common/serialize.js +41 -0
- package/lib/module/common/serialize.js.map +1 -0
- package/lib/module/common/validate.js +197 -0
- package/lib/module/common/validate.js.map +1 -0
- package/lib/module/declarations.d.js +2 -0
- package/lib/module/declarations.d.js.map +1 -0
- package/lib/module/index.js +33 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js +83 -0
- package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -0
- package/lib/module/internal/Module.js +64 -0
- package/lib/module/internal/Module.js.map +1 -0
- package/lib/module/internal/NativeError.js +61 -0
- package/lib/module/internal/NativeError.js.map +1 -0
- package/lib/module/internal/SharedEventEmitter.js +20 -0
- package/lib/module/internal/SharedEventEmitter.js.map +1 -0
- package/lib/module/internal/constants.js +20 -0
- package/lib/module/internal/constants.js.map +1 -0
- package/lib/module/internal/index.js +21 -0
- package/lib/module/internal/index.js.map +1 -0
- package/lib/module/internal/registry/nativeModule.js +215 -0
- package/lib/module/internal/registry/nativeModule.js.map +1 -0
- package/lib/module/types/AdEventListener.js +2 -0
- package/lib/module/types/AdEventListener.js.map +1 -0
- package/lib/module/types/AdShowOptions.js +2 -0
- package/lib/module/types/AdShowOptions.js.map +1 -0
- package/lib/module/types/AdapterStatus.js +10 -0
- package/lib/module/types/AdapterStatus.js.map +1 -0
- package/lib/module/types/AdsConsent.interface.js +2 -0
- package/lib/module/types/AdsConsent.interface.js.map +1 -0
- package/lib/module/types/BannerAdProps.js +2 -0
- package/lib/module/types/BannerAdProps.js.map +1 -0
- package/lib/module/types/GoogleMobileAdsNativeModule.js +2 -0
- package/lib/module/types/GoogleMobileAdsNativeModule.js.map +1 -0
- package/lib/module/types/MobileAd.interface.js +2 -0
- package/lib/module/types/MobileAd.interface.js.map +1 -0
- package/lib/module/types/MobileAdsModule.interface.js +2 -0
- package/lib/module/types/MobileAdsModule.interface.js.map +1 -0
- package/lib/module/types/Module.interface.js +2 -0
- package/lib/module/types/Module.interface.js.map +1 -0
- package/lib/module/types/RequestConfiguration.js +2 -0
- package/lib/module/types/RequestConfiguration.js.map +1 -0
- package/lib/module/types/RequestOptions.js +2 -0
- package/lib/module/types/RequestOptions.js.map +1 -0
- package/lib/module/types/RewardedAdReward.js +2 -0
- package/lib/module/types/RewardedAdReward.js.map +1 -0
- package/lib/module/validateAdRequestConfiguration.js +60 -0
- package/lib/module/validateAdRequestConfiguration.js.map +1 -0
- package/lib/module/validateAdRequestOptions.js +150 -0
- package/lib/module/validateAdRequestOptions.js.map +1 -0
- package/lib/module/validateAdShowOptions.js +39 -0
- package/lib/module/validateAdShowOptions.js.map +1 -0
- package/lib/module/version.js +3 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/AdEventType.d.ts +47 -0
- package/lib/typescript/AdsConsent.d.ts +2 -0
- package/lib/typescript/AdsConsentDebugGeography.d.ts +19 -0
- package/lib/typescript/AdsConsentStatus.d.ts +17 -0
- package/lib/typescript/BannerAdSize.d.ts +34 -0
- package/lib/typescript/MaxAdContentRating.d.ts +18 -0
- package/lib/typescript/MobileAds.d.ts +11 -0
- package/lib/typescript/RewardedAdEventType.d.ts +46 -0
- package/lib/typescript/TestIds.d.ts +6 -0
- package/lib/typescript/ads/AppOpenAd.d.ts +11 -0
- package/lib/typescript/ads/BannerAd.d.ts +3 -0
- package/lib/typescript/ads/InterstitialAd.d.ts +78 -0
- package/lib/typescript/ads/MobileAd.d.ts +32 -0
- package/lib/typescript/ads/RewardedAd.d.ts +84 -0
- package/lib/typescript/common/Base64.d.ts +14 -0
- package/lib/typescript/common/MutatableParams.d.ts +9 -0
- package/lib/typescript/common/ReferenceBase.d.ts +11 -0
- package/lib/typescript/common/deeps.d.ts +18 -0
- package/lib/typescript/common/id.d.ts +11 -0
- package/lib/typescript/common/index.d.ts +28 -0
- package/lib/typescript/common/path.d.ts +43 -0
- package/lib/typescript/common/promise.d.ts +13 -0
- package/lib/typescript/common/serialize.d.ts +5 -0
- package/lib/typescript/common/validate.d.ts +90 -0
- package/lib/typescript/index.d.ts +14 -0
- package/lib/typescript/internal/GoogleMobileAdsNativeEventEmitter.d.ts +12 -0
- package/lib/typescript/internal/Module.d.ts +13 -0
- package/lib/typescript/internal/NativeError.d.ts +26 -0
- package/lib/typescript/internal/SharedEventEmitter.d.ts +2 -0
- package/lib/typescript/internal/constants.d.ts +3 -0
- package/lib/typescript/internal/index.d.ts +4 -0
- package/lib/typescript/internal/registry/nativeModule.d.ts +15 -0
- package/lib/typescript/types/AdEventListener.d.ts +11 -0
- package/lib/typescript/types/AdShowOptions.d.ts +12 -0
- package/lib/typescript/types/AdapterStatus.d.ts +18 -0
- package/lib/typescript/types/AdsConsent.interface.d.ts +286 -0
- package/lib/typescript/types/BannerAdProps.d.ts +66 -0
- package/lib/typescript/types/GoogleMobileAdsNativeModule.d.ts +14 -0
- package/lib/typescript/types/MobileAd.interface.d.ts +64 -0
- package/lib/typescript/types/MobileAdsModule.interface.d.ts +38 -0
- package/lib/typescript/types/Module.interface.d.ts +14 -0
- package/lib/typescript/types/RequestConfiguration.d.ts +36 -0
- package/lib/typescript/types/RequestOptions.d.ts +106 -0
- package/lib/typescript/types/RewardedAdReward.d.ts +13 -0
- package/lib/typescript/validateAdRequestConfiguration.d.ts +2 -0
- package/lib/typescript/validateAdRequestOptions.d.ts +2 -0
- package/lib/typescript/validateAdShowOptions.d.ts +2 -0
- package/lib/typescript/version.d.ts +1 -0
- package/package.json +143 -0
- package/react-native.config.js +19 -0
- package/src/AdEventType.ts +68 -0
- package/src/AdsConsent.ts +191 -0
- package/src/AdsConsentDebugGeography.ts +38 -0
- package/src/AdsConsentStatus.ts +36 -0
- package/src/BannerAdSize.ts +59 -0
- package/src/MaxAdContentRating.ts +38 -0
- package/src/MobileAds.ts +84 -0
- package/src/RewardedAdEventType.ts +64 -0
- package/src/TestIds.ts +39 -0
- package/src/ads/AppOpenAd.ts +85 -0
- package/src/ads/BannerAd.tsx +126 -0
- package/src/ads/InterstitialAd.ts +156 -0
- package/src/ads/MobileAd.ts +101 -0
- package/src/ads/RewardedAd.ts +161 -0
- package/src/common/Base64.ts +114 -0
- package/src/common/MutatableParams.ts +50 -0
- package/src/common/ReferenceBase.ts +45 -0
- package/src/common/deeps.ts +88 -0
- package/src/common/id.ts +74 -0
- package/src/common/index.ts +103 -0
- package/src/common/path.ts +114 -0
- package/src/common/promise.ts +66 -0
- package/src/common/serialize.ts +43 -0
- package/src/common/validate.ts +205 -0
- package/src/declarations.d.ts +3 -0
- package/src/index.ts +35 -0
- package/src/internal/GoogleMobileAdsNativeEventEmitter.ts +81 -0
- package/src/internal/Module.ts +58 -0
- package/src/internal/NativeError.ts +56 -0
- package/src/internal/SharedEventEmitter.ts +22 -0
- package/src/internal/constants.ts +43 -0
- package/src/internal/index.ts +21 -0
- package/src/internal/registry/nativeModule.ts +226 -0
- package/src/types/AdEventListener.ts +16 -0
- package/src/types/AdShowOptions.ts +12 -0
- package/src/types/AdapterStatus.ts +20 -0
- package/src/types/AdsConsent.interface.ts +306 -0
- package/src/types/BannerAdProps.ts +73 -0
- package/src/types/GoogleMobileAdsNativeModule.ts +15 -0
- package/src/types/MobileAd.interface.ts +69 -0
- package/src/types/MobileAdsModule.interface.ts +43 -0
- package/src/types/Module.interface.ts +16 -0
- package/src/types/RequestConfiguration.ts +40 -0
- package/src/types/RequestOptions.ts +113 -0
- package/src/types/RewardedAdReward.ts +14 -0
- package/src/validateAdRequestConfiguration.ts +71 -0
- package/src/validateAdRequestOptions.ts +168 -0
- package/src/validateAdShowOptions.ts +41 -0
- package/src/version.ts +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -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 { hasOwnProperty, isArray, isBoolean, isObject } from './common';
|
|
18
|
+
import { MaxAdContentRating } from './MaxAdContentRating';
|
|
19
|
+
export function validateAdRequestConfiguration(requestConfiguration) {
|
|
20
|
+
const out = {};
|
|
21
|
+
|
|
22
|
+
if (!isObject(requestConfiguration)) {
|
|
23
|
+
throw new Error("'requestConfiguration' expected an object value");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (requestConfiguration.maxAdContentRating) {
|
|
27
|
+
if (requestConfiguration.maxAdContentRating !== MaxAdContentRating.G && requestConfiguration.maxAdContentRating !== MaxAdContentRating.PG && requestConfiguration.maxAdContentRating !== MaxAdContentRating.T && requestConfiguration.maxAdContentRating !== MaxAdContentRating.MA) {
|
|
28
|
+
throw new Error("'requestConfiguration.maxAdContentRating' expected on of MaxAdContentRating.G, MaxAdContentRating.PG, MaxAdContentRating.T or MaxAdContentRating.MA");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
out.maxAdContentRating = requestConfiguration.maxAdContentRating;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (hasOwnProperty(requestConfiguration, 'tagForChildDirectedTreatment')) {
|
|
35
|
+
if (!isBoolean(requestConfiguration.tagForChildDirectedTreatment)) {
|
|
36
|
+
throw new Error("'requestConfiguration.tagForChildDirectedTreatment' expected a boolean value");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
out.tagForChildDirectedTreatment = requestConfiguration.tagForChildDirectedTreatment;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (hasOwnProperty(requestConfiguration, 'tagForUnderAgeOfConsent')) {
|
|
43
|
+
if (!isBoolean(requestConfiguration.tagForUnderAgeOfConsent)) {
|
|
44
|
+
throw new Error("'requestConfiguration.tagForUnderAgeOfConsent' expected a boolean value");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
out.tagForUnderAgeOfConsent = requestConfiguration.tagForUnderAgeOfConsent;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (hasOwnProperty(requestConfiguration, 'testDeviceIdentifiers')) {
|
|
51
|
+
if (!isArray(requestConfiguration.testDeviceIdentifiers)) {
|
|
52
|
+
throw new Error("'requestConfiguration.testDeviceIdentifiers' expected an array value");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
out.testDeviceIdentifiers = requestConfiguration.testDeviceIdentifiers;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=validateAdRequestConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["validateAdRequestConfiguration.ts"],"names":["hasOwnProperty","isArray","isBoolean","isObject","MaxAdContentRating","validateAdRequestConfiguration","requestConfiguration","out","Error","maxAdContentRating","G","PG","T","MA","tagForChildDirectedTreatment","tagForUnderAgeOfConsent","testDeviceIdentifiers"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,cAAT,EAAyBC,OAAzB,EAAkCC,SAAlC,EAA6CC,QAA7C,QAA6D,UAA7D;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AAGA,OAAO,SAASC,8BAAT,CAAwCC,oBAAxC,EAAoF;AACzF,QAAMC,GAAyB,GAAG,EAAlC;;AAEA,MAAI,CAACJ,QAAQ,CAACG,oBAAD,CAAb,EAAqC;AACnC,UAAM,IAAIE,KAAJ,CAAU,iDAAV,CAAN;AACD;;AAED,MAAIF,oBAAoB,CAACG,kBAAzB,EAA6C;AAC3C,QACEH,oBAAoB,CAACG,kBAArB,KAA4CL,kBAAkB,CAACM,CAA/D,IACAJ,oBAAoB,CAACG,kBAArB,KAA4CL,kBAAkB,CAACO,EAD/D,IAEAL,oBAAoB,CAACG,kBAArB,KAA4CL,kBAAkB,CAACQ,CAF/D,IAGAN,oBAAoB,CAACG,kBAArB,KAA4CL,kBAAkB,CAACS,EAJjE,EAKE;AACA,YAAM,IAAIL,KAAJ,CACJ,qJADI,CAAN;AAGD;;AAEDD,IAAAA,GAAG,CAACE,kBAAJ,GAAyBH,oBAAoB,CAACG,kBAA9C;AACD;;AAED,MAAIT,cAAc,CAACM,oBAAD,EAAuB,8BAAvB,CAAlB,EAA0E;AACxE,QAAI,CAACJ,SAAS,CAACI,oBAAoB,CAACQ,4BAAtB,CAAd,EAAmE;AACjE,YAAM,IAAIN,KAAJ,CACJ,8EADI,CAAN;AAGD;;AAEDD,IAAAA,GAAG,CAACO,4BAAJ,GAAmCR,oBAAoB,CAACQ,4BAAxD;AACD;;AAED,MAAId,cAAc,CAACM,oBAAD,EAAuB,yBAAvB,CAAlB,EAAqE;AACnE,QAAI,CAACJ,SAAS,CAACI,oBAAoB,CAACS,uBAAtB,CAAd,EAA8D;AAC5D,YAAM,IAAIP,KAAJ,CAAU,yEAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACQ,uBAAJ,GAA8BT,oBAAoB,CAACS,uBAAnD;AACD;;AAED,MAAIf,cAAc,CAACM,oBAAD,EAAuB,uBAAvB,CAAlB,EAAmE;AACjE,QAAI,CAACL,OAAO,CAACK,oBAAoB,CAACU,qBAAtB,CAAZ,EAA0D;AACxD,YAAM,IAAIR,KAAJ,CAAU,sEAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACS,qBAAJ,GAA4BV,oBAAoB,CAACU,qBAAjD;AACD;;AAED,SAAOT,GAAP;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 { hasOwnProperty, isArray, isBoolean, isObject } from './common';\nimport { MaxAdContentRating } from './MaxAdContentRating';\nimport { RequestConfiguration } from './types/RequestConfiguration';\n\nexport function validateAdRequestConfiguration(requestConfiguration: RequestConfiguration) {\n const out: RequestConfiguration = {};\n\n if (!isObject(requestConfiguration)) {\n throw new Error(\"'requestConfiguration' expected an object value\");\n }\n\n if (requestConfiguration.maxAdContentRating) {\n if (\n requestConfiguration.maxAdContentRating !== MaxAdContentRating.G &&\n requestConfiguration.maxAdContentRating !== MaxAdContentRating.PG &&\n requestConfiguration.maxAdContentRating !== MaxAdContentRating.T &&\n requestConfiguration.maxAdContentRating !== MaxAdContentRating.MA\n ) {\n throw new Error(\n \"'requestConfiguration.maxAdContentRating' expected on of MaxAdContentRating.G, MaxAdContentRating.PG, MaxAdContentRating.T or MaxAdContentRating.MA\",\n );\n }\n\n out.maxAdContentRating = requestConfiguration.maxAdContentRating;\n }\n\n if (hasOwnProperty(requestConfiguration, 'tagForChildDirectedTreatment')) {\n if (!isBoolean(requestConfiguration.tagForChildDirectedTreatment)) {\n throw new Error(\n \"'requestConfiguration.tagForChildDirectedTreatment' expected a boolean value\",\n );\n }\n\n out.tagForChildDirectedTreatment = requestConfiguration.tagForChildDirectedTreatment;\n }\n\n if (hasOwnProperty(requestConfiguration, 'tagForUnderAgeOfConsent')) {\n if (!isBoolean(requestConfiguration.tagForUnderAgeOfConsent)) {\n throw new Error(\"'requestConfiguration.tagForUnderAgeOfConsent' expected a boolean value\");\n }\n\n out.tagForUnderAgeOfConsent = requestConfiguration.tagForUnderAgeOfConsent;\n }\n\n if (hasOwnProperty(requestConfiguration, 'testDeviceIdentifiers')) {\n if (!isArray(requestConfiguration.testDeviceIdentifiers)) {\n throw new Error(\"'requestConfiguration.testDeviceIdentifiers' expected an array value\");\n }\n\n out.testDeviceIdentifiers = requestConfiguration.testDeviceIdentifiers;\n }\n\n return out;\n}\n"]}
|
|
@@ -0,0 +1,150 @@
|
|
|
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 { hasOwnProperty, isArray, isBoolean, isNumber, isObject, isString, isUndefined, isValidUrl } from './common';
|
|
18
|
+
export function validateAdRequestOptions(options) {
|
|
19
|
+
const out = {};
|
|
20
|
+
|
|
21
|
+
if (isUndefined(options)) {
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!isObject(options)) {
|
|
26
|
+
throw new Error("'options' expected an object value");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (hasOwnProperty(options, 'requestNonPersonalizedAdsOnly')) {
|
|
30
|
+
if (!isBoolean(options.requestNonPersonalizedAdsOnly)) {
|
|
31
|
+
throw new Error("'options.requestNonPersonalizedAdsOnly' expected a boolean value");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
out.requestNonPersonalizedAdsOnly = options.requestNonPersonalizedAdsOnly;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (options.networkExtras) {
|
|
38
|
+
if (!isObject(options.networkExtras)) {
|
|
39
|
+
throw new Error("'options.networkExtras' expected an object of key/value pairs");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Object.entries(options.networkExtras).forEach(_ref => {
|
|
43
|
+
let [key, value] = _ref;
|
|
44
|
+
|
|
45
|
+
if (!isString(value)) {
|
|
46
|
+
throw new Error(`'options.networkExtras' expected a string value for object key "${key}"`);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
out.networkExtras = options.networkExtras;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (options.keywords) {
|
|
53
|
+
if (!isArray(options.keywords)) {
|
|
54
|
+
throw new Error("'options.keywords' expected an array containing string values");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
for (let i = 0; i < options.keywords.length; i++) {
|
|
58
|
+
const keyword = options.keywords[i];
|
|
59
|
+
|
|
60
|
+
if (!isString(keyword)) {
|
|
61
|
+
throw new Error("'options.keywords' expected an array containing string values");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
out.keywords = options.keywords;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (options.contentUrl) {
|
|
69
|
+
if (!isString(options.contentUrl)) {
|
|
70
|
+
throw new Error("'options.contentUrl' expected a string value");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!isValidUrl(options.contentUrl)) {
|
|
74
|
+
throw new Error("'options.contentUrl' expected a valid HTTP or HTTPS url.");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (options.contentUrl.length > 512) {
|
|
78
|
+
throw new Error("'options.contentUrl' maximum length of a content URL is 512 characters.");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
out.contentUrl = options.contentUrl;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (options.location) {
|
|
85
|
+
const error = new Error("'options.location' expected an array value containing a latitude & longitude number value.");
|
|
86
|
+
|
|
87
|
+
if (!isArray(options.location)) {
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const [latitude, longitude] = options.location;
|
|
92
|
+
|
|
93
|
+
if (!isNumber(latitude) || !isNumber(longitude)) {
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (latitude < -90 || latitude > 90) {
|
|
98
|
+
throw new Error(`'options.location' latitude value must be a number between -90 and 90, but was: ${latitude}`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (longitude < -180 || longitude > 180) {
|
|
102
|
+
throw new Error(`'options.location' longitude value must be a number between -180 and 180, but was: ${latitude}`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
out.location = [latitude, longitude];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (hasOwnProperty(options, 'locationAccuracy')) {
|
|
109
|
+
if (!isNumber(options.locationAccuracy)) {
|
|
110
|
+
throw new Error("'options.locationAccuracy' expected a number value.");
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (isNumber(options.locationAccuracy) && options.locationAccuracy < 0) {
|
|
114
|
+
throw new Error("'options.locationAccuracy' expected a number greater than 0.");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
out.locationAccuracy = options.locationAccuracy;
|
|
118
|
+
} else {
|
|
119
|
+
out.locationAccuracy = 5;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (options.requestAgent) {
|
|
123
|
+
if (!isString(options.requestAgent)) {
|
|
124
|
+
throw new Error("'options.requestAgent' expected a string value");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
out.requestAgent = options.requestAgent;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (options.serverSideVerificationOptions) {
|
|
131
|
+
if (!isObject(options.serverSideVerificationOptions)) {
|
|
132
|
+
throw new Error("'options.serverSideVerificationOptions' expected an object of key/value pairs");
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const ssvOptions = options.serverSideVerificationOptions;
|
|
136
|
+
|
|
137
|
+
if (ssvOptions.userId && !isString(ssvOptions.userId)) {
|
|
138
|
+
throw new Error("'options.serverSideVerificationOptions.userId' expected a string value");
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (ssvOptions.customData && !isString(ssvOptions.customData)) {
|
|
142
|
+
throw new Error("'options.serverSideVerificationOptions.customData' expected a string value");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
out.serverSideVerificationOptions = options.serverSideVerificationOptions;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=validateAdRequestOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["validateAdRequestOptions.ts"],"names":["hasOwnProperty","isArray","isBoolean","isNumber","isObject","isString","isUndefined","isValidUrl","validateAdRequestOptions","options","out","Error","requestNonPersonalizedAdsOnly","networkExtras","Object","entries","forEach","key","value","keywords","i","length","keyword","contentUrl","location","error","latitude","longitude","locationAccuracy","requestAgent","serverSideVerificationOptions","ssvOptions","userId","customData"],"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 isNumber,\n isObject,\n isString,\n isUndefined,\n isValidUrl,\n} from './common';\nimport { RequestOptions } from './types/RequestOptions';\n\nexport function validateAdRequestOptions(options?: RequestOptions) {\n const out: RequestOptions = {};\n\n if (isUndefined(options)) {\n return out;\n }\n\n if (!isObject(options)) {\n throw new Error(\"'options' expected an object value\");\n }\n\n if (hasOwnProperty(options, 'requestNonPersonalizedAdsOnly')) {\n if (!isBoolean(options.requestNonPersonalizedAdsOnly)) {\n throw new Error(\"'options.requestNonPersonalizedAdsOnly' expected a boolean value\");\n }\n\n out.requestNonPersonalizedAdsOnly = options.requestNonPersonalizedAdsOnly;\n }\n\n if (options.networkExtras) {\n if (!isObject(options.networkExtras)) {\n throw new Error(\"'options.networkExtras' expected an object of key/value pairs\");\n }\n\n Object.entries(options.networkExtras).forEach(([key, value]) => {\n if (!isString(value)) {\n throw new Error(`'options.networkExtras' expected a string value for object key \"${key}\"`);\n }\n });\n\n out.networkExtras = options.networkExtras;\n }\n\n if (options.keywords) {\n if (!isArray(options.keywords)) {\n throw new Error(\"'options.keywords' expected an array containing string values\");\n }\n\n for (let i = 0; i < options.keywords.length; i++) {\n const keyword = options.keywords[i];\n\n if (!isString(keyword)) {\n throw new Error(\"'options.keywords' expected an array containing string values\");\n }\n }\n\n out.keywords = options.keywords;\n }\n\n if (options.contentUrl) {\n if (!isString(options.contentUrl)) {\n throw new Error(\"'options.contentUrl' expected a string value\");\n }\n\n if (!isValidUrl(options.contentUrl)) {\n throw new Error(\"'options.contentUrl' expected a valid HTTP or HTTPS url.\");\n }\n\n if (options.contentUrl.length > 512) {\n throw new Error(\"'options.contentUrl' maximum length of a content URL is 512 characters.\");\n }\n\n out.contentUrl = options.contentUrl;\n }\n\n if (options.location) {\n const error = new Error(\n \"'options.location' expected an array value containing a latitude & longitude number value.\",\n );\n\n if (!isArray(options.location)) {\n throw error;\n }\n\n const [latitude, longitude] = options.location;\n\n if (!isNumber(latitude) || !isNumber(longitude)) {\n throw error;\n }\n\n if (latitude < -90 || latitude > 90) {\n throw new Error(\n `'options.location' latitude value must be a number between -90 and 90, but was: ${latitude}`,\n );\n }\n\n if (longitude < -180 || longitude > 180) {\n throw new Error(\n `'options.location' longitude value must be a number between -180 and 180, but was: ${latitude}`,\n );\n }\n\n out.location = [latitude, longitude];\n }\n\n if (hasOwnProperty(options, 'locationAccuracy')) {\n if (!isNumber(options.locationAccuracy)) {\n throw new Error(\"'options.locationAccuracy' expected a number value.\");\n }\n\n if (isNumber(options.locationAccuracy) && options.locationAccuracy < 0) {\n throw new Error(\"'options.locationAccuracy' expected a number greater than 0.\");\n }\n\n out.locationAccuracy = options.locationAccuracy;\n } else {\n out.locationAccuracy = 5;\n }\n\n if (options.requestAgent) {\n if (!isString(options.requestAgent)) {\n throw new Error(\"'options.requestAgent' expected a string value\");\n }\n\n out.requestAgent = options.requestAgent;\n }\n\n if (options.serverSideVerificationOptions) {\n if (!isObject(options.serverSideVerificationOptions)) {\n throw new Error(\n \"'options.serverSideVerificationOptions' expected an object of key/value pairs\",\n );\n }\n\n const ssvOptions = options.serverSideVerificationOptions;\n\n if (ssvOptions.userId && !isString(ssvOptions.userId)) {\n throw new Error(\"'options.serverSideVerificationOptions.userId' expected a string value\");\n }\n\n if (ssvOptions.customData && !isString(ssvOptions.customData)) {\n throw new Error(\"'options.serverSideVerificationOptions.customData' expected a string value\");\n }\n\n out.serverSideVerificationOptions = options.serverSideVerificationOptions;\n }\n\n return out;\n}\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { hasOwnProperty, isBoolean, isObject, isUndefined } from './common';
|
|
18
|
+
export function validateAdShowOptions(options) {
|
|
19
|
+
const out = {};
|
|
20
|
+
|
|
21
|
+
if (isUndefined(options)) {
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!isObject(options)) {
|
|
26
|
+
throw new Error("'options' expected an object value");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (hasOwnProperty(options, 'immersiveModeEnabled')) {
|
|
30
|
+
if (!isBoolean(options.immersiveModeEnabled)) {
|
|
31
|
+
throw new Error("'options.immersiveModeEnabled' expected a boolean value");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
out.immersiveModeEnabled = options.immersiveModeEnabled;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=validateAdShowOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["validateAdShowOptions.ts"],"names":["hasOwnProperty","isBoolean","isObject","isUndefined","validateAdShowOptions","options","out","Error","immersiveModeEnabled"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,cAAT,EAAyBC,SAAzB,EAAoCC,QAApC,EAA8CC,WAA9C,QAAiE,UAAjE;AAGA,OAAO,SAASC,qBAAT,CAA+BC,OAA/B,EAAwD;AAC7D,QAAMC,GAAkB,GAAG,EAA3B;;AAEA,MAAIH,WAAW,CAACE,OAAD,CAAf,EAA0B;AACxB,WAAOC,GAAP;AACD;;AAED,MAAI,CAACJ,QAAQ,CAACG,OAAD,CAAb,EAAwB;AACtB,UAAM,IAAIE,KAAJ,CAAU,oCAAV,CAAN;AACD;;AAED,MAAIP,cAAc,CAACK,OAAD,EAAU,sBAAV,CAAlB,EAAqD;AACnD,QAAI,CAACJ,SAAS,CAACI,OAAO,CAACG,oBAAT,CAAd,EAA8C;AAC5C,YAAM,IAAID,KAAJ,CAAU,yDAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACE,oBAAJ,GAA2BH,OAAO,CAACG,oBAAnC;AACD;;AAED,SAAOF,GAAP;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 { hasOwnProperty, isBoolean, isObject, isUndefined } from './common';\nimport { AdShowOptions } from './types/AdShowOptions';\n\nexport function validateAdShowOptions(options?: AdShowOptions) {\n const out: AdShowOptions = {};\n\n if (isUndefined(options)) {\n return out;\n }\n\n if (!isObject(options)) {\n throw new Error(\"'options' expected an object value\");\n }\n\n if (hasOwnProperty(options, 'immersiveModeEnabled')) {\n if (!isBoolean(options.immersiveModeEnabled)) {\n throw new Error(\"'options.immersiveModeEnabled' expected a boolean value\");\n }\n\n out.immersiveModeEnabled = options.immersiveModeEnabled;\n }\n\n return out;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '4.1.0';\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare enum AdEventType {
|
|
2
|
+
/**
|
|
3
|
+
* When an ad has loaded. At this point, the ad is ready to be shown to the user.
|
|
4
|
+
*
|
|
5
|
+
* #### Example
|
|
6
|
+
*
|
|
7
|
+
* ```js
|
|
8
|
+
* import { AdEventType } from 'react-native-google-mobile-ads';
|
|
9
|
+
*
|
|
10
|
+
* advert.onAdEvent((type,error,data) => {
|
|
11
|
+
* if (type === AdEventType.LOADED) {
|
|
12
|
+
* advert.show();
|
|
13
|
+
* }
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
LOADED = "loaded",
|
|
18
|
+
/**
|
|
19
|
+
* The ad has thrown an error. See the error parameter the listener callback for more information.
|
|
20
|
+
*
|
|
21
|
+
* #### Example
|
|
22
|
+
*
|
|
23
|
+
* ```js
|
|
24
|
+
* import { AdEventType } from 'react-native-google-mobile-ads';
|
|
25
|
+
*
|
|
26
|
+
* advert.onAdEvent((type, error, data) => {
|
|
27
|
+
* if (type === AdEventType.ERROR) {
|
|
28
|
+
* console.log('Ad error:', error);
|
|
29
|
+
* }
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
ERROR = "error",
|
|
34
|
+
/**
|
|
35
|
+
* The ad opened and is currently visible to the user. This event is fired after the `show()`
|
|
36
|
+
* method has been called.
|
|
37
|
+
*/
|
|
38
|
+
OPENED = "opened",
|
|
39
|
+
/**
|
|
40
|
+
* The user clicked the advert.
|
|
41
|
+
*/
|
|
42
|
+
CLICKED = "clicked",
|
|
43
|
+
/**
|
|
44
|
+
* The user closed the ad and has returned back to your application.
|
|
45
|
+
*/
|
|
46
|
+
CLOSED = "closed"
|
|
47
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AdsConsentDebugGeography enum.
|
|
3
|
+
*
|
|
4
|
+
* Used to set a mock location when testing the `AdsConsent` helper.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum AdsConsentDebugGeography {
|
|
7
|
+
/**
|
|
8
|
+
* Disable any debug geography.
|
|
9
|
+
*/
|
|
10
|
+
DISABLED = 0,
|
|
11
|
+
/**
|
|
12
|
+
* Sets the location to within the EEA.
|
|
13
|
+
*/
|
|
14
|
+
EEA = 1,
|
|
15
|
+
/**
|
|
16
|
+
* Sets the location to outside of the EEA.
|
|
17
|
+
*/
|
|
18
|
+
NOT_EEA = 2
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AdsConsentStatus enum.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum AdsConsentStatus {
|
|
5
|
+
/**
|
|
6
|
+
* The consent status is unknown and the user must provide consent to show ads if they are within the EEA or location is also unknown.
|
|
7
|
+
*/
|
|
8
|
+
UNKNOWN = 0,
|
|
9
|
+
/**
|
|
10
|
+
* The user has accepted non-personalized ads.
|
|
11
|
+
*/
|
|
12
|
+
NON_PERSONALIZED = 1,
|
|
13
|
+
/**
|
|
14
|
+
* The user has accepted personalized ads.
|
|
15
|
+
*/
|
|
16
|
+
PERSONALIZED = 2
|
|
17
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare enum BannerAdSize {
|
|
2
|
+
/**
|
|
3
|
+
* Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels).
|
|
4
|
+
*/
|
|
5
|
+
BANNER = "BANNER",
|
|
6
|
+
/**
|
|
7
|
+
* Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels).
|
|
8
|
+
*/
|
|
9
|
+
FULL_BANNER = "FULL_BANNER",
|
|
10
|
+
/**
|
|
11
|
+
* Large banner ad size (320x100 density-independent pixels).
|
|
12
|
+
*/
|
|
13
|
+
LARGE_BANNER = "LARGE_BANNER",
|
|
14
|
+
/**
|
|
15
|
+
* Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels).
|
|
16
|
+
*/
|
|
17
|
+
LEADERBOARD = "LEADERBOARD",
|
|
18
|
+
/**
|
|
19
|
+
* Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels).
|
|
20
|
+
*/
|
|
21
|
+
MEDIUM_RECTANGLE = "MEDIUM_RECTANGLE",
|
|
22
|
+
/**
|
|
23
|
+
* A (next generation) dynamically sized banner that is full-width and auto-height.
|
|
24
|
+
*/
|
|
25
|
+
ADAPTIVE_BANNER = "ADAPTIVE_BANNER",
|
|
26
|
+
/**
|
|
27
|
+
* A dynamically sized banner that matches its parent's width and expands/contracts its height to match the ad's content after loading completes.
|
|
28
|
+
*/
|
|
29
|
+
FLUID = "FLUID",
|
|
30
|
+
/**
|
|
31
|
+
* 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.
|
|
32
|
+
*/
|
|
33
|
+
WIDE_SKYSCRAPER = "WIDE_SKYSCRAPER"
|
|
34
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare enum MaxAdContentRating {
|
|
2
|
+
/**
|
|
3
|
+
* "General audiences." Content suitable for all audiences, including families and children.
|
|
4
|
+
*/
|
|
5
|
+
G = "G",
|
|
6
|
+
/**
|
|
7
|
+
* "Parental guidance." Content suitable for most audiences with parental guidance, including topics like non-realistic, cartoonish violence.
|
|
8
|
+
*/
|
|
9
|
+
PG = "PG",
|
|
10
|
+
/**
|
|
11
|
+
* T: "Teen." Content suitable for teen and older audiences, including topics such as general health, social networks, scary imagery, and fight sports.
|
|
12
|
+
*/
|
|
13
|
+
T = "T",
|
|
14
|
+
/**
|
|
15
|
+
* "Mature audiences." Content suitable only for mature audiences; includes topics such as alcohol, gambling, sexual content, and weapons.
|
|
16
|
+
*/
|
|
17
|
+
MA = "MA"
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Module } from './internal';
|
|
2
|
+
import { MobileAdsModuleInterface } from './types/MobileAdsModule.interface';
|
|
3
|
+
import { RequestConfiguration } from './types/RequestConfiguration';
|
|
4
|
+
import { App, Config } from './types/Module.interface';
|
|
5
|
+
declare class MobileAdsModule extends Module implements MobileAdsModuleInterface {
|
|
6
|
+
constructor(app: App, config: Config);
|
|
7
|
+
initialize(): Promise<import("./types/AdapterStatus").AdapterStatus[]>;
|
|
8
|
+
setRequestConfiguration(requestConfiguration: RequestConfiguration): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const MobileAds: () => MobileAdsModule;
|
|
11
|
+
export default MobileAds;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare enum RewardedAdEventType {
|
|
2
|
+
/**
|
|
3
|
+
* An event fired when a rewarded ad has loaded.
|
|
4
|
+
*
|
|
5
|
+
* This type differs from `AdEventType.LOADED` as when a rewarded ad is loaded,
|
|
6
|
+
* an additional data payload is provided to the event handler containing the ad reward
|
|
7
|
+
* (assuming the user earns the reward).
|
|
8
|
+
*
|
|
9
|
+
* The reward contains a `type` and `amount`.
|
|
10
|
+
*
|
|
11
|
+
* #### Example
|
|
12
|
+
*
|
|
13
|
+
* ```js
|
|
14
|
+
* import { RewardedAdEventType } from 'react-native-google-mobile-ads';
|
|
15
|
+
*
|
|
16
|
+
* rewardedAd.onAdEvent((type, error, data) => {
|
|
17
|
+
* if (type === RewardedAdEventType.LOADED) {
|
|
18
|
+
* console.log(`Rewarded Ad loaded with ${data.amount} ${data.type} as reward`);
|
|
19
|
+
* // E.g. "Rewarded Ad loaded with 50 coins as reward"
|
|
20
|
+
* rewardedAd.show();
|
|
21
|
+
* }
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
LOADED = "rewarded_loaded",
|
|
26
|
+
/**
|
|
27
|
+
* An event fired when the user earned the reward for the video. If the user does not earn a reward,
|
|
28
|
+
* the `AdEventType.CLOSED` event will be fired with no rewarded event.
|
|
29
|
+
*
|
|
30
|
+
* The reward contains a `type` and `amount`.
|
|
31
|
+
*
|
|
32
|
+
* #### Example
|
|
33
|
+
*
|
|
34
|
+
* ```js
|
|
35
|
+
* import { RewardedAdEventType } from 'react-native-google-mobile-ads';
|
|
36
|
+
*
|
|
37
|
+
* rewardedAd.onAdEvent((type, error, data) => {
|
|
38
|
+
* if (type === RewardedAdEventType.EARNED_REWARD) {
|
|
39
|
+
* console.log(`User earned ${data.amount} ${data.type}`);
|
|
40
|
+
* // E.g. "User earned 50 coins"
|
|
41
|
+
* }
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
EARNED_REWARD = "rewarded_earned_reward"
|
|
46
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MobileAd } from './MobileAd';
|
|
2
|
+
import { AdEventListener } from '../types/AdEventListener';
|
|
3
|
+
import { AdShowOptions } from '../types/AdShowOptions';
|
|
4
|
+
import { RequestOptions } from '../types/RequestOptions';
|
|
5
|
+
import { MobileAdInterface } from '../types/MobileAd.interface';
|
|
6
|
+
export declare class AppOpenAd extends MobileAd implements MobileAdInterface {
|
|
7
|
+
static createForAdRequest(adUnitId: string, requestOptions?: RequestOptions): AppOpenAd;
|
|
8
|
+
load(): void;
|
|
9
|
+
onAdEvent(handler: AdEventListener): () => null;
|
|
10
|
+
show(showOptions?: AdShowOptions): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { MobileAd } from './MobileAd';
|
|
2
|
+
import { AdEventListener } from '../types/AdEventListener';
|
|
3
|
+
import { AdShowOptions } from '../types/AdShowOptions';
|
|
4
|
+
import { RequestOptions } from '../types/RequestOptions';
|
|
5
|
+
import { MobileAdInterface } from '../types/MobileAd.interface';
|
|
6
|
+
/**
|
|
7
|
+
* A class for interacting and showing Interstitial Ads.
|
|
8
|
+
*
|
|
9
|
+
* An Interstitial advert can be pre-loaded and shown at a suitable point in your apps flow, such as at the end of a level
|
|
10
|
+
* in a game. An Interstitial is a full screen advert, laid on-top of your entire application which the user can interact with.
|
|
11
|
+
* Interactions are passed back via events which should be handled accordingly inside of your app.
|
|
12
|
+
*
|
|
13
|
+
* #### Example
|
|
14
|
+
*
|
|
15
|
+
* First create a new Interstitial instance, passing in your Ad Unit ID from the Google Mobile Ads configuration console, and any additional
|
|
16
|
+
* request options. The example below will present a test advert, and only request a non-personalized ad.
|
|
17
|
+
*
|
|
18
|
+
* ```js
|
|
19
|
+
* import { InterstitialAd, TestIds } from 'react-native-google-mobile-ads';
|
|
20
|
+
*
|
|
21
|
+
* const interstitial = InterstitialAd.createForAdRequest(TestIds.INTERSTITIAL, {
|
|
22
|
+
* requestNonPersonalizedAdsOnly: true,
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Each advert needs to be loaded from Google Mobile Ads before being shown. It is recommended this is performed before the user
|
|
27
|
+
* reaches the checkpoint to show the advert, so it's ready to go. Before loading the advert, we need to setup
|
|
28
|
+
* event listeners to listen for updates from Google Mobile Ads, such as advert loaded or failed to load.
|
|
29
|
+
*
|
|
30
|
+
* Event types match the `AdEventType` interface. Once the advert has loaded, we can trigger it to show:
|
|
31
|
+
*
|
|
32
|
+
* ```js
|
|
33
|
+
* import { AdEventType } from 'react-native-google-mobile-ads';
|
|
34
|
+
*
|
|
35
|
+
* interstitial.onAdEvent((type) => {
|
|
36
|
+
* if (type === AdEventType.LOADED) {
|
|
37
|
+
* interstitial.show();
|
|
38
|
+
* }
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* interstitial.load();
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* The advert will be presented to the user, and several more events can be triggered such as the user clicking the
|
|
45
|
+
* advert or closing it.
|
|
46
|
+
*/
|
|
47
|
+
export declare class InterstitialAd extends MobileAd implements MobileAdInterface {
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new InterstitialAd instance.
|
|
50
|
+
*
|
|
51
|
+
* #### Example
|
|
52
|
+
*
|
|
53
|
+
* ```js
|
|
54
|
+
* import { InterstitialAd, AdEventType, TestIds } from 'react-native-google-mobile-ads';
|
|
55
|
+
*
|
|
56
|
+
* const interstitialAd = await InterstitialAd.createForAdRequest(TestIds.INTERSTITIAL, {
|
|
57
|
+
* requestAgent: 'CoolAds',
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* interstitialAd.onAdEvent((type, error) => {
|
|
61
|
+
* console.log('New event: ', type, error);
|
|
62
|
+
*
|
|
63
|
+
* if (type === AdEventType.LOADED) {
|
|
64
|
+
* interstitialAd.show();
|
|
65
|
+
* }
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* interstitialAd.load();
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @param adUnitId The Ad Unit ID for the Interstitial. You can find this on your Google Mobile Ads dashboard.
|
|
72
|
+
* @param requestOptions Optional RequestOptions used to load the ad.
|
|
73
|
+
*/
|
|
74
|
+
static createForAdRequest(adUnitId: string, requestOptions?: RequestOptions): InterstitialAd;
|
|
75
|
+
load(): void;
|
|
76
|
+
onAdEvent(handler: AdEventListener): () => null;
|
|
77
|
+
show(showOptions?: AdShowOptions): Promise<void>;
|
|
78
|
+
}
|