@capacitor-community/admob 8.0.1 → 8.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 (87) hide show
  1. package/CapacitorCommunityAdmob.podspec +1 -1
  2. package/Package.swift +1 -1
  3. package/README.md +470 -186
  4. package/android/build.gradle +1 -1
  5. package/android/src/main/java/com/getcapacitor/community/admob/appopen/AppOpenAdManager.kt +7 -1
  6. package/android/src/main/java/com/getcapacitor/community/admob/appopen/AppOpenAdPlugin.kt +26 -8
  7. package/android/src/main/java/com/getcapacitor/community/admob/appopen/AppOpenAdPluginEvents.kt +1 -0
  8. package/android/src/main/java/com/getcapacitor/community/admob/banner/BannerAdPluginEvents.kt +2 -1
  9. package/android/src/main/java/com/getcapacitor/community/admob/banner/BannerExecutor.java +79 -29
  10. package/android/src/main/java/com/getcapacitor/community/admob/helpers/FullscreenPluginCallback.kt +7 -2
  11. package/android/src/main/java/com/getcapacitor/community/admob/interstitial/AdInterstitialExecutor.java +21 -3
  12. package/android/src/main/java/com/getcapacitor/community/admob/interstitial/InterstitialAdCallbackAndListeners.kt +12 -2
  13. package/android/src/main/java/com/getcapacitor/community/admob/interstitial/InterstitialAdPluginPluginEvent.kt +1 -0
  14. package/android/src/main/java/com/getcapacitor/community/admob/models/AdMobRevenueData.kt +15 -0
  15. package/android/src/main/java/com/getcapacitor/community/admob/rewarded/AdRewardExecutor.java +20 -3
  16. package/android/src/main/java/com/getcapacitor/community/admob/rewarded/RewardAdPluginEvents.kt +1 -0
  17. package/android/src/main/java/com/getcapacitor/community/admob/rewarded/RewardedAdCallbackAndListeners.kt +14 -4
  18. package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/AdRewardInterstitialExecutor.java +20 -3
  19. package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/RewardInterstitialAdPluginEvents.kt +1 -0
  20. package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/RewardedInterstitialAdCallbackAndListeners.kt +14 -3
  21. package/dist/docs.json +511 -178
  22. package/dist/esm/app-open/app-open-ad-options.interface.d.ts +6 -0
  23. package/dist/esm/app-open/app-open-ad-plugin-events.enum.d.ts +20 -1
  24. package/dist/esm/app-open/app-open-ad-plugin-events.enum.js +19 -0
  25. package/dist/esm/app-open/app-open-ad-plugin-events.enum.js.map +1 -1
  26. package/dist/esm/app-open/app-open-definitions.interface.d.ts +31 -8
  27. package/dist/esm/banner/banner-ad-options.interface.d.ts +5 -6
  28. package/dist/esm/banner/banner-ad-plugin-events.enum.d.ts +17 -4
  29. package/dist/esm/banner/banner-ad-plugin-events.enum.js +16 -3
  30. package/dist/esm/banner/banner-ad-plugin-events.enum.js.map +1 -1
  31. package/dist/esm/banner/banner-ad-position.enum.d.ts +3 -3
  32. package/dist/esm/banner/banner-ad-position.enum.js +3 -3
  33. package/dist/esm/banner/banner-ad-size.enum.d.ts +4 -3
  34. package/dist/esm/banner/banner-ad-size.enum.js +4 -3
  35. package/dist/esm/banner/banner-ad-size.enum.js.map +1 -1
  36. package/dist/esm/banner/banner-definitions.interface.d.ts +17 -10
  37. package/dist/esm/banner/banner-size.interface.d.ts +8 -1
  38. package/dist/esm/definitions.d.ts +17 -16
  39. package/dist/esm/definitions.js.map +1 -1
  40. package/dist/esm/interstitial/interstitial-ad-plugin-events.enum.d.ts +10 -6
  41. package/dist/esm/interstitial/interstitial-ad-plugin-events.enum.js +9 -5
  42. package/dist/esm/interstitial/interstitial-ad-plugin-events.enum.js.map +1 -1
  43. package/dist/esm/interstitial/interstitial-definitions.interface.d.ts +24 -4
  44. package/dist/esm/reward/reward-ad-options.interface.d.ts +7 -6
  45. package/dist/esm/reward/reward-ad-plugin-events.enum.d.ts +13 -12
  46. package/dist/esm/reward/reward-ad-plugin-events.enum.js +12 -11
  47. package/dist/esm/reward/reward-ad-plugin-events.enum.js.map +1 -1
  48. package/dist/esm/reward/reward-definitions.interface.d.ts +27 -4
  49. package/dist/esm/reward/reward-item.interface.d.ts +3 -4
  50. package/dist/esm/reward-interstitial/reward-interstitial-ad-options.interface.d.ts +7 -6
  51. package/dist/esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.d.ts +13 -12
  52. package/dist/esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.js +12 -11
  53. package/dist/esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.js.map +1 -1
  54. package/dist/esm/reward-interstitial/reward-interstitial-definitions.interface.d.ts +30 -7
  55. package/dist/esm/reward-interstitial/reward-interstitial-item.interface.d.ts +3 -4
  56. package/dist/esm/shared/ad-load-info.interface.d.ts +6 -0
  57. package/dist/esm/shared/ad-mob-revenue-data.interface.d.ts +50 -0
  58. package/dist/esm/shared/ad-mob-revenue-data.interface.js +23 -0
  59. package/dist/esm/shared/ad-mob-revenue-data.interface.js.map +1 -0
  60. package/dist/esm/shared/ad-options.interface.d.ts +9 -11
  61. package/dist/esm/shared/ad-show-options.interface.d.ts +12 -0
  62. package/dist/esm/shared/ad-show-options.interface.js +2 -0
  63. package/dist/esm/shared/ad-show-options.interface.js.map +1 -0
  64. package/dist/esm/shared/admob-error.interface.d.ts +3 -2
  65. package/dist/esm/shared/index.d.ts +2 -0
  66. package/dist/esm/shared/index.js +2 -0
  67. package/dist/esm/shared/index.js.map +1 -1
  68. package/dist/esm/shared/tracking-authorization-status.interface.d.ts +6 -1
  69. package/dist/esm/web.d.ts +6 -6
  70. package/dist/esm/web.js +11 -6
  71. package/dist/esm/web.js.map +1 -1
  72. package/dist/plugin.cjs.js +109 -42
  73. package/dist/plugin.cjs.js.map +1 -1
  74. package/dist/plugin.js +109 -42
  75. package/dist/plugin.js.map +1 -1
  76. package/ios/Sources/AdMobPlugin/AppOpen/AppOpenAdManager.swift +12 -1
  77. package/ios/Sources/AdMobPlugin/AppOpen/AppOpenAdPlugin.swift +40 -10
  78. package/ios/Sources/AdMobPlugin/AppOpen/AppOpenAdPluginEvents.swift +1 -0
  79. package/ios/Sources/AdMobPlugin/Banner/BannerAdPluginEvents.swift +1 -0
  80. package/ios/Sources/AdMobPlugin/Banner/BannerExecutor.swift +14 -0
  81. package/ios/Sources/AdMobPlugin/Interstitial/AdInterstitialExecutor.swift +41 -5
  82. package/ios/Sources/AdMobPlugin/Interstitial/InterstitialAdPluginEvents.swift +1 -0
  83. package/ios/Sources/AdMobPlugin/Rewarded/AdRewardExecutor.swift +44 -5
  84. package/ios/Sources/AdMobPlugin/Rewarded/RewardAdPluginEvents.swift +1 -0
  85. package/ios/Sources/AdMobPlugin/RewardedInterstitial/AdRewardInterstitialExecutor.swift +45 -6
  86. package/ios/Sources/AdMobPlugin/RewardedInterstitial/RewardInterstitialAdPluginEvents.swift +1 -0
  87. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  import type { PluginListenerHandle } from '@capacitor/core';
2
2
  import type { ValidateAllEventsEnumAreImplemented } from '../private/validate-all-events-implemented.type';
3
- import type { AdLoadInfo, AdMobError, AdOptions } from '../shared';
3
+ import type { AdLoadInfo, AdMobError, AdMobRevenueData, AdOptions, AdShowOptions } from '../shared';
4
4
  import type { InterstitialAdPluginEvents } from './interstitial-ad-plugin-events.enum';
5
5
  export type InterstitialDefinitionsHasAllEvents = ValidateAllEventsEnumAreImplemented<InterstitialAdPluginEvents, InterstitialDefinitions>;
6
6
  export interface InterstitialDefinitions {
7
7
  /**
8
- * Prepare interstitial banner
8
+ * Loads an interstitial ad and returns the loaded ad unit ID.
9
9
  *
10
10
  * @group Interstitial
11
11
  * @param options AdOptions
@@ -13,15 +13,35 @@ export interface InterstitialDefinitions {
13
13
  */
14
14
  prepareInterstitial(options: AdOptions): Promise<AdLoadInfo>;
15
15
  /**
16
- * Show interstitial ad when it’s ready
16
+ * Shows a loaded interstitial ad.
17
17
  *
18
18
  * @group Interstitial
19
+ * @param options Optional. Pass { adId } to show a specific prepared ad instead of the most recent one.
19
20
  * @since 1.1.2
20
21
  */
21
- showInterstitial(): Promise<void>;
22
+ showInterstitial(options?: AdShowOptions): Promise<void>;
23
+ /**
24
+ * Listens for interstitial ad load failures.
25
+ */
22
26
  addListener(eventName: InterstitialAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void): Promise<PluginListenerHandle>;
27
+ /**
28
+ * Listens for interstitial ad load events.
29
+ */
23
30
  addListener(eventName: InterstitialAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void): Promise<PluginListenerHandle>;
31
+ /**
32
+ * Listens for interstitial ad dismissed events.
33
+ */
24
34
  addListener(eventName: InterstitialAdPluginEvents.Dismissed, listenerFunc: () => void): Promise<PluginListenerHandle>;
35
+ /**
36
+ * Listens for interstitial ad show failures.
37
+ */
25
38
  addListener(eventName: InterstitialAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void): Promise<PluginListenerHandle>;
39
+ /**
40
+ * Listens for interstitial ad shown events.
41
+ */
26
42
  addListener(eventName: InterstitialAdPluginEvents.Showed, listenerFunc: () => void): Promise<PluginListenerHandle>;
43
+ /**
44
+ * Listens for interstitial impression-level ad revenue events.
45
+ */
46
+ addListener(eventName: InterstitialAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void): Promise<PluginListenerHandle>;
27
47
  }
@@ -2,22 +2,23 @@ import type { AdOptions } from '../shared/ad-options.interface';
2
2
  type AtLeastOne<T> = {
3
3
  [K in keyof T]: Pick<T, K>;
4
4
  }[keyof T];
5
+ /**
6
+ * Options for loading a rewarded ad.
7
+ */
5
8
  export interface RewardAdOptions extends AdOptions {
6
9
  /**
7
- * If you have enabled SSV in your AdMob Application. You can provide customData or
8
- * a userId be passed to your callback to do further processing on.
9
- *
10
- * *Important* You *HAVE* to define one of them.
10
+ * Server-side verification options for the rewarded ad.
11
+ * Provide at least one of `userId` or `customData`.
11
12
  *
12
13
  * @see https://support.google.com/admob/answer/9603226?hl=en-GB
13
14
  */
14
15
  ssv?: AtLeastOne<{
15
16
  /**
16
- * An optional UserId to pass to your SSV callback function.
17
+ * A user identifier passed to the SSV callback.
17
18
  */
18
19
  userId: string;
19
20
  /**
20
- * An optional custom set of data to pass to your SSV callback function.
21
+ * Custom data passed to the SSV callback.
21
22
  */
22
23
  customData: string;
23
24
  }>;
@@ -1,32 +1,33 @@
1
1
  export declare enum RewardAdPluginEvents {
2
2
  /**
3
- * Emits after trying to prepare a RewardAd and the Video is loaded and ready to be show
3
+ * Emits when a rewarded ad has loaded and is ready to show.
4
4
  */
5
5
  Loaded = "onRewardedVideoAdLoaded",
6
6
  /**
7
- * Emits after trying to prepare a RewardAd when it could not be loaded
7
+ * Emits when a rewarded ad fails to load.
8
8
  */
9
9
  FailedToLoad = "onRewardedVideoAdFailedToLoad",
10
10
  /**
11
- * Emits when the AdReward video is visible to the user
11
+ * Emits when a rewarded ad is shown.
12
12
  */
13
13
  Showed = "onRewardedVideoAdShowed",
14
14
  /**
15
- * Emits when the AdReward video is failed to show
15
+ * Emits when a loaded rewarded ad fails to show.
16
16
  */
17
17
  FailedToShow = "onRewardedVideoAdFailedToShow",
18
18
  /**
19
- * Emits when the AdReward video is not visible to the user anymore.
19
+ * Emits when a rewarded ad is dismissed.
20
20
  *
21
- * **Important**: This has nothing to do with the reward it self. This event
22
- * will emits in this two cases:
23
- * 1. The user starts the video ad but close it before the reward emit.
24
- * 2. The user start the video and see it until end, then gets the reward
25
- * and after that the ad is closed.
21
+ * This event does not indicate whether the user earned a reward. Listen for
22
+ * `Rewarded` separately before granting the reward.
26
23
  */
27
24
  Dismissed = "onRewardedVideoAdDismissed",
28
25
  /**
29
- * Emits when user get rewarded from AdReward
26
+ * Emits when the user earns the advertised reward.
30
27
  */
31
- Rewarded = "onRewardedVideoAdReward"
28
+ Rewarded = "onRewardedVideoAdReward",
29
+ /**
30
+ * Emits impression-level ad revenue data when a paid event is recorded.
31
+ */
32
+ AdImpression = "onRewardedVideoAdImpression"
32
33
  }
@@ -2,34 +2,35 @@
2
2
  export var RewardAdPluginEvents;
3
3
  (function (RewardAdPluginEvents) {
4
4
  /**
5
- * Emits after trying to prepare a RewardAd and the Video is loaded and ready to be show
5
+ * Emits when a rewarded ad has loaded and is ready to show.
6
6
  */
7
7
  RewardAdPluginEvents["Loaded"] = "onRewardedVideoAdLoaded";
8
8
  /**
9
- * Emits after trying to prepare a RewardAd when it could not be loaded
9
+ * Emits when a rewarded ad fails to load.
10
10
  */
11
11
  RewardAdPluginEvents["FailedToLoad"] = "onRewardedVideoAdFailedToLoad";
12
12
  /**
13
- * Emits when the AdReward video is visible to the user
13
+ * Emits when a rewarded ad is shown.
14
14
  */
15
15
  RewardAdPluginEvents["Showed"] = "onRewardedVideoAdShowed";
16
16
  /**
17
- * Emits when the AdReward video is failed to show
17
+ * Emits when a loaded rewarded ad fails to show.
18
18
  */
19
19
  RewardAdPluginEvents["FailedToShow"] = "onRewardedVideoAdFailedToShow";
20
20
  /**
21
- * Emits when the AdReward video is not visible to the user anymore.
21
+ * Emits when a rewarded ad is dismissed.
22
22
  *
23
- * **Important**: This has nothing to do with the reward it self. This event
24
- * will emits in this two cases:
25
- * 1. The user starts the video ad but close it before the reward emit.
26
- * 2. The user start the video and see it until end, then gets the reward
27
- * and after that the ad is closed.
23
+ * This event does not indicate whether the user earned a reward. Listen for
24
+ * `Rewarded` separately before granting the reward.
28
25
  */
29
26
  RewardAdPluginEvents["Dismissed"] = "onRewardedVideoAdDismissed";
30
27
  /**
31
- * Emits when user get rewarded from AdReward
28
+ * Emits when the user earns the advertised reward.
32
29
  */
33
30
  RewardAdPluginEvents["Rewarded"] = "onRewardedVideoAdReward";
31
+ /**
32
+ * Emits impression-level ad revenue data when a paid event is recorded.
33
+ */
34
+ RewardAdPluginEvents["AdImpression"] = "onRewardedVideoAdImpression";
34
35
  })(RewardAdPluginEvents || (RewardAdPluginEvents = {}));
35
36
  //# sourceMappingURL=reward-ad-plugin-events.enum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reward-ad-plugin-events.enum.js","sourceRoot":"","sources":["../../../src/reward/reward-ad-plugin-events.enum.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,MAAM,CAAN,IAAY,oBA+BX;AA/BD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,0DAAkC,CAAA;IAClC;;OAEG;IACH,sEAA8C,CAAA;IAC9C;;OAEG;IACH,0DAAkC,CAAA;IAClC;;OAEG;IACH,sEAA8C,CAAA;IAC9C;;;;;;;;OAQG;IACH,gEAAuC,CAAA;IACvC;;OAEG;IACH,4DAAmC,CAAA;AACrC,CAAC,EA/BW,oBAAoB,KAApB,oBAAoB,QA+B/B"}
1
+ {"version":3,"file":"reward-ad-plugin-events.enum.js","sourceRoot":"","sources":["../../../src/reward/reward-ad-plugin-events.enum.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,MAAM,CAAN,IAAY,oBAgCX;AAhCD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,0DAAkC,CAAA;IAClC;;OAEG;IACH,sEAA8C,CAAA;IAC9C;;OAEG;IACH,0DAAkC,CAAA;IAClC;;OAEG;IACH,sEAA8C,CAAA;IAC9C;;;;;OAKG;IACH,gEAAuC,CAAA;IACvC;;OAEG;IACH,4DAAmC,CAAA;IACnC;;OAEG;IACH,oEAA4C,CAAA;AAC9C,CAAC,EAhCW,oBAAoB,KAApB,oBAAoB,QAgC/B"}
@@ -1,13 +1,13 @@
1
1
  import type { PluginListenerHandle } from '@capacitor/core';
2
2
  import type { ValidateAllEventsEnumAreImplemented } from '../private/validate-all-events-implemented.type';
3
- import type { AdLoadInfo, AdMobError } from '../shared';
3
+ import type { AdLoadInfo, AdMobError, AdMobRevenueData, AdShowOptions } from '../shared';
4
4
  import type { RewardAdOptions } from './reward-ad-options.interface';
5
5
  import type { RewardAdPluginEvents } from './reward-ad-plugin-events.enum';
6
6
  import type { AdMobRewardItem } from './reward-item.interface';
7
7
  export type RewardDefinitionsHasAllEvents = ValidateAllEventsEnumAreImplemented<RewardAdPluginEvents, RewardDefinitions>;
8
8
  export interface RewardDefinitions {
9
9
  /**
10
- * Prepare a reward video ad
10
+ * Loads a rewarded ad and returns the loaded ad unit ID.
11
11
  *
12
12
  * @group RewardVideo
13
13
  * @param options RewardAdOptions
@@ -15,16 +15,39 @@ export interface RewardDefinitions {
15
15
  */
16
16
  prepareRewardVideoAd(options: RewardAdOptions): Promise<AdLoadInfo>;
17
17
  /**
18
- * Show a reward video ad
18
+ * Shows a loaded rewarded ad and resolves when the user earns the reward.
19
19
  *
20
20
  * @group RewardVideo
21
+ * @param options Optional. Pass { adId } to show a specific prepared ad instead of the most recent one.
21
22
  * @since 1.1.2
22
23
  */
23
- showRewardVideoAd(): Promise<AdMobRewardItem>;
24
+ showRewardVideoAd(options?: AdShowOptions): Promise<AdMobRewardItem>;
25
+ /**
26
+ * Listens for rewarded ad load failures.
27
+ */
24
28
  addListener(eventName: RewardAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void): Promise<PluginListenerHandle>;
29
+ /**
30
+ * Listens for rewarded ad load events.
31
+ */
25
32
  addListener(eventName: RewardAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void): Promise<PluginListenerHandle>;
33
+ /**
34
+ * Listens for earned reward events.
35
+ */
26
36
  addListener(eventName: RewardAdPluginEvents.Rewarded, listenerFunc: (reward: AdMobRewardItem) => void): Promise<PluginListenerHandle>;
37
+ /**
38
+ * Listens for rewarded ad dismissed events.
39
+ */
27
40
  addListener(eventName: RewardAdPluginEvents.Dismissed, listenerFunc: () => void): Promise<PluginListenerHandle>;
41
+ /**
42
+ * Listens for rewarded ad show failures.
43
+ */
28
44
  addListener(eventName: RewardAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void): Promise<PluginListenerHandle>;
45
+ /**
46
+ * Listens for rewarded ad shown events.
47
+ */
29
48
  addListener(eventName: RewardAdPluginEvents.Showed, listenerFunc: () => void): Promise<PluginListenerHandle>;
49
+ /**
50
+ * Listens for rewarded impression-level ad revenue events.
51
+ */
52
+ addListener(eventName: RewardAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void): Promise<PluginListenerHandle>;
30
53
  }
@@ -1,14 +1,13 @@
1
1
  /**
2
- * For more information
3
- * https://developers.google.com/admob/android/rewarded-video-adapters?hl=en
2
+ * The reward earned by the user after viewing a rewarded ad.
4
3
  */
5
4
  export interface AdMobRewardItem {
6
5
  /**
7
- * Rewarded type user got
6
+ * The reward item type configured for the ad unit.
8
7
  */
9
8
  type: string;
10
9
  /**
11
- * Rewarded amount user got
10
+ * The reward amount earned by the user.
12
11
  */
13
12
  amount: number;
14
13
  }
@@ -2,22 +2,23 @@ import type { AdOptions } from '../shared/ad-options.interface';
2
2
  type AtLeastOne<T> = {
3
3
  [K in keyof T]: Pick<T, K>;
4
4
  }[keyof T];
5
+ /**
6
+ * Options for loading a rewarded interstitial ad.
7
+ */
5
8
  export interface RewardInterstitialAdOptions extends AdOptions {
6
9
  /**
7
- * If you have enabled SSV in your AdMob Application. You can provide customData or
8
- * a userId be passed to your callback to do further processing on.
9
- *
10
- * *Important* You *HAVE* to define one of them.
10
+ * Server-side verification options for the rewarded interstitial ad.
11
+ * Provide at least one of `userId` or `customData`.
11
12
  *
12
13
  * @see https://support.google.com/admob/answer/9603226?hl=en-GB
13
14
  */
14
15
  ssv?: AtLeastOne<{
15
16
  /**
16
- * An optional UserId to pass to your SSV callback function.
17
+ * A user identifier passed to the SSV callback.
17
18
  */
18
19
  userId: string;
19
20
  /**
20
- * An optional custom set of data to pass to your SSV callback function.
21
+ * Custom data passed to the SSV callback.
21
22
  */
22
23
  customData: string;
23
24
  }>;
@@ -1,32 +1,33 @@
1
1
  export declare enum RewardInterstitialAdPluginEvents {
2
2
  /**
3
- * Emits after trying to prepare a RewardAd and the Video is loaded and ready to be show
3
+ * Emits when a rewarded interstitial ad has loaded and is ready to show.
4
4
  */
5
5
  Loaded = "onRewardedInterstitialAdLoaded",
6
6
  /**
7
- * Emits after trying to prepare a RewardAd when it could not be loaded
7
+ * Emits when a rewarded interstitial ad fails to load.
8
8
  */
9
9
  FailedToLoad = "onRewardedInterstitialAdFailedToLoad",
10
10
  /**
11
- * Emits when the AdReward video is visible to the user
11
+ * Emits when a rewarded interstitial ad is shown.
12
12
  */
13
13
  Showed = "onRewardedInterstitialAdShowed",
14
14
  /**
15
- * Emits when the AdReward video is failed to show
15
+ * Emits when a loaded rewarded interstitial ad fails to show.
16
16
  */
17
17
  FailedToShow = "onRewardedInterstitialAdFailedToShow",
18
18
  /**
19
- * Emits when the AdReward video is not visible to the user anymore.
19
+ * Emits when a rewarded interstitial ad is dismissed.
20
20
  *
21
- * **Important**: This has nothing to do with the reward it self. This event
22
- * will emits in this two cases:
23
- * 1. The user starts the video ad but close it before the reward emit.
24
- * 2. The user start the video and see it until end, then gets the reward
25
- * and after that the ad is closed.
21
+ * This event does not indicate whether the user earned a reward. Listen for
22
+ * `Rewarded` separately before granting the reward.
26
23
  */
27
24
  Dismissed = "onRewardedInterstitialAdDismissed",
28
25
  /**
29
- * Emits when user get rewarded from AdReward
26
+ * Emits when the user earns the advertised reward.
30
27
  */
31
- Rewarded = "onRewardedInterstitialAdReward"
28
+ Rewarded = "onRewardedInterstitialAdReward",
29
+ /**
30
+ * Emits impression-level ad revenue data when a paid event is recorded.
31
+ */
32
+ AdImpression = "onRewardedInterstitialAdImpression"
32
33
  }
@@ -2,34 +2,35 @@
2
2
  export var RewardInterstitialAdPluginEvents;
3
3
  (function (RewardInterstitialAdPluginEvents) {
4
4
  /**
5
- * Emits after trying to prepare a RewardAd and the Video is loaded and ready to be show
5
+ * Emits when a rewarded interstitial ad has loaded and is ready to show.
6
6
  */
7
7
  RewardInterstitialAdPluginEvents["Loaded"] = "onRewardedInterstitialAdLoaded";
8
8
  /**
9
- * Emits after trying to prepare a RewardAd when it could not be loaded
9
+ * Emits when a rewarded interstitial ad fails to load.
10
10
  */
11
11
  RewardInterstitialAdPluginEvents["FailedToLoad"] = "onRewardedInterstitialAdFailedToLoad";
12
12
  /**
13
- * Emits when the AdReward video is visible to the user
13
+ * Emits when a rewarded interstitial ad is shown.
14
14
  */
15
15
  RewardInterstitialAdPluginEvents["Showed"] = "onRewardedInterstitialAdShowed";
16
16
  /**
17
- * Emits when the AdReward video is failed to show
17
+ * Emits when a loaded rewarded interstitial ad fails to show.
18
18
  */
19
19
  RewardInterstitialAdPluginEvents["FailedToShow"] = "onRewardedInterstitialAdFailedToShow";
20
20
  /**
21
- * Emits when the AdReward video is not visible to the user anymore.
21
+ * Emits when a rewarded interstitial ad is dismissed.
22
22
  *
23
- * **Important**: This has nothing to do with the reward it self. This event
24
- * will emits in this two cases:
25
- * 1. The user starts the video ad but close it before the reward emit.
26
- * 2. The user start the video and see it until end, then gets the reward
27
- * and after that the ad is closed.
23
+ * This event does not indicate whether the user earned a reward. Listen for
24
+ * `Rewarded` separately before granting the reward.
28
25
  */
29
26
  RewardInterstitialAdPluginEvents["Dismissed"] = "onRewardedInterstitialAdDismissed";
30
27
  /**
31
- * Emits when user get rewarded from AdReward
28
+ * Emits when the user earns the advertised reward.
32
29
  */
33
30
  RewardInterstitialAdPluginEvents["Rewarded"] = "onRewardedInterstitialAdReward";
31
+ /**
32
+ * Emits impression-level ad revenue data when a paid event is recorded.
33
+ */
34
+ RewardInterstitialAdPluginEvents["AdImpression"] = "onRewardedInterstitialAdImpression";
34
35
  })(RewardInterstitialAdPluginEvents || (RewardInterstitialAdPluginEvents = {}));
35
36
  //# sourceMappingURL=reward-interstitial-ad-plugin-events.enum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reward-interstitial-ad-plugin-events.enum.js","sourceRoot":"","sources":["../../../src/reward-interstitial/reward-interstitial-ad-plugin-events.enum.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,MAAM,CAAN,IAAY,gCA+BX;AA/BD,WAAY,gCAAgC;IAC1C;;OAEG;IACH,6EAAyC,CAAA;IACzC;;OAEG;IACH,yFAAqD,CAAA;IACrD;;OAEG;IACH,6EAAyC,CAAA;IACzC;;OAEG;IACH,yFAAqD,CAAA;IACrD;;;;;;;;OAQG;IACH,mFAA+C,CAAA;IAC/C;;OAEG;IACH,+EAA2C,CAAA;AAC7C,CAAC,EA/BW,gCAAgC,KAAhC,gCAAgC,QA+B3C"}
1
+ {"version":3,"file":"reward-interstitial-ad-plugin-events.enum.js","sourceRoot":"","sources":["../../../src/reward-interstitial/reward-interstitial-ad-plugin-events.enum.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,MAAM,CAAN,IAAY,gCAgCX;AAhCD,WAAY,gCAAgC;IAC1C;;OAEG;IACH,6EAAyC,CAAA;IACzC;;OAEG;IACH,yFAAqD,CAAA;IACrD;;OAEG;IACH,6EAAyC,CAAA;IACzC;;OAEG;IACH,yFAAqD,CAAA;IACrD;;;;;OAKG;IACH,mFAA+C,CAAA;IAC/C;;OAEG;IACH,+EAA2C,CAAA;IAC3C;;OAEG;IACH,uFAAmD,CAAA;AACrD,CAAC,EAhCW,gCAAgC,KAAhC,gCAAgC,QAgC3C"}
@@ -1,30 +1,53 @@
1
1
  import type { PluginListenerHandle } from '@capacitor/core';
2
2
  import type { ValidateAllEventsEnumAreImplemented } from '../private/validate-all-events-implemented.type';
3
- import type { AdLoadInfo, AdMobError } from '../shared';
3
+ import type { AdLoadInfo, AdMobError, AdMobRevenueData, AdShowOptions } from '../shared';
4
4
  import type { RewardInterstitialAdOptions } from './reward-interstitial-ad-options.interface';
5
5
  import type { RewardInterstitialAdPluginEvents } from './reward-interstitial-ad-plugin-events.enum';
6
6
  import type { AdMobRewardInterstitialItem } from './reward-interstitial-item.interface';
7
7
  export type RewardInterstitialDefinitionsHasAllEvents = ValidateAllEventsEnumAreImplemented<RewardInterstitialAdPluginEvents, RewardInterstitialDefinitions>;
8
8
  export interface RewardInterstitialDefinitions {
9
9
  /**
10
- * Prepare a reward video ad
10
+ * Loads a rewarded interstitial ad and returns the loaded ad unit ID.
11
11
  *
12
- * @group RewardVideo
13
- * @param options RewardAdOptions
12
+ * @group RewardInterstitial
13
+ * @param options RewardInterstitialAdOptions
14
14
  * @since 1.1.2
15
15
  */
16
16
  prepareRewardInterstitialAd(options: RewardInterstitialAdOptions): Promise<AdLoadInfo>;
17
17
  /**
18
- * Show a reward video ad
18
+ * Shows a loaded rewarded interstitial ad and resolves when the user earns the reward.
19
19
  *
20
- * @group RewardVideo
20
+ * @group RewardInterstitial
21
+ * @param options Optional. Pass { adId } to show a specific prepared ad instead of the most recent one.
21
22
  * @since 1.1.2
22
23
  */
23
- showRewardInterstitialAd(): Promise<AdMobRewardInterstitialItem>;
24
+ showRewardInterstitialAd(options?: AdShowOptions): Promise<AdMobRewardInterstitialItem>;
25
+ /**
26
+ * Listens for rewarded interstitial ad load failures.
27
+ */
24
28
  addListener(eventName: RewardInterstitialAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void): Promise<PluginListenerHandle>;
29
+ /**
30
+ * Listens for rewarded interstitial ad load events.
31
+ */
25
32
  addListener(eventName: RewardInterstitialAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void): Promise<PluginListenerHandle>;
33
+ /**
34
+ * Listens for earned reward events.
35
+ */
26
36
  addListener(eventName: RewardInterstitialAdPluginEvents.Rewarded, listenerFunc: (reward: AdMobRewardInterstitialItem) => void): Promise<PluginListenerHandle>;
37
+ /**
38
+ * Listens for rewarded interstitial ad dismissed events.
39
+ */
27
40
  addListener(eventName: RewardInterstitialAdPluginEvents.Dismissed, listenerFunc: () => void): Promise<PluginListenerHandle>;
41
+ /**
42
+ * Listens for rewarded interstitial ad show failures.
43
+ */
28
44
  addListener(eventName: RewardInterstitialAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void): Promise<PluginListenerHandle>;
45
+ /**
46
+ * Listens for rewarded interstitial ad shown events.
47
+ */
29
48
  addListener(eventName: RewardInterstitialAdPluginEvents.Showed, listenerFunc: () => void): Promise<PluginListenerHandle>;
49
+ /**
50
+ * Listens for rewarded interstitial impression-level ad revenue events.
51
+ */
52
+ addListener(eventName: RewardInterstitialAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void): Promise<PluginListenerHandle>;
30
53
  }
@@ -1,14 +1,13 @@
1
1
  /**
2
- * For more information
3
- * https://developers.google.com/admob/android/rewarded-video-adapters?hl=en
2
+ * The reward earned by the user after viewing a rewarded interstitial ad.
4
3
  */
5
4
  export interface AdMobRewardInterstitialItem {
6
5
  /**
7
- * Rewarded type user got
6
+ * The reward item type configured for the ad unit.
8
7
  */
9
8
  type: string;
10
9
  /**
11
- * Rewarded amount user got
10
+ * The reward amount earned by the user.
12
11
  */
13
12
  amount: number;
14
13
  }
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Information returned after an ad loads successfully.
3
+ */
1
4
  export interface AdLoadInfo {
5
+ /**
6
+ * The ad unit ID of the loaded ad.
7
+ */
2
8
  adUnitId: string;
3
9
  }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The precision of an impression-level ad value.
3
+ */
4
+ export declare enum AdValuePrecision {
5
+ /**
6
+ * The ad value precision is unknown.
7
+ */
8
+ Unknown = 0,
9
+ /**
10
+ * The ad value is estimated from aggregated data.
11
+ */
12
+ Estimated = 1,
13
+ /**
14
+ * The ad value was provided by the publisher.
15
+ */
16
+ PublisherProvided = 2,
17
+ /**
18
+ * The ad value is the precise value paid for this ad.
19
+ */
20
+ Precise = 3
21
+ }
22
+ /**
23
+ * Impression-level ad revenue data emitted by a paid event.
24
+ */
25
+ export interface AdMobRevenueData {
26
+ /**
27
+ * The ad unit ID associated with the paid event.
28
+ */
29
+ adUnitId: string;
30
+ /**
31
+ * The ad value in micros, where 1,000,000 micros equals one currency unit.
32
+ */
33
+ valueMicros: number;
34
+ /**
35
+ * The ISO 4217 currency code for `valueMicros`.
36
+ */
37
+ currencyCode: string;
38
+ /**
39
+ * The precision of the reported ad value.
40
+ */
41
+ precision: AdValuePrecision;
42
+ /**
43
+ * The mediation adapter class name that served the impression, or an empty string when unavailable.
44
+ */
45
+ networkName: string;
46
+ /**
47
+ * The response identifier associated with the impression, or an empty string when unavailable.
48
+ */
49
+ impressionId: string;
50
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The precision of an impression-level ad value.
3
+ */
4
+ export var AdValuePrecision;
5
+ (function (AdValuePrecision) {
6
+ /**
7
+ * The ad value precision is unknown.
8
+ */
9
+ AdValuePrecision[AdValuePrecision["Unknown"] = 0] = "Unknown";
10
+ /**
11
+ * The ad value is estimated from aggregated data.
12
+ */
13
+ AdValuePrecision[AdValuePrecision["Estimated"] = 1] = "Estimated";
14
+ /**
15
+ * The ad value was provided by the publisher.
16
+ */
17
+ AdValuePrecision[AdValuePrecision["PublisherProvided"] = 2] = "PublisherProvided";
18
+ /**
19
+ * The ad value is the precise value paid for this ad.
20
+ */
21
+ AdValuePrecision[AdValuePrecision["Precise"] = 3] = "Precise";
22
+ })(AdValuePrecision || (AdValuePrecision = {}));
23
+ //# sourceMappingURL=ad-mob-revenue-data.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ad-mob-revenue-data.interface.js","sourceRoot":"","sources":["../../../src/shared/ad-mob-revenue-data.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,gBAoBX;AApBD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,6DAAW,CAAA;IAEX;;OAEG;IACH,iEAAa,CAAA;IAEb;;OAEG;IACH,iFAAqB,CAAA;IAErB;;OAEG;IACH,6DAAW,CAAA;AACb,CAAC,EApBW,gBAAgB,KAAhB,gBAAgB,QAoB3B"}
@@ -1,30 +1,31 @@
1
+ /**
2
+ * Common options for requesting an ad.
3
+ */
1
4
  export interface AdOptions {
2
5
  /**
3
- * The ad unit ID that you want to request
6
+ * The ad unit ID to load.
4
7
  *
5
8
  * @see https://support.google.com/admob/answer/7356431?hl=en
6
9
  * @since 1.1.2
7
10
  */
8
11
  adId: string;
9
12
  /**
10
- * You can use test mode of ad.
13
+ * Whether to request a test ad.
11
14
  *
12
15
  * @default false
13
16
  * @since 1.1.2
14
17
  */
15
18
  isTesting?: boolean;
16
19
  /**
17
- * Margin Banner. Default is 0px;
18
- * If position is BOTTOM_CENTER, margin is be margin-bottom.
19
- * If position is TOP_CENTER, margin is be margin-top.
20
+ * The banner margin in logical display units (dp on Android and points on iOS).
21
+ * For `BOTTOM_CENTER`, this is the bottom margin. For `TOP_CENTER`, this is the top margin.
20
22
  *
21
23
  * @default 0
22
24
  * @since 1.1.2
23
25
  */
24
26
  margin?: number;
25
27
  /**
26
- * The default behavior of the Google Mobile Ads SDK is to serve personalized ads.
27
- * Set this to true to request Non-Personalized Ads
28
+ * Whether to request non-personalized ads.
28
29
  *
29
30
  * @see https://developers.google.com/admob/ios/eu-consent
30
31
  * @see https://developers.google.com/admob/android/eu-consent
@@ -33,10 +34,7 @@ export interface AdOptions {
33
34
  */
34
35
  npa?: boolean;
35
36
  /**
36
- * Sets a flag that controls if this interstitial or reward object will be displayed in immersive mode.
37
- * Call this method before show.
38
- * During show, if this flag is on and immersive mode is supported,
39
- * SYSTEM_UI_FLAG_IMMERSIVE_STICKY &SYSTEM_UI_FLAG_HIDE_NAVIGATION will be turned on for interstitial or reward ad.
37
+ * Whether to display a full-screen ad in immersive mode on Android.
40
38
  *
41
39
  * @see https://developers.google.com/admob/android/reference/com/google/android/gms/ads/interstitial/InterstitialAd#setImmersiveMode(boolean)
42
40
  * @see https://developers.google.com/admob/android/reference/com/google/android/gms/ads/rewarded/RewardedAd#setImmersiveMode(boolean)
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Options for selecting a previously loaded ad to show or inspect.
3
+ */
4
+ export interface AdShowOptions {
5
+ /**
6
+ * The ad unit ID of a previously prepared ad to target.
7
+ * If omitted, the operation targets the most recently prepared ad.
8
+ *
9
+ * @since 8.0.1
10
+ */
11
+ adId?: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ad-show-options.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ad-show-options.interface.js","sourceRoot":"","sources":["../../../src/shared/ad-show-options.interface.ts"],"names":[],"mappings":""}