@ezoic/react-native-sdk 1.1.0 → 1.3.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 (38) hide show
  1. package/EzoicReactNativeSdk.podspec +4 -1
  2. package/README.md +26 -2
  3. package/android/build.gradle +7 -1
  4. package/android/src/main/java/com/ezoic/reactnative/EzoicAdsModule.kt +144 -0
  5. package/android/src/main/java/com/ezoic/reactnative/EzoicNativeAdViewManager.kt +314 -0
  6. package/android/src/main/java/com/ezoic/reactnative/EzoicReactNativeSdkPackage.kt +4 -1
  7. package/ios/EzoicAdsImpl.swift +200 -44
  8. package/ios/EzoicNativeAdHostView.swift +181 -0
  9. package/ios/EzoicNativeAdViewComponentView.mm +99 -0
  10. package/ios/EzoicReactNativeSdk.mm +18 -1
  11. package/lib/module/EzoicInterstitialAd.js +108 -0
  12. package/lib/module/EzoicInterstitialAd.js.map +1 -0
  13. package/lib/module/EzoicNativeAdViewNativeComponent.ts +22 -0
  14. package/lib/module/EzoicRewardedAd.js +4 -1
  15. package/lib/module/EzoicRewardedAd.js.map +1 -1
  16. package/lib/module/NativeEzoicAds.js.map +1 -1
  17. package/lib/module/helpers.js.map +1 -1
  18. package/lib/module/index.js +29 -0
  19. package/lib/module/index.js.map +1 -1
  20. package/lib/typescript/src/EzoicInterstitialAd.d.ts +51 -0
  21. package/lib/typescript/src/EzoicInterstitialAd.d.ts.map +1 -0
  22. package/lib/typescript/src/EzoicNativeAdViewNativeComponent.d.ts +18 -0
  23. package/lib/typescript/src/EzoicNativeAdViewNativeComponent.d.ts.map +1 -0
  24. package/lib/typescript/src/EzoicRewardedAd.d.ts +1 -0
  25. package/lib/typescript/src/EzoicRewardedAd.d.ts.map +1 -1
  26. package/lib/typescript/src/NativeEzoicAds.d.ts +2 -0
  27. package/lib/typescript/src/NativeEzoicAds.d.ts.map +1 -1
  28. package/lib/typescript/src/helpers.d.ts +1 -1
  29. package/lib/typescript/src/helpers.d.ts.map +1 -1
  30. package/lib/typescript/src/index.d.ts +21 -0
  31. package/lib/typescript/src/index.d.ts.map +1 -1
  32. package/package.json +2 -2
  33. package/src/EzoicInterstitialAd.ts +126 -0
  34. package/src/EzoicNativeAdViewNativeComponent.ts +22 -0
  35. package/src/EzoicRewardedAd.ts +8 -2
  36. package/src/NativeEzoicAds.ts +3 -1
  37. package/src/helpers.ts +1 -1
  38. package/src/index.tsx +51 -0
package/src/index.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { StyleProp, ViewStyle } from 'react-native';
2
2
  import NativeEzoicAds, { type EzoicConfig } from './NativeEzoicAds';
3
3
  import EzoicBannerNative from './EzoicBannerViewNativeComponent';
4
+ import EzoicNativeAdNative from './EzoicNativeAdViewNativeComponent';
4
5
  import { coerceAdUnitId, normalizeConfig, normalizeSize } from './helpers';
5
6
 
6
7
  export type { EzoicConfig };
@@ -9,6 +10,10 @@ export {
9
10
  type EzoicReward,
10
11
  type EzoicRewardedAdListeners,
11
12
  } from './EzoicRewardedAd';
13
+ export {
14
+ EzoicInterstitialAd,
15
+ type EzoicInterstitialAdListeners,
16
+ } from './EzoicInterstitialAd';
12
17
 
13
18
  export const EzoicAds = {
14
19
  initialize(config: EzoicConfig): Promise<void> {
@@ -71,3 +76,49 @@ export function EzoicBannerView(props: EzoicBannerViewProps) {
71
76
  />
72
77
  );
73
78
  }
79
+
80
+ export interface EzoicNativeAdError {
81
+ message: string;
82
+ code: number;
83
+ }
84
+
85
+ export interface EzoicNativeAdViewProps {
86
+ adUnitIdentifier: string | number;
87
+ style?: StyleProp<ViewStyle>;
88
+ onLoad?: () => void;
89
+ onError?: (error: EzoicNativeAdError) => void;
90
+ onImpression?: () => void;
91
+ onClick?: () => void;
92
+ onOpen?: () => void;
93
+ onClose?: () => void;
94
+ }
95
+
96
+ /**
97
+ * Renders a native ad in an SDK-built template `NativeAdView`. The component
98
+ * fills the bounds it is given by its RN style, so size it with `style` (e.g.
99
+ * `{ width: '100%', height: 300 }`); the template lays out its assets inside.
100
+ */
101
+ export function EzoicNativeAdView(props: EzoicNativeAdViewProps) {
102
+ const {
103
+ adUnitIdentifier,
104
+ onLoad,
105
+ onError,
106
+ onImpression,
107
+ onClick,
108
+ onOpen,
109
+ onClose,
110
+ ...rest
111
+ } = props;
112
+ return (
113
+ <EzoicNativeAdNative
114
+ {...rest}
115
+ adUnitIdentifier={coerceAdUnitId(adUnitIdentifier)}
116
+ onLoad={onLoad ? () => onLoad() : undefined}
117
+ onError={onError ? (e) => onError(e.nativeEvent) : undefined}
118
+ onImpression={onImpression ? () => onImpression() : undefined}
119
+ onAdClick={onClick ? () => onClick() : undefined}
120
+ onOpen={onOpen ? () => onOpen() : undefined}
121
+ onClose={onClose ? () => onClose() : undefined}
122
+ />
123
+ );
124
+ }