react-native-applovin-max 5.7.2 → 6.0.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 (50) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/com/applovin/mediation/adapters/GoogleAdManagerMediationAdapter.java.saved +1616 -0
  4. package/android/src/main/java/com/applovin/mediation/adapters/{GoogleMediationAdapter.java.saved → GoogleMediationAdapter.java.old} +126 -49
  5. package/android/src/main/java/com/applovin/mediation/adapters/MintegralMediationAdapter.java.old +1481 -0
  6. package/ios/AppLovinMAX.m +1 -9
  7. package/ios/AppLovinMAX.xcodeproj/project.pbxproj +4 -4
  8. package/ios/AppLovinMAX.xcworkspace/xcuserdata/hiroshi.watanabe.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  9. package/ios/AppLovinMAXNativeAdView.m +8 -1
  10. package/ios/Podfile +1 -1
  11. package/package.json +2 -1
  12. package/react-native-applovin-max.podspec +1 -1
  13. package/src/AdView.tsx +251 -0
  14. package/src/AppLovinMAX.ts +24 -0
  15. package/src/AppOpenAd.ts +128 -0
  16. package/src/BannerAd.ts +175 -0
  17. package/src/EventEmitter.ts +27 -0
  18. package/src/InterstitialAd.ts +128 -0
  19. package/src/MRecAd.ts +147 -0
  20. package/src/Privacy.ts +6 -0
  21. package/src/RewardedAd.ts +144 -0
  22. package/src/TargetingData.ts +168 -0
  23. package/src/index.ts +21 -0
  24. package/src/nativeAd/NativeAdView.tsx +161 -0
  25. package/src/nativeAd/NativeAdViewComponents.tsx +185 -0
  26. package/src/nativeAd/NativeAdViewProvider.tsx +35 -0
  27. package/src/types/AdEvent.ts +26 -0
  28. package/src/types/AdInfo.ts +348 -0
  29. package/src/types/AdProps.ts +60 -0
  30. package/src/types/AdViewProps.ts +36 -0
  31. package/src/types/AppLovinMAX.ts +86 -0
  32. package/src/types/AppOpenAd.ts +3 -0
  33. package/src/types/BannerAd.ts +47 -0
  34. package/src/types/Configuration.ts +11 -0
  35. package/src/types/FullscreenAd.ts +135 -0
  36. package/src/types/InterstitialAd.ts +3 -0
  37. package/src/types/MRecAd.ts +13 -0
  38. package/src/types/NativeAd.ts +50 -0
  39. package/src/types/NativeAdViewProps.ts +17 -0
  40. package/src/types/Privacy.ts +73 -0
  41. package/src/types/RewardedAd.ts +18 -0
  42. package/src/types/ViewAd.ts +158 -0
  43. package/src/types/index.ts +4 -0
  44. package/src/AppLovinMAXAdView.js +0 -231
  45. package/src/AppLovinMAXEventListeners.js +0 -419
  46. package/src/NativeAdComponents.js +0 -208
  47. package/src/NativeAdView.js +0 -164
  48. package/src/NativeAdViewProvider.js +0 -19
  49. package/src/TargetingData.js +0 -104
  50. package/src/index.js +0 -291
@@ -0,0 +1,348 @@
1
+ /**
2
+ * Represents an ad that has been served by AppLovin MAX.
3
+ */
4
+ export type AdInfo = {
5
+
6
+ /**
7
+ * The ad unit ID for which this ad was loaded.
8
+ */
9
+ adUnitId: string;
10
+
11
+ /**
12
+ * The creative id tied to the ad, if any. You can report creative issues to the corresponding
13
+ * ad network using this id.
14
+ *
15
+ * @see {@link https://dash.applovin.com/documentation/mediation/react-native/testing-networks/creative-debugger#creative-id}
16
+ */
17
+ creativeId?: string | null;
18
+
19
+ /**
20
+ * The ad network from which this ad was loaded.
21
+ *
22
+ * @see {@link https://dash.applovin.com/documentation/mediation/react-native/testing-networks/creative-debugger#network-name}
23
+ */
24
+ networkName: string;
25
+
26
+ /**
27
+ * The placement name that you assign when you integrate each ad format, for granular reporting
28
+ * in postbacks.
29
+ */
30
+ placement?: string | null;
31
+
32
+ /**
33
+ * The ad’s revenue amount. In the case where no revenue amount exists, or it is not available
34
+ * yet, will return a value of 0.
35
+ */
36
+ revenue: number;
37
+
38
+ /**
39
+ * The DSP network that provided the loaded ad when the ad is served through AppLovin Exchange.
40
+ */
41
+ dspName?: string | null;
42
+
43
+ /**
44
+ * The underlying waterfall of ad responses.
45
+ */
46
+ waterfall: AdWaterfallInfo;
47
+
48
+ /**
49
+ * The native ad info.
50
+ */
51
+ nativeAd?: AdNativeInfo | null;
52
+ };
53
+
54
+
55
+ /**
56
+ * Encapsulates various data for MAX load errors.
57
+ */
58
+ export type AdLoadFailedInfo = {
59
+
60
+ /**
61
+ * The ad unit ID for which this ad was loaded.
62
+ */
63
+ adUnitId: string;
64
+
65
+ /**
66
+ * The error code for the error.
67
+ */
68
+ code: string | null;
69
+
70
+ /**
71
+ * The error message for the error.
72
+ */
73
+ message?: string | null;
74
+
75
+ /**
76
+ * The mediated network's error code for the error.
77
+ */
78
+ mediatedNetworkErrorCode: number;
79
+
80
+ /**
81
+ * The mediated network's error message for the error.
82
+ */
83
+ mediatedNetworkErrorMessage: string;
84
+
85
+ /**
86
+ * The message for the error.
87
+ */
88
+ adLoadFailureInfo?: string | null;
89
+
90
+ /**
91
+ * The underlying waterfall of ad responses.
92
+ */
93
+ waterfall?: AdWaterfallInfo | null;
94
+ };
95
+
96
+ /**
97
+ * Encapsulates various data for MAX display errors.
98
+ */
99
+ export type AdDisplayFailedInfo = AdInfo & {
100
+
101
+ /**
102
+ * The error code for the error.
103
+ */
104
+ code: string | null;
105
+
106
+ /**
107
+ * The error message for the error.
108
+ */
109
+ message?: string | null;
110
+
111
+ /**
112
+ * The mediated network's error code for the error.
113
+ */
114
+ mediatedNetworkErrorCode: number;
115
+
116
+ /**
117
+ * The mediated network's error message for the error.
118
+ */
119
+ mediatedNetworkErrorMessage: string;
120
+ };
121
+
122
+ /**
123
+ * Represents a reward given to the user.
124
+ */
125
+ export type AdRewardInfo = AdInfo & {
126
+
127
+ /**
128
+ * The reward label.
129
+ */
130
+ rewardLabel?: string | null;
131
+
132
+ /**
133
+ * The rewarded amount.
134
+ */
135
+ rewardAmount: string;
136
+ };
137
+
138
+ /**
139
+ * Represents a revenue given to the user.
140
+ */
141
+ export type AdRevenueInfo = AdInfo & {
142
+
143
+ /**
144
+ * The ad network placement for which this ad was loaded.
145
+ */
146
+ networkPlacement: string;
147
+
148
+ /**
149
+ * The precision of the revenue value for this ad.
150
+ *
151
+ * Possible values are:
152
+ * - "publisher_defined" - If the revenue is the price assigned to the line item by the publisher.
153
+ * - "exact" - If the revenue is the resulting price of a real-time auction.
154
+ * - "estimated" - If the revenue is the price obtained by auto-CPM.
155
+ * - "undefined" - If we do not have permission from the ad network to share impression-level data.
156
+ * - "" - An empty string, if revenue and precision are not valid (for example, in test mode).
157
+ */
158
+ revenuePrecision: string;
159
+
160
+ /**
161
+ * The current country code.
162
+ */
163
+ countryCode: string;
164
+ };
165
+
166
+ /**
167
+ * Represents a native ad.
168
+ */
169
+ export type AdNativeInfo = {
170
+
171
+ /**
172
+ * The native ad title text.
173
+ */
174
+ title?: string;
175
+
176
+ /**
177
+ * The native ad advertiser text.
178
+ */
179
+ advertiser?: string;
180
+
181
+ /**
182
+ * The native ad body text.
183
+ */
184
+ body?: string;
185
+
186
+ /**
187
+ * The native ad CTA button text.
188
+ */
189
+ callToAction?: string;
190
+
191
+ /**
192
+ * The star rating of the native ad.
193
+ */
194
+ starRating?: number;
195
+
196
+ /**
197
+ * The aspect ratio for the media view if provided by the network.
198
+ */
199
+ mediaContentAspectRatio?: number;
200
+
201
+ /**
202
+ * Whether or not the icon is available.
203
+ */
204
+ isIconImageAvailable: boolean;
205
+
206
+ /**
207
+ * Whether or not the Options view is available.
208
+ */
209
+ isOptionsViewAvailable: boolean;
210
+
211
+ /**
212
+ * Whether or not the Media view is available.
213
+ */
214
+ isMediaViewAvailable: boolean;
215
+ };
216
+
217
+ /**
218
+ * Represents an ad waterfall, encapsulating various metadata such as total latency, underlying ad
219
+ * responses, etc.
220
+ */
221
+ export type AdWaterfallInfo = {
222
+
223
+ /**
224
+ * The ad waterfall name.
225
+ */
226
+ name: string;
227
+
228
+ /**
229
+ * The ad waterfall test name.
230
+ */
231
+ testName: string;
232
+
233
+ /**
234
+ * The list of {@link AdNetworkResponseInfo} info objects relating to each ad in the waterfall,
235
+ * ordered by their position.
236
+ */
237
+ networkResponses: AdNetworkResponseInfo[];
238
+
239
+ /**
240
+ * The total latency in seconds for this waterfall to finish processing.
241
+ */
242
+ latencyMillis: number;
243
+ };
244
+
245
+ /**
246
+ * This enum contains possible states of an ad in the waterfall the adapter response info could
247
+ * represent.
248
+ */
249
+ export enum AdLoadState {
250
+
251
+ /**
252
+ * The AppLovin MAX SDK did not attempt to load an ad from this network in the waterfall because
253
+ * an ad higher in the waterfall loaded successfully.
254
+ */
255
+ LoadStateAdLoadNotAttempted = 0,
256
+
257
+ /**
258
+ * An ad successfully loaded from this network.
259
+ */
260
+ LoadStateAdLoaded = 1,
261
+
262
+ /**
263
+ * An ad failed to load from this network.
264
+ */
265
+ LoadStateAdFailedToLoad = 2
266
+ }
267
+
268
+ /**
269
+ * Encapsulates load and display errors.
270
+ */
271
+ export type AdErrorInfo = {
272
+
273
+ /**
274
+ * The error code for the error.
275
+ */
276
+ code: number;
277
+
278
+ /**
279
+ * The error message for the error.
280
+ */
281
+ message?: string;
282
+
283
+ /**
284
+ * @deprecated
285
+ */
286
+ adLoadFailureInfo?: string;
287
+ };
288
+
289
+ /**
290
+ * This class represents an ad response in a waterfall.
291
+ */
292
+ export type AdNetworkResponseInfo = {
293
+
294
+ /**
295
+ * The state of the ad that this object represents. For more info, see the {@link AdLoadState} enum.
296
+ */
297
+ adLoadState: AdLoadState;
298
+
299
+ /**
300
+ * The mediated network that this adapter response info object represents.
301
+ */
302
+ mediatedNetwork?: AdMediatedNetworkInfo;
303
+
304
+ /**
305
+ * The credentials used to load an ad from this adapter, as entered in the AppLovin MAX dashboard.
306
+ */
307
+ credentials: { [key: string]: any; };
308
+
309
+ /**
310
+ * The ad load error this network response resulted in. Will be unavailable if an attempt to
311
+ * load an ad has not been made or an ad was loaded successfully (i.e. the loadState is NOT
312
+ * LoadStateAdFailedToLoad).
313
+ */
314
+ error?: AdErrorInfo;
315
+
316
+ /**
317
+ * The amount of time the network took to load (either successfully or not) an ad, in
318
+ * milliseconds. If an attempt to load an ad has not been made (i.e. the loadState is
319
+ * LoadStateAdLoadNotAttempted), the value will be -1.
320
+ */
321
+ latencyMillis: number;
322
+ };
323
+
324
+ /**
325
+ * This class represents information for a mediated network.
326
+ */
327
+ export type AdMediatedNetworkInfo = {
328
+
329
+ /**
330
+ * The name of the mediated network.
331
+ */
332
+ name: string;
333
+
334
+ /**
335
+ * The class name of the adapter for the mediated network.
336
+ */
337
+ adapterClassName: string;
338
+
339
+ /**
340
+ * The version of the adapter for the mediated network.
341
+ */
342
+ adapterVersion: string;
343
+
344
+ /**
345
+ * The version of the mediated network’s SDK.
346
+ */
347
+ sdkVersion: string;
348
+ };
@@ -0,0 +1,60 @@
1
+ import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo } from "./AdInfo";
2
+
3
+ /**
4
+ * Defines the base properties for the UI component ads i.e {@link Adview} and {@link NativeAdView}.
5
+ */
6
+ export type AdProps = {
7
+
8
+ /**
9
+ * A string value representing the ad unit id to load ads for.
10
+ */
11
+ adUnitId: string;
12
+
13
+ /**
14
+ * A string value representing the placement name that you assign when you integrate each ad
15
+ * format, for granular reporting in ad events.
16
+ */
17
+ placement?: string | null;
18
+
19
+ /**
20
+ * The custom data to tie the showing ad to.
21
+ */
22
+ customData?: string | null;
23
+
24
+ /**
25
+ * A dictionary value representing the extra parameters to set a list of key-value string pairs
26
+ * for the ad.
27
+ */
28
+ extraParameters?: { [key: string]: string | null };
29
+
30
+ /**
31
+ * A dictionary value representing the local extra parameters to set a list of key-value pairs
32
+ * to pass to the adapter instances.
33
+ */
34
+ localExtraParameters?: { [key: string]: any };
35
+
36
+ /**
37
+ * A callback fuction to be fired when a new ad has been loaded.
38
+ */
39
+ onAdLoaded?: (adInfo: AdInfo) => void;
40
+
41
+ /**
42
+ * A callback fuction to be fired when an ad could not be retrieved.
43
+ */
44
+ onAdLoadFailed?: (error: AdLoadFailedInfo) => void;
45
+
46
+ /**
47
+ * A callback fuction to be fired when the ad failed to display.
48
+ */
49
+ onAdDisplayFailed?: (error: AdDisplayFailedInfo) => void;
50
+
51
+ /**
52
+ * A callback fuction to be fired when ad is clicked.
53
+ */
54
+ onAdClicked?: (adInfo: AdInfo) => void;
55
+
56
+ /**
57
+ * A callback fuction to be fired when the revenue event is detected.
58
+ */
59
+ onAdRevenuePaid?: (adInfo: AdRevenueInfo) => void;
60
+ };
@@ -0,0 +1,36 @@
1
+ import type { AdProps } from "./AdProps";
2
+ import type { AdInfo } from "./AdInfo";
3
+ import type { AdFormat } from "../AdView";
4
+
5
+ /**
6
+ * Represents an {@link AdView} - Banner / MREC.
7
+ */
8
+ export type AdViewProps = AdProps & {
9
+
10
+ /**
11
+ * A string value representing the ad format to load ads for. Should be either
12
+ * {@link AdFormat.BANNER} or {@link AdFormat.MREC}.
13
+ */
14
+ adFormat: AdFormat;
15
+
16
+ /**
17
+ * A boolean value representing whether or not to enable adaptive banners.
18
+ */
19
+ adaptiveBannerEnabled?: boolean;
20
+
21
+ /**
22
+ * A boolean value representing whether or not to enable auto-refresh. Note that auto-refresh is
23
+ * enabled by default.
24
+ */
25
+ autoRefresh?: boolean;
26
+
27
+ /**
28
+ * A callback fuction to be fired when the ad view is expanded.
29
+ */
30
+ onAdExpanded?: (adInfo: AdInfo) => void;
31
+
32
+ /**
33
+ * A callback fuction to be fired when the ad view is collapsed.
34
+ */
35
+ onAdCollapsed?: (adInfo: AdInfo) => void;
36
+ };
@@ -0,0 +1,86 @@
1
+ import type { Configuration } from "./Configuration";
2
+
3
+ /**
4
+ * Represents the AppLovinMAX module.
5
+ */
6
+ export type AppLovinMAXType = {
7
+
8
+ /**
9
+ * Whether the SDK has fully been initialized without errors and the completion callback called.
10
+ */
11
+ isInitialized(): Promise<boolean>;
12
+
13
+ /**
14
+ * Initializes the SDK, and returns Configuration when it finishes initializing.
15
+ *
16
+ * @param sdkKey SDK key to use for the instance of the AppLovin SDK.
17
+ */
18
+ initialize(sdkKey: string): Promise<Configuration>;
19
+
20
+ /**
21
+ * Presents the mediation debugger UI.
22
+ */
23
+ showMediationDebugger(): void;
24
+
25
+ /**
26
+ * Whether this device is a tablet.
27
+ */
28
+ isTablet(): Promise<boolean>;
29
+
30
+ /**
31
+ * Sets an id for the current user. This identifier will be tied to SDK events and AppLovin’s
32
+ * optional S2S postbacks.
33
+ *
34
+ * @param userId User id.
35
+ */
36
+ setUserId(userId: string): void;
37
+
38
+ /**
39
+ * Sets a muted state or not for beginning video ads.
40
+ *
41
+ * @param muted If ads should begin in a muted state.
42
+ */
43
+ setMuted(muted: boolean): void;
44
+
45
+ /**
46
+ * Whether to begin video ads in a muted state or not.
47
+ */
48
+ isMuted(): Promise<boolean>;
49
+
50
+ /**
51
+ * A toggle for verbose logging for the SDK.
52
+ *
53
+ * @param verboseLoggingEnabled True if log messages should be output.
54
+ */
55
+ setVerboseLogging(verboseLoggingEnabled: boolean): void;
56
+
57
+ /**
58
+ * Enable devices to receive test ads by passing in the advertising identifier (IDFA) of each
59
+ * test device. Refer to AppLovin logs for the IDFA of your current device.
60
+ *
61
+ * @param advertisingIds A list of the advertising ids.
62
+ */
63
+ setTestDeviceAdvertisingIds(advertisingIds: string[]): void;
64
+
65
+ /**
66
+ * Whether the Creative Debugger will be displayed after flipping the device screen down twice.
67
+ *
68
+ * @param enabled Default to true.
69
+ */
70
+ setCreativeDebuggerEnabled(enabled: boolean): void;
71
+
72
+ /**
73
+ * Set an extra parameter to pass to the AppLovin server.
74
+ *
75
+ * @param key Parameter key.
76
+ * @param value Parameter value.
77
+ */
78
+ setExtraParameter(key: string, value: string | null): void;
79
+
80
+ /**
81
+ * Whether or not the SDK will collect the device location.
82
+ *
83
+ * @param enabled Defaults to true.
84
+ */
85
+ setLocationCollectionEnabled(enabled: boolean): Promise<void>;
86
+ };
@@ -0,0 +1,3 @@
1
+ import type { FullscreenAdType } from "./FullscreenAd";
2
+
3
+ export type AppOpenAdType = FullscreenAdType;
@@ -0,0 +1,47 @@
1
+ import type { ViewAdType } from "./ViewAd";
2
+ import type { AdViewPosition } from "../AdView";
3
+
4
+ export type BannerAdType = ViewAdType & {
5
+
6
+ /**
7
+ * Creates a banner at the specified position and offsets.
8
+ *
9
+ * @param adUnitId The Ad Unit ID to load ads for.
10
+ * @param position {@ AdViewPosition} position.
11
+ * @param xOffset Offset from the left corner.
12
+ * @param yOffset Offset from the top corner.
13
+ */
14
+ createAd(adUnitId: string, position: AdViewPosition, xOffset?: number, yOffset?: number): void;
15
+
16
+ /**
17
+ * Sets a background color for the banner.
18
+ *
19
+ * @param adUnitId The Ad Unit ID to load ads for.
20
+ * @param hexColorCode Hexadecimal color (#rrggbb).
21
+ */
22
+ setBackgroundColor(adUnitId: string, hexColorCode: string): void;
23
+
24
+ /**
25
+ * Sets the banner width.
26
+ *
27
+ * @param adUnitId The Ad Unit ID to load ads for.
28
+ * @param width The desired banner width.
29
+ */
30
+ setWidth(adUnitId: string, width: number): void;
31
+
32
+ /**
33
+ * Updates the banner position offsets.
34
+ *
35
+ * @param adUnitId The Ad Unit ID to load ads for.
36
+ * @param xOffset Offset from the left corner.
37
+ * @param yOffset Offset from the top corner.
38
+ */
39
+ updateOffsets(adUnitId: string, xOffset: number, yOffset: number): void;
40
+
41
+ /**
42
+ * Gets the adaptive banner size for the provided width at the current orientation.
43
+ *
44
+ * @param width The banner width.
45
+ */
46
+ getAdaptiveHeightForWidth(width: number): Promise<number>;
47
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Encapsulates various data for the SDK configuration.
3
+ */
4
+ export type Configuration = {
5
+
6
+ /**
7
+ * The country code of this user.
8
+ */
9
+ countryCode: string;
10
+ };
11
+