Skip to content

Commit 3081e14

Browse files
author
Matt
committed
Adds TS Interface Changes for Javascript
1 parent 6a3512f commit 3081e14

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

src/reward/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from './reward-ad-plugin-events.enum';
22
export * from './reward-definitions.interface';
33
export * from './reward-item.interface';
4+
export * from './reward-ad-options.interface';
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { AdOptions } from '../shared/ad-options.interface';
2+
3+
// This is a type to ensure that IF ssv is provided, at least one of userId or customData is required.
4+
type AtLeastOne<T> = {[K in keyof T]: Pick<T, K>}[keyof T];
5+
6+
// Because only RewardedAds use SSV. This interface is only available for RewardedAds
7+
export interface RewardAdOptions extends AdOptions {
8+
/**
9+
* If you have enabled SSV in your AdMob Application. You can provide customData or
10+
* a userId be passed to your callback to do further processing on.
11+
*
12+
* @see https://support.google.com/admob/answer/9603226?hl=en-GB
13+
*/
14+
ssv?: AtLeastOne<{
15+
/**
16+
* An optional UserId to pass to your SSV callback function.
17+
*/
18+
userId: string;
19+
/**
20+
* An optional custom set of data to pass to your SSV callback function.
21+
*/
22+
customData: string;
23+
}>;
24+
}

src/reward/reward-definitions.interface.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import type { PluginListenerHandle } from '@capacitor/core';
22

33
import type { ValidateAllEventsEnumAreImplemented} from '../private/validate-all-events-implemented.type'
4-
import type { AdLoadInfo, AdMobError, AdOptions } from '../shared';
4+
import type { AdLoadInfo, AdMobError } from '../shared';
55

6+
import type { RewardAdOptions } from './reward-ad-options.interface';
67
import type { RewardAdPluginEvents } from './reward-ad-plugin-events.enum';
78
import type { AdMobRewardItem } from './reward-item.interface';
89

@@ -14,10 +15,10 @@ export interface RewardDefinitions {
1415
* Prepare a reward video ad
1516
*
1617
* @group RewardVideo
17-
* @param options AdOptions
18+
* @param options RewardAdOptions
1819
* @since 1.1.2
1920
*/
20-
prepareRewardVideoAd(options: AdOptions): Promise<AdLoadInfo>;
21+
prepareRewardVideoAd(options: RewardAdOptions): Promise<AdLoadInfo>;
2122

2223
/**
2324
* Show a reward video ad

0 commit comments

Comments
 (0)