react-native-daro 1.0.12-beta01 → 1.0.13

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 (110) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/darom/DaroMModule.kt +1 -1
  3. package/android/src/main/java/com/darom/impl/DaroMRewardedAdModuleImpl.kt +8 -2
  4. package/ios/DaroMAdBannerViewManager.swift +4 -0
  5. package/lib/commonjs/AppOpenAd.js +129 -70
  6. package/lib/commonjs/AppOpenAd.js.map +1 -1
  7. package/lib/commonjs/EventEmitter.js +39 -11
  8. package/lib/commonjs/EventEmitter.js.map +1 -1
  9. package/lib/commonjs/InterstitialAd.js +129 -70
  10. package/lib/commonjs/InterstitialAd.js.map +1 -1
  11. package/lib/commonjs/LightPopupAd.js +143 -80
  12. package/lib/commonjs/LightPopupAd.js.map +1 -1
  13. package/lib/commonjs/RewardedAd.js +138 -80
  14. package/lib/commonjs/RewardedAd.js.map +1 -1
  15. package/lib/commonjs/index.js +0 -1
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/commonjs/types/AdEvent.js +17 -0
  18. package/lib/commonjs/types/AdEvent.js.map +1 -1
  19. package/lib/module/AppOpenAd.js +129 -71
  20. package/lib/module/AppOpenAd.js.map +1 -1
  21. package/lib/module/EventEmitter.js +37 -10
  22. package/lib/module/EventEmitter.js.map +1 -1
  23. package/lib/module/InterstitialAd.js +130 -72
  24. package/lib/module/InterstitialAd.js.map +1 -1
  25. package/lib/module/LightPopupAd.js +145 -83
  26. package/lib/module/LightPopupAd.js.map +1 -1
  27. package/lib/module/RewardedAd.js +139 -82
  28. package/lib/module/RewardedAd.js.map +1 -1
  29. package/lib/module/index.js +0 -1
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/module/types/AdEvent.js +18 -1
  32. package/lib/module/types/AdEvent.js.map +1 -1
  33. package/lib/typescript/commonjs/src/AppOpenAd.d.ts +47 -2
  34. package/lib/typescript/commonjs/src/AppOpenAd.d.ts.map +1 -1
  35. package/lib/typescript/commonjs/src/EventEmitter.d.ts +9 -1
  36. package/lib/typescript/commonjs/src/EventEmitter.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/src/InterstitialAd.d.ts +47 -2
  38. package/lib/typescript/commonjs/src/InterstitialAd.d.ts.map +1 -1
  39. package/lib/typescript/commonjs/src/LightPopupAd.d.ts +51 -2
  40. package/lib/typescript/commonjs/src/LightPopupAd.d.ts.map +1 -1
  41. package/lib/typescript/commonjs/src/RewardedAd.d.ts +51 -2
  42. package/lib/typescript/commonjs/src/RewardedAd.d.ts.map +1 -1
  43. package/lib/typescript/commonjs/src/index.d.ts +1 -1
  44. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  45. package/lib/typescript/commonjs/src/types/AdEvent.d.ts +24 -0
  46. package/lib/typescript/commonjs/src/types/AdEvent.d.ts.map +1 -1
  47. package/lib/typescript/commonjs/src/types/LightPopupAd.d.ts +1 -5
  48. package/lib/typescript/commonjs/src/types/LightPopupAd.d.ts.map +1 -1
  49. package/lib/typescript/module/src/AppOpenAd.d.ts +47 -2
  50. package/lib/typescript/module/src/AppOpenAd.d.ts.map +1 -1
  51. package/lib/typescript/module/src/EventEmitter.d.ts +9 -1
  52. package/lib/typescript/module/src/EventEmitter.d.ts.map +1 -1
  53. package/lib/typescript/module/src/InterstitialAd.d.ts +47 -2
  54. package/lib/typescript/module/src/InterstitialAd.d.ts.map +1 -1
  55. package/lib/typescript/module/src/LightPopupAd.d.ts +51 -2
  56. package/lib/typescript/module/src/LightPopupAd.d.ts.map +1 -1
  57. package/lib/typescript/module/src/RewardedAd.d.ts +51 -2
  58. package/lib/typescript/module/src/RewardedAd.d.ts.map +1 -1
  59. package/lib/typescript/module/src/index.d.ts +1 -1
  60. package/lib/typescript/module/src/index.d.ts.map +1 -1
  61. package/lib/typescript/module/src/types/AdEvent.d.ts +24 -0
  62. package/lib/typescript/module/src/types/AdEvent.d.ts.map +1 -1
  63. package/lib/typescript/module/src/types/LightPopupAd.d.ts +1 -5
  64. package/lib/typescript/module/src/types/LightPopupAd.d.ts.map +1 -1
  65. package/package.json +6 -2
  66. package/react-native-daro-m.podspec +1 -1
  67. package/src/AppOpenAd.ts +172 -104
  68. package/src/EventEmitter.ts +60 -14
  69. package/src/InterstitialAd.ts +159 -103
  70. package/src/LightPopupAd.ts +183 -97
  71. package/src/RewardedAd.ts +181 -122
  72. package/src/index.tsx +19 -11
  73. package/src/types/AdEvent.ts +39 -2
  74. package/src/types/LightPopupAd.ts +2 -7
  75. package/lib/commonjs/types/AppOpenAd.js +0 -6
  76. package/lib/commonjs/types/AppOpenAd.js.map +0 -1
  77. package/lib/commonjs/types/FullScreenAd.js +0 -6
  78. package/lib/commonjs/types/FullScreenAd.js.map +0 -1
  79. package/lib/commonjs/types/InterstitialAd.js +0 -6
  80. package/lib/commonjs/types/InterstitialAd.js.map +0 -1
  81. package/lib/commonjs/types/RewardedAd.js +0 -6
  82. package/lib/commonjs/types/RewardedAd.js.map +0 -1
  83. package/lib/module/types/AppOpenAd.js +0 -4
  84. package/lib/module/types/AppOpenAd.js.map +0 -1
  85. package/lib/module/types/FullScreenAd.js +0 -4
  86. package/lib/module/types/FullScreenAd.js.map +0 -1
  87. package/lib/module/types/InterstitialAd.js +0 -4
  88. package/lib/module/types/InterstitialAd.js.map +0 -1
  89. package/lib/module/types/RewardedAd.js +0 -4
  90. package/lib/module/types/RewardedAd.js.map +0 -1
  91. package/lib/typescript/commonjs/src/types/AppOpenAd.d.ts +0 -3
  92. package/lib/typescript/commonjs/src/types/AppOpenAd.d.ts.map +0 -1
  93. package/lib/typescript/commonjs/src/types/FullScreenAd.d.ts +0 -21
  94. package/lib/typescript/commonjs/src/types/FullScreenAd.d.ts.map +0 -1
  95. package/lib/typescript/commonjs/src/types/InterstitialAd.d.ts +0 -3
  96. package/lib/typescript/commonjs/src/types/InterstitialAd.d.ts.map +0 -1
  97. package/lib/typescript/commonjs/src/types/RewardedAd.d.ts +0 -9
  98. package/lib/typescript/commonjs/src/types/RewardedAd.d.ts.map +0 -1
  99. package/lib/typescript/module/src/types/AppOpenAd.d.ts +0 -3
  100. package/lib/typescript/module/src/types/AppOpenAd.d.ts.map +0 -1
  101. package/lib/typescript/module/src/types/FullScreenAd.d.ts +0 -21
  102. package/lib/typescript/module/src/types/FullScreenAd.d.ts.map +0 -1
  103. package/lib/typescript/module/src/types/InterstitialAd.d.ts +0 -3
  104. package/lib/typescript/module/src/types/InterstitialAd.d.ts.map +0 -1
  105. package/lib/typescript/module/src/types/RewardedAd.d.ts +0 -9
  106. package/lib/typescript/module/src/types/RewardedAd.d.ts.map +0 -1
  107. package/src/types/AppOpenAd.ts +0 -3
  108. package/src/types/FullScreenAd.ts +0 -28
  109. package/src/types/InterstitialAd.ts +0 -3
  110. package/src/types/RewardedAd.ts +0 -15
package/src/RewardedAd.ts CHANGED
@@ -1,130 +1,189 @@
1
- import { NativeModules } from "react-native";
2
- import { addEventListener, removeEventListener } from "./EventEmitter";
3
- import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRewardInfo } from "./types/AdInfo";
4
- import type { RewardedAdType } from "./types/RewardedAd";
1
+ import { NativeModules } from 'react-native';
2
+ import {
3
+ addEventListener,
4
+ removeEventListener,
5
+ AdEventEmitter,
6
+ } from './EventEmitter';
7
+ import type {
8
+ AdDisplayFailedInfo,
9
+ AdInfo,
10
+ AdLoadFailedInfo,
11
+ AdRewardInfo,
12
+ } from './types/AdInfo';
13
+ import {
14
+ AdEventType,
15
+ RewardedAdEventType,
16
+ type RewardedAdEventPayloadMap,
17
+ } from './types/AdEvent';
5
18
 
6
19
  const { DaroMModule } = NativeModules;
7
20
 
8
21
  const {
9
- ON_REWARDED_AD_LOADED_EVENT,
10
- ON_REWARDED_AD_LOAD_FAILED_EVENT,
11
- ON_REWARDED_AD_CLICKED_EVENT,
12
- ON_REWARDED_AD_DISPLAYED_EVENT,
13
- ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT,
14
- ON_REWARDED_AD_HIDDEN_EVENT,
15
- ON_REWARDED_AD_RECEIVED_REWARD_EVENT,
16
- ON_REWARDED_AD_IMPRESSION_RECORDED,
22
+ ON_REWARDED_AD_LOADED_EVENT,
23
+ ON_REWARDED_AD_LOAD_FAILED_EVENT,
24
+ ON_REWARDED_AD_CLICKED_EVENT,
25
+ ON_REWARDED_AD_DISPLAYED_EVENT,
26
+ ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT,
27
+ ON_REWARDED_AD_HIDDEN_EVENT,
28
+ ON_REWARDED_AD_RECEIVED_REWARD_EVENT,
29
+ ON_REWARDED_AD_IMPRESSION_RECORDED,
17
30
  } = DaroMModule.getConstants();
18
31
 
19
-
20
- const isAdReady = (adUnitId: string): Promise<boolean> => {
21
- return DaroMModule.isRewardedAdReady(adUnitId);
22
- };
23
-
24
- const loadAd = (adUnitId: string): void => {
25
- DaroMModule.loadRewardedAd(adUnitId);
26
- };
27
-
28
- const showAd = (adUnitId: string, customData?: string | null): void => {
29
- DaroMModule.showRewardedAd(adUnitId, customData ?? null);
30
- };
31
-
32
- const addAdLoadedEventListener = (listener: (adInfo: AdInfo) => void): void => {
33
- addEventListener(ON_REWARDED_AD_LOADED_EVENT, listener);
34
- };
35
-
36
- const removeAdLoadedEventListener = (): void => {
37
- removeEventListener(ON_REWARDED_AD_LOADED_EVENT);
38
- };
39
-
40
- const addAdLoadFailedEventListener = (listener: (errorInfo: AdLoadFailedInfo) => void): void => {
41
- addEventListener(ON_REWARDED_AD_LOAD_FAILED_EVENT, listener);
42
- };
43
-
44
- const removeAdLoadFailedEventListener = (): void => {
45
- removeEventListener(ON_REWARDED_AD_LOAD_FAILED_EVENT);
46
- };
47
-
48
- const addAdClickedEventListener = (listener: (adInfo: AdInfo) => void): void => {
49
- addEventListener(ON_REWARDED_AD_CLICKED_EVENT, listener);
50
- };
51
-
52
- const removeAdClickedEventListener = (): void => {
53
- removeEventListener(ON_REWARDED_AD_CLICKED_EVENT);
54
- };
55
-
56
- const addAdDisplayedEventListener = (listener: (adInfo: AdInfo) => void): void => {
57
- addEventListener(ON_REWARDED_AD_DISPLAYED_EVENT, listener);
58
- };
59
-
60
- const removeAdDisplayedEventListener = (): void => {
61
- removeEventListener(ON_REWARDED_AD_DISPLAYED_EVENT);
62
- };
63
-
64
- const addAdFailedToDisplayEventListener = (listener: (errorInfo: AdDisplayFailedInfo) => void): void => {
65
- addEventListener(ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT, listener);
66
- };
67
-
68
- const removeAdFailedToDisplayEventListener = (): void => {
69
- removeEventListener(ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT);
70
- };
71
-
72
- const addAdHiddenEventListener = (listener: (adInfo: AdInfo) => void): void => {
73
- addEventListener(ON_REWARDED_AD_HIDDEN_EVENT, listener);
74
- };
75
-
76
- const removeAdHiddenEventListener = (): void => {
77
- removeEventListener(ON_REWARDED_AD_HIDDEN_EVENT);
78
- };
79
-
80
- const addAdImpressionRecordedListener = (listener: (adInfo: AdInfo) => void): void => {
81
- addEventListener(ON_REWARDED_AD_IMPRESSION_RECORDED, listener);
82
- };
83
-
84
- const removeAdImpressionRecordedListener = (): void => {
85
- removeEventListener(ON_REWARDED_AD_IMPRESSION_RECORDED);
86
- };
87
-
88
- // Rewarded specific APIs
89
-
90
- const addAdReceivedRewardEventListener = (listener: (adInfo: AdRewardInfo) => void): void => {
91
- addEventListener(ON_REWARDED_AD_RECEIVED_REWARD_EVENT, listener);
92
- };
93
-
94
- const removeAdReceivedRewardEventListener = (): void => {
95
- removeEventListener(ON_REWARDED_AD_RECEIVED_REWARD_EVENT);
96
- };
97
-
98
-
99
- export const RewardedAd: RewardedAdType = {
100
- isAdReady,
101
- loadAd,
102
- showAd,
103
-
104
- addAdLoadedEventListener,
105
- removeAdLoadedEventListener,
106
-
107
- addAdLoadFailedEventListener,
108
- removeAdLoadFailedEventListener,
109
-
110
- addAdClickedEventListener,
111
- removeAdClickedEventListener,
112
-
113
- addAdDisplayedEventListener,
114
- removeAdDisplayedEventListener,
115
-
116
- addAdFailedToDisplayEventListener,
117
- removeAdFailedToDisplayEventListener,
118
-
119
- addAdHiddenEventListener,
120
- removeAdHiddenEventListener,
121
-
122
- addAdImpressionRecordedListener,
123
- removeAdImpressionRecordedListener,
124
-
125
- // Rewarded specific APIs
126
- addAdReceivedRewardEventListener,
127
- removeAdReceivedRewardEventListener,
128
- };
32
+ const NATIVE_EVENT_BY_TYPE: Record<AdEventType | RewardedAdEventType, string> =
33
+ {
34
+ [AdEventType.LOADED]: ON_REWARDED_AD_LOADED_EVENT,
35
+ [AdEventType.LOAD_FAILED]: ON_REWARDED_AD_LOAD_FAILED_EVENT,
36
+ [AdEventType.CLICKED]: ON_REWARDED_AD_CLICKED_EVENT,
37
+ [AdEventType.DISPLAYED]: ON_REWARDED_AD_DISPLAYED_EVENT,
38
+ [AdEventType.FAILED_TO_DISPLAY]: ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT,
39
+ [AdEventType.HIDDEN]: ON_REWARDED_AD_HIDDEN_EVENT,
40
+ [AdEventType.IMPRESSION_RECORDED]: ON_REWARDED_AD_IMPRESSION_RECORDED,
41
+ [RewardedAdEventType.RECEIVED_REWARD]: ON_REWARDED_AD_RECEIVED_REWARD_EVENT,
42
+ };
43
+
44
+ export class RewardedAd {
45
+ private readonly eventEmitter = new AdEventEmitter();
46
+
47
+ private constructor(private readonly adUnitId: string) {}
48
+
49
+ static createForAdRequest(adUnitId: string): RewardedAd {
50
+ return new RewardedAd(adUnitId);
51
+ }
52
+
53
+ isAdReady(): Promise<boolean> {
54
+ return DaroMModule.isRewardedAdReady(this.adUnitId);
55
+ }
56
+
57
+ load(): void {
58
+ DaroMModule.loadRewardedAd(this.adUnitId);
59
+ }
60
+
61
+ show(customData?: string | null): void {
62
+ DaroMModule.showRewardedAd(this.adUnitId, customData ?? null);
63
+ }
64
+
65
+ addAdEventListener<T extends AdEventType | RewardedAdEventType>(
66
+ type: T,
67
+ listener: (info: RewardedAdEventPayloadMap[T]) => void
68
+ ): () => void {
69
+ const nativeEvent = NATIVE_EVENT_BY_TYPE[type];
70
+ const adUnitId = this.adUnitId;
71
+ return this.eventEmitter.addEventListener(nativeEvent, (payload: any) => {
72
+ if (payload?.adUnitId !== undefined && payload.adUnitId !== adUnitId) {
73
+ return;
74
+ }
75
+ listener(payload);
76
+ });
77
+ }
78
+
79
+ removeAllListeners(): void {
80
+ this.eventEmitter.removeAllListeners();
81
+ }
82
+
83
+ // ---- Deprecated static API (backward compatibility) ----
84
+
85
+ /** @deprecated `RewardedAd.createForAdRequest(adUnitId)` 인스턴스의 `isAdReady()`를 사용하세요. */
86
+ static isAdReady(adUnitId: string): Promise<boolean> {
87
+ return DaroMModule.isRewardedAdReady(adUnitId);
88
+ }
89
+
90
+ /** @deprecated `RewardedAd.createForAdRequest(adUnitId)` 인스턴스의 `load()`를 사용하세요. */
91
+ static loadAd(adUnitId: string): void {
92
+ DaroMModule.loadRewardedAd(adUnitId);
93
+ }
94
+
95
+ /** @deprecated `RewardedAd.createForAdRequest(adUnitId)` 인스턴스의 `show()`를 사용하세요. */
96
+ static showAd(adUnitId: string, customData?: string | null): void {
97
+ DaroMModule.showRewardedAd(adUnitId, customData ?? null);
98
+ }
99
+
100
+ /** @deprecated `addAdEventListener(AdEventType.LOADED, ...)`를 인스턴스에서 사용하세요. */
101
+ static addAdLoadedEventListener(listener: (adInfo: AdInfo) => void): void {
102
+ addEventListener(ON_REWARDED_AD_LOADED_EVENT, listener);
103
+ }
104
+
105
+ /** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
106
+ static removeAdLoadedEventListener(): void {
107
+ removeEventListener(ON_REWARDED_AD_LOADED_EVENT);
108
+ }
109
+
110
+ /** @deprecated `addAdEventListener(AdEventType.LOAD_FAILED, ...)`를 인스턴스에서 사용하세요. */
111
+ static addAdLoadFailedEventListener(
112
+ listener: (errorInfo: AdLoadFailedInfo) => void
113
+ ): void {
114
+ addEventListener(ON_REWARDED_AD_LOAD_FAILED_EVENT, listener);
115
+ }
116
+
117
+ /** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
118
+ static removeAdLoadFailedEventListener(): void {
119
+ removeEventListener(ON_REWARDED_AD_LOAD_FAILED_EVENT);
120
+ }
121
+
122
+ /** @deprecated `addAdEventListener(AdEventType.CLICKED, ...)`를 인스턴스에서 사용하세요. */
123
+ static addAdClickedEventListener(listener: (adInfo: AdInfo) => void): void {
124
+ addEventListener(ON_REWARDED_AD_CLICKED_EVENT, listener);
125
+ }
126
+
127
+ /** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
128
+ static removeAdClickedEventListener(): void {
129
+ removeEventListener(ON_REWARDED_AD_CLICKED_EVENT);
130
+ }
131
+
132
+ /** @deprecated `addAdEventListener(AdEventType.DISPLAYED, ...)`를 인스턴스에서 사용하세요. */
133
+ static addAdDisplayedEventListener(listener: (adInfo: AdInfo) => void): void {
134
+ addEventListener(ON_REWARDED_AD_DISPLAYED_EVENT, listener);
135
+ }
136
+
137
+ /** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
138
+ static removeAdDisplayedEventListener(): void {
139
+ removeEventListener(ON_REWARDED_AD_DISPLAYED_EVENT);
140
+ }
141
+
142
+ /** @deprecated `addAdEventListener(AdEventType.FAILED_TO_DISPLAY, ...)`를 인스턴스에서 사용하세요. */
143
+ static addAdFailedToDisplayEventListener(
144
+ listener: (errorInfo: AdDisplayFailedInfo) => void
145
+ ): void {
146
+ addEventListener(ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT, listener);
147
+ }
148
+
149
+ /** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
150
+ static removeAdFailedToDisplayEventListener(): void {
151
+ removeEventListener(ON_REWARDED_AD_FAILED_TO_DISPLAY_EVENT);
152
+ }
153
+
154
+ /** @deprecated `addAdEventListener(AdEventType.HIDDEN, ...)`를 인스턴스에서 사용하세요. */
155
+ static addAdHiddenEventListener(listener: (adInfo: AdInfo) => void): void {
156
+ addEventListener(ON_REWARDED_AD_HIDDEN_EVENT, listener);
157
+ }
158
+
159
+ /** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
160
+ static removeAdHiddenEventListener(): void {
161
+ removeEventListener(ON_REWARDED_AD_HIDDEN_EVENT);
162
+ }
163
+
164
+ /** @deprecated `addAdEventListener(AdEventType.IMPRESSION_RECORDED, ...)`를 인스턴스에서 사용하세요. */
165
+ static addAdImpressionRecordedListener(
166
+ listener: (adInfo: AdInfo) => void
167
+ ): void {
168
+ addEventListener(ON_REWARDED_AD_IMPRESSION_RECORDED, listener);
169
+ }
170
+
171
+ /** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
172
+ static removeAdImpressionRecordedListener(): void {
173
+ removeEventListener(ON_REWARDED_AD_IMPRESSION_RECORDED);
174
+ }
175
+
176
+ /** @deprecated `addAdEventListener(RewardedAdEventType.RECEIVED_REWARD, ...)`를 인스턴스에서 사용하세요. */
177
+ static addAdReceivedRewardEventListener(
178
+ listener: (adInfo: AdRewardInfo) => void
179
+ ): void {
180
+ addEventListener(ON_REWARDED_AD_RECEIVED_REWARD_EVENT, listener);
181
+ }
182
+
183
+ /** @deprecated 인스턴스의 `addAdEventListener` disposer를 사용하세요. */
184
+ static removeAdReceivedRewardEventListener(): void {
185
+ removeEventListener(ON_REWARDED_AD_RECEIVED_REWARD_EVENT);
186
+ }
187
+ }
129
188
 
130
189
  export default RewardedAd;
package/src/index.tsx CHANGED
@@ -1,7 +1,4 @@
1
- import {
2
- NativeModules,
3
- Platform
4
- } from 'react-native';
1
+ import { NativeModules, Platform } from 'react-native';
5
2
 
6
3
  export * from './AdBannerView';
7
4
  export * from './types';
@@ -10,7 +7,13 @@ export { RewardedAd } from './RewardedAd';
10
7
  export { LightPopupAd } from './LightPopupAd';
11
8
 
12
9
  export { NativeAdView } from './nativeAd/NativeAdView';
13
- export { BodyView, CallToActionView, IconView, MediaView, TitleView } from './nativeAd/NativeAdViewComponents';
10
+ export {
11
+ BodyView,
12
+ CallToActionView,
13
+ IconView,
14
+ MediaView,
15
+ TitleView,
16
+ } from './nativeAd/NativeAdViewComponents';
14
17
 
15
18
  const LINKING_ERROR =
16
19
  `The package 'react-native-daro-m' doesn't seem to be linked. Make sure: \n\n` +
@@ -18,15 +21,20 @@ const LINKING_ERROR =
18
21
  '- You rebuilt the app after installing the package\n' +
19
22
  '- You are not using Expo Go\n';
20
23
 
21
- const DaroMModule = NativeModules.DaroMModule ? NativeModules.DaroMModule : new Proxy({}, {
22
- get() {
23
- throw new Error(LINKING_ERROR);
24
- },
25
- });
24
+ const DaroMModule = NativeModules.DaroMModule
25
+ ? NativeModules.DaroMModule
26
+ : new Proxy(
27
+ {},
28
+ {
29
+ get() {
30
+ throw new Error(LINKING_ERROR);
31
+ },
32
+ }
33
+ );
26
34
 
27
35
  export async function initialize() {
28
36
  await DaroMModule.initializeSdk();
29
- };
37
+ }
30
38
 
31
39
  export async function showMediationDebugger() {
32
40
  await DaroMModule.showMediationDebugger();
@@ -1,9 +1,46 @@
1
- import type { AdInfo, AdLoadFailedInfo, AdDisplayFailedInfo, AdRewardInfo } from './AdInfo';
1
+ import type {
2
+ AdInfo,
3
+ AdLoadFailedInfo,
4
+ AdDisplayFailedInfo,
5
+ AdRewardInfo,
6
+ } from './AdInfo';
2
7
 
3
- export type AdEventObject = AdInfo | AdLoadFailedInfo | AdDisplayFailedInfo | AdRewardInfo;
8
+ export type AdEventObject =
9
+ | AdInfo
10
+ | AdLoadFailedInfo
11
+ | AdDisplayFailedInfo
12
+ | AdRewardInfo;
4
13
 
5
14
  // Defines a generic event listener for the pragrammatic methods to receive an event from the native module.
6
15
  export type AdEventListener<T extends AdEventObject> = (event: T) => void;
7
16
 
8
17
  // Defines a generic event object for the UI components i.e. AdView and NativeAdView to receive an event from the native module.
9
18
  export type AdNativeEvent<T extends AdEventObject> = { nativeEvent: T };
19
+
20
+ export enum AdEventType {
21
+ LOADED = 'LOADED',
22
+ LOAD_FAILED = 'LOAD_FAILED',
23
+ CLICKED = 'CLICKED',
24
+ DISPLAYED = 'DISPLAYED',
25
+ FAILED_TO_DISPLAY = 'FAILED_TO_DISPLAY',
26
+ HIDDEN = 'HIDDEN',
27
+ IMPRESSION_RECORDED = 'IMPRESSION_RECORDED',
28
+ }
29
+
30
+ export enum RewardedAdEventType {
31
+ RECEIVED_REWARD = 'RECEIVED_REWARD',
32
+ }
33
+
34
+ export interface AdEventPayloadMap {
35
+ [AdEventType.LOADED]: AdInfo;
36
+ [AdEventType.LOAD_FAILED]: AdLoadFailedInfo;
37
+ [AdEventType.CLICKED]: AdInfo;
38
+ [AdEventType.DISPLAYED]: AdInfo;
39
+ [AdEventType.FAILED_TO_DISPLAY]: AdDisplayFailedInfo;
40
+ [AdEventType.HIDDEN]: AdInfo;
41
+ [AdEventType.IMPRESSION_RECORDED]: AdInfo;
42
+ }
43
+
44
+ export interface RewardedAdEventPayloadMap extends AdEventPayloadMap {
45
+ [RewardedAdEventType.RECEIVED_REWARD]: AdRewardInfo;
46
+ }
@@ -1,9 +1,4 @@
1
- import type { ColorValue } from "react-native";
2
- import type { FullScreenAdType } from "./FullScreenAd";
3
-
4
- export interface LightPopupAdType extends FullScreenAdType {
5
- setLightPopupAdConfiguration: (adUnitId: string, configuration: LightPopupAdConfiguration) => void;
6
- }
1
+ import type { ColorValue } from 'react-native';
7
2
 
8
3
  export interface LightPopupAdConfiguration {
9
4
  backgroundColor?: ColorValue;
@@ -16,4 +11,4 @@ export interface LightPopupAdConfiguration {
16
11
  bodyTextColor?: ColorValue;
17
12
  ctaButtonTextColor?: ColorValue;
18
13
  ctaButtonBackgroundColor?: ColorValue;
19
- }
14
+ }
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- //# sourceMappingURL=AppOpenAd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/AppOpenAd.ts"],"mappings":"","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- //# sourceMappingURL=FullScreenAd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/FullScreenAd.ts"],"mappings":"","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- //# sourceMappingURL=InterstitialAd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/InterstitialAd.ts"],"mappings":"","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- //# sourceMappingURL=RewardedAd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/RewardedAd.ts"],"mappings":"","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export {};
4
- //# sourceMappingURL=AppOpenAd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/AppOpenAd.ts"],"mappings":"","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export {};
4
- //# sourceMappingURL=FullScreenAd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/FullScreenAd.ts"],"mappings":"","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export {};
4
- //# sourceMappingURL=InterstitialAd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/InterstitialAd.ts"],"mappings":"","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export {};
4
- //# sourceMappingURL=RewardedAd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/RewardedAd.ts"],"mappings":"","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import type { InterstitialAdType } from './InterstitialAd';
2
- export type AppOpenAdType = InterstitialAdType;
3
- //# sourceMappingURL=AppOpenAd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppOpenAd.d.ts","sourceRoot":"","sources":["../../../../../src/types/AppOpenAd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC"}
@@ -1,21 +0,0 @@
1
- import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo } from "./AdInfo";
2
- export type FullScreenAdType = {
3
- isAdReady: (adUnitId: string) => Promise<boolean>;
4
- loadAd: (adUnitId: string) => void;
5
- showAd: (adUnitId: string) => void;
6
- addAdLoadedEventListener: (listener: (adInfo: AdInfo) => void) => void;
7
- removeAdLoadedEventListener: (listener: (adInfo: AdInfo) => void) => void;
8
- addAdLoadFailedEventListener: (listener: (errorInfo: AdLoadFailedInfo) => void) => void;
9
- removeAdLoadFailedEventListener: (listener: (errorInfo: AdLoadFailedInfo) => void) => void;
10
- addAdClickedEventListener: (listener: (adInfo: AdInfo) => void) => void;
11
- removeAdClickedEventListener: (listener: (adInfo: AdInfo) => void) => void;
12
- addAdDisplayedEventListener: (listener: (adInfo: AdInfo) => void) => void;
13
- removeAdDisplayedEventListener: (listener: (adInfo: AdInfo) => void) => void;
14
- addAdFailedToDisplayEventListener: (listener: (errorInfo: AdDisplayFailedInfo) => void) => void;
15
- removeAdFailedToDisplayEventListener: (listener: (errorInfo: AdDisplayFailedInfo) => void) => void;
16
- addAdHiddenEventListener: (listener: (adInfo: AdInfo) => void) => void;
17
- removeAdHiddenEventListener: (listener: (adInfo: AdInfo) => void) => void;
18
- addAdImpressionRecordedListener: (listener: (adInfo: AdInfo) => void) => void;
19
- removeAdImpressionRecordedListener: (listener: (adInfo: AdInfo) => void) => void;
20
- };
21
- //# sourceMappingURL=FullScreenAd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FullScreenAd.d.ts","sourceRoot":"","sources":["../../../../../src/types/FullScreenAd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GAAG;IAC9B,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IACvE,2BAA2B,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAE1E,4BAA4B,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,gBAAgB,KAAK,IAAI,KAAK,IAAI,CAAC;IACxF,+BAA+B,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,gBAAgB,KAAK,IAAI,KAAK,IAAI,CAAC;IAE3F,yBAAyB,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IACxE,4BAA4B,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAE3E,2BAA2B,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAC1E,8BAA8B,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAE7E,iCAAiC,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,mBAAmB,KAAK,IAAI,KAAK,IAAI,CAAC;IAChG,oCAAoC,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,mBAAmB,KAAK,IAAI,KAAK,IAAI,CAAC;IAEnG,wBAAwB,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IACvE,2BAA2B,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAE1E,+BAA+B,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAC9E,kCAAkC,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;CACjF,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { FullScreenAdType } from "./FullScreenAd";
2
- export type InterstitialAdType = FullScreenAdType;
3
- //# sourceMappingURL=InterstitialAd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InterstitialAd.d.ts","sourceRoot":"","sources":["../../../../../src/types/InterstitialAd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { AdEventListener } from './AdEvent';
2
- import type { AdRewardInfo } from './AdInfo';
3
- import type { FullScreenAdType } from './FullScreenAd';
4
- export type RewardedAdType = FullScreenAdType & {
5
- showAd(adUnitId: string, customData?: string | null): void;
6
- addAdReceivedRewardEventListener(listener: AdEventListener<AdRewardInfo>): void;
7
- removeAdReceivedRewardEventListener(): void;
8
- };
9
- //# sourceMappingURL=RewardedAd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RewardedAd.d.ts","sourceRoot":"","sources":["../../../../../src/types/RewardedAd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG;IAE/C,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAI3D,gCAAgC,CAAC,QAAQ,EAAE,eAAe,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;IAGhF,mCAAmC,IAAI,IAAI,CAAC;CAC5C,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { InterstitialAdType } from './InterstitialAd';
2
- export type AppOpenAdType = InterstitialAdType;
3
- //# sourceMappingURL=AppOpenAd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppOpenAd.d.ts","sourceRoot":"","sources":["../../../../../src/types/AppOpenAd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC"}
@@ -1,21 +0,0 @@
1
- import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo } from "./AdInfo";
2
- export type FullScreenAdType = {
3
- isAdReady: (adUnitId: string) => Promise<boolean>;
4
- loadAd: (adUnitId: string) => void;
5
- showAd: (adUnitId: string) => void;
6
- addAdLoadedEventListener: (listener: (adInfo: AdInfo) => void) => void;
7
- removeAdLoadedEventListener: (listener: (adInfo: AdInfo) => void) => void;
8
- addAdLoadFailedEventListener: (listener: (errorInfo: AdLoadFailedInfo) => void) => void;
9
- removeAdLoadFailedEventListener: (listener: (errorInfo: AdLoadFailedInfo) => void) => void;
10
- addAdClickedEventListener: (listener: (adInfo: AdInfo) => void) => void;
11
- removeAdClickedEventListener: (listener: (adInfo: AdInfo) => void) => void;
12
- addAdDisplayedEventListener: (listener: (adInfo: AdInfo) => void) => void;
13
- removeAdDisplayedEventListener: (listener: (adInfo: AdInfo) => void) => void;
14
- addAdFailedToDisplayEventListener: (listener: (errorInfo: AdDisplayFailedInfo) => void) => void;
15
- removeAdFailedToDisplayEventListener: (listener: (errorInfo: AdDisplayFailedInfo) => void) => void;
16
- addAdHiddenEventListener: (listener: (adInfo: AdInfo) => void) => void;
17
- removeAdHiddenEventListener: (listener: (adInfo: AdInfo) => void) => void;
18
- addAdImpressionRecordedListener: (listener: (adInfo: AdInfo) => void) => void;
19
- removeAdImpressionRecordedListener: (listener: (adInfo: AdInfo) => void) => void;
20
- };
21
- //# sourceMappingURL=FullScreenAd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FullScreenAd.d.ts","sourceRoot":"","sources":["../../../../../src/types/FullScreenAd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GAAG;IAC9B,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IACvE,2BAA2B,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAE1E,4BAA4B,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,gBAAgB,KAAK,IAAI,KAAK,IAAI,CAAC;IACxF,+BAA+B,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,gBAAgB,KAAK,IAAI,KAAK,IAAI,CAAC;IAE3F,yBAAyB,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IACxE,4BAA4B,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAE3E,2BAA2B,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAC1E,8BAA8B,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAE7E,iCAAiC,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,mBAAmB,KAAK,IAAI,KAAK,IAAI,CAAC;IAChG,oCAAoC,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,mBAAmB,KAAK,IAAI,KAAK,IAAI,CAAC;IAEnG,wBAAwB,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IACvE,2BAA2B,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAE1E,+BAA+B,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IAC9E,kCAAkC,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;CACjF,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { FullScreenAdType } from "./FullScreenAd";
2
- export type InterstitialAdType = FullScreenAdType;
3
- //# sourceMappingURL=InterstitialAd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InterstitialAd.d.ts","sourceRoot":"","sources":["../../../../../src/types/InterstitialAd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { AdEventListener } from './AdEvent';
2
- import type { AdRewardInfo } from './AdInfo';
3
- import type { FullScreenAdType } from './FullScreenAd';
4
- export type RewardedAdType = FullScreenAdType & {
5
- showAd(adUnitId: string, customData?: string | null): void;
6
- addAdReceivedRewardEventListener(listener: AdEventListener<AdRewardInfo>): void;
7
- removeAdReceivedRewardEventListener(): void;
8
- };
9
- //# sourceMappingURL=RewardedAd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RewardedAd.d.ts","sourceRoot":"","sources":["../../../../../src/types/RewardedAd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG;IAE/C,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAI3D,gCAAgC,CAAC,QAAQ,EAAE,eAAe,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;IAGhF,mCAAmC,IAAI,IAAI,CAAC;CAC5C,CAAC"}