react-native-daro 1.0.15 → 2.0.0-rc.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 (241) hide show
  1. package/README.md +2 -5
  2. package/android/build.gradle +17 -14
  3. package/android/src/main/java/com/daro/reactnative/DaroMediaViewManager.kt +25 -0
  4. package/android/src/main/java/com/daro/reactnative/DaroRNAdBannerViewManager.kt +105 -0
  5. package/android/src/main/java/com/daro/reactnative/DaroRNAdNativeViewManager.kt +163 -0
  6. package/android/src/main/java/com/daro/reactnative/DaroRNModule.kt +376 -0
  7. package/android/src/main/java/com/daro/reactnative/DaroRNPackage.kt +45 -0
  8. package/android/src/main/java/com/daro/reactnative/DaroSdkBridge.kt +52 -0
  9. package/android/src/main/java/com/daro/reactnative/constants/{InternalDaroMBannerSize.kt → InternalDaroRNBannerSize.kt} +2 -2
  10. package/android/src/main/java/com/daro/reactnative/event/{DaroMEvent.kt → DaroRNEvent.kt} +22 -11
  11. package/android/src/main/java/com/daro/reactnative/impl/{DaroMBannerViewModuleImpl.kt → DaroRNBannerViewModuleImpl.kt} +3 -3
  12. package/android/src/main/java/com/daro/reactnative/impl/{DaroMInterstitialModuleImpl.kt → DaroRNInterstitialModuleImpl.kt} +4 -4
  13. package/android/src/main/java/com/daro/reactnative/impl/{DaroMLightPopupModuleImpl.kt → DaroRNLightPopupModuleImpl.kt} +4 -4
  14. package/android/src/main/java/com/daro/reactnative/impl/{DaroMRewardedAdModuleImpl.kt → DaroRNRewardedAdModuleImpl.kt} +4 -4
  15. package/android/src/main/java/com/daro/reactnative/util/AdInfoUtil.kt +12 -0
  16. package/android/src/main/java/com/daro/reactnative/util/DaroQaProbe.kt +147 -0
  17. package/android/src/main/java/com/daro/reactnative/util/EventEmitterUtil.kt +20 -7
  18. package/android/src/main/java/com/daro/reactnative/view/DaroMediaView.kt +123 -0
  19. package/android/src/main/java/com/daro/reactnative/view/{DaroMAdBannerViewContainer.kt → DaroRNAdBannerViewContainer.kt} +2 -3
  20. package/android/src/main/java/com/daro/reactnative/view/DaroRNAdNativeViewContainer.kt +623 -0
  21. package/android/src/newarch/java/com/daro/reactnative/DaroRNModuleSpec.kt +6 -0
  22. package/android/src/oldarch/java/com/daro/reactnative/DaroRNModuleSpec.kt +119 -0
  23. package/ios/{DaroMModule+AppOpen.swift → DaroRNModule+AppOpen.swift} +22 -20
  24. package/ios/DaroRNModule+Consent.swift +88 -0
  25. package/ios/{DaroMModule+Interstitial.swift → DaroRNModule+Interstitial.swift} +21 -18
  26. package/ios/{DaroMModule+LightPopup.swift → DaroRNModule+LightPopup.swift} +18 -15
  27. package/ios/DaroRNModule+Qa.swift +158 -0
  28. package/ios/{DaroMModule+Rewarded.swift → DaroRNModule+Rewarded.swift} +22 -19
  29. package/ios/DaroRNModule.mm +88 -0
  30. package/ios/{DaroMModule.swift → DaroRNModule.swift} +24 -10
  31. package/ios/Fabric/DaroRNAdBannerComponentView.mm +219 -0
  32. package/ios/Fabric/DaroRNFabricEventSink.mm +31 -0
  33. package/ios/Fabric/DaroRNFabricPropApplier.mm +123 -0
  34. package/ios/Fabric/DaroRNNativeAdComponentView.mm +306 -0
  35. package/ios/{DaroMAdBannerViewManager.m → Paper/DaroRNAdBannerViewManager.m} +4 -2
  36. package/ios/Paper/DaroRNAdBannerViewManager.swift +21 -0
  37. package/ios/{DaroMNativeAdViewManager.m → Paper/DaroRNNativeAdViewManager.m} +3 -2
  38. package/ios/Paper/DaroRNNativeAdViewManager.swift +22 -0
  39. package/ios/Shared/DaroMediationDebugger.swift +14 -0
  40. package/ios/{mediation/admob → Shared}/DaroMediationTypes.swift +1 -0
  41. package/ios/Shared/DaroRNAdEventSink.swift +24 -0
  42. package/ios/Shared/DaroRNBannerAdView.swift +188 -0
  43. package/ios/Shared/DaroRNNativeAdLoadCoordinator.swift +49 -0
  44. package/ios/Shared/DaroRNNativeAdView.swift +575 -0
  45. package/ios/Shared/DaroRNNativeAssetResolver.swift +53 -0
  46. package/lib/commonjs/AdBannerView.js +20 -41
  47. package/lib/commonjs/AdBannerView.js.map +1 -1
  48. package/lib/commonjs/AppOpenAd.js +45 -12
  49. package/lib/commonjs/AppOpenAd.js.map +1 -1
  50. package/lib/commonjs/DaroMediaViewNativeComponent.ts +9 -0
  51. package/lib/commonjs/DaroRNAdBannerViewNativeComponent.ts +50 -0
  52. package/lib/commonjs/DaroRNNativeAdViewNativeComponent.ts +65 -0
  53. package/lib/commonjs/EventEmitter.js +4 -5
  54. package/lib/commonjs/EventEmitter.js.map +1 -1
  55. package/lib/commonjs/InterstitialAd.js +9 -11
  56. package/lib/commonjs/InterstitialAd.js.map +1 -1
  57. package/lib/commonjs/LightPopupAd.js +11 -12
  58. package/lib/commonjs/LightPopupAd.js.map +1 -1
  59. package/lib/commonjs/NativeDaroModule.js +9 -0
  60. package/lib/commonjs/NativeDaroModule.js.map +1 -0
  61. package/lib/commonjs/RewardedAd.js +9 -11
  62. package/lib/commonjs/RewardedAd.js.map +1 -1
  63. package/lib/commonjs/codegen-env.d.js +2 -0
  64. package/lib/commonjs/codegen-env.d.js.map +1 -0
  65. package/lib/commonjs/hooks/useInterstitialAd.js +110 -0
  66. package/lib/commonjs/hooks/useInterstitialAd.js.map +1 -0
  67. package/lib/commonjs/hooks/useLightPopupAd.js +114 -0
  68. package/lib/commonjs/hooks/useLightPopupAd.js.map +1 -0
  69. package/lib/commonjs/hooks/useRewardedAd.js +113 -0
  70. package/lib/commonjs/hooks/useRewardedAd.js.map +1 -0
  71. package/lib/commonjs/index.js +150 -13
  72. package/lib/commonjs/index.js.map +1 -1
  73. package/lib/commonjs/nativeAd/NativeAdView.js +23 -22
  74. package/lib/commonjs/nativeAd/NativeAdView.js.map +1 -1
  75. package/lib/commonjs/nativeAd/NativeAdViewComponents.js +43 -31
  76. package/lib/commonjs/nativeAd/NativeAdViewComponents.js.map +1 -1
  77. package/lib/commonjs/nativeAd/NativeAdViewProvider.js +34 -7
  78. package/lib/commonjs/nativeAd/NativeAdViewProvider.js.map +1 -1
  79. package/lib/module/AdBannerView.js +19 -42
  80. package/lib/module/AdBannerView.js.map +1 -1
  81. package/lib/module/AppOpenAd.js +45 -13
  82. package/lib/module/AppOpenAd.js.map +1 -1
  83. package/lib/module/DaroMediaViewNativeComponent.ts +9 -0
  84. package/lib/module/DaroRNAdBannerViewNativeComponent.ts +50 -0
  85. package/lib/module/DaroRNNativeAdViewNativeComponent.ts +65 -0
  86. package/lib/module/EventEmitter.js +4 -6
  87. package/lib/module/EventEmitter.js.map +1 -1
  88. package/lib/module/InterstitialAd.js +8 -11
  89. package/lib/module/InterstitialAd.js.map +1 -1
  90. package/lib/module/LightPopupAd.js +11 -13
  91. package/lib/module/LightPopupAd.js.map +1 -1
  92. package/lib/module/NativeDaroModule.js +5 -0
  93. package/lib/module/NativeDaroModule.js.map +1 -0
  94. package/lib/module/RewardedAd.js +8 -11
  95. package/lib/module/RewardedAd.js.map +1 -1
  96. package/lib/module/codegen-env.d.js +2 -0
  97. package/lib/module/codegen-env.d.js.map +1 -0
  98. package/lib/module/hooks/useInterstitialAd.js +106 -0
  99. package/lib/module/hooks/useInterstitialAd.js.map +1 -0
  100. package/lib/module/hooks/useLightPopupAd.js +110 -0
  101. package/lib/module/hooks/useLightPopupAd.js.map +1 -0
  102. package/lib/module/hooks/useRewardedAd.js +109 -0
  103. package/lib/module/hooks/useRewardedAd.js.map +1 -0
  104. package/lib/module/index.js +108 -13
  105. package/lib/module/index.js.map +1 -1
  106. package/lib/module/nativeAd/NativeAdView.js +22 -23
  107. package/lib/module/nativeAd/NativeAdView.js.map +1 -1
  108. package/lib/module/nativeAd/NativeAdViewComponents.js +45 -34
  109. package/lib/module/nativeAd/NativeAdViewComponents.js.map +1 -1
  110. package/lib/module/nativeAd/NativeAdViewProvider.js +35 -8
  111. package/lib/module/nativeAd/NativeAdViewProvider.js.map +1 -1
  112. package/lib/typescript/commonjs/plugin/src/index.d.ts +2 -6
  113. package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -1
  114. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +2 -6
  115. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -1
  116. package/lib/typescript/commonjs/plugin/src/withIos.d.ts +2 -6
  117. package/lib/typescript/commonjs/plugin/src/withIos.d.ts.map +1 -1
  118. package/lib/typescript/commonjs/src/AdBannerView.d.ts +2 -2
  119. package/lib/typescript/commonjs/src/AdBannerView.d.ts.map +1 -1
  120. package/lib/typescript/commonjs/src/AppOpenAd.d.ts +2 -2
  121. package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
  122. package/lib/typescript/commonjs/src/DaroMediaViewNativeComponent.d.ts +6 -0
  123. package/lib/typescript/commonjs/src/DaroMediaViewNativeComponent.d.ts.map +1 -0
  124. package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts +33 -0
  125. package/lib/typescript/commonjs/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -0
  126. package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts +43 -0
  127. package/lib/typescript/commonjs/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/src/EventEmitter.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/src/InterstitialAd.d.ts.map +1 -1
  130. package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/src/NativeDaroModule.d.ts +70 -0
  132. package/lib/typescript/commonjs/src/NativeDaroModule.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/src/RewardedAd.d.ts.map +1 -1
  134. package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts +19 -0
  135. package/lib/typescript/commonjs/src/hooks/useInterstitialAd.d.ts.map +1 -0
  136. package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts +23 -0
  137. package/lib/typescript/commonjs/src/hooks/useLightPopupAd.d.ts.map +1 -0
  138. package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts +20 -0
  139. package/lib/typescript/commonjs/src/hooks/useRewardedAd.d.ts.map +1 -0
  140. package/lib/typescript/commonjs/src/index.d.ts +86 -1
  141. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  142. package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts +1 -0
  143. package/lib/typescript/commonjs/src/nativeAd/NativeAdView.d.ts.map +1 -1
  144. package/lib/typescript/commonjs/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
  145. package/lib/typescript/commonjs/src/nativeAd/NativeAdViewProvider.d.ts +11 -5
  146. package/lib/typescript/commonjs/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
  147. package/lib/typescript/commonjs/src/types/AdInfo.d.ts +15 -0
  148. package/lib/typescript/commonjs/src/types/AdInfo.d.ts.map +1 -1
  149. package/lib/typescript/commonjs/src/types/AdProps.d.ts +0 -1
  150. package/lib/typescript/commonjs/src/types/AdProps.d.ts.map +1 -1
  151. package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts +2 -0
  152. package/lib/typescript/commonjs/src/types/NativeAdViewProps.d.ts.map +1 -1
  153. package/lib/typescript/module/plugin/src/index.d.ts +2 -6
  154. package/lib/typescript/module/plugin/src/index.d.ts.map +1 -1
  155. package/lib/typescript/module/plugin/src/withAndroid.d.ts +2 -6
  156. package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -1
  157. package/lib/typescript/module/plugin/src/withIos.d.ts +2 -6
  158. package/lib/typescript/module/plugin/src/withIos.d.ts.map +1 -1
  159. package/lib/typescript/module/src/AdBannerView.d.ts +2 -2
  160. package/lib/typescript/module/src/AdBannerView.d.ts.map +1 -1
  161. package/lib/typescript/module/src/AppOpenAd.d.ts +2 -2
  162. package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
  163. package/lib/typescript/module/src/DaroMediaViewNativeComponent.d.ts +6 -0
  164. package/lib/typescript/module/src/DaroMediaViewNativeComponent.d.ts.map +1 -0
  165. package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts +33 -0
  166. package/lib/typescript/module/src/DaroRNAdBannerViewNativeComponent.d.ts.map +1 -0
  167. package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts +43 -0
  168. package/lib/typescript/module/src/DaroRNNativeAdViewNativeComponent.d.ts.map +1 -0
  169. package/lib/typescript/module/src/EventEmitter.d.ts.map +1 -1
  170. package/lib/typescript/module/src/InterstitialAd.d.ts.map +1 -1
  171. package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
  172. package/lib/typescript/module/src/NativeDaroModule.d.ts +70 -0
  173. package/lib/typescript/module/src/NativeDaroModule.d.ts.map +1 -0
  174. package/lib/typescript/module/src/RewardedAd.d.ts.map +1 -1
  175. package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts +19 -0
  176. package/lib/typescript/module/src/hooks/useInterstitialAd.d.ts.map +1 -0
  177. package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts +23 -0
  178. package/lib/typescript/module/src/hooks/useLightPopupAd.d.ts.map +1 -0
  179. package/lib/typescript/module/src/hooks/useRewardedAd.d.ts +20 -0
  180. package/lib/typescript/module/src/hooks/useRewardedAd.d.ts.map +1 -0
  181. package/lib/typescript/module/src/index.d.ts +86 -1
  182. package/lib/typescript/module/src/index.d.ts.map +1 -1
  183. package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts +1 -0
  184. package/lib/typescript/module/src/nativeAd/NativeAdView.d.ts.map +1 -1
  185. package/lib/typescript/module/src/nativeAd/NativeAdViewComponents.d.ts.map +1 -1
  186. package/lib/typescript/module/src/nativeAd/NativeAdViewProvider.d.ts +11 -5
  187. package/lib/typescript/module/src/nativeAd/NativeAdViewProvider.d.ts.map +1 -1
  188. package/lib/typescript/module/src/types/AdInfo.d.ts +15 -0
  189. package/lib/typescript/module/src/types/AdInfo.d.ts.map +1 -1
  190. package/lib/typescript/module/src/types/AdProps.d.ts +0 -1
  191. package/lib/typescript/module/src/types/AdProps.d.ts.map +1 -1
  192. package/lib/typescript/module/src/types/NativeAdViewProps.d.ts +2 -0
  193. package/lib/typescript/module/src/types/NativeAdViewProps.d.ts.map +1 -1
  194. package/package.json +12 -5
  195. package/plugin/build/index.d.ts +2 -6
  196. package/plugin/build/index.js +21 -56
  197. package/plugin/build/withAndroid.d.ts +2 -6
  198. package/plugin/build/withAndroid.js +123 -83
  199. package/plugin/build/withIos.d.ts +2 -6
  200. package/plugin/build/withIos.js +37 -34
  201. package/react-native-daro.podspec +4 -2
  202. package/src/AdBannerView.tsx +24 -63
  203. package/src/AppOpenAd.ts +48 -17
  204. package/src/DaroMediaViewNativeComponent.ts +9 -0
  205. package/src/DaroRNAdBannerViewNativeComponent.ts +50 -0
  206. package/src/DaroRNNativeAdViewNativeComponent.ts +65 -0
  207. package/src/EventEmitter.ts +4 -5
  208. package/src/InterstitialAd.ts +8 -10
  209. package/src/LightPopupAd.ts +11 -12
  210. package/src/NativeDaroModule.ts +106 -0
  211. package/src/RewardedAd.ts +8 -10
  212. package/src/codegen-env.d.ts +45 -0
  213. package/src/hooks/useInterstitialAd.ts +117 -0
  214. package/src/hooks/useLightPopupAd.ts +132 -0
  215. package/src/hooks/useRewardedAd.ts +122 -0
  216. package/src/index.tsx +157 -22
  217. package/src/nativeAd/NativeAdView.tsx +41 -54
  218. package/src/nativeAd/NativeAdViewComponents.tsx +80 -42
  219. package/src/nativeAd/NativeAdViewProvider.tsx +75 -17
  220. package/src/types/AdInfo.ts +17 -0
  221. package/src/types/AdProps.ts +0 -2
  222. package/src/types/NativeAdViewProps.ts +7 -0
  223. package/android/src/admob/java/com/daro/reactnative/DaroSdkBridge.kt +0 -23
  224. package/android/src/main/java/com/daro/reactnative/DaroMAdBannerViewManager.kt +0 -132
  225. package/android/src/main/java/com/daro/reactnative/DaroMAdNativeViewManager.kt +0 -136
  226. package/android/src/main/java/com/daro/reactnative/DaroMModule.kt +0 -202
  227. package/android/src/main/java/com/daro/reactnative/DaroMPackage.kt +0 -21
  228. package/android/src/main/java/com/daro/reactnative/view/DaroMAdNativeViewContainer.kt +0 -375
  229. package/ios/DaroMAdBannerViewManager.swift +0 -91
  230. package/ios/DaroMModule.mm +0 -45
  231. package/ios/DaroMNativeAdViewManager.swift +0 -291
  232. package/ios/mediation/admob/DaroMediationDebugger.swift +0 -11
  233. package/lib/commonjs/types/DaroMMobileAds.js +0 -2
  234. package/lib/commonjs/types/DaroMMobileAds.js.map +0 -1
  235. package/lib/module/types/DaroMMobileAds.js +0 -2
  236. package/lib/module/types/DaroMMobileAds.js.map +0 -1
  237. package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts +0 -6
  238. package/lib/typescript/commonjs/src/types/DaroMMobileAds.d.ts.map +0 -1
  239. package/lib/typescript/module/src/types/DaroMMobileAds.d.ts +0 -6
  240. package/lib/typescript/module/src/types/DaroMMobileAds.d.ts.map +0 -1
  241. package/src/types/DaroMMobileAds.ts +0 -5
package/src/AppOpenAd.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { NativeModules } from 'react-native';
1
+ import { Platform } from 'react-native';
2
2
  import {
3
3
  addEventListener,
4
4
  removeEventListener,
5
5
  AdEventEmitter,
6
6
  } from './EventEmitter';
7
+ import NativeDaroModule from './NativeDaroModule';
7
8
  import type {
8
9
  AdDisplayFailedInfo,
9
10
  AdInfo,
@@ -11,7 +12,11 @@ import type {
11
12
  } from './types/AdInfo';
12
13
  import { AdEventType, type AdEventPayloadMap } from './types/AdEvent';
13
14
 
14
- const { DaroMModule } = NativeModules;
15
+ const IS_SUPPORTED_PLATFORM = Platform.OS === 'ios';
16
+
17
+ const warnUnsupportedPlatform = () => {
18
+ console.warn('AppOpenAd is only supported on iOS.');
19
+ };
15
20
 
16
21
  const {
17
22
  ON_APPOPEN_AD_LOADED_EVENT,
@@ -21,7 +26,7 @@ const {
21
26
  ON_APPOPEN_AD_FAILED_TO_DISPLAY_EVENT,
22
27
  ON_APPOPEN_AD_HIDDEN_EVENT,
23
28
  ON_APPOPEN_AD_IMPRESSION_RECORDED,
24
- } = DaroMModule.getConstants();
29
+ } = NativeDaroModule.getConstants();
25
30
 
26
31
  const NATIVE_EVENT_BY_TYPE: Record<AdEventType, string> = {
27
32
  [AdEventType.LOADED]: ON_APPOPEN_AD_LOADED_EVENT,
@@ -51,18 +56,28 @@ export class AppOpenAd {
51
56
  }
52
57
 
53
58
  isAdReady(): Promise<boolean> {
54
- return DaroMModule.isAppOpenAdReady(this.requestId, this.adUnitId);
59
+ if (!IS_SUPPORTED_PLATFORM) {
60
+ return Promise.resolve(false);
61
+ }
62
+ return NativeDaroModule.isAppOpenAdReady(this.requestId, this.adUnitId);
55
63
  }
56
64
 
57
65
  load(): void {
58
- DaroMModule.loadAppOpenAd(this.requestId, this.adUnitId);
66
+ if (!IS_SUPPORTED_PLATFORM) {
67
+ warnUnsupportedPlatform();
68
+ return;
69
+ }
70
+ NativeDaroModule.loadAppOpenAd(this.requestId, this.adUnitId);
59
71
  }
60
72
 
61
- show(placement?: string | null, customData?: string | null): void {
62
- DaroMModule.showAppOpenAd(
73
+ show(customData?: string | null): void {
74
+ if (!IS_SUPPORTED_PLATFORM) {
75
+ warnUnsupportedPlatform();
76
+ return;
77
+ }
78
+ NativeDaroModule.showAppOpenAd(
63
79
  this.requestId,
64
80
  this.adUnitId,
65
- placement ?? undefined,
66
81
  customData ?? undefined
67
82
  );
68
83
  }
@@ -71,6 +86,11 @@ export class AppOpenAd {
71
86
  type: T,
72
87
  listener: (info: AdEventPayloadMap[T]) => void
73
88
  ): () => void {
89
+ if (!IS_SUPPORTED_PLATFORM) {
90
+ warnUnsupportedPlatform();
91
+ return () => {};
92
+ }
93
+
74
94
  const nativeEvent = NATIVE_EVENT_BY_TYPE[type];
75
95
  const requestId = this.requestId;
76
96
  return this.eventEmitter.addEventListener(nativeEvent, (payload: any) => {
@@ -101,6 +121,11 @@ export class AppOpenAd {
101
121
  event: string,
102
122
  listener: (info: T) => void
103
123
  ): void {
124
+ if (!IS_SUPPORTED_PLATFORM) {
125
+ warnUnsupportedPlatform();
126
+ return;
127
+ }
128
+
104
129
  addEventListener(event, (payload: any) => {
105
130
  if (!AppOpenAd._legacyRequestIdSet.has(payload?.requestId)) {
106
131
  return;
@@ -111,27 +136,33 @@ export class AppOpenAd {
111
136
 
112
137
  /** @deprecated `AppOpenAd.createForAdRequest(adUnitId)` 인스턴스의 `isAdReady()`를 사용하세요. */
113
138
  static isAdReady(adUnitId: string): Promise<boolean> {
139
+ if (!IS_SUPPORTED_PLATFORM) {
140
+ return Promise.resolve(false);
141
+ }
114
142
  const requestId = AppOpenAd._getLegacyRequestId(adUnitId);
115
- return DaroMModule.isAppOpenAdReady(requestId, adUnitId);
143
+ return NativeDaroModule.isAppOpenAdReady(requestId, adUnitId);
116
144
  }
117
145
 
118
146
  /** @deprecated `AppOpenAd.createForAdRequest(adUnitId)` 인스턴스의 `load()`를 사용하세요. */
119
147
  static loadAd(adUnitId: string): void {
148
+ if (!IS_SUPPORTED_PLATFORM) {
149
+ warnUnsupportedPlatform();
150
+ return;
151
+ }
120
152
  const requestId = AppOpenAd._getLegacyRequestId(adUnitId);
121
- DaroMModule.loadAppOpenAd(requestId, adUnitId);
153
+ NativeDaroModule.loadAppOpenAd(requestId, adUnitId);
122
154
  }
123
155
 
124
156
  /** @deprecated `AppOpenAd.createForAdRequest(adUnitId)` 인스턴스의 `show()`를 사용하세요. */
125
- static showAd(
126
- adUnitId: string,
127
- placement?: string | null,
128
- customData?: string | null
129
- ): void {
157
+ static showAd(adUnitId: string, customData?: string | null): void {
158
+ if (!IS_SUPPORTED_PLATFORM) {
159
+ warnUnsupportedPlatform();
160
+ return;
161
+ }
130
162
  const requestId = AppOpenAd._getLegacyRequestId(adUnitId);
131
- DaroMModule.showAppOpenAd(
163
+ NativeDaroModule.showAppOpenAd(
132
164
  requestId,
133
165
  adUnitId,
134
- placement ?? undefined,
135
166
  customData ?? undefined
136
167
  );
137
168
  }
@@ -0,0 +1,9 @@
1
+ /* eslint-disable @react-native/no-deep-imports -- React Native 0.74 codegen parser compatibility requires this import. */
2
+ import type { ViewProps } from 'react-native';
3
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
+
5
+ export interface NativeProps extends ViewProps {}
6
+
7
+ export default codegenNativeComponent<NativeProps>('DaroMediaView', {
8
+ excludedPlatforms: ['iOS'],
9
+ });
@@ -0,0 +1,50 @@
1
+ /* eslint-disable @react-native/no-deep-imports -- React Native 0.74 codegen parser compatibility requires these imports. */
2
+ import type * as React from 'react';
3
+ import type { HostComponent, ViewProps } from 'react-native';
4
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
5
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
6
+ import type {
7
+ DirectEventHandler,
8
+ Double,
9
+ Int32,
10
+ WithDefault,
11
+ } from 'react-native/Libraries/Types/CodegenTypes';
12
+
13
+ // 필드 구성은 src/types/AdInfo.ts 의 AdInfo 와 같은 것을 뜻한다. 이쪽은 codegen 이
14
+ // 읽는 선언이라 **여기 없으면 네이티브가 실어 보내도 Fabric 이 걸러낸다.**
15
+ type AdInfoPayload = {
16
+ adUnitId: string;
17
+ latencyMillis: Double;
18
+ mediationPlatform?: string;
19
+ adNetwork?: string;
20
+ };
21
+
22
+ type AdLoadFailedInfoPayload = {
23
+ adUnitId: string;
24
+ code: Int32;
25
+ message: string;
26
+ latencyMillis: Double;
27
+ };
28
+
29
+ export interface NativeProps extends ViewProps {
30
+ adUnitId: string;
31
+ adFormat: string;
32
+ loadOnMount?: WithDefault<boolean, true>;
33
+ isVisible?: WithDefault<boolean, true>;
34
+ onAdLoadedEvent?: DirectEventHandler<AdInfoPayload>;
35
+ onAdLoadFailedEvent?: DirectEventHandler<AdLoadFailedInfoPayload>;
36
+ onAdClickedEvent?: DirectEventHandler<AdInfoPayload>;
37
+ onAdImpressionRecordedEvent?: DirectEventHandler<AdInfoPayload>;
38
+ }
39
+
40
+ type ComponentType = HostComponent<NativeProps>;
41
+
42
+ interface NativeCommands {
43
+ loadAd: (viewRef: React.ElementRef<ComponentType>) => void;
44
+ }
45
+
46
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
47
+ supportedCommands: ['loadAd'],
48
+ });
49
+
50
+ export default codegenNativeComponent<NativeProps>('DaroRNAdBannerView');
@@ -0,0 +1,65 @@
1
+ /* eslint-disable @react-native/no-deep-imports -- React Native 0.74 codegen parser compatibility requires these imports. */
2
+ import type * as React from 'react';
3
+ import type { HostComponent, ViewProps } from 'react-native';
4
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
5
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
6
+ import type {
7
+ DirectEventHandler,
8
+ Double,
9
+ Int32,
10
+ UnsafeMixed,
11
+ WithDefault,
12
+ } from 'react-native/Libraries/Types/CodegenTypes';
13
+
14
+ // 필드 구성은 src/types/AdInfo.ts 의 AdInfo 와 같은 것을 뜻한다. 이쪽은 codegen 이
15
+ // 읽는 선언이라 **여기 없으면 네이티브가 실어 보내도 Fabric 이 걸러낸다.**
16
+ type AdInfoPayload = {
17
+ adUnitId: string;
18
+ latencyMillis: Double;
19
+ mediationPlatform?: string;
20
+ adNetwork?: string;
21
+ };
22
+
23
+ type AdLoadFailedInfoPayload = {
24
+ adUnitId: string;
25
+ code: Int32;
26
+ message: string;
27
+ latencyMillis: Double;
28
+ };
29
+
30
+ type AdChoicesPosition = 'topLeft' | 'topRight' | 'bottomRight' | 'bottomLeft';
31
+
32
+ export interface NativeProps extends ViewProps {
33
+ adUnitId: string;
34
+ loadOnMount?: WithDefault<boolean, true>;
35
+ adChoicesPosition?: WithDefault<AdChoicesPosition, 'bottomRight'>;
36
+
37
+ titleView?: Int32;
38
+ bodyView?: Int32;
39
+ callToActionView?: Int32;
40
+ iconView?: Int32;
41
+ mediaView?: Int32;
42
+
43
+ titleViewStyleProps?: UnsafeMixed;
44
+ bodyViewStyleProps?: UnsafeMixed;
45
+ callToActionViewStyleProps?: UnsafeMixed;
46
+ iconViewStyleProps?: UnsafeMixed;
47
+ mediaViewStyleProps?: UnsafeMixed;
48
+
49
+ onAdLoadedEvent?: DirectEventHandler<AdInfoPayload>;
50
+ onAdLoadFailedEvent?: DirectEventHandler<AdLoadFailedInfoPayload>;
51
+ onAdClickedEvent?: DirectEventHandler<AdInfoPayload>;
52
+ onAdImpressionRecordedEvent?: DirectEventHandler<AdInfoPayload>;
53
+ }
54
+
55
+ type ComponentType = HostComponent<NativeProps>;
56
+
57
+ interface NativeCommands {
58
+ loadAd: (viewRef: React.ElementRef<ComponentType>) => void;
59
+ }
60
+
61
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
62
+ supportedCommands: ['loadAd'],
63
+ });
64
+
65
+ export default codegenNativeComponent<NativeProps>('DaroRNNativeAdView');
@@ -1,10 +1,9 @@
1
- import { NativeModules, NativeEventEmitter } from 'react-native';
1
+ import { NativeEventEmitter } from 'react-native';
2
2
  import type { EventSubscription } from 'react-native';
3
+ import NativeDaroModule from './NativeDaroModule';
3
4
  import type { AdEventObject, AdEventListener } from './types/AdEvent';
4
5
 
5
- const { DaroMModule } = NativeModules;
6
-
7
- const emitter = new NativeEventEmitter(DaroMModule);
6
+ const emitter = new NativeEventEmitter(NativeDaroModule);
8
7
  const subscriptions: Map<string, Set<EventSubscription>> = new Map();
9
8
 
10
9
  export const addEventListener = <T extends AdEventObject>(
@@ -37,7 +36,7 @@ export class AdEventEmitter {
37
36
  private subscriptions: Map<string, Set<EventSubscription>> = new Map();
38
37
 
39
38
  constructor() {
40
- this.emitter = new NativeEventEmitter(DaroMModule);
39
+ this.emitter = new NativeEventEmitter(NativeDaroModule);
41
40
  }
42
41
 
43
42
  addEventListener<T extends AdEventObject>(
@@ -1,9 +1,9 @@
1
- import { NativeModules } from 'react-native';
2
1
  import {
3
2
  addEventListener,
4
3
  removeEventListener,
5
4
  AdEventEmitter,
6
5
  } from './EventEmitter';
6
+ import NativeDaroModule from './NativeDaroModule';
7
7
  import type {
8
8
  AdDisplayFailedInfo,
9
9
  AdInfo,
@@ -11,8 +11,6 @@ import type {
11
11
  } from './types/AdInfo';
12
12
  import { AdEventType, type AdEventPayloadMap } from './types/AdEvent';
13
13
 
14
- const { DaroMModule } = NativeModules;
15
-
16
14
  const {
17
15
  ON_INTERSTITIAL_LOADED_EVENT,
18
16
  ON_INTERSTITIAL_LOAD_FAILED_EVENT,
@@ -21,7 +19,7 @@ const {
21
19
  ON_INTERSTITIAL_AD_FAILED_TO_DISPLAY_EVENT,
22
20
  ON_INTERSTITIAL_HIDDEN_EVENT,
23
21
  ON_INTERSTITIAL_AD_IMPRESSION_RECORDED,
24
- } = DaroMModule.getConstants();
22
+ } = NativeDaroModule.getConstants();
25
23
 
26
24
  const NATIVE_EVENT_BY_TYPE: Record<AdEventType, string> = {
27
25
  [AdEventType.LOADED]: ON_INTERSTITIAL_LOADED_EVENT,
@@ -51,15 +49,15 @@ export class InterstitialAd {
51
49
  }
52
50
 
53
51
  isAdReady(): Promise<boolean> {
54
- return DaroMModule.isInterstitialReady(this.requestId, this.adUnitId);
52
+ return NativeDaroModule.isInterstitialReady(this.requestId, this.adUnitId);
55
53
  }
56
54
 
57
55
  load(): void {
58
- DaroMModule.loadInterstitial(this.requestId, this.adUnitId);
56
+ NativeDaroModule.loadInterstitial(this.requestId, this.adUnitId);
59
57
  }
60
58
 
61
59
  show(): void {
62
- DaroMModule.showInterstitial(this.requestId, this.adUnitId);
60
+ NativeDaroModule.showInterstitial(this.requestId, this.adUnitId);
63
61
  }
64
62
 
65
63
  addAdEventListener<T extends AdEventType>(
@@ -109,19 +107,19 @@ export class InterstitialAd {
109
107
  /** @deprecated `InterstitialAd.createForAdRequest(adUnitId)` 인스턴스의 `isAdReady()`를 사용하세요. */
110
108
  static isAdReady(adUnitId: string): Promise<boolean> {
111
109
  const requestId = InterstitialAd._getLegacyRequestId(adUnitId);
112
- return DaroMModule.isInterstitialReady(requestId, adUnitId);
110
+ return NativeDaroModule.isInterstitialReady(requestId, adUnitId);
113
111
  }
114
112
 
115
113
  /** @deprecated `InterstitialAd.createForAdRequest(adUnitId)` 인스턴스의 `load()`를 사용하세요. */
116
114
  static loadAd(adUnitId: string): void {
117
115
  const requestId = InterstitialAd._getLegacyRequestId(adUnitId);
118
- DaroMModule.loadInterstitial(requestId, adUnitId);
116
+ NativeDaroModule.loadInterstitial(requestId, adUnitId);
119
117
  }
120
118
 
121
119
  /** @deprecated `InterstitialAd.createForAdRequest(adUnitId)` 인스턴스의 `show()`를 사용하세요. */
122
120
  static showAd(adUnitId: string): void {
123
121
  const requestId = InterstitialAd._getLegacyRequestId(adUnitId);
124
- DaroMModule.showInterstitial(requestId, adUnitId);
122
+ NativeDaroModule.showInterstitial(requestId, adUnitId);
125
123
  }
126
124
 
127
125
  /** @deprecated `addAdEventListener(AdEventType.LOADED, ...)`를 인스턴스에서 사용하세요. */
@@ -1,9 +1,10 @@
1
- import { NativeModules, processColor, type ColorValue } from 'react-native';
1
+ import { processColor, type ColorValue } from 'react-native';
2
2
  import {
3
3
  addEventListener,
4
4
  removeEventListener,
5
5
  AdEventEmitter,
6
6
  } from './EventEmitter';
7
+ import NativeDaroModule from './NativeDaroModule';
7
8
  import type {
8
9
  AdDisplayFailedInfo,
9
10
  AdInfo,
@@ -12,8 +13,6 @@ import type {
12
13
  import type { LightPopupAdConfiguration } from './types/LightPopupAd';
13
14
  import { AdEventType, type AdEventPayloadMap } from './types/AdEvent';
14
15
 
15
- const { DaroMModule } = NativeModules;
16
-
17
16
  const {
18
17
  ON_LIGHTPOPUP_LOADED_EVENT,
19
18
  ON_LIGHTPOPUP_LOAD_FAILED_EVENT,
@@ -22,7 +21,7 @@ const {
22
21
  ON_LIGHTPOPUP_AD_FAILED_TO_DISPLAY_EVENT,
23
22
  ON_LIGHTPOPUP_HIDDEN_EVENT,
24
23
  ON_LIGHTPOPUP_AD_IMPRESSION_RECORDED,
25
- } = DaroMModule.getConstants();
24
+ } = NativeDaroModule.getConstants();
26
25
 
27
26
  const NATIVE_EVENT_BY_TYPE: Record<AdEventType, string> = {
28
27
  [AdEventType.LOADED]: ON_LIGHTPOPUP_LOADED_EVENT,
@@ -103,19 +102,19 @@ export class LightPopupAd {
103
102
  }
104
103
 
105
104
  isAdReady(): Promise<boolean> {
106
- return DaroMModule.isLightPopupReady(this.requestId, this.adUnitId);
105
+ return NativeDaroModule.isLightPopupReady(this.requestId, this.adUnitId);
107
106
  }
108
107
 
109
108
  load(): void {
110
- DaroMModule.loadLightPopup(this.requestId, this.adUnitId);
109
+ NativeDaroModule.loadLightPopup(this.requestId, this.adUnitId);
111
110
  }
112
111
 
113
112
  show(): void {
114
- DaroMModule.showLightPopup(this.requestId, this.adUnitId);
113
+ NativeDaroModule.showLightPopup(this.requestId, this.adUnitId);
115
114
  }
116
115
 
117
116
  setConfiguration(configuration: LightPopupAdConfiguration): void {
118
- DaroMModule.setLightPopupAdConfiguration(
117
+ NativeDaroModule.setLightPopupAdConfiguration(
119
118
  this.requestId,
120
119
  this.adUnitId,
121
120
  normalizeConfiguration(configuration)
@@ -167,19 +166,19 @@ export class LightPopupAd {
167
166
  /** @deprecated `LightPopupAd.createForAdRequest(adUnitId)` 인스턴스의 `isAdReady()`를 사용하세요. */
168
167
  static isAdReady(adUnitId: string): Promise<boolean> {
169
168
  const requestId = LightPopupAd._getLegacyRequestId(adUnitId);
170
- return DaroMModule.isLightPopupReady(requestId, adUnitId);
169
+ return NativeDaroModule.isLightPopupReady(requestId, adUnitId);
171
170
  }
172
171
 
173
172
  /** @deprecated `LightPopupAd.createForAdRequest(adUnitId)` 인스턴스의 `load()`를 사용하세요. */
174
173
  static loadAd(adUnitId: string): void {
175
174
  const requestId = LightPopupAd._getLegacyRequestId(adUnitId);
176
- DaroMModule.loadLightPopup(requestId, adUnitId);
175
+ NativeDaroModule.loadLightPopup(requestId, adUnitId);
177
176
  }
178
177
 
179
178
  /** @deprecated `LightPopupAd.createForAdRequest(adUnitId)` 인스턴스의 `show()`를 사용하세요. */
180
179
  static showAd(adUnitId: string): void {
181
180
  const requestId = LightPopupAd._getLegacyRequestId(adUnitId);
182
- DaroMModule.showLightPopup(requestId, adUnitId);
181
+ NativeDaroModule.showLightPopup(requestId, adUnitId);
183
182
  }
184
183
 
185
184
  /** @deprecated 인스턴스의 `setConfiguration()`을 사용하세요. */
@@ -188,7 +187,7 @@ export class LightPopupAd {
188
187
  configuration: LightPopupAdConfiguration
189
188
  ): void {
190
189
  const requestId = LightPopupAd._getLegacyRequestId(adUnitId);
191
- DaroMModule.setLightPopupAdConfiguration(
190
+ NativeDaroModule.setLightPopupAdConfiguration(
192
191
  requestId,
193
192
  adUnitId,
194
193
  normalizeConfiguration(configuration)
@@ -0,0 +1,106 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+ import type {
4
+ Double,
5
+ UnsafeObject,
6
+ } from 'react-native/Libraries/Types/CodegenTypes';
7
+
8
+ export type DaroModuleConstants = {
9
+ ON_INTERSTITIAL_LOADED_EVENT: string;
10
+ ON_INTERSTITIAL_LOAD_FAILED_EVENT: string;
11
+ ON_INTERSTITIAL_CLICKED_EVENT: string;
12
+ ON_INTERSTITIAL_DISPLAYED_EVENT: string;
13
+ ON_INTERSTITIAL_AD_FAILED_TO_DISPLAY_EVENT: string;
14
+ ON_INTERSTITIAL_HIDDEN_EVENT: string;
15
+ ON_INTERSTITIAL_AD_IMPRESSION_RECORDED: string;
16
+
17
+ ON_REWARDED_AD_LOADED_EVENT: string;
18
+ ON_REWARDED_AD_LOAD_FAILED_EVENT: string;
19
+ ON_REWARDED_AD_CLICKED_EVENT: string;
20
+ ON_REWARDED_AD_DISPLAYED_EVENT: string;
21
+ ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT: string;
22
+ ON_REWARDED_AD_HIDDEN_EVENT: string;
23
+ ON_REWARDED_AD_RECEIVED_REWARD_EVENT: string;
24
+ ON_REWARDED_AD_IMPRESSION_RECORDED: string;
25
+
26
+ ON_APPOPEN_AD_LOADED_EVENT: string;
27
+ ON_APPOPEN_AD_LOAD_FAILED_EVENT: string;
28
+ ON_APPOPEN_AD_CLICKED_EVENT: string;
29
+ ON_APPOPEN_AD_DISPLAYED_EVENT: string;
30
+ ON_APPOPEN_AD_FAILED_TO_DISPLAY_EVENT: string;
31
+ ON_APPOPEN_AD_HIDDEN_EVENT: string;
32
+ ON_APPOPEN_AD_IMPRESSION_RECORDED: string;
33
+
34
+ ON_LIGHTPOPUP_LOADED_EVENT: string;
35
+ ON_LIGHTPOPUP_LOAD_FAILED_EVENT: string;
36
+ ON_LIGHTPOPUP_CLICKED_EVENT: string;
37
+ ON_LIGHTPOPUP_DISPLAYED_EVENT: string;
38
+ ON_LIGHTPOPUP_AD_FAILED_TO_DISPLAY_EVENT: string;
39
+ ON_LIGHTPOPUP_HIDDEN_EVENT: string;
40
+ ON_LIGHTPOPUP_AD_IMPRESSION_RECORDED: string;
41
+
42
+ BANNER_AD_FORMAT_LABEL: string;
43
+ MREC_AD_FORMAT_LABEL: string;
44
+ UNKNOWN_AD_FORMAT_LABEL?: string;
45
+ };
46
+
47
+ export interface Spec extends TurboModule {
48
+ getConstants: () => DaroModuleConstants;
49
+ addListener: (eventName: string) => void;
50
+ removeListeners: (count: number) => void;
51
+
52
+ isInitialized: () => Promise<boolean>;
53
+ initializeSdk: () => Promise<void>;
54
+ setUserId: (userId: string) => Promise<void>;
55
+
56
+ // 동의 상태는 **문자열**로 건넨다. Android 는 enum 이름, iOS 는 Int raw value 라
57
+ // 표현이 애초에 다르고, 어느 한쪽 표현을 브리지 계약으로 삼으면 다른 쪽이 그것을
58
+ // 되옮기다 조용히 틀린다 — Flutter 가 Android enum 이름(`nativeName`)을 그대로
59
+ // 넘겨 iOS 에서 깨진 전례가 있다(DARO-1471). 여기서는 플랫폼 중립 문자열만 오가고,
60
+ // 각 네이티브 어댑터가 자기 표현으로 옮긴다.
61
+ setGdpr: (status: string, consentString: string) => Promise<void>;
62
+ setCcpa: (status: string, consentString: string) => Promise<void>;
63
+ setCoppa: (status: string) => Promise<void>;
64
+
65
+ showMediationDebugger: () => Promise<void>;
66
+ showMediationDebuggerFor: (mediation: string) => Promise<void>;
67
+ getSdkVersion: () => Promise<string | null>;
68
+ getMediationStatuses: () => Promise<UnsafeObject[] | null>;
69
+ getMediationWeights: () => Promise<UnsafeObject | null>;
70
+ getAdapterInventory: () => Promise<UnsafeObject>;
71
+ getIntegrationKeyInfo: () => Promise<UnsafeObject>;
72
+
73
+ isInterstitialReady: (
74
+ requestId: Double,
75
+ adUnitId: string
76
+ ) => Promise<boolean>;
77
+ loadInterstitial: (requestId: Double, adUnitId: string) => Promise<void>;
78
+ showInterstitial: (requestId: Double, adUnitId: string) => Promise<void>;
79
+
80
+ isRewardedAdReady: (requestId: Double, adUnitId: string) => Promise<boolean>;
81
+ loadRewardedAd: (requestId: Double, adUnitId: string) => Promise<void>;
82
+ showRewardedAd: (
83
+ requestId: Double,
84
+ adUnitId: string,
85
+ customData?: string | null
86
+ ) => Promise<void>;
87
+
88
+ isAppOpenAdReady: (requestId: Double, adUnitId: string) => Promise<boolean>;
89
+ loadAppOpenAd: (requestId: Double, adUnitId: string) => Promise<void>;
90
+ showAppOpenAd: (
91
+ requestId: Double,
92
+ adUnitId: string,
93
+ customData?: string | null
94
+ ) => Promise<void>;
95
+
96
+ isLightPopupReady: (requestId: Double, adUnitId: string) => Promise<boolean>;
97
+ loadLightPopup: (requestId: Double, adUnitId: string) => Promise<void>;
98
+ showLightPopup: (requestId: Double, adUnitId: string) => Promise<void>;
99
+ setLightPopupAdConfiguration: (
100
+ requestId: Double,
101
+ adUnitId: string,
102
+ configuration: UnsafeObject
103
+ ) => Promise<void>;
104
+ }
105
+
106
+ export default TurboModuleRegistry.getEnforcing<Spec>('DaroRNModule');
package/src/RewardedAd.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { NativeModules } from 'react-native';
2
1
  import {
3
2
  addEventListener,
4
3
  removeEventListener,
5
4
  AdEventEmitter,
6
5
  } from './EventEmitter';
6
+ import NativeDaroModule from './NativeDaroModule';
7
7
  import type {
8
8
  AdDisplayFailedInfo,
9
9
  AdInfo,
@@ -16,8 +16,6 @@ import {
16
16
  type RewardedAdEventPayloadMap,
17
17
  } from './types/AdEvent';
18
18
 
19
- const { DaroMModule } = NativeModules;
20
-
21
19
  const {
22
20
  ON_REWARDED_AD_LOADED_EVENT,
23
21
  ON_REWARDED_AD_LOAD_FAILED_EVENT,
@@ -27,7 +25,7 @@ const {
27
25
  ON_REWARDED_AD_HIDDEN_EVENT,
28
26
  ON_REWARDED_AD_RECEIVED_REWARD_EVENT,
29
27
  ON_REWARDED_AD_IMPRESSION_RECORDED,
30
- } = DaroMModule.getConstants();
28
+ } = NativeDaroModule.getConstants();
31
29
 
32
30
  const NATIVE_EVENT_BY_TYPE: Record<AdEventType | RewardedAdEventType, string> =
33
31
  {
@@ -59,15 +57,15 @@ export class RewardedAd {
59
57
  }
60
58
 
61
59
  isAdReady(): Promise<boolean> {
62
- return DaroMModule.isRewardedAdReady(this.requestId, this.adUnitId);
60
+ return NativeDaroModule.isRewardedAdReady(this.requestId, this.adUnitId);
63
61
  }
64
62
 
65
63
  load(): void {
66
- DaroMModule.loadRewardedAd(this.requestId, this.adUnitId);
64
+ NativeDaroModule.loadRewardedAd(this.requestId, this.adUnitId);
67
65
  }
68
66
 
69
67
  show(customData?: string | null): void {
70
- DaroMModule.showRewardedAd(
68
+ NativeDaroModule.showRewardedAd(
71
69
  this.requestId,
72
70
  this.adUnitId,
73
71
  customData ?? null
@@ -119,19 +117,19 @@ export class RewardedAd {
119
117
  /** @deprecated `RewardedAd.createForAdRequest(adUnitId)` 인스턴스의 `isAdReady()`를 사용하세요. */
120
118
  static isAdReady(adUnitId: string): Promise<boolean> {
121
119
  const requestId = RewardedAd._getLegacyRequestId(adUnitId);
122
- return DaroMModule.isRewardedAdReady(requestId, adUnitId);
120
+ return NativeDaroModule.isRewardedAdReady(requestId, adUnitId);
123
121
  }
124
122
 
125
123
  /** @deprecated `RewardedAd.createForAdRequest(adUnitId)` 인스턴스의 `load()`를 사용하세요. */
126
124
  static loadAd(adUnitId: string): void {
127
125
  const requestId = RewardedAd._getLegacyRequestId(adUnitId);
128
- DaroMModule.loadRewardedAd(requestId, adUnitId);
126
+ NativeDaroModule.loadRewardedAd(requestId, adUnitId);
129
127
  }
130
128
 
131
129
  /** @deprecated `RewardedAd.createForAdRequest(adUnitId)` 인스턴스의 `show()`를 사용하세요. */
132
130
  static showAd(adUnitId: string, customData?: string | null): void {
133
131
  const requestId = RewardedAd._getLegacyRequestId(adUnitId);
134
- DaroMModule.showRewardedAd(requestId, adUnitId, customData ?? null);
132
+ NativeDaroModule.showRewardedAd(requestId, adUnitId, customData ?? null);
135
133
  }
136
134
 
137
135
  /** @deprecated `addAdEventListener(AdEventType.LOADED, ...)`를 인스턴스에서 사용하세요. */
@@ -0,0 +1,45 @@
1
+ declare module 'react-native/Libraries/Types/CodegenTypes' {
2
+ import type { NativeSyntheticEvent } from 'react-native';
3
+
4
+ export type DirectEventHandler<
5
+ T,
6
+ PaperName extends string | never = never,
7
+ > = [PaperName] extends [never]
8
+ ? (event: NativeSyntheticEvent<T>) => void | Promise<void>
9
+ : (event: NativeSyntheticEvent<T>) => void | Promise<void>;
10
+ export type Int32 = number;
11
+ export type Double = number;
12
+ export type UnsafeObject = object;
13
+ export type UnsafeMixed = unknown;
14
+ export type WithDefault<Type, Value> = Type | (Value & never);
15
+ }
16
+
17
+ declare module 'react-native/Libraries/Utilities/codegenNativeCommands' {
18
+ export interface Options<T extends string> {
19
+ readonly supportedCommands: ReadonlyArray<T>;
20
+ }
21
+
22
+ function codegenNativeCommands<T extends object>(
23
+ options: Options<keyof T extends string ? keyof T : never>
24
+ ): T;
25
+
26
+ export default codegenNativeCommands;
27
+ }
28
+
29
+ declare module 'react-native/Libraries/Utilities/codegenNativeComponent' {
30
+ import type { HostComponent } from 'react-native';
31
+
32
+ export interface Options {
33
+ readonly interfaceOnly?: boolean | undefined;
34
+ readonly paperComponentName?: string | undefined;
35
+ readonly paperComponentNameDeprecated?: string | undefined;
36
+ readonly excludedPlatforms?: ReadonlyArray<'iOS' | 'android'> | undefined;
37
+ }
38
+
39
+ function codegenNativeComponent<Props extends object>(
40
+ componentName: string,
41
+ options?: Options
42
+ ): HostComponent<Props>;
43
+
44
+ export default codegenNativeComponent;
45
+ }