react-native-google-mobile-ads 5.1.1 → 6.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 (176) hide show
  1. package/__tests__/interstitial.test.ts +32 -5
  2. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsAppOpenModule.java +2 -1
  3. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsBannerAdViewManager.java +110 -68
  4. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsCommon.java +5 -11
  5. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsEvent.java +3 -0
  6. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsInterstitialModule.java +38 -20
  7. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.java +45 -0
  8. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsPackage.java +1 -0
  9. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsRewardedInterstitialModule.java +199 -0
  10. package/docs/ad-inspector.mdx +39 -0
  11. package/docs/displaying-ads-hook.mdx +1 -1
  12. package/docs/displaying-ads.mdx +178 -26
  13. package/docs/migrating-to-v6.mdx +111 -0
  14. package/docs.json +3 -1
  15. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m +1 -0
  16. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.m +63 -8
  17. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +4 -0
  18. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.m +10 -7
  19. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.h +2 -1
  20. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.m +17 -2
  21. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m +44 -30
  22. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.m +19 -0
  23. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.h +25 -0
  24. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.m +173 -0
  25. package/lib/commonjs/AdEventType.js.map +1 -1
  26. package/lib/commonjs/GAMAdEventType.js +30 -0
  27. package/lib/commonjs/GAMAdEventType.js.map +1 -0
  28. package/lib/commonjs/MobileAds.js +9 -2
  29. package/lib/commonjs/MobileAds.js.map +1 -1
  30. package/lib/commonjs/RewardedAdEventType.js.map +1 -1
  31. package/lib/commonjs/TestIds.js +11 -2
  32. package/lib/commonjs/TestIds.js.map +1 -1
  33. package/lib/commonjs/ads/AppOpenAd.js +8 -53
  34. package/lib/commonjs/ads/AppOpenAd.js.map +1 -1
  35. package/lib/commonjs/ads/BannerAd.js +7 -110
  36. package/lib/commonjs/ads/BannerAd.js.map +1 -1
  37. package/lib/commonjs/ads/BaseAd.js +144 -0
  38. package/lib/commonjs/ads/BaseAd.js.map +1 -0
  39. package/lib/commonjs/ads/GAMBannerAd.js +42 -0
  40. package/lib/commonjs/ads/GAMBannerAd.js.map +1 -0
  41. package/lib/commonjs/ads/GAMInterstitialAd.js +48 -0
  42. package/lib/commonjs/ads/GAMInterstitialAd.js.map +1 -0
  43. package/lib/commonjs/ads/InterstitialAd.js +13 -64
  44. package/lib/commonjs/ads/InterstitialAd.js.map +1 -1
  45. package/lib/commonjs/ads/MobileAd.js +131 -12
  46. package/lib/commonjs/ads/MobileAd.js.map +1 -1
  47. package/lib/commonjs/ads/RewardedAd.js +23 -65
  48. package/lib/commonjs/ads/RewardedAd.js.map +1 -1
  49. package/lib/commonjs/ads/RewardedInterstitialAd.js +127 -0
  50. package/lib/commonjs/ads/RewardedInterstitialAd.js.map +1 -0
  51. package/lib/commonjs/hooks/useAppOpenAd.js.map +1 -1
  52. package/lib/commonjs/hooks/useFullScreenAd.js +9 -4
  53. package/lib/commonjs/hooks/useFullScreenAd.js.map +1 -1
  54. package/lib/commonjs/hooks/useInterstitialAd.js.map +1 -1
  55. package/lib/commonjs/hooks/useRewardedAd.js.map +1 -1
  56. package/lib/commonjs/hooks/useRewardedInterstitialAd.js +51 -0
  57. package/lib/commonjs/hooks/useRewardedInterstitialAd.js.map +1 -0
  58. package/lib/commonjs/index.js +80 -0
  59. package/lib/commonjs/index.js.map +1 -1
  60. package/lib/commonjs/types/AdEventsListener.js +6 -0
  61. package/lib/commonjs/types/AdEventsListener.js.map +1 -0
  62. package/lib/commonjs/types/AppEvent.js +2 -0
  63. package/lib/commonjs/types/AppEvent.js.map +1 -0
  64. package/lib/commonjs/types/index.js +149 -0
  65. package/lib/commonjs/types/index.js.map +1 -0
  66. package/lib/commonjs/validateAdRequestOptions.js +0 -38
  67. package/lib/commonjs/validateAdRequestOptions.js.map +1 -1
  68. package/lib/commonjs/version.js +2 -2
  69. package/lib/commonjs/version.js.map +1 -1
  70. package/lib/module/AdEventType.js.map +1 -1
  71. package/lib/module/GAMAdEventType.js +22 -0
  72. package/lib/module/GAMAdEventType.js.map +1 -0
  73. package/lib/module/MobileAds.js +9 -2
  74. package/lib/module/MobileAds.js.map +1 -1
  75. package/lib/module/RewardedAdEventType.js.map +1 -1
  76. package/lib/module/TestIds.js +11 -2
  77. package/lib/module/TestIds.js.map +1 -1
  78. package/lib/module/ads/AppOpenAd.js +10 -37
  79. package/lib/module/ads/AppOpenAd.js.map +1 -1
  80. package/lib/module/ads/BannerAd.js +7 -85
  81. package/lib/module/ads/BannerAd.js.map +1 -1
  82. package/lib/module/ads/BaseAd.js +124 -0
  83. package/lib/module/ads/BaseAd.js.map +1 -0
  84. package/lib/module/ads/GAMBannerAd.js +42 -0
  85. package/lib/module/ads/GAMBannerAd.js.map +1 -0
  86. package/lib/module/ads/GAMInterstitialAd.js +38 -0
  87. package/lib/module/ads/GAMInterstitialAd.js.map +1 -0
  88. package/lib/module/ads/InterstitialAd.js +15 -48
  89. package/lib/module/ads/InterstitialAd.js.map +1 -1
  90. package/lib/module/ads/MobileAd.js +128 -12
  91. package/lib/module/ads/MobileAd.js.map +1 -1
  92. package/lib/module/ads/RewardedAd.js +24 -49
  93. package/lib/module/ads/RewardedAd.js.map +1 -1
  94. package/lib/module/ads/RewardedInterstitialAd.js +130 -0
  95. package/lib/module/ads/RewardedInterstitialAd.js.map +1 -0
  96. package/lib/module/hooks/useAppOpenAd.js.map +1 -1
  97. package/lib/module/hooks/useFullScreenAd.js +9 -4
  98. package/lib/module/hooks/useFullScreenAd.js.map +1 -1
  99. package/lib/module/hooks/useInterstitialAd.js.map +1 -1
  100. package/lib/module/hooks/useRewardedAd.js.map +1 -1
  101. package/lib/module/hooks/useRewardedInterstitialAd.js +38 -0
  102. package/lib/module/hooks/useRewardedInterstitialAd.js.map +1 -0
  103. package/lib/module/index.js +6 -0
  104. package/lib/module/index.js.map +1 -1
  105. package/lib/module/types/AdEventsListener.js +2 -0
  106. package/lib/module/types/AdEventsListener.js.map +1 -0
  107. package/lib/module/types/AppEvent.js +2 -0
  108. package/lib/module/types/AppEvent.js.map +1 -0
  109. package/lib/module/types/index.js +28 -0
  110. package/lib/module/types/index.js.map +1 -0
  111. package/lib/module/validateAdRequestOptions.js +1 -39
  112. package/lib/module/validateAdRequestOptions.js.map +1 -1
  113. package/lib/module/version.js +2 -2
  114. package/lib/module/version.js.map +1 -1
  115. package/lib/typescript/AdEventType.d.ts +4 -8
  116. package/lib/typescript/GAMAdEventType.d.ts +20 -0
  117. package/lib/typescript/MobileAds.d.ts +2 -1
  118. package/lib/typescript/RewardedAdEventType.d.ts +7 -11
  119. package/lib/typescript/TestIds.d.ts +7 -0
  120. package/lib/typescript/ads/AppOpenAd.d.ts +6 -6
  121. package/lib/typescript/ads/BannerAd.d.ts +1 -1
  122. package/lib/typescript/ads/BaseAd.d.ts +35 -0
  123. package/lib/typescript/ads/GAMBannerAd.d.ts +7 -0
  124. package/lib/typescript/ads/GAMInterstitialAd.d.ts +33 -0
  125. package/lib/typescript/ads/InterstitialAd.d.ts +10 -16
  126. package/lib/typescript/ads/MobileAd.d.ts +35 -16
  127. package/lib/typescript/ads/RewardedAd.d.ts +17 -19
  128. package/lib/typescript/ads/RewardedInterstitialAd.d.ts +82 -0
  129. package/lib/typescript/hooks/useAppOpenAd.d.ts +1 -1
  130. package/lib/typescript/hooks/useFullScreenAd.d.ts +2 -1
  131. package/lib/typescript/hooks/useInterstitialAd.d.ts +1 -1
  132. package/lib/typescript/hooks/useRewardedAd.d.ts +1 -1
  133. package/lib/typescript/hooks/useRewardedInterstitialAd.d.ts +9 -0
  134. package/lib/typescript/index.d.ts +7 -1
  135. package/lib/typescript/types/AdEventListener.d.ts +5 -9
  136. package/lib/typescript/types/AdEventsListener.d.ts +8 -0
  137. package/lib/typescript/types/AppEvent.d.ts +13 -0
  138. package/lib/typescript/types/BannerAdProps.d.ts +81 -4
  139. package/lib/typescript/types/GoogleMobileAdsNativeModule.d.ts +12 -6
  140. package/lib/typescript/types/MobileAd.interface.d.ts +37 -12
  141. package/lib/typescript/types/MobileAdsModule.interface.d.ts +9 -0
  142. package/lib/typescript/types/RequestOptions.d.ts +0 -22
  143. package/lib/typescript/types/index.d.ts +11 -0
  144. package/lib/typescript/version.d.ts +1 -1
  145. package/package.json +50 -49
  146. package/src/AdEventType.ts +4 -8
  147. package/src/GAMAdEventType.ts +37 -0
  148. package/src/MobileAds.ts +13 -0
  149. package/src/RewardedAdEventType.ts +7 -11
  150. package/src/TestIds.ts +9 -0
  151. package/src/ads/AppOpenAd.ts +11 -41
  152. package/src/ads/BannerAd.tsx +4 -106
  153. package/src/ads/BaseAd.tsx +156 -0
  154. package/src/ads/GAMBannerAd.tsx +37 -0
  155. package/src/ads/GAMInterstitialAd.ts +45 -0
  156. package/src/ads/InterstitialAd.ts +15 -56
  157. package/src/ads/MobileAd.ts +153 -30
  158. package/src/ads/RewardedAd.ts +29 -55
  159. package/src/ads/RewardedInterstitialAd.ts +143 -0
  160. package/src/hooks/useAppOpenAd.ts +1 -1
  161. package/src/hooks/useFullScreenAd.ts +9 -7
  162. package/src/hooks/useInterstitialAd.ts +1 -1
  163. package/src/hooks/useRewardedAd.ts +1 -1
  164. package/src/hooks/useRewardedInterstitialAd.ts +47 -0
  165. package/src/index.ts +6 -0
  166. package/src/types/AdEventListener.ts +31 -13
  167. package/src/types/AdEventsListener.ts +24 -0
  168. package/src/types/AppEvent.ts +14 -0
  169. package/src/types/BannerAdProps.ts +81 -4
  170. package/src/types/GoogleMobileAdsNativeModule.ts +16 -6
  171. package/src/types/MobileAd.interface.ts +56 -12
  172. package/src/types/MobileAdsModule.interface.ts +10 -0
  173. package/src/types/RequestOptions.ts +0 -24
  174. package/src/types/index.ts +28 -0
  175. package/src/validateAdRequestOptions.ts +0 -45
  176. package/src/version.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["RewardedAd.ts"],"names":["isFunction","isString","MobileAds","validateAdRequestOptions","validateAdShowOptions","MobileAd","_rewardedRequest","RewardedAd","createForAdRequest","adUnitId","requestOptions","Error","options","e","message","requestId","load","_loaded","_isLoadCalled","_googleMobileAds","native","rewardedLoad","_requestId","_adUnitId","_requestOptions","onAdEvent","handler","_setAdEventHandler","show","showOptions","rewardedShow"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,UAAT,EAAqBC,QAArB,QAAqC,WAArC;AACA,SAASC,SAAT,QAA0B,cAA1B;AACA,SAASC,wBAAT,QAAyC,6BAAzC;AACA,SAASC,qBAAT,QAAsC,0BAAtC;AACA,SAASC,QAAT,QAAyB,YAAzB;AAMA,IAAIC,gBAAgB,GAAG,CAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AwBD,OAAxB,CAAP;AACD;;AAEDE,EAAAA,IAAI,CAACC,WAAD,EAA8B;AAChC,QAAI,CAAC,KAAKZ,OAAV,EAAmB;AACjB,YAAM,IAAIN,KAAJ,CACJ,mFADI,CAAN;AAGD;;AAED,QAAIC,OAAJ;;AACA,QAAI;AACFA,MAAAA,OAAO,GAAGR,qBAAqB,CAACyB,WAAD,CAA/B;AACD,KAFD,CAEE,OAAOhB,CAAP,EAAU;AACV,UAAIA,CAAC,YAAYF,KAAjB,EAAwB;AACtB,cAAM,IAAIA,KAAJ,CAAW,sBAAqBE,CAAC,CAACC,OAAQ,GAA1C,CAAN;AACD;AACF;;AACD,WAAO,KAAKK,gBAAL,CAAsBC,MAAtB,CAA6BU,YAA7B,CAA0C,KAAKR,UAA/C,EAA2D,KAAKC,SAAhE,EAA2EX,OAA3E,CAAP;AACD;;AAnFmE","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, isString } from '../common';\nimport { MobileAds } from '../MobileAds';\nimport { validateAdRequestOptions } from '../validateAdRequestOptions';\nimport { validateAdShowOptions } from '../validateAdShowOptions';\nimport { MobileAd } from './MobileAd';\nimport { AdEventListener } from '../types/AdEventListener';\nimport { AdShowOptions } from '../types/AdShowOptions';\nimport { RequestOptions } from '../types/RequestOptions';\nimport { MobileAdInterface } from '../types/MobileAd.interface';\n\nlet _rewardedRequest = 0;\n\n/**\n * A class for interacting and showing Rewarded Ads.\n *\n * An Rewarded advert can be pre-loaded and shown at a suitable point in your apps flow, such as at the end of a level\n * in a game. The content of a rewarded advert can be controlled via your Google Mobile Ads dashboard. Typically users are rewarded\n * after completing a specific advert action (e.g. watching a video or submitting an option via an interactive form).\n * Events (such as the user earning a reward or closing a rewarded advert early) are sent back for you to handle accordingly\n * within your application.\n *\n * #### Example\n *\n * First create a new Rewarded instance, passing in your Ad Unit ID from the Google Mobile Ads configuration console, and any additional\n * request options. The example below will present a test advert, and only request a non-personalized ad.\n *\n * ```js\n * import { RewardedAd, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewarded = RewardedAd.createForAdRequest(TestIds.REWARDED, {\n * requestNonPersonalizedAdsOnly: true,\n * });\n * ```\n *\n * Each advert needs to be loaded from Google Mobile Ads before being shown. It is recommended this is performed before the user\n * reaches the checkpoint to show the advert, so it's ready to go. Before loading the advert, we need to setup\n * event listeners to listen for updates from Google Mobile Ads, such as advert loaded or failed to load.\n *\n * Event types match the `AdEventType` or `RewardedAdEventType` interface. The potential user reward for rewarded\n * adverts are passed back to the event handler on advert load and when the user earns the reward.\n *\n * ```js\n * import { RewardedAdEventType } from 'react-native-google-mobile-ads';\n *\n * rewarded.onAdEvent((type, error, reward) => {\n * if (type === RewardedAdEventType.LOADED) {\n * rewarded.show();\n * }\n * if (type === RewardedAdEventType.EARNED_REWARD) {\n * console.log('User earned reward of ', reward);\n * }\n * });\n *\n * rewarded.load();\n * ```\n *\n * The rewarded advert will be presented to the user, and several more events can be triggered such as the user clicking the\n * advert, closing it or completing the action.\n */\nexport class RewardedAd extends MobileAd implements MobileAdInterface {\n /**\n * Creates a new RewardedAd instance.\n *\n * #### Example\n *\n * ```js\n * import { RewardedAd, RewardedAdEventType, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewardedAd = await RewardedAd.createForAdRequest(TestIds.REWARDED, {\n * requestAgent: 'CoolAds',\n * });\n *\n * rewardedAd.onAdEvent((type, error, data) => {\n * console.log('New event: ', type, error);\n *\n * if (type === RewardedAdEventType.LOADED) {\n * rewardedAd.show();\n * }\n * });\n *\n * rewardedAd.load();\n * ```\n *\n * @param adUnitId The Ad Unit ID for the Rewarded Ad. You can find this on your Google Mobile Ads dashboard.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\n static createForAdRequest(adUnitId: string, requestOptions?: RequestOptions): RewardedAd {\n if (!isString(adUnitId)) {\n throw new Error(\"RewardedAd.createForAdRequest(*) 'adUnitId' expected an string value.\");\n }\n\n let options = {};\n try {\n options = validateAdRequestOptions(requestOptions);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`RewardedAd.createForAdRequest(_, *) ${e.message}.`);\n }\n }\n\n const requestId = _rewardedRequest++;\n return new RewardedAd('rewarded', MobileAds(), requestId, adUnitId, options);\n }\n\n load() {\n // Prevent multiple load calls\n if (this._loaded || this._isLoadCalled) {\n return;\n }\n\n this._isLoadCalled = true;\n this._googleMobileAds.native.rewardedLoad(\n this._requestId,\n this._adUnitId,\n this._requestOptions,\n );\n }\n\n onAdEvent(handler: AdEventListener) {\n if (!isFunction(handler)) {\n throw new Error(\"RewardedAd.onAdEvent(*) 'handler' expected a function.\");\n }\n\n return this._setAdEventHandler(handler);\n }\n\n show(showOptions?: AdShowOptions) {\n if (!this._loaded) {\n throw new Error(\n 'RewardedAd.show() The requested RewardedAd has not loaded and could not be shown.',\n );\n }\n\n let options;\n try {\n options = validateAdShowOptions(showOptions);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`RewardedAd.show(*) ${e.message}.`);\n }\n }\n return this._googleMobileAds.native.rewardedShow(this._requestId, this._adUnitId, options);\n }\n}\n"]}
1
+ {"version":3,"sources":["RewardedAd.ts"],"names":["isString","MobileAds","validateAdRequestOptions","MobileAd","AdEventType","RewardedAd","createForAdRequest","adUnitId","requestOptions","Error","options","e","message","requestId","_rewardedRequest","addAdEventsListener","listener","_addAdEventsListener","addAdEventListener","type","LOADED","_addAdEventListener"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,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AAAA,kBAAkB,CAChBC,IADgB,EAEhBH,QAFgB,EAGhB;AACA,QAAIG,IAAI,KAAKf,WAAW,CAACgB,MAAzB,EAAiC;AAC/B,YAAM,IAAIX,KAAJ,CACJ,gGADI,CAAN;AAGD;;AACD,WAAO,KAAKY,mBAAL,CAAyBF,IAAzB,EAA+BH,QAA/B,CAAP;AACD;;AA7DsC;;gBAA5BX,U,sBACyB,C","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 { isString } from '../common';\nimport { MobileAds } from '../MobileAds';\nimport { validateAdRequestOptions } from '../validateAdRequestOptions';\nimport { MobileAd } from './MobileAd';\nimport { AdEventType } from '../AdEventType';\nimport { RewardedAdEventType } from '../RewardedAdEventType';\nimport { AdEventListener } from '../types/AdEventListener';\nimport { AdEventsListener } from '../types/AdEventsListener';\nimport { RequestOptions } from '../types/RequestOptions';\n\n/**\n * A class for interacting and showing Rewarded Ads.\n *\n * An Rewarded advert can be pre-loaded and shown at a suitable point in your apps flow, such as at the end of a level\n * in a game. The content of a rewarded advert can be controlled via your Google Mobile Ads dashboard. Typically users are rewarded\n * after completing a specific advert action (e.g. watching a video or submitting an option via an interactive form).\n * Events (such as the user earning a reward or closing a rewarded advert early) are sent back for you to handle accordingly\n * within your application.\n *\n * #### Example\n *\n * First create a new Rewarded instance, passing in your Ad Unit ID from the Google Mobile Ads configuration console, and any additional\n * request options. The example below will present a test advert, and only request a non-personalized ad.\n *\n * ```js\n * import { RewardedAd, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewarded = RewardedAd.createForAdRequest(TestIds.REWARDED, {\n * requestNonPersonalizedAdsOnly: true,\n * });\n * ```\n *\n * Each advert needs to be loaded from Google Mobile Ads before being shown. It is recommended this is performed before the user\n * reaches the checkpoint to show the advert, so it's ready to go. Before loading the advert, we need to setup\n * event listeners to listen for updates from Google Mobile Ads, such as advert loaded or failed to load.\n *\n * Event types match the `AdEventType` or `RewardedAdEventType` interface. The potential user reward for rewarded\n * adverts are passed back to the event handler on advert load and when the user earns the reward.\n *\n * ```js\n * import { RewardedAdEventType } from 'react-native-google-mobile-ads';\n *\n * rewarded.addAdEventListener(RewardedAdEventType.LOADED. () => {\n * rewarded.show();\n * });\n * rewarded.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {\n * console.log('User earned reward of ', reward);\n * });\n *\n * rewarded.load();\n * ```\n *\n * The rewarded advert will be presented to the user, and several more events can be triggered such as the user clicking the\n * advert, closing it or completing the action.\n */\nexport class RewardedAd extends MobileAd {\n protected static _rewardedRequest = 0;\n /**\n * Creates a new RewardedAd instance.\n *\n * #### Example\n *\n * ```js\n * import { RewardedAd, RewardedAdEventType, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewardedAd = await RewardedAd.createForAdRequest(TestIds.REWARDED, {\n * requestAgent: 'CoolAds',\n * });\n *\n * rewarded.addAdEventListener(RewardedAdEventType.LOADED. () => {\n * rewarded.show();\n * });\n * rewarded.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {\n * console.log('User earned reward of ', reward);\n * });\n *\n * rewardedAd.load();\n * ```\n *\n * @param adUnitId The Ad Unit ID for the Rewarded Ad. You can find this on your Google Mobile Ads dashboard.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\n static createForAdRequest(adUnitId: string, requestOptions?: RequestOptions) {\n if (!isString(adUnitId)) {\n throw new Error(\"RewardedAd.createForAdRequest(*) 'adUnitId' expected an string value.\");\n }\n\n let options = {};\n try {\n options = validateAdRequestOptions(requestOptions);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`RewardedAd.createForAdRequest(_, *) ${e.message}.`);\n }\n }\n\n const requestId = RewardedAd._rewardedRequest++;\n return new RewardedAd('rewarded', MobileAds(), requestId, adUnitId, options);\n }\n\n addAdEventsListener<T extends AdEventType | RewardedAdEventType>(\n listener: AdEventsListener<T>,\n ): () => void {\n return this._addAdEventsListener(listener);\n }\n\n addAdEventListener<T extends AdEventType | RewardedAdEventType>(\n type: T,\n listener: AdEventListener<T>,\n ) {\n if (type === AdEventType.LOADED) {\n throw new Error(\n 'RewardedAd.addAdEventListener(*) use RewardedAdEventType.LOADED instead of AdEventType.LOADED.',\n );\n }\n return this._addAdEventListener(type, listener);\n }\n}\n"]}
@@ -0,0 +1,130 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ /*
4
+ * Copyright (c) 2016-present Invertase Limited & Contributors
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this library except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ */
19
+ import { isString } from '../common';
20
+ import { MobileAds } from '../MobileAds';
21
+ import { validateAdRequestOptions } from '../validateAdRequestOptions';
22
+ import { MobileAd } from './MobileAd';
23
+ import { AdEventType } from '../AdEventType';
24
+
25
+ /**
26
+ * A class for interacting and showing Rewarded Interstitial Ads.
27
+ *
28
+ * An Rewarded Interstitial advert can be pre-loaded and shown at a suitable point in your apps flow, such as at the end of a level
29
+ * in a game. The content of a rewarded interstital advert can be controlled via your Google Mobile Ads dashboard. Typically users are rewarded
30
+ * after completing a specific advert action (e.g. watching a video or submitting an option via an interactive form).
31
+ * Events (such as the user earning a reward or closing a rewarded interstital advert early) are sent back for you to handle accordingly
32
+ * within your application.
33
+ *
34
+ * #### Example
35
+ *
36
+ * First create a new Rewarded Interstitial instance, passing in your Ad Unit ID from the Google Mobile Ads configuration console, and any additional
37
+ * request options. The example below will present a test advert, and only request a non-personalized ad.
38
+ *
39
+ * ```js
40
+ * import { RewardedInterstitialAd, TestIds } from 'react-native-google-mobile-ads';
41
+ *
42
+ * const rewardedInterstitial = RewardedInterstitialAd.createForAdRequest(TestIds.REWARDED_INTERSTITIAL, {
43
+ * requestNonPersonalizedAdsOnly: true,
44
+ * });
45
+ * ```
46
+ *
47
+ * Each advert needs to be loaded from Google Mobile Ads before being shown. It is recommended this is performed before the user
48
+ * reaches the checkpoint to show the advert, so it's ready to go. Before loading the advert, we need to setup
49
+ * event listeners to listen for updates from Google Mobile Ads, such as advert loaded or failed to load.
50
+ *
51
+ * Event types match the `AdEventType` or `RewardedAdEventType` interface. The potential user reward for rewarded interstitial
52
+ * adverts are passed back to the event handler on advert load and when the user earns the reward.
53
+ *
54
+ * ```js
55
+ * import { RewardedAdEventType } from 'react-native-google-mobile-ads';
56
+ *
57
+ * rewardedInterstitial.addAdEventListener(RewardedAdEventType.LOADED. () => {
58
+ * rewarded.show();
59
+ * });
60
+ * rewardedInterstitial.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {
61
+ * console.log('User earned reward of ', reward);
62
+ * });
63
+ *
64
+ * rewardedInterstitial.load();
65
+ * ```
66
+ *
67
+ * The rewarded interstitial advert will be presented to the user, and several more events can be triggered such as the user clicking the
68
+ * advert, closing it or completing the action.
69
+ */
70
+ export class RewardedInterstitialAd extends MobileAd {
71
+ /**
72
+ * Creates a new RewardedInterstitialAd instance.
73
+ *
74
+ * #### Example
75
+ *
76
+ * ```js
77
+ * import { RewardedInterstitialAd, RewardedAdEventType, TestIds } from 'react-native-google-mobile-ads';
78
+ *
79
+ * const rewardedInterstitialAd = await RewardedInterstitialAd.createForAdRequest(TestIds.REWARDED_INTERSTITIAL, {
80
+ * requestAgent: 'CoolAds',
81
+ * });
82
+ *
83
+ * rewardedInterstitialAd.addAdEventListener(RewardedAdEventType.LOADED. () => {
84
+ * rewardedInterstitialAd.show();
85
+ * });
86
+ * rewardedInterstitialAd.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {
87
+ * console.log('User earned reward of ', reward);
88
+ * });
89
+ *
90
+ * rewardedInterstitialAd.load();
91
+ * ```
92
+ *
93
+ * @param adUnitId The Ad Unit ID for the Rewarded Interstitial Ad. You can find this on your Google Mobile Ads dashboard.
94
+ * @param requestOptions Optional RequestOptions used to load the ad.
95
+ */
96
+ static createForAdRequest(adUnitId, requestOptions) {
97
+ if (!isString(adUnitId)) {
98
+ throw new Error("RewardedInterstitialAd.createForAdRequest(*) 'adUnitId' expected an string value.");
99
+ }
100
+
101
+ let options = {};
102
+
103
+ try {
104
+ options = validateAdRequestOptions(requestOptions);
105
+ } catch (e) {
106
+ if (e instanceof Error) {
107
+ throw new Error(`RewardedInterstitialAd.createForAdRequest(_, *) ${e.message}.`);
108
+ }
109
+ }
110
+
111
+ const requestId = RewardedInterstitialAd._rewardedInterstitialRequest++;
112
+ return new RewardedInterstitialAd('rewarded_interstitial', MobileAds(), requestId, adUnitId, options);
113
+ }
114
+
115
+ addAdEventsListener(listener) {
116
+ return this._addAdEventsListener(listener);
117
+ }
118
+
119
+ addAdEventListener(type, listener) {
120
+ if (type === AdEventType.LOADED) {
121
+ throw new Error('RewardedInterstitialAd.addAdEventListener(*) use RewardedAdEventType.LOADED instead of AdEventType.LOADED.');
122
+ }
123
+
124
+ return this._addAdEventListener(type, listener);
125
+ }
126
+
127
+ }
128
+
129
+ _defineProperty(RewardedInterstitialAd, "_rewardedInterstitialRequest", 0);
130
+ //# sourceMappingURL=RewardedInterstitialAd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RewardedInterstitialAd.ts"],"names":["isString","MobileAds","validateAdRequestOptions","MobileAd","AdEventType","RewardedInterstitialAd","createForAdRequest","adUnitId","requestOptions","Error","options","e","message","requestId","_rewardedInterstitialRequest","addAdEventsListener","listener","_addAdEventsListener","addAdEventListener","type","LOADED","_addAdEventListener"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,QAAT,QAAyB,WAAzB;AACA,SAASC,SAAT,QAA0B,cAA1B;AACA,SAASC,wBAAT,QAAyC,6BAAzC;AACA,SAASC,QAAT,QAAyB,YAAzB;AACA,SAASC,WAAT,QAA4B,gBAA5B;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAN,SAAqCF,QAArC,CAA8C;AAEnD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC2B,SAAlBG,kBAAkB,CAACC,QAAD,EAAmBC,cAAnB,EAAoD;AAC3E,QAAI,CAACR,QAAQ,CAACO,QAAD,CAAb,EAAyB;AACvB,YAAM,IAAIE,KAAJ,CACJ,mFADI,CAAN;AAGD;;AAED,QAAIC,OAAO,GAAG,EAAd;;AACA,QAAI;AACFA,MAAAA,OAAO,GAAGR,wBAAwB,CAACM,cAAD,CAAlC;AACD,KAFD,CAEE,OAAOG,CAAP,EAAU;AACV,UAAIA,CAAC,YAAYF,KAAjB,EAAwB;AACtB,cAAM,IAAIA,KAAJ,CAAW,mDAAkDE,CAAC,CAACC,OAAQ,GAAvE,CAAN;AACD;AACF;;AAED,UAAMC,SAAS,GAAGR,sBAAsB,CAACS,4BAAvB,EAAlB;AACA,WAAO,IAAIT,sBAAJ,CACL,uBADK,EAELJ,SAAS,EAFJ,EAGLY,SAHK,EAILN,QAJK,EAKLG,OALK,CAAP;AAOD;;AAEDK,EAAAA,mBAAmB,CACjBC,QADiB,EAEL;AACZ,WAAO,KAAKC,oBAAL,CAA0BD,QAA1B,CAAP;AACD;;AAEDE,EAAAA,kBAAkB,CAChBC,IADgB,EAEhBH,QAFgB,EAGhB;AACA,QAAIG,IAAI,KAAKf,WAAW,CAACgB,MAAzB,EAAiC;AAC/B,YAAM,IAAIX,KAAJ,CACJ,4GADI,CAAN;AAGD;;AACD,WAAO,KAAKY,mBAAL,CAAyBF,IAAzB,EAA+BH,QAA/B,CAAP;AACD;;AArEkD;;gBAAxCX,sB,kCACqC,C","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 { isString } from '../common';\nimport { MobileAds } from '../MobileAds';\nimport { validateAdRequestOptions } from '../validateAdRequestOptions';\nimport { MobileAd } from './MobileAd';\nimport { AdEventType } from '../AdEventType';\nimport { RewardedAdEventType } from '../RewardedAdEventType';\nimport { AdEventListener } from '../types/AdEventListener';\nimport { AdEventsListener } from '../types/AdEventsListener';\nimport { RequestOptions } from '../types/RequestOptions';\n\n/**\n * A class for interacting and showing Rewarded Interstitial Ads.\n *\n * An Rewarded Interstitial advert can be pre-loaded and shown at a suitable point in your apps flow, such as at the end of a level\n * in a game. The content of a rewarded interstital advert can be controlled via your Google Mobile Ads dashboard. Typically users are rewarded\n * after completing a specific advert action (e.g. watching a video or submitting an option via an interactive form).\n * Events (such as the user earning a reward or closing a rewarded interstital advert early) are sent back for you to handle accordingly\n * within your application.\n *\n * #### Example\n *\n * First create a new Rewarded Interstitial instance, passing in your Ad Unit ID from the Google Mobile Ads configuration console, and any additional\n * request options. The example below will present a test advert, and only request a non-personalized ad.\n *\n * ```js\n * import { RewardedInterstitialAd, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewardedInterstitial = RewardedInterstitialAd.createForAdRequest(TestIds.REWARDED_INTERSTITIAL, {\n * requestNonPersonalizedAdsOnly: true,\n * });\n * ```\n *\n * Each advert needs to be loaded from Google Mobile Ads before being shown. It is recommended this is performed before the user\n * reaches the checkpoint to show the advert, so it's ready to go. Before loading the advert, we need to setup\n * event listeners to listen for updates from Google Mobile Ads, such as advert loaded or failed to load.\n *\n * Event types match the `AdEventType` or `RewardedAdEventType` interface. The potential user reward for rewarded interstitial\n * adverts are passed back to the event handler on advert load and when the user earns the reward.\n *\n * ```js\n * import { RewardedAdEventType } from 'react-native-google-mobile-ads';\n *\n * rewardedInterstitial.addAdEventListener(RewardedAdEventType.LOADED. () => {\n * rewarded.show();\n * });\n * rewardedInterstitial.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {\n * console.log('User earned reward of ', reward);\n * });\n *\n * rewardedInterstitial.load();\n * ```\n *\n * The rewarded interstitial advert will be presented to the user, and several more events can be triggered such as the user clicking the\n * advert, closing it or completing the action.\n */\nexport class RewardedInterstitialAd extends MobileAd {\n protected static _rewardedInterstitialRequest = 0;\n /**\n * Creates a new RewardedInterstitialAd instance.\n *\n * #### Example\n *\n * ```js\n * import { RewardedInterstitialAd, RewardedAdEventType, TestIds } from 'react-native-google-mobile-ads';\n *\n * const rewardedInterstitialAd = await RewardedInterstitialAd.createForAdRequest(TestIds.REWARDED_INTERSTITIAL, {\n * requestAgent: 'CoolAds',\n * });\n *\n * rewardedInterstitialAd.addAdEventListener(RewardedAdEventType.LOADED. () => {\n * rewardedInterstitialAd.show();\n * });\n * rewardedInterstitialAd.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {\n * console.log('User earned reward of ', reward);\n * });\n *\n * rewardedInterstitialAd.load();\n * ```\n *\n * @param adUnitId The Ad Unit ID for the Rewarded Interstitial Ad. You can find this on your Google Mobile Ads dashboard.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\n static createForAdRequest(adUnitId: string, requestOptions?: RequestOptions) {\n if (!isString(adUnitId)) {\n throw new Error(\n \"RewardedInterstitialAd.createForAdRequest(*) 'adUnitId' expected an string value.\",\n );\n }\n\n let options = {};\n try {\n options = validateAdRequestOptions(requestOptions);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`RewardedInterstitialAd.createForAdRequest(_, *) ${e.message}.`);\n }\n }\n\n const requestId = RewardedInterstitialAd._rewardedInterstitialRequest++;\n return new RewardedInterstitialAd(\n 'rewarded_interstitial',\n MobileAds(),\n requestId,\n adUnitId,\n options,\n );\n }\n\n addAdEventsListener<T extends AdEventType | RewardedAdEventType>(\n listener: AdEventsListener<T>,\n ): () => void {\n return this._addAdEventsListener(listener);\n }\n\n addAdEventListener<T extends AdEventType | RewardedAdEventType>(\n type: T,\n listener: AdEventListener<T>,\n ) {\n if (type === AdEventType.LOADED) {\n throw new Error(\n 'RewardedInterstitialAd.addAdEventListener(*) use RewardedAdEventType.LOADED instead of AdEventType.LOADED.',\n );\n }\n return this._addAdEventListener(type, listener);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["useAppOpenAd.ts"],"names":["useState","useDeepCompareEffect","AppOpenAd","useFullScreenAd","useAppOpenAd","adUnitId","requestOptions","appOpenAd","setAppOpenAd","createForAdRequest"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,QAAT,QAAyB,OAAzB;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;AAEA,SAASC,SAAT,QAA0B,kBAA1B;AAIA,SAASC,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,YAAT,CACLC,QADK,EAG4B;AAAA,MADjCC,cACiC,uEADA,EACA;AACjC,QAAM,CAACC,SAAD,EAAYC,YAAZ,IAA4BR,QAAQ,CAAmB,IAAnB,CAA1C;AAEAC,EAAAA,oBAAoB,CAAC,MAAM;AACzBO,IAAAA,YAAY,CAAC,MAAM;AACjB,aAAOH,QAAQ,GAAGH,SAAS,CAACO,kBAAV,CAA6BJ,QAA7B,EAAuCC,cAAvC,CAAH,GAA4D,IAA3E;AACD,KAFW,CAAZ;AAGD,GAJmB,EAIjB,CAACD,QAAD,EAAWC,cAAX,CAJiB,CAApB;AAMA,SAAOH,eAAe,CAACI,SAAD,CAAtB;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 { useState } from 'react';\nimport useDeepCompareEffect from 'use-deep-compare-effect';\n\nimport { AppOpenAd } from '../ads/AppOpenAd';\nimport { AdHookReturns } from '../types/AdStates';\nimport { RequestOptions } from '../types/RequestOptions';\n\nimport { useFullScreenAd } from './useFullScreenAd';\n\n/**\n * React Hook for App Open Ad.\n *\n * @param adUnitId The Ad Unit ID for the App Open Ad. You can find this on your Google Mobile Ads dashboard. You can destroy ad instance by setting this value to null.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\nexport function useAppOpenAd(\n adUnitId: string | null,\n requestOptions: RequestOptions = {},\n): Omit<AdHookReturns, 'adReward'> {\n const [appOpenAd, setAppOpenAd] = useState<AppOpenAd | null>(null);\n\n useDeepCompareEffect(() => {\n setAppOpenAd(() => {\n return adUnitId ? AppOpenAd.createForAdRequest(adUnitId, requestOptions) : null;\n });\n }, [adUnitId, requestOptions]);\n\n return useFullScreenAd(appOpenAd);\n}\n"]}
1
+ {"version":3,"sources":["useAppOpenAd.ts"],"names":["useState","useDeepCompareEffect","AppOpenAd","useFullScreenAd","useAppOpenAd","adUnitId","requestOptions","appOpenAd","setAppOpenAd","createForAdRequest"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,QAAT,QAAyB,OAAzB;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;AAEA,SAASC,SAAT,QAA0B,kBAA1B;AAIA,SAASC,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,YAAT,CACLC,QADK,EAG6C;AAAA,MADlDC,cACkD,uEADjB,EACiB;AAClD,QAAM,CAACC,SAAD,EAAYC,YAAZ,IAA4BR,QAAQ,CAAmB,IAAnB,CAA1C;AAEAC,EAAAA,oBAAoB,CAAC,MAAM;AACzBO,IAAAA,YAAY,CAAC,MAAM;AACjB,aAAOH,QAAQ,GAAGH,SAAS,CAACO,kBAAV,CAA6BJ,QAA7B,EAAuCC,cAAvC,CAAH,GAA4D,IAA3E;AACD,KAFW,CAAZ;AAGD,GAJmB,EAIjB,CAACD,QAAD,EAAWC,cAAX,CAJiB,CAApB;AAMA,SAAOH,eAAe,CAACI,SAAD,CAAtB;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 { useState } from 'react';\nimport useDeepCompareEffect from 'use-deep-compare-effect';\n\nimport { AppOpenAd } from '../ads/AppOpenAd';\nimport { AdHookReturns } from '../types/AdStates';\nimport { RequestOptions } from '../types/RequestOptions';\n\nimport { useFullScreenAd } from './useFullScreenAd';\n\n/**\n * React Hook for App Open Ad.\n *\n * @param adUnitId The Ad Unit ID for the App Open Ad. You can find this on your Google Mobile Ads dashboard. You can destroy ad instance by setting this value to null.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\nexport function useAppOpenAd(\n adUnitId: string | null,\n requestOptions: RequestOptions = {},\n): Omit<AdHookReturns, 'reward' | 'isEarnedReward'> {\n const [appOpenAd, setAppOpenAd] = useState<AppOpenAd | null>(null);\n\n useDeepCompareEffect(() => {\n setAppOpenAd(() => {\n return adUnitId ? AppOpenAd.createForAdRequest(adUnitId, requestOptions) : null;\n });\n }, [adUnitId, requestOptions]);\n\n return useFullScreenAd(appOpenAd);\n}\n"]}
@@ -49,7 +49,12 @@ export function useFullScreenAd(ad) {
49
49
  return;
50
50
  }
51
51
 
52
- const unsubscribe = ad.onAdEvent((type, error, data) => {
52
+ const unsubscribe = ad.addAdEventsListener(_ref => {
53
+ let {
54
+ type,
55
+ payload
56
+ } = _ref;
57
+
53
58
  switch (type) {
54
59
  case AdEventType.LOADED:
55
60
  setState({
@@ -77,21 +82,21 @@ export function useFullScreenAd(ad) {
77
82
 
78
83
  case AdEventType.ERROR:
79
84
  setState({
80
- error: error
85
+ error: payload
81
86
  });
82
87
  break;
83
88
 
84
89
  case RewardedAdEventType.LOADED:
85
90
  setState({
86
91
  isLoaded: true,
87
- reward: data
92
+ reward: payload
88
93
  });
89
94
  break;
90
95
 
91
96
  case RewardedAdEventType.EARNED_REWARD:
92
97
  setState({
93
98
  isEarnedReward: true,
94
- reward: data
99
+ reward: payload
95
100
  });
96
101
  break;
97
102
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useFullScreenAd.ts"],"names":["useCallback","useEffect","useReducer","AdEventType","RewardedAdEventType","initialState","isLoaded","isOpened","isClicked","isClosed","error","undefined","reward","isEarnedReward","useFullScreenAd","ad","state","setState","prevState","newState","isShowing","load","show","showOptions","unsubscribe","onAdEvent","type","data","LOADED","OPENED","CLOSED","CLICKED","ERROR","EARNED_REWARD"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAAkBA,WAAlB,EAA+BC,SAA/B,EAA0CC,UAA1C,QAA4D,OAA5D;AAEA,SAASC,WAAT,QAA4B,gBAA5B;AAIA,SAASC,mBAAT,QAAoC,wBAApC;AAIA,MAAMC,YAAsB,GAAG;AAC7BC,EAAAA,QAAQ,EAAE,KADmB;AAE7BC,EAAAA,QAAQ,EAAE,KAFmB;AAG7BC,EAAAA,SAAS,EAAE,KAHkB;AAI7BC,EAAAA,QAAQ,EAAE,KAJmB;AAK7BC,EAAAA,KAAK,EAAEC,SALsB;AAM7BC,EAAAA,MAAM,EAAED,SANqB;AAO7BE,EAAAA,cAAc,EAAE;AAPa,CAA/B;AAUA,OAAO,SAASC,eAAT,CACLC,EADK,EAEU;AACf,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoBf,UAAU,CAClC,CAACgB,SAAD,EAAYC,QAAZ,MAA0B,EAAE,GAAGD,SAAL;AAAgB,OAAGC;AAAnB,GAA1B,CADkC,EAElCd,YAFkC,CAApC;AAIA,QAAMe,SAAS,GAAGJ,KAAK,CAACT,QAAN,IAAkB,CAACS,KAAK,CAACP,QAA3C;AAEA,QAAMY,IAAI,GAAGrB,WAAW,CAAC,MAAM;AAC7B,QAAIe,EAAJ,EAAQ;AACNE,MAAAA,QAAQ,CAACZ,YAAD,CAAR;AACAU,MAAAA,EAAE,CAACM,IAAH;AACD;AACF,GALuB,EAKrB,CAACN,EAAD,CALqB,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,YAAAA,MAAM,EAAEe;AAAhC,WAAD,CAAR;AACA;AArBJ;AAuBD,KAxBmB,CAApB;AAyBA,WAAO,MAAM;AACXH,MAAAA,WAAW;AACZ,KAFD;AAGD,GAjCQ,EAiCN,CAACT,EAAD,CAjCM,CAAT;AAmCA,SAAO,EACL,GAAGC,KADE;AAELI,IAAAA,SAFK;AAGLC,IAAAA,IAHK;AAILC,IAAAA;AAJK,GAAP;AAMD","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 { Reducer, useCallback, useEffect, useReducer } from 'react';\n\nimport { AdEventType } from '../AdEventType';\nimport { AppOpenAd } from '../ads/AppOpenAd';\nimport { InterstitialAd } from '../ads/InterstitialAd';\nimport { RewardedAd } from '../ads/RewardedAd';\nimport { RewardedAdEventType } from '../RewardedAdEventType';\nimport { AdStates, AdHookReturns } from '../types/AdStates';\nimport { AdShowOptions } from '../types/AdShowOptions';\n\nconst initialState: AdStates = {\n isLoaded: false,\n isOpened: false,\n isClicked: false,\n isClosed: false,\n error: undefined,\n reward: undefined,\n isEarnedReward: false,\n};\n\nexport function useFullScreenAd<T extends InterstitialAd | RewardedAd | AppOpenAd | null>(\n ad: T,\n): AdHookReturns {\n const [state, setState] = useReducer<Reducer<AdStates, Partial<AdStates>>>(\n (prevState, newState) => ({ ...prevState, ...newState }),\n initialState,\n );\n const isShowing = state.isOpened && !state.isClosed;\n\n const load = useCallback(() => {\n if (ad) {\n setState(initialState);\n ad.load();\n }\n }, [ad]);\n\n const show = useCallback(\n (showOptions?: AdShowOptions) => {\n if (ad) {\n ad.show(showOptions);\n }\n },\n [ad],\n );\n\n useEffect(() => {\n setState(initialState);\n if (!ad) {\n return;\n }\n const unsubscribe = ad.onAdEvent((type, error, data) => {\n switch (type) {\n case AdEventType.LOADED:\n setState({ isLoaded: true });\n break;\n case AdEventType.OPENED:\n setState({ isOpened: true });\n break;\n case AdEventType.CLOSED:\n setState({ isClosed: true });\n break;\n case AdEventType.CLICKED:\n setState({ isClicked: true });\n break;\n case AdEventType.ERROR:\n setState({ error: error });\n break;\n case RewardedAdEventType.LOADED:\n setState({ isLoaded: true, reward: data });\n break;\n case RewardedAdEventType.EARNED_REWARD:\n setState({ isEarnedReward: true, reward: data });\n break;\n }\n });\n return () => {\n unsubscribe();\n };\n }, [ad]);\n\n return {\n ...state,\n isShowing,\n load,\n show,\n };\n}\n"]}
1
+ {"version":3,"sources":["useFullScreenAd.ts"],"names":["useCallback","useEffect","useReducer","AdEventType","RewardedAdEventType","initialState","isLoaded","isOpened","isClicked","isClosed","error","undefined","reward","isEarnedReward","useFullScreenAd","ad","state","setState","prevState","newState","isShowing","load","show","showOptions","unsubscribe","addAdEventsListener","type","payload","LOADED","OPENED","CLOSED","CLICKED","ERROR","EARNED_REWARD"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAAkBA,WAAlB,EAA+BC,SAA/B,EAA0CC,UAA1C,QAA4D,OAA5D;AAEA,SAASC,WAAT,QAA4B,gBAA5B;AAKA,SAASC,mBAAT,QAAoC,wBAApC;AAKA,MAAMC,YAAsB,GAAG;AAC7BC,EAAAA,QAAQ,EAAE,KADmB;AAE7BC,EAAAA,QAAQ,EAAE,KAFmB;AAG7BC,EAAAA,SAAS,EAAE,KAHkB;AAI7BC,EAAAA,QAAQ,EAAE,KAJmB;AAK7BC,EAAAA,KAAK,EAAEC,SALsB;AAM7BC,EAAAA,MAAM,EAAED,SANqB;AAO7BE,EAAAA,cAAc,EA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AA,QAAQ,EAAE;AAAZ,WAAD,CAAR;AACA;;AACF,aAAKN,WAAW,CAAC4B,OAAjB;AACEd,UAAAA,QAAQ,CAAC;AAAET,YAAAA,SAAS,EAAE;AAAb,WAAD,CAAR;AACA;;AACF,aAAKL,WAAW,CAAC6B,KAAjB;AACEf,UAAAA,QAAQ,CAAC;AAAEP,YAAAA,KAAK,EAAEiB;AAAT,WAAD,CAAR;AACA;;AACF,aAAKvB,mBAAmB,CAACwB,MAAzB;AACEX,UAAAA,QAAQ,CAAC;AAAEX,YAAAA,QAAQ,EAAE,IAAZ;AAAkBM,YAAAA,MAAM,EAAEe;AAA1B,WAAD,CAAR;AACA;;AACF,aAAKvB,mBAAmB,CAAC6B,aAAzB;AACEhB,UAAAA,QAAQ,CAAC;AAAEJ,YAAAA,cAAc,EAAE,IAAlB;AAAwBD,YAAAA,MAAM,EAAEe;AAAhC,WAAD,CAAR;AACA;AArBJ;AAuBD,KAxBmB,CAApB;AAyBA,WAAO,MAAM;AACXH,MAAAA,WAAW;AACZ,KAFD;AAGD,GAjCQ,EAiCN,CAACT,EAAD,CAjCM,CAAT;AAmCA,SAAO,EACL,GAAGC,KADE;AAELI,IAAAA,SAFK;AAGLC,IAAAA,IAHK;AAILC,IAAAA;AAJK,GAAP;AAMD","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 { Reducer, useCallback, useEffect, useReducer } from 'react';\n\nimport { AdEventType } from '../AdEventType';\nimport { AppOpenAd } from '../ads/AppOpenAd';\nimport { InterstitialAd } from '../ads/InterstitialAd';\nimport { RewardedAd } from '../ads/RewardedAd';\nimport { RewardedInterstitialAd } from '../ads/RewardedInterstitialAd';\nimport { RewardedAdEventType } from '../RewardedAdEventType';\nimport { AdStates, AdHookReturns } from '../types/AdStates';\nimport { AdShowOptions } from '../types/AdShowOptions';\nimport { RewardedAdReward } from '../types/RewardedAdReward';\n\nconst initialState: AdStates = {\n isLoaded: false,\n isOpened: false,\n isClicked: false,\n isClosed: false,\n error: undefined,\n reward: undefined,\n isEarnedReward: false,\n};\n\nexport function useFullScreenAd<\n T extends AppOpenAd | InterstitialAd | RewardedAd | RewardedInterstitialAd | null,\n>(ad: T): AdHookReturns {\n const [state, setState] = useReducer<Reducer<AdStates, Partial<AdStates>>>(\n (prevState, newState) => ({ ...prevState, ...newState }),\n initialState,\n );\n const isShowing = state.isOpened && !state.isClosed;\n\n const load = useCallback(() => {\n if (ad) {\n setState(initialState);\n ad.load();\n }\n }, [ad]);\n\n const show = useCallback(\n (showOptions?: AdShowOptions) => {\n if (ad) {\n ad.show(showOptions);\n }\n },\n [ad],\n );\n\n useEffect(() => {\n setState(initialState);\n if (!ad) {\n return;\n }\n const unsubscribe = (ad as RewardedAd).addAdEventsListener(({ type, payload }) => {\n switch (type) {\n case AdEventType.LOADED:\n setState({ isLoaded: true });\n break;\n case AdEventType.OPENED:\n setState({ isOpened: true });\n break;\n case AdEventType.CLOSED:\n setState({ isClosed: true });\n break;\n case AdEventType.CLICKED:\n setState({ isClicked: true });\n break;\n case AdEventType.ERROR:\n setState({ error: payload as Error });\n break;\n case RewardedAdEventType.LOADED:\n setState({ isLoaded: true, reward: payload as RewardedAdReward });\n break;\n case RewardedAdEventType.EARNED_REWARD:\n setState({ isEarnedReward: true, reward: payload as RewardedAdReward });\n break;\n }\n });\n return () => {\n unsubscribe();\n };\n }, [ad]);\n\n return {\n ...state,\n isShowing,\n load,\n show,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["useInterstitialAd.ts"],"names":["useState","useDeepCompareEffect","InterstitialAd","useFullScreenAd","useInterstitialAd","adUnitId","requestOptions","interstitialAd","setInterstitialAd","createForAdRequest"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,QAAT,QAAyB,OAAzB;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;AAEA,SAASC,cAAT,QAA+B,uBAA/B;AAIA,SAASC,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,CACLC,QADK,EAG4B;AAAA,MADjCC,cACiC,uEADA,EACA;AACjC,QAAM,CAACC,cAAD,EAAiBC,iBAAjB,IAAsCR,QAAQ,CAAwB,IAAxB,CAApD;AAEAC,EAAAA,oBAAoB,CAAC,MAAM;AACzBO,IAAAA,iBAAiB,CAAC,MAAM;AACtB,aAAOH,QAAQ,GAAGH,cAAc,CAACO,kBAAf,CAAkCJ,QAAlC,EAA4CC,cAA5C,CAAH,GAAiE,IAAhF;AACD,KAFgB,CAAjB;AAGD,GAJmB,EAIjB,CAACD,QAAD,EAAWC,cAAX,CAJiB,CAApB;AAMA,SAAOH,eAAe,CAACI,cAAD,CAAtB;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 { useState } from 'react';\nimport useDeepCompareEffect from 'use-deep-compare-effect';\n\nimport { InterstitialAd } from '../ads/InterstitialAd';\nimport { AdHookReturns } from '../types/AdStates';\nimport { RequestOptions } from '../types/RequestOptions';\n\nimport { useFullScreenAd } from './useFullScreenAd';\n\n/**\n * React Hook for Interstitial Ad.\n *\n * @param adUnitId The Ad Unit ID for the Interstitial Ad. You can find this on your Google Mobile Ads dashboard. You can destroy ad instance by setting this value to null.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\nexport function useInterstitialAd(\n adUnitId: string | null,\n requestOptions: RequestOptions = {},\n): Omit<AdHookReturns, 'adReward'> {\n const [interstitialAd, setInterstitialAd] = useState<InterstitialAd | null>(null);\n\n useDeepCompareEffect(() => {\n setInterstitialAd(() => {\n return adUnitId ? InterstitialAd.createForAdRequest(adUnitId, requestOptions) : null;\n });\n }, [adUnitId, requestOptions]);\n\n return useFullScreenAd(interstitialAd);\n}\n"]}
1
+ {"version":3,"sources":["useInterstitialAd.ts"],"names":["useState","useDeepCompareEffect","InterstitialAd","useFullScreenAd","useInterstitialAd","adUnitId","requestOptions","interstitialAd","setInterstitialAd","createForAdRequest"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,QAAT,QAAyB,OAAzB;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;AAEA,SAASC,cAAT,QAA+B,uBAA/B;AAIA,SAASC,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,CACLC,QADK,EAG6C;AAAA,MADlDC,cACkD,uEADjB,EACiB;AAClD,QAAM,CAACC,cAAD,EAAiBC,iBAAjB,IAAsCR,QAAQ,CAAwB,IAAxB,CAApD;AAEAC,EAAAA,oBAAoB,CAAC,MAAM;AACzBO,IAAAA,iBAAiB,CAAC,MAAM;AACtB,aAAOH,QAAQ,GAAGH,cAAc,CAACO,kBAAf,CAAkCJ,QAAlC,EAA4CC,cAA5C,CAAH,GAAiE,IAAhF;AACD,KAFgB,CAAjB;AAGD,GAJmB,EAIjB,CAACD,QAAD,EAAWC,cAAX,CAJiB,CAApB;AAMA,SAAOH,eAAe,CAACI,cAAD,CAAtB;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 { useState } from 'react';\nimport useDeepCompareEffect from 'use-deep-compare-effect';\n\nimport { InterstitialAd } from '../ads/InterstitialAd';\nimport { AdHookReturns } from '../types/AdStates';\nimport { RequestOptions } from '../types/RequestOptions';\n\nimport { useFullScreenAd } from './useFullScreenAd';\n\n/**\n * React Hook for Interstitial Ad.\n *\n * @param adUnitId The Ad Unit ID for the Interstitial Ad. You can find this on your Google Mobile Ads dashboard. You can destroy ad instance by setting this value to null.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\nexport function useInterstitialAd(\n adUnitId: string | null,\n requestOptions: RequestOptions = {},\n): Omit<AdHookReturns, 'reward' | 'isEarnedReward'> {\n const [interstitialAd, setInterstitialAd] = useState<InterstitialAd | null>(null);\n\n useDeepCompareEffect(() => {\n setInterstitialAd(() => {\n return adUnitId ? InterstitialAd.createForAdRequest(adUnitId, requestOptions) : null;\n });\n }, [adUnitId, requestOptions]);\n\n return useFullScreenAd(interstitialAd);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["useRewardedAd.ts"],"names":["useState","useDeepCompareEffect","RewardedAd","useFullScreenAd","useRewardedAd","adUnitId","requestOptions","rewardedAd","setRewardedAd","createForAdRequest"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,QAAT,QAAyB,OAAzB;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;AAEA,SAASC,UAAT,QAA2B,mBAA3B;AAIA,SAASC,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CACLC,QADK,EAG4B;AAAA,MADjCC,cACiC,uEADA,EACA;AACjC,QAAM,CAACC,UAAD,EAAaC,aAAb,IAA8BR,QAAQ,CAAoB,IAApB,CAA5C;AAEAC,EAAAA,oBAAoB,CAAC,MAAM;AACzBO,IAAAA,aAAa,CAAC,MAAM;AAClB,aAAOH,QAAQ,GAAGH,UAAU,CAACO,kBAAX,CAA8BJ,QAA9B,EAAwCC,cAAxC,CAAH,GAA6D,IAA5E;AACD,KAFY,CAAb;AAGD,GAJmB,EAIjB,CAACD,QAAD,EAAWC,cAAX,CAJiB,CAApB;AAMA,SAAOH,eAAe,CAACI,UAAD,CAAtB;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 { useState } from 'react';\nimport useDeepCompareEffect from 'use-deep-compare-effect';\n\nimport { RewardedAd } from '../ads/RewardedAd';\nimport { AdHookReturns } from '../types/AdStates';\nimport { RequestOptions } from '../types/RequestOptions';\n\nimport { useFullScreenAd } from './useFullScreenAd';\n\n/**\n * React Hook for Rewarded Ad.\n *\n * @param adUnitId The Ad Unit ID for the Rewarded Ad. You can find this on your Google Mobile Ads dashboard. You can destroy ad instance by setting this value to null.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\nexport function useRewardedAd(\n adUnitId: string | null,\n requestOptions: RequestOptions = {},\n): Omit<AdHookReturns, 'adReward'> {\n const [rewardedAd, setRewardedAd] = useState<RewardedAd | null>(null);\n\n useDeepCompareEffect(() => {\n setRewardedAd(() => {\n return adUnitId ? RewardedAd.createForAdRequest(adUnitId, requestOptions) : null;\n });\n }, [adUnitId, requestOptions]);\n\n return useFullScreenAd(rewardedAd);\n}\n"]}
1
+ {"version":3,"sources":["useRewardedAd.ts"],"names":["useState","useDeepCompareEffect","RewardedAd","useFullScreenAd","useRewardedAd","adUnitId","requestOptions","rewardedAd","setRewardedAd","createForAdRequest"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,QAAT,QAAyB,OAAzB;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;AAEA,SAASC,UAAT,QAA2B,mBAA3B;AAIA,SAASC,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CACLC,QADK,EAGU;AAAA,MADfC,cACe,uEADkB,EAClB;AACf,QAAM,CAACC,UAAD,EAAaC,aAAb,IAA8BR,QAAQ,CAAoB,IAApB,CAA5C;AAEAC,EAAAA,oBAAoB,CAAC,MAAM;AACzBO,IAAAA,aAAa,CAAC,MAAM;AAClB,aAAOH,QAAQ,GAAGH,UAAU,CAACO,kBAAX,CAA8BJ,QAA9B,EAAwCC,cAAxC,CAAH,GAA6D,IAA5E;AACD,KAFY,CAAb;AAGD,GAJmB,EAIjB,CAACD,QAAD,EAAWC,cAAX,CAJiB,CAApB;AAMA,SAAOH,eAAe,CAACI,UAAD,CAAtB;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 { useState } from 'react';\nimport useDeepCompareEffect from 'use-deep-compare-effect';\n\nimport { RewardedAd } from '../ads/RewardedAd';\nimport { AdHookReturns } from '../types/AdStates';\nimport { RequestOptions } from '../types/RequestOptions';\n\nimport { useFullScreenAd } from './useFullScreenAd';\n\n/**\n * React Hook for Rewarded Ad.\n *\n * @param adUnitId The Ad Unit ID for the Rewarded Ad. You can find this on your Google Mobile Ads dashboard. You can destroy ad instance by setting this value to null.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\nexport function useRewardedAd(\n adUnitId: string | null,\n requestOptions: RequestOptions = {},\n): AdHookReturns {\n const [rewardedAd, setRewardedAd] = useState<RewardedAd | null>(null);\n\n useDeepCompareEffect(() => {\n setRewardedAd(() => {\n return adUnitId ? RewardedAd.createForAdRequest(adUnitId, requestOptions) : null;\n });\n }, [adUnitId, requestOptions]);\n\n return useFullScreenAd(rewardedAd);\n}\n"]}
@@ -0,0 +1,38 @@
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 { useState } from 'react';
18
+ import useDeepCompareEffect from 'use-deep-compare-effect';
19
+ import { RewardedInterstitialAd } from '../ads/RewardedInterstitialAd';
20
+ import { useFullScreenAd } from './useFullScreenAd';
21
+ /**
22
+ * React Hook for Rewarded Interstitial Ad.
23
+ *
24
+ * @param adUnitId The Ad Unit ID for the Rewarded Interstitial Ad. You can find this on your Google Mobile Ads dashboard. You can destroy ad instance by setting this value to null.
25
+ * @param requestOptions Optional RequestOptions used to load the ad.
26
+ */
27
+
28
+ export function useRewardedInterstitialAd(adUnitId) {
29
+ let requestOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
30
+ const [rewardedInterstitialAd, setRewardedInterstitialAd] = useState(null);
31
+ useDeepCompareEffect(() => {
32
+ setRewardedInterstitialAd(() => {
33
+ return adUnitId ? RewardedInterstitialAd.createForAdRequest(adUnitId, requestOptions) : null;
34
+ });
35
+ }, [adUnitId, requestOptions]);
36
+ return useFullScreenAd(rewardedInterstitialAd);
37
+ }
38
+ //# sourceMappingURL=useRewardedInterstitialAd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useRewardedInterstitialAd.ts"],"names":["useState","useDeepCompareEffect","RewardedInterstitialAd","useFullScreenAd","useRewardedInterstitialAd","adUnitId","requestOptions","rewardedInterstitialAd","setRewardedInterstitialAd","createForAdRequest"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,QAAT,QAAyB,OAAzB;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;AAEA,SAASC,sBAAT,QAAuC,+BAAvC;AAIA,SAASC,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,yBAAT,CACLC,QADK,EAGU;AAAA,MADfC,cACe,uEADkB,EAClB;AACf,QAAM,CAACC,sBAAD,EAAyBC,yBAAzB,IACJR,QAAQ,CAAgC,IAAhC,CADV;AAGAC,EAAAA,oBAAoB,CAAC,MAAM;AACzBO,IAAAA,yBAAyB,CAAC,MAAM;AAC9B,aAAOH,QAAQ,GAAGH,sBAAsB,CAACO,kBAAvB,CAA0CJ,QAA1C,EAAoDC,cAApD,CAAH,GAAyE,IAAxF;AACD,KAFwB,CAAzB;AAGD,GAJmB,EAIjB,CAACD,QAAD,EAAWC,cAAX,CAJiB,CAApB;AAMA,SAAOH,eAAe,CAACI,sBAAD,CAAtB;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 { useState } from 'react';\nimport useDeepCompareEffect from 'use-deep-compare-effect';\n\nimport { RewardedInterstitialAd } from '../ads/RewardedInterstitialAd';\nimport { AdHookReturns } from '../types/AdStates';\nimport { RequestOptions } from '../types/RequestOptions';\n\nimport { useFullScreenAd } from './useFullScreenAd';\n\n/**\n * React Hook for Rewarded Interstitial Ad.\n *\n * @param adUnitId The Ad Unit ID for the Rewarded Interstitial Ad. You can find this on your Google Mobile Ads dashboard. You can destroy ad instance by setting this value to null.\n * @param requestOptions Optional RequestOptions used to load the ad.\n */\nexport function useRewardedInterstitialAd(\n adUnitId: string | null,\n requestOptions: RequestOptions = {},\n): AdHookReturns {\n const [rewardedInterstitialAd, setRewardedInterstitialAd] =\n useState<RewardedInterstitialAd | null>(null);\n\n useDeepCompareEffect(() => {\n setRewardedInterstitialAd(() => {\n return adUnitId ? RewardedInterstitialAd.createForAdRequest(adUnitId, requestOptions) : null;\n });\n }, [adUnitId, requestOptions]);\n\n return useFullScreenAd(rewardedInterstitialAd);\n}\n"]}
@@ -26,13 +26,19 @@ export { MaxAdContentRating } from './MaxAdContentRating';
26
26
  export { TestIds } from './TestIds';
27
27
  export { AdEventType } from './AdEventType';
28
28
  export { BannerAdSize } from './BannerAdSize';
29
+ export { GAMAdEventType } from './GAMAdEventType';
29
30
  export { RewardedAdEventType } from './RewardedAdEventType';
30
31
  export { AdsConsent } from './AdsConsent';
31
32
  export { AppOpenAd } from './ads/AppOpenAd';
32
33
  export { InterstitialAd } from './ads/InterstitialAd';
33
34
  export { RewardedAd } from './ads/RewardedAd';
35
+ export { RewardedInterstitialAd } from './ads/RewardedInterstitialAd';
34
36
  export { BannerAd } from './ads/BannerAd';
37
+ export { GAMBannerAd } from './ads/GAMBannerAd';
38
+ export { GAMInterstitialAd } from './ads/GAMInterstitialAd';
35
39
  export { useAppOpenAd } from './hooks/useAppOpenAd';
36
40
  export { useInterstitialAd } from './hooks/useInterstitialAd';
37
41
  export { useRewardedAd } from './hooks/useRewardedAd';
42
+ export { useRewardedInterstitialAd } from './hooks/useRewardedInterstitialAd';
43
+ export * from './types';
38
44
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["version","SDK_VERSION","default","MobileAds","AdsConsentDebugGeography","AdsConsentPurposes","AdsConsentSpecialFeatures","AdsConsentStatus","MaxAdContentRating","TestIds","AdEventType","BannerAdSize","RewardedAdEventType","AdsConsent","AppOpenAd","InterstitialAd","RewardedAd","BannerAd","useAppOpenAd","useInterstitialAd","useRewardedAd"],"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,kBAAT,QAAmC,sBAAnC;AACA,SAASC,yBAAT,QAA0C,6BAA1C;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;AACA,SAASC,YAAT,QAA6B,sBAA7B;AACA,SAASC,iBAAT,QAAkC,2BAAlC;AACA,SAASC,aAAT,QAA8B,uBAA9B","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 { AdsConsentPurposes } from './AdsConsentPurposes';\nexport { AdsConsentSpecialFeatures } from './AdsConsentSpecialFeatures';\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';\nexport { useAppOpenAd } from './hooks/useAppOpenAd';\nexport { useInterstitialAd } from './hooks/useInterstitialAd';\nexport { useRewardedAd } from './hooks/useRewardedAd';\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":["version","SDK_VERSION","default","MobileAds","AdsConsentDebugGeography","AdsConsentPurposes","AdsConsentSpecialFeatures","AdsConsentStatus","MaxAdContentRating","TestIds","AdEventType","BannerAdSize","GAMAdEventType","RewardedAdEventType","AdsConsent","AppOpenAd","InterstitialAd","RewardedAd","RewardedInterstitialAd","BannerAd","GAMBannerAd","GAMInterstitialAd","useAppOpenAd","useInterstitialAd","useRewardedAd","useRewardedInterstitialAd"],"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,kBAAT,QAAmC,sBAAnC;AACA,SAASC,yBAAT,QAA0C,6BAA1C;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,cAAT,QAA+B,kBAA/B;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,sBAAT,QAAuC,8BAAvC;AACA,SAASC,QAAT,QAAyB,gBAAzB;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,iBAAT,QAAkC,yBAAlC;AACA,SAASC,YAAT,QAA6B,sBAA7B;AACA,SAASC,iBAAT,QAAkC,2BAAlC;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,yBAAT,QAA0C,mCAA1C;AACA,cAAc,SAAd","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 { AdsConsentPurposes } from './AdsConsentPurposes';\nexport { AdsConsentSpecialFeatures } from './AdsConsentSpecialFeatures';\nexport { AdsConsentStatus } from './AdsConsentStatus';\nexport { MaxAdContentRating } from './MaxAdContentRating';\nexport { TestIds } from './TestIds';\nexport { AdEventType } from './AdEventType';\nexport { BannerAdSize } from './BannerAdSize';\nexport { GAMAdEventType } from './GAMAdEventType';\nexport { RewardedAdEventType } from './RewardedAdEventType';\nexport { AdsConsent } from './AdsConsent';\nexport { AppOpenAd } from './ads/AppOpenAd';\nexport { InterstitialAd } from './ads/InterstitialAd';\nexport { RewardedAd } from './ads/RewardedAd';\nexport { RewardedInterstitialAd } from './ads/RewardedInterstitialAd';\nexport { BannerAd } from './ads/BannerAd';\nexport { GAMBannerAd } from './ads/GAMBannerAd';\nexport { GAMInterstitialAd } from './ads/GAMInterstitialAd';\nexport { useAppOpenAd } from './hooks/useAppOpenAd';\nexport { useInterstitialAd } from './hooks/useInterstitialAd';\nexport { useRewardedAd } from './hooks/useRewardedAd';\nexport { useRewardedInterstitialAd } from './hooks/useRewardedInterstitialAd';\nexport * from './types';\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AdEventsListener.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=AppEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -0,0 +1,28 @@
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
+ export * from './AdapterStatus';
18
+ export * from './AdEventListener';
19
+ export * from './AdEventsListener';
20
+ export * from './AdsConsent.interface';
21
+ export * from './AdShowOptions';
22
+ export * from './AdStates';
23
+ export * from './BannerAdProps';
24
+ export * from './RequestConfiguration';
25
+ export * from './RequestOptions';
26
+ export * from './RewardedAdReward';
27
+ export * from './AppEvent';
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,cAAc,iBAAd;AACA,cAAc,mBAAd;AACA,cAAc,oBAAd;AACA,cAAc,wBAAd;AACA,cAAc,iBAAd;AACA,cAAc,YAAd;AACA,cAAc,iBAAd;AACA,cAAc,wBAAd;AACA,cAAc,kBAAd;AACA,cAAc,oBAAd;AACA,cAAc,YAAd","sourcesContent":["/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nexport * from './AdapterStatus';\nexport * from './AdEventListener';\nexport * from './AdEventsListener';\nexport * from './AdsConsent.interface';\nexport * from './AdShowOptions';\nexport * from './AdStates';\nexport * from './BannerAdProps';\nexport * from './RequestConfiguration';\nexport * from './RequestOptions';\nexport * from './RewardedAdReward';\nexport * from './AppEvent';\n"]}
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  *
16
16
  */
17
- import { hasOwnProperty, isArray, isBoolean, isNumber, isObject, isString, isUndefined, isValidUrl } from './common';
17
+ import { hasOwnProperty, isArray, isBoolean, isObject, isString, isUndefined, isValidUrl } from './common';
18
18
  export function validateAdRequestOptions(options) {
19
19
  const out = {};
20
20
 
@@ -81,44 +81,6 @@ export function validateAdRequestOptions(options) {
81
81
  out.contentUrl = options.contentUrl;
82
82
  }
83
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
84
  if (options.requestAgent) {
123
85
  if (!isString(options.requestAgent)) {
124
86
  throw new Error("'options.requestAgent' expected a string value");
@@ -1 +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","customTargeting"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SACEA,cADF,EAEEC,OAFF,EAGEC,SAHF,EAIEC,QAJF,EAKEC,QALF,EAMEC,QANF,EAOEC,WAPF,EAQEC,UARF,QASO,UATP;AAYA,OAAO,SAASC,wBAAT,CAAkCC,OAAlC,EAA4D;AACjE,QAAMC,GAAmB,GAAG,EAA5B;;AAEA,MAAIJ,WAAW,CAACG,OAAD,CAAf,EAA0B;AACxB,WAAOC,GAAP;AACD;;AAED,MAAI,CAACN,QAAQ,CAACK,OAAD,CAAb,EAAwB;AACtB,UAAM,IAAIE,KAAJ,CAAU,oCAAV,CAAN;AACD;;AAED,MAAIX,cAAc,CAACS,OAAD,EAAU,+BAAV,CAAlB,EAA8D;AAC5D,QAAI,CAACP,SAAS,CAACO,OAAO,CAACG,6BAAT,CAAd,EAAuD;AACrD,YAAM,IAAID,KAAJ,CAAU,kEAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACE,6BAAJ,GAAoCH,OAAO,CAACG,6BAA5C;AACD;;AAED,MAAIH,OAAO,CAACI,aAAZ,EAA2B;AACzB,QAAI,CAACT,QAAQ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016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\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 if (options.customTargeting) {\n if (!isObject(options.customTargeting)) {\n throw new Error(\"'options.customTargeting' expected an object of key/value pairs\");\n }\n out.customTargeting = options.customTargeting;\n }\n\n return out;\n}\n"]}
1
+ {"version":3,"sources":["validateAdRequestOptions.ts"],"names":["hasOwnProperty","isArray","isBoolean","isObject","isString","isUndefined","isValidUrl","validateAdRequestOptions","options","out","Error","requestNonPersonalizedAdsOnly","networkExtras","Object","entries","forEach","key","value","keywords","i","length","keyword","contentUrl","requestAgent","serverSideVerificationOptions","ssvOptions","userId","customData","customTargeting"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SACEA,cADF,EAEEC,OAFF,EAGEC,SAHF,EAIEC,QAJF,EAKEC,QALF,EAMEC,WANF,EAOEC,UAPF,QAQO,UARP;AAWA,OAAO,SAASC,wBAAT,CAAkCC,OAAlC,EAA4D;AACjE,QAAMC,GAAmB,GAAG,EAA5B;;AAEA,MAAIJ,WAAW,CAACG,OAAD,CAAf,EAA0B;AACxB,WAAOC,GAAP;AACD;;AAED,MAAI,CAACN,QAAQ,CAACK,OAAD,CAAb,EAAwB;AACtB,UAAM,IAAIE,KAAJ,CAAU,oCAAV,CAAN;AACD;;AAED,MAAIV,cAAc,CAACQ,OAAD,EAAU,+BAAV,CAAlB,EAA8D;AAC5D,QAAI,CAACN,SAAS,CAACM,OAAO,CAACG,6BAAT,CAAd,EAAuD;AACrD,YAAM,IAAID,KAAJ,CAAU,kEAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACE,6BAAJ,GAAoCH,OAAO,CAACG,6BAA5C;AACD;;AAED,MAAIH,OAAO,CAACI,aAAZ,EAA2B;AACzB,QAAI,CAACT,QAAQ,CAACK,OAAO,CAACI,aAAT,CAAb,EAAsC;AACpC,YAAM,IAAIF,KAAJ,CAAU,+DAAV,CAAN;AACD;;AAEDG,IAAAA,MAAM,CAACC,OAAP,CAAeN,OAAO,CAACI,aAAvB,EAAsCG,OAAt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;;AAED,MAAId,OAAO,CAACe,YAAZ,EAA0B;AACxB,QAAI,CAACnB,QAAQ,CAACI,OAAO,CAACe,YAAT,CAAb,EAAqC;AACnC,YAAM,IAAIb,KAAJ,CAAU,gDAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACc,YAAJ,GAAmBf,OAAO,CAACe,YAA3B;AACD;;AAED,MAAIf,OAAO,CAACgB,6BAAZ,EAA2C;AACzC,QAAI,CAACrB,QAAQ,CAACK,OAAO,CAACgB,6BAAT,CAAb,EAAsD;AACpD,YAAM,IAAId,KAAJ,CACJ,+EADI,CAAN;AAGD;;AAED,UAAMe,UAAU,GAAGjB,OAAO,CAACgB,6BAA3B;;AAEA,QAAIC,UAAU,CAACC,MAAX,IAAqB,CAACtB,QAAQ,CAACqB,UAAU,CAACC,MAAZ,CAAlC,EAAuD;AACrD,YAAM,IAAIhB,KAAJ,CAAU,wEAAV,CAAN;AACD;;AAED,QAAIe,UAAU,CAACE,UAAX,IAAyB,CAACvB,QAAQ,CAACqB,UAAU,CAACE,UAAZ,CAAtC,EAA+D;AAC7D,YAAM,IAAIjB,KAAJ,CAAU,4EAAV,CAAN;AACD;;AAEDD,IAAAA,GAAG,CAACe,6BAAJ,GAAoChB,OAAO,CAACgB,6BAA5C;AACD;;AAED,MAAIhB,OAAO,CAACoB,eAAZ,EAA6B;AAC3B,QAAI,CAACzB,QAAQ,CAACK,OAAO,CAACoB,eAAT,CAAb,EAAwC;AACtC,YAAM,IAAIlB,KAAJ,CAAU,iEAAV,CAAN;AACD;;AACDD,IAAAA,GAAG,CAACmB,eAAJ,GAAsBpB,OAAO,CAACoB,eAA9B;AACD;;AAED,SAAOnB,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 {\n hasOwnProperty,\n isArray,\n isBoolean,\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.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 if (options.customTargeting) {\n if (!isObject(options.customTargeting)) {\n throw new Error(\"'options.customTargeting' expected an object of key/value pairs\");\n }\n out.customTargeting = options.customTargeting;\n }\n\n return out;\n}\n"]}
@@ -1,3 +1,3 @@
1
- // generated by genversion
2
- export const version = '5.1.1';
1
+ // Generated by genversion.
2
+ export const version = '6.1.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '5.1.1';\n"]}
1
+ {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// Generated by genversion.\nexport const version = '6.1.0';\n"]}
@@ -7,10 +7,8 @@ export declare enum AdEventType {
7
7
  * ```js
8
8
  * import { AdEventType } from 'react-native-google-mobile-ads';
9
9
  *
10
- * advert.onAdEvent((type,error,data) => {
11
- * if (type === AdEventType.LOADED) {
12
- * advert.show();
13
- * }
10
+ * advert.addEventListener(AdEventType.LOADED, () => {
11
+ * advert.show();
14
12
  * });
15
13
  * ```
16
14
  */
@@ -23,10 +21,8 @@ export declare enum AdEventType {
23
21
  * ```js
24
22
  * import { AdEventType } from 'react-native-google-mobile-ads';
25
23
  *
26
- * advert.onAdEvent((type, error, data) => {
27
- * if (type === AdEventType.ERROR) {
28
- * console.log('Ad error:', error);
29
- * }
24
+ * advert.addEventListener(AdEventType.ERROR, (error) => {
25
+ * console.log('Ad error:', error);
30
26
  * });
31
27
  * ```
32
28
  */