react-native-applovin-max 9.0.0 → 9.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.
Files changed (132) hide show
  1. package/android/build.gradle +3 -3
  2. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +1 -1
  3. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModuleImpl.java +2 -1
  4. package/ios/AppLovinMAX.mm +2 -1
  5. package/lib/commonjs/AdView.js +60 -76
  6. package/lib/commonjs/AdView.js.map +1 -1
  7. package/lib/commonjs/AppLovinMAX.js +43 -29
  8. package/lib/commonjs/AppLovinMAX.js.map +1 -1
  9. package/lib/commonjs/ErrorCode.js +24 -31
  10. package/lib/commonjs/ErrorCode.js.map +1 -1
  11. package/lib/commonjs/EventEmitter.js +22 -1
  12. package/lib/commonjs/EventEmitter.js.map +1 -1
  13. package/lib/commonjs/Utils.js +22 -4
  14. package/lib/commonjs/Utils.js.map +1 -1
  15. package/lib/commonjs/nativeAd/NativeAdView.js +33 -22
  16. package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
  17. package/lib/commonjs/nativeAd/NativeAdViewComponents.js +84 -41
  18. package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
  19. package/lib/commonjs/nativeAd/NativeAdViewProvider.js +29 -0
  20. package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
  21. package/lib/commonjs/specs/AppLovinMAXAdViewNativeComponent.js +27 -0
  22. package/lib/commonjs/specs/AppLovinMAXAdViewNativeComponent.js.map +1 -1
  23. package/lib/commonjs/specs/AppLovinMAXNativeAdViewNativeComponent.js +23 -0
  24. package/lib/commonjs/specs/AppLovinMAXNativeAdViewNativeComponent.js.map +1 -1
  25. package/lib/commonjs/specs/NativeAppLovinMAXModule.js +7 -0
  26. package/lib/commonjs/specs/NativeAppLovinMAXModule.js.map +1 -1
  27. package/lib/commonjs/types/AdInfo.js +13 -16
  28. package/lib/commonjs/types/AdInfo.js.map +1 -1
  29. package/lib/module/AdView.js +60 -76
  30. package/lib/module/AdView.js.map +1 -1
  31. package/lib/module/AppLovinMAX.js +44 -29
  32. package/lib/module/AppLovinMAX.js.map +1 -1
  33. package/lib/module/ErrorCode.js +24 -31
  34. package/lib/module/ErrorCode.js.map +1 -1
  35. package/lib/module/EventEmitter.js +22 -1
  36. package/lib/module/EventEmitter.js.map +1 -1
  37. package/lib/module/Utils.js +22 -4
  38. package/lib/module/Utils.js.map +1 -1
  39. package/lib/module/nativeAd/NativeAdView.js +34 -21
  40. package/lib/module/nativeAd/NativeAdView.js.map +1 -1
  41. package/lib/module/nativeAd/NativeAdViewComponents.js +87 -40
  42. package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
  43. package/lib/module/nativeAd/NativeAdViewProvider.js +30 -0
  44. package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -1
  45. package/lib/module/specs/AppLovinMAXAdViewNativeComponent.js +28 -0
  46. package/lib/module/specs/AppLovinMAXAdViewNativeComponent.js.map +1 -1
  47. package/lib/module/specs/AppLovinMAXNativeAdViewNativeComponent.js +24 -0
  48. package/lib/module/specs/AppLovinMAXNativeAdViewNativeComponent.js.map +1 -1
  49. package/lib/module/specs/NativeAppLovinMAXModule.js +9 -0
  50. package/lib/module/specs/NativeAppLovinMAXModule.js.map +1 -1
  51. package/lib/module/types/AdInfo.js +13 -16
  52. package/lib/module/types/AdInfo.js.map +1 -1
  53. package/lib/typescript/src/AdView.d.ts +27 -21
  54. package/lib/typescript/src/AdView.d.ts.map +1 -1
  55. package/lib/typescript/src/AppLovinMAX.d.ts +22 -21
  56. package/lib/typescript/src/AppLovinMAX.d.ts.map +1 -1
  57. package/lib/typescript/src/ErrorCode.d.ts +24 -31
  58. package/lib/typescript/src/ErrorCode.d.ts.map +1 -1
  59. package/lib/typescript/src/EventEmitter.d.ts +16 -0
  60. package/lib/typescript/src/EventEmitter.d.ts.map +1 -1
  61. package/lib/typescript/src/Utils.d.ts +15 -0
  62. package/lib/typescript/src/Utils.d.ts.map +1 -1
  63. package/lib/typescript/src/nativeAd/NativeAdView.d.ts +15 -7
  64. package/lib/typescript/src/nativeAd/NativeAdView.d.ts.map +1 -1
  65. package/lib/typescript/src/nativeAd/NativeAdViewComponents.d.ts +65 -1
  66. package/lib/typescript/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
  67. package/lib/typescript/src/nativeAd/NativeAdViewProvider.d.ts +17 -0
  68. package/lib/typescript/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
  69. package/lib/typescript/src/specs/AppLovinMAXAdViewNativeComponent.d.ts +45 -1
  70. package/lib/typescript/src/specs/AppLovinMAXAdViewNativeComponent.d.ts.map +1 -1
  71. package/lib/typescript/src/specs/AppLovinMAXNativeAdViewNativeComponent.d.ts +57 -6
  72. package/lib/typescript/src/specs/AppLovinMAXNativeAdViewNativeComponent.d.ts.map +1 -1
  73. package/lib/typescript/src/specs/NativeAppLovinMAXModule.d.ts +10 -0
  74. package/lib/typescript/src/specs/NativeAppLovinMAXModule.d.ts.map +1 -1
  75. package/lib/typescript/src/types/AdEvent.d.ts +10 -4
  76. package/lib/typescript/src/types/AdEvent.d.ts.map +1 -1
  77. package/lib/typescript/src/types/AdInfo.d.ts +78 -85
  78. package/lib/typescript/src/types/AdInfo.d.ts.map +1 -1
  79. package/lib/typescript/src/types/AdProps.d.ts +14 -15
  80. package/lib/typescript/src/types/AdProps.d.ts.map +1 -1
  81. package/lib/typescript/src/types/AdViewProps.d.ts +28 -29
  82. package/lib/typescript/src/types/AdViewProps.d.ts.map +1 -1
  83. package/lib/typescript/src/types/AppLovinMAX.d.ts +50 -53
  84. package/lib/typescript/src/types/AppLovinMAX.d.ts.map +1 -1
  85. package/lib/typescript/src/types/BannerAd.d.ts +22 -17
  86. package/lib/typescript/src/types/BannerAd.d.ts.map +1 -1
  87. package/lib/typescript/src/types/CMPError.d.ts +7 -4
  88. package/lib/typescript/src/types/CMPError.d.ts.map +1 -1
  89. package/lib/typescript/src/types/Configuration.d.ts +12 -14
  90. package/lib/typescript/src/types/Configuration.d.ts.map +1 -1
  91. package/lib/typescript/src/types/FullscreenAd.d.ts +39 -46
  92. package/lib/typescript/src/types/FullscreenAd.d.ts.map +1 -1
  93. package/lib/typescript/src/types/MRecAd.d.ts +7 -3
  94. package/lib/typescript/src/types/MRecAd.d.ts.map +1 -1
  95. package/lib/typescript/src/types/NativeAd.d.ts +12 -11
  96. package/lib/typescript/src/types/NativeAd.d.ts.map +1 -1
  97. package/lib/typescript/src/types/NativeAdViewProps.d.ts +4 -3
  98. package/lib/typescript/src/types/NativeAdViewProps.d.ts.map +1 -1
  99. package/lib/typescript/src/types/Privacy.d.ts +13 -6
  100. package/lib/typescript/src/types/Privacy.d.ts.map +1 -1
  101. package/lib/typescript/src/types/RewardedAd.d.ts +7 -5
  102. package/lib/typescript/src/types/RewardedAd.d.ts.map +1 -1
  103. package/lib/typescript/src/types/ViewAd.d.ts +46 -50
  104. package/lib/typescript/src/types/ViewAd.d.ts.map +1 -1
  105. package/package.json +1 -1
  106. package/react-native-applovin-max.podspec +2 -2
  107. package/src/AdView.tsx +62 -80
  108. package/src/AppLovinMAX.ts +39 -29
  109. package/src/ErrorCode.ts +24 -31
  110. package/src/EventEmitter.ts +20 -2
  111. package/src/Utils.ts +20 -1
  112. package/src/nativeAd/NativeAdView.tsx +31 -21
  113. package/src/nativeAd/NativeAdViewComponents.tsx +97 -38
  114. package/src/nativeAd/NativeAdViewProvider.tsx +23 -0
  115. package/src/specs/AppLovinMAXAdViewNativeComponent.ts +62 -1
  116. package/src/specs/AppLovinMAXNativeAdViewNativeComponent.ts +70 -6
  117. package/src/specs/NativeAppLovinMAXModule.ts +75 -55
  118. package/src/types/AdEvent.ts +10 -4
  119. package/src/types/AdInfo.ts +78 -85
  120. package/src/types/AdProps.ts +14 -15
  121. package/src/types/AdViewProps.ts +28 -29
  122. package/src/types/AppLovinMAX.ts +50 -53
  123. package/src/types/BannerAd.ts +22 -17
  124. package/src/types/CMPError.ts +7 -4
  125. package/src/types/Configuration.ts +12 -14
  126. package/src/types/FullscreenAd.ts +39 -46
  127. package/src/types/MRecAd.ts +7 -3
  128. package/src/types/NativeAd.ts +12 -11
  129. package/src/types/NativeAdViewProps.ts +4 -3
  130. package/src/types/Privacy.ts +13 -6
  131. package/src/types/RewardedAd.ts +7 -5
  132. package/src/types/ViewAd.ts +46 -50
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Provides context and state management for NativeAdView and its child asset views.
3
+ * Shares asset view refs and native ad data between internal components and the native SDK.
4
+ */
5
+
1
6
  import * as React from 'react';
2
7
  import { useState, createContext, useRef } from 'react';
3
8
  import type { ReactNode } from 'react';
@@ -5,12 +10,20 @@ import type { Image, NativeMethods, Text, View } from 'react-native';
5
10
  import type { NativeAd } from '../types/NativeAd';
6
11
  import type { NativeProps } from '../specs/AppLovinMAXNativeAdViewNativeComponent';
7
12
 
13
+ /**
14
+ * Native component type for the rendered NativeAdView.
15
+ */
8
16
  export type NativeAdViewType = React.Component<NativeProps> & NativeMethods;
9
17
 
18
+ // Ref types for native views
10
19
  type TextRef = React.ElementRef<typeof Text>;
11
20
  type ImageRef = React.ElementRef<typeof Image>;
12
21
  type ViewRef = React.ElementRef<typeof View>;
13
22
 
23
+ /**
24
+ * Context type used internally by NativeAdView.
25
+ * Stores references to asset views and the current native ad data.
26
+ */
14
27
  export type NativeAdViewContextType = {
15
28
  titleRef: React.RefObject<TextRef>;
16
29
  advertiserRef: React.RefObject<TextRef>;
@@ -23,11 +36,15 @@ export type NativeAdViewContextType = {
23
36
  setNativeAd: React.Dispatch<React.SetStateAction<NativeAd>>;
24
37
  };
25
38
 
39
+ // Default for an uninitialized native ad
26
40
  const defaultNativeAd: NativeAd = {
27
41
  isOptionsViewAvailable: false,
28
42
  isMediaViewAvailable: false,
29
43
  };
30
44
 
45
+ /**
46
+ * Internal context used by NativeAdView to provide access to asset view refs and native ad data.
47
+ */
31
48
  export const NativeAdViewContext = createContext<NativeAdViewContextType>({
32
49
  titleRef: { current: null },
33
50
  advertiserRef: { current: null },
@@ -40,6 +57,9 @@ export const NativeAdViewContext = createContext<NativeAdViewContextType>({
40
57
  setNativeAd: () => {},
41
58
  });
42
59
 
60
+ /**
61
+ * React provider that wraps components requiring access to NativeAdViewContext.
62
+ */
43
63
  export const NativeAdViewProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
44
64
  const titleRef = useRef<TextRef | null>(null);
45
65
  const advertiserRef = useRef<TextRef | null>(null);
@@ -50,6 +70,9 @@ export const NativeAdViewProvider: React.FC<{ children: ReactNode }> = ({ childr
50
70
  const mediaViewRef = useRef<ViewRef | null>(null);
51
71
  const [nativeAd, setNativeAd] = useState<NativeAd>(defaultNativeAd);
52
72
 
73
+ /**
74
+ * Memoized context value to avoid unnecessary renders.
75
+ */
53
76
  const providerValue = React.useMemo(
54
77
  () => ({
55
78
  titleRef,
@@ -3,6 +3,9 @@ import type { Double, DirectEventHandler, WithDefault } from 'react-native/Libra
3
3
  import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
4
4
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
5
5
 
6
+ /**
7
+ * Payload for ad lifecycle events (e.g. load, display, click).
8
+ */
6
9
  export type AdInfoEvent = Readonly<{
7
10
  adUnitId: string;
8
11
  adFormat: string;
@@ -21,6 +24,9 @@ export type AdInfoEvent = Readonly<{
21
24
  }>;
22
25
  }>;
23
26
 
27
+ /**
28
+ * Payload for ad load failure events.
29
+ */
24
30
  export type AdLoadFailedEvent = Readonly<{
25
31
  adUnitId: string;
26
32
  adViewId?: Double;
@@ -31,6 +37,9 @@ export type AdLoadFailedEvent = Readonly<{
31
37
  adLoadFailureInfo?: string | null;
32
38
  }>;
33
39
 
40
+ /**
41
+ * Payload for ad display failure events.
42
+ */
34
43
  export type AdDisplayFailedEvent = Readonly<{
35
44
  adUnitId: string;
36
45
  adFormat: string;
@@ -53,44 +62,96 @@ export type AdDisplayFailedEvent = Readonly<{
53
62
  mediatedNetworkErrorMessage: string;
54
63
  }>;
55
64
 
65
+ /**
66
+ * Props passed to the {@link AppLovinMAXAdView} native component.
67
+ */
56
68
  export interface NativeProps extends ViewProps {
69
+ /** Ad unit ID used to load the ad. */
57
70
  adUnitId: string;
71
+
72
+ /** Ad format (e.g., "BANNER", "MREC"). */
58
73
  adFormat?: string;
74
+
75
+ /** Unique identifier for this ad view. Defaults to 0. */
59
76
  adViewId?: WithDefault<Double, 0>;
77
+
78
+ /** Optional placement name for ad tracking. */
60
79
  placement?: string | null;
80
+
81
+ /** Optional custom data associated with the ad. */
61
82
  customData?: string | null;
83
+
84
+ /** Enables adaptive banner sizing. Defaults to `true`. */
62
85
  adaptiveBannerEnabled?: WithDefault<boolean, true>;
86
+
87
+ /** Enables automatic refresh of the ad. Defaults to `true`. */
63
88
  autoRefresh?: WithDefault<boolean, true>;
89
+
90
+ /** Whether to automatically load the ad on mount. Defaults to `true`. */
64
91
  loadOnMount?: WithDefault<boolean, true>;
92
+
93
+ /** Extra key-value string parameters passed to the SDK. */
65
94
  extraParameters?: ReadonlyArray<{
66
95
  key: string;
67
96
  value: string | null;
68
97
  }>;
98
+
99
+ /** Local string parameters passed to the mediation adapter. */
69
100
  strLocalExtraParameters?: ReadonlyArray<{
70
101
  key: string;
71
102
  value: string | null;
72
103
  }>;
104
+
105
+ /** Local boolean parameters passed to the mediation adapter. */
73
106
  boolLocalExtraParameters?: ReadonlyArray<{
74
107
  key: string;
75
108
  value: boolean | null;
76
109
  }>;
110
+
111
+ /** Called when an ad is successfully loaded. */
77
112
  onAdLoadedEvent: DirectEventHandler<AdInfoEvent>;
113
+
114
+ /** Called when an ad fails to load. */
78
115
  onAdLoadFailedEvent: DirectEventHandler<AdLoadFailedEvent>;
116
+
117
+ /** Called when an ad fails to display. */
79
118
  onAdDisplayFailedEvent: DirectEventHandler<AdDisplayFailedEvent>;
119
+
120
+ /** Called when the ad is clicked. */
80
121
  onAdClickedEvent: DirectEventHandler<AdInfoEvent>;
122
+
123
+ /** Called when the ad expands. */
81
124
  onAdExpandedEvent: DirectEventHandler<AdInfoEvent>;
125
+
126
+ /** Called when the ad collapses. */
82
127
  onAdCollapsedEvent: DirectEventHandler<AdInfoEvent>;
128
+
129
+ /** Called when ad revenue is reported. */
83
130
  onAdRevenuePaidEvent: DirectEventHandler<AdInfoEvent>;
84
131
  }
85
132
 
86
133
  type AppLovinMAXAdViewNativeComponentType = HostComponent<NativeProps>;
87
134
 
135
+ /**
136
+ * Native commands callable from JS for managing {@link AppLovinMAXAdView}.
137
+ */
88
138
  interface NativeCommands {
89
- loadAd: (viewRef: React.ElementRef<AppLovinMAXAdViewNativeComponentType>) => void;
139
+ /**
140
+ * Manually starts loading a new ad when `loadOnMount` is `false`.
141
+ *
142
+ * @param viewRef - Reference to the native ad view component.
143
+ */
144
+ loadAd(viewRef: React.ElementRef<AppLovinMAXAdViewNativeComponentType>): void;
90
145
  }
91
146
 
147
+ /**
148
+ * JS interface to ad view commands for {@link AppLovinMAXAdView}.
149
+ */
92
150
  export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
93
151
  supportedCommands: ['loadAd'],
94
152
  });
95
153
 
154
+ /**
155
+ * Native view component for displaying a banner or MREC ad.
156
+ */
96
157
  export default codegenNativeComponent<NativeProps>('AppLovinMAXAdView') as HostComponent<NativeProps>;
@@ -3,6 +3,9 @@ import type { Double, DirectEventHandler } from 'react-native/Libraries/Types/Co
3
3
  import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
4
4
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
5
5
 
6
+ /**
7
+ * Payload for native ad lifecycle events (e.g., load, click, revenue).
8
+ */
6
9
  export type AdInfoEvent = Readonly<{
7
10
  adUnitId: string;
8
11
  adFormat: string;
@@ -18,6 +21,10 @@ export type AdInfoEvent = Readonly<{
18
21
  width: Double;
19
22
  height: Double;
20
23
  }>;
24
+
25
+ /**
26
+ * Optional native ad content for display in asset views.
27
+ */
21
28
  nativeAd?: Readonly<{
22
29
  title?: string;
23
30
  advertiser?: string;
@@ -29,6 +36,10 @@ export type AdInfoEvent = Readonly<{
29
36
  isOptionsViewAvailable: boolean;
30
37
  isMediaViewAvailable: boolean;
31
38
  }>;
39
+
40
+ /**
41
+ * Full internal native ad payload used for runtime rendering and view mapping.
42
+ */
32
43
  nativeAdImpl: Readonly<{
33
44
  title?: string | null;
34
45
  advertiser?: string | null;
@@ -43,6 +54,9 @@ export type AdInfoEvent = Readonly<{
43
54
  }>;
44
55
  }>;
45
56
 
57
+ /**
58
+ * Payload for native ad load failure events.
59
+ */
46
60
  export type AdLoadFailedEvent = Readonly<{
47
61
  adUnitId: string;
48
62
  code: Double;
@@ -52,38 +66,88 @@ export type AdLoadFailedEvent = Readonly<{
52
66
  adLoadFailureInfo?: string | null;
53
67
  }>;
54
68
 
69
+ /**
70
+ * Props passed to the {@link AppLovinMAXNativeAdView} native component.
71
+ */
55
72
  export interface NativeProps extends ViewProps {
73
+ /** Ad unit ID used to load the ad. */
56
74
  adUnitId: string;
75
+
76
+ /** Optional placement name for ad tracking. */
57
77
  placement?: string | null;
78
+
79
+ /** Optional custom data associated with the ad. */
58
80
  customData?: string | null;
81
+
82
+ /** Extra key-value string parameters passed to the SDK. */
59
83
  extraParameters?: ReadonlyArray<{
60
84
  key: string;
61
85
  value: string | null;
62
- }> | null;
86
+ }>;
87
+
88
+ /** Local string parameters passed to the mediation adapter. */
63
89
  strLocalExtraParameters?: ReadonlyArray<{
64
90
  key: string;
65
91
  value: string | null;
66
- }> | null;
92
+ }>;
93
+
94
+ /** Local boolean parameters passed to the mediation adapter. */
67
95
  boolLocalExtraParameters?: ReadonlyArray<{
68
96
  key: string;
69
97
  value: boolean | null;
70
- }> | null;
98
+ }>;
99
+
100
+ /** Called when a native ad is successfully loaded. */
71
101
  onAdLoadedEvent: DirectEventHandler<AdInfoEvent>;
102
+
103
+ /** Called when ad loading fails. */
72
104
  onAdLoadFailedEvent: DirectEventHandler<AdLoadFailedEvent>;
105
+
106
+ /** Called when the ad is clicked. */
73
107
  onAdClickedEvent: DirectEventHandler<AdInfoEvent>;
108
+
109
+ /** Called when ad revenue is reported. */
74
110
  onAdRevenuePaidEvent: DirectEventHandler<AdInfoEvent>;
75
111
  }
76
112
 
77
113
  type AppLovinMAXNativeAdViewNativeComponentType = HostComponent<NativeProps>;
78
114
 
115
+ /**
116
+ * Native commands callable from JS for managing {@link NativeAdView}.
117
+ */
79
118
  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;
119
+ /**
120
+ * Manually loads a new native ad.
121
+ *
122
+ * @param viewRef - Reference to the native ad view.
123
+ */
124
+ loadAd(viewRef: React.ElementRef<AppLovinMAXNativeAdViewNativeComponentType>): void;
125
+
126
+ /**
127
+ * Binds a React Native child view to a native asset (e.g. TitleView, IconView).
128
+ *
129
+ * @param viewRef - Reference to the native ad view.
130
+ * @param assetViewTag - React tag for the asset view (via `findNodeHandle()`).
131
+ * @param assetViewName - Name of the asset (e.g., "MediaView", "CallToActionView").
132
+ */
133
+ updateAssetView(viewRef: React.ElementRef<AppLovinMAXNativeAdViewNativeComponentType>, assetViewTag: Double, assetViewName: string): void;
134
+
135
+ /**
136
+ * Instructs the native view to render the bound native ad after all asset views are set.
137
+ *
138
+ * @param viewRef - Reference to the native ad view.
139
+ */
140
+ renderNativeAd(viewRef: React.ElementRef<AppLovinMAXNativeAdViewNativeComponentType>): void;
83
141
  }
84
142
 
143
+ /**
144
+ * JS interface to native ad view commands for {@link AppLovinMAXNativeAdView}.
145
+ */
85
146
  export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
86
147
  supportedCommands: ['loadAd', 'updateAssetView', 'renderNativeAd'],
87
148
  });
88
149
 
150
+ /**
151
+ * Native component for rendering a custom native ad layout using bound asset views.
152
+ */
89
153
  export default codegenNativeComponent<NativeProps>('AppLovinMAXNativeAdView') as HostComponent<NativeProps>;
@@ -5,8 +5,16 @@ import type { Configuration } from '../types';
5
5
  import type { CMPError } from '../types';
6
6
  import type { AdViewId } from '../types';
7
7
 
8
+ /**
9
+ * Native TurboModule interface for AppLovin MAX.
10
+ * Defines all methods and constants exposed to JavaScript.
11
+ */
8
12
  export interface Spec extends TurboModule {
13
+ /**
14
+ * Returns all supported event constants and SDK error codes.
15
+ */
9
16
  readonly getConstants: () => {
17
+ // Interstitial ad events
10
18
  ON_INTERSTITIAL_LOADED_EVENT: string;
11
19
  ON_INTERSTITIAL_LOAD_FAILED_EVENT: string;
12
20
  ON_INTERSTITIAL_CLICKED_EVENT: string;
@@ -14,6 +22,8 @@ export interface Spec extends TurboModule {
14
22
  ON_INTERSTITIAL_AD_FAILED_TO_DISPLAY_EVENT: string;
15
23
  ON_INTERSTITIAL_HIDDEN_EVENT: string;
16
24
  ON_INTERSTITIAL_AD_REVENUE_PAID: string;
25
+
26
+ // Rewarded ad events
17
27
  ON_REWARDED_AD_LOADED_EVENT: string;
18
28
  ON_REWARDED_AD_LOAD_FAILED_EVENT: string;
19
29
  ON_REWARDED_AD_CLICKED_EVENT: string;
@@ -22,18 +32,24 @@ export interface Spec extends TurboModule {
22
32
  ON_REWARDED_AD_HIDDEN_EVENT: string;
23
33
  ON_REWARDED_AD_RECEIVED_REWARD_EVENT: string;
24
34
  ON_REWARDED_AD_REVENUE_PAID: string;
35
+
36
+ // Banner ad events
25
37
  ON_BANNER_AD_LOADED_EVENT: string;
26
38
  ON_BANNER_AD_LOAD_FAILED_EVENT: string;
27
39
  ON_BANNER_AD_CLICKED_EVENT: string;
28
40
  ON_BANNER_AD_COLLAPSED_EVENT: string;
29
41
  ON_BANNER_AD_EXPANDED_EVENT: string;
30
42
  ON_BANNER_AD_REVENUE_PAID: string;
43
+
44
+ // MREC ad events
31
45
  ON_MREC_AD_LOADED_EVENT: string;
32
46
  ON_MREC_AD_LOAD_FAILED_EVENT: string;
33
47
  ON_MREC_AD_CLICKED_EVENT: string;
34
48
  ON_MREC_AD_COLLAPSED_EVENT: string;
35
49
  ON_MREC_AD_EXPANDED_EVENT: string;
36
50
  ON_MREC_AD_REVENUE_PAID: string;
51
+
52
+ // App Open ad events
37
53
  ON_APPOPEN_AD_LOADED_EVENT: string;
38
54
  ON_APPOPEN_AD_LOAD_FAILED_EVENT: string;
39
55
  ON_APPOPEN_AD_CLICKED_EVENT: string;
@@ -41,8 +57,12 @@ export interface Spec extends TurboModule {
41
57
  ON_APPOPEN_AD_FAILED_TO_DISPLAY_EVENT: string;
42
58
  ON_APPOPEN_AD_HIDDEN_EVENT: string;
43
59
  ON_APPOPEN_AD_REVENUE_PAID: string;
60
+
61
+ // Native UI component ad events
44
62
  ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOADED_EVENT: string;
45
63
  ON_NATIVE_UI_COMPONENT_ADVIEW_AD_LOAD_FAILED_EVENT: string;
64
+
65
+ // Error codes
46
66
  MAX_ERROR_CODE_UNSPECIFIED: number;
47
67
  MAX_ERROR_CODE_NO_FILL: number;
48
68
  MAX_ERROR_CODE_AD_LOAD_FAILED: number;
@@ -57,138 +77,132 @@ export interface Spec extends TurboModule {
57
77
  MAX_ERROR_CODE_INVALID_AD_UNIT_ID: number;
58
78
  };
59
79
 
60
- isInitialized(): Promise<boolean>;
80
+ // ─────────────────────────────────────────────────────────
81
+ // SDK Initialization & Configuration
82
+ // ─────────────────────────────────────────────────────────
61
83
 
84
+ isInitialized(): Promise<boolean>;
62
85
  initialize(pluginVersion: string, sdkKey: string): Promise<Configuration>;
63
-
64
86
  isTablet(): Promise<boolean>;
65
-
66
87
  showMediationDebugger(): void;
67
88
 
68
- setHasUserConsent(hasUserConsent: boolean): void;
89
+ // ─────────────────────────────────────────────────────────
90
+ // Privacy & Consent APIs
91
+ // ─────────────────────────────────────────────────────────
69
92
 
93
+ setHasUserConsent(hasUserConsent: boolean): void;
70
94
  hasUserConsent(): Promise<boolean>;
71
95
 
72
96
  setDoNotSell(doNotSell: boolean): void;
73
-
74
97
  isDoNotSell(): Promise<boolean>;
75
98
 
76
- setUserId(userId: string): void;
99
+ // ─────────────────────────────────────────────────────────
100
+ // User & Debug Settings
101
+ // ─────────────────────────────────────────────────────────
77
102
 
103
+ setUserId(userId: string): void;
78
104
  setMuted(muted: boolean): void;
79
-
80
105
  isMuted(): Promise<boolean>;
81
-
82
106
  setVerboseLogging(enabled: boolean): void;
83
-
84
107
  setCreativeDebuggerEnabled(enabled: boolean): void;
85
-
86
108
  setTestDeviceAdvertisingIds(ids: string[]): void;
87
109
 
88
- setExtraParameter(key: string, value: string | null): void;
110
+ // ─────────────────────────────────────────────────────────
111
+ // Extra Parameters
112
+ // ─────────────────────────────────────────────────────────
89
113
 
114
+ setExtraParameter(key: string, value: string | null): void;
90
115
  setInitializationAdUnitIds(adUnitIds: string[]): void;
91
116
 
92
- setTermsAndPrivacyPolicyFlowEnabled(enabled: boolean): void;
117
+ // ─────────────────────────────────────────────────────────
118
+ // CMP (Consent Flow)
119
+ // ─────────────────────────────────────────────────────────
93
120
 
121
+ setTermsAndPrivacyPolicyFlowEnabled(enabled: boolean): void;
94
122
  setPrivacyPolicyUrl(url: string): void;
95
-
96
123
  setTermsOfServiceUrl(url: string): void;
97
-
98
124
  setConsentFlowDebugUserGeography(userGeography: string): void;
99
-
100
125
  showCmpForExistingUser(): Promise<CMPError | null>;
101
-
102
126
  hasSupportedCmp(): Promise<boolean>;
103
127
 
104
- addSegment(key: number, values: number[]): Promise<void>;
128
+ // ─────────────────────────────────────────────────────────
129
+ // Segments
130
+ // ─────────────────────────────────────────────────────────
105
131
 
132
+ addSegment(key: number, values: number[]): Promise<void>;
106
133
  getSegments(): Promise<{ [key: string]: number[] } | null>;
107
134
 
108
- createBanner(adUnitId: string, position: string): void;
135
+ // ─────────────────────────────────────────────────────────
136
+ // Banner Ads
137
+ // ─────────────────────────────────────────────────────────
109
138
 
139
+ createBanner(adUnitId: string, position: string): void;
110
140
  createBannerWithOffsets(adUnitId: string, position: string, xOffset: number, yOffset: number): void;
111
-
112
141
  setBannerBackgroundColor(adUnitId: string, hexColorCode: string): void;
113
-
114
142
  setBannerPlacement(adUnitId: string, placement: string | null): void;
115
-
116
143
  setBannerCustomData(adUnitId: string, customData: string | null): void;
117
-
118
144
  setBannerWidth(adUnitId: string, width: number): void;
119
-
120
145
  updateBannerPosition(adUnitId: string, position: string): void;
121
-
122
146
  updateBannerOffsets(adUnitId: string, xOffset: number, yOffset: number): void;
123
-
124
147
  setBannerExtraParameter(adUnitId: string, key: string, value: string | null): void;
125
-
126
148
  setBannerLocalExtraParameter(adUnitId: string, parameters: UnsafeObject): void;
127
-
128
149
  startBannerAutoRefresh(adUnitId: string): void;
129
-
130
150
  stopBannerAutoRefresh(adUnitId: string): void;
131
-
132
151
  showBanner(adUnitId: string): void;
133
-
134
152
  hideBanner(adUnitId: string): void;
135
-
136
153
  destroyBanner(adUnitId: string): void;
137
-
138
154
  getAdaptiveBannerHeightForWidth(width: number): Promise<number>;
139
155
 
140
- createMRec(adUnitId: string, position: string): void;
156
+ // ─────────────────────────────────────────────────────────
157
+ // MREC Ads
158
+ // ─────────────────────────────────────────────────────────
141
159
 
160
+ createMRec(adUnitId: string, position: string): void;
142
161
  setMRecPlacement(adUnitId: string, placement: string | null): void;
143
-
144
162
  setMRecCustomData(adUnitId: string, customData: string | null): void;
145
-
146
163
  updateMRecPosition(adUnitId: string, position: string): void;
147
-
148
164
  setMRecExtraParameter(adUnitId: string, key: string, value: string | null): void;
149
-
150
165
  setMRecLocalExtraParameter(adUnitId: string, parameters: UnsafeObject): void;
151
-
152
166
  startMRecAutoRefresh(adUnitId: string): void;
153
-
154
167
  stopMRecAutoRefresh(adUnitId: string): void;
155
-
156
168
  showMRec(adUnitId: string): void;
157
-
158
169
  hideMRec(adUnitId: string): void;
159
-
160
170
  destroyMRec(adUnitId: string): void;
161
171
 
162
- loadInterstitial(adUnitId: string): void;
172
+ // ─────────────────────────────────────────────────────────
173
+ // Interstitial Ads
174
+ // ─────────────────────────────────────────────────────────
163
175
 
176
+ loadInterstitial(adUnitId: string): void;
164
177
  isInterstitialReady(adUnitId: string): Promise<boolean>;
165
-
166
178
  showInterstitial(adUnitId: string, placement?: string | null, customData?: string | null): void;
167
-
168
179
  setInterstitialExtraParameter(adUnitId: string, key: string, value: string | null): void;
169
-
170
180
  setInterstitialLocalExtraParameter(adUnitId: string, parameters: UnsafeObject): void;
171
181
 
172
- loadRewardedAd(adUnitId: string): void;
182
+ // ─────────────────────────────────────────────────────────
183
+ // Rewarded Ads
184
+ // ─────────────────────────────────────────────────────────
173
185
 
186
+ loadRewardedAd(adUnitId: string): void;
174
187
  isRewardedAdReady(adUnitId: string): Promise<boolean>;
175
-
176
188
  showRewardedAd(adUnitId: string, placement?: string | null, customData?: string | null): void;
177
-
178
189
  setRewardedAdExtraParameter(adUnitId: string, key: string, value: string | null): void;
179
-
180
190
  setRewardedAdLocalExtraParameter(adUnitId: string, parameters: UnsafeObject): void;
181
191
 
182
- loadAppOpenAd(adUnitId: string): void;
192
+ // ─────────────────────────────────────────────────────────
193
+ // App Open Ads
194
+ // ─────────────────────────────────────────────────────────
183
195
 
196
+ loadAppOpenAd(adUnitId: string): void;
184
197
  isAppOpenAdReady(adUnitId: string): Promise<boolean>;
185
-
186
198
  showAppOpenAd(adUnitId: string, placement?: string | null, customData?: string | null): void;
187
-
188
199
  setAppOpenAdExtraParameter(adUnitId: string, key: string, value: string | null): void;
189
-
190
200
  setAppOpenAdLocalExtraParameter(adUnitId: string, parameters: UnsafeObject): void;
191
201
 
202
+ // ─────────────────────────────────────────────────────────
203
+ // Native UI Component AdView (Preload/Destroy)
204
+ // ─────────────────────────────────────────────────────────
205
+
192
206
  preloadNativeUIComponentAdView(
193
207
  adUnitId: string,
194
208
  adFormat: string,
@@ -200,9 +214,15 @@ export interface Spec extends TurboModule {
200
214
 
201
215
  destroyNativeUIComponentAdView(adViewId: number): Promise<void>;
202
216
 
203
- addListener(eventType: string): void;
217
+ // ─────────────────────────────────────────────────────────
218
+ // TurboModule Listener Management
219
+ // ─────────────────────────────────────────────────────────
204
220
 
221
+ addListener(eventType: string): void;
205
222
  removeListeners(count: number): void;
206
223
  }
207
224
 
225
+ /**
226
+ * Enforces use of the native AppLovinMAX TurboModule.
227
+ */
208
228
  export default TurboModuleRegistry.getEnforcing<Spec>('AppLovinMAX');
@@ -1,15 +1,21 @@
1
1
  import type { AdInfo, AdLoadFailedInfo, AdDisplayFailedInfo, AdRewardInfo } from './AdInfo';
2
2
 
3
+ /**
4
+ * Represents any ad event object that can be emitted by the native AppLovin MAX module.
5
+ */
3
6
  export type AdEventObject = AdInfo | AdLoadFailedInfo | AdDisplayFailedInfo | AdRewardInfo;
4
7
 
5
8
  /**
6
- * Defines a generic event listener for the pragrammatic methods to receive an event from the native
7
- * module.
9
+ * A generic event listener for handling ad events in programmatic APIs.
10
+ *
11
+ * @template T - A specific ad event type.
8
12
  */
9
13
  export type AdEventListener<T extends AdEventObject> = (event: T) => void;
10
14
 
11
15
  /**
12
- * Defines a generic event object for the UI components i.e. AdView and NativeAdView to receive an
13
- * event from the native module.
16
+ * Wraps an ad event in a `nativeEvent` field, following the React Native synthetic event pattern.
17
+ * Used for UI component props such as {@link AdView} and {@link NativeAdView}.
18
+ *
19
+ * @template T - A specific ad event type.
14
20
  */
15
21
  export type AdNativeEvent<T extends AdEventObject> = { nativeEvent: T };