react-native-applovin-max 6.0.0 → 6.0.2
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/android/build.gradle +3 -3
- package/ios/Podfile +1 -1
- package/ios/Podfile.lock +5 -5
- package/package.json +5 -1
- package/react-native-applovin-max.podspec +2 -2
- package/src/AdView.tsx +62 -50
- package/src/AppLovinMAX.ts +8 -10
- package/src/AppOpenAd.ts +28 -31
- package/src/BannerAd.ts +36 -35
- package/src/EventEmitter.ts +9 -9
- package/src/InterstitialAd.ts +31 -32
- package/src/MRecAd.ts +32 -31
- package/src/Privacy.ts +2 -2
- package/src/RewardedAd.ts +31 -34
- package/src/TargetingData.ts +95 -38
- package/src/index.ts +12 -12
- package/src/nativeAd/NativeAdView.tsx +68 -59
- package/src/nativeAd/NativeAdViewComponents.tsx +36 -28
- package/src/nativeAd/NativeAdViewProvider.tsx +15 -13
- package/src/types/AdEvent.ts +2 -13
- package/src/types/AdInfo.ts +27 -39
- package/src/types/AdProps.ts +13 -9
- package/src/types/AdViewProps.ts +6 -7
- package/src/types/AppLovinMAX.ts +19 -19
- package/src/types/AppOpenAd.ts +1 -1
- package/src/types/BannerAd.ts +12 -13
- package/src/types/Configuration.ts +2 -4
- package/src/types/FullscreenAd.ts +45 -39
- package/src/types/InterstitialAd.ts +1 -1
- package/src/types/MRecAd.ts +3 -4
- package/src/types/NativeAd.ts +1 -2
- package/src/types/NativeAdViewProps.ts +1 -2
- package/src/types/Privacy.ts +18 -23
- package/src/types/RewardedAd.ts +8 -7
- package/src/types/TargetingData.ts +50 -0
- package/src/types/ViewAd.ts +50 -46
- package/src/types/index.ts +4 -4
package/src/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { default, AppLovinMAX } from
|
|
2
|
-
export { Privacy } from
|
|
3
|
-
export { TargetingData, AdContentRating, UserGender } from
|
|
4
|
-
export { InterstitialAd } from
|
|
5
|
-
export { RewardedAd } from
|
|
6
|
-
export { AppOpenAd } from
|
|
7
|
-
export { BannerAd } from
|
|
8
|
-
export { MRecAd } from
|
|
9
|
-
export { AdView, AdFormat, AdViewPosition } from
|
|
10
|
-
export { NativeAdView } from
|
|
1
|
+
export { default, AppLovinMAX } from './AppLovinMAX';
|
|
2
|
+
export { Privacy } from './Privacy';
|
|
3
|
+
export { TargetingData, AdContentRating, UserGender } from './TargetingData';
|
|
4
|
+
export { InterstitialAd } from './InterstitialAd';
|
|
5
|
+
export { RewardedAd } from './RewardedAd';
|
|
6
|
+
export { AppOpenAd } from './AppOpenAd';
|
|
7
|
+
export { BannerAd } from './BannerAd';
|
|
8
|
+
export { MRecAd } from './MRecAd';
|
|
9
|
+
export { AdView, AdFormat, AdViewPosition } from './AdView';
|
|
10
|
+
export { NativeAdView } from './nativeAd/NativeAdView';
|
|
11
11
|
export {
|
|
12
12
|
TitleView,
|
|
13
13
|
AdvertiserView,
|
|
@@ -17,5 +17,5 @@ export {
|
|
|
17
17
|
OptionsView,
|
|
18
18
|
MediaView,
|
|
19
19
|
StarRatingView,
|
|
20
|
-
} from
|
|
21
|
-
export * from
|
|
20
|
+
} from './nativeAd/NativeAdViewComponents';
|
|
21
|
+
export * from './types';
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import React, { forwardRef, useContext, useImperativeHandle, useRef, useState, useEffect, useCallback } from
|
|
2
|
-
import { NativeModules, requireNativeComponent, UIManager, findNodeHandle } from
|
|
3
|
-
import type { ViewProps } from
|
|
4
|
-
import { NativeAdViewContext, NativeAdViewProvider } from
|
|
5
|
-
import type { AdInfo, AdLoadFailedInfo, AdRevenueInfo } from
|
|
6
|
-
import type { AdNativeEvent } from
|
|
7
|
-
import type { NativeAd } from
|
|
8
|
-
import type { NativeAdViewHandler, NativeAdViewProps } from
|
|
9
|
-
import type { NativeAdViewType, NativeAdViewContextType } from
|
|
1
|
+
import React, { forwardRef, useContext, useImperativeHandle, useRef, useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { NativeModules, requireNativeComponent, UIManager, findNodeHandle } from 'react-native';
|
|
3
|
+
import type { ViewProps } from 'react-native';
|
|
4
|
+
import { NativeAdViewContext, NativeAdViewProvider } from './NativeAdViewProvider';
|
|
5
|
+
import type { AdInfo, AdLoadFailedInfo, AdRevenueInfo } from '../types/AdInfo';
|
|
6
|
+
import type { AdNativeEvent } from '../types/AdEvent';
|
|
7
|
+
import type { NativeAd } from '../types/NativeAd';
|
|
8
|
+
import type { NativeAdViewHandler, NativeAdViewProps } from '../types/NativeAdViewProps';
|
|
9
|
+
import type { NativeAdViewType, NativeAdViewContextType } from './NativeAdViewProvider';
|
|
10
10
|
|
|
11
11
|
const { AppLovinMAX } = NativeModules;
|
|
12
12
|
|
|
13
13
|
type NativeAdViewNativeEvents = {
|
|
14
|
-
onAdLoadedEvent(event: { nativeEvent: { nativeAd: NativeAd; adInfo: AdInfo
|
|
15
|
-
onAdLoadFailedEvent(event: AdNativeEvent<AdLoadFailedInfo>): void
|
|
16
|
-
onAdClickedEvent(event: AdNativeEvent<AdInfo>): void
|
|
17
|
-
onAdRevenuePaidEvent(event: AdNativeEvent<AdRevenueInfo>): void
|
|
14
|
+
onAdLoadedEvent(event: { nativeEvent: { nativeAd: NativeAd; adInfo: AdInfo } }): void;
|
|
15
|
+
onAdLoadFailedEvent(event: AdNativeEvent<AdLoadFailedInfo>): void;
|
|
16
|
+
onAdClickedEvent(event: AdNativeEvent<AdInfo>): void;
|
|
17
|
+
onAdRevenuePaidEvent(event: AdNativeEvent<AdRevenueInfo>): void;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewProps & NativeAdViewNativeEvents>(
|
|
20
|
+
const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewProps & NativeAdViewNativeEvents>(
|
|
21
|
+
'AppLovinMAXNativeAdView'
|
|
22
|
+
);
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
|
-
* The {@link NativeAdView} component
|
|
24
|
-
* the asset views:
|
|
25
|
+
* The {@link NativeAdView} component that you use building a native ad. This loads a native ad and
|
|
26
|
+
* renders it with the asset views:
|
|
25
27
|
*
|
|
26
28
|
* - {@link IconView}
|
|
27
29
|
* - {@link TitleView}
|
|
@@ -31,9 +33,10 @@ const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewPro
|
|
|
31
33
|
* - {@link MediaView}
|
|
32
34
|
* - {@link CallToActionView}
|
|
33
35
|
*
|
|
34
|
-
*
|
|
35
|
-
* the layout and style of the asset views.
|
|
36
|
-
*
|
|
36
|
+
* {@link NativeAdView} fills each asset view with the data of a native ad as soon as it loads the native
|
|
37
|
+
* ad, but you need to provide the layout and style of the asset views.
|
|
38
|
+
* {@link NativeAdView} can reload a new native ad by using the ref handler.
|
|
39
|
+
*
|
|
37
40
|
* ### Example:
|
|
38
41
|
* ```js
|
|
39
42
|
* <NativeAdView
|
|
@@ -55,46 +58,52 @@ const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewPro
|
|
|
55
58
|
* </NativeAdView>
|
|
56
59
|
* ```
|
|
57
60
|
*/
|
|
58
|
-
export const NativeAdView = forwardRef<NativeAdViewHandler, NativeAdViewProps & ViewProps>(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
export const NativeAdView = forwardRef<NativeAdViewHandler, NativeAdViewProps & ViewProps>(
|
|
62
|
+
function NativeAdView(props, ref) {
|
|
63
|
+
const [isInitialized, setIsInitialized] = useState<boolean>(false);
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
// check that AppLovinMAX has been initialized
|
|
67
|
+
AppLovinMAX.isInitialized().then((result: boolean) => {
|
|
68
|
+
setIsInitialized(result);
|
|
69
|
+
if (!result) {
|
|
70
|
+
console.warn(
|
|
71
|
+
'NativeAdView is mounted before the initialization of the AppLovin MAX React Native module'
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
// Not ready to render NativeAdView
|
|
78
|
+
if (!isInitialized) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
70
81
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
82
|
+
return (
|
|
83
|
+
<NativeAdViewProvider>
|
|
84
|
+
<NativeAdViewImpl {...props} ref={ref} />
|
|
85
|
+
</NativeAdViewProvider>
|
|
86
|
+
);
|
|
74
87
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
style,
|
|
95
|
-
...otherProps
|
|
96
|
-
}, ref) => {
|
|
97
|
-
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const NativeAdViewImpl = forwardRef<NativeAdViewHandler, NativeAdViewProps & ViewProps>(function NativeAdViewImpl(
|
|
91
|
+
{
|
|
92
|
+
adUnitId,
|
|
93
|
+
placement,
|
|
94
|
+
customData,
|
|
95
|
+
extraParameters,
|
|
96
|
+
localExtraParameters,
|
|
97
|
+
onAdLoaded,
|
|
98
|
+
onAdLoadFailed,
|
|
99
|
+
onAdClicked,
|
|
100
|
+
onAdRevenuePaid,
|
|
101
|
+
children,
|
|
102
|
+
style,
|
|
103
|
+
...otherProps
|
|
104
|
+
},
|
|
105
|
+
ref
|
|
106
|
+
) {
|
|
98
107
|
// context from NativeAdViewProvider
|
|
99
108
|
const { setNativeAd, setNativeAdView } = useContext(NativeAdViewContext) as NativeAdViewContextType;
|
|
100
109
|
|
|
@@ -106,7 +115,7 @@ const NativeAdViewImpl = forwardRef<NativeAdViewHandler, NativeAdViewProps & Vie
|
|
|
106
115
|
if (nativeAdViewRef) {
|
|
107
116
|
UIManager.dispatchViewManagerCommand(
|
|
108
117
|
findNodeHandle(nativeAdViewRef.current),
|
|
109
|
-
UIManager.getViewManagerConfig(
|
|
118
|
+
UIManager.getViewManagerConfig('AppLovinMAXNativeAdView').Commands.loadAd,
|
|
110
119
|
undefined
|
|
111
120
|
);
|
|
112
121
|
}
|
|
@@ -123,7 +132,7 @@ const NativeAdViewImpl = forwardRef<NativeAdViewHandler, NativeAdViewProps & Vie
|
|
|
123
132
|
}
|
|
124
133
|
}, []);
|
|
125
134
|
|
|
126
|
-
const onAdLoadedEvent = (event: { nativeEvent: { nativeAd: NativeAd; adInfo: AdInfo
|
|
135
|
+
const onAdLoadedEvent = (event: { nativeEvent: { nativeAd: NativeAd; adInfo: AdInfo } }) => {
|
|
127
136
|
setNativeAd(event.nativeEvent.nativeAd);
|
|
128
137
|
if (onAdLoaded) onAdLoaded(event.nativeEvent.adInfo);
|
|
129
138
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, { useContext, useRef, useEffect } from
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import React, { useContext, useRef, useEffect } from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { findNodeHandle, Text, Image, View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
4
|
+
import type { ViewProps, ImageProps, TextStyle, StyleProp, TextProps } from 'react-native';
|
|
5
|
+
import { NativeAdViewContext } from './NativeAdViewProvider';
|
|
5
6
|
|
|
6
|
-
export const TitleView = (props:
|
|
7
|
+
export const TitleView = (props: TextProps) => {
|
|
7
8
|
const titleRef = useRef(null);
|
|
8
9
|
const { nativeAd, nativeAdView } = useContext(NativeAdViewContext);
|
|
9
10
|
|
|
@@ -22,7 +23,7 @@ export const TitleView = (props: ViewProps) => {
|
|
|
22
23
|
);
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
export const AdvertiserView = (props:
|
|
26
|
+
export const AdvertiserView = (props: TextProps) => {
|
|
26
27
|
const advertiserRef = useRef(null);
|
|
27
28
|
const { nativeAd, nativeAdView } = useContext(NativeAdViewContext);
|
|
28
29
|
|
|
@@ -41,7 +42,7 @@ export const AdvertiserView = (props: ViewProps) => {
|
|
|
41
42
|
);
|
|
42
43
|
};
|
|
43
44
|
|
|
44
|
-
export const BodyView = (props:
|
|
45
|
+
export const BodyView = (props: TextProps) => {
|
|
45
46
|
const bodyRef = useRef(null);
|
|
46
47
|
const { nativeAd, nativeAdView } = useContext(NativeAdViewContext);
|
|
47
48
|
|
|
@@ -60,7 +61,7 @@ export const BodyView = (props: ViewProps) => {
|
|
|
60
61
|
);
|
|
61
62
|
};
|
|
62
63
|
|
|
63
|
-
export const CallToActionView = (props:
|
|
64
|
+
export const CallToActionView = (props: TextProps) => {
|
|
64
65
|
const callToActionRef = useRef(null);
|
|
65
66
|
const { nativeAd, nativeAdView } = useContext(NativeAdViewContext);
|
|
66
67
|
|
|
@@ -73,7 +74,7 @@ export const CallToActionView = (props: ViewProps) => {
|
|
|
73
74
|
}, [nativeAd]);
|
|
74
75
|
|
|
75
76
|
return (
|
|
76
|
-
<TouchableOpacity
|
|
77
|
+
<TouchableOpacity>
|
|
77
78
|
<Text {...props} ref={callToActionRef}>
|
|
78
79
|
{nativeAd.callToAction || null}
|
|
79
80
|
</Text>
|
|
@@ -81,7 +82,7 @@ export const CallToActionView = (props: ViewProps) => {
|
|
|
81
82
|
);
|
|
82
83
|
};
|
|
83
84
|
|
|
84
|
-
export const IconView = (props: Omit<ImageProps,
|
|
85
|
+
export const IconView = (props: Omit<ImageProps, 'source'>) => {
|
|
85
86
|
const imageRef = useRef(null);
|
|
86
87
|
const { nativeAd, nativeAdView } = useContext(NativeAdViewContext);
|
|
87
88
|
|
|
@@ -93,10 +94,12 @@ export const IconView = (props: Omit<ImageProps, | 'source'>) => {
|
|
|
93
94
|
});
|
|
94
95
|
}, [nativeAd]);
|
|
95
96
|
|
|
96
|
-
return (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
return nativeAd.url ? (
|
|
98
|
+
<Image {...props} source={{ uri: nativeAd.url }} />
|
|
99
|
+
) : nativeAd.image ? (
|
|
100
|
+
<Image {...props} ref={imageRef} source={0} />
|
|
101
|
+
) : (
|
|
102
|
+
<View {...props} />
|
|
100
103
|
);
|
|
101
104
|
};
|
|
102
105
|
|
|
@@ -111,9 +114,7 @@ export const OptionsView = (props: ViewProps) => {
|
|
|
111
114
|
});
|
|
112
115
|
}, [nativeAd]);
|
|
113
116
|
|
|
114
|
-
return
|
|
115
|
-
<View {...props} ref={viewRef} />
|
|
116
|
-
);
|
|
117
|
+
return <View {...props} ref={viewRef} />;
|
|
117
118
|
};
|
|
118
119
|
|
|
119
120
|
export const MediaView = (props: ViewProps) => {
|
|
@@ -128,17 +129,15 @@ export const MediaView = (props: ViewProps) => {
|
|
|
128
129
|
});
|
|
129
130
|
}, [nativeAd]);
|
|
130
131
|
|
|
131
|
-
return
|
|
132
|
-
<View {...props} ref={viewRef} />
|
|
133
|
-
);
|
|
132
|
+
return <View {...props} ref={viewRef} />;
|
|
134
133
|
};
|
|
135
134
|
|
|
136
135
|
export const StarRatingView = (props: ViewProps) => {
|
|
137
136
|
const { style, ...restProps } = props;
|
|
138
137
|
|
|
139
138
|
const maxStarCount = 5;
|
|
140
|
-
const starColor = StyleSheet.flatten(style as StyleProp<TextStyle> || {}).color ??
|
|
141
|
-
const starSize = StyleSheet.flatten(style as StyleProp<TextStyle> || {}).fontSize ?? 10;
|
|
139
|
+
const starColor = StyleSheet.flatten((style as StyleProp<TextStyle>) || {}).color ?? '#ffe234';
|
|
140
|
+
const starSize = StyleSheet.flatten((style as StyleProp<TextStyle>) || {}).fontSize ?? 10;
|
|
142
141
|
|
|
143
142
|
const { nativeAd } = useContext(NativeAdViewContext);
|
|
144
143
|
|
|
@@ -159,23 +158,32 @@ export const StarRatingView = (props: ViewProps) => {
|
|
|
159
158
|
return (
|
|
160
159
|
<View {...restProps} style={[style, { flexDirection: 'row', alignItems: 'center' }]}>
|
|
161
160
|
{(() => {
|
|
162
|
-
|
|
161
|
+
const stars: ReactNode[] = [];
|
|
163
162
|
for (let index = 0; index < maxStarCount; index++) {
|
|
164
163
|
if (nativeAd.starRating) {
|
|
165
164
|
const width = (nativeAd.starRating - index) * starSize;
|
|
166
165
|
stars.push(
|
|
167
166
|
<View key={index}>
|
|
168
167
|
<EmptyStar />
|
|
169
|
-
{
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
{nativeAd.starRating > index && (
|
|
169
|
+
<View
|
|
170
|
+
style={{
|
|
171
|
+
width: width,
|
|
172
|
+
overflow: 'hidden',
|
|
173
|
+
position: 'absolute',
|
|
174
|
+
}}
|
|
175
|
+
>
|
|
172
176
|
<FilledStar />
|
|
173
177
|
</View>
|
|
174
|
-
}
|
|
178
|
+
)}
|
|
175
179
|
</View>
|
|
176
180
|
);
|
|
177
181
|
} else {
|
|
178
|
-
stars.push(
|
|
182
|
+
stars.push(
|
|
183
|
+
<Text key={index} style={{ fontSize: starSize }}>
|
|
184
|
+
{' '}
|
|
185
|
+
</Text>
|
|
186
|
+
);
|
|
179
187
|
}
|
|
180
188
|
}
|
|
181
189
|
return stars;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { useState, createContext } from
|
|
2
|
-
import type { NativeMethods } from
|
|
3
|
-
import type { NativeAd } from
|
|
4
|
-
import type { NativeAdViewProps } from
|
|
1
|
+
import React, { useState, createContext } from 'react';
|
|
2
|
+
import type { NativeMethods } from 'react-native';
|
|
3
|
+
import type { NativeAd } from '../types/NativeAd';
|
|
4
|
+
import type { NativeAdViewProps } from '../types/NativeAdViewProps';
|
|
5
5
|
|
|
6
6
|
export type NativeAdViewType = React.Component<NativeAdViewProps> & NativeMethods;
|
|
7
7
|
|
|
@@ -15,21 +15,23 @@ export type NativeAdViewContextType = {
|
|
|
15
15
|
export const NativeAdViewContext = createContext<NativeAdViewContextType>({
|
|
16
16
|
nativeAd: { isOptionsViewAvailable: false, isMediaViewAvailable: false },
|
|
17
17
|
nativeAdView: null,
|
|
18
|
-
setNativeAd: () => {
|
|
19
|
-
setNativeAdView: () => {
|
|
18
|
+
setNativeAd: () => {},
|
|
19
|
+
setNativeAdView: () => {},
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
export const NativeAdViewProvider: React.FC<{ children: React.ReactNode }> = (props) => {
|
|
23
|
-
const [nativeAd, setNativeAd] = useState({
|
|
23
|
+
const [nativeAd, setNativeAd] = useState({
|
|
24
|
+
isOptionsViewAvailable: false,
|
|
25
|
+
isMediaViewAvailable: false,
|
|
26
|
+
});
|
|
24
27
|
const [nativeAdView, setNativeAdView] = useState(Object);
|
|
25
28
|
|
|
26
29
|
const providerValue = {
|
|
27
|
-
nativeAd,
|
|
30
|
+
nativeAd,
|
|
31
|
+
nativeAdView,
|
|
32
|
+
setNativeAd,
|
|
33
|
+
setNativeAdView,
|
|
28
34
|
};
|
|
29
35
|
|
|
30
|
-
return
|
|
31
|
-
<NativeAdViewContext.Provider value={providerValue}>
|
|
32
|
-
{props.children}
|
|
33
|
-
</NativeAdViewContext.Provider>
|
|
34
|
-
);
|
|
36
|
+
return <NativeAdViewContext.Provider value={providerValue}>{props.children}</NativeAdViewContext.Provider>;
|
|
35
37
|
};
|
package/src/types/AdEvent.ts
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AdInfo,
|
|
3
|
-
AdLoadFailedInfo,
|
|
4
|
-
AdDisplayFailedInfo,
|
|
5
|
-
AdRevenueInfo,
|
|
6
|
-
AdRewardInfo
|
|
7
|
-
} from "./AdInfo";
|
|
1
|
+
import type { AdInfo, AdLoadFailedInfo, AdDisplayFailedInfo, AdRevenueInfo, AdRewardInfo } from './AdInfo';
|
|
8
2
|
|
|
9
|
-
export type AdEventObject =
|
|
10
|
-
AdInfo |
|
|
11
|
-
AdLoadFailedInfo |
|
|
12
|
-
AdDisplayFailedInfo |
|
|
13
|
-
AdRevenueInfo |
|
|
14
|
-
AdRewardInfo;
|
|
3
|
+
export type AdEventObject = AdInfo | AdLoadFailedInfo | AdDisplayFailedInfo | AdRevenueInfo | AdRewardInfo;
|
|
15
4
|
|
|
16
5
|
/**
|
|
17
6
|
* Defines a generic event listener for the pragrammatic methods to receive an event from the native
|
package/src/types/AdInfo.ts
CHANGED
|
@@ -2,24 +2,23 @@
|
|
|
2
2
|
* Represents an ad that has been served by AppLovin MAX.
|
|
3
3
|
*/
|
|
4
4
|
export type AdInfo = {
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* The ad unit ID for which this ad was loaded.
|
|
8
7
|
*/
|
|
9
8
|
adUnitId: string;
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
|
-
* The creative
|
|
13
|
-
* ad network using this
|
|
11
|
+
* The creative ID tied to the ad, if any. You can report creative issues to the corresponding
|
|
12
|
+
* ad network using this ID.
|
|
14
13
|
*
|
|
15
|
-
* @see {@link https://
|
|
14
|
+
* @see {@link https://support.applovin.com/hc/en-us/articles/13986039797389-Creative-Debugger#h_01HC10588YYDNZMS1GPCVRD2E7}
|
|
16
15
|
*/
|
|
17
16
|
creativeId?: string | null;
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
19
|
* The ad network from which this ad was loaded.
|
|
21
20
|
*
|
|
22
|
-
* @see {@link https://
|
|
21
|
+
* @see {@link https://support.applovin.com/hc/en-us/articles/13986039797389-Creative-Debugger#h_01HC10588YWTJHYE1E35HWQTX7}
|
|
23
22
|
*/
|
|
24
23
|
networkName: string;
|
|
25
24
|
|
|
@@ -31,12 +30,12 @@ export type AdInfo = {
|
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* The ad’s revenue amount. In the case where no revenue amount exists, or it is not available
|
|
34
|
-
* yet,
|
|
33
|
+
* yet, return 0.
|
|
35
34
|
*/
|
|
36
35
|
revenue: number;
|
|
37
36
|
|
|
38
37
|
/**
|
|
39
|
-
* The DSP network that
|
|
38
|
+
* The DSP network that provides the loaded ad when the ad is served through AppLovin Exchange.
|
|
40
39
|
*/
|
|
41
40
|
dspName?: string | null;
|
|
42
41
|
|
|
@@ -51,12 +50,10 @@ export type AdInfo = {
|
|
|
51
50
|
nativeAd?: AdNativeInfo | null;
|
|
52
51
|
};
|
|
53
52
|
|
|
54
|
-
|
|
55
53
|
/**
|
|
56
54
|
* Encapsulates various data for MAX load errors.
|
|
57
55
|
*/
|
|
58
56
|
export type AdLoadFailedInfo = {
|
|
59
|
-
|
|
60
57
|
/**
|
|
61
58
|
* The ad unit ID for which this ad was loaded.
|
|
62
59
|
*/
|
|
@@ -97,7 +94,6 @@ export type AdLoadFailedInfo = {
|
|
|
97
94
|
* Encapsulates various data for MAX display errors.
|
|
98
95
|
*/
|
|
99
96
|
export type AdDisplayFailedInfo = AdInfo & {
|
|
100
|
-
|
|
101
97
|
/**
|
|
102
98
|
* The error code for the error.
|
|
103
99
|
*/
|
|
@@ -123,7 +119,6 @@ export type AdDisplayFailedInfo = AdInfo & {
|
|
|
123
119
|
* Represents a reward given to the user.
|
|
124
120
|
*/
|
|
125
121
|
export type AdRewardInfo = AdInfo & {
|
|
126
|
-
|
|
127
122
|
/**
|
|
128
123
|
* The reward label.
|
|
129
124
|
*/
|
|
@@ -136,10 +131,9 @@ export type AdRewardInfo = AdInfo & {
|
|
|
136
131
|
};
|
|
137
132
|
|
|
138
133
|
/**
|
|
139
|
-
* Represents
|
|
134
|
+
* Represents revenue given to the publisher.
|
|
140
135
|
*/
|
|
141
136
|
export type AdRevenueInfo = AdInfo & {
|
|
142
|
-
|
|
143
137
|
/**
|
|
144
138
|
* The ad network placement for which this ad was loaded.
|
|
145
139
|
*/
|
|
@@ -158,7 +152,7 @@ export type AdRevenueInfo = AdInfo & {
|
|
|
158
152
|
revenuePrecision: string;
|
|
159
153
|
|
|
160
154
|
/**
|
|
161
|
-
* The current country code.
|
|
155
|
+
* The current country code where the ad was shown.
|
|
162
156
|
*/
|
|
163
157
|
countryCode: string;
|
|
164
158
|
};
|
|
@@ -167,49 +161,48 @@ export type AdRevenueInfo = AdInfo & {
|
|
|
167
161
|
* Represents a native ad.
|
|
168
162
|
*/
|
|
169
163
|
export type AdNativeInfo = {
|
|
170
|
-
|
|
171
164
|
/**
|
|
172
|
-
* The native ad title text.
|
|
165
|
+
* The native ad title text for {@link TitleView}.
|
|
173
166
|
*/
|
|
174
167
|
title?: string;
|
|
175
168
|
|
|
176
169
|
/**
|
|
177
|
-
* The native ad advertiser text.
|
|
170
|
+
* The native ad advertiser text for {@link AdvertiserView}.
|
|
178
171
|
*/
|
|
179
172
|
advertiser?: string;
|
|
180
173
|
|
|
181
174
|
/**
|
|
182
|
-
* The native ad body text.
|
|
175
|
+
* The native ad body text for {@link BodyView}}.
|
|
183
176
|
*/
|
|
184
177
|
body?: string;
|
|
185
178
|
|
|
186
179
|
/**
|
|
187
|
-
* The native ad CTA
|
|
180
|
+
* The native ad CTA (call to action) text for {@link CallToActionView}.
|
|
188
181
|
*/
|
|
189
182
|
callToAction?: string;
|
|
190
183
|
|
|
191
184
|
/**
|
|
192
|
-
* The star rating of the native ad.
|
|
185
|
+
* The star rating of the native ad in the [0.0, 5.0] range for {@link StarRatingView}, if provided by the network.
|
|
193
186
|
*/
|
|
194
187
|
starRating?: number;
|
|
195
188
|
|
|
196
189
|
/**
|
|
197
|
-
* The aspect ratio for
|
|
190
|
+
* The aspect ratio (width-to-height) for {@link MediaView} if provided by the network.
|
|
198
191
|
*/
|
|
199
192
|
mediaContentAspectRatio?: number;
|
|
200
193
|
|
|
201
194
|
/**
|
|
202
|
-
* Whether or not the
|
|
195
|
+
* Whether or not the content for {@link IconView} is available.
|
|
203
196
|
*/
|
|
204
197
|
isIconImageAvailable: boolean;
|
|
205
198
|
|
|
206
199
|
/**
|
|
207
|
-
* Whether or not the
|
|
200
|
+
* Whether or not the content for {@link OptionsView} is available.
|
|
208
201
|
*/
|
|
209
202
|
isOptionsViewAvailable: boolean;
|
|
210
203
|
|
|
211
204
|
/**
|
|
212
|
-
* Whether or not the
|
|
205
|
+
* Whether or not the content for {@link MediaView} is available.
|
|
213
206
|
*/
|
|
214
207
|
isMediaViewAvailable: boolean;
|
|
215
208
|
};
|
|
@@ -219,7 +212,6 @@ export type AdNativeInfo = {
|
|
|
219
212
|
* responses, etc.
|
|
220
213
|
*/
|
|
221
214
|
export type AdWaterfallInfo = {
|
|
222
|
-
|
|
223
215
|
/**
|
|
224
216
|
* The ad waterfall name.
|
|
225
217
|
*/
|
|
@@ -243,11 +235,10 @@ export type AdWaterfallInfo = {
|
|
|
243
235
|
};
|
|
244
236
|
|
|
245
237
|
/**
|
|
246
|
-
* This enum contains possible states of an ad in the waterfall
|
|
247
|
-
*
|
|
238
|
+
* This enum contains possible states of an ad in the waterfall.
|
|
239
|
+
* Each adapter response {@link AdNetworkResponseInfo} corresponds to one of these states.
|
|
248
240
|
*/
|
|
249
241
|
export enum AdLoadState {
|
|
250
|
-
|
|
251
242
|
/**
|
|
252
243
|
* The AppLovin MAX SDK did not attempt to load an ad from this network in the waterfall because
|
|
253
244
|
* an ad higher in the waterfall loaded successfully.
|
|
@@ -262,14 +253,13 @@ export enum AdLoadState {
|
|
|
262
253
|
/**
|
|
263
254
|
* An ad failed to load from this network.
|
|
264
255
|
*/
|
|
265
|
-
LoadStateAdFailedToLoad = 2
|
|
256
|
+
LoadStateAdFailedToLoad = 2,
|
|
266
257
|
}
|
|
267
258
|
|
|
268
259
|
/**
|
|
269
260
|
* Encapsulates load and display errors.
|
|
270
261
|
*/
|
|
271
262
|
export type AdErrorInfo = {
|
|
272
|
-
|
|
273
263
|
/**
|
|
274
264
|
* The error code for the error.
|
|
275
265
|
*/
|
|
@@ -290,9 +280,8 @@ export type AdErrorInfo = {
|
|
|
290
280
|
* This class represents an ad response in a waterfall.
|
|
291
281
|
*/
|
|
292
282
|
export type AdNetworkResponseInfo = {
|
|
293
|
-
|
|
294
283
|
/**
|
|
295
|
-
* The state of the ad that this object represents.
|
|
284
|
+
* The state of the ad that this object represents. For more info, see the {@link AdLoadState} enum.
|
|
296
285
|
*/
|
|
297
286
|
adLoadState: AdLoadState;
|
|
298
287
|
|
|
@@ -304,19 +293,19 @@ export type AdNetworkResponseInfo = {
|
|
|
304
293
|
/**
|
|
305
294
|
* The credentials used to load an ad from this adapter, as entered in the AppLovin MAX dashboard.
|
|
306
295
|
*/
|
|
307
|
-
credentials: { [key: string]:
|
|
296
|
+
credentials: { [key: string]: string | number | boolean | object | null };
|
|
308
297
|
|
|
309
298
|
/**
|
|
310
299
|
* 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.
|
|
312
|
-
* LoadStateAdFailedToLoad).
|
|
300
|
+
* load an ad has not been made or an ad was loaded successfully (i.e. {@link adLoadState}
|
|
301
|
+
* is NOT LoadStateAdFailedToLoad).
|
|
313
302
|
*/
|
|
314
303
|
error?: AdErrorInfo;
|
|
315
304
|
|
|
316
305
|
/**
|
|
317
|
-
* The amount of time the network took to load (either successfully or not) an ad, in
|
|
318
|
-
*
|
|
319
|
-
*
|
|
306
|
+
* The amount of time the network took to load (either successfully or not) an ad, in milliseconds.
|
|
307
|
+
* If an attempt to load an ad has not been made (i.e. {@link adLoadState} is LoadStateAdLoadNotAttempted),
|
|
308
|
+
* the value will be -1.
|
|
320
309
|
*/
|
|
321
310
|
latencyMillis: number;
|
|
322
311
|
};
|
|
@@ -325,7 +314,6 @@ export type AdNetworkResponseInfo = {
|
|
|
325
314
|
* This class represents information for a mediated network.
|
|
326
315
|
*/
|
|
327
316
|
export type AdMediatedNetworkInfo = {
|
|
328
|
-
|
|
329
317
|
/**
|
|
330
318
|
* The name of the mediated network.
|
|
331
319
|
*/
|