react-native-purchases-admob 0.0.0-stage → 10.15.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.
- package/LICENSE +20 -0
- package/README.md +91 -2
- package/lib/commonjs/index.js +446 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/state.js +92 -0
- package/lib/commonjs/state.js.map +1 -0
- package/lib/commonjs/tracker.js +161 -0
- package/lib/commonjs/tracker.js.map +1 -0
- package/lib/module/index.js +439 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/state.js +82 -0
- package/lib/module/state.js.map +1 -0
- package/lib/module/tracker.js +150 -0
- package/lib/module/tracker.js.map +1 -0
- package/lib/typescript/src/index.d.ts +230 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/state.d.ts +31 -0
- package/lib/typescript/src/state.d.ts.map +1 -0
- package/lib/typescript/src/tracker.d.ts +17 -0
- package/lib/typescript/src/tracker.d.ts.map +1 -0
- package/package.json +109 -4
- package/src/index.ts +623 -0
- package/src/state.ts +109 -0
- package/src/tracker.ts +200 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 RevenueCat
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,92 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://uploads-ssl.webflow.com/5e2613cf294dc30503dcefb7/5e752025f8c3a31d56a51408_logo_red%20(1).svg" width="350" alt="RevenueCat"/>
|
|
3
|
+
<br>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/react-native-purchases-admob)
|
|
6
|
+
|
|
7
|
+
## react-native-purchases-admob
|
|
8
|
+
|
|
9
|
+
_react-native-purchases-admob_ connects [react-native-google-mobile-ads](https://github.com/invertase/react-native-google-mobile-ads) to [RevenueCat](https://www.revenuecat.com/)'s ad tracking and reward verification. Create your ads through the adapter and it reports loaded, failed-to-load, displayed, opened, revenue and earned-reward events for you; rewarded ads can additionally have their rewards verified server-side. See the [AdMob integration docs](https://www.revenuecat.com/docs/ad-monetization/admob) for the full picture.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
yarn add react-native-purchases react-native-google-mobile-ads react-native-purchases-admob
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires `react-native-google-mobile-ads` 17 or newer (the first version that exposes `responseInfo` and `valueMicros` on every ad format). Configure `Purchases` and initialize `mobileAds()` as you normally would; the adapter only tracks while `Purchases` is configured.
|
|
18
|
+
|
|
19
|
+
## Tracking full-screen ads
|
|
20
|
+
|
|
21
|
+
Replace `InterstitialAd.createForAdRequest(...)` with the matching `RevenueCatAdMob.create...` call. The returned object is the same `InterstitialAd`, so `load()`, listeners and `destroy()` work as before; `placement` is a free-form label for where the ad is shown.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { RevenueCatAdMob } from "react-native-purchases-admob";
|
|
25
|
+
|
|
26
|
+
const interstitial = RevenueCatAdMob.createInterstitialAd(adUnitId, {
|
|
27
|
+
placement: "level_complete",
|
|
28
|
+
requestOptions: { keywords: ["game"] },
|
|
29
|
+
});
|
|
30
|
+
interstitial.addAdEventListener(AdEventType.LOADED, () => setReady(true));
|
|
31
|
+
interstitial.load();
|
|
32
|
+
|
|
33
|
+
// Later. The placement given here overrides the load-time one for this impression.
|
|
34
|
+
await RevenueCatAdMob.showAndTrack(interstitial, {
|
|
35
|
+
placement: "level_complete_retry",
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`createAppOpenAd` works the same way. For an ad you created yourself, call `RevenueCatAdMob.trackAd(ad, { placement })` before `load()`.
|
|
40
|
+
|
|
41
|
+
## Banner and native ads
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { useTrackingBannerAdProps } from "react-native-purchases-admob";
|
|
45
|
+
|
|
46
|
+
function HomeBanner() {
|
|
47
|
+
const bannerProps = useTrackingBannerAdProps({
|
|
48
|
+
unitId,
|
|
49
|
+
size: BannerAdSize.BANNER,
|
|
50
|
+
placement: "home_bottom",
|
|
51
|
+
onPaid: (paid) => console.log(paid.value),
|
|
52
|
+
});
|
|
53
|
+
return <BannerAd {...bannerProps} />;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const nativeAd = await NativeAd.createForAdRequest(adUnitId);
|
|
57
|
+
RevenueCatAdMob.trackNativeAd(nativeAd, { placement: "feed" });
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Banners are a component, not an ad object, and their events arrive through props that React re-evaluates on every render, which is why they get a hook while every other format does not. Your own banner callbacks (`onAdLoaded`, `onPaid`, ...) are forwarded. Class components can use `RevenueCatAdMob.trackingBannerAdProps(...)` instead; it returns the same props but starts a new tracking state on every call, so call it once per banner instance (for example in the constructor), not inside `render`.
|
|
61
|
+
|
|
62
|
+
## Reward verification
|
|
63
|
+
|
|
64
|
+
`react-native-google-mobile-ads` only accepts server-side verification options when the ad request is created, before AdMob's response id exists. The adapter therefore generates the impression id itself when you opt in, attaches the RevenueCat token to the request, and uses that id for every tracking event of the ad.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const rewarded = await RevenueCatAdMob.createRewardedAd(adUnitId, {
|
|
68
|
+
placement: "extra_life",
|
|
69
|
+
enableRewardVerification: true,
|
|
70
|
+
});
|
|
71
|
+
rewarded.load();
|
|
72
|
+
|
|
73
|
+
await RevenueCatAdMob.showWithRewardVerification(rewarded, {
|
|
74
|
+
onRewardVerificationStarted: () => showSpinner(),
|
|
75
|
+
onRewardVerificationCompleted: (result) => {
|
|
76
|
+
if (result.failed) return showError();
|
|
77
|
+
grant(result.reward);
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Verification tokens are single-use, so create a new ad for every verified show rather than calling `load()` again on the same instance; after it has loaded, a second `load()` on a verified instance logs a warning and does nothing (a retry after a load error still works). `onRewardVerificationCompleted` is called at most once per show, after the user earns the reward; it is not called when the ad is dismissed or fails before a reward. The ad unit's server-side verification URL must point at RevenueCat and a reward must be configured for it in the RevenueCat dashboard; see the [rewards docs](https://www.revenuecat.com/docs/ad-monetization/rewards).
|
|
83
|
+
|
|
84
|
+
## Not covered
|
|
85
|
+
|
|
86
|
+
The `useInterstitialAd` / `useRewardedAd` hooks create their ads internally and cannot be routed through the adapter; use the class API above. Ad pools and multi-format requests are not tracked.
|
|
87
|
+
|
|
88
|
+
## Requirements
|
|
89
|
+
|
|
90
|
+
- iOS 15.0+ (ad tracking is unavailable below that; calls are ignored with a warning)
|
|
91
|
+
- `react-native-google-mobile-ads` 17.x (17.0.0 needs React Native 0.76+, 17.1.0+ needs 0.86+) and the New Architecture
|
|
92
|
+
- `react-native-purchases` 10.14.0
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.RevenueCatAdMob = void 0;
|
|
7
|
+
exports.useTrackingBannerAdProps = useTrackingBannerAdProps;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _reactNativePurchases = _interopRequireWildcard(require("react-native-purchases"));
|
|
10
|
+
var _reactNativeGoogleMobileAds = require("react-native-google-mobile-ads");
|
|
11
|
+
var _state = require("./state");
|
|
12
|
+
var _tracker = require("./tracker");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
/**
|
|
15
|
+
* The structural shape of a `react-native-google-mobile-ads` full-screen ad
|
|
16
|
+
* (`InterstitialAd`, `AppOpenAd`, `RewardedAd`, `RewardedInterstitialAd`).
|
|
17
|
+
* Typed structurally so the adapter works across the library's per-class
|
|
18
|
+
* listener generics and duplicate type installations.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const failedResult = {
|
|
22
|
+
failed: true,
|
|
23
|
+
moreRewards: []
|
|
24
|
+
};
|
|
25
|
+
function formatOf(ad) {
|
|
26
|
+
if (ad instanceof _reactNativeGoogleMobileAds.InterstitialAd) {
|
|
27
|
+
return _reactNativePurchases.AdFormat.interstitial;
|
|
28
|
+
}
|
|
29
|
+
if (ad instanceof _reactNativeGoogleMobileAds.RewardedInterstitialAd) {
|
|
30
|
+
return _reactNativePurchases.AdFormat.rewardedInterstitial;
|
|
31
|
+
}
|
|
32
|
+
if (ad instanceof _reactNativeGoogleMobileAds.RewardedAd) {
|
|
33
|
+
return _reactNativePurchases.AdFormat.rewarded;
|
|
34
|
+
}
|
|
35
|
+
if (ad instanceof _reactNativeGoogleMobileAds.AppOpenAd) {
|
|
36
|
+
return _reactNativePurchases.AdFormat.appOpen;
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Attaches RevenueCat tracking to an already created full-screen ad. Listeners
|
|
43
|
+
* are additive, so your own `addAdEventListener` calls keep working.
|
|
44
|
+
*/
|
|
45
|
+
function trackAd(ad, adFormat, placement, pinnedImpressionId = null) {
|
|
46
|
+
const state = (0, _state.setState)(ad, new _state.TrackedAdState(adFormat, ad.adUnitId, placement, pinnedImpressionId));
|
|
47
|
+
const rewarded = ad instanceof _reactNativeGoogleMobileAds.RewardedAd || ad instanceof _reactNativeGoogleMobileAds.RewardedInterstitialAd;
|
|
48
|
+
ad.addAdEventsListener(({
|
|
49
|
+
type,
|
|
50
|
+
payload
|
|
51
|
+
}) => {
|
|
52
|
+
switch (type) {
|
|
53
|
+
case _reactNativeGoogleMobileAds.AdEventType.LOADED:
|
|
54
|
+
case _reactNativeGoogleMobileAds.RewardedAdEventType.LOADED:
|
|
55
|
+
if (type === _reactNativeGoogleMobileAds.AdEventType.LOADED && rewarded) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
state.loadedOnce = true;
|
|
59
|
+
state.updateFromResponse(ad.responseInfo);
|
|
60
|
+
_tracker.AdMobTracker.trackLoaded(state);
|
|
61
|
+
return;
|
|
62
|
+
case _reactNativeGoogleMobileAds.AdEventType.ERROR:
|
|
63
|
+
{
|
|
64
|
+
const error = payload;
|
|
65
|
+
if ((error === null || error === void 0 ? void 0 : error.phase) === "show") {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
_tracker.AdMobTracker.trackFailedToLoad(ad.adUnitId, adFormat, state.loadPlacement, error === null || error === void 0 ? void 0 : error.reason);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
case _reactNativeGoogleMobileAds.AdEventType.IMPRESSION:
|
|
72
|
+
_tracker.AdMobTracker.trackDisplayed(state);
|
|
73
|
+
return;
|
|
74
|
+
case _reactNativeGoogleMobileAds.AdEventType.CLICKED:
|
|
75
|
+
_tracker.AdMobTracker.trackOpened(state);
|
|
76
|
+
return;
|
|
77
|
+
case _reactNativeGoogleMobileAds.AdEventType.PAID:
|
|
78
|
+
_tracker.AdMobTracker.trackRevenue(state, payload);
|
|
79
|
+
return;
|
|
80
|
+
case _reactNativeGoogleMobileAds.RewardedAdEventType.EARNED_REWARD:
|
|
81
|
+
// With verification enabled the core SDK reports earning from the poll.
|
|
82
|
+
if (!state.clientTransactionId) {
|
|
83
|
+
_tracker.AdMobTracker.trackRewardEarnedUnverified(state);
|
|
84
|
+
}
|
|
85
|
+
return;
|
|
86
|
+
default:
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return state;
|
|
91
|
+
}
|
|
92
|
+
async function createRewarded(create, adFormat, options) {
|
|
93
|
+
let requestOptions = options.requestOptions ?? {};
|
|
94
|
+
let pinnedImpressionId = null;
|
|
95
|
+
let clientTransactionId = null;
|
|
96
|
+
if (options.enableRewardVerification) {
|
|
97
|
+
pinnedImpressionId = (0, _state.generateImpressionId)();
|
|
98
|
+
try {
|
|
99
|
+
const token = await _reactNativePurchases.default.generateRewardVerificationToken(pinnedImpressionId);
|
|
100
|
+
clientTransactionId = token.clientTransactionId;
|
|
101
|
+
requestOptions = {
|
|
102
|
+
...requestOptions,
|
|
103
|
+
serverSideVerificationOptions: {
|
|
104
|
+
userId: token.appUserID,
|
|
105
|
+
customData: token.customData
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
} catch (e) {
|
|
109
|
+
(0, _tracker.logWarning)(`Could not enable reward verification: ${e}`);
|
|
110
|
+
pinnedImpressionId = null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const ad = create(requestOptions);
|
|
114
|
+
const state = trackAd(ad, adFormat, options.placement, pinnedImpressionId);
|
|
115
|
+
state.clientTransactionId = clientTransactionId;
|
|
116
|
+
if (pinnedImpressionId) {
|
|
117
|
+
preventReload(ad, state);
|
|
118
|
+
}
|
|
119
|
+
return ad;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The SSV token travels with the request options, which the library reuses
|
|
124
|
+
* and attaches natively on every successful load, so a reload after the ad
|
|
125
|
+
* has loaded would send the already used token to AdMob. Shadow `load` on
|
|
126
|
+
* the instance so it is ignored once the ad has loaded; a retry after a load
|
|
127
|
+
* error never consumed the token and still goes through.
|
|
128
|
+
*/
|
|
129
|
+
function preventReload(ad, state) {
|
|
130
|
+
const load = ad.load.bind(ad);
|
|
131
|
+
ad.load = () => {
|
|
132
|
+
if (state.loadedOnce) {
|
|
133
|
+
(0, _tracker.logWarning)("Reward verification tokens are single-use; load() was ignored. " + "Create a new ad through createRewardedAd for each verified show.");
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
load();
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function trackedBannerProps(state, props) {
|
|
140
|
+
return {
|
|
141
|
+
...props,
|
|
142
|
+
onAdLoaded: dimensions => {
|
|
143
|
+
var _props$onAdLoaded;
|
|
144
|
+
state.updateFromResponse(dimensions.responseInfo);
|
|
145
|
+
_tracker.AdMobTracker.trackLoaded(state);
|
|
146
|
+
(_props$onAdLoaded = props.onAdLoaded) === null || _props$onAdLoaded === void 0 || _props$onAdLoaded.call(props, dimensions);
|
|
147
|
+
},
|
|
148
|
+
onAdFailedToLoad: error => {
|
|
149
|
+
var _props$onAdFailedToLo;
|
|
150
|
+
_tracker.AdMobTracker.trackFailedToLoad(props.unitId, _reactNativePurchases.AdFormat.banner, state.loadPlacement, error.reason);
|
|
151
|
+
(_props$onAdFailedToLo = props.onAdFailedToLoad) === null || _props$onAdFailedToLo === void 0 || _props$onAdFailedToLo.call(props, error);
|
|
152
|
+
},
|
|
153
|
+
onAdImpression: () => {
|
|
154
|
+
var _props$onAdImpression;
|
|
155
|
+
_tracker.AdMobTracker.trackDisplayed(state);
|
|
156
|
+
(_props$onAdImpression = props.onAdImpression) === null || _props$onAdImpression === void 0 || _props$onAdImpression.call(props);
|
|
157
|
+
},
|
|
158
|
+
onAdClicked: () => {
|
|
159
|
+
var _props$onAdClicked;
|
|
160
|
+
_tracker.AdMobTracker.trackOpened(state);
|
|
161
|
+
(_props$onAdClicked = props.onAdClicked) === null || _props$onAdClicked === void 0 || _props$onAdClicked.call(props);
|
|
162
|
+
},
|
|
163
|
+
onPaid: paid => {
|
|
164
|
+
var _props$onPaid;
|
|
165
|
+
_tracker.AdMobTracker.trackRevenue(state, paid);
|
|
166
|
+
(_props$onPaid = props.onPaid) === null || _props$onPaid === void 0 || _props$onPaid.call(props, paid);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Returns `BannerAd` props that report to RevenueCat, forwarding to the
|
|
173
|
+
* props you pass in. Spread the result into `<BannerAd {...props} />`.
|
|
174
|
+
* The tracking state lives for the lifetime of the calling component, so
|
|
175
|
+
* rerenders keep the impression id of the banner that loaded.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```tsx
|
|
179
|
+
* function HomeBanner() {
|
|
180
|
+
* const bannerProps = useTrackingBannerAdProps({
|
|
181
|
+
* unitId,
|
|
182
|
+
* size: BannerAdSize.BANNER,
|
|
183
|
+
* placement: "home_bottom",
|
|
184
|
+
* });
|
|
185
|
+
* return <BannerAd {...bannerProps} />;
|
|
186
|
+
* }
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
function useTrackingBannerAdProps(props) {
|
|
190
|
+
const {
|
|
191
|
+
placement,
|
|
192
|
+
...rest
|
|
193
|
+
} = props;
|
|
194
|
+
const state = (0, _react.useRef)(null);
|
|
195
|
+
if (state.current === null) {
|
|
196
|
+
state.current = new _state.TrackedAdState(_reactNativePurchases.AdFormat.banner, props.unitId, placement);
|
|
197
|
+
}
|
|
198
|
+
return trackedBannerProps(state.current, rest);
|
|
199
|
+
}
|
|
200
|
+
function prepareShow(ad, placement) {
|
|
201
|
+
const state = (0, _state.stateFor)(ad);
|
|
202
|
+
if (!state) {
|
|
203
|
+
(0, _tracker.logWarning)("This ad was not created through RevenueCatAdMob; it will not be tracked.");
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
206
|
+
if (placement != null) {
|
|
207
|
+
state.showPlacement = placement;
|
|
208
|
+
}
|
|
209
|
+
return state;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Entry point of the RevenueCat AdMob adapter for React Native.
|
|
214
|
+
*
|
|
215
|
+
* Create full-screen ads through `create...` instead of
|
|
216
|
+
* `createForAdRequest`, then `load()` and show them through
|
|
217
|
+
* `showAndTrack` / `showWithRewardVerification`. Banner components spread
|
|
218
|
+
* `useTrackingBannerAdProps(...)`; native ads go through `trackNativeAd`.
|
|
219
|
+
*/
|
|
220
|
+
const RevenueCatAdMob = exports.RevenueCatAdMob = {
|
|
221
|
+
/**
|
|
222
|
+
* Creates an interstitial ad whose loaded, displayed, opened, revenue and
|
|
223
|
+
* failed-to-load events are reported to RevenueCat. Use it in place of
|
|
224
|
+
* `InterstitialAd.createForAdRequest`, then `load()` and show it through
|
|
225
|
+
* `showAndTrack`.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```typescript
|
|
229
|
+
* const interstitial = RevenueCatAdMob.createInterstitialAd(adUnitId, {
|
|
230
|
+
* placement: "level_complete",
|
|
231
|
+
* });
|
|
232
|
+
* interstitial.addAdEventListener(AdEventType.LOADED, () => setReady(true));
|
|
233
|
+
* interstitial.load();
|
|
234
|
+
* // Later
|
|
235
|
+
* await RevenueCatAdMob.showAndTrack(interstitial);
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
createInterstitialAd(adUnitId, options = {}) {
|
|
239
|
+
const ad = _reactNativeGoogleMobileAds.InterstitialAd.createForAdRequest(adUnitId, options.requestOptions);
|
|
240
|
+
trackAd(ad, _reactNativePurchases.AdFormat.interstitial, options.placement);
|
|
241
|
+
return ad;
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* Creates an app open ad tracked by RevenueCat. Use it in place of
|
|
245
|
+
* `AppOpenAd.createForAdRequest`, then `load()` and show it through
|
|
246
|
+
* `showAndTrack`.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```typescript
|
|
250
|
+
* const appOpen = RevenueCatAdMob.createAppOpenAd(adUnitId, {
|
|
251
|
+
* placement: "cold_start",
|
|
252
|
+
* });
|
|
253
|
+
* appOpen.load();
|
|
254
|
+
* // When the app comes to the foreground
|
|
255
|
+
* await RevenueCatAdMob.showAndTrack(appOpen);
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
createAppOpenAd(adUnitId, options = {}) {
|
|
259
|
+
const ad = _reactNativeGoogleMobileAds.AppOpenAd.createForAdRequest(adUnitId, options.requestOptions);
|
|
260
|
+
trackAd(ad, _reactNativePurchases.AdFormat.appOpen, options.placement);
|
|
261
|
+
return ad;
|
|
262
|
+
},
|
|
263
|
+
/**
|
|
264
|
+
* Creates a rewarded ad tracked by RevenueCat. Use it in place of
|
|
265
|
+
* `RewardedAd.createForAdRequest`. With `enableRewardVerification` the
|
|
266
|
+
* adapter requests a verification token first, which is why this resolves
|
|
267
|
+
* asynchronously; show such ads through `showWithRewardVerification`.
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```typescript
|
|
271
|
+
* const rewarded = await RevenueCatAdMob.createRewardedAd(adUnitId, {
|
|
272
|
+
* placement: "extra_life",
|
|
273
|
+
* enableRewardVerification: true,
|
|
274
|
+
* });
|
|
275
|
+
* rewarded.load();
|
|
276
|
+
* // Later
|
|
277
|
+
* await RevenueCatAdMob.showWithRewardVerification(rewarded, {
|
|
278
|
+
* onRewardVerificationCompleted: (result) => {
|
|
279
|
+
* if (!result.failed) grant(result.reward);
|
|
280
|
+
* },
|
|
281
|
+
* });
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
createRewardedAd(adUnitId, options = {}) {
|
|
285
|
+
return createRewarded(requestOptions => _reactNativeGoogleMobileAds.RewardedAd.createForAdRequest(adUnitId, requestOptions), _reactNativePurchases.AdFormat.rewarded, options);
|
|
286
|
+
},
|
|
287
|
+
/**
|
|
288
|
+
* Creates a rewarded interstitial ad tracked by RevenueCat. Use it in place
|
|
289
|
+
* of `RewardedInterstitialAd.createForAdRequest`; otherwise identical to
|
|
290
|
+
* `createRewardedAd`.
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```typescript
|
|
294
|
+
* const ad = await RevenueCatAdMob.createRewardedInterstitialAd(adUnitId, {
|
|
295
|
+
* placement: "chapter_end",
|
|
296
|
+
* });
|
|
297
|
+
* ad.load();
|
|
298
|
+
* // Later
|
|
299
|
+
* await RevenueCatAdMob.showAndTrack(ad);
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
createRewardedInterstitialAd(adUnitId, options = {}) {
|
|
303
|
+
return createRewarded(requestOptions => _reactNativeGoogleMobileAds.RewardedInterstitialAd.createForAdRequest(adUnitId, requestOptions), _reactNativePurchases.AdFormat.rewardedInterstitial, options);
|
|
304
|
+
},
|
|
305
|
+
/**
|
|
306
|
+
* Attaches tracking to a full-screen ad you created yourself. Call before
|
|
307
|
+
* `load()`. Reward verification is only available for ads created through
|
|
308
|
+
* `createRewardedAd` / `createRewardedInterstitialAd`.
|
|
309
|
+
*/
|
|
310
|
+
trackAd(ad, options = {}) {
|
|
311
|
+
const adFormat = formatOf(ad);
|
|
312
|
+
if (!adFormat) {
|
|
313
|
+
(0, _tracker.logWarning)("Unsupported ad type; it will not be tracked.");
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
trackAd(ad, adFormat, options.placement);
|
|
317
|
+
},
|
|
318
|
+
/**
|
|
319
|
+
* Shows a tracked full-screen ad, optionally overriding its placement.
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```typescript
|
|
323
|
+
* await RevenueCatAdMob.showAndTrack(interstitial, {
|
|
324
|
+
* placement: "level_complete_retry",
|
|
325
|
+
* });
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
328
|
+
showAndTrack(ad, options = {}) {
|
|
329
|
+
prepareShow(ad, options.placement);
|
|
330
|
+
return ad.show(options.showOptions);
|
|
331
|
+
},
|
|
332
|
+
/**
|
|
333
|
+
* Shows a rewarded ad and verifies the earned reward with RevenueCat.
|
|
334
|
+
* `onRewardVerificationCompleted` is called at most once per show, after
|
|
335
|
+
* the user earns the reward; it is not called when the ad is dismissed or
|
|
336
|
+
* fails before a reward. It receives a failed result when the ad was
|
|
337
|
+
* created without `enableRewardVerification`.
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* ```typescript
|
|
341
|
+
* await RevenueCatAdMob.showWithRewardVerification(rewarded, {
|
|
342
|
+
* onRewardVerificationStarted: () => showSpinner(),
|
|
343
|
+
* onRewardVerificationCompleted: (result) => {
|
|
344
|
+
* if (result.failed) return showError();
|
|
345
|
+
* grant(result.reward);
|
|
346
|
+
* },
|
|
347
|
+
* });
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
showWithRewardVerification(ad, options) {
|
|
351
|
+
const state = prepareShow(ad, options.placement);
|
|
352
|
+
if (state) {
|
|
353
|
+
state.rewardVerificationDelivered = false;
|
|
354
|
+
}
|
|
355
|
+
const unsubscribe = ad.addAdEventListener(_reactNativeGoogleMobileAds.RewardedAdEventType.EARNED_REWARD, reward => {
|
|
356
|
+
var _options$onUserEarned, _options$onRewardVeri;
|
|
357
|
+
(_options$onUserEarned = options.onUserEarnedReward) === null || _options$onUserEarned === void 0 || _options$onUserEarned.call(options, reward);
|
|
358
|
+
(_options$onRewardVeri = options.onRewardVerificationStarted) === null || _options$onRewardVeri === void 0 || _options$onRewardVeri.call(options);
|
|
359
|
+
const deliver = result => {
|
|
360
|
+
if (state !== null && state !== void 0 && state.rewardVerificationDelivered) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (state) {
|
|
364
|
+
state.rewardVerificationDelivered = true;
|
|
365
|
+
}
|
|
366
|
+
options.onRewardVerificationCompleted(result);
|
|
367
|
+
};
|
|
368
|
+
const clientTransactionId = state === null || state === void 0 ? void 0 : state.clientTransactionId;
|
|
369
|
+
if (!state || !clientTransactionId) {
|
|
370
|
+
(0, _tracker.logWarning)("Reward earned but reward verification was not enabled for this ad. " + "Create it with enableRewardVerification: true.");
|
|
371
|
+
deliver(failedResult);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
_reactNativePurchases.default.pollRewardVerification(clientTransactionId, state.trackingMetadata).then(deliver).catch(e => {
|
|
375
|
+
(0, _tracker.logWarning)(`Reward verification failed: ${e}`);
|
|
376
|
+
deliver(failedResult);
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
const unsubscribeAll = () => {
|
|
380
|
+
unsubscribe();
|
|
381
|
+
unsubscribeOnClose();
|
|
382
|
+
unsubscribeOnError();
|
|
383
|
+
};
|
|
384
|
+
const unsubscribeOnClose = ad.addAdEventListener(_reactNativeGoogleMobileAds.AdEventType.CLOSED, unsubscribeAll);
|
|
385
|
+
const unsubscribeOnError = ad.addAdEventListener(_reactNativeGoogleMobileAds.AdEventType.ERROR, unsubscribeAll);
|
|
386
|
+
const shown = ad.show(options.showOptions);
|
|
387
|
+
// A rejected show never emits CLOSED, so the listeners would outlive it.
|
|
388
|
+
shown.catch(unsubscribeAll);
|
|
389
|
+
return shown;
|
|
390
|
+
},
|
|
391
|
+
/**
|
|
392
|
+
* Returns `BannerAd` props that report to RevenueCat, forwarding to the
|
|
393
|
+
* props you pass in. Spread the result into `<BannerAd {...props} />`.
|
|
394
|
+
* Each call starts a new tracking state, so call it once per banner
|
|
395
|
+
* instance (for example in a class component's constructor), never inside
|
|
396
|
+
* `render`. Function components should use `useTrackingBannerAdProps` instead.
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```tsx
|
|
400
|
+
* class HomeBanner extends React.Component {
|
|
401
|
+
* bannerProps = RevenueCatAdMob.trackingBannerAdProps({
|
|
402
|
+
* unitId,
|
|
403
|
+
* size: BannerAdSize.BANNER,
|
|
404
|
+
* placement: "home_bottom",
|
|
405
|
+
* });
|
|
406
|
+
* render() {
|
|
407
|
+
* return <BannerAd {...this.bannerProps} />;
|
|
408
|
+
* }
|
|
409
|
+
* }
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
trackingBannerAdProps(props) {
|
|
413
|
+
const {
|
|
414
|
+
placement,
|
|
415
|
+
...rest
|
|
416
|
+
} = props;
|
|
417
|
+
return trackedBannerProps(new _state.TrackedAdState(_reactNativePurchases.AdFormat.banner, props.unitId, placement), rest);
|
|
418
|
+
},
|
|
419
|
+
/**
|
|
420
|
+
* Tracks a loaded native ad. `NativeAd.createForAdRequest` resolves with a
|
|
421
|
+
* loaded ad, so the loaded event is reported immediately.
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* ```typescript
|
|
425
|
+
* const nativeAd = await NativeAd.createForAdRequest(adUnitId);
|
|
426
|
+
* RevenueCatAdMob.trackNativeAd(nativeAd, { placement: "feed" });
|
|
427
|
+
* ```
|
|
428
|
+
*/
|
|
429
|
+
trackNativeAd(ad, options = {}) {
|
|
430
|
+
const state = (0, _state.setState)(ad, new _state.TrackedAdState(_reactNativePurchases.AdFormat.nativeAd, ad.adUnitId, options.placement));
|
|
431
|
+
state.updateFromResponse(ad.responseInfo ?? {
|
|
432
|
+
responseId: ad.responseId
|
|
433
|
+
});
|
|
434
|
+
_tracker.AdMobTracker.trackLoaded(state);
|
|
435
|
+
ad.addAdEventListener(_reactNativeGoogleMobileAds.NativeAdEventType.IMPRESSION, () => _tracker.AdMobTracker.trackDisplayed(state));
|
|
436
|
+
ad.addAdEventListener(_reactNativeGoogleMobileAds.NativeAdEventType.CLICKED, () => _tracker.AdMobTracker.trackOpened(state));
|
|
437
|
+
ad.addAdEventListener(_reactNativeGoogleMobileAds.NativeAdEventType.PAID, paid => _tracker.AdMobTracker.trackRevenue(state, paid));
|
|
438
|
+
},
|
|
439
|
+
/** The impression id the adapter uses for a tracked ad, once known. */
|
|
440
|
+
impressionIdOf(ad) {
|
|
441
|
+
var _stateFor;
|
|
442
|
+
return ((_stateFor = (0, _state.stateFor)(ad)) === null || _stateFor === void 0 ? void 0 : _stateFor.impressionId) ?? null;
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
var _default = exports.default = RevenueCatAdMob;
|
|
446
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNativePurchases","_interopRequireWildcard","_reactNativeGoogleMobileAds","_state","_tracker","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","failedResult","failed","moreRewards","formatOf","ad","InterstitialAd","AdFormat","interstitial","RewardedInterstitialAd","rewardedInterstitial","RewardedAd","rewarded","AppOpenAd","appOpen","trackAd","adFormat","placement","pinnedImpressionId","state","setState","TrackedAdState","adUnitId","addAdEventsListener","type","payload","AdEventType","LOADED","RewardedAdEventType","loadedOnce","updateFromResponse","responseInfo","AdMobTracker","trackLoaded","ERROR","error","phase","trackFailedToLoad","loadPlacement","reason","IMPRESSION","trackDisplayed","CLICKED","trackOpened","PAID","trackRevenue","EARNED_REWARD","clientTransactionId","trackRewardEarnedUnverified","createRewarded","create","options","requestOptions","enableRewardVerification","generateImpressionId","token","Purchases","generateRewardVerificationToken","serverSideVerificationOptions","userId","appUserID","customData","logWarning","preventReload","load","bind","trackedBannerProps","props","onAdLoaded","dimensions","_props$onAdLoaded","onAdFailedToLoad","_props$onAdFailedToLo","unitId","banner","onAdImpression","_props$onAdImpression","onAdClicked","_props$onAdClicked","onPaid","paid","_props$onPaid","useTrackingBannerAdProps","rest","useRef","current","prepareShow","stateFor","undefined","showPlacement","RevenueCatAdMob","exports","createInterstitialAd","createForAdRequest","createAppOpenAd","createRewardedAd","createRewardedInterstitialAd","showAndTrack","show","showOptions","showWithRewardVerification","rewardVerificationDelivered","unsubscribe","addAdEventListener","reward","_options$onUserEarned","_options$onRewardVeri","onUserEarnedReward","onRewardVerificationStarted","deliver","result","onRewardVerificationCompleted","pollRewardVerification","trackingMetadata","then","catch","unsubscribeAll","unsubscribeOnClose","unsubscribeOnError","CLOSED","shown","trackingBannerAdProps","trackNativeAd","nativeAd","responseId","NativeAdEventType","impressionIdOf","_stateFor","impressionId","_default"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,2BAAA,GAAAH,OAAA;AAmBA,IAAAI,MAAA,GAAAJ,OAAA;AAMA,IAAAK,QAAA,GAAAL,OAAA;AAAqD,SAAAE,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA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