cloudx-react-native 2.0.0-beta.1 → 2.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 (197) hide show
  1. package/README.md +420 -1046
  2. package/android/src/main/AndroidManifest.xml +0 -4
  3. package/android/src/main/java/com/cloudxreactnative/CloudXAdEvents.kt +39 -0
  4. package/android/src/main/java/com/cloudxreactnative/CloudXAdInfo.kt +32 -0
  5. package/android/src/main/java/com/cloudxreactnative/CloudXModuleImpl.kt +694 -0
  6. package/android/src/{newarch/com/cloudxreactnative/CloudXReactNativePackage.kt → main/java/com/cloudxreactnative/CloudXPackage.kt} +14 -13
  7. package/android/src/newarch/com/cloudxreactnative/{CloudXReactNativeModule.kt → CloudXModule.kt} +31 -34
  8. package/android/src/oldarch/com/cloudxreactnative/{CloudXReactNativeModule.kt → CloudXModule.kt} +27 -32
  9. package/cloudx-react-native.podspec +1 -1
  10. package/ios/CloudX.h +47 -0
  11. package/ios/CloudX.mm +1406 -0
  12. package/lib/commonjs/AppTrackingTransparency.js +13 -13
  13. package/lib/commonjs/AppTrackingTransparency.js.map +1 -1
  14. package/lib/commonjs/CloudX.js +16 -12
  15. package/lib/commonjs/CloudX.js.map +1 -1
  16. package/lib/commonjs/CloudXAdPosition.js +23 -0
  17. package/lib/commonjs/CloudXAdPosition.js.map +1 -0
  18. package/lib/commonjs/{BannerAd.js → CloudXBannerAd.js} +42 -37
  19. package/lib/commonjs/CloudXBannerAd.js.map +1 -0
  20. package/lib/commonjs/CloudXErrorCode.js +116 -0
  21. package/lib/commonjs/CloudXErrorCode.js.map +1 -0
  22. package/lib/commonjs/{InterstitialAd.js → CloudXInterstitialAd.js} +10 -10
  23. package/lib/commonjs/CloudXInterstitialAd.js.map +1 -0
  24. package/lib/commonjs/{MRecAd.js → CloudXMRECAd.js} +42 -37
  25. package/lib/commonjs/CloudXMRECAd.js.map +1 -0
  26. package/lib/commonjs/{RewardedAd.js → CloudXRewardedAd.js} +10 -10
  27. package/lib/commonjs/CloudXRewardedAd.js.map +1 -0
  28. package/lib/commonjs/EventEmitter.js +3 -3
  29. package/lib/commonjs/EventEmitter.js.map +1 -1
  30. package/lib/commonjs/hooks.js +25 -26
  31. package/lib/commonjs/hooks.js.map +1 -1
  32. package/lib/commonjs/index.js +27 -41
  33. package/lib/commonjs/index.js.map +1 -1
  34. package/lib/commonjs/specs/{NativeCloudXModule.js → NativeCloudX.js} +2 -2
  35. package/lib/commonjs/specs/NativeCloudX.js.map +1 -0
  36. package/lib/commonjs/types/AdProps.js +6 -0
  37. package/lib/commonjs/types/AdProps.js.map +1 -0
  38. package/lib/commonjs/types/InterstitialAd.js +6 -0
  39. package/lib/commonjs/types/InterstitialAd.js.map +1 -0
  40. package/lib/commonjs/types/MRECAd.js +6 -0
  41. package/lib/commonjs/types/MRECAd.js.map +1 -0
  42. package/lib/commonjs/types/ViewAd.js +6 -0
  43. package/lib/commonjs/types/ViewAd.js.map +1 -0
  44. package/lib/module/AppTrackingTransparency.js +12 -12
  45. package/lib/module/AppTrackingTransparency.js.map +1 -1
  46. package/lib/module/CloudX.js +16 -12
  47. package/lib/module/CloudX.js.map +1 -1
  48. package/lib/module/CloudXAdPosition.js +17 -0
  49. package/lib/module/CloudXAdPosition.js.map +1 -0
  50. package/lib/module/{BannerAd.js → CloudXBannerAd.js} +41 -36
  51. package/lib/module/CloudXBannerAd.js.map +1 -0
  52. package/lib/module/CloudXErrorCode.js +110 -0
  53. package/lib/module/CloudXErrorCode.js.map +1 -0
  54. package/lib/module/{InterstitialAd.js → CloudXInterstitialAd.js} +9 -9
  55. package/lib/module/CloudXInterstitialAd.js.map +1 -0
  56. package/lib/module/{MRecAd.js → CloudXMRECAd.js} +41 -36
  57. package/lib/module/CloudXMRECAd.js.map +1 -0
  58. package/lib/module/{RewardedAd.js → CloudXRewardedAd.js} +9 -9
  59. package/lib/module/CloudXRewardedAd.js.map +1 -0
  60. package/lib/module/EventEmitter.js +2 -2
  61. package/lib/module/EventEmitter.js.map +1 -1
  62. package/lib/module/hooks.js +14 -15
  63. package/lib/module/hooks.js.map +1 -1
  64. package/lib/module/index.js +9 -10
  65. package/lib/module/index.js.map +1 -1
  66. package/lib/module/specs/{NativeCloudXModule.js → NativeCloudX.js} +2 -2
  67. package/lib/module/specs/NativeCloudX.js.map +1 -0
  68. package/lib/module/types/AdProps.js +2 -0
  69. package/lib/module/types/AdProps.js.map +1 -0
  70. package/lib/module/types/InterstitialAd.js +2 -0
  71. package/lib/module/types/InterstitialAd.js.map +1 -0
  72. package/lib/module/types/MRECAd.js +2 -0
  73. package/lib/module/types/MRECAd.js.map +1 -0
  74. package/lib/module/types/ViewAd.js +2 -0
  75. package/lib/module/types/ViewAd.js.map +1 -0
  76. package/lib/typescript/src/AppTrackingTransparency.d.ts +4 -4
  77. package/lib/typescript/src/AppTrackingTransparency.d.ts.map +1 -1
  78. package/lib/typescript/src/CloudX.d.ts.map +1 -1
  79. package/lib/typescript/src/CloudXAdPosition.d.ts +16 -0
  80. package/lib/typescript/src/CloudXAdPosition.d.ts.map +1 -0
  81. package/lib/typescript/src/CloudXBannerAd.d.ts +4 -0
  82. package/lib/typescript/src/CloudXBannerAd.d.ts.map +1 -0
  83. package/lib/typescript/src/{ErrorCode.d.ts → CloudXErrorCode.d.ts} +2 -2
  84. package/lib/typescript/src/CloudXErrorCode.d.ts.map +1 -0
  85. package/lib/typescript/src/CloudXInterstitialAd.d.ts +4 -0
  86. package/lib/typescript/src/CloudXInterstitialAd.d.ts.map +1 -0
  87. package/lib/typescript/src/CloudXMRECAd.d.ts +4 -0
  88. package/lib/typescript/src/CloudXMRECAd.d.ts.map +1 -0
  89. package/lib/typescript/src/CloudXRewardedAd.d.ts +4 -0
  90. package/lib/typescript/src/CloudXRewardedAd.d.ts.map +1 -0
  91. package/lib/typescript/src/EventEmitter.d.ts +4 -2
  92. package/lib/typescript/src/EventEmitter.d.ts.map +1 -1
  93. package/lib/typescript/src/hooks.d.ts +7 -8
  94. package/lib/typescript/src/hooks.d.ts.map +1 -1
  95. package/lib/typescript/src/index.d.ts +12 -13
  96. package/lib/typescript/src/index.d.ts.map +1 -1
  97. package/lib/typescript/src/specs/{NativeCloudXModule.d.ts → NativeCloudX.d.ts} +47 -64
  98. package/lib/typescript/src/specs/NativeCloudX.d.ts.map +1 -0
  99. package/lib/typescript/src/types/AdEvent.d.ts +3 -3
  100. package/lib/typescript/src/types/AdEvent.d.ts.map +1 -1
  101. package/lib/typescript/src/types/AdInfo.d.ts +7 -7
  102. package/lib/typescript/src/types/AdInfo.d.ts.map +1 -1
  103. package/lib/typescript/src/types/AdProps.d.ts +21 -0
  104. package/lib/typescript/src/types/AdProps.d.ts.map +1 -0
  105. package/lib/typescript/src/types/BannerAd.d.ts +8 -34
  106. package/lib/typescript/src/types/BannerAd.d.ts.map +1 -1
  107. package/lib/typescript/src/types/CloudX.d.ts +7 -4
  108. package/lib/typescript/src/types/CloudX.d.ts.map +1 -1
  109. package/lib/typescript/src/types/Configuration.d.ts +7 -3
  110. package/lib/typescript/src/types/Configuration.d.ts.map +1 -1
  111. package/lib/typescript/src/types/FullscreenAd.d.ts +10 -9
  112. package/lib/typescript/src/types/FullscreenAd.d.ts.map +1 -1
  113. package/lib/typescript/src/types/InterstitialAd.d.ts +8 -0
  114. package/lib/typescript/src/types/InterstitialAd.d.ts.map +1 -0
  115. package/lib/typescript/src/types/MRECAd.d.ts +13 -0
  116. package/lib/typescript/src/types/MRECAd.d.ts.map +1 -0
  117. package/lib/typescript/src/types/RewardedAd.d.ts +5 -4
  118. package/lib/typescript/src/types/RewardedAd.d.ts.map +1 -1
  119. package/lib/typescript/src/types/ViewAd.d.ts +29 -0
  120. package/lib/typescript/src/types/ViewAd.d.ts.map +1 -0
  121. package/lib/typescript/src/types/index.d.ts +11 -7
  122. package/lib/typescript/src/types/index.d.ts.map +1 -1
  123. package/package.json +8 -10
  124. package/src/AppTrackingTransparency.ts +10 -10
  125. package/src/CloudX.ts +21 -16
  126. package/src/CloudXAdPosition.ts +16 -0
  127. package/src/{BannerAd.ts → CloudXBannerAd.ts} +69 -47
  128. package/src/{ErrorCode.ts → CloudXErrorCode.ts} +1 -1
  129. package/src/{InterstitialAd.ts → CloudXInterstitialAd.ts} +17 -17
  130. package/src/{MRecAd.ts → CloudXMRECAd.ts} +69 -47
  131. package/src/{RewardedAd.ts → CloudXRewardedAd.ts} +18 -18
  132. package/src/EventEmitter.ts +4 -4
  133. package/src/hooks.ts +20 -22
  134. package/src/index.ts +27 -24
  135. package/src/specs/{NativeCloudXModule.ts → NativeCloudX.ts} +61 -82
  136. package/src/types/AdEvent.ts +3 -3
  137. package/src/types/AdInfo.ts +7 -7
  138. package/src/types/AdProps.ts +27 -0
  139. package/src/types/BannerAd.ts +8 -54
  140. package/src/types/CloudX.ts +10 -5
  141. package/src/types/Configuration.ts +8 -3
  142. package/src/types/FullscreenAd.ts +10 -9
  143. package/src/types/InterstitialAd.ts +8 -0
  144. package/src/types/MRECAd.ts +13 -0
  145. package/src/types/RewardedAd.ts +5 -4
  146. package/src/types/ViewAd.ts +38 -0
  147. package/src/types/index.ts +11 -7
  148. package/android/src/main/java/com/cloudxreactnative/CloudXAdViewEvent.kt +0 -15
  149. package/android/src/main/java/com/cloudxreactnative/CloudXBannerViewManagerImpl.kt +0 -472
  150. package/android/src/main/java/com/cloudxreactnative/CloudXReactNativeModuleImpl.kt +0 -861
  151. package/android/src/newarch/com/cloudxreactnative/CloudXBannerViewManager.kt +0 -90
  152. package/android/src/oldarch/com/cloudxreactnative/CloudXBannerViewManager.kt +0 -76
  153. package/android/src/oldarch/com/cloudxreactnative/CloudXReactNativePackage.kt +0 -16
  154. package/ios/RNCloudXBannerView.h +0 -51
  155. package/ios/RNCloudXBannerView.mm +0 -633
  156. package/ios/RNCloudXBannerViewManager.h +0 -11
  157. package/ios/RNCloudXBannerViewManager.mm +0 -60
  158. package/ios/RNCloudXModule.h +0 -30
  159. package/ios/RNCloudXModule.mm +0 -1088
  160. package/lib/commonjs/AdView.js +0 -151
  161. package/lib/commonjs/AdView.js.map +0 -1
  162. package/lib/commonjs/BannerAd.js.map +0 -1
  163. package/lib/commonjs/ErrorCode.js +0 -116
  164. package/lib/commonjs/ErrorCode.js.map +0 -1
  165. package/lib/commonjs/InterstitialAd.js.map +0 -1
  166. package/lib/commonjs/MRecAd.js.map +0 -1
  167. package/lib/commonjs/RewardedAd.js.map +0 -1
  168. package/lib/commonjs/specs/CloudXAdViewNativeComponent.js +0 -26
  169. package/lib/commonjs/specs/CloudXAdViewNativeComponent.js.map +0 -1
  170. package/lib/commonjs/specs/NativeCloudXModule.js.map +0 -1
  171. package/lib/module/AdView.js +0 -144
  172. package/lib/module/AdView.js.map +0 -1
  173. package/lib/module/BannerAd.js.map +0 -1
  174. package/lib/module/ErrorCode.js +0 -110
  175. package/lib/module/ErrorCode.js.map +0 -1
  176. package/lib/module/InterstitialAd.js.map +0 -1
  177. package/lib/module/MRecAd.js.map +0 -1
  178. package/lib/module/RewardedAd.js.map +0 -1
  179. package/lib/module/specs/CloudXAdViewNativeComponent.js +0 -20
  180. package/lib/module/specs/CloudXAdViewNativeComponent.js.map +0 -1
  181. package/lib/module/specs/NativeCloudXModule.js.map +0 -1
  182. package/lib/typescript/src/AdView.d.ts +0 -69
  183. package/lib/typescript/src/AdView.d.ts.map +0 -1
  184. package/lib/typescript/src/BannerAd.d.ts +0 -4
  185. package/lib/typescript/src/BannerAd.d.ts.map +0 -1
  186. package/lib/typescript/src/ErrorCode.d.ts.map +0 -1
  187. package/lib/typescript/src/InterstitialAd.d.ts +0 -4
  188. package/lib/typescript/src/InterstitialAd.d.ts.map +0 -1
  189. package/lib/typescript/src/MRecAd.d.ts +0 -4
  190. package/lib/typescript/src/MRecAd.d.ts.map +0 -1
  191. package/lib/typescript/src/RewardedAd.d.ts +0 -4
  192. package/lib/typescript/src/RewardedAd.d.ts.map +0 -1
  193. package/lib/typescript/src/specs/CloudXAdViewNativeComponent.d.ts +0 -61
  194. package/lib/typescript/src/specs/CloudXAdViewNativeComponent.d.ts.map +0 -1
  195. package/lib/typescript/src/specs/NativeCloudXModule.d.ts.map +0 -1
  196. package/src/AdView.tsx +0 -213
  197. package/src/specs/CloudXAdViewNativeComponent.ts +0 -82
@@ -1,5 +1,6 @@
1
1
  import type { TurboModule } from 'react-native';
2
2
  import { TurboModuleRegistry } from 'react-native';
3
+ import type { CloudXConfiguration } from '../types/Configuration';
3
4
 
4
5
  /**
5
6
  * TurboModule spec for the CloudX native module.
@@ -12,18 +13,52 @@ import { TurboModuleRegistry } from 'react-native';
12
13
  */
13
14
  export interface Spec extends TurboModule {
14
15
  // =========================================================================
15
- // Event Emitter (required by NativeEventEmitter)
16
+ // Constants (event names)
16
17
  // =========================================================================
17
18
 
18
- addListener(eventName: string): void;
19
- removeListeners(count: number): void;
19
+ readonly getConstants: () => {
20
+ // Banner events
21
+ ON_BANNER_AD_LOADED_EVENT: string;
22
+ ON_BANNER_AD_LOAD_FAILED_EVENT: string;
23
+ ON_BANNER_AD_CLICKED_EVENT: string;
24
+ ON_BANNER_AD_EXPANDED_EVENT: string;
25
+ ON_BANNER_AD_COLLAPSED_EVENT: string;
26
+ ON_BANNER_AD_REVENUE_PAID: string;
27
+
28
+ // MREC events
29
+ ON_MREC_AD_LOADED_EVENT: string;
30
+ ON_MREC_AD_LOAD_FAILED_EVENT: string;
31
+ ON_MREC_AD_CLICKED_EVENT: string;
32
+ ON_MREC_AD_EXPANDED_EVENT: string;
33
+ ON_MREC_AD_COLLAPSED_EVENT: string;
34
+ ON_MREC_AD_REVENUE_PAID: string;
35
+
36
+ // Interstitial events
37
+ ON_INTERSTITIAL_LOADED_EVENT: string;
38
+ ON_INTERSTITIAL_LOAD_FAILED_EVENT: string;
39
+ ON_INTERSTITIAL_CLICKED_EVENT: string;
40
+ ON_INTERSTITIAL_DISPLAYED_EVENT: string;
41
+ ON_INTERSTITIAL_DISPLAY_FAILED_EVENT: string;
42
+ ON_INTERSTITIAL_HIDDEN_EVENT: string;
43
+ ON_INTERSTITIAL_AD_REVENUE_PAID: string;
44
+
45
+ // Rewarded events
46
+ ON_REWARDED_AD_LOADED_EVENT: string;
47
+ ON_REWARDED_AD_LOAD_FAILED_EVENT: string;
48
+ ON_REWARDED_AD_CLICKED_EVENT: string;
49
+ ON_REWARDED_AD_DISPLAYED_EVENT: string;
50
+ ON_REWARDED_AD_DISPLAY_FAILED_EVENT: string;
51
+ ON_REWARDED_AD_HIDDEN_EVENT: string;
52
+ ON_REWARDED_AD_RECEIVED_REWARD_EVENT: string;
53
+ ON_REWARDED_AD_REVENUE_PAID: string;
54
+ };
20
55
 
21
56
  // =========================================================================
22
57
  // Initialization
23
58
  // =========================================================================
24
59
 
25
- initialize(pluginVersion: string, appKey: string): Promise<Object>;
26
60
  isInitialized(): Promise<boolean>;
61
+ initialize(pluginVersion: string, appKey: string): Promise<CloudXConfiguration>;
27
62
  isTablet(): Promise<boolean>;
28
63
  getVersion(): Promise<string>;
29
64
 
@@ -49,33 +84,33 @@ export interface Spec extends TurboModule {
49
84
 
50
85
  createBanner(adUnitId: string, position: string): void;
51
86
  createBannerWithOffsets(adUnitId: string, position: string, xOffset: number, yOffset: number): void;
52
- showBanner(adUnitId: string): void;
53
- hideBanner(adUnitId: string): void;
54
- destroyBanner(adUnitId: string): void;
87
+ setBannerBackgroundColor(adUnitId: string, hexColorString: string): void;
55
88
  setBannerPlacement(adUnitId: string, placement: string | null): void;
56
89
  setBannerCustomData(adUnitId: string, customData: string | null): void;
57
- startBannerAutoRefresh(adUnitId: string): void;
58
- stopBannerAutoRefresh(adUnitId: string): void;
59
90
  updateBannerPosition(adUnitId: string, position: string): void;
60
91
  updateBannerOffsets(adUnitId: string, xOffset: number, yOffset: number): void;
61
- setBannerBackgroundColor(adUnitId: string, hexColorString: string): void;
92
+ startBannerAutoRefresh(adUnitId: string): void;
93
+ stopBannerAutoRefresh(adUnitId: string): void;
94
+ showBanner(adUnitId: string): void;
95
+ hideBanner(adUnitId: string): void;
96
+ destroyBanner(adUnitId: string): void;
62
97
 
63
98
  // =========================================================================
64
99
  // MREC (Programmatic)
65
100
  // =========================================================================
66
101
 
67
- createMRec(adUnitId: string, position: string): void;
68
- createMRecWithOffsets(adUnitId: string, position: string, xOffset: number, yOffset: number): void;
69
- showMRec(adUnitId: string): void;
70
- hideMRec(adUnitId: string): void;
71
- destroyMRec(adUnitId: string): void;
72
- setMRecPlacement(adUnitId: string, placement: string | null): void;
73
- setMRecCustomData(adUnitId: string, customData: string | null): void;
74
- startMRecAutoRefresh(adUnitId: string): void;
75
- stopMRecAutoRefresh(adUnitId: string): void;
76
- updateMRecPosition(adUnitId: string, position: string): void;
77
- updateMRecOffsets(adUnitId: string, xOffset: number, yOffset: number): void;
78
- setMRecBackgroundColor(adUnitId: string, hexColorString: string): void;
102
+ createMREC(adUnitId: string, position: string): void;
103
+ createMRECWithOffsets(adUnitId: string, position: string, xOffset: number, yOffset: number): void;
104
+ setMRECPlacement(adUnitId: string, placement: string | null): void;
105
+ setMRECCustomData(adUnitId: string, customData: string | null): void;
106
+ updateMRECPosition(adUnitId: string, position: string): void;
107
+ updateMRECOffsets(adUnitId: string, xOffset: number, yOffset: number): void;
108
+ startMRECAutoRefresh(adUnitId: string): void;
109
+ stopMRECAutoRefresh(adUnitId: string): void;
110
+ showMREC(adUnitId: string): void;
111
+ hideMREC(adUnitId: string): void;
112
+ destroyMREC(adUnitId: string): void;
113
+ setMRECBackgroundColor(adUnitId: string, hexColorString: string): void;
79
114
 
80
115
  // =========================================================================
81
116
  // Interstitial
@@ -96,67 +131,11 @@ export interface Spec extends TurboModule {
96
131
  destroyRewarded(adUnitId: string): void;
97
132
 
98
133
  // =========================================================================
99
- // Constants (event names, positions, error codes)
134
+ // Event Emitter (required by NativeEventEmitter)
100
135
  // =========================================================================
101
136
 
102
- getConstants(): {
103
- // Banner events
104
- ON_BANNER_AD_LOADED_EVENT: string;
105
- ON_BANNER_AD_LOAD_FAILED_EVENT: string;
106
- ON_BANNER_AD_CLICKED_EVENT: string;
107
- ON_BANNER_AD_EXPANDED_EVENT: string;
108
- ON_BANNER_AD_COLLAPSED_EVENT: string;
109
- ON_BANNER_AD_REVENUE_PAID: string;
110
-
111
- // MREC events
112
- ON_MREC_AD_LOADED_EVENT: string;
113
- ON_MREC_AD_LOAD_FAILED_EVENT: string;
114
- ON_MREC_AD_CLICKED_EVENT: string;
115
- ON_MREC_AD_EXPANDED_EVENT: string;
116
- ON_MREC_AD_COLLAPSED_EVENT: string;
117
- ON_MREC_AD_REVENUE_PAID: string;
118
-
119
- // Interstitial events
120
- ON_INTERSTITIAL_LOADED_EVENT: string;
121
- ON_INTERSTITIAL_LOAD_FAILED_EVENT: string;
122
- ON_INTERSTITIAL_CLICKED_EVENT: string;
123
- ON_INTERSTITIAL_DISPLAYED_EVENT: string;
124
- ON_INTERSTITIAL_DISPLAY_FAILED_EVENT: string;
125
- ON_INTERSTITIAL_HIDDEN_EVENT: string;
126
- ON_INTERSTITIAL_AD_REVENUE_PAID: string;
127
-
128
- // Rewarded events
129
- ON_REWARDED_AD_LOADED_EVENT: string;
130
- ON_REWARDED_AD_LOAD_FAILED_EVENT: string;
131
- ON_REWARDED_AD_CLICKED_EVENT: string;
132
- ON_REWARDED_AD_DISPLAYED_EVENT: string;
133
- ON_REWARDED_AD_DISPLAY_FAILED_EVENT: string;
134
- ON_REWARDED_AD_HIDDEN_EVENT: string;
135
- ON_REWARDED_AD_RECEIVED_REWARD_EVENT: string;
136
- ON_REWARDED_AD_REVENUE_PAID: string;
137
-
138
- // Position constants
139
- TOP_LEFT_POSITION: string;
140
- TOP_CENTER_POSITION: string;
141
- TOP_RIGHT_POSITION: string;
142
- CENTER_LEFT_POSITION: string;
143
- CENTERED_POSITION: string;
144
- CENTER_RIGHT_POSITION: string;
145
- BOTTOM_LEFT_POSITION: string;
146
- BOTTOM_CENTER_POSITION: string;
147
- BOTTOM_RIGHT_POSITION: string;
148
-
149
- // Error code constants
150
- ERROR_CODE_INTERNAL_ERROR: number;
151
- ERROR_CODE_NETWORK_ERROR: number;
152
- ERROR_CODE_NETWORK_TIMEOUT: number;
153
- ERROR_CODE_NO_FILL: number;
154
- ERROR_CODE_AD_NOT_READY: number;
155
- ERROR_CODE_AD_ALREADY_SHOWING: number;
156
- ERROR_CODE_INVALID_AD_UNIT: number;
157
- ERROR_CODE_NOT_INITIALIZED: number;
158
- ERROR_CODE_NO_CONNECTION: number;
159
- };
137
+ addListener(eventName: string): void;
138
+ removeListeners(count: number): void;
160
139
  }
161
140
 
162
- export default TurboModuleRegistry.getEnforcing<Spec>('CloudXModule');
141
+ export default TurboModuleRegistry.getEnforcing<Spec>('CloudX');
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Represents any ad event object emitted by the native module.
3
3
  */
4
- import type { AdInfo, AdLoadFailedInfo, AdDisplayFailedInfo, AdRewardInfo } from './AdInfo';
4
+ import type { CloudXAdInfo, CloudXAdLoadFailedInfo, CloudXAdDisplayFailedInfo, CloudXAdRewardInfo } from './AdInfo';
5
5
 
6
- export type AdEventObject = AdInfo | AdLoadFailedInfo | AdDisplayFailedInfo | AdRewardInfo;
6
+ export type CloudXAdEventObject = CloudXAdInfo | CloudXAdLoadFailedInfo | CloudXAdDisplayFailedInfo | CloudXAdRewardInfo;
7
7
 
8
8
  /**
9
9
  * Generic ad event listener callback type.
10
10
  */
11
- export type AdEventListener<T extends AdEventObject = AdEventObject> = (event: T) => void;
11
+ export type CloudXAdEventListener<T extends CloudXAdEventObject = CloudXAdEventObject> = (event: T) => void;
@@ -1,9 +1,9 @@
1
- import type { ErrorCode } from '../ErrorCode';
1
+ import type { CloudXErrorCode } from '../CloudXErrorCode';
2
2
 
3
3
  /**
4
4
  * Represents a successfully loaded ad served by CloudX.
5
5
  */
6
- export type AdInfo = {
6
+ export type CloudXAdInfo = {
7
7
  /** The ad unit ID for this ad. */
8
8
  adUnitId: string;
9
9
 
@@ -26,12 +26,12 @@ export type AdInfo = {
26
26
  /**
27
27
  * Represents a failure when attempting to load an ad.
28
28
  */
29
- export type AdLoadFailedInfo = {
29
+ export type CloudXAdLoadFailedInfo = {
30
30
  /** The ad unit ID for which the load failed. */
31
31
  adUnitId: string;
32
32
 
33
33
  /** CloudX error code. */
34
- code: ErrorCode;
34
+ code: CloudXErrorCode;
35
35
 
36
36
  /** Descriptive error message. */
37
37
  message?: string | null;
@@ -40,9 +40,9 @@ export type AdLoadFailedInfo = {
40
40
  /**
41
41
  * Represents an error that occurred when displaying an ad.
42
42
  */
43
- export type AdDisplayFailedInfo = AdInfo & {
43
+ export type CloudXAdDisplayFailedInfo = CloudXAdInfo & {
44
44
  /** CloudX error code. */
45
- code: ErrorCode;
45
+ code: CloudXErrorCode;
46
46
 
47
47
  /** Descriptive error message. */
48
48
  message?: string | null;
@@ -51,7 +51,7 @@ export type AdDisplayFailedInfo = AdInfo & {
51
51
  /**
52
52
  * Represents a successful reward event from a rewarded ad.
53
53
  */
54
- export type AdRewardInfo = AdInfo & {
54
+ export type CloudXAdRewardInfo = CloudXAdInfo & {
55
55
  /** The label of the reward. */
56
56
  rewardLabel?: string | null;
57
57
 
@@ -0,0 +1,27 @@
1
+ import type { CloudXAdInfo, CloudXAdLoadFailedInfo } from './AdInfo';
2
+
3
+ /**
4
+ * Base props shared by ad UI components.
5
+ */
6
+ export type CloudXAdProps = {
7
+ /** The ad unit ID used to load ads. */
8
+ adUnitId: string;
9
+
10
+ /** Placement name for reporting. */
11
+ placement?: string | null;
12
+
13
+ /** Custom data string. */
14
+ customData?: string | null;
15
+
16
+ /** Called when a new ad is successfully loaded. */
17
+ onAdLoaded?: (adInfo: CloudXAdInfo) => void;
18
+
19
+ /** Called when the SDK fails to load a new ad. */
20
+ onAdLoadFailed?: (errorInfo: CloudXAdLoadFailedInfo) => void;
21
+
22
+ /** Called when the ad is clicked by the user. */
23
+ onAdClicked?: (adInfo: CloudXAdInfo) => void;
24
+
25
+ /** Called when ad revenue is paid to the publisher. */
26
+ onAdRevenuePaid?: (adInfo: CloudXAdInfo) => void;
27
+ };
@@ -1,59 +1,13 @@
1
- import type { AdInfo, AdLoadFailedInfo } from './AdInfo';
1
+ import type { CloudXViewAdType } from './ViewAd';
2
+ import type { CloudXAdPosition } from '../CloudXAdPosition';
2
3
 
3
4
  /**
4
- * Position constants for programmatic banner placement.
5
+ * Banner ad interface.
6
+ * Extends {@link CloudXViewAdType} with banner-specific methods.
5
7
  */
6
- export type AdViewPositionType =
7
- | 'top_left'
8
- | 'top_center'
9
- | 'top_right'
10
- | 'center_left'
11
- | 'centered'
12
- | 'center_right'
13
- | 'bottom_left'
14
- | 'bottom_center'
15
- | 'bottom_right';
16
-
17
- /**
18
- * Programmatic banner ad interface.
19
- */
20
- export type BannerAdType = {
21
- createAd(adUnitId: string, position: AdViewPositionType): void;
22
- createAdWithOffsets(adUnitId: string, position: AdViewPositionType, xOffset: number, yOffset: number): void;
23
- destroyAd(adUnitId: string): void;
24
- showAd(adUnitId: string): void;
25
- hideAd(adUnitId: string): void;
26
-
27
- updatePosition(adUnitId: string, position: AdViewPositionType): void;
8
+ export type CloudXBannerAdType = CloudXViewAdType & {
9
+ createAd(adUnitId: string, position: CloudXAdPosition): void;
10
+ createAdWithOffsets(adUnitId: string, position: CloudXAdPosition, xOffset: number, yOffset: number): void;
11
+ setBackgroundColor(adUnitId: string, hexColorCode: string): void;
28
12
  updateOffsets(adUnitId: string, xOffset: number, yOffset: number): void;
29
- setBackgroundColor(adUnitId: string, hexColorString: string): void;
30
-
31
- setPlacement(adUnitId: string, placement: string | null): void;
32
- setCustomData(adUnitId: string, customData: string | null): void;
33
-
34
- startAutoRefresh(adUnitId: string): void;
35
- stopAutoRefresh(adUnitId: string): void;
36
-
37
- addAdLoadedEventListener(listener: (adInfo: AdInfo) => void): void;
38
- removeAdLoadedEventListener(): void;
39
-
40
- addAdLoadFailedEventListener(listener: (errorInfo: AdLoadFailedInfo) => void): void;
41
- removeAdLoadFailedEventListener(): void;
42
-
43
- addAdClickedEventListener(listener: (adInfo: AdInfo) => void): void;
44
- removeAdClickedEventListener(): void;
45
-
46
- addAdExpandedEventListener(listener: (adInfo: AdInfo) => void): void;
47
- removeAdExpandedEventListener(): void;
48
-
49
- addAdCollapsedEventListener(listener: (adInfo: AdInfo) => void): void;
50
- removeAdCollapsedEventListener(): void;
51
-
52
- addAdRevenuePaidListener(listener: (adInfo: AdInfo) => void): void;
53
- removeAdRevenuePaidListener(): void;
54
13
  };
55
-
56
- /**
57
- * MREC ad type is identical to Banner in terms of API surface.
58
- */
59
- export type MRecAdType = BannerAdType;
@@ -1,20 +1,25 @@
1
- import type { Configuration } from './Configuration';
1
+ import type { CloudXInitializationResult } from './Configuration';
2
+
3
+ export type CloudXLogLevelValue = 'verbose' | 'debug' | 'info' | 'warn' | 'error' | 'none';
2
4
 
3
5
  /**
4
6
  * Main CloudX SDK module interface.
5
7
  */
6
8
  export type CloudXType = {
7
- /** Initializes the CloudX SDK with the given app key. */
8
- initialize(appKey: string): Promise<Configuration>;
9
-
10
9
  /** Returns whether the SDK has been initialized. */
11
10
  isInitialized(): Promise<boolean>;
12
11
 
12
+ /** Initializes the CloudX SDK with the given app key. */
13
+ initialize(appKey: string): Promise<CloudXInitializationResult>;
14
+
15
+ /** Checks whether the current device is a tablet. */
16
+ isTablet(): Promise<boolean>;
17
+
13
18
  /** Returns the native SDK version string. */
14
19
  getVersion(): Promise<string>;
15
20
 
16
21
  /** Sets the minimum log level for CloudX SDK logging. */
17
- setMinLogLevel(level: string): void;
22
+ setMinLogLevel(level: CloudXLogLevelValue): void;
18
23
 
19
24
  /** Sets a hashed user ID for targeting. */
20
25
  setHashedUserID(hashedUserID: string): void;
@@ -1,10 +1,15 @@
1
1
  /**
2
- * SDK configuration returned after successful initialization.
2
+ * Result object returned after calling `initialize()`.
3
3
  */
4
- export type Configuration = {
4
+ export type CloudXInitializationResult = {
5
5
  /** Whether initialization was successful. */
6
6
  success: boolean;
7
7
 
8
- /** Optional message with additional details. */
8
+ /** Optional message with additional details, populated on failure. */
9
9
  message?: string | null;
10
10
  };
11
+
12
+ /**
13
+ * @deprecated Use `CloudXInitializationResult` instead.
14
+ */
15
+ export type CloudXConfiguration = CloudXInitializationResult;
@@ -1,9 +1,10 @@
1
- import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo } from './AdInfo';
1
+ import type { CloudXAdDisplayFailedInfo, CloudXAdInfo, CloudXAdLoadFailedInfo } from './AdInfo';
2
+ import type { CloudXAdEventListener } from './AdEvent';
2
3
 
3
4
  /**
4
5
  * Shared interface for fullscreen ad types (Interstitial, Rewarded).
5
6
  */
6
- export type FullscreenAdType = {
7
+ export type CloudXFullscreenAdType = {
7
8
  /** Returns whether an ad is ready to display. */
8
9
  isAdReady(adUnitId: string): Promise<boolean>;
9
10
 
@@ -16,24 +17,24 @@ export type FullscreenAdType = {
16
17
  /** Destroys the ad instance and frees resources. */
17
18
  destroyAd(adUnitId: string): void;
18
19
 
19
- addAdLoadedEventListener(listener: (adInfo: AdInfo) => void): void;
20
+ addAdLoadedEventListener(listener: CloudXAdEventListener<CloudXAdInfo>): void;
20
21
  removeAdLoadedEventListener(): void;
21
22
 
22
- addAdLoadFailedEventListener(listener: (errorInfo: AdLoadFailedInfo) => void): void;
23
+ addAdLoadFailedEventListener(listener: CloudXAdEventListener<CloudXAdLoadFailedInfo>): void;
23
24
  removeAdLoadFailedEventListener(): void;
24
25
 
25
- addAdClickedEventListener(listener: (adInfo: AdInfo) => void): void;
26
+ addAdClickedEventListener(listener: CloudXAdEventListener<CloudXAdInfo>): void;
26
27
  removeAdClickedEventListener(): void;
27
28
 
28
- addAdDisplayedEventListener(listener: (adInfo: AdInfo) => void): void;
29
+ addAdDisplayedEventListener(listener: CloudXAdEventListener<CloudXAdInfo>): void;
29
30
  removeAdDisplayedEventListener(): void;
30
31
 
31
- addAdFailedToDisplayEventListener(listener: (errorInfo: AdDisplayFailedInfo) => void): void;
32
+ addAdFailedToDisplayEventListener(listener: CloudXAdEventListener<CloudXAdDisplayFailedInfo>): void;
32
33
  removeAdFailedToDisplayEventListener(): void;
33
34
 
34
- addAdHiddenEventListener(listener: (adInfo: AdInfo) => void): void;
35
+ addAdHiddenEventListener(listener: CloudXAdEventListener<CloudXAdInfo>): void;
35
36
  removeAdHiddenEventListener(): void;
36
37
 
37
- addAdRevenuePaidListener(listener: (adInfo: AdInfo) => void): void;
38
+ addAdRevenuePaidListener(listener: CloudXAdEventListener<CloudXAdInfo>): void;
38
39
  removeAdRevenuePaidListener(): void;
39
40
  };
@@ -0,0 +1,8 @@
1
+ import type { CloudXFullscreenAdType } from './FullscreenAd';
2
+
3
+ /**
4
+ * Interstitial ad type — identical to the fullscreen ad interface.
5
+ * Provides a named type for consumers and a place to add interstitial-specific
6
+ * methods in the future without refactoring.
7
+ */
8
+ export type CloudXInterstitialAdType = CloudXFullscreenAdType;
@@ -0,0 +1,13 @@
1
+ import type { CloudXViewAdType } from './ViewAd';
2
+ import type { CloudXAdPosition } from '../CloudXAdPosition';
3
+
4
+ /**
5
+ * MREC ad interface.
6
+ * Extends {@link CloudXViewAdType} with MREC-specific methods.
7
+ */
8
+ export type CloudXMRECAdType = CloudXViewAdType & {
9
+ createAd(adUnitId: string, position: CloudXAdPosition): void;
10
+ createAdWithOffsets(adUnitId: string, position: CloudXAdPosition, xOffset: number, yOffset: number): void;
11
+ setBackgroundColor(adUnitId: string, hexColorCode: string): void;
12
+ updateOffsets(adUnitId: string, xOffset: number, yOffset: number): void;
13
+ };
@@ -1,10 +1,11 @@
1
- import type { AdRewardInfo } from './AdInfo';
2
- import type { FullscreenAdType } from './FullscreenAd';
1
+ import type { CloudXAdRewardInfo } from './AdInfo';
2
+ import type { CloudXAdEventListener } from './AdEvent';
3
+ import type { CloudXFullscreenAdType } from './FullscreenAd';
3
4
 
4
5
  /**
5
6
  * Rewarded ad interface, extending fullscreen ad with reward listener.
6
7
  */
7
- export type RewardedAdType = FullscreenAdType & {
8
- addAdReceivedRewardEventListener(listener: (rewardInfo: AdRewardInfo) => void): void;
8
+ export type CloudXRewardedAdType = CloudXFullscreenAdType & {
9
+ addAdReceivedRewardEventListener(listener: CloudXAdEventListener<CloudXAdRewardInfo>): void;
9
10
  removeAdReceivedRewardEventListener(): void;
10
11
  };
@@ -0,0 +1,38 @@
1
+ import type { CloudXAdInfo, CloudXAdLoadFailedInfo } from './AdInfo';
2
+ import type { CloudXAdEventListener } from './AdEvent';
3
+ import type { CloudXAdPosition } from '../CloudXAdPosition';
4
+
5
+ /**
6
+ * Shared interface for view-based ads (Banners and MRECs).
7
+ */
8
+ export type CloudXViewAdType = {
9
+ destroyAd(adUnitId: string): void;
10
+ showAd(adUnitId: string): void;
11
+ hideAd(adUnitId: string): void;
12
+
13
+ setPlacement(adUnitId: string, placement: string | null): void;
14
+ setCustomData(adUnitId: string, customData: string | null): void;
15
+
16
+ updatePosition(adUnitId: string, bannerPosition: CloudXAdPosition): void;
17
+
18
+ startAutoRefresh(adUnitId: string): void;
19
+ stopAutoRefresh(adUnitId: string): void;
20
+
21
+ addAdLoadedEventListener(listener: CloudXAdEventListener<CloudXAdInfo>): void;
22
+ removeAdLoadedEventListener(): void;
23
+
24
+ addAdLoadFailedEventListener(listener: CloudXAdEventListener<CloudXAdLoadFailedInfo>): void;
25
+ removeAdLoadFailedEventListener(): void;
26
+
27
+ addAdClickedEventListener(listener: CloudXAdEventListener<CloudXAdInfo>): void;
28
+ removeAdClickedEventListener(): void;
29
+
30
+ addAdExpandedEventListener(listener: CloudXAdEventListener<CloudXAdInfo>): void;
31
+ removeAdExpandedEventListener(): void;
32
+
33
+ addAdCollapsedEventListener(listener: CloudXAdEventListener<CloudXAdInfo>): void;
34
+ removeAdCollapsedEventListener(): void;
35
+
36
+ addAdRevenuePaidListener(listener: CloudXAdEventListener<CloudXAdInfo>): void;
37
+ removeAdRevenuePaidListener(): void;
38
+ };
@@ -1,7 +1,11 @@
1
- export type { AdInfo, AdLoadFailedInfo, AdDisplayFailedInfo, AdRewardInfo } from './AdInfo';
2
- export type { Configuration } from './Configuration';
3
- export type { CloudXType } from './CloudX';
4
- export type { FullscreenAdType } from './FullscreenAd';
5
- export type { RewardedAdType } from './RewardedAd';
6
- export type { BannerAdType, MRecAdType, AdViewPositionType } from './BannerAd';
7
- export type { AdEventObject, AdEventListener } from './AdEvent';
1
+ export type { CloudXAdInfo, CloudXAdLoadFailedInfo, CloudXAdDisplayFailedInfo, CloudXAdRewardInfo } from './AdInfo';
2
+ export type { CloudXInitializationResult, CloudXConfiguration } from './Configuration';
3
+ export type { CloudXType, CloudXLogLevelValue } from './CloudX';
4
+ export type { CloudXFullscreenAdType } from './FullscreenAd';
5
+ export type { CloudXInterstitialAdType } from './InterstitialAd';
6
+ export type { CloudXRewardedAdType } from './RewardedAd';
7
+ export type { CloudXViewAdType } from './ViewAd';
8
+ export type { CloudXBannerAdType } from './BannerAd';
9
+ export type { CloudXMRECAdType } from './MRECAd';
10
+ export type { CloudXAdProps } from './AdProps';
11
+ export type { CloudXAdEventObject, CloudXAdEventListener } from './AdEvent';
@@ -1,15 +0,0 @@
1
- package com.cloudxreactnative
2
-
3
- import com.facebook.react.bridge.WritableMap
4
- import com.facebook.react.uimanager.events.Event
5
-
6
- class CloudXAdViewEvent(
7
- surfaceId: Int,
8
- viewId: Int,
9
- private val name: String,
10
- private val payload: WritableMap?
11
- ) : Event<CloudXAdViewEvent>(surfaceId, viewId) {
12
- override fun getEventName(): String = name
13
- override fun canCoalesce(): Boolean = false
14
- override fun getEventData(): WritableMap? = payload
15
- }