@ezoic/react-native-sdk 1.2.0 → 1.4.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 (40) hide show
  1. package/EzoicReactNativeSdk.podspec +4 -1
  2. package/README.md +86 -2
  3. package/android/build.gradle +7 -1
  4. package/android/src/main/java/com/ezoic/reactnative/EzoicAdsModule.kt +129 -0
  5. package/android/src/main/java/com/ezoic/reactnative/EzoicNativeAdViewManager.kt +314 -0
  6. package/android/src/main/java/com/ezoic/reactnative/EzoicOutstreamAdViewManager.kt +191 -0
  7. package/android/src/main/java/com/ezoic/reactnative/EzoicReactNativeSdkPackage.kt +5 -1
  8. package/ios/EzoicAdsImpl.swift +160 -0
  9. package/ios/EzoicNativeAdHostView.swift +181 -0
  10. package/ios/EzoicNativeAdViewComponentView.mm +99 -0
  11. package/ios/EzoicOutstreamAdHostView.swift +86 -0
  12. package/ios/EzoicOutstreamAdViewComponentView.mm +105 -0
  13. package/ios/EzoicReactNativeSdk.mm +41 -0
  14. package/lib/module/EzoicInstreamAd.js +91 -0
  15. package/lib/module/EzoicInstreamAd.js.map +1 -0
  16. package/lib/module/EzoicNativeAdViewNativeComponent.ts +22 -0
  17. package/lib/module/EzoicOutstreamAdViewNativeComponent.ts +23 -0
  18. package/lib/module/NativeEzoicAds.js.map +1 -1
  19. package/lib/module/helpers.js.map +1 -1
  20. package/lib/module/index.js +58 -0
  21. package/lib/module/index.js.map +1 -1
  22. package/lib/typescript/src/EzoicInstreamAd.d.ts +86 -0
  23. package/lib/typescript/src/EzoicInstreamAd.d.ts.map +1 -0
  24. package/lib/typescript/src/EzoicNativeAdViewNativeComponent.d.ts +18 -0
  25. package/lib/typescript/src/EzoicNativeAdViewNativeComponent.d.ts.map +1 -0
  26. package/lib/typescript/src/EzoicOutstreamAdViewNativeComponent.d.ts +18 -0
  27. package/lib/typescript/src/EzoicOutstreamAdViewNativeComponent.d.ts.map +1 -0
  28. package/lib/typescript/src/NativeEzoicAds.d.ts +4 -0
  29. package/lib/typescript/src/NativeEzoicAds.d.ts.map +1 -1
  30. package/lib/typescript/src/helpers.d.ts +1 -1
  31. package/lib/typescript/src/helpers.d.ts.map +1 -1
  32. package/lib/typescript/src/index.d.ts +42 -0
  33. package/lib/typescript/src/index.d.ts.map +1 -1
  34. package/package.json +2 -2
  35. package/src/EzoicInstreamAd.ts +110 -0
  36. package/src/EzoicNativeAdViewNativeComponent.ts +22 -0
  37. package/src/EzoicOutstreamAdViewNativeComponent.ts +23 -0
  38. package/src/NativeEzoicAds.ts +18 -0
  39. package/src/helpers.ts +1 -1
  40. package/src/index.tsx +100 -0
@@ -0,0 +1,86 @@
1
+ import UIKit
2
+ import EzoicAdsSDKBinary
3
+
4
+ /// Bridge protocol the Fabric component view implements to receive outstream
5
+ /// events. Mirrors `EzoicNativeAdHostViewDelegate` — the ObjC++ component view
6
+ /// forwards these onto the Fabric `_eventEmitter`.
7
+ @objc public protocol EzoicOutstreamAdHostViewDelegate: AnyObject {
8
+ func outstreamAdDidLoad()
9
+ func outstreamAdDidFail(_ message: String, code: Int)
10
+ func outstreamAdDidRecordImpression()
11
+ func outstreamAdDidRecordClick()
12
+ func outstreamAdWillPresentScreen()
13
+ func outstreamAdDidDismissScreen()
14
+ }
15
+
16
+ /// Host `UIView` wrapping the native `EzoicOutstreamAdView`. Unlike the native
17
+ /// ad (which returns a `NativeAd` we build a template around), the native
18
+ /// outstream view renders itself (it attaches its own `AdManagerBannerView`),
19
+ /// so this host just embeds it edge-to-edge, wires the delegate before
20
+ /// `loadAd()`, and tears it down on `deinit`.
21
+ ///
22
+ /// Load is deferred to `startLoad()` (called from the component view's
23
+ /// `finalizeUpdates`) so the Fabric event emitter is attached before the native
24
+ /// SDK can fail synchronously (uninitialized) and emit `onError`.
25
+ @objc public class EzoicOutstreamAdHostView: UIView, EzoicOutstreamAdViewDelegate {
26
+
27
+ @objc public weak var hostDelegate: EzoicOutstreamAdHostViewDelegate?
28
+
29
+ private var adUnitId: Int = 0
30
+ private var outstreamView: EzoicOutstreamAdView?
31
+ private var loadStarted = false
32
+
33
+ /// Stores the ad unit id. The load is NOT started here — the Fabric
34
+ /// component view calls `startLoad()` from `finalizeUpdates`.
35
+ @objc public func configure(adUnitIdentifier: String) {
36
+ self.adUnitId = Int(adUnitIdentifier) ?? 0
37
+ }
38
+
39
+ /// Builds the native outstream view, wires its delegate BEFORE `loadAd()`,
40
+ /// embeds it edge-to-edge, and loads once. A second call is a no-op; the
41
+ /// guard survives repeated `finalizeUpdates` calls.
42
+ @objc public func startLoad() {
43
+ if loadStarted { return }
44
+ loadStarted = true
45
+
46
+ let view = EzoicOutstreamAdView(adUnitIdentifier: adUnitId)
47
+ // Delegate before loadAd so no early lifecycle callback is missed.
48
+ view.delegate = self
49
+ view.translatesAutoresizingMaskIntoConstraints = false
50
+ addSubview(view)
51
+ NSLayoutConstraint.activate([
52
+ view.topAnchor.constraint(equalTo: topAnchor),
53
+ view.leadingAnchor.constraint(equalTo: leadingAnchor),
54
+ view.trailingAnchor.constraint(equalTo: trailingAnchor),
55
+ view.bottomAnchor.constraint(equalTo: bottomAnchor),
56
+ ])
57
+ self.outstreamView = view
58
+ view.loadAd()
59
+ }
60
+
61
+ // MARK: - EzoicOutstreamAdViewDelegate
62
+ public func outstreamViewDidLoad(_ outstreamView: EzoicOutstreamAdView) {
63
+ hostDelegate?.outstreamAdDidLoad()
64
+ }
65
+ public func outstreamView(_ outstreamView: EzoicOutstreamAdView, didFailToLoadWithError error: EzoicError) {
66
+ hostDelegate?.outstreamAdDidFail(error.localizedDescription, code: error.code)
67
+ }
68
+ public func outstreamViewDidRecordImpression(_ outstreamView: EzoicOutstreamAdView) {
69
+ hostDelegate?.outstreamAdDidRecordImpression()
70
+ }
71
+ public func outstreamViewDidRecordClick(_ outstreamView: EzoicOutstreamAdView) {
72
+ hostDelegate?.outstreamAdDidRecordClick()
73
+ }
74
+ public func outstreamViewWillPresentScreen(_ outstreamView: EzoicOutstreamAdView) {
75
+ hostDelegate?.outstreamAdWillPresentScreen()
76
+ }
77
+ public func outstreamViewDidDismissScreen(_ outstreamView: EzoicOutstreamAdView) {
78
+ hostDelegate?.outstreamAdDidDismissScreen()
79
+ }
80
+
81
+ deinit {
82
+ // The native view also destroys itself on removeFromSuperview, but call it
83
+ // explicitly for a deterministic teardown. Safe to call multiple times.
84
+ outstreamView?.destroy()
85
+ }
86
+ }
@@ -0,0 +1,105 @@
1
+ #import <React/RCTViewComponentView.h>
2
+ #import <react/renderer/components/EzoicReactNativeSdkSpec/ComponentDescriptors.h>
3
+ #import <react/renderer/components/EzoicReactNativeSdkSpec/EventEmitters.h>
4
+ #import <react/renderer/components/EzoicReactNativeSdkSpec/Props.h>
5
+ #import <react/renderer/components/EzoicReactNativeSdkSpec/RCTComponentViewHelpers.h>
6
+ #import <EzoicReactNativeSdk/EzoicReactNativeSdk-Swift.h>
7
+
8
+ using namespace facebook::react;
9
+
10
+ @interface EzoicOutstreamAdView : RCTViewComponentView <EzoicOutstreamAdHostViewDelegate>
11
+ @end
12
+
13
+ @implementation EzoicOutstreamAdView {
14
+ EzoicOutstreamAdHostView *_host;
15
+ NSString *_lastAdUnit;
16
+ BOOL _loadStarted;
17
+ }
18
+
19
+ + (ComponentDescriptorProvider)componentDescriptorProvider {
20
+ return concreteComponentDescriptorProvider<EzoicOutstreamAdViewComponentDescriptor>();
21
+ }
22
+
23
+ - (instancetype)initWithFrame:(CGRect)frame {
24
+ if (self = [super initWithFrame:frame]) {
25
+ _host = [EzoicOutstreamAdHostView new];
26
+ _host.hostDelegate = self;
27
+ self.contentView = _host;
28
+ }
29
+ return self;
30
+ }
31
+
32
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps {
33
+ const auto &newProps = *std::static_pointer_cast<EzoicOutstreamAdViewProps const>(props);
34
+ NSString *adUnit = [NSString stringWithUTF8String:newProps.adUnitIdentifier.c_str()];
35
+ if (![adUnit isEqualToString:_lastAdUnit]) {
36
+ // Ad unit changed after a load already started: swap in a fresh host
37
+ // (mirrors prepareForRecycle) and reset the load guard so finalizeUpdates
38
+ // starts a new load for the new id.
39
+ if (_loadStarted) {
40
+ // Nil the abandoned host's delegate first: a late lifecycle callback from
41
+ // it would otherwise emit a Fabric event for the wrong ad unit.
42
+ _host.hostDelegate = nil;
43
+ [_host removeFromSuperview];
44
+ _host = [EzoicOutstreamAdHostView new];
45
+ _host.hostDelegate = self;
46
+ self.contentView = _host;
47
+ _loadStarted = NO;
48
+ }
49
+ _lastAdUnit = adUnit;
50
+ [_host configureWithAdUnitIdentifier:adUnit];
51
+ }
52
+ [super updateProps:props oldProps:oldProps];
53
+ }
54
+
55
+ // RCTMountingManager mounts on Insert as updateProps → updateEventEmitter →
56
+ // finalizeUpdates. Starting the load here (not in updateProps) guarantees the
57
+ // event emitter is attached before the native SDK can fail synchronously and
58
+ // emit onError, which would otherwise be dropped while _eventEmitter is nil.
59
+ - (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask {
60
+ [super finalizeUpdates:updateMask];
61
+ if (!_loadStarted && _lastAdUnit.length > 0) {
62
+ _loadStarted = YES;
63
+ [_host startLoad];
64
+ }
65
+ }
66
+
67
+ - (void)outstreamAdDidLoad {
68
+ if (_eventEmitter) std::static_pointer_cast<EzoicOutstreamAdViewEventEmitter const>(_eventEmitter)->onLoad({});
69
+ }
70
+ - (void)outstreamAdDidFail:(NSString *)message code:(NSInteger)code {
71
+ if (_eventEmitter)
72
+ std::static_pointer_cast<EzoicOutstreamAdViewEventEmitter const>(_eventEmitter)
73
+ ->onError({.message = std::string([message UTF8String]), .code = (int)code});
74
+ }
75
+ - (void)outstreamAdDidRecordImpression {
76
+ if (_eventEmitter) std::static_pointer_cast<EzoicOutstreamAdViewEventEmitter const>(_eventEmitter)->onImpression({});
77
+ }
78
+ - (void)outstreamAdDidRecordClick {
79
+ if (_eventEmitter) std::static_pointer_cast<EzoicOutstreamAdViewEventEmitter const>(_eventEmitter)->onAdClick({});
80
+ }
81
+ - (void)outstreamAdWillPresentScreen {
82
+ if (_eventEmitter) std::static_pointer_cast<EzoicOutstreamAdViewEventEmitter const>(_eventEmitter)->onOpen({});
83
+ }
84
+ - (void)outstreamAdDidDismissScreen {
85
+ if (_eventEmitter) std::static_pointer_cast<EzoicOutstreamAdViewEventEmitter const>(_eventEmitter)->onClose({});
86
+ }
87
+
88
+ - (void)prepareForRecycle {
89
+ // Recycled views are reused for a new ad unit; rebuild the host (which owns
90
+ // the native EzoicOutstreamAdView, destroyed on deinit) and reset the guards.
91
+ // Nil the delegate first: a late lifecycle callback from the abandoned host
92
+ // would otherwise emit a Fabric event for the wrong ad unit.
93
+ _host.hostDelegate = nil;
94
+ [_host removeFromSuperview];
95
+ _host = [EzoicOutstreamAdHostView new];
96
+ _host.hostDelegate = self;
97
+ self.contentView = _host;
98
+ _lastAdUnit = nil;
99
+ _loadStarted = NO;
100
+ [super prepareForRecycle];
101
+ }
102
+
103
+ Class<RCTComponentViewProtocol> EzoicOutstreamAdViewCls(void) { return EzoicOutstreamAdView.class; }
104
+
105
+ @end
@@ -42,6 +42,11 @@ static NSString *const kEzoicInterstitialEvent = @"EzoicInterstitialAdEvent";
42
42
  _hasListeners = NO;
43
43
  }
44
44
 
45
+ - (void)invalidate {
46
+ [_impl invalidate];
47
+ [super invalidate];
48
+ }
49
+
45
50
  - (void)initialize:(JS::NativeEzoicAds::EzoicConfig &)config
46
51
  resolve:(RCTPromiseResolveBlock)resolve
47
52
  reject:(RCTPromiseRejectBlock)reject {
@@ -105,6 +110,42 @@ static NSString *const kEzoicInterstitialEvent = @"EzoicInterstitialAdEvent";
105
110
  reject:^(NSString *code, NSString *msg, NSError *_Nullable e) { reject(code, msg, e); }];
106
111
  }
107
112
 
113
+ - (void)loadInstreamAd:(double)adUnitIdentifier
114
+ contentUrl:(NSString *)contentUrl
115
+ resolve:(RCTPromiseResolveBlock)resolve
116
+ reject:(RCTPromiseRejectBlock)reject {
117
+ [_impl loadInstreamAd:adUnitIdentifier
118
+ contentUrl:contentUrl
119
+ resolve:^(id _Nullable v) { resolve(v); }
120
+ reject:^(NSString *code, NSString *msg, NSError *_Nullable e) { reject(code, msg, e); }];
121
+ }
122
+
123
+ - (void)getInstreamNextAdTagUrl:(double)adUnitIdentifier
124
+ resolve:(RCTPromiseResolveBlock)resolve
125
+ reject:(RCTPromiseRejectBlock)reject {
126
+ [_impl getInstreamNextAdTagUrl:adUnitIdentifier
127
+ resolve:^(id _Nullable v) { resolve(v); }
128
+ reject:^(NSString *code, NSString *msg, NSError *_Nullable e) { reject(code, msg, e); }];
129
+ }
130
+
131
+ - (void)reportInstreamImpression:(double)adUnitIdentifier
132
+ revenueUsd:(NSNumber *)revenueUsd
133
+ resolve:(RCTPromiseResolveBlock)resolve
134
+ reject:(RCTPromiseRejectBlock)reject {
135
+ [_impl reportInstreamImpression:adUnitIdentifier
136
+ revenueUsd:revenueUsd
137
+ resolve:^(id _Nullable v) { resolve(v); }
138
+ reject:^(NSString *code, NSString *msg, NSError *_Nullable e) { reject(code, msg, e); }];
139
+ }
140
+
141
+ - (void)destroyInstreamAd:(double)adUnitIdentifier
142
+ resolve:(RCTPromiseResolveBlock)resolve
143
+ reject:(RCTPromiseRejectBlock)reject {
144
+ [_impl destroyInstreamAd:adUnitIdentifier
145
+ resolve:^(id _Nullable v) { resolve(v); }
146
+ reject:^(NSString *code, NSString *msg, NSError *_Nullable e) { reject(code, msg, e); }];
147
+ }
148
+
108
149
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
109
150
  (const facebook::react::ObjCTurboModule::InitParams &)params {
110
151
  return std::make_shared<facebook::react::NativeEzoicAdsSpecJSI>(params);
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ import NativeEzoicAds from "./NativeEzoicAds.js";
4
+
5
+ /** Options for {@link EzoicInstreamAd.load}. */
6
+
7
+ /** Options for {@link EzoicInstreamAd.reportImpression}. */
8
+
9
+ /**
10
+ * An instream video ad controller. Instream video runs inside the host app's
11
+ * OWN video content: **the host owns the video player and the Google IMA SDK**.
12
+ * Unlike the banner/native/outstream views, this controller renders nothing and
13
+ * holds no view — its sole deliverable is a GAM VAST ad-tag URL string the host
14
+ * feeds to its own IMA `AdsRequest`.
15
+ *
16
+ * Usage:
17
+ *
18
+ * ```ts
19
+ * const instream = new EzoicInstreamAd('12345');
20
+ * const tagUrl = await instream.load({ contentUrl: playingVideoUrl });
21
+ * // hand tagUrl to your IMA AdsLoader / AdsRequest.
22
+ *
23
+ * // On an IMA ad error, walk down the floor waterfall:
24
+ * const next = await instream.getNextAdTagUrl();
25
+ * if (next) { /* request IMA again with next *\/ }
26
+ *
27
+ * // On the IMA STARTED event, record the Ezoic impression:
28
+ * await instream.reportImpression({ revenueUsd: 0.42 });
29
+ *
30
+ * // When finished with the ad unit:
31
+ * await instream.destroy();
32
+ * ```
33
+ *
34
+ * Mirrors the native `EzoicInstreamAd` load pipeline on both platforms. Unlike
35
+ * the interstitial/rewarded ads, the controller is **multi-use** and NOT
36
+ * auto-destroying: the native controller is prefetchable and reused across
37
+ * loads for the same id, so the same instance can be loaded again after a
38
+ * previous load resolves. Call {@link destroy} when the unit is no longer
39
+ * needed. There is no event emitter — every result settles the returned
40
+ * promise directly from the native listener/delegate.
41
+ */
42
+ export class EzoicInstreamAd {
43
+ /** The Ezoic ad unit identifier this controller was created for. */
44
+
45
+ /**
46
+ * @param adUnitIdentifier the Ezoic ad unit id (numeric). A string is coerced
47
+ * to a number so callers can pass either; a non-numeric string yields `NaN`,
48
+ * which the native side rejects.
49
+ */
50
+ constructor(adUnitIdentifier) {
51
+ this.adUnitIdentifier = Number(adUnitIdentifier);
52
+ }
53
+
54
+ /**
55
+ * Loads the instream config, runs optional Prebid demand, and resolves with
56
+ * the GAM VAST ad-tag URL for the host's IMA player. Rejects on no fill, an
57
+ * uninitialized SDK, or an overlapping load already in flight for this id.
58
+ * Safe to call again after a previous load resolves (multi-use).
59
+ */
60
+ load(options) {
61
+ return NativeEzoicAds.loadInstreamAd(this.adUnitIdentifier, options?.contentUrl ?? null);
62
+ }
63
+
64
+ /**
65
+ * Pops the current head off the floor waterfall and resolves with the ad tag
66
+ * rebuilt against the next `eb_br` hash, or `null` once the waterfall is
67
+ * exhausted (or before a successful {@link load} / after {@link destroy}).
68
+ * Call this on an IMA ad error to try the next floor.
69
+ */
70
+ getNextAdTagUrl() {
71
+ return NativeEzoicAds.getInstreamNextAdTagUrl(this.adUnitIdentifier);
72
+ }
73
+
74
+ /**
75
+ * Fires the Ezoic impression-event pixel for the most recently delivered tag.
76
+ * Call this on the IMA `STARTED` event. No-op natively when no tag has been
77
+ * delivered or after {@link destroy}.
78
+ */
79
+ reportImpression(options) {
80
+ return NativeEzoicAds.reportInstreamImpression(this.adUnitIdentifier, options?.revenueUsd ?? null);
81
+ }
82
+
83
+ /**
84
+ * Cancels any in-flight load and releases the native controller for this id.
85
+ * A load in flight rejects. Safe to call multiple times.
86
+ */
87
+ destroy() {
88
+ return NativeEzoicAds.destroyInstreamAd(this.adUnitIdentifier);
89
+ }
90
+ }
91
+ //# sourceMappingURL=EzoicInstreamAd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeEzoicAds","EzoicInstreamAd","constructor","adUnitIdentifier","Number","load","options","loadInstreamAd","contentUrl","getNextAdTagUrl","getInstreamNextAdTagUrl","reportImpression","reportInstreamImpression","revenueUsd","destroy","destroyInstreamAd"],"sourceRoot":"../../src","sources":["EzoicInstreamAd.ts"],"mappings":";;AAAA,OAAOA,cAAc,MAAM,qBAAkB;;AAE7C;;AAUA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,CAAC;EAC3B;;EAGA;AACF;AACA;AACA;AACA;EACEC,WAAWA,CAACC,gBAAiC,EAAE;IAC7C,IAAI,CAACA,gBAAgB,GAAGC,MAAM,CAACD,gBAAgB,CAAC;EAClD;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEE,IAAIA,CAACC,OAAkC,EAAmB;IACxD,OAAON,cAAc,CAACO,cAAc,CAClC,IAAI,CAACJ,gBAAgB,EACrBG,OAAO,EAAEE,UAAU,IAAI,IACzB,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEC,eAAeA,CAAA,EAA2B;IACxC,OAAOT,cAAc,CAACU,uBAAuB,CAAC,IAAI,CAACP,gBAAgB,CAAC;EACtE;;EAEA;AACF;AACA;AACA;AACA;EACEQ,gBAAgBA,CAACL,OAAwC,EAAiB;IACxE,OAAON,cAAc,CAACY,wBAAwB,CAC5C,IAAI,CAACT,gBAAgB,EACrBG,OAAO,EAAEO,UAAU,IAAI,IACzB,CAAC;EACH;;EAEA;AACF;AACA;AACA;EACEC,OAAOA,CAAA,EAAkB;IACvB,OAAOd,cAAc,CAACe,iBAAiB,CAAC,IAAI,CAACZ,gBAAgB,CAAC;EAChE;AACF","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ import { codegenNativeComponent } from 'react-native';
2
+ import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
3
+
4
+ type LoadEvent = Readonly<{}>;
5
+ type ErrorEvent = Readonly<{ message: string; code: CodegenTypes.Int32 }>;
6
+
7
+ export interface NativeProps extends ViewProps {
8
+ adUnitIdentifier: string;
9
+ onLoad?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
10
+ onError?: CodegenTypes.BubblingEventHandler<ErrorEvent> | null;
11
+ onImpression?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
12
+ // `onClick` is reserved by core ViewProps (a gesture handler), so the native
13
+ // native-ad-click event is exposed as `onAdClick`. The public
14
+ // `EzoicNativeAdView` component maps the user-facing `onClick` prop onto this.
15
+ onAdClick?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
16
+ onOpen?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
17
+ onClose?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
18
+ }
19
+
20
+ export default codegenNativeComponent<NativeProps>(
21
+ 'EzoicNativeAdView'
22
+ ) as HostComponent<NativeProps>;
@@ -0,0 +1,23 @@
1
+ import { codegenNativeComponent } from 'react-native';
2
+ import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
3
+
4
+ type LoadEvent = Readonly<{}>;
5
+ type ErrorEvent = Readonly<{ message: string; code: CodegenTypes.Int32 }>;
6
+
7
+ export interface NativeProps extends ViewProps {
8
+ adUnitIdentifier: string;
9
+ onLoad?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
10
+ onError?: CodegenTypes.BubblingEventHandler<ErrorEvent> | null;
11
+ onImpression?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
12
+ // `onClick` is reserved by core ViewProps (a gesture handler), so the native
13
+ // outstream-click event is exposed as `onAdClick`. The public
14
+ // `EzoicOutstreamAdView` component maps the user-facing `onClick` prop onto
15
+ // this.
16
+ onAdClick?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
17
+ onOpen?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
18
+ onClose?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
19
+ }
20
+
21
+ export default codegenNativeComponent<NativeProps>(
22
+ 'EzoicOutstreamAdView'
23
+ ) as HostComponent<NativeProps>;
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeEzoicAds.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;;AAWlD;AACA;AACA;AACA;AACA;AACA;;AAsBA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,qBAAqB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeEzoicAds.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;;AAWlD;AACA;AACA;AACA;AACA;AACA;;AAwCA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,qBAAqB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["normalizeConfig","config","domain","Error","out","autoReadConsent","undefined","subjectToCOPPA","requestATTBeforeAds","debugEnabled","testMode","normalizeSize","size","split","map","s","trim","filter","length","join","coerceAdUnitId","adUnitIdentifier","String","mapRewardResult","result","earned","type","amount"],"sourceRoot":"../../src","sources":["helpers.ts"],"mappings":";;AAEA,OAAO,SAASA,eAAeA,CAACC,MAAmB,EAAe;EAChE,IAAI,CAACA,MAAM,IAAI,CAACA,MAAM,CAACC,MAAM,EAAE;IAC7B,MAAM,IAAIC,KAAK,CAAC,oDAAoD,CAAC;EACvE;EACA,MAAMC,GAAgB,GAAG;IAAEF,MAAM,EAAED,MAAM,CAACC;EAAO,CAAC;EAClD,IAAID,MAAM,CAACI,eAAe,KAAKC,SAAS,EACtCF,GAAG,CAACC,eAAe,GAAGJ,MAAM,CAACI,eAAe;EAC9C,IAAIJ,MAAM,CAACM,cAAc,KAAKD,SAAS,EACrCF,GAAG,CAACG,cAAc,GAAGN,MAAM,CAACM,cAAc;EAC5C,IAAIN,MAAM,CAACO,mBAAmB,KAAKF,SAAS,EAC1CF,GAAG,CAACI,mBAAmB,GAAGP,MAAM,CAACO,mBAAmB;EACtD,IAAIP,MAAM,CAACQ,YAAY,KAAKH,SAAS,EAAEF,GAAG,CAACK,YAAY,GAAGR,MAAM,CAACQ,YAAY;EAC7E,IAAIR,MAAM,CAACS,QAAQ,KAAKJ,SAAS,EAAEF,GAAG,CAACM,QAAQ,GAAGT,MAAM,CAACS,QAAQ;EACjE,OAAON,GAAG;AACZ;AAEA,OAAO,SAASO,aAAaA,CAACC,IAAwB,EAAU;EAC9D,IAAI,CAACA,IAAI,EAAE,OAAO,EAAE;EACpB,OAAOA,IAAI,CACRC,KAAK,CAAC,GAAG,CAAC,CACVC,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC,CACpBC,MAAM,CAAEF,CAAC,IAAKA,CAAC,CAACG,MAAM,GAAG,CAAC,CAAC,CAC3BC,IAAI,CAAC,GAAG,CAAC;AACd;AAEA,OAAO,SAASC,cAAcA,CAACC,gBAAwB,EAAU;EAC/D,OAAOC,MAAM,CAACD,gBAAgB,CAAC;AACjC;AAQA;AACA;AACA;AACA;AACA,OAAO,SAASE,eAAeA,CAC7BC,MAA2C,EACF;EACzC,IAAIA,MAAM,IAAIA,MAAM,CAACC,MAAM,EAAE;IAC3B,OAAO;MAAEC,IAAI,EAAEF,MAAM,CAACE,IAAI;MAAEC,MAAM,EAAEH,MAAM,CAACG;IAAO,CAAC;EACrD;EACA,OAAO,IAAI;AACb","ignoreList":[]}
1
+ {"version":3,"names":["normalizeConfig","config","domain","Error","out","autoReadConsent","undefined","subjectToCOPPA","requestATTBeforeAds","debugEnabled","testMode","normalizeSize","size","split","map","s","trim","filter","length","join","coerceAdUnitId","adUnitIdentifier","String","mapRewardResult","result","earned","type","amount"],"sourceRoot":"../../src","sources":["helpers.ts"],"mappings":";;AAEA,OAAO,SAASA,eAAeA,CAACC,MAAmB,EAAe;EAChE,IAAI,CAACA,MAAM,IAAI,CAACA,MAAM,CAACC,MAAM,EAAE;IAC7B,MAAM,IAAIC,KAAK,CAAC,oDAAoD,CAAC;EACvE;EACA,MAAMC,GAAgB,GAAG;IAAEF,MAAM,EAAED,MAAM,CAACC;EAAO,CAAC;EAClD,IAAID,MAAM,CAACI,eAAe,KAAKC,SAAS,EACtCF,GAAG,CAACC,eAAe,GAAGJ,MAAM,CAACI,eAAe;EAC9C,IAAIJ,MAAM,CAACM,cAAc,KAAKD,SAAS,EACrCF,GAAG,CAACG,cAAc,GAAGN,MAAM,CAACM,cAAc;EAC5C,IAAIN,MAAM,CAACO,mBAAmB,KAAKF,SAAS,EAC1CF,GAAG,CAACI,mBAAmB,GAAGP,MAAM,CAACO,mBAAmB;EACtD,IAAIP,MAAM,CAACQ,YAAY,KAAKH,SAAS,EAAEF,GAAG,CAACK,YAAY,GAAGR,MAAM,CAACQ,YAAY;EAC7E,IAAIR,MAAM,CAACS,QAAQ,KAAKJ,SAAS,EAAEF,GAAG,CAACM,QAAQ,GAAGT,MAAM,CAACS,QAAQ;EACjE,OAAON,GAAG;AACZ;AAEA,OAAO,SAASO,aAAaA,CAACC,IAAwB,EAAU;EAC9D,IAAI,CAACA,IAAI,EAAE,OAAO,EAAE;EACpB,OAAOA,IAAI,CACRC,KAAK,CAAC,GAAG,CAAC,CACVC,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC,CACpBC,MAAM,CAAEF,CAAC,IAAKA,CAAC,CAACG,MAAM,GAAG,CAAC,CAAC,CAC3BC,IAAI,CAAC,GAAG,CAAC;AACd;AAEA,OAAO,SAASC,cAAcA,CAACC,gBAAiC,EAAU;EACxE,OAAOC,MAAM,CAACD,gBAAgB,CAAC;AACjC;AAQA;AACA;AACA;AACA;AACA,OAAO,SAASE,eAAeA,CAC7BC,MAA2C,EACF;EACzC,IAAIA,MAAM,IAAIA,MAAM,CAACC,MAAM,EAAE;IAC3B,OAAO;MAAEC,IAAI,EAAEF,MAAM,CAACE,IAAI;MAAEC,MAAM,EAAEH,MAAM,CAACG;IAAO,CAAC;EACrD;EACA,OAAO,IAAI;AACb","ignoreList":[]}
@@ -2,10 +2,13 @@
2
2
 
3
3
  import NativeEzoicAds from "./NativeEzoicAds.js";
4
4
  import EzoicBannerNative from './EzoicBannerViewNativeComponent';
5
+ import EzoicNativeAdNative from './EzoicNativeAdViewNativeComponent';
6
+ import EzoicOutstreamNative from './EzoicOutstreamAdViewNativeComponent';
5
7
  import { coerceAdUnitId, normalizeConfig, normalizeSize } from "./helpers.js";
6
8
  import { jsx as _jsx } from "react/jsx-runtime";
7
9
  export { EzoicRewardedAd } from "./EzoicRewardedAd.js";
8
10
  export { EzoicInterstitialAd } from "./EzoicInterstitialAd.js";
11
+ export { EzoicInstreamAd } from "./EzoicInstreamAd.js";
9
12
  export const EzoicAds = {
10
13
  initialize(config) {
11
14
  return NativeEzoicAds.initialize(normalizeConfig(config));
@@ -47,4 +50,59 @@ export function EzoicBannerView(props) {
47
50
  onClose: onClose ? () => onClose() : undefined
48
51
  });
49
52
  }
53
+ /**
54
+ * Renders a native ad in an SDK-built template `NativeAdView`. The component
55
+ * fills the bounds it is given by its RN style, so size it with `style` (e.g.
56
+ * `{ width: '100%', height: 300 }`); the template lays out its assets inside.
57
+ */
58
+ export function EzoicNativeAdView(props) {
59
+ const {
60
+ adUnitIdentifier,
61
+ onLoad,
62
+ onError,
63
+ onImpression,
64
+ onClick,
65
+ onOpen,
66
+ onClose,
67
+ ...rest
68
+ } = props;
69
+ return /*#__PURE__*/_jsx(EzoicNativeAdNative, {
70
+ ...rest,
71
+ adUnitIdentifier: coerceAdUnitId(adUnitIdentifier),
72
+ onLoad: onLoad ? () => onLoad() : undefined,
73
+ onError: onError ? e => onError(e.nativeEvent) : undefined,
74
+ onImpression: onImpression ? () => onImpression() : undefined,
75
+ onAdClick: onClick ? () => onClick() : undefined,
76
+ onOpen: onOpen ? () => onOpen() : undefined,
77
+ onClose: onClose ? () => onClose() : undefined
78
+ });
79
+ }
80
+ /**
81
+ * Renders an outstream video ad in an SDK-built player. Outstream video runs on
82
+ * its own (not inside host video content), so the SDK owns the player and this
83
+ * component only needs a size. Fills the bounds it is given by its RN style, so
84
+ * size it with `style` (e.g. `{ width: '100%', height: 200 }`).
85
+ */
86
+ export function EzoicOutstreamAdView(props) {
87
+ const {
88
+ adUnitIdentifier,
89
+ onLoad,
90
+ onError,
91
+ onImpression,
92
+ onClick,
93
+ onOpen,
94
+ onClose,
95
+ ...rest
96
+ } = props;
97
+ return /*#__PURE__*/_jsx(EzoicOutstreamNative, {
98
+ ...rest,
99
+ adUnitIdentifier: coerceAdUnitId(adUnitIdentifier),
100
+ onLoad: onLoad ? () => onLoad() : undefined,
101
+ onError: onError ? e => onError(e.nativeEvent) : undefined,
102
+ onImpression: onImpression ? () => onImpression() : undefined,
103
+ onAdClick: onClick ? () => onClick() : undefined,
104
+ onOpen: onOpen ? () => onOpen() : undefined,
105
+ onClose: onClose ? () => onClose() : undefined
106
+ });
107
+ }
50
108
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NativeEzoicAds","EzoicBannerNative","coerceAdUnitId","normalizeConfig","normalizeSize","jsx","_jsx","EzoicRewardedAd","EzoicInterstitialAd","EzoicAds","initialize","config","setGDPRConsent","applies","consentString","setGPPConsent","gppString","sectionIds","setSubjectToCOPPA","value","trackPageview","EzoicBannerView","props","adUnitIdentifier","size","onLoad","onError","onImpression","onClick","onOpen","onClose","rest","undefined","e","nativeEvent","onAdClick"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AACA,OAAOA,cAAc,MAA4B,qBAAkB;AACnE,OAAOC,iBAAiB,MAAM,kCAAkC;AAChE,SAASC,cAAc,EAAEC,eAAe,EAAEC,aAAa,QAAQ,cAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG3E,SACEC,eAAe,QAGV,sBAAmB;AAC1B,SACEC,mBAAmB,QAEd,0BAAuB;AAE9B,OAAO,MAAMC,QAAQ,GAAG;EACtBC,UAAUA,CAACC,MAAmB,EAAiB;IAC7C,OAAOX,cAAc,CAACU,UAAU,CAACP,eAAe,CAACQ,MAAM,CAAC,CAAC;EAC3D,CAAC;EACDC,cAAcA,CAACC,OAAgB,EAAEC,aAAsB,EAAQ;IAC7Dd,cAAc,CAACY,cAAc,CAACC,OAAO,EAAEC,aAAa,CAAC;EACvD,CAAC;EACDC,aAAaA,CAACC,SAAkB,EAAEC,UAAmB,EAAQ;IAC3DjB,cAAc,CAACe,aAAa,CAACC,SAAS,EAAEC,UAAU,CAAC;EACrD,CAAC;EACDC,iBAAiBA,CAACC,KAAc,EAAQ;IACtCnB,cAAc,CAACkB,iBAAiB,CAACC,KAAK,CAAC;EACzC,CAAC;EACDC,aAAaA,CAAA,EAAqB;IAChC,OAAOpB,cAAc,CAACoB,aAAa,CAAC,CAAC;EACvC;AACF,CAAC;AAmBD,OAAO,SAASC,eAAeA,CAACC,KAA2B,EAAE;EAC3D,MAAM;IACJC,gBAAgB;IAChBC,IAAI;IACJC,MAAM;IACNC,OAAO;IACPC,YAAY;IACZC,OAAO;IACPC,MAAM;IACNC,OAAO;IACP,GAAGC;EACL,CAAC,GAAGT,KAAK;EACT,oBACEhB,IAAA,CAACL,iBAAiB;IAAA,GACZ8B,IAAI;IACRR,gBAAgB,EAAErB,cAAc,CAACqB,gBAAgB,CAAE;IACnDC,IAAI,EAAEpB,aAAa,CAACoB,IAAI,CAAE;IAC1BC,MAAM,EAAEA,MAAM,GAAG,MAAMA,MAAM,CAAC,CAAC,GAAGO,SAAU;IAC5CN,OAAO,EAAEA,OAAO,GAAIO,CAAC,IAAKP,OAAO,CAACO,CAAC,CAACC,WAAW,CAAC,GAAGF,SAAU;IAC7DL,YAAY,EAAEA,YAAY,GAAG,MAAMA,YAAY,CAAC,CAAC,GAAGK,SAAU;IAC9DG,SAAS,EAAEP,OAAO,GAAG,MAAMA,OAAO,CAAC,CAAC,GAAGI,SAAU;IACjDH,MAAM,EAAEA,MAAM,GAAG,MAAMA,MAAM,CAAC,CAAC,GAAGG,SAAU;IAC5CF,OAAO,EAAEA,OAAO,GAAG,MAAMA,OAAO,CAAC,CAAC,GAAGE;EAAU,CAChD,CAAC;AAEN","ignoreList":[]}
1
+ {"version":3,"names":["NativeEzoicAds","EzoicBannerNative","EzoicNativeAdNative","EzoicOutstreamNative","coerceAdUnitId","normalizeConfig","normalizeSize","jsx","_jsx","EzoicRewardedAd","EzoicInterstitialAd","EzoicInstreamAd","EzoicAds","initialize","config","setGDPRConsent","applies","consentString","setGPPConsent","gppString","sectionIds","setSubjectToCOPPA","value","trackPageview","EzoicBannerView","props","adUnitIdentifier","size","onLoad","onError","onImpression","onClick","onOpen","onClose","rest","undefined","e","nativeEvent","onAdClick","EzoicNativeAdView","EzoicOutstreamAdView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"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","ignoreList":[]}
@@ -0,0 +1,86 @@
1
+ /** Options for {@link EzoicInstreamAd.load}. */
2
+ export interface EzoicInstreamLoadOptions {
3
+ /**
4
+ * The URL of the video the host is currently playing. When supplied it is
5
+ * added to the VAST ad tag as `url`/`description_url` for contextual
6
+ * targeting. Omit it when the content URL is unknown.
7
+ */
8
+ contentUrl?: string;
9
+ }
10
+ /** Options for {@link EzoicInstreamAd.reportImpression}. */
11
+ export interface EzoicInstreamImpressionOptions {
12
+ /**
13
+ * The publisher-reported revenue (USD) for this impression, if known. Folded
14
+ * into the Ezoic impression-event pixel. Omit it when no revenue is known.
15
+ */
16
+ revenueUsd?: number;
17
+ }
18
+ /**
19
+ * An instream video ad controller. Instream video runs inside the host app's
20
+ * OWN video content: **the host owns the video player and the Google IMA SDK**.
21
+ * Unlike the banner/native/outstream views, this controller renders nothing and
22
+ * holds no view — its sole deliverable is a GAM VAST ad-tag URL string the host
23
+ * feeds to its own IMA `AdsRequest`.
24
+ *
25
+ * Usage:
26
+ *
27
+ * ```ts
28
+ * const instream = new EzoicInstreamAd('12345');
29
+ * const tagUrl = await instream.load({ contentUrl: playingVideoUrl });
30
+ * // hand tagUrl to your IMA AdsLoader / AdsRequest.
31
+ *
32
+ * // On an IMA ad error, walk down the floor waterfall:
33
+ * const next = await instream.getNextAdTagUrl();
34
+ * if (next) { /* request IMA again with next *\/ }
35
+ *
36
+ * // On the IMA STARTED event, record the Ezoic impression:
37
+ * await instream.reportImpression({ revenueUsd: 0.42 });
38
+ *
39
+ * // When finished with the ad unit:
40
+ * await instream.destroy();
41
+ * ```
42
+ *
43
+ * Mirrors the native `EzoicInstreamAd` load pipeline on both platforms. Unlike
44
+ * the interstitial/rewarded ads, the controller is **multi-use** and NOT
45
+ * auto-destroying: the native controller is prefetchable and reused across
46
+ * loads for the same id, so the same instance can be loaded again after a
47
+ * previous load resolves. Call {@link destroy} when the unit is no longer
48
+ * needed. There is no event emitter — every result settles the returned
49
+ * promise directly from the native listener/delegate.
50
+ */
51
+ export declare class EzoicInstreamAd {
52
+ /** The Ezoic ad unit identifier this controller was created for. */
53
+ readonly adUnitIdentifier: number;
54
+ /**
55
+ * @param adUnitIdentifier the Ezoic ad unit id (numeric). A string is coerced
56
+ * to a number so callers can pass either; a non-numeric string yields `NaN`,
57
+ * which the native side rejects.
58
+ */
59
+ constructor(adUnitIdentifier: string | number);
60
+ /**
61
+ * Loads the instream config, runs optional Prebid demand, and resolves with
62
+ * the GAM VAST ad-tag URL for the host's IMA player. Rejects on no fill, an
63
+ * uninitialized SDK, or an overlapping load already in flight for this id.
64
+ * Safe to call again after a previous load resolves (multi-use).
65
+ */
66
+ load(options?: EzoicInstreamLoadOptions): Promise<string>;
67
+ /**
68
+ * Pops the current head off the floor waterfall and resolves with the ad tag
69
+ * rebuilt against the next `eb_br` hash, or `null` once the waterfall is
70
+ * exhausted (or before a successful {@link load} / after {@link destroy}).
71
+ * Call this on an IMA ad error to try the next floor.
72
+ */
73
+ getNextAdTagUrl(): Promise<string | null>;
74
+ /**
75
+ * Fires the Ezoic impression-event pixel for the most recently delivered tag.
76
+ * Call this on the IMA `STARTED` event. No-op natively when no tag has been
77
+ * delivered or after {@link destroy}.
78
+ */
79
+ reportImpression(options?: EzoicInstreamImpressionOptions): Promise<void>;
80
+ /**
81
+ * Cancels any in-flight load and releases the native controller for this id.
82
+ * A load in flight rejects. Safe to call multiple times.
83
+ */
84
+ destroy(): Promise<void>;
85
+ }
86
+ //# sourceMappingURL=EzoicInstreamAd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EzoicInstreamAd.d.ts","sourceRoot":"","sources":["../../../src/EzoicInstreamAd.ts"],"names":[],"mappings":"AAEA,gDAAgD;AAChD,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,4DAA4D;AAC5D,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAAa,eAAe;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAElC;;;;OAIG;gBACS,gBAAgB,EAAE,MAAM,GAAG,MAAM;IAI7C;;;;;OAKG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC;IAOzD;;;;;OAKG;IACH,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIzC;;;;OAIG;IACH,gBAAgB,CAAC,OAAO,CAAC,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC;IAOzE;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAGzB"}
@@ -0,0 +1,18 @@
1
+ import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
2
+ type LoadEvent = Readonly<{}>;
3
+ type ErrorEvent = Readonly<{
4
+ message: string;
5
+ code: CodegenTypes.Int32;
6
+ }>;
7
+ export interface NativeProps extends ViewProps {
8
+ adUnitIdentifier: string;
9
+ onLoad?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
10
+ onError?: CodegenTypes.BubblingEventHandler<ErrorEvent> | null;
11
+ onImpression?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
12
+ onAdClick?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
13
+ onOpen?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
14
+ onClose?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
15
+ }
16
+ declare const _default: HostComponent<NativeProps>;
17
+ export default _default;
18
+ //# sourceMappingURL=EzoicNativeAdViewNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EzoicNativeAdViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/EzoicNativeAdViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE3E,KAAK,SAAS,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC9B,KAAK,UAAU,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAA;CAAE,CAAC,CAAC;AAE1E,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IAC/D,YAAY,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAInE,SAAS,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAChE,MAAM,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;CAC/D;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
@@ -0,0 +1,18 @@
1
+ import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
2
+ type LoadEvent = Readonly<{}>;
3
+ type ErrorEvent = Readonly<{
4
+ message: string;
5
+ code: CodegenTypes.Int32;
6
+ }>;
7
+ export interface NativeProps extends ViewProps {
8
+ adUnitIdentifier: string;
9
+ onLoad?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
10
+ onError?: CodegenTypes.BubblingEventHandler<ErrorEvent> | null;
11
+ onImpression?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
12
+ onAdClick?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
13
+ onOpen?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
14
+ onClose?: CodegenTypes.BubblingEventHandler<LoadEvent> | null;
15
+ }
16
+ declare const _default: HostComponent<NativeProps>;
17
+ export default _default;
18
+ //# sourceMappingURL=EzoicOutstreamAdViewNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EzoicOutstreamAdViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/EzoicOutstreamAdViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE3E,KAAK,SAAS,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC9B,KAAK,UAAU,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAA;CAAE,CAAC,CAAC;AAE1E,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IAC/D,YAAY,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAKnE,SAAS,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAChE,MAAM,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;CAC/D;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
@@ -28,6 +28,10 @@ export interface Spec extends TurboModule {
28
28
  showRewardedAd(adUnitIdentifier: string): Promise<EzoicRewardResult>;
29
29
  loadInterstitialAd(adUnitIdentifier: string): Promise<void>;
30
30
  showInterstitialAd(adUnitIdentifier: string): Promise<void>;
31
+ loadInstreamAd(adUnitIdentifier: number, contentUrl: string | null): Promise<string>;
32
+ getInstreamNextAdTagUrl(adUnitIdentifier: number): Promise<string | null>;
33
+ reportInstreamImpression(adUnitIdentifier: number, revenueUsd: number | null): Promise<void>;
34
+ destroyInstreamAd(adUnitIdentifier: number): Promise<void>;
31
35
  addListener(eventName: string): void;
32
36
  removeListeners(count: number): void;
33
37
  }