@capacitor-community/admob
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -863,8 +863,8 @@ { | ||
"name": "prepareRewardVideoAd", | ||
"signature": "(options: AdOptions) => Promise<AdLoadInfo>", | ||
"signature": "(options: RewardAdOptions) => Promise<AdLoadInfo>", | ||
"parameters": [ | ||
{ | ||
"name": "options", | ||
"docs": "AdOptions", | ||
"type": "AdOptions" | ||
"docs": "RewardAdOptions", | ||
"type": "RewardAdOptions" | ||
} | ||
@@ -895,3 +895,3 @@ ], | ||
{ | ||
"text": "AdOptions", | ||
"text": "RewardAdOptions", | ||
"kind": "text" | ||
@@ -914,3 +914,3 @@ } | ||
"AdLoadInfo", | ||
"AdOptions" | ||
"RewardAdOptions" | ||
], | ||
@@ -1659,2 +1659,38 @@ "slug": "preparerewardvideoad" | ||
{ | ||
"name": "RewardAdOptions", | ||
"slug": "rewardadoptions", | ||
"docs": "", | ||
"tags": [], | ||
"methods": [], | ||
"properties": [ | ||
{ | ||
"name": "ssv", | ||
"tags": [ | ||
{ | ||
"text": [ | ||
{ | ||
"text": "https", | ||
"kind": "text" | ||
}, | ||
{ | ||
"text": "://support.google.com/admob/answer/9603226?hl=en-GB", | ||
"kind": "text" | ||
} | ||
], | ||
"name": "see" | ||
} | ||
], | ||
"docs": "If you have enabled SSV in your AdMob Application. You can provide customData or\na userId be passed to your callback to do further processing on.\n\n*Important* You *HAVE* to define one of them.", | ||
"complexTypes": [ | ||
"AtLeastOne" | ||
], | ||
"type": "AtLeastOne<{\n /**\n * An optional UserId to pass to your SSV callback function.\n */\n userId: string;\n /**\n * An optional custom set of data to pass to your SSV callback function.\n */\n customData: string;\n }>" | ||
} | ||
], | ||
"importObject": [ | ||
"AdOptions", | ||
"AtLeastOne" | ||
] | ||
}, | ||
{ | ||
"name": "AdMobRewardItem", | ||
@@ -1918,4 +1954,35 @@ "slug": "admobrewarditem", | ||
], | ||
"typeAliases": [], | ||
"typeAliases": [ | ||
{ | ||
"name": "AtLeastOne", | ||
"slug": "atleastone", | ||
"docs": "", | ||
"types": [ | ||
{ | ||
"text": "{[K in keyof T]: Pick<T, K>}[keyof T]", | ||
"complexTypes": [ | ||
"T", | ||
"Pick", | ||
"K" | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Pick", | ||
"slug": "pick", | ||
"docs": "From T, pick a set of properties whose keys are in the union K", | ||
"types": [ | ||
{ | ||
"text": "{\r\n [P in K]: T[P];\r\n}", | ||
"complexTypes": [ | ||
"K", | ||
"T", | ||
"P" | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"pluginConfigs": [] | ||
} |
export * from './reward-ad-plugin-events.enum'; | ||
export * from './reward-definitions.interface'; | ||
export * from './reward-item.interface'; | ||
export * from './reward-ad-options.interface'; |
export * from './reward-ad-plugin-events.enum'; | ||
export * from './reward-definitions.interface'; | ||
export * from './reward-item.interface'; | ||
export * from './reward-ad-options.interface'; | ||
//# sourceMappingURL=index.js.map |
import type { PluginListenerHandle } from '@capacitor/core'; | ||
import type { ValidateAllEventsEnumAreImplemented } from '../private/validate-all-events-implemented.type'; | ||
import type { AdLoadInfo, AdMobError, AdOptions } from '../shared'; | ||
import type { AdLoadInfo, AdMobError } from '../shared'; | ||
import type { RewardAdOptions } from './reward-ad-options.interface'; | ||
import type { RewardAdPluginEvents } from './reward-ad-plugin-events.enum'; | ||
@@ -12,6 +13,6 @@ import type { AdMobRewardItem } from './reward-item.interface'; | ||
* @group RewardVideo | ||
* @param options AdOptions | ||
* @param options RewardAdOptions | ||
* @since 1.1.2 | ||
*/ | ||
prepareRewardVideoAd(options: AdOptions): Promise<AdLoadInfo>; | ||
prepareRewardVideoAd(options: RewardAdOptions): Promise<AdLoadInfo>; | ||
/** | ||
@@ -18,0 +19,0 @@ * Show a reward video ad |
{ | ||
"name": "@capacitor-community/admob", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "A native plugin for AdMob", | ||
@@ -51,3 +51,3 @@ "main": "dist/plugin.cjs.js", | ||
"eslint": "^7.11.0", | ||
"husky": "^4.0.0", | ||
"husky": "^4.3.8", | ||
"lint-staged": "^11.0.0", | ||
@@ -54,0 +54,0 @@ "np": "^7.4.0", |
@@ -16,3 +16,3 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p> | ||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-4-orange?style=flat-square" /></a> | ||
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-7-orange?style=flat-square" /></a> | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
@@ -32,3 +32,3 @@ </p> | ||
[Demo code is here.](https://github.com/capacitor-community/admob/tree/feat/demo) | ||
[Demo code is here.](https://github.com/capacitor-community/admob/tree/master/demo) | ||
@@ -174,3 +174,3 @@ ### Screenshots | ||
```ts | ||
import { AdMob, AdOptions, AdLoadInfo, RewardAdPluginEvents, AdMobRewardItem } from '@capacitor-community/admob'; | ||
import { AdMob, RewardAdOptions, AdLoadInfo, RewardAdPluginEvents, AdMobRewardItem } from '@capacitor-community/admob'; | ||
@@ -187,6 +187,10 @@ export async function rewardVideo(): Promise<void> { | ||
const options: AdOptions = { | ||
const options: RewardAdOptions = { | ||
adId: 'YOUR ADID', | ||
// isTesting: true | ||
// npa: true | ||
// ssv: { | ||
// userId: "A user ID to send to your SSV" | ||
// customData: JSON.stringify({ ...MyCustomData }) | ||
//} | ||
}; | ||
@@ -198,2 +202,34 @@ await AdMob.prepareRewardVideoAd(options); | ||
## Server-side Verification Notice | ||
SSV callbacks are only fired on Production Adverts, therefore test Ads will not fire off your SSV callback. | ||
For E2E tests or just for validating the data in your `RewardAdOptions` work as expected, you can add a custom GET | ||
request to your mock endpoint after the `RewardAdPluginEvents.Rewarded` similar to this: | ||
```ts | ||
AdMob.addListener(RewardAdPluginEvents.Rewarded, async () => { | ||
// ... | ||
if (ENVIRONMENT_IS_DEVELOPMENT) { | ||
try { | ||
const url = `https://your-staging-ssv-endpoint` + new URLSearchParams({ | ||
'ad_network': 'TEST', | ||
'ad_unit': 'TEST', | ||
'custom_data': customData, // <-- passed CustomData | ||
'reward_amount': 'TEST', | ||
'reward_item': 'TEST', | ||
'timestamp': 'TEST', | ||
'transaction_id': 'TEST', | ||
'user_id': userId, // <-- Passed UserID | ||
'signature': 'TEST', | ||
'key_id': 'TEST' | ||
}); | ||
await fetch(url); | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
// ... | ||
}); | ||
``` | ||
## Index | ||
@@ -230,2 +266,3 @@ <docgen-index> | ||
* [Interfaces](#interfaces) | ||
* [Type Aliases](#type-aliases) | ||
* [Enums](#enums) | ||
@@ -532,3 +569,3 @@ | ||
```typescript | ||
prepareRewardVideoAd(options: AdOptions) => Promise<AdLoadInfo> | ||
prepareRewardVideoAd(options: RewardAdOptions) => Promise<AdLoadInfo> | ||
``` | ||
@@ -538,5 +575,5 @@ | ||
| Param | Type | Description | | ||
| ------------- | ----------------------------------------------- | ---------------------------------- | | ||
| **`options`** | <code><a href="#adoptions">AdOptions</a></code> | <a href="#adoptions">AdOptions</a> | | ||
| Param | Type | Description | | ||
| ------------- | ----------------------------------------------------------- | ---------------------------------------------- | | ||
| **`options`** | <code><a href="#rewardadoptions">RewardAdOptions</a></code> | <a href="#rewardadoptions">RewardAdOptions</a> | | ||
@@ -734,2 +771,9 @@ **Returns:** <code>Promise<<a href="#adloadinfo">AdLoadInfo</a>></code> | ||
#### RewardAdOptions | ||
| Prop | Type | Description | | ||
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| **`ssv`** | <code><a href="#atleastone">AtLeastOne</a><{ /** * An optional UserId to pass to your SSV callback function. */ userId: string; /** * An optional custom set of data to pass to your SSV callback function. */ customData: string; }></code> | If you have enabled SSV in your AdMob Application. You can provide customData or a userId be passed to your callback to do further processing on. *Important* You *HAVE* to define one of them. | | ||
#### AdMobRewardItem | ||
@@ -746,2 +790,17 @@ | ||
### Type Aliases | ||
#### AtLeastOne | ||
<code>{[K in keyof T]: <a href="#pick">Pick</a><T, K>}[keyof T]</code> | ||
#### Pick | ||
From T, pick a set of properties whose keys are in the union K | ||
<code>{ [P in K]: T[P]; }</code> | ||
### Enums | ||
@@ -846,2 +905,3 @@ | ||
<td align="center"><a href="https://github.com/vanessag"><img src="https://avatars.githubusercontent.com/u/4007550?v=4?s=100" width="100px;" alt=""/><br /><sub><b>vanessag</b></sub></a><br /><a href="https://github.com/capacitor-community/admob/commits?author=vanessag" title="Code">💻</a></td> | ||
<td align="center"><a href="https://mattmilan.dev/"><img src="https://avatars.githubusercontent.com/u/49694881?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Matt Milan</b></sub></a><br /><a href="https://github.com/capacitor-community/admob/commits?author=mattmilan-dev" title="Code">💻</a></td> | ||
</tr> | ||
@@ -848,0 +908,0 @@ </table> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
264588
121
3235
905