cloudx-react-native 2.0.0-beta.1

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 (171) hide show
  1. package/LICENSE +57 -0
  2. package/README.md +1258 -0
  3. package/android/build.gradle +78 -0
  4. package/android/gradle.properties +7 -0
  5. package/android/src/main/AndroidManifest.xml +7 -0
  6. package/android/src/main/java/com/cloudxreactnative/CloudXAdViewEvent.kt +15 -0
  7. package/android/src/main/java/com/cloudxreactnative/CloudXBannerViewManagerImpl.kt +472 -0
  8. package/android/src/main/java/com/cloudxreactnative/CloudXReactNativeModuleImpl.kt +861 -0
  9. package/android/src/newarch/com/cloudxreactnative/CloudXBannerViewManager.kt +90 -0
  10. package/android/src/newarch/com/cloudxreactnative/CloudXReactNativeModule.kt +73 -0
  11. package/android/src/newarch/com/cloudxreactnative/CloudXReactNativePackage.kt +37 -0
  12. package/android/src/oldarch/com/cloudxreactnative/CloudXBannerViewManager.kt +76 -0
  13. package/android/src/oldarch/com/cloudxreactnative/CloudXReactNativeModule.kt +73 -0
  14. package/android/src/oldarch/com/cloudxreactnative/CloudXReactNativePackage.kt +16 -0
  15. package/cloudx-react-native.podspec +46 -0
  16. package/ios/AppTrackingTransparency.h +13 -0
  17. package/ios/AppTrackingTransparency.mm +59 -0
  18. package/ios/RNCloudXBannerView.h +51 -0
  19. package/ios/RNCloudXBannerView.mm +633 -0
  20. package/ios/RNCloudXBannerViewManager.h +11 -0
  21. package/ios/RNCloudXBannerViewManager.mm +60 -0
  22. package/ios/RNCloudXModule.h +30 -0
  23. package/ios/RNCloudXModule.mm +1088 -0
  24. package/lib/commonjs/AdView.js +151 -0
  25. package/lib/commonjs/AdView.js.map +1 -0
  26. package/lib/commonjs/AppTrackingTransparency.js +62 -0
  27. package/lib/commonjs/AppTrackingTransparency.js.map +1 -0
  28. package/lib/commonjs/BannerAd.js +117 -0
  29. package/lib/commonjs/BannerAd.js.map +1 -0
  30. package/lib/commonjs/CloudX.js +49 -0
  31. package/lib/commonjs/CloudX.js.map +1 -0
  32. package/lib/commonjs/ErrorCode.js +116 -0
  33. package/lib/commonjs/ErrorCode.js.map +1 -0
  34. package/lib/commonjs/EventEmitter.js +44 -0
  35. package/lib/commonjs/EventEmitter.js.map +1 -0
  36. package/lib/commonjs/InterstitialAd.js +94 -0
  37. package/lib/commonjs/InterstitialAd.js.map +1 -0
  38. package/lib/commonjs/MRecAd.js +117 -0
  39. package/lib/commonjs/MRecAd.js.map +1 -0
  40. package/lib/commonjs/RewardedAd.js +103 -0
  41. package/lib/commonjs/RewardedAd.js.map +1 -0
  42. package/lib/commonjs/hooks.js +239 -0
  43. package/lib/commonjs/hooks.js.map +1 -0
  44. package/lib/commonjs/index.js +144 -0
  45. package/lib/commonjs/index.js.map +1 -0
  46. package/lib/commonjs/specs/CloudXAdViewNativeComponent.js +26 -0
  47. package/lib/commonjs/specs/CloudXAdViewNativeComponent.js.map +1 -0
  48. package/lib/commonjs/specs/NativeCloudXModule.js +18 -0
  49. package/lib/commonjs/specs/NativeCloudXModule.js.map +1 -0
  50. package/lib/commonjs/types/AdEvent.js +6 -0
  51. package/lib/commonjs/types/AdEvent.js.map +1 -0
  52. package/lib/commonjs/types/AdInfo.js +6 -0
  53. package/lib/commonjs/types/AdInfo.js.map +1 -0
  54. package/lib/commonjs/types/BannerAd.js +6 -0
  55. package/lib/commonjs/types/BannerAd.js.map +1 -0
  56. package/lib/commonjs/types/CloudX.js +6 -0
  57. package/lib/commonjs/types/CloudX.js.map +1 -0
  58. package/lib/commonjs/types/Configuration.js +2 -0
  59. package/lib/commonjs/types/Configuration.js.map +1 -0
  60. package/lib/commonjs/types/FullscreenAd.js +6 -0
  61. package/lib/commonjs/types/FullscreenAd.js.map +1 -0
  62. package/lib/commonjs/types/RewardedAd.js +6 -0
  63. package/lib/commonjs/types/RewardedAd.js.map +1 -0
  64. package/lib/commonjs/types/index.js +2 -0
  65. package/lib/commonjs/types/index.js.map +1 -0
  66. package/lib/module/AdView.js +144 -0
  67. package/lib/module/AdView.js.map +1 -0
  68. package/lib/module/AppTrackingTransparency.js +55 -0
  69. package/lib/module/AppTrackingTransparency.js.map +1 -0
  70. package/lib/module/BannerAd.js +110 -0
  71. package/lib/module/BannerAd.js.map +1 -0
  72. package/lib/module/CloudX.js +42 -0
  73. package/lib/module/CloudX.js.map +1 -0
  74. package/lib/module/ErrorCode.js +110 -0
  75. package/lib/module/ErrorCode.js.map +1 -0
  76. package/lib/module/EventEmitter.js +35 -0
  77. package/lib/module/EventEmitter.js.map +1 -0
  78. package/lib/module/InterstitialAd.js +87 -0
  79. package/lib/module/InterstitialAd.js.map +1 -0
  80. package/lib/module/MRecAd.js +110 -0
  81. package/lib/module/MRecAd.js.map +1 -0
  82. package/lib/module/RewardedAd.js +96 -0
  83. package/lib/module/RewardedAd.js.map +1 -0
  84. package/lib/module/hooks.js +230 -0
  85. package/lib/module/hooks.js.map +1 -0
  86. package/lib/module/index.js +33 -0
  87. package/lib/module/index.js.map +1 -0
  88. package/lib/module/specs/CloudXAdViewNativeComponent.js +20 -0
  89. package/lib/module/specs/CloudXAdViewNativeComponent.js.map +1 -0
  90. package/lib/module/specs/NativeCloudXModule.js +14 -0
  91. package/lib/module/specs/NativeCloudXModule.js.map +1 -0
  92. package/lib/module/types/AdEvent.js +2 -0
  93. package/lib/module/types/AdEvent.js.map +1 -0
  94. package/lib/module/types/AdInfo.js +2 -0
  95. package/lib/module/types/AdInfo.js.map +1 -0
  96. package/lib/module/types/BannerAd.js +2 -0
  97. package/lib/module/types/BannerAd.js.map +1 -0
  98. package/lib/module/types/CloudX.js +2 -0
  99. package/lib/module/types/CloudX.js.map +1 -0
  100. package/lib/module/types/Configuration.js +2 -0
  101. package/lib/module/types/Configuration.js.map +1 -0
  102. package/lib/module/types/FullscreenAd.js +2 -0
  103. package/lib/module/types/FullscreenAd.js.map +1 -0
  104. package/lib/module/types/RewardedAd.js +2 -0
  105. package/lib/module/types/RewardedAd.js.map +1 -0
  106. package/lib/module/types/index.js +2 -0
  107. package/lib/module/types/index.js.map +1 -0
  108. package/lib/typescript/src/AdView.d.ts +69 -0
  109. package/lib/typescript/src/AdView.d.ts.map +1 -0
  110. package/lib/typescript/src/AppTrackingTransparency.d.ts +28 -0
  111. package/lib/typescript/src/AppTrackingTransparency.d.ts.map +1 -0
  112. package/lib/typescript/src/BannerAd.d.ts +4 -0
  113. package/lib/typescript/src/BannerAd.d.ts.map +1 -0
  114. package/lib/typescript/src/CloudX.d.ts +4 -0
  115. package/lib/typescript/src/CloudX.d.ts.map +1 -0
  116. package/lib/typescript/src/ErrorCode.d.ts +102 -0
  117. package/lib/typescript/src/ErrorCode.d.ts.map +1 -0
  118. package/lib/typescript/src/EventEmitter.d.ts +16 -0
  119. package/lib/typescript/src/EventEmitter.d.ts.map +1 -0
  120. package/lib/typescript/src/InterstitialAd.d.ts +4 -0
  121. package/lib/typescript/src/InterstitialAd.d.ts.map +1 -0
  122. package/lib/typescript/src/MRecAd.d.ts +4 -0
  123. package/lib/typescript/src/MRecAd.d.ts.map +1 -0
  124. package/lib/typescript/src/RewardedAd.d.ts +4 -0
  125. package/lib/typescript/src/RewardedAd.d.ts.map +1 -0
  126. package/lib/typescript/src/hooks.d.ts +50 -0
  127. package/lib/typescript/src/hooks.d.ts.map +1 -0
  128. package/lib/typescript/src/index.d.ts +23 -0
  129. package/lib/typescript/src/index.d.ts.map +1 -0
  130. package/lib/typescript/src/specs/CloudXAdViewNativeComponent.d.ts +61 -0
  131. package/lib/typescript/src/specs/CloudXAdViewNativeComponent.d.ts.map +1 -0
  132. package/lib/typescript/src/specs/NativeCloudXModule.d.ts +106 -0
  133. package/lib/typescript/src/specs/NativeCloudXModule.d.ts.map +1 -0
  134. package/lib/typescript/src/types/AdEvent.d.ts +10 -0
  135. package/lib/typescript/src/types/AdEvent.d.ts.map +1 -0
  136. package/lib/typescript/src/types/AdInfo.d.ts +48 -0
  137. package/lib/typescript/src/types/AdInfo.d.ts.map +1 -0
  138. package/lib/typescript/src/types/BannerAd.d.ts +39 -0
  139. package/lib/typescript/src/types/BannerAd.d.ts.map +1 -0
  140. package/lib/typescript/src/types/CloudX.d.ts +25 -0
  141. package/lib/typescript/src/types/CloudX.d.ts.map +1 -0
  142. package/lib/typescript/src/types/Configuration.d.ts +10 -0
  143. package/lib/typescript/src/types/Configuration.d.ts.map +1 -0
  144. package/lib/typescript/src/types/FullscreenAd.d.ts +29 -0
  145. package/lib/typescript/src/types/FullscreenAd.d.ts.map +1 -0
  146. package/lib/typescript/src/types/RewardedAd.d.ts +10 -0
  147. package/lib/typescript/src/types/RewardedAd.d.ts.map +1 -0
  148. package/lib/typescript/src/types/index.d.ts +8 -0
  149. package/lib/typescript/src/types/index.d.ts.map +1 -0
  150. package/package.json +78 -0
  151. package/src/AdView.tsx +213 -0
  152. package/src/AppTrackingTransparency.ts +56 -0
  153. package/src/BannerAd.ts +133 -0
  154. package/src/CloudX.ts +55 -0
  155. package/src/ErrorCode.ts +157 -0
  156. package/src/EventEmitter.ts +38 -0
  157. package/src/InterstitialAd.ts +103 -0
  158. package/src/MRecAd.ts +133 -0
  159. package/src/RewardedAd.ts +113 -0
  160. package/src/hooks.ts +292 -0
  161. package/src/index.ts +50 -0
  162. package/src/specs/CloudXAdViewNativeComponent.ts +82 -0
  163. package/src/specs/NativeCloudXModule.ts +162 -0
  164. package/src/types/AdEvent.ts +11 -0
  165. package/src/types/AdInfo.ts +60 -0
  166. package/src/types/BannerAd.ts +59 -0
  167. package/src/types/CloudX.ts +33 -0
  168. package/src/types/Configuration.ts +10 -0
  169. package/src/types/FullscreenAd.ts +39 -0
  170. package/src/types/RewardedAd.ts +10 -0
  171. package/src/types/index.ts +7 -0
@@ -0,0 +1,82 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import type { DirectEventHandler, Int32, Double } from 'react-native/Libraries/Types/CodegenTypes';
3
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
5
+
6
+ /**
7
+ * Ad info event payload from native.
8
+ */
9
+ export type AdInfoEvent = Readonly<{
10
+ adUnitId: string;
11
+ adFormat: string;
12
+ networkName: string;
13
+ networkPlacement: string;
14
+ placement: string;
15
+ revenue: Double;
16
+ }>;
17
+
18
+ /**
19
+ * Ad error event payload from native.
20
+ */
21
+ export type AdErrorEvent = Readonly<{
22
+ adUnitId: string;
23
+ code: Int32;
24
+ message: string;
25
+ }>;
26
+
27
+ /**
28
+ * Props for CloudXAdView native component.
29
+ */
30
+ export interface NativeProps extends ViewProps {
31
+ /** The ad unit ID. */
32
+ adUnitId?: string | null;
33
+
34
+ /** The ad format: "BANNER" or "MREC". */
35
+ adFormat?: string | null;
36
+
37
+ /** Placement name. */
38
+ placement?: string | null;
39
+
40
+ /** Custom data string. */
41
+ customData?: string | null;
42
+
43
+ /** Whether to automatically refresh the ad. */
44
+ autoRefresh?: boolean;
45
+
46
+ /** Whether to load the ad on mount. */
47
+ loadOnMount?: boolean;
48
+
49
+ /** Position for programmatic window-level placement (e.g. "TOP_CENTER", "BOTTOM_CENTER"). */
50
+ adPosition?: string | null;
51
+
52
+ /** Called when ad is loaded. */
53
+ onAdLoaded?: DirectEventHandler<AdInfoEvent>;
54
+
55
+ /** Called when ad fails to load. */
56
+ onAdLoadFailed?: DirectEventHandler<AdErrorEvent>;
57
+
58
+ /** Called when ad is clicked. */
59
+ onAdClicked?: DirectEventHandler<AdInfoEvent>;
60
+
61
+ /** Called when ad expands. */
62
+ onAdExpanded?: DirectEventHandler<AdInfoEvent>;
63
+
64
+ /** Called when ad collapses. */
65
+ onAdCollapsed?: DirectEventHandler<AdInfoEvent>;
66
+
67
+ /** Called when ad revenue is paid. */
68
+ onAdRevenuePaid?: DirectEventHandler<AdInfoEvent>;
69
+ }
70
+
71
+ type NativeComponentType = HostComponent<NativeProps>;
72
+
73
+ interface NativeCommands {
74
+ loadAd: (viewRef: React.ElementRef<NativeComponentType>) => void;
75
+ destroy: (viewRef: React.ElementRef<NativeComponentType>) => void;
76
+ }
77
+
78
+ export const Commands = codegenNativeCommands<NativeCommands>({
79
+ supportedCommands: ['loadAd', 'destroy'],
80
+ });
81
+
82
+ export default codegenNativeComponent<NativeProps>('CloudXAdView') as NativeComponentType;
@@ -0,0 +1,162 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ /**
5
+ * TurboModule spec for the CloudX native module.
6
+ *
7
+ * This spec defines every native method exposed to JavaScript.
8
+ * Codegen uses this to produce type-safe native bindings.
9
+ *
10
+ * All methods correspond 1-to-1 with public APIs in the native iOS SDK
11
+ * (CloudXCore 2.1.0-beta) and the native Android SDK.
12
+ */
13
+ export interface Spec extends TurboModule {
14
+ // =========================================================================
15
+ // Event Emitter (required by NativeEventEmitter)
16
+ // =========================================================================
17
+
18
+ addListener(eventName: string): void;
19
+ removeListeners(count: number): void;
20
+
21
+ // =========================================================================
22
+ // Initialization
23
+ // =========================================================================
24
+
25
+ initialize(pluginVersion: string, appKey: string): Promise<Object>;
26
+ isInitialized(): Promise<boolean>;
27
+ isTablet(): Promise<boolean>;
28
+ getVersion(): Promise<string>;
29
+
30
+ // =========================================================================
31
+ // Configuration
32
+ // =========================================================================
33
+
34
+ setMinLogLevel(level: string): void;
35
+ setVisualDebuggingEnabled(enabled: boolean): void;
36
+
37
+ // =========================================================================
38
+ // User Targeting
39
+ // =========================================================================
40
+
41
+ setHashedUserID(hashedUserID: string): void;
42
+ setUserKeyValue(key: string, value: string): void;
43
+ setAppKeyValue(key: string, value: string): void;
44
+ clearAllKeyValues(): void;
45
+
46
+ // =========================================================================
47
+ // Banner (Programmatic)
48
+ // =========================================================================
49
+
50
+ createBanner(adUnitId: string, position: string): void;
51
+ 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;
55
+ setBannerPlacement(adUnitId: string, placement: string | null): void;
56
+ setBannerCustomData(adUnitId: string, customData: string | null): void;
57
+ startBannerAutoRefresh(adUnitId: string): void;
58
+ stopBannerAutoRefresh(adUnitId: string): void;
59
+ updateBannerPosition(adUnitId: string, position: string): void;
60
+ updateBannerOffsets(adUnitId: string, xOffset: number, yOffset: number): void;
61
+ setBannerBackgroundColor(adUnitId: string, hexColorString: string): void;
62
+
63
+ // =========================================================================
64
+ // MREC (Programmatic)
65
+ // =========================================================================
66
+
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;
79
+
80
+ // =========================================================================
81
+ // Interstitial
82
+ // =========================================================================
83
+
84
+ loadInterstitial(adUnitId: string): void;
85
+ isInterstitialReady(adUnitId: string): Promise<boolean>;
86
+ showInterstitial(adUnitId: string, placement?: string | null, customData?: string | null): void;
87
+ destroyInterstitial(adUnitId: string): void;
88
+
89
+ // =========================================================================
90
+ // Rewarded
91
+ // =========================================================================
92
+
93
+ loadRewarded(adUnitId: string): void;
94
+ isRewardedReady(adUnitId: string): Promise<boolean>;
95
+ showRewarded(adUnitId: string, placement?: string | null, customData?: string | null): void;
96
+ destroyRewarded(adUnitId: string): void;
97
+
98
+ // =========================================================================
99
+ // Constants (event names, positions, error codes)
100
+ // =========================================================================
101
+
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
+ };
160
+ }
161
+
162
+ export default TurboModuleRegistry.getEnforcing<Spec>('CloudXModule');
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Represents any ad event object emitted by the native module.
3
+ */
4
+ import type { AdInfo, AdLoadFailedInfo, AdDisplayFailedInfo, AdRewardInfo } from './AdInfo';
5
+
6
+ export type AdEventObject = AdInfo | AdLoadFailedInfo | AdDisplayFailedInfo | AdRewardInfo;
7
+
8
+ /**
9
+ * Generic ad event listener callback type.
10
+ */
11
+ export type AdEventListener<T extends AdEventObject = AdEventObject> = (event: T) => void;
@@ -0,0 +1,60 @@
1
+ import type { ErrorCode } from '../ErrorCode';
2
+
3
+ /**
4
+ * Represents a successfully loaded ad served by CloudX.
5
+ */
6
+ export type AdInfo = {
7
+ /** The ad unit ID for this ad. */
8
+ adUnitId: string;
9
+
10
+ /** The format of the ad (e.g., "BANNER", "MREC", "INTERSTITIAL", "REWARDED"). */
11
+ adFormat: string;
12
+
13
+ /** The name of the ad network that served the ad. */
14
+ networkName: string;
15
+
16
+ /** The name of the placement as configured on the ad network side. */
17
+ networkPlacement?: string | null;
18
+
19
+ /** The custom placement name defined in your integration. */
20
+ placement?: string | null;
21
+
22
+ /** The revenue generated from the ad impression, in USD. Defaults to 0. */
23
+ revenue: number;
24
+ };
25
+
26
+ /**
27
+ * Represents a failure when attempting to load an ad.
28
+ */
29
+ export type AdLoadFailedInfo = {
30
+ /** The ad unit ID for which the load failed. */
31
+ adUnitId: string;
32
+
33
+ /** CloudX error code. */
34
+ code: ErrorCode;
35
+
36
+ /** Descriptive error message. */
37
+ message?: string | null;
38
+ };
39
+
40
+ /**
41
+ * Represents an error that occurred when displaying an ad.
42
+ */
43
+ export type AdDisplayFailedInfo = AdInfo & {
44
+ /** CloudX error code. */
45
+ code: ErrorCode;
46
+
47
+ /** Descriptive error message. */
48
+ message?: string | null;
49
+ };
50
+
51
+ /**
52
+ * Represents a successful reward event from a rewarded ad.
53
+ */
54
+ export type AdRewardInfo = AdInfo & {
55
+ /** The label of the reward. */
56
+ rewardLabel?: string | null;
57
+
58
+ /** The reward amount. */
59
+ rewardAmount: number;
60
+ };
@@ -0,0 +1,59 @@
1
+ import type { AdInfo, AdLoadFailedInfo } from './AdInfo';
2
+
3
+ /**
4
+ * Position constants for programmatic banner placement.
5
+ */
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;
28
+ 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
+ };
55
+
56
+ /**
57
+ * MREC ad type is identical to Banner in terms of API surface.
58
+ */
59
+ export type MRecAdType = BannerAdType;
@@ -0,0 +1,33 @@
1
+ import type { Configuration } from './Configuration';
2
+
3
+ /**
4
+ * Main CloudX SDK module interface.
5
+ */
6
+ export type CloudXType = {
7
+ /** Initializes the CloudX SDK with the given app key. */
8
+ initialize(appKey: string): Promise<Configuration>;
9
+
10
+ /** Returns whether the SDK has been initialized. */
11
+ isInitialized(): Promise<boolean>;
12
+
13
+ /** Returns the native SDK version string. */
14
+ getVersion(): Promise<string>;
15
+
16
+ /** Sets the minimum log level for CloudX SDK logging. */
17
+ setMinLogLevel(level: string): void;
18
+
19
+ /** Sets a hashed user ID for targeting. */
20
+ setHashedUserID(hashedUserID: string): void;
21
+
22
+ /** Sets a user-level key-value pair for targeting. */
23
+ setUserKeyValue(key: string, value: string): void;
24
+
25
+ /** Sets an app-level key-value pair for targeting. */
26
+ setAppKeyValue(key: string, value: string): void;
27
+
28
+ /** Clears all targeting key-values. */
29
+ clearAllKeyValues(): void;
30
+
31
+ /** Enables or disables visual debugging overlay (iOS only; no-op on Android). */
32
+ setVisualDebuggingEnabled(enabled: boolean): void;
33
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * SDK configuration returned after successful initialization.
3
+ */
4
+ export type Configuration = {
5
+ /** Whether initialization was successful. */
6
+ success: boolean;
7
+
8
+ /** Optional message with additional details. */
9
+ message?: string | null;
10
+ };
@@ -0,0 +1,39 @@
1
+ import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo } from './AdInfo';
2
+
3
+ /**
4
+ * Shared interface for fullscreen ad types (Interstitial, Rewarded).
5
+ */
6
+ export type FullscreenAdType = {
7
+ /** Returns whether an ad is ready to display. */
8
+ isAdReady(adUnitId: string): Promise<boolean>;
9
+
10
+ /** Loads an ad for the given ad unit. */
11
+ loadAd(adUnitId: string): void;
12
+
13
+ /** Shows a previously loaded ad. */
14
+ showAd(adUnitId: string, placement?: string | null, customData?: string | null): void;
15
+
16
+ /** Destroys the ad instance and frees resources. */
17
+ destroyAd(adUnitId: string): void;
18
+
19
+ addAdLoadedEventListener(listener: (adInfo: AdInfo) => void): void;
20
+ removeAdLoadedEventListener(): void;
21
+
22
+ addAdLoadFailedEventListener(listener: (errorInfo: AdLoadFailedInfo) => void): void;
23
+ removeAdLoadFailedEventListener(): void;
24
+
25
+ addAdClickedEventListener(listener: (adInfo: AdInfo) => void): void;
26
+ removeAdClickedEventListener(): void;
27
+
28
+ addAdDisplayedEventListener(listener: (adInfo: AdInfo) => void): void;
29
+ removeAdDisplayedEventListener(): void;
30
+
31
+ addAdFailedToDisplayEventListener(listener: (errorInfo: AdDisplayFailedInfo) => void): void;
32
+ removeAdFailedToDisplayEventListener(): void;
33
+
34
+ addAdHiddenEventListener(listener: (adInfo: AdInfo) => void): void;
35
+ removeAdHiddenEventListener(): void;
36
+
37
+ addAdRevenuePaidListener(listener: (adInfo: AdInfo) => void): void;
38
+ removeAdRevenuePaidListener(): void;
39
+ };
@@ -0,0 +1,10 @@
1
+ import type { AdRewardInfo } from './AdInfo';
2
+ import type { FullscreenAdType } from './FullscreenAd';
3
+
4
+ /**
5
+ * Rewarded ad interface, extending fullscreen ad with reward listener.
6
+ */
7
+ export type RewardedAdType = FullscreenAdType & {
8
+ addAdReceivedRewardEventListener(listener: (rewardInfo: AdRewardInfo) => void): void;
9
+ removeAdReceivedRewardEventListener(): void;
10
+ };
@@ -0,0 +1,7 @@
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';