react-native-applovin-max 6.0.1 → 6.1.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/android/build.gradle +3 -3
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +127 -20
- package/ios/AppLovinMAX.m +154 -25
- 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 +58 -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 +58 -2
- package/src/RewardedAd.ts +31 -34
- package/src/TargetingData.ts +46 -35
- package/src/index.ts +12 -12
- package/src/nativeAd/NativeAdView.tsx +64 -55
- package/src/nativeAd/NativeAdViewComponents.tsx +38 -29
- package/src/nativeAd/NativeAdViewProvider.tsx +16 -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 +14 -8
- package/src/types/AppOpenAd.ts +1 -1
- package/src/types/BannerAd.ts +8 -9
- package/src/types/Configuration.ts +28 -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 +28 -16
- 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
- package/android/src/main/java/com/applovin/mediation/adapters/GoogleAdManagerMediationAdapter.java.saved +0 -1616
- package/android/src/main/java/com/applovin/mediation/adapters/GoogleMediationAdapter.java.old +0 -1788
- package/android/src/main/java/com/applovin/mediation/adapters/MintegralMediationAdapter.java.old +0 -1481
- package/android/src/main/java/com/applovin/mediation/adapters/MintegralMediationAdapter.java.saved +0 -1448
- package/ios/AppLovinMAX.xcworkspace/xcuserdata/hiroshi.watanabe.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { forwardRef, useContext, useImperativeHandle, useRef, useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import { NativeModules, requireNativeComponent, UIManager, findNodeHandle } from 'react-native';
|
|
4
|
+
import type { ViewProps } from 'react-native';
|
|
5
|
+
import { NativeAdViewContext, NativeAdViewProvider } from './NativeAdViewProvider';
|
|
6
|
+
import type { AdInfo, AdLoadFailedInfo, AdRevenueInfo } from '../types/AdInfo';
|
|
7
|
+
import type { AdNativeEvent } from '../types/AdEvent';
|
|
8
|
+
import type { NativeAd } from '../types/NativeAd';
|
|
9
|
+
import type { NativeAdViewHandler, NativeAdViewProps } from '../types/NativeAdViewProps';
|
|
10
|
+
import type { NativeAdViewType, NativeAdViewContextType } from './NativeAdViewProvider';
|
|
10
11
|
|
|
11
12
|
const { AppLovinMAX } = NativeModules;
|
|
12
13
|
|
|
13
14
|
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
|
|
15
|
+
onAdLoadedEvent(event: { nativeEvent: { nativeAd: NativeAd; adInfo: AdInfo } }): void;
|
|
16
|
+
onAdLoadFailedEvent(event: AdNativeEvent<AdLoadFailedInfo>): void;
|
|
17
|
+
onAdClickedEvent(event: AdNativeEvent<AdInfo>): void;
|
|
18
|
+
onAdRevenuePaidEvent(event: AdNativeEvent<AdRevenueInfo>): void;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewProps & NativeAdViewNativeEvents>(
|
|
21
|
+
const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewProps & NativeAdViewNativeEvents>(
|
|
22
|
+
'AppLovinMAXNativeAdView'
|
|
23
|
+
);
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* The {@link NativeAdView} component that you use building a native ad. This loads a native ad and
|
|
@@ -34,7 +37,7 @@ const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewPro
|
|
|
34
37
|
* {@link NativeAdView} fills each asset view with the data of a native ad as soon as it loads the native
|
|
35
38
|
* ad, but you need to provide the layout and style of the asset views.
|
|
36
39
|
* {@link NativeAdView} can reload a new native ad by using the ref handler.
|
|
37
|
-
*
|
|
40
|
+
*
|
|
38
41
|
* ### Example:
|
|
39
42
|
* ```js
|
|
40
43
|
* <NativeAdView
|
|
@@ -56,46 +59,52 @@ const NativeAdViewComponent = requireNativeComponent<NativeAdViewProps & ViewPro
|
|
|
56
59
|
* </NativeAdView>
|
|
57
60
|
* ```
|
|
58
61
|
*/
|
|
59
|
-
export const NativeAdView = forwardRef<NativeAdViewHandler, NativeAdViewProps & ViewProps>(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
export const NativeAdView = forwardRef<NativeAdViewHandler, NativeAdViewProps & ViewProps>(
|
|
63
|
+
function NativeAdView(props, ref) {
|
|
64
|
+
const [isInitialized, setIsInitialized] = useState<boolean>(false);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
// check that AppLovinMAX has been initialized
|
|
68
|
+
AppLovinMAX.isInitialized().then((result: boolean) => {
|
|
69
|
+
setIsInitialized(result);
|
|
70
|
+
if (!result) {
|
|
71
|
+
console.warn(
|
|
72
|
+
'NativeAdView is mounted before the initialization of the AppLovin MAX React Native module'
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}, []);
|
|
77
|
+
|
|
78
|
+
// Not ready to render NativeAdView
|
|
79
|
+
if (!isInitialized) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
71
82
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
return (
|
|
84
|
+
<NativeAdViewProvider>
|
|
85
|
+
<NativeAdViewImpl {...props} ref={ref} />
|
|
86
|
+
</NativeAdViewProvider>
|
|
87
|
+
);
|
|
75
88
|
}
|
|
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
|
-
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const NativeAdViewImpl = forwardRef<NativeAdViewHandler, NativeAdViewProps & ViewProps>(function NativeAdViewImpl(
|
|
92
|
+
{
|
|
93
|
+
adUnitId,
|
|
94
|
+
placement,
|
|
95
|
+
customData,
|
|
96
|
+
extraParameters,
|
|
97
|
+
localExtraParameters,
|
|
98
|
+
onAdLoaded,
|
|
99
|
+
onAdLoadFailed,
|
|
100
|
+
onAdClicked,
|
|
101
|
+
onAdRevenuePaid,
|
|
102
|
+
children,
|
|
103
|
+
style,
|
|
104
|
+
...otherProps
|
|
105
|
+
},
|
|
106
|
+
ref
|
|
107
|
+
) {
|
|
99
108
|
// context from NativeAdViewProvider
|
|
100
109
|
const { setNativeAd, setNativeAdView } = useContext(NativeAdViewContext) as NativeAdViewContextType;
|
|
101
110
|
|
|
@@ -107,7 +116,7 @@ const NativeAdViewImpl = forwardRef<NativeAdViewHandler, NativeAdViewProps & Vie
|
|
|
107
116
|
if (nativeAdViewRef) {
|
|
108
117
|
UIManager.dispatchViewManagerCommand(
|
|
109
118
|
findNodeHandle(nativeAdViewRef.current),
|
|
110
|
-
UIManager.getViewManagerConfig(
|
|
119
|
+
UIManager.getViewManagerConfig('AppLovinMAXNativeAdView').Commands.loadAd,
|
|
111
120
|
undefined
|
|
112
121
|
);
|
|
113
122
|
}
|
|
@@ -124,7 +133,7 @@ const NativeAdViewImpl = forwardRef<NativeAdViewHandler, NativeAdViewProps & Vie
|
|
|
124
133
|
}
|
|
125
134
|
}, []);
|
|
126
135
|
|
|
127
|
-
const onAdLoadedEvent = (event: { nativeEvent: { nativeAd: NativeAd; adInfo: AdInfo
|
|
136
|
+
const onAdLoadedEvent = (event: { nativeEvent: { nativeAd: NativeAd; adInfo: AdInfo } }) => {
|
|
128
137
|
setNativeAd(event.nativeEvent.nativeAd);
|
|
129
138
|
if (onAdLoaded) onAdLoaded(event.nativeEvent.adInfo);
|
|
130
139
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useContext, useRef, useEffect } from 'react';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { findNodeHandle, Text, Image, View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
5
|
+
import type { ViewProps, ImageProps, TextStyle, StyleProp, TextProps } from 'react-native';
|
|
6
|
+
import { NativeAdViewContext } from './NativeAdViewProvider';
|
|
7
|
+
|
|
8
|
+
export const TitleView = (props: TextProps) => {
|
|
7
9
|
const titleRef = useRef(null);
|
|
8
10
|
const { nativeAd, nativeAdView } = useContext(NativeAdViewContext);
|
|
9
11
|
|
|
@@ -22,7 +24,7 @@ export const TitleView = (props: ViewProps) => {
|
|
|
22
24
|
);
|
|
23
25
|
};
|
|
24
26
|
|
|
25
|
-
export const AdvertiserView = (props:
|
|
27
|
+
export const AdvertiserView = (props: TextProps) => {
|
|
26
28
|
const advertiserRef = useRef(null);
|
|
27
29
|
const { nativeAd, nativeAdView } = useContext(NativeAdViewContext);
|
|
28
30
|
|
|
@@ -41,7 +43,7 @@ export const AdvertiserView = (props: ViewProps) => {
|
|
|
41
43
|
);
|
|
42
44
|
};
|
|
43
45
|
|
|
44
|
-
export const BodyView = (props:
|
|
46
|
+
export const BodyView = (props: TextProps) => {
|
|
45
47
|
const bodyRef = useRef(null);
|
|
46
48
|
const { nativeAd, nativeAdView } = useContext(NativeAdViewContext);
|
|
47
49
|
|
|
@@ -60,7 +62,7 @@ export const BodyView = (props: ViewProps) => {
|
|
|
60
62
|
);
|
|
61
63
|
};
|
|
62
64
|
|
|
63
|
-
export const CallToActionView = (props:
|
|
65
|
+
export const CallToActionView = (props: TextProps) => {
|
|
64
66
|
const callToActionRef = useRef(null);
|
|
65
67
|
const { nativeAd, nativeAdView } = useContext(NativeAdViewContext);
|
|
66
68
|
|
|
@@ -73,7 +75,7 @@ export const CallToActionView = (props: ViewProps) => {
|
|
|
73
75
|
}, [nativeAd]);
|
|
74
76
|
|
|
75
77
|
return (
|
|
76
|
-
<TouchableOpacity
|
|
78
|
+
<TouchableOpacity>
|
|
77
79
|
<Text {...props} ref={callToActionRef}>
|
|
78
80
|
{nativeAd.callToAction || null}
|
|
79
81
|
</Text>
|
|
@@ -81,7 +83,7 @@ export const CallToActionView = (props: ViewProps) => {
|
|
|
81
83
|
);
|
|
82
84
|
};
|
|
83
85
|
|
|
84
|
-
export const IconView = (props: Omit<ImageProps,
|
|
86
|
+
export const IconView = (props: Omit<ImageProps, 'source'>) => {
|
|
85
87
|
const imageRef = useRef(null);
|
|
86
88
|
const { nativeAd, nativeAdView } = useContext(NativeAdViewContext);
|
|
87
89
|
|
|
@@ -93,10 +95,12 @@ export const IconView = (props: Omit<ImageProps, | 'source'>) => {
|
|
|
93
95
|
});
|
|
94
96
|
}, [nativeAd]);
|
|
95
97
|
|
|
96
|
-
return (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
return nativeAd.url ? (
|
|
99
|
+
<Image {...props} source={{ uri: nativeAd.url }} />
|
|
100
|
+
) : nativeAd.image ? (
|
|
101
|
+
<Image {...props} ref={imageRef} source={0} />
|
|
102
|
+
) : (
|
|
103
|
+
<View {...props} />
|
|
100
104
|
);
|
|
101
105
|
};
|
|
102
106
|
|
|
@@ -111,9 +115,7 @@ export const OptionsView = (props: ViewProps) => {
|
|
|
111
115
|
});
|
|
112
116
|
}, [nativeAd]);
|
|
113
117
|
|
|
114
|
-
return
|
|
115
|
-
<View {...props} ref={viewRef} />
|
|
116
|
-
);
|
|
118
|
+
return <View {...props} ref={viewRef} />;
|
|
117
119
|
};
|
|
118
120
|
|
|
119
121
|
export const MediaView = (props: ViewProps) => {
|
|
@@ -128,17 +130,15 @@ export const MediaView = (props: ViewProps) => {
|
|
|
128
130
|
});
|
|
129
131
|
}, [nativeAd]);
|
|
130
132
|
|
|
131
|
-
return
|
|
132
|
-
<View {...props} ref={viewRef} />
|
|
133
|
-
);
|
|
133
|
+
return <View {...props} ref={viewRef} />;
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
export const StarRatingView = (props: ViewProps) => {
|
|
137
137
|
const { style, ...restProps } = props;
|
|
138
138
|
|
|
139
139
|
const maxStarCount = 5;
|
|
140
|
-
const starColor = StyleSheet.flatten(style as StyleProp<TextStyle> || {}).color ??
|
|
141
|
-
const starSize = StyleSheet.flatten(style as StyleProp<TextStyle> || {}).fontSize ?? 10;
|
|
140
|
+
const starColor = StyleSheet.flatten((style as StyleProp<TextStyle>) || {}).color ?? '#ffe234';
|
|
141
|
+
const starSize = StyleSheet.flatten((style as StyleProp<TextStyle>) || {}).fontSize ?? 10;
|
|
142
142
|
|
|
143
143
|
const { nativeAd } = useContext(NativeAdViewContext);
|
|
144
144
|
|
|
@@ -159,23 +159,32 @@ export const StarRatingView = (props: ViewProps) => {
|
|
|
159
159
|
return (
|
|
160
160
|
<View {...restProps} style={[style, { flexDirection: 'row', alignItems: 'center' }]}>
|
|
161
161
|
{(() => {
|
|
162
|
-
|
|
162
|
+
const stars: ReactNode[] = [];
|
|
163
163
|
for (let index = 0; index < maxStarCount; index++) {
|
|
164
164
|
if (nativeAd.starRating) {
|
|
165
165
|
const width = (nativeAd.starRating - index) * starSize;
|
|
166
166
|
stars.push(
|
|
167
167
|
<View key={index}>
|
|
168
168
|
<EmptyStar />
|
|
169
|
-
{
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
{nativeAd.starRating > index && (
|
|
170
|
+
<View
|
|
171
|
+
style={{
|
|
172
|
+
width: width,
|
|
173
|
+
overflow: 'hidden',
|
|
174
|
+
position: 'absolute',
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
172
177
|
<FilledStar />
|
|
173
178
|
</View>
|
|
174
|
-
}
|
|
179
|
+
)}
|
|
175
180
|
</View>
|
|
176
181
|
);
|
|
177
182
|
} else {
|
|
178
|
-
stars.push(
|
|
183
|
+
stars.push(
|
|
184
|
+
<Text key={index} style={{ fontSize: starSize }}>
|
|
185
|
+
{' '}
|
|
186
|
+
</Text>
|
|
187
|
+
);
|
|
179
188
|
}
|
|
180
189
|
}
|
|
181
190
|
return stars;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useState, createContext } from 'react';
|
|
3
|
+
import type { NativeMethods } from 'react-native';
|
|
4
|
+
import type { NativeAd } from '../types/NativeAd';
|
|
5
|
+
import type { NativeAdViewProps } from '../types/NativeAdViewProps';
|
|
5
6
|
|
|
6
7
|
export type NativeAdViewType = React.Component<NativeAdViewProps> & NativeMethods;
|
|
7
8
|
|
|
@@ -15,21 +16,23 @@ export type NativeAdViewContextType = {
|
|
|
15
16
|
export const NativeAdViewContext = createContext<NativeAdViewContextType>({
|
|
16
17
|
nativeAd: { isOptionsViewAvailable: false, isMediaViewAvailable: false },
|
|
17
18
|
nativeAdView: null,
|
|
18
|
-
setNativeAd: () => {
|
|
19
|
-
setNativeAdView: () => {
|
|
19
|
+
setNativeAd: () => {},
|
|
20
|
+
setNativeAdView: () => {},
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
export const NativeAdViewProvider: React.FC<{ children: React.ReactNode }> = (props) => {
|
|
23
|
-
const [nativeAd, setNativeAd] = useState({
|
|
24
|
+
const [nativeAd, setNativeAd] = useState({
|
|
25
|
+
isOptionsViewAvailable: false,
|
|
26
|
+
isMediaViewAvailable: false,
|
|
27
|
+
});
|
|
24
28
|
const [nativeAdView, setNativeAdView] = useState(Object);
|
|
25
29
|
|
|
26
30
|
const providerValue = {
|
|
27
|
-
nativeAd,
|
|
31
|
+
nativeAd,
|
|
32
|
+
nativeAdView,
|
|
33
|
+
setNativeAd,
|
|
34
|
+
setNativeAdView,
|
|
28
35
|
};
|
|
29
36
|
|
|
30
|
-
return
|
|
31
|
-
<NativeAdViewContext.Provider value={providerValue}>
|
|
32
|
-
{props.children}
|
|
33
|
-
</NativeAdViewContext.Provider>
|
|
34
|
-
);
|
|
37
|
+
return <NativeAdViewContext.Provider value={providerValue}>{props.children}</NativeAdViewContext.Provider>;
|
|
35
38
|
};
|
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,23 +1,29 @@
|
|
|
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>;
|
|
20
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Sets a list of the ad units for the SDK to initialize only those networks.
|
|
22
|
+
*
|
|
23
|
+
* @param adUnitIds Ad units to be initialized with the SDK.
|
|
24
|
+
*/
|
|
25
|
+
setInitializationAdUnitIds(adUnitIds: string[]): void;
|
|
26
|
+
|
|
21
27
|
/**
|
|
22
28
|
* Presents the mediation debugger UI.
|
|
23
29
|
*/
|
|
@@ -31,7 +37,7 @@ export type AppLovinMAXType = {
|
|
|
31
37
|
/**
|
|
32
38
|
* Sets an ID for the current user. AppLovin ties this identifier to SDK events and AppLovin’s
|
|
33
39
|
* optional S2S postbacks.
|
|
34
|
-
*
|
|
40
|
+
*
|
|
35
41
|
* @param userId User id.
|
|
36
42
|
*/
|
|
37
43
|
setUserId(userId: string): void;
|
|
@@ -58,7 +64,7 @@ export type AppLovinMAXType = {
|
|
|
58
64
|
/**
|
|
59
65
|
* Enables devices to receive test ads by passing in the advertising identifier (IDFA) of each
|
|
60
66
|
* test device. Refer to AppLovin logs for the IDFA of your current device.
|
|
61
|
-
*
|
|
67
|
+
*
|
|
62
68
|
* @param advertisingIds A list of the advertising ids.
|
|
63
69
|
*/
|
|
64
70
|
setTestDeviceAdvertisingIds(advertisingIds: string[]): void;
|
|
@@ -72,7 +78,7 @@ export type AppLovinMAXType = {
|
|
|
72
78
|
|
|
73
79
|
/**
|
|
74
80
|
* Sets an extra parameter to pass to the AppLovin server.
|
|
75
|
-
*
|
|
81
|
+
*
|
|
76
82
|
* @param key Parameter key.
|
|
77
83
|
* @param value Parameter value.
|
|
78
84
|
*/
|
|
@@ -83,5 +89,5 @@ export type AppLovinMAXType = {
|
|
|
83
89
|
*
|
|
84
90
|
* @param enabled Defaults to true.
|
|
85
91
|
*/
|
|
86
|
-
setLocationCollectionEnabled(enabled: boolean):
|
|
92
|
+
setLocationCollectionEnabled(enabled: boolean): void;
|
|
87
93
|
};
|
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>;
|