react-native-google-mobile-ads 6.0.0 → 6.2.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 (72) hide show
  1. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsCommon.java +9 -3
  2. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsEvent.java +2 -0
  3. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsPackage.java +1 -0
  4. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsRewardedInterstitialModule.java +199 -0
  5. package/docs/displaying-ads-hook.mdx +1 -1
  6. package/docs/displaying-ads.mdx +132 -1
  7. package/docs/european-user-consent.mdx +31 -0
  8. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +1 -0
  9. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.m +7 -1
  10. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.h +25 -0
  11. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.m +173 -0
  12. package/lib/commonjs/BannerAdSize.js +2 -0
  13. package/lib/commonjs/BannerAdSize.js.map +1 -1
  14. package/lib/commonjs/MobileAds.js +5 -2
  15. package/lib/commonjs/MobileAds.js.map +1 -1
  16. package/lib/commonjs/TestIds.js +6 -2
  17. package/lib/commonjs/TestIds.js.map +1 -1
  18. package/lib/commonjs/ads/MobileAd.js +16 -4
  19. package/lib/commonjs/ads/MobileAd.js.map +1 -1
  20. package/lib/commonjs/ads/RewardedInterstitialAd.js +127 -0
  21. package/lib/commonjs/ads/RewardedInterstitialAd.js.map +1 -0
  22. package/lib/commonjs/hooks/useFullScreenAd.js.map +1 -1
  23. package/lib/commonjs/hooks/useRewardedAd.js.map +1 -1
  24. package/lib/commonjs/hooks/useRewardedInterstitialAd.js +51 -0
  25. package/lib/commonjs/hooks/useRewardedInterstitialAd.js.map +1 -0
  26. package/lib/commonjs/index.js +19 -1
  27. package/lib/commonjs/index.js.map +1 -1
  28. package/lib/commonjs/version.js +1 -1
  29. package/lib/commonjs/version.js.map +1 -1
  30. package/lib/module/BannerAdSize.js +2 -0
  31. package/lib/module/BannerAdSize.js.map +1 -1
  32. package/lib/module/MobileAds.js +5 -2
  33. package/lib/module/MobileAds.js.map +1 -1
  34. package/lib/module/TestIds.js +6 -2
  35. package/lib/module/TestIds.js.map +1 -1
  36. package/lib/module/ads/MobileAd.js +16 -4
  37. package/lib/module/ads/MobileAd.js.map +1 -1
  38. package/lib/module/ads/RewardedInterstitialAd.js +130 -0
  39. package/lib/module/ads/RewardedInterstitialAd.js.map +1 -0
  40. package/lib/module/hooks/useFullScreenAd.js.map +1 -1
  41. package/lib/module/hooks/useRewardedAd.js.map +1 -1
  42. package/lib/module/hooks/useRewardedInterstitialAd.js +38 -0
  43. package/lib/module/hooks/useRewardedInterstitialAd.js.map +1 -0
  44. package/lib/module/index.js +2 -0
  45. package/lib/module/index.js.map +1 -1
  46. package/lib/module/version.js +1 -1
  47. package/lib/module/version.js.map +1 -1
  48. package/lib/typescript/BannerAdSize.d.ts +10 -1
  49. package/lib/typescript/MobileAds.d.ts +1 -1
  50. package/lib/typescript/TestIds.d.ts +2 -0
  51. package/lib/typescript/ads/MobileAd.d.ts +3 -2
  52. package/lib/typescript/ads/RewardedInterstitialAd.d.ts +82 -0
  53. package/lib/typescript/hooks/useFullScreenAd.d.ts +2 -1
  54. package/lib/typescript/hooks/useRewardedAd.d.ts +1 -1
  55. package/lib/typescript/hooks/useRewardedInterstitialAd.d.ts +9 -0
  56. package/lib/typescript/index.d.ts +3 -1
  57. package/lib/typescript/types/GoogleMobileAdsNativeModule.d.ts +12 -7
  58. package/lib/typescript/types/MobileAdsModule.interface.d.ts +1 -1
  59. package/lib/typescript/version.d.ts +1 -1
  60. package/package.json +8 -8
  61. package/src/BannerAdSize.ts +12 -1
  62. package/src/MobileAds.ts +9 -0
  63. package/src/TestIds.ts +4 -0
  64. package/src/ads/MobileAd.ts +16 -6
  65. package/src/ads/RewardedInterstitialAd.ts +143 -0
  66. package/src/hooks/useFullScreenAd.ts +4 -3
  67. package/src/hooks/useRewardedAd.ts +1 -1
  68. package/src/hooks/useRewardedInterstitialAd.ts +47 -0
  69. package/src/index.ts +2 -0
  70. package/src/types/GoogleMobileAdsNativeModule.ts +16 -7
  71. package/src/types/MobileAdsModule.interface.ts +1 -1
  72. package/src/version.ts +1 -1
@@ -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"]}
@@ -32,11 +32,13 @@ export { AdsConsent } from './AdsConsent';
32
32
  export { AppOpenAd } from './ads/AppOpenAd';
33
33
  export { InterstitialAd } from './ads/InterstitialAd';
34
34
  export { RewardedAd } from './ads/RewardedAd';
35
+ export { RewardedInterstitialAd } from './ads/RewardedInterstitialAd';
35
36
  export { BannerAd } from './ads/BannerAd';
36
37
  export { GAMBannerAd } from './ads/GAMBannerAd';
37
38
  export { GAMInterstitialAd } from './ads/GAMInterstitialAd';
38
39
  export { useAppOpenAd } from './hooks/useAppOpenAd';
39
40
  export { useInterstitialAd } from './hooks/useInterstitialAd';
40
41
  export { useRewardedAd } from './hooks/useRewardedAd';
42
+ export { useRewardedInterstitialAd } from './hooks/useRewardedInterstitialAd';
41
43
  export * from './types';
42
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","GAMAdEventType","RewardedAdEventType","AdsConsent","AppOpenAd","InterstitialAd","RewardedAd","BannerAd","GAMBannerAd","GAMInterstitialAd","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,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,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,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 { 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 * from './types';\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"]}
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '6.0.0';
2
+ export const version = '6.2.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 = '6.0.0';\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.2.0';\n"]}
@@ -20,9 +20,18 @@ export declare enum BannerAdSize {
20
20
  */
21
21
  MEDIUM_RECTANGLE = "MEDIUM_RECTANGLE",
22
22
  /**
23
- * A (next generation) dynamically sized banner that is full-width and auto-height.
23
+ * @deprecated Use `ANCHORED_ADAPTIVE_BANNER` instead.
24
24
  */
25
25
  ADAPTIVE_BANNER = "ADAPTIVE_BANNER",
26
+ /**
27
+ * A (next generation) dynamically sized banner that is full-width and auto-height.
28
+ */
29
+ ANCHORED_ADAPTIVE_BANNER = "ANCHORED_ADAPTIVE_BANNER",
30
+ /**
31
+ * Inline adaptive banners are larger, taller banners compared to anchored adaptive banners. They are of variable height, and can be as tall as the device screen.
32
+ * They are intended to be placed in scrolling content.
33
+ */
34
+ INLINE_ADAPTIVE_BANNER = "INLINE_ADAPTIVE_BANNER",
26
35
  /**
27
36
  * A dynamically sized banner that matches its parent's width and expands/contracts its height to match the ad's content after loading completes.
28
37
  */
@@ -6,7 +6,7 @@ declare class MobileAdsModule extends Module implements MobileAdsModuleInterface
6
6
  constructor(app: App, config: Config);
7
7
  initialize(): Promise<import("./types").AdapterStatus[]>;
8
8
  setRequestConfiguration(requestConfiguration: RequestConfiguration): Promise<void>;
9
- openAdInspector(): () => Promise<void>;
9
+ openAdInspector(): Promise<void>;
10
10
  }
11
11
  export declare const MobileAds: () => MobileAdsModule;
12
12
  export default MobileAds;
@@ -3,9 +3,11 @@ export declare const TestIds: {
3
3
  BANNER: string;
4
4
  INTERSTITIAL: string;
5
5
  REWARDED: string;
6
+ REWARDED_INTERSTITIAL: string;
6
7
  GAM_APP_OPEN: string;
7
8
  GAM_BANNER: string;
8
9
  GAM_INTERSTITIAL: string;
9
10
  GAM_REWARDED: string;
11
+ GAM_REWARDED_INTERSTITIAL: string;
10
12
  GAM_NATIVE: string;
11
13
  };
@@ -12,7 +12,7 @@ import { GAMAdEventType } from '../GAMAdEventType';
12
12
  import { AppEvent } from '../types/AppEvent';
13
13
  declare type EventType = AdEventType | RewardedAdEventType | GAMAdEventType;
14
14
  export declare abstract class MobileAd implements MobileAdInterface {
15
- protected _type: 'app_open' | 'interstitial' | 'rewarded';
15
+ protected _type: 'app_open' | 'interstitial' | 'rewarded' | 'rewarded_interstitial';
16
16
  protected _googleMobileAds: MobileAdsModuleInterface;
17
17
  protected _requestId: number;
18
18
  protected _adUnitId: string;
@@ -24,7 +24,7 @@ export declare abstract class MobileAd implements MobileAdInterface {
24
24
  protected _adEventsListenerId: number;
25
25
  protected _adEventListenerId: number;
26
26
  protected _nativeListener: EmitterSubscription;
27
- protected constructor(type: 'app_open' | 'interstitial' | 'rewarded', googleMobileAds: MobileAdsModuleInterface, requestId: number, adUnitId: string, requestOptions: RequestOptions);
27
+ protected constructor(type: 'app_open' | 'interstitial' | 'rewarded' | 'rewarded_interstitial', googleMobileAds: MobileAdsModuleInterface, requestId: number, adUnitId: string, requestOptions: RequestOptions);
28
28
  protected _handleAdEvent(event: {
29
29
  body: {
30
30
  type: EventType;
@@ -39,6 +39,7 @@ export declare abstract class MobileAd implements MobileAdInterface {
39
39
  protected _addAdEventListener<T extends EventType>(type: T, listener: AdEventListener<T>): () => void;
40
40
  protected _getAdEventListeners<T extends EventType>(type: T): Map<number, AdEventListener<T>>;
41
41
  protected get _className(): string;
42
+ protected get _camelCaseType(): "appOpen" | "interstitial" | "rewarded" | "rewardedInterstitial";
42
43
  load(): void;
43
44
  show(showOptions?: AdShowOptions): Promise<void>;
44
45
  abstract addAdEventsListener<T extends never>(listener: AdEventsListener<T>): () => void;
@@ -0,0 +1,82 @@
1
+ import { MobileAd } from './MobileAd';
2
+ import { AdEventType } from '../AdEventType';
3
+ import { RewardedAdEventType } from '../RewardedAdEventType';
4
+ import { AdEventListener } from '../types/AdEventListener';
5
+ import { AdEventsListener } from '../types/AdEventsListener';
6
+ import { RequestOptions } from '../types/RequestOptions';
7
+ /**
8
+ * A class for interacting and showing Rewarded Interstitial Ads.
9
+ *
10
+ * 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
11
+ * in a game. The content of a rewarded interstital advert can be controlled via your Google Mobile Ads dashboard. Typically users are rewarded
12
+ * after completing a specific advert action (e.g. watching a video or submitting an option via an interactive form).
13
+ * Events (such as the user earning a reward or closing a rewarded interstital advert early) are sent back for you to handle accordingly
14
+ * within your application.
15
+ *
16
+ * #### Example
17
+ *
18
+ * First create a new Rewarded Interstitial instance, passing in your Ad Unit ID from the Google Mobile Ads configuration console, and any additional
19
+ * request options. The example below will present a test advert, and only request a non-personalized ad.
20
+ *
21
+ * ```js
22
+ * import { RewardedInterstitialAd, TestIds } from 'react-native-google-mobile-ads';
23
+ *
24
+ * const rewardedInterstitial = RewardedInterstitialAd.createForAdRequest(TestIds.REWARDED_INTERSTITIAL, {
25
+ * requestNonPersonalizedAdsOnly: true,
26
+ * });
27
+ * ```
28
+ *
29
+ * Each advert needs to be loaded from Google Mobile Ads before being shown. It is recommended this is performed before the user
30
+ * reaches the checkpoint to show the advert, so it's ready to go. Before loading the advert, we need to setup
31
+ * event listeners to listen for updates from Google Mobile Ads, such as advert loaded or failed to load.
32
+ *
33
+ * Event types match the `AdEventType` or `RewardedAdEventType` interface. The potential user reward for rewarded interstitial
34
+ * adverts are passed back to the event handler on advert load and when the user earns the reward.
35
+ *
36
+ * ```js
37
+ * import { RewardedAdEventType } from 'react-native-google-mobile-ads';
38
+ *
39
+ * rewardedInterstitial.addAdEventListener(RewardedAdEventType.LOADED. () => {
40
+ * rewarded.show();
41
+ * });
42
+ * rewardedInterstitial.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {
43
+ * console.log('User earned reward of ', reward);
44
+ * });
45
+ *
46
+ * rewardedInterstitial.load();
47
+ * ```
48
+ *
49
+ * The rewarded interstitial advert will be presented to the user, and several more events can be triggered such as the user clicking the
50
+ * advert, closing it or completing the action.
51
+ */
52
+ export declare class RewardedInterstitialAd extends MobileAd {
53
+ protected static _rewardedInterstitialRequest: number;
54
+ /**
55
+ * Creates a new RewardedInterstitialAd instance.
56
+ *
57
+ * #### Example
58
+ *
59
+ * ```js
60
+ * import { RewardedInterstitialAd, RewardedAdEventType, TestIds } from 'react-native-google-mobile-ads';
61
+ *
62
+ * const rewardedInterstitialAd = await RewardedInterstitialAd.createForAdRequest(TestIds.REWARDED_INTERSTITIAL, {
63
+ * requestAgent: 'CoolAds',
64
+ * });
65
+ *
66
+ * rewardedInterstitialAd.addAdEventListener(RewardedAdEventType.LOADED. () => {
67
+ * rewardedInterstitialAd.show();
68
+ * });
69
+ * rewardedInterstitialAd.addAdEventListener(RewardedAdEventType.EARNED_REWARD. (reward) => {
70
+ * console.log('User earned reward of ', reward);
71
+ * });
72
+ *
73
+ * rewardedInterstitialAd.load();
74
+ * ```
75
+ *
76
+ * @param adUnitId The Ad Unit ID for the Rewarded Interstitial Ad. You can find this on your Google Mobile Ads dashboard.
77
+ * @param requestOptions Optional RequestOptions used to load the ad.
78
+ */
79
+ static createForAdRequest(adUnitId: string, requestOptions?: RequestOptions): RewardedInterstitialAd;
80
+ addAdEventsListener<T extends AdEventType | RewardedAdEventType>(listener: AdEventsListener<T>): () => void;
81
+ addAdEventListener<T extends AdEventType | RewardedAdEventType>(type: T, listener: AdEventListener<T>): () => void;
82
+ }
@@ -1,5 +1,6 @@
1
1
  import { AppOpenAd } from '../ads/AppOpenAd';
2
2
  import { InterstitialAd } from '../ads/InterstitialAd';
3
3
  import { RewardedAd } from '../ads/RewardedAd';
4
+ import { RewardedInterstitialAd } from '../ads/RewardedInterstitialAd';
4
5
  import { AdHookReturns } from '../types/AdStates';
5
- export declare function useFullScreenAd<T extends InterstitialAd | RewardedAd | AppOpenAd | null>(ad: T): AdHookReturns;
6
+ export declare function useFullScreenAd<T extends AppOpenAd | InterstitialAd | RewardedAd | RewardedInterstitialAd | null>(ad: T): AdHookReturns;
@@ -6,4 +6,4 @@ import { RequestOptions } from '../types/RequestOptions';
6
6
  * @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.
7
7
  * @param requestOptions Optional RequestOptions used to load the ad.
8
8
  */
9
- export declare function useRewardedAd(adUnitId: string | null, requestOptions?: RequestOptions): Omit<AdHookReturns, 'adReward'>;
9
+ export declare function useRewardedAd(adUnitId: string | null, requestOptions?: RequestOptions): AdHookReturns;
@@ -0,0 +1,9 @@
1
+ import { AdHookReturns } from '../types/AdStates';
2
+ import { RequestOptions } from '../types/RequestOptions';
3
+ /**
4
+ * React Hook for Rewarded Interstitial Ad.
5
+ *
6
+ * @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.
7
+ * @param requestOptions Optional RequestOptions used to load the ad.
8
+ */
9
+ export declare function useRewardedInterstitialAd(adUnitId: string | null, requestOptions?: RequestOptions): AdHookReturns;
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "6.0.0";
1
+ export declare const SDK_VERSION = "6.2.0";
2
2
  export { default, MobileAds } from './MobileAds';
3
3
  export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
4
4
  export { AdsConsentPurposes } from './AdsConsentPurposes';
@@ -14,10 +14,12 @@ export { AdsConsent } from './AdsConsent';
14
14
  export { AppOpenAd } from './ads/AppOpenAd';
15
15
  export { InterstitialAd } from './ads/InterstitialAd';
16
16
  export { RewardedAd } from './ads/RewardedAd';
17
+ export { RewardedInterstitialAd } from './ads/RewardedInterstitialAd';
17
18
  export { BannerAd } from './ads/BannerAd';
18
19
  export { GAMBannerAd } from './ads/GAMBannerAd';
19
20
  export { GAMInterstitialAd } from './ads/GAMInterstitialAd';
20
21
  export { useAppOpenAd } from './hooks/useAppOpenAd';
21
22
  export { useInterstitialAd } from './hooks/useInterstitialAd';
22
23
  export { useRewardedAd } from './hooks/useRewardedAd';
24
+ export { useRewardedInterstitialAd } from './hooks/useRewardedInterstitialAd';
23
25
  export * from './types';
@@ -2,14 +2,19 @@ import { AdapterStatus } from './AdapterStatus';
2
2
  import { RequestConfiguration } from './RequestConfiguration';
3
3
  import { RequestOptions } from './RequestOptions';
4
4
  import { AdShowOptions } from './AdShowOptions';
5
+ declare type AdLoadFunction = (requestId: number, adUnitId: string, requestOptions: RequestOptions) => void;
6
+ declare type AdShowFunction = (requestId: number, adUnitId: string, showOptions?: AdShowOptions) => Promise<void>;
5
7
  export interface GoogleMobileAdsNativeModule {
6
8
  initialize(): Promise<AdapterStatus[]>;
7
9
  setRequestConfiguration(requestConfiguration?: RequestConfiguration): Promise<void>;
8
- openAdInspector(): () => Promise<void>;
9
- appOpenLoad(requestId: number, adUnitId: string, requestOptions: RequestOptions): void;
10
- appOpenShow(requestId: number, adUnitId: string, showOptions?: AdShowOptions): Promise<void>;
11
- interstitialLoad(requestId: number, adUnitId: string, requestOptions: RequestOptions): void;
12
- interstitialShow(requestId: number, adUnitId: string, showOptions?: AdShowOptions): Promise<void>;
13
- rewardedLoad(requestId: number, adUnitId: string, requestOptions: RequestOptions): void;
14
- rewardedShow(requestId: number, adUnitId: string, showOptions?: AdShowOptions): Promise<void>;
10
+ openAdInspector(): Promise<void>;
11
+ appOpenLoad: AdLoadFunction;
12
+ appOpenShow: AdShowFunction;
13
+ interstitialLoad: AdLoadFunction;
14
+ interstitialShow: AdShowFunction;
15
+ rewardedLoad: AdLoadFunction;
16
+ rewardedShow: AdShowFunction;
17
+ rewardedInterstitialLoad: AdLoadFunction;
18
+ rewardedInterstitialShow: AdShowFunction;
15
19
  }
20
+ export {};
@@ -35,7 +35,7 @@ export interface MobileAdsModuleInterface {
35
35
  *
36
36
  * @see https://developers.google.com/ad-manager/mobile-ads-sdk/android/ad-inspector
37
37
  */
38
- openAdInspector(): () => Promise<void>;
38
+ openAdInspector(): Promise<void>;
39
39
  /**
40
40
  * The native module instance for the Google Mobile Ads service.
41
41
  */
@@ -1 +1 @@
1
- export declare const version = "6.0.0";
1
+ export declare const version = "6.2.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-google-mobile-ads",
3
- "version": "6.0.0",
3
+ "version": "6.2.0",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Google Mobile Ads is an easy way to monetize mobile apps with targeted, in-app advertising.",
6
6
  "main": "lib/commonjs/index.js",
@@ -97,7 +97,7 @@
97
97
  "tests:ios:test-cover": "cd RNGoogleMobileAdsExample && ./node_modules/.bin/nyc yarn detox test --configuration ios.sim.debug",
98
98
  "tests:ios:test-cover-reuse": "cd RNGoogleMobileAdsExample && node_modules/.bin/nyc yarn detox test --configuration ios.sim.debug --reuse --loglevel warn",
99
99
  "tests:ios:pod:install": "cd RNGoogleMobileAdsExample && cd ios && rm -rf RNGoogleMobileAdsExample.xcworkspace && rm -f Podfile.lock && pod install --repo-update && cd ..",
100
- "package:update": "yarn upgrade --latest && yarn add clang-format@v1.6.0"
100
+ "package:update": "yarn upgrade --latest"
101
101
  },
102
102
  "dependencies": {
103
103
  "@iabtcf/core": "^1.4.0",
@@ -113,13 +113,13 @@
113
113
  "@semantic-release/npm": "^9.0.1",
114
114
  "@semantic-release/release-notes-generator": "^10.0.3",
115
115
  "@types/jest": "^27.4.1",
116
- "@types/node": "^17.0.29",
116
+ "@types/node": "^17.0.30",
117
117
  "@types/react": "^18.0.8",
118
118
  "@types/react-native": "^0.67.6",
119
119
  "@typescript-eslint/eslint-plugin": "^5.21.0",
120
120
  "@typescript-eslint/parser": "^5.21.0",
121
- "babel-jest": "^28.0.2",
122
- "clang-format": "1.6.0",
121
+ "babel-jest": "^28.0.3",
122
+ "clang-format": "1.8.0",
123
123
  "codecov": "^3.8.3",
124
124
  "conventional-changelog-cli": "^2.2.2",
125
125
  "eslint": "^8.14.0",
@@ -130,8 +130,8 @@
130
130
  "eslint-plugin-react": "^7.29.4",
131
131
  "genversion": "^3.1.1",
132
132
  "google-java-format": "^1.0.1",
133
- "inquirer": "^8.2.3",
134
- "jest": "^28.0.2",
133
+ "inquirer": "^8.2.4",
134
+ "jest": "^28.0.3",
135
135
  "lerna": "4.0.0",
136
136
  "prettier": "^2.6.2",
137
137
  "react": "^18.1.0",
@@ -142,7 +142,7 @@
142
142
  "shelljs": "^0.8.5",
143
143
  "ts-jest": "^27.1.4",
144
144
  "ts-node": "^10.7.0",
145
- "typescript": "^4.6.3"
145
+ "typescript": "^4.6.4"
146
146
  },
147
147
  "publishConfig": {
148
148
  "access": "public"
@@ -43,10 +43,21 @@ export enum BannerAdSize {
43
43
  MEDIUM_RECTANGLE = 'MEDIUM_RECTANGLE',
44
44
 
45
45
  /**
46
- * A (next generation) dynamically sized banner that is full-width and auto-height.
46
+ * @deprecated Use `ANCHORED_ADAPTIVE_BANNER` instead.
47
47
  */
48
48
  ADAPTIVE_BANNER = 'ADAPTIVE_BANNER',
49
49
 
50
+ /**
51
+ * A (next generation) dynamically sized banner that is full-width and auto-height.
52
+ */
53
+ ANCHORED_ADAPTIVE_BANNER = 'ANCHORED_ADAPTIVE_BANNER',
54
+
55
+ /**
56
+ * Inline adaptive banners are larger, taller banners compared to anchored adaptive banners. They are of variable height, and can be as tall as the device screen.
57
+ * They are intended to be placed in scrolling content.
58
+ */
59
+ INLINE_ADAPTIVE_BANNER = 'INLINE_ADAPTIVE_BANNER',
60
+
50
61
  /**
51
62
  * A dynamically sized banner that matches its parent's width and expands/contracts its height to match the ad's content after loading completes.
52
63
  */
package/src/MobileAds.ts CHANGED
@@ -12,6 +12,7 @@ const nativeModuleName = [
12
12
  'RNGoogleMobileAdsAppOpenModule',
13
13
  'RNGoogleMobileAdsInterstitialModule',
14
14
  'RNGoogleMobileAdsRewardedModule',
15
+ 'RNGoogleMobileAdsRewardedInterstitialModule',
15
16
  ];
16
17
 
17
18
  type Event = {
@@ -43,6 +44,13 @@ class MobileAdsModule extends Module implements MobileAdsModuleInterface {
43
44
  event,
44
45
  );
45
46
  });
47
+
48
+ this.emitter.addListener('google_mobile_ads_rewarded_interstitial_event', (event: Event) => {
49
+ this.emitter.emit(
50
+ `google_mobile_ads_rewarded_interstitial_event:${event.adUnitId}:${event.requestId}`,
51
+ event,
52
+ );
53
+ });
46
54
  }
47
55
 
48
56
  initialize() {
@@ -77,6 +85,7 @@ const MobileAdsInstance = new MobileAdsModule(
77
85
  'google_mobile_ads_app_open_event',
78
86
  'google_mobile_ads_interstitial_event',
79
87
  'google_mobile_ads_rewarded_event',
88
+ 'google_mobile_ads_rewarded_interstitial_event',
80
89
  ],
81
90
  },
82
91
  );
package/src/TestIds.ts CHANGED
@@ -22,10 +22,12 @@ export const TestIds = {
22
22
  BANNER: '',
23
23
  INTERSTITIAL: '',
24
24
  REWARDED: '',
25
+ REWARDED_INTERSTITIAL: '',
25
26
  GAM_APP_OPEN: '/6499/example/app-open',
26
27
  GAM_BANNER: '/6499/example/banner',
27
28
  GAM_INTERSTITIAL: '/6499/example/interstitial',
28
29
  GAM_REWARDED: '/6499/example/rewarded',
30
+ GAM_REWARDED_INTERSTITIAL: '/21775744923/example/rewarded_interstitial',
29
31
  GAM_NATIVE: '/6499/example/native',
30
32
  ...Platform.select({
31
33
  android: {
@@ -33,12 +35,14 @@ export const TestIds = {
33
35
  BANNER: 'ca-app-pub-3940256099942544/6300978111',
34
36
  INTERSTITIAL: 'ca-app-pub-3940256099942544/1033173712',
35
37
  REWARDED: 'ca-app-pub-3940256099942544/5224354917',
38
+ REWARDED_INTERSTITIAL: 'ca-app-pub-3940256099942544/5354046379',
36
39
  },
37
40
  ios: {
38
41
  APP_OPEN: 'ca-app-pub-3940256099942544/5662855259',
39
42
  BANNER: 'ca-app-pub-3940256099942544/2934735716',
40
43
  INTERSTITIAL: 'ca-app-pub-3940256099942544/4411468910',
41
44
  REWARDED: 'ca-app-pub-3940256099942544/1712485313',
45
+ REWARDED_INTERSTITIAL: 'ca-app-pub-3940256099942544/6978759866',
42
46
  },
43
47
  }),
44
48
  };
@@ -34,7 +34,7 @@ import { validateAdShowOptions } from '../validateAdShowOptions';
34
34
  type EventType = AdEventType | RewardedAdEventType | GAMAdEventType;
35
35
 
36
36
  export abstract class MobileAd implements MobileAdInterface {
37
- protected _type: 'app_open' | 'interstitial' | 'rewarded';
37
+ protected _type: 'app_open' | 'interstitial' | 'rewarded' | 'rewarded_interstitial';
38
38
  protected _googleMobileAds: MobileAdsModuleInterface;
39
39
  protected _requestId: number;
40
40
  protected _adUnitId: string;
@@ -48,7 +48,7 @@ export abstract class MobileAd implements MobileAdInterface {
48
48
  protected _nativeListener: EmitterSubscription;
49
49
 
50
50
  protected constructor(
51
- type: 'app_open' | 'interstitial' | 'rewarded',
51
+ type: 'app_open' | 'interstitial' | 'rewarded' | 'rewarded_interstitial',
52
52
  googleMobileAds: MobileAdsModuleInterface,
53
53
  requestId: number,
54
54
  adUnitId: string,
@@ -158,6 +158,18 @@ export abstract class MobileAd implements MobileAdInterface {
158
158
  return this.constructor.name;
159
159
  }
160
160
 
161
+ protected get _camelCaseType() {
162
+ let type: 'appOpen' | 'interstitial' | 'rewarded' | 'rewardedInterstitial';
163
+ if (this._type === 'app_open') {
164
+ type = 'appOpen';
165
+ } else if (this._type === 'rewarded_interstitial') {
166
+ type = 'rewardedInterstitial';
167
+ } else {
168
+ type = this._type;
169
+ }
170
+ return type;
171
+ }
172
+
161
173
  public load() {
162
174
  // Prevent multiple load calls
163
175
  if (this._loaded || this._isLoadCalled) {
@@ -165,8 +177,7 @@ export abstract class MobileAd implements MobileAdInterface {
165
177
  }
166
178
 
167
179
  this._isLoadCalled = true;
168
- const type = this._type === 'app_open' ? 'appOpen' : this._type;
169
- const load = this._googleMobileAds.native[`${type}Load`];
180
+ const load = this._googleMobileAds.native[`${this._camelCaseType}Load`];
170
181
  load(this._requestId, this._adUnitId, this._requestOptions);
171
182
  }
172
183
 
@@ -188,8 +199,7 @@ export abstract class MobileAd implements MobileAdInterface {
188
199
  }
189
200
  }
190
201
 
191
- const type = this._type === 'app_open' ? 'appOpen' : this._type;
192
- const show = this._googleMobileAds.native[`${type}Show`];
202
+ const show = this._googleMobileAds.native[`${this._camelCaseType}Show`];
193
203
  return show(this._requestId, this._adUnitId, options);
194
204
  }
195
205