-
-
Notifications
You must be signed in to change notification settings - Fork 151
/
type-test.ts
291 lines (248 loc) · 8.66 KB
/
type-test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
/* eslint-disable no-console */
import mobileAds, {
SDK_VERSION,
MobileAds,
AdsConsentDebugGeography,
AdsConsentPurposes,
AdsConsentSpecialFeatures,
AdsConsentStatus,
AdsConsentPrivacyOptionsRequirementStatus,
MaxAdContentRating,
TestIds,
AdEventType,
BannerAdSize,
GAMBannerAdSize,
GAMAdEventType,
RewardedAdEventType,
AdsConsent,
AppOpenAd,
InterstitialAd,
RewardedAd,
RewardedInterstitialAd,
BannerAd,
GAMBannerAd,
GAMInterstitialAd,
useAppOpenAd,
useInterstitialAd,
useRewardedAd,
useRewardedInterstitialAd,
useForeground,
} from './src';
// static exports
console.log(SDK_VERSION);
// default export
mobileAds()
.initialize()
.then(statuses => statuses);
mobileAds().openAdInspector().then();
mobileAds().openDebugMenu('foo');
mobileAds().setAppMuted(false);
mobileAds().setAppVolume(0.5);
mobileAds().setRequestConfiguration({ maxAdContentRating: MaxAdContentRating.G }).then();
mobileAds().subscribeToNativeModuleEvent('foo');
// MobileAds
MobileAds()
.initialize()
.then(statuses => statuses);
MobileAds().openAdInspector().then();
MobileAds().openDebugMenu('foo');
MobileAds().setAppMuted(false);
MobileAds().setAppVolume(0.5);
MobileAds().setRequestConfiguration({ maxAdContentRating: MaxAdContentRating.G }).then();
MobileAds().subscribeToNativeModuleEvent('foo');
// AdsConsentDebugGeography
console.log(AdsConsentDebugGeography.DISABLED);
console.log(AdsConsentDebugGeography.EEA);
console.log(AdsConsentDebugGeography.NOT_EEA);
// AdsConsentPurposes
console.log(AdsConsentPurposes.APPLY_MARKET_RESEARCH_TO_GENERATE_AUDIENCE_INSIGHTS);
console.log(AdsConsentPurposes.CREATE_A_PERSONALISED_ADS_PROFILE);
console.log(AdsConsentPurposes.CREATE_A_PERSONALISED_CONTENT_PROFILE);
console.log(AdsConsentPurposes.DEVELOP_AND_IMPROVE_PRODUCTS);
console.log(AdsConsentPurposes.MEASURE_AD_PERFORMANCE);
console.log(AdsConsentPurposes.MEASURE_CONTENT_PERFORMANCE);
console.log(AdsConsentPurposes.SELECT_BASIC_ADS);
console.log(AdsConsentPurposes.SELECT_PERSONALISED_ADS);
console.log(AdsConsentPurposes.SELECT_PERSONALISED_CONTENT);
console.log(AdsConsentPurposes.STORE_AND_ACCESS_INFORMATION_ON_DEVICE);
// AdsConsentSpecialFeatures
console.log(AdsConsentSpecialFeatures.ACTIVELY_SCAN_DEVICE_CHARACTERISTICS_FOR_IDENTIFICATION);
console.log(AdsConsentSpecialFeatures.USE_PRECISE_GEOLOCATION_DATA);
// AdsConsentStatus
console.log(AdsConsentStatus.UNKNOWN);
console.log(AdsConsentStatus.REQUIRED);
console.log(AdsConsentStatus.NOT_REQUIRED);
console.log(AdsConsentStatus.OBTAINED);
// AdsConsentPrivacyOptionsRequirementStatus
console.log(AdsConsentPrivacyOptionsRequirementStatus.NOT_REQUIRED);
console.log(AdsConsentPrivacyOptionsRequirementStatus.REQUIRED);
console.log(AdsConsentPrivacyOptionsRequirementStatus.UNKNOWN);
// MaxAdContentRating
console.log(MaxAdContentRating.G);
console.log(MaxAdContentRating.MA);
console.log(MaxAdContentRating.PG);
console.log(MaxAdContentRating.T);
// TestIds
console.log(TestIds.ADAPTIVE_BANNER);
console.log(TestIds.APP_OPEN);
console.log(TestIds.BANNER);
console.log(TestIds.GAM_APP_OPEN);
console.log(TestIds.GAM_BANNER);
console.log(TestIds.GAM_INTERSTITIAL);
console.log(TestIds.GAM_NATIVE);
console.log(TestIds.GAM_REWARDED);
console.log(TestIds.GAM_REWARDED_INTERSTITIAL);
console.log(TestIds.INTERSTITIAL);
console.log(TestIds.INTERSTITIAL_VIDEO);
console.log(TestIds.REWARDED);
console.log(TestIds.REWARDED_INTERSTITIAL);
// AdEventType
console.log(AdEventType.CLICKED);
console.log(AdEventType.CLOSED);
console.log(AdEventType.ERROR);
console.log(AdEventType.LOADED);
console.log(AdEventType.OPENED);
console.log(AdEventType.PAID);
// BannerAdSize
console.log(BannerAdSize.ANCHORED_ADAPTIVE_BANNER);
console.log(BannerAdSize.BANNER);
console.log(BannerAdSize.FULL_BANNER);
console.log(BannerAdSize.INLINE_ADAPTIVE_BANNER);
console.log(BannerAdSize.LARGE_BANNER);
console.log(BannerAdSize.LEADERBOARD);
console.log(BannerAdSize.MEDIUM_RECTANGLE);
console.log(BannerAdSize.WIDE_SKYSCRAPER);
console.log(BannerAdSize.ADAPTIVE_BANNER);
// GAMBannerAdSize
console.log(GAMBannerAdSize.ANCHORED_ADAPTIVE_BANNER);
console.log(GAMBannerAdSize.BANNER);
console.log(GAMBannerAdSize.FLUID);
console.log(GAMBannerAdSize.FULL_BANNER);
console.log(GAMBannerAdSize.INLINE_ADAPTIVE_BANNER);
console.log(GAMBannerAdSize.LARGE_BANNER);
console.log(GAMBannerAdSize.LEADERBOARD);
console.log(GAMBannerAdSize.MEDIUM_RECTANGLE);
console.log(GAMBannerAdSize.WIDE_SKYSCRAPER);
console.log(GAMBannerAdSize.ADAPTIVE_BANNER);
// GAMAdEventType
console.log(GAMAdEventType.APP_EVENT);
// RewaredAdEventType
console.log(RewardedAdEventType.LOADED);
console.log(RewardedAdEventType.EARNED_REWARD);
// AdsConsent
AdsConsent.getConsentInfo().then(info => info.canRequestAds);
AdsConsent.getGdprApplies().then(applies => applies);
AdsConsent.getPurposeConsents().then(consents => consents);
AdsConsent.getPurposeLegitimateInterests().then(legitimateInterests => legitimateInterests);
AdsConsent.getTCModel().then(model => model.cmpId);
AdsConsent.getTCString().then(string => string);
AdsConsent.getUserChoices().then(choices => choices.selectBasicAds);
AdsConsent.loadAndShowConsentFormIfRequired().then(info => info.canRequestAds);
AdsConsent.requestInfoUpdate().then(info => info.canRequestAds);
AdsConsent.reset();
AdsConsent.showForm().then(info => info.status);
AdsConsent.showPrivacyOptionsForm().then(info => info.status);
// AppOpenAd
const appOpenAd = AppOpenAd.createForAdRequest('foo', {
keywords: ['test'],
});
console.log(appOpenAd.adUnitId);
console.log(appOpenAd.loaded);
appOpenAd.load();
appOpenAd.show().then();
appOpenAd.addAdEventListener(AdEventType.PAID, () => {});
appOpenAd.addAdEventsListener(({ type, payload }) => {
if (payload) {
console.log(type);
console.log(payload instanceof Error && payload.message);
console.log('amount' in payload && payload.amount);
console.log('data' in payload && payload.data);
}
});
appOpenAd.removeAllListeners();
// InterstitialAd
const interstitial = InterstitialAd.createForAdRequest('foo', {
keywords: ['test'],
});
console.log(interstitial.adUnitId);
console.log(interstitial.loaded);
interstitial.load();
interstitial.show().then();
interstitial.addAdEventListener(AdEventType.PAID, () => {});
interstitial.addAdEventsListener(({ type, payload }) => {
if (payload) {
console.log(type);
console.log(payload instanceof Error && payload.message);
console.log('amount' in payload && payload.amount);
console.log('data' in payload && payload.data);
}
});
interstitial.removeAllListeners();
// RewardedAd
const rewardedAd = RewardedAd.createForAdRequest('foo', {
keywords: ['test'],
});
console.log(rewardedAd.adUnitId);
console.log(rewardedAd.loaded);
rewardedAd.load();
rewardedAd.show().then();
rewardedAd.addAdEventListener(AdEventType.PAID, () => {});
rewardedAd.addAdEventsListener(({ type, payload }) => {
if (payload) {
console.log(type);
console.log(payload instanceof Error && payload.message);
console.log('amount' in payload && payload.amount);
console.log('data' in payload && payload.data);
}
});
rewardedAd.removeAllListeners();
// RewardedInterstitialAd
const rewardedInterstitialAd = RewardedInterstitialAd.createForAdRequest('foo', {
keywords: ['test'],
});
console.log(rewardedInterstitialAd.adUnitId);
console.log(rewardedInterstitialAd.loaded);
rewardedInterstitialAd.load();
rewardedInterstitialAd.show().then();
rewardedInterstitialAd.addAdEventListener(AdEventType.PAID, () => {});
rewardedInterstitialAd.addAdEventsListener(({ type, payload }) => {
if (payload) {
console.log(type);
console.log(payload instanceof Error && payload.message);
console.log('amount' in payload && payload.amount);
console.log('data' in payload && payload.data);
}
});
rewardedInterstitialAd.removeAllListeners();
// BannerAd
console.log(BannerAd);
// GAMBannerAd
console.log(GAMBannerAd);
// GAMInterstitialAd
const gmaInterstitialAd = GAMInterstitialAd.createForAdRequest('foo', {
keywords: ['test'],
});
console.log(gmaInterstitialAd.adUnitId);
console.log(gmaInterstitialAd.loaded);
gmaInterstitialAd.load();
gmaInterstitialAd.show().then();
gmaInterstitialAd.addAdEventListener(AdEventType.PAID, () => {});
gmaInterstitialAd.addAdEventsListener(({ type, payload }) => {
if (payload) {
console.log(type);
console.log(payload instanceof Error && payload.message);
console.log('amount' in payload && payload.amount);
console.log('data' in payload && payload.data);
}
});
gmaInterstitialAd.removeAllListeners();
// useAppOpenAd
console.log(useAppOpenAd);
// useInterstitialAd
console.log(useInterstitialAd);
// useRewardedAd
console.log(useRewardedAd);
// useRewardedInterstitialAd
console.log(useRewardedInterstitialAd);
// useForeground
console.log(useForeground);