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,8 +1,12 @@
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';
8
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC5F,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC/E,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACpH,YAAY,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACvF,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAChE,YAAY,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,YAAY,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudx-react-native",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.0",
4
4
  "description": "React Native wrapper for CloudX SDK (iOS & Android)",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -16,7 +16,11 @@
16
16
  "!**/__tests__",
17
17
  "!**/__fixtures__",
18
18
  "!**/__mocks__",
19
- "!lib/typescript/example"
19
+ "!lib/typescript/example",
20
+ "!android/build",
21
+ "!android/.gradle",
22
+ "!android/.cxx",
23
+ "!ios/build"
20
24
  ],
21
25
  "repository": {
22
26
  "type": "git",
@@ -51,15 +55,9 @@
51
55
  "typescript": "^5.2.2"
52
56
  },
53
57
  "codegenConfig": {
54
- "name": "RNCloudXSpec",
58
+ "name": "CloudXSpec",
55
59
  "type": "all",
56
- "jsSrcsDir": "./src/specs",
57
- "ios": {
58
- "_comment": "modulesProvider maps JS TurboModule names to native ObjC classes. Required for RN 0.82+ so RCTAppDependencyProvider can discover and register the module at runtime.",
59
- "modulesProvider": {
60
- "CloudXModule": "RNCloudXModule"
61
- }
62
- }
60
+ "jsSrcsDir": "./src/specs"
63
61
  },
64
62
  "react-native-builder-bob": {
65
63
  "source": "src",
@@ -12,7 +12,7 @@ const ATTModule = NativeModules.AppTrackingTransparency;
12
12
  /**
13
13
  * ATT authorization status values.
14
14
  */
15
- export enum ATTStatus {
15
+ export enum CloudXATTStatus {
16
16
  AUTHORIZED = 'authorized',
17
17
  DENIED = 'denied',
18
18
  RESTRICTED = 'restricted',
@@ -24,33 +24,33 @@ export enum ATTStatus {
24
24
  * Requests App Tracking Transparency permission (iOS 14+).
25
25
  *
26
26
  * On iOS 14+, this shows the system ATT permission dialog.
27
- * On iOS < 14 or Android, returns ATTStatus.NOT_REQUIRED.
27
+ * On iOS < 14 or Android, returns CloudXATTStatus.NOT_REQUIRED.
28
28
  */
29
- export async function requestTrackingAuthorization(): Promise<ATTStatus> {
29
+ export async function requestTrackingAuthorization(): Promise<CloudXATTStatus> {
30
30
  if (Platform.OS !== 'ios' || !ATTModule) {
31
- return ATTStatus.NOT_REQUIRED;
31
+ return CloudXATTStatus.NOT_REQUIRED;
32
32
  }
33
33
 
34
34
  try {
35
35
  const status: string = await ATTModule.requestTrackingAuthorization();
36
- return status as ATTStatus;
36
+ return status as CloudXATTStatus;
37
37
  } catch (_error) {
38
- return ATTStatus.NOT_DETERMINED;
38
+ return CloudXATTStatus.NOT_DETERMINED;
39
39
  }
40
40
  }
41
41
 
42
42
  /**
43
43
  * Gets the current tracking authorization status without showing a dialog.
44
44
  */
45
- export async function getTrackingAuthorizationStatus(): Promise<ATTStatus> {
45
+ export async function getTrackingAuthorizationStatus(): Promise<CloudXATTStatus> {
46
46
  if (Platform.OS !== 'ios' || !ATTModule) {
47
- return ATTStatus.NOT_REQUIRED;
47
+ return CloudXATTStatus.NOT_REQUIRED;
48
48
  }
49
49
 
50
50
  try {
51
51
  const status: string = await ATTModule.getTrackingAuthorizationStatus();
52
- return status as ATTStatus;
52
+ return status as CloudXATTStatus;
53
53
  } catch (_error) {
54
- return ATTStatus.NOT_DETERMINED;
54
+ return CloudXATTStatus.NOT_DETERMINED;
55
55
  }
56
56
  }
package/src/CloudX.ts CHANGED
@@ -1,48 +1,53 @@
1
- import type { CloudXType } from './types/CloudX';
2
- import type { Configuration } from './types/Configuration';
3
- import NativeCloudXModule from './specs/NativeCloudXModule';
1
+ import type { CloudXType, CloudXLogLevelValue } from './types/CloudX';
2
+ import type { CloudXInitializationResult } from './types/Configuration';
3
+ import NativeCloudX from './specs/NativeCloudX';
4
4
 
5
5
  const VERSION = '2.0.0';
6
6
 
7
- const initialize = (appKey: string): Promise<Configuration> => {
8
- return NativeCloudXModule.initialize(VERSION, appKey) as Promise<Configuration>;
7
+ const isInitialized = (): Promise<boolean> => {
8
+ return NativeCloudX.isInitialized();
9
9
  };
10
10
 
11
- const isInitialized = (): Promise<boolean> => {
12
- return NativeCloudXModule.isInitialized();
11
+ const initialize = (appKey: string): Promise<CloudXInitializationResult> => {
12
+ return NativeCloudX.initialize(VERSION, appKey);
13
+ };
14
+
15
+ const isTablet = (): Promise<boolean> => {
16
+ return NativeCloudX.isTablet();
13
17
  };
14
18
 
15
19
  const getVersion = (): Promise<string> => {
16
- return NativeCloudXModule.getVersion();
20
+ return NativeCloudX.getVersion();
17
21
  };
18
22
 
19
- const setMinLogLevel = (level: string): void => {
20
- NativeCloudXModule.setMinLogLevel(level);
23
+ const setMinLogLevel = (level: CloudXLogLevelValue): void => {
24
+ NativeCloudX.setMinLogLevel(level);
21
25
  };
22
26
 
23
27
  const setHashedUserID = (hashedUserID: string): void => {
24
- NativeCloudXModule.setHashedUserID(hashedUserID);
28
+ NativeCloudX.setHashedUserID(hashedUserID);
25
29
  };
26
30
 
27
31
  const setUserKeyValue = (key: string, value: string): void => {
28
- NativeCloudXModule.setUserKeyValue(key, value);
32
+ NativeCloudX.setUserKeyValue(key, value);
29
33
  };
30
34
 
31
35
  const setAppKeyValue = (key: string, value: string): void => {
32
- NativeCloudXModule.setAppKeyValue(key, value);
36
+ NativeCloudX.setAppKeyValue(key, value);
33
37
  };
34
38
 
35
39
  const clearAllKeyValues = (): void => {
36
- NativeCloudXModule.clearAllKeyValues();
40
+ NativeCloudX.clearAllKeyValues();
37
41
  };
38
42
 
39
43
  const setVisualDebuggingEnabled = (enabled: boolean): void => {
40
- NativeCloudXModule.setVisualDebuggingEnabled(enabled);
44
+ NativeCloudX.setVisualDebuggingEnabled(enabled);
41
45
  };
42
46
 
43
47
  export const CloudX: CloudXType = {
44
- initialize,
45
48
  isInitialized,
49
+ initialize,
50
+ isTablet,
46
51
  getVersion,
47
52
  setMinLogLevel,
48
53
  setHashedUserID,
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Position constants for programmatic banner and MREC placement.
3
+ */
4
+ export enum CloudXAdPosition {
5
+ TOP_LEFT = 'top_left',
6
+ TOP_CENTER = 'top_center',
7
+ TOP_RIGHT = 'top_right',
8
+ CENTER_LEFT = 'center_left',
9
+ CENTERED = 'centered',
10
+ CENTER_RIGHT = 'center_right',
11
+ BOTTOM_LEFT = 'bottom_left',
12
+ BOTTOM_CENTER = 'bottom_center',
13
+ BOTTOM_RIGHT = 'bottom_right',
14
+ }
15
+
16
+ export default CloudXAdPosition;
@@ -1,133 +1,155 @@
1
1
  import { addEventListener, removeEventListener } from './EventEmitter';
2
- import type { AdInfo, AdLoadFailedInfo } from './types/AdInfo';
3
- import type { BannerAdType, AdViewPositionType } from './types/BannerAd';
4
- import NativeCloudXModule from './specs/NativeCloudXModule';
2
+ import type { CloudXAdPosition } from './CloudXAdPosition';
3
+ import type { CloudXAdInfo, CloudXAdLoadFailedInfo } from './types/AdInfo';
4
+ import type { CloudXBannerAdType } from './types/BannerAd';
5
+ import NativeCloudX from './specs/NativeCloudX';
5
6
 
6
7
  const {
7
8
  ON_BANNER_AD_LOADED_EVENT,
8
9
  ON_BANNER_AD_LOAD_FAILED_EVENT,
9
10
  ON_BANNER_AD_CLICKED_EVENT,
10
- ON_BANNER_AD_EXPANDED_EVENT,
11
11
  ON_BANNER_AD_COLLAPSED_EVENT,
12
+ ON_BANNER_AD_EXPANDED_EVENT,
12
13
  ON_BANNER_AD_REVENUE_PAID,
13
- } = NativeCloudXModule.getConstants();
14
+ } = NativeCloudX.getConstants();
14
15
 
15
- const createAd = (adUnitId: string, position: AdViewPositionType): void => {
16
- NativeCloudXModule.createBanner(adUnitId, position);
16
+ const createAd = (adUnitId: string, position: CloudXAdPosition): void => {
17
+ NativeCloudX.createBanner(adUnitId, position);
17
18
  };
18
19
 
19
- const createAdWithOffsets = (adUnitId: string, position: AdViewPositionType, xOffset: number, yOffset: number): void => {
20
- NativeCloudXModule.createBannerWithOffsets(adUnitId, position, xOffset, yOffset);
20
+ const createAdWithOffsets = (adUnitId: string, position: CloudXAdPosition, xOffset: number, yOffset: number): void => {
21
+ NativeCloudX.createBannerWithOffsets(adUnitId, position, xOffset, yOffset);
21
22
  };
22
23
 
23
24
  const destroyAd = (adUnitId: string): void => {
24
- NativeCloudXModule.destroyBanner(adUnitId);
25
+ NativeCloudX.destroyBanner(adUnitId);
25
26
  };
26
27
 
27
28
  const showAd = (adUnitId: string): void => {
28
- NativeCloudXModule.showBanner(adUnitId);
29
+ NativeCloudX.showBanner(adUnitId);
29
30
  };
30
31
 
31
32
  const hideAd = (adUnitId: string): void => {
32
- NativeCloudXModule.hideBanner(adUnitId);
33
+ NativeCloudX.hideBanner(adUnitId);
33
34
  };
34
35
 
35
36
  const setPlacement = (adUnitId: string, placement: string | null): void => {
36
- NativeCloudXModule.setBannerPlacement(adUnitId, placement);
37
+ NativeCloudX.setBannerPlacement(adUnitId, placement);
37
38
  };
38
39
 
39
40
  const setCustomData = (adUnitId: string, customData: string | null): void => {
40
- NativeCloudXModule.setBannerCustomData(adUnitId, customData);
41
- };
42
-
43
- const startAutoRefresh = (adUnitId: string): void => {
44
- NativeCloudXModule.startBannerAutoRefresh(adUnitId);
45
- };
46
-
47
- const stopAutoRefresh = (adUnitId: string): void => {
48
- NativeCloudXModule.stopBannerAutoRefresh(adUnitId);
41
+ NativeCloudX.setBannerCustomData(adUnitId, customData);
49
42
  };
50
43
 
51
- const updatePosition = (adUnitId: string, position: AdViewPositionType): void => {
52
- NativeCloudXModule.updateBannerPosition(adUnitId, position);
44
+ const updatePosition = (adUnitId: string, bannerPosition: CloudXAdPosition): void => {
45
+ NativeCloudX.updateBannerPosition(adUnitId, bannerPosition);
53
46
  };
54
47
 
55
- const updateOffsets = (adUnitId: string, xOffset: number, yOffset: number): void => {
56
- NativeCloudXModule.updateBannerOffsets(adUnitId, xOffset, yOffset);
48
+ const startAutoRefresh = (adUnitId: string): void => {
49
+ NativeCloudX.startBannerAutoRefresh(adUnitId);
57
50
  };
58
51
 
59
- const setBackgroundColor = (adUnitId: string, hexColorString: string): void => {
60
- NativeCloudXModule.setBannerBackgroundColor(adUnitId, hexColorString);
52
+ const stopAutoRefresh = (adUnitId: string): void => {
53
+ NativeCloudX.stopBannerAutoRefresh(adUnitId);
61
54
  };
62
55
 
63
- const addAdLoadedEventListener = (listener: (adInfo: AdInfo) => void): void => {
56
+ const addAdLoadedEventListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
64
57
  addEventListener(ON_BANNER_AD_LOADED_EVENT, listener);
65
58
  };
59
+
66
60
  const removeAdLoadedEventListener = (): void => {
67
61
  removeEventListener(ON_BANNER_AD_LOADED_EVENT);
68
62
  };
69
63
 
70
- const addAdLoadFailedEventListener = (listener: (errorInfo: AdLoadFailedInfo) => void): void => {
64
+ const addAdLoadFailedEventListener = (listener: (errorInfo: CloudXAdLoadFailedInfo) => void): void => {
71
65
  addEventListener(ON_BANNER_AD_LOAD_FAILED_EVENT, listener);
72
66
  };
67
+
73
68
  const removeAdLoadFailedEventListener = (): void => {
74
69
  removeEventListener(ON_BANNER_AD_LOAD_FAILED_EVENT);
75
70
  };
76
71
 
77
- const addAdClickedEventListener = (listener: (adInfo: AdInfo) => void): void => {
72
+ const addAdClickedEventListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
78
73
  addEventListener(ON_BANNER_AD_CLICKED_EVENT, listener);
79
74
  };
75
+
80
76
  const removeAdClickedEventListener = (): void => {
81
77
  removeEventListener(ON_BANNER_AD_CLICKED_EVENT);
82
78
  };
83
79
 
84
- const addAdExpandedEventListener = (listener: (adInfo: AdInfo) => void): void => {
85
- addEventListener(ON_BANNER_AD_EXPANDED_EVENT, listener);
86
- };
87
- const removeAdExpandedEventListener = (): void => {
88
- removeEventListener(ON_BANNER_AD_EXPANDED_EVENT);
89
- };
90
-
91
- const addAdCollapsedEventListener = (listener: (adInfo: AdInfo) => void): void => {
80
+ const addAdCollapsedEventListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
92
81
  addEventListener(ON_BANNER_AD_COLLAPSED_EVENT, listener);
93
82
  };
83
+
94
84
  const removeAdCollapsedEventListener = (): void => {
95
85
  removeEventListener(ON_BANNER_AD_COLLAPSED_EVENT);
96
86
  };
97
87
 
98
- const addAdRevenuePaidListener = (listener: (adInfo: AdInfo) => void): void => {
88
+ const addAdExpandedEventListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
89
+ addEventListener(ON_BANNER_AD_EXPANDED_EVENT, listener);
90
+ };
91
+
92
+ const removeAdExpandedEventListener = (): void => {
93
+ removeEventListener(ON_BANNER_AD_EXPANDED_EVENT);
94
+ };
95
+
96
+ const addAdRevenuePaidListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
99
97
  addEventListener(ON_BANNER_AD_REVENUE_PAID, listener);
100
98
  };
99
+
101
100
  const removeAdRevenuePaidListener = (): void => {
102
101
  removeEventListener(ON_BANNER_AD_REVENUE_PAID);
103
102
  };
104
103
 
105
- export const BannerAd: BannerAdType = {
104
+ // Banner specific APIs
105
+
106
+ const setBackgroundColor = (adUnitId: string, hexColorCode: string): void => {
107
+ NativeCloudX.setBannerBackgroundColor(adUnitId, hexColorCode);
108
+ };
109
+
110
+ const updateOffsets = (adUnitId: string, xOffset: number, yOffset: number): void => {
111
+ NativeCloudX.updateBannerOffsets(adUnitId, xOffset, yOffset);
112
+ };
113
+
114
+ export const CloudXBannerAd: CloudXBannerAdType = {
106
115
  createAd,
107
116
  createAdWithOffsets,
108
117
  destroyAd,
118
+
109
119
  showAd,
110
120
  hideAd,
111
- updatePosition,
112
- updateOffsets,
113
- setBackgroundColor,
121
+
114
122
  setPlacement,
115
123
  setCustomData,
124
+
125
+ updatePosition,
126
+
116
127
  startAutoRefresh,
117
128
  stopAutoRefresh,
118
129
 
119
130
  addAdLoadedEventListener,
120
131
  removeAdLoadedEventListener,
132
+
121
133
  addAdLoadFailedEventListener,
122
134
  removeAdLoadFailedEventListener,
135
+
123
136
  addAdClickedEventListener,
124
137
  removeAdClickedEventListener,
125
- addAdExpandedEventListener,
126
- removeAdExpandedEventListener,
138
+
127
139
  addAdCollapsedEventListener,
128
140
  removeAdCollapsedEventListener,
141
+
142
+ addAdExpandedEventListener,
143
+ removeAdExpandedEventListener,
144
+
129
145
  addAdRevenuePaidListener,
130
146
  removeAdRevenuePaidListener,
147
+
148
+ // Banner specific APIs
149
+
150
+ setBackgroundColor,
151
+
152
+ updateOffsets,
131
153
  };
132
154
 
133
- export default BannerAd;
155
+ export default CloudXBannerAd;
@@ -11,7 +11,7 @@
11
11
  * 500-599 Configuration / setup errors
12
12
  * 600-699 Adapter-level errors
13
13
  */
14
- export enum ErrorCode {
14
+ export enum CloudXErrorCode {
15
15
  // GENERAL (0-99)
16
16
 
17
17
  /** An internal error occurred. */
@@ -1,7 +1,7 @@
1
1
  import { addEventListener, removeEventListener } from './EventEmitter';
2
- import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo } from './types/AdInfo';
3
- import type { FullscreenAdType } from './types/FullscreenAd';
4
- import NativeCloudXModule from './specs/NativeCloudXModule';
2
+ import type { CloudXAdDisplayFailedInfo, CloudXAdInfo, CloudXAdLoadFailedInfo } from './types/AdInfo';
3
+ import type { CloudXFullscreenAdType } from './types/FullscreenAd';
4
+ import NativeCloudX from './specs/NativeCloudX';
5
5
 
6
6
  const {
7
7
  ON_INTERSTITIAL_LOADED_EVENT,
@@ -11,74 +11,74 @@ const {
11
11
  ON_INTERSTITIAL_DISPLAY_FAILED_EVENT,
12
12
  ON_INTERSTITIAL_HIDDEN_EVENT,
13
13
  ON_INTERSTITIAL_AD_REVENUE_PAID,
14
- } = NativeCloudXModule.getConstants();
14
+ } = NativeCloudX.getConstants();
15
15
 
16
16
  const isAdReady = (adUnitId: string): Promise<boolean> => {
17
- return NativeCloudXModule.isInterstitialReady(adUnitId);
17
+ return NativeCloudX.isInterstitialReady(adUnitId);
18
18
  };
19
19
 
20
20
  const loadAd = (adUnitId: string): void => {
21
- NativeCloudXModule.loadInterstitial(adUnitId);
21
+ NativeCloudX.loadInterstitial(adUnitId);
22
22
  };
23
23
 
24
24
  const showAd = (adUnitId: string, placement?: string | null, customData?: string | null): void => {
25
- NativeCloudXModule.showInterstitial(adUnitId, placement ?? undefined, customData ?? undefined);
25
+ NativeCloudX.showInterstitial(adUnitId, placement ?? undefined, customData ?? undefined);
26
26
  };
27
27
 
28
28
  const destroyAd = (adUnitId: string): void => {
29
- NativeCloudXModule.destroyInterstitial(adUnitId);
29
+ NativeCloudX.destroyInterstitial(adUnitId);
30
30
  };
31
31
 
32
- const addAdLoadedEventListener = (listener: (adInfo: AdInfo) => void): void => {
32
+ const addAdLoadedEventListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
33
33
  addEventListener(ON_INTERSTITIAL_LOADED_EVENT, listener);
34
34
  };
35
35
  const removeAdLoadedEventListener = (): void => {
36
36
  removeEventListener(ON_INTERSTITIAL_LOADED_EVENT);
37
37
  };
38
38
 
39
- const addAdLoadFailedEventListener = (listener: (errorInfo: AdLoadFailedInfo) => void): void => {
39
+ const addAdLoadFailedEventListener = (listener: (errorInfo: CloudXAdLoadFailedInfo) => void): void => {
40
40
  addEventListener(ON_INTERSTITIAL_LOAD_FAILED_EVENT, listener);
41
41
  };
42
42
  const removeAdLoadFailedEventListener = (): void => {
43
43
  removeEventListener(ON_INTERSTITIAL_LOAD_FAILED_EVENT);
44
44
  };
45
45
 
46
- const addAdClickedEventListener = (listener: (adInfo: AdInfo) => void): void => {
46
+ const addAdClickedEventListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
47
47
  addEventListener(ON_INTERSTITIAL_CLICKED_EVENT, listener);
48
48
  };
49
49
  const removeAdClickedEventListener = (): void => {
50
50
  removeEventListener(ON_INTERSTITIAL_CLICKED_EVENT);
51
51
  };
52
52
 
53
- const addAdDisplayedEventListener = (listener: (adInfo: AdInfo) => void): void => {
53
+ const addAdDisplayedEventListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
54
54
  addEventListener(ON_INTERSTITIAL_DISPLAYED_EVENT, listener);
55
55
  };
56
56
  const removeAdDisplayedEventListener = (): void => {
57
57
  removeEventListener(ON_INTERSTITIAL_DISPLAYED_EVENT);
58
58
  };
59
59
 
60
- const addAdFailedToDisplayEventListener = (listener: (errorInfo: AdDisplayFailedInfo) => void): void => {
60
+ const addAdFailedToDisplayEventListener = (listener: (errorInfo: CloudXAdDisplayFailedInfo) => void): void => {
61
61
  addEventListener(ON_INTERSTITIAL_DISPLAY_FAILED_EVENT, listener);
62
62
  };
63
63
  const removeAdFailedToDisplayEventListener = (): void => {
64
64
  removeEventListener(ON_INTERSTITIAL_DISPLAY_FAILED_EVENT);
65
65
  };
66
66
 
67
- const addAdHiddenEventListener = (listener: (adInfo: AdInfo) => void): void => {
67
+ const addAdHiddenEventListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
68
68
  addEventListener(ON_INTERSTITIAL_HIDDEN_EVENT, listener);
69
69
  };
70
70
  const removeAdHiddenEventListener = (): void => {
71
71
  removeEventListener(ON_INTERSTITIAL_HIDDEN_EVENT);
72
72
  };
73
73
 
74
- const addAdRevenuePaidListener = (listener: (adInfo: AdInfo) => void): void => {
74
+ const addAdRevenuePaidListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
75
75
  addEventListener(ON_INTERSTITIAL_AD_REVENUE_PAID, listener);
76
76
  };
77
77
  const removeAdRevenuePaidListener = (): void => {
78
78
  removeEventListener(ON_INTERSTITIAL_AD_REVENUE_PAID);
79
79
  };
80
80
 
81
- export const InterstitialAd: FullscreenAdType = {
81
+ export const CloudXInterstitialAd: CloudXFullscreenAdType = {
82
82
  isAdReady,
83
83
  loadAd,
84
84
  showAd,
@@ -100,4 +100,4 @@ export const InterstitialAd: FullscreenAdType = {
100
100
  removeAdRevenuePaidListener,
101
101
  };
102
102
 
103
- export default InterstitialAd;
103
+ export default CloudXInterstitialAd;