react-native-applovin-max 8.1.1 → 9.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 (165) hide show
  1. package/android/build.gradle +14 -3
  2. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +33 -26
  3. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManagerImpl.java +110 -0
  4. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewUiComponent.java +17 -15
  5. package/android/src/main/java/com/applovin/reactnative/{AppLovinMAXModule.java → AppLovinMAXModuleImpl.java} +115 -179
  6. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdView.java +84 -56
  7. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdViewManagerImpl.java +101 -0
  8. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXPackage.java +44 -11
  9. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXUtils.java +56 -0
  10. package/android/src/newarch/com/applovin/reactnative/AppLovinMAXAdViewManager.java +151 -0
  11. package/android/src/newarch/com/applovin/reactnative/AppLovinMAXModule.java +453 -0
  12. package/android/src/newarch/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +130 -0
  13. package/android/src/oldarch/com/applovin/reactnative/AppLovinMAXAdViewManager.java +128 -0
  14. package/android/src/oldarch/com/applovin/reactnative/AppLovinMAXModule.java +453 -0
  15. package/android/src/oldarch/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +93 -0
  16. package/ios/AppLovinMAX.h +8 -8
  17. package/ios/{AppLovinMAX.m → AppLovinMAX.mm} +73 -64
  18. package/ios/AppLovinMAXAdView.h +7 -2
  19. package/ios/AppLovinMAXAdView.mm +747 -0
  20. package/ios/{AppLovinMAXAdViewManager.m → AppLovinMAXAdViewManager.mm} +3 -2
  21. package/ios/{AppLovinMAXAdViewUIComponent.m → AppLovinMAXAdViewUIComponent.mm} +2 -1
  22. package/ios/AppLovinMAXNativeAdView.h +15 -4
  23. package/ios/AppLovinMAXNativeAdView.mm +745 -0
  24. package/ios/AppLovinMAXNativeAdViewManager.mm +116 -0
  25. package/lib/commonjs/AdView.js +67 -85
  26. package/lib/commonjs/AdView.js.map +1 -1
  27. package/lib/commonjs/AppLovinMAX.js +51 -10
  28. package/lib/commonjs/AppLovinMAX.js.map +1 -1
  29. package/lib/commonjs/AppOpenAd.js +8 -10
  30. package/lib/commonjs/AppOpenAd.js.map +1 -1
  31. package/lib/commonjs/BannerAd.js +19 -21
  32. package/lib/commonjs/BannerAd.js.map +1 -1
  33. package/lib/commonjs/ErrorCode.js +57 -5
  34. package/lib/commonjs/ErrorCode.js.map +1 -1
  35. package/lib/commonjs/EventEmitter.js +3 -5
  36. package/lib/commonjs/EventEmitter.js.map +1 -1
  37. package/lib/commonjs/InterstitialAd.js +8 -10
  38. package/lib/commonjs/InterstitialAd.js.map +1 -1
  39. package/lib/commonjs/MRecAd.js +14 -16
  40. package/lib/commonjs/MRecAd.js.map +1 -1
  41. package/lib/commonjs/Privacy.js +3 -5
  42. package/lib/commonjs/Privacy.js.map +1 -1
  43. package/lib/commonjs/RewardedAd.js +8 -10
  44. package/lib/commonjs/RewardedAd.js.map +1 -1
  45. package/lib/commonjs/Utils.js +25 -0
  46. package/lib/commonjs/Utils.js.map +1 -0
  47. package/lib/commonjs/nativeAd/NativeAdView.js +65 -42
  48. package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
  49. package/lib/commonjs/nativeAd/NativeAdViewComponents.js +51 -47
  50. package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
  51. package/lib/commonjs/nativeAd/NativeAdViewProvider.js +38 -8
  52. package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
  53. package/lib/commonjs/nativeAd/img/blank_icon.png +0 -0
  54. package/lib/commonjs/specs/AppLovinMAXAdViewNativeComponent.js +14 -0
  55. package/lib/commonjs/specs/AppLovinMAXAdViewNativeComponent.js.map +1 -0
  56. package/lib/commonjs/specs/AppLovinMAXNativeAdViewNativeComponent.js +14 -0
  57. package/lib/commonjs/specs/AppLovinMAXNativeAdViewNativeComponent.js.map +1 -0
  58. package/lib/commonjs/specs/NativeAppLovinMAXModule.js +9 -0
  59. package/lib/commonjs/specs/NativeAppLovinMAXModule.js.map +1 -0
  60. package/lib/commonjs/types/AdInfo.js +10 -3
  61. package/lib/commonjs/types/AdInfo.js.map +1 -1
  62. package/lib/module/AdView.js +62 -81
  63. package/lib/module/AdView.js.map +1 -1
  64. package/lib/module/AppLovinMAX.js +47 -7
  65. package/lib/module/AppLovinMAX.js.map +1 -1
  66. package/lib/module/AppOpenAd.js +1 -4
  67. package/lib/module/AppOpenAd.js.map +1 -1
  68. package/lib/module/BannerAd.js +1 -4
  69. package/lib/module/BannerAd.js.map +1 -1
  70. package/lib/module/ErrorCode.js +55 -4
  71. package/lib/module/ErrorCode.js.map +1 -1
  72. package/lib/module/EventEmitter.js +2 -4
  73. package/lib/module/EventEmitter.js.map +1 -1
  74. package/lib/module/InterstitialAd.js +2 -5
  75. package/lib/module/InterstitialAd.js.map +1 -1
  76. package/lib/module/MRecAd.js +1 -4
  77. package/lib/module/MRecAd.js.map +1 -1
  78. package/lib/module/Privacy.js +1 -4
  79. package/lib/module/Privacy.js.map +1 -1
  80. package/lib/module/RewardedAd.js +2 -5
  81. package/lib/module/RewardedAd.js.map +1 -1
  82. package/lib/module/Utils.js +17 -0
  83. package/lib/module/Utils.js.map +1 -0
  84. package/lib/module/nativeAd/NativeAdView.js +63 -40
  85. package/lib/module/nativeAd/NativeAdView.js.map +1 -1
  86. package/lib/module/nativeAd/NativeAdViewComponents.js +53 -49
  87. package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
  88. package/lib/module/nativeAd/NativeAdViewProvider.js +39 -9
  89. package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -1
  90. package/lib/module/nativeAd/img/blank_icon.png +0 -0
  91. package/lib/module/specs/AppLovinMAXAdViewNativeComponent.js +7 -0
  92. package/lib/module/specs/AppLovinMAXAdViewNativeComponent.js.map +1 -0
  93. package/lib/module/specs/AppLovinMAXNativeAdViewNativeComponent.js +7 -0
  94. package/lib/module/specs/AppLovinMAXNativeAdViewNativeComponent.js.map +1 -0
  95. package/lib/module/specs/NativeAppLovinMAXModule.js +3 -0
  96. package/lib/module/specs/NativeAppLovinMAXModule.js.map +1 -0
  97. package/lib/module/types/AdInfo.js +10 -4
  98. package/lib/module/types/AdInfo.js.map +1 -1
  99. package/lib/typescript/src/AdView.d.ts +16 -16
  100. package/lib/typescript/src/AdView.d.ts.map +1 -1
  101. package/lib/typescript/src/AppLovinMAX.d.ts.map +1 -1
  102. package/lib/typescript/src/AppOpenAd.d.ts.map +1 -1
  103. package/lib/typescript/src/BannerAd.d.ts.map +1 -1
  104. package/lib/typescript/src/ErrorCode.d.ts.map +1 -1
  105. package/lib/typescript/src/EventEmitter.d.ts.map +1 -1
  106. package/lib/typescript/src/InterstitialAd.d.ts.map +1 -1
  107. package/lib/typescript/src/MRecAd.d.ts.map +1 -1
  108. package/lib/typescript/src/Privacy.d.ts.map +1 -1
  109. package/lib/typescript/src/RewardedAd.d.ts.map +1 -1
  110. package/lib/typescript/src/Utils.d.ts +16 -0
  111. package/lib/typescript/src/Utils.d.ts.map +1 -0
  112. package/lib/typescript/src/nativeAd/NativeAdView.d.ts.map +1 -1
  113. package/lib/typescript/src/nativeAd/NativeAdViewComponents.d.ts +1 -1
  114. package/lib/typescript/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
  115. package/lib/typescript/src/nativeAd/NativeAdViewProvider.d.ts +14 -5
  116. package/lib/typescript/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
  117. package/lib/typescript/src/specs/AppLovinMAXAdViewNativeComponent.d.ts +86 -0
  118. package/lib/typescript/src/specs/AppLovinMAXAdViewNativeComponent.d.ts.map +1 -0
  119. package/lib/typescript/src/specs/AppLovinMAXNativeAdViewNativeComponent.d.ts +80 -0
  120. package/lib/typescript/src/specs/AppLovinMAXNativeAdViewNativeComponent.d.ts.map +1 -0
  121. package/lib/typescript/src/specs/NativeAppLovinMAXModule.d.ts +132 -0
  122. package/lib/typescript/src/specs/NativeAppLovinMAXModule.d.ts.map +1 -0
  123. package/lib/typescript/src/types/AdEvent.d.ts +2 -2
  124. package/lib/typescript/src/types/AdEvent.d.ts.map +1 -1
  125. package/lib/typescript/src/types/AdInfo.d.ts +24 -25
  126. package/lib/typescript/src/types/AdInfo.d.ts.map +1 -1
  127. package/lib/typescript/src/types/AdProps.d.ts +4 -4
  128. package/lib/typescript/src/types/AdProps.d.ts.map +1 -1
  129. package/lib/typescript/src/types/FullscreenAd.d.ts +4 -4
  130. package/lib/typescript/src/types/FullscreenAd.d.ts.map +1 -1
  131. package/lib/typescript/src/types/NativeAd.d.ts +4 -0
  132. package/lib/typescript/src/types/NativeAd.d.ts.map +1 -1
  133. package/lib/typescript/src/types/ViewAd.d.ts +4 -4
  134. package/lib/typescript/src/types/ViewAd.d.ts.map +1 -1
  135. package/package.json +9 -1
  136. package/react-native-applovin-max.podspec +3 -3
  137. package/src/AdView.tsx +56 -121
  138. package/src/AppLovinMAX.ts +7 -8
  139. package/src/AppOpenAd.ts +3 -5
  140. package/src/BannerAd.ts +3 -5
  141. package/src/ErrorCode.ts +1 -3
  142. package/src/EventEmitter.ts +2 -3
  143. package/src/InterstitialAd.ts +4 -6
  144. package/src/MRecAd.ts +3 -5
  145. package/src/Privacy.ts +1 -3
  146. package/src/RewardedAd.ts +4 -6
  147. package/src/Utils.ts +26 -0
  148. package/src/nativeAd/NativeAdView.tsx +65 -65
  149. package/src/nativeAd/NativeAdViewComponents.tsx +32 -60
  150. package/src/nativeAd/NativeAdViewProvider.tsx +37 -12
  151. package/src/nativeAd/img/blank_icon.png +0 -0
  152. package/src/specs/AppLovinMAXAdViewNativeComponent.ts +96 -0
  153. package/src/specs/AppLovinMAXNativeAdViewNativeComponent.ts +89 -0
  154. package/src/specs/NativeAppLovinMAXModule.ts +208 -0
  155. package/src/types/AdEvent.ts +2 -2
  156. package/src/types/AdInfo.ts +28 -28
  157. package/src/types/AdProps.ts +4 -4
  158. package/src/types/FullscreenAd.ts +4 -4
  159. package/src/types/NativeAd.ts +5 -0
  160. package/src/types/ViewAd.ts +4 -4
  161. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManager.java +0 -149
  162. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +0 -163
  163. package/ios/AppLovinMAXAdView.m +0 -323
  164. package/ios/AppLovinMAXNativeAdView.m +0 -432
  165. package/ios/AppLovinMAXNativeAdViewManager.m +0 -64
@@ -0,0 +1,89 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import type { Double, DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
3
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
4
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
5
+
6
+ export type AdInfoEvent = Readonly<{
7
+ adUnitId: string;
8
+ adFormat: string;
9
+ networkName: string;
10
+ networkPlacement: string;
11
+ creativeId?: string | null;
12
+ placement?: string | null;
13
+ revenue: Double;
14
+ revenuePrecision: string;
15
+ latencyMillis: Double;
16
+ dspName?: string | null;
17
+ size: Readonly<{
18
+ width: Double;
19
+ height: Double;
20
+ }>;
21
+ nativeAd?: Readonly<{
22
+ title?: string;
23
+ advertiser?: string;
24
+ body?: string;
25
+ callToAction?: string;
26
+ starRating?: Double;
27
+ mediaContentAspectRatio?: Double;
28
+ isIconImageAvailable: boolean;
29
+ isOptionsViewAvailable: boolean;
30
+ isMediaViewAvailable: boolean;
31
+ }>;
32
+ nativeAdImpl: Readonly<{
33
+ title?: string | null;
34
+ advertiser?: string | null;
35
+ body?: string | null;
36
+ callToAction?: string | null;
37
+ image?: boolean;
38
+ imageSource?: string | null;
39
+ url?: string;
40
+ starRating?: Double;
41
+ isOptionsViewAvailable: boolean;
42
+ isMediaViewAvailable: boolean;
43
+ }>;
44
+ }>;
45
+
46
+ export type AdLoadFailedEvent = Readonly<{
47
+ adUnitId: string;
48
+ code: Double;
49
+ message?: string | null;
50
+ mediatedNetworkErrorCode: Double;
51
+ mediatedNetworkErrorMessage: string;
52
+ adLoadFailureInfo?: string | null;
53
+ }>;
54
+
55
+ export interface NativeProps extends ViewProps {
56
+ adUnitId: string;
57
+ placement?: string | null;
58
+ customData?: string | null;
59
+ extraParameters?: ReadonlyArray<{
60
+ key: string;
61
+ value: string | null;
62
+ }> | null;
63
+ strLocalExtraParameters?: ReadonlyArray<{
64
+ key: string;
65
+ value: string | null;
66
+ }> | null;
67
+ boolLocalExtraParameters?: ReadonlyArray<{
68
+ key: string;
69
+ value: boolean | null;
70
+ }> | null;
71
+ onAdLoadedEvent: DirectEventHandler<AdInfoEvent>;
72
+ onAdLoadFailedEvent: DirectEventHandler<AdLoadFailedEvent>;
73
+ onAdClickedEvent: DirectEventHandler<AdInfoEvent>;
74
+ onAdRevenuePaidEvent: DirectEventHandler<AdInfoEvent>;
75
+ }
76
+
77
+ type AppLovinMAXNativeAdViewNativeComponentType = HostComponent<NativeProps>;
78
+
79
+ interface NativeCommands {
80
+ loadAd: (viewRef: React.ElementRef<AppLovinMAXNativeAdViewNativeComponentType>) => void;
81
+ updateAssetView: (viewRef: React.ElementRef<AppLovinMAXNativeAdViewNativeComponentType>, assetViewTag: Double, assetViewName: string) => void;
82
+ renderNativeAd: (viewRef: React.ElementRef<AppLovinMAXNativeAdViewNativeComponentType>) => void;
83
+ }
84
+
85
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
86
+ supportedCommands: ['loadAd', 'updateAssetView', 'renderNativeAd'],
87
+ });
88
+
89
+ export default codegenNativeComponent<NativeProps>('AppLovinMAXNativeAdView') as HostComponent<NativeProps>;
@@ -0,0 +1,208 @@
1
+ import { TurboModuleRegistry } from 'react-native';
2
+ import type { TurboModule } from 'react-native';
3
+ import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
4
+ import type { Configuration } from '../types';
5
+ import type { CMPError } from '../types';
6
+ import type { AdViewId } from '../types';
7
+
8
+ export interface Spec extends TurboModule {
9
+ readonly getConstants: () => {
10
+ ON_INTERSTITIAL_LOADED_EVENT: string;
11
+ ON_INTERSTITIAL_LOAD_FAILED_EVENT: string;
12
+ ON_INTERSTITIAL_CLICKED_EVENT: string;
13
+ ON_INTERSTITIAL_DISPLAYED_EVENT: string;
14
+ ON_INTERSTITIAL_AD_FAILED_TO_DISPLAY_EVENT: string;
15
+ ON_INTERSTITIAL_HIDDEN_EVENT: string;
16
+ ON_INTERSTITIAL_AD_REVENUE_PAID: string;
17
+ ON_REWARDED_AD_LOADED_EVENT: string;
18
+ ON_REWARDED_AD_LOAD_FAILED_EVENT: string;
19
+ ON_REWARDED_AD_CLICKED_EVENT: string;
20
+ ON_REWARDED_AD_DISPLAYED_EVENT: string;
21
+ ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT: string;
22
+ ON_REWARDED_AD_HIDDEN_EVENT: string;
23
+ ON_REWARDED_AD_RECEIVED_REWARD_EVENT: string;
24
+ ON_REWARDED_AD_REVENUE_PAID: string;
25
+ ON_BANNER_AD_LOADED_EVENT: string;
26
+ ON_BANNER_AD_LOAD_FAILED_EVENT: string;
27
+ ON_BANNER_AD_CLICKED_EVENT: string;
28
+ ON_BANNER_AD_COLLAPSED_EVENT: string;
29
+ ON_BANNER_AD_EXPANDED_EVENT: string;
30
+ ON_BANNER_AD_REVENUE_PAID: string;
31
+ ON_MREC_AD_LOADED_EVENT: string;
32
+ ON_MREC_AD_LOAD_FAILED_EVENT: string;
33
+ ON_MREC_AD_CLICKED_EVENT: string;
34
+ ON_MREC_AD_COLLAPSED_EVENT: string;
35
+ ON_MREC_AD_EXPANDED_EVENT: string;
36
+ ON_MREC_AD_REVENUE_PAID: string;
37
+ ON_APPOPEN_AD_LOADED_EVENT: string;
38
+ ON_APPOPEN_AD_LOAD_FAILED_EVENT: string;
39
+ ON_APPOPEN_AD_CLICKED_EVENT: string;
40
+ ON_APPOPEN_AD_DISPLAYED_EVENT: string;
41
+ ON_APPOPEN_AD_FAILED_TO_DISPLAY_EVENT: string;
42
+ ON_APPOPEN_AD_HIDDEN_EVENT: string;
43
+ ON_APPOPEN_AD_REVENUE_PAID: string;
44
+ ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT: string;
45
+ ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT: string;
46
+ MAX_ERROR_CODE_UNSPECIFIED: number;
47
+ MAX_ERROR_CODE_NO_FILL: number;
48
+ MAX_ERROR_CODE_AD_LOAD_FAILED: number;
49
+ MAX_ERROR_CODE_AD_DISPLAY_FAILED: number;
50
+ MAX_ERROR_CODE_NETWORK_ERROR: number;
51
+ MAX_ERROR_CODE_NETWORK_TIMEOUT: number;
52
+ MAX_ERROR_CODE_NO_NETWORK: number;
53
+ MAX_ERROR_CODE_FULLSCREEN_AD_ALREADY_SHOWING: number;
54
+ MAX_ERROR_CODE_FULLSCREEN_AD_NOT_READY: number;
55
+ MAX_ERROR_CODE_FULLSCREEN_AD_INVALID_VIEW_CONTROLLER: number;
56
+ MAX_ERROR_CODE_DONT_KEEP_ACTIVITIES_ENABLED: number;
57
+ MAX_ERROR_CODE_INVALID_AD_UNIT_ID: number;
58
+ };
59
+
60
+ isInitialized(): Promise<boolean>;
61
+
62
+ initialize(pluginVersion: string, sdkKey: string): Promise<Configuration>;
63
+
64
+ isTablet(): Promise<boolean>;
65
+
66
+ showMediationDebugger(): void;
67
+
68
+ setHasUserConsent(hasUserConsent: boolean): void;
69
+
70
+ hasUserConsent(): Promise<boolean>;
71
+
72
+ setDoNotSell(doNotSell: boolean): void;
73
+
74
+ isDoNotSell(): Promise<boolean>;
75
+
76
+ setUserId(userId: string): void;
77
+
78
+ setMuted(muted: boolean): void;
79
+
80
+ isMuted(): Promise<boolean>;
81
+
82
+ setVerboseLogging(enabled: boolean): void;
83
+
84
+ setCreativeDebuggerEnabled(enabled: boolean): void;
85
+
86
+ setTestDeviceAdvertisingIds(ids: string[]): void;
87
+
88
+ setExtraParameter(key: string, value: string | null): void;
89
+
90
+ setInitializationAdUnitIds(adUnitIds: string[]): void;
91
+
92
+ setTermsAndPrivacyPolicyFlowEnabled(enabled: boolean): void;
93
+
94
+ setPrivacyPolicyUrl(url: string): void;
95
+
96
+ setTermsOfServiceUrl(url: string): void;
97
+
98
+ setConsentFlowDebugUserGeography(userGeography: string): void;
99
+
100
+ showCmpForExistingUser(): Promise<CMPError | null>;
101
+
102
+ hasSupportedCmp(): Promise<boolean>;
103
+
104
+ addSegment(key: number, values: number[]): Promise<void>;
105
+
106
+ getSegments(): Promise<{ [key: string]: number[] } | null>;
107
+
108
+ createBanner(adUnitId: string, position: string): void;
109
+
110
+ createBannerWithOffsets(adUnitId: string, position: string, xOffset: number, yOffset: number): void;
111
+
112
+ setBannerBackgroundColor(adUnitId: string, hexColorCode: string): void;
113
+
114
+ setBannerPlacement(adUnitId: string, placement: string | null): void;
115
+
116
+ setBannerCustomData(adUnitId: string, customData: string | null): void;
117
+
118
+ setBannerWidth(adUnitId: string, width: number): void;
119
+
120
+ updateBannerPosition(adUnitId: string, position: string): void;
121
+
122
+ updateBannerOffsets(adUnitId: string, xOffset: number, yOffset: number): void;
123
+
124
+ setBannerExtraParameter(adUnitId: string, key: string, value: string | null): void;
125
+
126
+ setBannerLocalExtraParameter(adUnitId: string, parameters: UnsafeObject): void;
127
+
128
+ startBannerAutoRefresh(adUnitId: string): void;
129
+
130
+ stopBannerAutoRefresh(adUnitId: string): void;
131
+
132
+ showBanner(adUnitId: string): void;
133
+
134
+ hideBanner(adUnitId: string): void;
135
+
136
+ destroyBanner(adUnitId: string): void;
137
+
138
+ getAdaptiveBannerHeightForWidth(width: number): Promise<number>;
139
+
140
+ createMRec(adUnitId: string, position: string): void;
141
+
142
+ setMRecPlacement(adUnitId: string, placement: string | null): void;
143
+
144
+ setMRecCustomData(adUnitId: string, customData: string | null): void;
145
+
146
+ updateMRecPosition(adUnitId: string, position: string): void;
147
+
148
+ setMRecExtraParameter(adUnitId: string, key: string, value: string | null): void;
149
+
150
+ setMRecLocalExtraParameter(adUnitId: string, parameters: UnsafeObject): void;
151
+
152
+ startMRecAutoRefresh(adUnitId: string): void;
153
+
154
+ stopMRecAutoRefresh(adUnitId: string): void;
155
+
156
+ showMRec(adUnitId: string): void;
157
+
158
+ hideMRec(adUnitId: string): void;
159
+
160
+ destroyMRec(adUnitId: string): void;
161
+
162
+ loadInterstitial(adUnitId: string): void;
163
+
164
+ isInterstitialReady(adUnitId: string): Promise<boolean>;
165
+
166
+ showInterstitial(adUnitId: string, placement?: string | null, customData?: string | null): void;
167
+
168
+ setInterstitialExtraParameter(adUnitId: string, key: string, value: string | null): void;
169
+
170
+ setInterstitialLocalExtraParameter(adUnitId: string, parameters: UnsafeObject): void;
171
+
172
+ loadRewardedAd(adUnitId: string): void;
173
+
174
+ isRewardedAdReady(adUnitId: string): Promise<boolean>;
175
+
176
+ showRewardedAd(adUnitId: string, placement?: string | null, customData?: string | null): void;
177
+
178
+ setRewardedAdExtraParameter(adUnitId: string, key: string, value: string | null): void;
179
+
180
+ setRewardedAdLocalExtraParameter(adUnitId: string, parameters: UnsafeObject): void;
181
+
182
+ loadAppOpenAd(adUnitId: string): void;
183
+
184
+ isAppOpenAdReady(adUnitId: string): Promise<boolean>;
185
+
186
+ showAppOpenAd(adUnitId: string, placement?: string | null, customData?: string | null): void;
187
+
188
+ setAppOpenAdExtraParameter(adUnitId: string, key: string, value: string | null): void;
189
+
190
+ setAppOpenAdLocalExtraParameter(adUnitId: string, parameters: UnsafeObject): void;
191
+
192
+ preloadNativeUIComponentAdView(
193
+ adUnitId: string,
194
+ adFormat: string,
195
+ placement?: string | null,
196
+ customData?: string | null,
197
+ extraParameters?: UnsafeObject | null,
198
+ localExtraParameters?: UnsafeObject | null
199
+ ): Promise<AdViewId>;
200
+
201
+ destroyNativeUIComponentAdView(adViewId: number): Promise<void>;
202
+
203
+ addListener(eventType: string): void;
204
+
205
+ removeListeners(count: number): void;
206
+ }
207
+
208
+ export default TurboModuleRegistry.getEnforcing<Spec>('AppLovinMAX');
@@ -1,6 +1,6 @@
1
- import type { AdInfo, AdLoadFailedInfo, AdDisplayFailedInfo, AdRevenueInfo, AdRewardInfo } from './AdInfo';
1
+ import type { AdInfo, AdLoadFailedInfo, AdDisplayFailedInfo, AdRewardInfo } from './AdInfo';
2
2
 
3
- export type AdEventObject = AdInfo | AdLoadFailedInfo | AdDisplayFailedInfo | AdRevenueInfo | AdRewardInfo;
3
+ export type AdEventObject = AdInfo | AdLoadFailedInfo | AdDisplayFailedInfo | AdRewardInfo;
4
4
 
5
5
  /**
6
6
  * Defines a generic event listener for the pragrammatic methods to receive an event from the native
@@ -10,6 +10,11 @@ export type AdInfo = {
10
10
  */
11
11
  adUnitId: string;
12
12
 
13
+ /**
14
+ * The format of this ad.
15
+ */
16
+ adFormat: string;
17
+
13
18
  /**
14
19
  * The unique ID of the native UI component AdView.
15
20
  */
@@ -30,6 +35,11 @@ export type AdInfo = {
30
35
  */
31
36
  networkName: string;
32
37
 
38
+ /**
39
+ * The ad network placement for which this ad was loaded.
40
+ */
41
+ networkPlacement: string;
42
+
33
43
  /**
34
44
  * The placement name that you assign when you integrate each ad format, for granular reporting
35
45
  * in postbacks.
@@ -42,15 +52,32 @@ export type AdInfo = {
42
52
  */
43
53
  revenue: number;
44
54
 
55
+ /**
56
+ * The precision of the revenue value for this ad.
57
+ *
58
+ * Possible values are:
59
+ * - "publisher_defined" - If the revenue is the price assigned to the line item by the publisher.
60
+ * - "exact" - If the revenue is the resulting price of a real-time auction.
61
+ * - "estimated" - If the revenue is the price obtained by auto-CPM.
62
+ * - "undefined" - If we do not have permission from the ad network to share impression-level data.
63
+ * - "" - An empty string, if revenue and precision are not valid (for example, in test mode).
64
+ */
65
+ revenuePrecision: string;
66
+
45
67
  /**
46
68
  * The DSP network that provides the loaded ad when the ad is served through AppLovin Exchange.
47
69
  */
48
70
  dspName?: string | null;
49
71
 
72
+ /**
73
+ * The latency of the mediation ad load request in milliseconds.
74
+ */
75
+ latencyMillis: number;
76
+
50
77
  /**
51
78
  * The underlying waterfall of ad responses.
52
79
  */
53
- waterfall: AdWaterfallInfo;
80
+ waterfall?: AdWaterfallInfo;
54
81
 
55
82
  /**
56
83
  * The native ad info.
@@ -151,33 +178,6 @@ export type AdRewardInfo = AdInfo & {
151
178
  rewardAmount: string;
152
179
  };
153
180
 
154
- /**
155
- * Represents revenue given to the publisher.
156
- */
157
- export type AdRevenueInfo = AdInfo & {
158
- /**
159
- * The ad network placement for which this ad was loaded.
160
- */
161
- networkPlacement: string;
162
-
163
- /**
164
- * The precision of the revenue value for this ad.
165
- *
166
- * Possible values are:
167
- * - "publisher_defined" - If the revenue is the price assigned to the line item by the publisher.
168
- * - "exact" - If the revenue is the resulting price of a real-time auction.
169
- * - "estimated" - If the revenue is the price obtained by auto-CPM.
170
- * - "undefined" - If we do not have permission from the ad network to share impression-level data.
171
- * - "" - An empty string, if revenue and precision are not valid (for example, in test mode).
172
- */
173
- revenuePrecision: string;
174
-
175
- /**
176
- * The current country code where the ad was shown.
177
- */
178
- countryCode: string;
179
- };
180
-
181
181
  /**
182
182
  * Represents a native ad.
183
183
  */
@@ -1,4 +1,4 @@
1
- import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo } from './AdInfo';
1
+ import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo } from './AdInfo';
2
2
 
3
3
  /**
4
4
  * Local extra parameters can be of type: string, number, boolean, array, map, and null.
@@ -29,13 +29,13 @@ export type AdProps = {
29
29
  * A dictionary value representing the extra parameters to set a list of key-value string pairs
30
30
  * for the ad.
31
31
  */
32
- extraParameters?: { [key: string]: string | null };
32
+ extraParameters?: { [key: string]: string };
33
33
 
34
34
  /**
35
35
  * A dictionary value representing the local extra parameters to set a list of key-value pairs
36
36
  * to pass to the adapter instances.
37
37
  */
38
- localExtraParameters?: { [key: string]: LocalExtraParameterValue };
38
+ localExtraParameters?: { [key: string]: string | boolean };
39
39
 
40
40
  /**
41
41
  * A callback fuction that {@link AdView} or {@link NativeAdView} fires when it loads a new ad.
@@ -60,5 +60,5 @@ export type AdProps = {
60
60
  /**
61
61
  * A callback fuction that {@link AdView} or {@link NativeAdView} fires when it pays ad revenue to the publisher.
62
62
  */
63
- onAdRevenuePaid?: (adInfo: AdRevenueInfo) => void;
63
+ onAdRevenuePaid?: (adInfo: AdInfo) => void;
64
64
  };
@@ -1,5 +1,5 @@
1
1
  import type { AdEventListener } from './AdEvent';
2
- import type { AdInfo, AdLoadFailedInfo, AdRevenueInfo, AdDisplayFailedInfo } from './AdInfo';
2
+ import type { AdInfo, AdLoadFailedInfo, AdDisplayFailedInfo } from './AdInfo';
3
3
  import type { LocalExtraParameterValue } from './AdProps';
4
4
 
5
5
  /**
@@ -126,15 +126,15 @@ export type FullscreenAdType = {
126
126
  removeAdHiddenEventListener(): void;
127
127
 
128
128
  /**
129
- * Adds the specified event listener to receive {@link AdRevenueInfo} when a full-screen ad
129
+ * Adds the specified event listener to receive {@link AdInfo} when a full-screen ad
130
130
  * pays ad revenue to the publisher.
131
131
  *
132
132
  * @param listener Listener to be notified.
133
133
  */
134
- addAdRevenuePaidListener(listener: AdEventListener<AdRevenueInfo>): void;
134
+ addAdRevenuePaidListener(listener: AdEventListener<AdInfo>): void;
135
135
 
136
136
  /**
137
- * Removes the event listener to receive {@link AdRevenueInfo} when a full-screen ad pays
137
+ * Removes the event listener to receive {@link AdInfo} when a full-screen ad pays
138
138
  * ad revenue to the publisher.
139
139
  */
140
140
  removeAdRevenuePaidListener(): void;
@@ -27,6 +27,11 @@ export type NativeAd = {
27
27
  */
28
28
  image?: boolean;
29
29
 
30
+ /**
31
+ * The data of the icon.
32
+ */
33
+ imageSource?: string | null;
34
+
30
35
  /**
31
36
  * The URL string of the icon.
32
37
  */
@@ -1,5 +1,5 @@
1
1
  import type { AdEventListener } from './AdEvent';
2
- import type { AdInfo, AdLoadFailedInfo, AdRevenueInfo } from './AdInfo';
2
+ import type { AdInfo, AdLoadFailedInfo } from './AdInfo';
3
3
  import type { LocalExtraParameterValue } from './AdProps';
4
4
  import type { AdViewPosition } from '../AdView';
5
5
 
@@ -147,15 +147,15 @@ export type ViewAdType = {
147
147
  removeAdExpandedEventListener(): void;
148
148
 
149
149
  /**
150
- * Adds the specified event listener to receive {@link AdRevenueInfo} when a view-base ad pays
150
+ * Adds the specified event listener to receive {@link AdInfo} when a view-base ad pays
151
151
  * ad revenue to the publisher.
152
152
  *
153
153
  * @param listener Listener to be notified.
154
154
  */
155
- addAdRevenuePaidListener(listener: AdEventListener<AdRevenueInfo>): void;
155
+ addAdRevenuePaidListener(listener: AdEventListener<AdInfo>): void;
156
156
 
157
157
  /**
158
- * Removes the event listener to receive {@link AdRevenueInfo} when when a view-base ad pays ad
158
+ * Removes the event listener to receive {@link AdInfo} when when a view-base ad pays ad
159
159
  * revenue to the publisher.
160
160
  */
161
161
  removeAdRevenuePaidListener(): void;
@@ -1,149 +0,0 @@
1
- package com.applovin.reactnative;
2
-
3
- import com.facebook.react.bridge.ReadableArray;
4
- import com.facebook.react.bridge.ReadableMap;
5
- import com.facebook.react.common.MapBuilder;
6
- import com.facebook.react.uimanager.SimpleViewManager;
7
- import com.facebook.react.uimanager.ThemedReactContext;
8
- import com.facebook.react.uimanager.annotations.ReactProp;
9
-
10
- import java.util.Map;
11
-
12
- import androidx.annotation.NonNull;
13
- import androidx.annotation.Nullable;
14
-
15
- /**
16
- * Created by Thomas So on September 26 2020
17
- */
18
- class AppLovinMAXAdViewManager
19
- extends SimpleViewManager<AppLovinMAXAdView>
20
- {
21
- private static final int COMMAND_LOAD_AD = 1;
22
-
23
- public AppLovinMAXAdViewManager() { }
24
-
25
- @NonNull
26
- @Override
27
- public String getName()
28
- {
29
- return "AppLovinMAXAdView";
30
- }
31
-
32
- @Nullable
33
- @Override
34
- public Map<String, Object> getExportedCustomDirectEventTypeConstants()
35
- {
36
- // mapping Android events to JavaScript events
37
- return MapBuilder.<String, Object>builder()
38
- .put( AppLovinMAXAdEvents.ON_AD_LOADED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_LOADED_EVENT ) )
39
- .put( AppLovinMAXAdEvents.ON_AD_LOAD_FAILED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_LOAD_FAILED_EVENT ) )
40
- .put( AppLovinMAXAdEvents.ON_AD_DISPLAY_FAILED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_DISPLAY_FAILED_EVENT ) )
41
- .put( AppLovinMAXAdEvents.ON_AD_CLICKED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_CLICKED_EVENT ) )
42
- .put( AppLovinMAXAdEvents.ON_AD_EXPANDED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_EXPANDED_EVENT ) )
43
- .put( AppLovinMAXAdEvents.ON_AD_COLLAPSED_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_COLLAPSED_EVENT ) )
44
- .put( AppLovinMAXAdEvents.ON_AD_REVENUE_PAID_EVENT, MapBuilder.of( "registrationName", AppLovinMAXAdEvents.ON_AD_REVENUE_PAID_EVENT ) )
45
- .build();
46
- }
47
-
48
- @Nullable
49
- @Override
50
- public Map<String, Integer> getCommandsMap()
51
- {
52
- return MapBuilder.of(
53
- "loadAd", COMMAND_LOAD_AD
54
- );
55
- }
56
-
57
- @Override
58
- public void receiveCommand(@NonNull final AppLovinMAXAdView view, final int commandId, @Nullable final ReadableArray args)
59
- {
60
- if ( commandId == COMMAND_LOAD_AD )
61
- {
62
- view.loadAd();
63
- }
64
- }
65
-
66
- @NonNull
67
- @Override
68
- protected AppLovinMAXAdView createViewInstance(@NonNull final ThemedReactContext reactContext)
69
- {
70
- // NOTE: Do not set frame or backgroundColor as RN will overwrite the values set by your custom class in order to match your JavaScript component's layout props - hence wrapper
71
- return new AppLovinMAXAdView( reactContext );
72
- }
73
-
74
- @ReactProp(name = "adUnitId")
75
- public void setAdUnitId(final AppLovinMAXAdView view, final String adUnitId)
76
- {
77
- view.setAdUnitId( adUnitId );
78
- }
79
-
80
- @ReactProp(name = "adFormat")
81
- public void setAdFormat(final AppLovinMAXAdView view, final String adFormatStr)
82
- {
83
- view.setAdFormat( adFormatStr );
84
- }
85
-
86
- @ReactProp(name = "adViewId")
87
- public void setAdFormat(final AppLovinMAXAdView view, final int adViewId)
88
- {
89
- view.setAdViewId( adViewId );
90
- }
91
-
92
- @ReactProp(name = "placement")
93
- public void setPlacement(final AppLovinMAXAdView view, @Nullable final String placement)
94
- {
95
- view.setPlacement( placement );
96
- }
97
-
98
- @ReactProp(name = "customData")
99
- public void setCustomData(final AppLovinMAXAdView view, @Nullable final String customData)
100
- {
101
- view.setCustomData( customData );
102
- }
103
-
104
- @ReactProp(name = "adaptiveBannerEnabled")
105
- public void setAdaptiveBannerEnabled(final AppLovinMAXAdView view, final boolean enabled)
106
- {
107
- view.setAdaptiveBannerEnabled( enabled );
108
- }
109
-
110
- @ReactProp(name = "autoRefresh")
111
- public void setAutoRefresh(final AppLovinMAXAdView view, final boolean enabled)
112
- {
113
- view.setAutoRefreshEnabled( enabled );
114
- }
115
-
116
- @ReactProp(name = "loadOnMount")
117
- public void setLoadOnMount(final AppLovinMAXAdView view, final boolean enabled)
118
- {
119
- view.setLoadOnMount( enabled );
120
- }
121
-
122
- @ReactProp(name = "extraParameters")
123
- public void setExtraParameters(final AppLovinMAXAdView view, @Nullable final ReadableMap value)
124
- {
125
- view.setExtraParameters( value );
126
- }
127
-
128
- @ReactProp(name = "localExtraParameters")
129
- public void setLocalExtraParameters(final AppLovinMAXAdView view, @Nullable final ReadableMap value)
130
- {
131
- view.setLocalExtraParameters( value );
132
- }
133
-
134
- @Override
135
- public void onAfterUpdateTransaction(@NonNull final AppLovinMAXAdView view)
136
- {
137
- super.onAfterUpdateTransaction( view );
138
-
139
- view.onSetProps();
140
- }
141
-
142
- @Override
143
- public void onDropViewInstance(AppLovinMAXAdView view)
144
- {
145
- view.destroy();
146
-
147
- super.onDropViewInstance( view );
148
- }
149
- }