react-native-applovin-max 6.0.1 → 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 +4 -4
- package/package.json +5 -1
- package/react-native-applovin-max.podspec +2 -2
- package/src/AdView.tsx +55 -43
- 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 +34 -23
- package/src/index.ts +12 -12
- package/src/nativeAd/NativeAdView.tsx +63 -55
- 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 +6 -18
- package/src/types/AdProps.ts +7 -3
- package/src/types/AdViewProps.ts +4 -5
- package/src/types/AppLovinMAX.ts +7 -8
- package/src/types/AppOpenAd.ts +1 -1
- package/src/types/BannerAd.ts +8 -9
- package/src/types/Configuration.ts +1 -3
- package/src/types/FullscreenAd.ts +19 -19
- 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 +7 -13
- package/src/types/RewardedAd.ts +4 -5
- package/src/types/TargetingData.ts +1 -2
- package/src/types/ViewAd.ts +20 -20
- package/src/types/index.ts +4 -4
|
@@ -1,23 +1,25 @@
|
|
|
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
25
|
* The {@link NativeAdView} component that you use building a native ad. This loads a native ad and
|
|
@@ -34,7 +36,7 @@ const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewPro
|
|
|
34
36
|
* {@link NativeAdView} fills each asset view with the data of a native ad as soon as it loads the native
|
|
35
37
|
* ad, but you need to provide the layout and style of the asset views.
|
|
36
38
|
* {@link NativeAdView} can reload a new native ad by using the ref handler.
|
|
37
|
-
*
|
|
39
|
+
*
|
|
38
40
|
* ### Example:
|
|
39
41
|
* ```js
|
|
40
42
|
* <NativeAdView
|
|
@@ -56,46 +58,52 @@ const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewPro
|
|
|
56
58
|
* </NativeAdView>
|
|
57
59
|
* ```
|
|
58
60
|
*/
|
|
59
|
-
export const NativeAdView = forwardRef<NativeAdViewHandler, NativeAdViewProps & ViewProps>(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
+
}
|
|
71
81
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
return (
|
|
83
|
+
<NativeAdViewProvider>
|
|
84
|
+
<NativeAdViewImpl {...props} ref={ref} />
|
|
85
|
+
</NativeAdViewProvider>
|
|
86
|
+
);
|
|
75
87
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
style,
|
|
96
|
-
...otherProps
|
|
97
|
-
}, ref) => {
|
|
98
|
-
|
|
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
|
+
) {
|
|
99
107
|
// context from NativeAdViewProvider
|
|
100
108
|
const { setNativeAd, setNativeAdView } = useContext(NativeAdViewContext) as NativeAdViewContextType;
|
|
101
109
|
|
|
@@ -107,7 +115,7 @@ const NativeAdViewImpl = forwardRef<NativeAdViewHandler, NativeAdViewProps & Vie
|
|
|
107
115
|
if (nativeAdViewRef) {
|
|
108
116
|
UIManager.dispatchViewManagerCommand(
|
|
109
117
|
findNodeHandle(nativeAdViewRef.current),
|
|
110
|
-
UIManager.getViewManagerConfig(
|
|
118
|
+
UIManager.getViewManagerConfig('AppLovinMAXNativeAdView').Commands.loadAd,
|
|
111
119
|
undefined
|
|
112
120
|
);
|
|
113
121
|
}
|
|
@@ -124,7 +132,7 @@ const NativeAdViewImpl = forwardRef<NativeAdViewHandler, NativeAdViewProps & Vie
|
|
|
124
132
|
}
|
|
125
133
|
}, []);
|
|
126
134
|
|
|
127
|
-
const onAdLoadedEvent = (event: { nativeEvent: { nativeAd: NativeAd; adInfo: AdInfo
|
|
135
|
+
const onAdLoadedEvent = (event: { nativeEvent: { nativeAd: NativeAd; adInfo: AdInfo } }) => {
|
|
128
136
|
setNativeAd(event.nativeEvent.nativeAd);
|
|
129
137
|
if (onAdLoaded) onAdLoaded(event.nativeEvent.adInfo);
|
|
130
138
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, { useContext, useRef, useEffect
|
|
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,7 +2,6 @@
|
|
|
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
|
*/
|
|
@@ -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
|
*/
|
|
@@ -139,7 +134,6 @@ export type AdRewardInfo = AdInfo & {
|
|
|
139
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
|
*/
|
|
@@ -167,7 +161,6 @@ export type AdRevenueInfo = AdInfo & {
|
|
|
167
161
|
* Represents a native ad.
|
|
168
162
|
*/
|
|
169
163
|
export type AdNativeInfo = {
|
|
170
|
-
|
|
171
164
|
/**
|
|
172
165
|
* The native ad title text for {@link TitleView}.
|
|
173
166
|
*/
|
|
@@ -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.
|
|
238
|
+
* This enum contains possible states of an ad in the waterfall.
|
|
247
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,7 +280,6 @@ 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
284
|
* The state of the ad that this object represents. For more info, see the {@link AdLoadState} enum.
|
|
296
285
|
*/
|
|
@@ -304,18 +293,18 @@ 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. {@link adLoadState}
|
|
300
|
+
* load an ad has not been made or an ad was loaded successfully (i.e. {@link adLoadState}
|
|
312
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 milliseconds.
|
|
318
|
-
* If an attempt to load an ad has not been made (i.e. {@link adLoadState} is LoadStateAdLoadNotAttempted),
|
|
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),
|
|
319
308
|
* the value will be -1.
|
|
320
309
|
*/
|
|
321
310
|
latencyMillis: number;
|
|
@@ -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
|
*/
|
package/src/types/AdProps.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo } from
|
|
1
|
+
import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo } from './AdInfo';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Local extra parameters can be of type: string, number, boolean, array, map, and null.
|
|
5
|
+
*/
|
|
6
|
+
export type LocalExtraParameterValue = string | number | boolean | object | null;
|
|
2
7
|
|
|
3
8
|
/**
|
|
4
9
|
* Defines the base properties for the UI component ads i.e {@link Adview} and {@link NativeAdView}.
|
|
5
10
|
*/
|
|
6
11
|
export type AdProps = {
|
|
7
|
-
|
|
8
12
|
/**
|
|
9
13
|
* A string value representing the ad unit ID to load ads for.
|
|
10
14
|
*/
|
|
@@ -31,7 +35,7 @@ export type AdProps = {
|
|
|
31
35
|
* A dictionary value representing the local extra parameters to set a list of key-value pairs
|
|
32
36
|
* to pass to the adapter instances.
|
|
33
37
|
*/
|
|
34
|
-
localExtraParameters?: { [key: string]:
|
|
38
|
+
localExtraParameters?: { [key: string]: LocalExtraParameterValue };
|
|
35
39
|
|
|
36
40
|
/**
|
|
37
41
|
* A callback fuction that {@link Adview} or {@link NativeAdView} fires when it loads a new ad.
|
package/src/types/AdViewProps.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { AdProps } from
|
|
2
|
-
import type { AdInfo } from
|
|
3
|
-
import type { AdFormat } from
|
|
1
|
+
import type { AdProps } from './AdProps';
|
|
2
|
+
import type { AdInfo } from './AdInfo';
|
|
3
|
+
import type { AdFormat } from '../AdView';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents an {@link AdView} - Banner / MREC.
|
|
7
7
|
*/
|
|
8
8
|
export type AdViewProps = AdProps & {
|
|
9
|
-
|
|
10
9
|
/**
|
|
11
|
-
* An enum value representing the ad format to load ads for. Should be either
|
|
10
|
+
* An enum value representing the ad format to load ads for. Should be either
|
|
12
11
|
* {@link AdFormat.BANNER} or {@link AdFormat.MREC}.
|
|
13
12
|
*/
|
|
14
13
|
adFormat: AdFormat;
|
package/src/types/AppLovinMAX.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import type { Configuration } from
|
|
1
|
+
import type { Configuration } from './Configuration';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents the AppLovinMAX module.
|
|
5
5
|
*/
|
|
6
6
|
export type AppLovinMAXType = {
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
|
-
* Indicates whether or not the AppLovinMAX SDK has fully initialized without errors and
|
|
8
|
+
* Indicates whether or not the AppLovinMAX SDK has fully initialized without errors and
|
|
10
9
|
* {@link AppLovinMAX.initialize()} has called the completion callback.
|
|
11
10
|
*/
|
|
12
11
|
isInitialized(): Promise<boolean>;
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Initializes the AppLovinMAX SDK, and returns {@link Configuration} when it finishes initializing.
|
|
16
|
-
*
|
|
15
|
+
*
|
|
17
16
|
* @param sdkKey SDK key to use for the instance of the AppLovinMAX SDK.
|
|
18
17
|
*/
|
|
19
18
|
initialize(sdkKey: string): Promise<Configuration>;
|
|
@@ -31,7 +30,7 @@ export type AppLovinMAXType = {
|
|
|
31
30
|
/**
|
|
32
31
|
* Sets an ID for the current user. AppLovin ties this identifier to SDK events and AppLovin’s
|
|
33
32
|
* optional S2S postbacks.
|
|
34
|
-
*
|
|
33
|
+
*
|
|
35
34
|
* @param userId User id.
|
|
36
35
|
*/
|
|
37
36
|
setUserId(userId: string): void;
|
|
@@ -58,7 +57,7 @@ export type AppLovinMAXType = {
|
|
|
58
57
|
/**
|
|
59
58
|
* Enables devices to receive test ads by passing in the advertising identifier (IDFA) of each
|
|
60
59
|
* test device. Refer to AppLovin logs for the IDFA of your current device.
|
|
61
|
-
*
|
|
60
|
+
*
|
|
62
61
|
* @param advertisingIds A list of the advertising ids.
|
|
63
62
|
*/
|
|
64
63
|
setTestDeviceAdvertisingIds(advertisingIds: string[]): void;
|
|
@@ -72,7 +71,7 @@ export type AppLovinMAXType = {
|
|
|
72
71
|
|
|
73
72
|
/**
|
|
74
73
|
* Sets an extra parameter to pass to the AppLovin server.
|
|
75
|
-
*
|
|
74
|
+
*
|
|
76
75
|
* @param key Parameter key.
|
|
77
76
|
* @param value Parameter value.
|
|
78
77
|
*/
|
|
@@ -83,5 +82,5 @@ export type AppLovinMAXType = {
|
|
|
83
82
|
*
|
|
84
83
|
* @param enabled Defaults to true.
|
|
85
84
|
*/
|
|
86
|
-
setLocationCollectionEnabled(enabled: boolean):
|
|
85
|
+
setLocationCollectionEnabled(enabled: boolean): void;
|
|
87
86
|
};
|
package/src/types/AppOpenAd.ts
CHANGED
package/src/types/BannerAd.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { ViewAdType } from
|
|
2
|
-
import type { AdViewPosition } from
|
|
1
|
+
import type { ViewAdType } from './ViewAd';
|
|
2
|
+
import type { AdViewPosition } from '../AdView';
|
|
3
3
|
|
|
4
4
|
export type BannerAdType = ViewAdType & {
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Creates a banner at the specified position and offsets.
|
|
8
|
-
*
|
|
7
|
+
*
|
|
9
8
|
* @param adUnitId The Ad Unit ID to load ads for.
|
|
10
9
|
* @param position {@ AdViewPosition} position.
|
|
11
10
|
* @param xOffset Horizontal offset from the left position.
|
|
@@ -14,8 +13,8 @@ export type BannerAdType = ViewAdType & {
|
|
|
14
13
|
createAd(adUnitId: string, position: AdViewPosition, xOffset?: number, yOffset?: number): void;
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
|
-
* Sets a background color for the banner.
|
|
18
|
-
*
|
|
16
|
+
* Sets a background color for the banner.
|
|
17
|
+
*
|
|
19
18
|
* @param adUnitId The Ad Unit ID to load ads for.
|
|
20
19
|
* @param hexColorCode Hexadecimal color (#rrggbb).
|
|
21
20
|
*/
|
|
@@ -23,7 +22,7 @@ export type BannerAdType = ViewAdType & {
|
|
|
23
22
|
|
|
24
23
|
/**
|
|
25
24
|
* Sets the banner width.
|
|
26
|
-
*
|
|
25
|
+
*
|
|
27
26
|
* @param adUnitId The Ad Unit ID to load ads for.
|
|
28
27
|
* @param width The desired banner width.
|
|
29
28
|
*/
|
|
@@ -31,7 +30,7 @@ export type BannerAdType = ViewAdType & {
|
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* Updates the banner position offsets.
|
|
34
|
-
*
|
|
33
|
+
*
|
|
35
34
|
* @param adUnitId The Ad Unit ID to load ads for.
|
|
36
35
|
* @param xOffset Horizontal offset from the left position.
|
|
37
36
|
* @param yOffset Vertical offset from the top position.
|
|
@@ -40,7 +39,7 @@ export type BannerAdType = ViewAdType & {
|
|
|
40
39
|
|
|
41
40
|
/**
|
|
42
41
|
* Gets the adaptive banner size for the provided width at the current orientation.
|
|
43
|
-
*
|
|
42
|
+
*
|
|
44
43
|
* @param width The banner width.
|
|
45
44
|
*/
|
|
46
45
|
getAdaptiveHeightForWidth(width: number): Promise<number>;
|