setupad-prebid-react-native 0.1.6 → 0.1.8

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.
package/app.plugin.js CHANGED
@@ -5,10 +5,40 @@ const path = require('path');
5
5
  /**
6
6
  * Expo config plugin for setupad-prebid-react-native
7
7
  *
8
- * Automatically configures the consumer's iOS Podfile with:
8
+ * Automatically configures the consumer's iOS project with:
9
+ * - use_frameworks! :linkage => :static (via Podfile.properties.json)
9
10
  * - Explicit VeonPrebid pod dependencies
10
11
  * - post_install hooks for DEFINES_MODULE and Swift module resolution
11
12
  */
13
+
14
+ /**
15
+ * Ensures ios.useFrameworks is set to "static" in Podfile.properties.json.
16
+ * This is required for VeonPrebidMobile Swift module resolution.
17
+ */
18
+ function withUseFrameworks(config) {
19
+ return withDangerousMod(config, [
20
+ 'ios',
21
+ async (cfg) => {
22
+ const propsPath = path.join(
23
+ cfg.modRequest.platformProjectRoot,
24
+ 'Podfile.properties.json'
25
+ );
26
+
27
+ let props = {};
28
+ if (fs.existsSync(propsPath)) {
29
+ props = JSON.parse(fs.readFileSync(propsPath, 'utf8'));
30
+ }
31
+
32
+ if (props['ios.useFrameworks'] !== 'static') {
33
+ props['ios.useFrameworks'] = 'static';
34
+ fs.writeFileSync(propsPath, JSON.stringify(props, null, 2) + '\n');
35
+ }
36
+
37
+ return cfg;
38
+ },
39
+ ]);
40
+ }
41
+
12
42
  function withVeonPrebidIOS(config) {
13
43
  return withDangerousMod(config, [
14
44
  'ios',
@@ -58,5 +88,5 @@ function withVeonPrebidIOS(config) {
58
88
  }
59
89
 
60
90
  module.exports = function withVeonPrebid(config) {
61
- return withPlugins(config, [withVeonPrebidIOS]);
62
- };
91
+ return withPlugins(config, [withUseFrameworks, withVeonPrebidIOS]);
92
+ };
@@ -77,6 +77,33 @@ using namespace facebook::react;
77
77
  [super updateProps:props oldProps:oldProps];
78
78
  }
79
79
 
80
+ - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
81
+ {
82
+ NSLog(@"VeonPrebid iOS: handleCommand: %@", commandName);
83
+
84
+ if ([commandName isEqualToString:@"loadBanner"]) {
85
+ [_view performSelector:@selector(loadBanner)];
86
+ } else if ([commandName isEqualToString:@"showBanner"]) {
87
+ [_view performSelector:@selector(showBanner)];
88
+ } else if ([commandName isEqualToString:@"hideBanner"]) {
89
+ [_view performSelector:@selector(hideBanner)];
90
+ } else if ([commandName isEqualToString:@"loadInterstitial"]) {
91
+ [_view performSelector:@selector(loadInterstitial)];
92
+ } else if ([commandName isEqualToString:@"showInterstitial"]) {
93
+ [_view performSelector:@selector(showInterstitial)];
94
+ } else if ([commandName isEqualToString:@"hideInterstitial"]) {
95
+ [_view performSelector:@selector(hideInterstitial)];
96
+ } else if ([commandName isEqualToString:@"pauseAuction"]) {
97
+ [_view performSelector:@selector(pauseAuction)];
98
+ } else if ([commandName isEqualToString:@"resumeAuction"]) {
99
+ [_view performSelector:@selector(resumeAuction)];
100
+ } else if ([commandName isEqualToString:@"destroyAuction"]) {
101
+ [_view performSelector:@selector(destroyAuction)];
102
+ } else {
103
+ [super handleCommand:commandName args:args];
104
+ }
105
+ }
106
+
80
107
  - (void)updateEventEmitter:(EventEmitter::Shared const &)eventEmitter
81
108
  {
82
109
  [super updateEventEmitter:eventEmitter];
@@ -91,6 +118,8 @@ using namespace facebook::react;
91
118
  if (event[@"adId"]) data.adId = std::string([event[@"adId"] UTF8String]);
92
119
  if (event[@"sdk"]) data.sdk = std::string([event[@"sdk"] UTF8String]);
93
120
  if (event[@"message"]) data.message = std::string([event[@"message"] UTF8String]);
121
+ if (event[@"error"]) data.error = std::string([event[@"error"] UTF8String]);
122
+ if (event[@"sdkType"]) data.sdkType = std::string([event[@"sdkType"] UTF8String]);
94
123
  emitter->onAdLoaded(data);
95
124
  }
96
125
  };
@@ -104,6 +133,8 @@ using namespace facebook::react;
104
133
  if (event[@"adId"]) data.adId = std::string([event[@"adId"] UTF8String]);
105
134
  if (event[@"sdk"]) data.sdk = std::string([event[@"sdk"] UTF8String]);
106
135
  if (event[@"message"]) data.message = std::string([event[@"message"] UTF8String]);
136
+ if (event[@"error"]) data.error = std::string([event[@"error"] UTF8String]);
137
+ if (event[@"sdkType"]) data.sdkType = std::string([event[@"sdkType"] UTF8String]);
107
138
  emitter->onAdDisplayed(data);
108
139
  }
109
140
  };
@@ -117,6 +148,8 @@ using namespace facebook::react;
117
148
  if (event[@"adId"]) data.adId = std::string([event[@"adId"] UTF8String]);
118
149
  if (event[@"sdk"]) data.sdk = std::string([event[@"sdk"] UTF8String]);
119
150
  if (event[@"message"]) data.message = std::string([event[@"message"] UTF8String]);
151
+ if (event[@"error"]) data.error = std::string([event[@"error"] UTF8String]);
152
+ if (event[@"sdkType"]) data.sdkType = std::string([event[@"sdkType"] UTF8String]);
120
153
  emitter->onAdFailed(data);
121
154
  }
122
155
  };
@@ -130,6 +163,8 @@ using namespace facebook::react;
130
163
  if (event[@"adId"]) data.adId = std::string([event[@"adId"] UTF8String]);
131
164
  if (event[@"sdk"]) data.sdk = std::string([event[@"sdk"] UTF8String]);
132
165
  if (event[@"message"]) data.message = std::string([event[@"message"] UTF8String]);
166
+ if (event[@"error"]) data.error = std::string([event[@"error"] UTF8String]);
167
+ if (event[@"sdkType"]) data.sdkType = std::string([event[@"sdkType"] UTF8String]);
133
168
  emitter->onAdClicked(data);
134
169
  }
135
170
  };
@@ -143,6 +178,8 @@ using namespace facebook::react;
143
178
  if (event[@"adId"]) data.adId = std::string([event[@"adId"] UTF8String]);
144
179
  if (event[@"sdk"]) data.sdk = std::string([event[@"sdk"] UTF8String]);
145
180
  if (event[@"message"]) data.message = std::string([event[@"message"] UTF8String]);
181
+ if (event[@"error"]) data.error = std::string([event[@"error"] UTF8String]);
182
+ if (event[@"sdkType"]) data.sdkType = std::string([event[@"sdkType"] UTF8String]);
146
183
  emitter->onAdClosed(data);
147
184
  }
148
185
  };
@@ -1,21 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  import { useRef, useImperativeHandle, forwardRef, useCallback } from 'react';
4
- import { UIManager, findNodeHandle, StyleSheet, View } from 'react-native';
5
- import VeonPrebidReactNativeView from './VeonPrebidReactNativeViewNativeComponent';
4
+ import { StyleSheet, View } from 'react-native';
5
+ import VeonPrebidReactNativeView, { Commands } from './VeonPrebidReactNativeViewNativeComponent';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
- // Command IDs - must match ViewManager (starts from 0 in iOS Old Architecture!)
8
- const Commands = {
9
- loadBanner: 0,
10
- showBanner: 1,
11
- hideBanner: 2,
12
- loadInterstitial: 3,
13
- showInterstitial: 4,
14
- hideInterstitial: 5,
15
- pauseAuction: 6,
16
- resumeAuction: 7,
17
- destroyAuction: 8
18
- };
19
7
  const VeonPrebidAd = /*#__PURE__*/forwardRef((props, ref) => {
20
8
  const {
21
9
  adType,
@@ -32,26 +20,35 @@ const VeonPrebidAd = /*#__PURE__*/forwardRef((props, ref) => {
32
20
  style
33
21
  } = props;
34
22
  const viewRef = useRef(null);
35
- const executeCommand = useCallback((commandName, commandId) => {
36
- const node = findNodeHandle(viewRef.current);
37
- if (!node) {
38
- console.warn(`Cannot execute ${commandName} - view not mounted`);
39
- return;
40
- }
41
- console.log(`Executing ${commandName} (ID: ${commandId}) on node: ${node}`);
42
- UIManager.dispatchViewManagerCommand(node, commandId, []);
43
- }, []);
44
23
  useImperativeHandle(ref, () => ({
45
- loadBanner: () => executeCommand('loadBanner', Commands.loadBanner),
46
- showBanner: () => executeCommand('showBanner', Commands.showBanner),
47
- hideBanner: () => executeCommand('hideBanner', Commands.hideBanner),
48
- loadInterstitial: () => executeCommand('loadInterstitial', Commands.loadInterstitial),
49
- showInterstitial: () => executeCommand('showInterstitial', Commands.showInterstitial),
50
- hideInterstitial: () => executeCommand('hideInterstitial', Commands.hideInterstitial),
51
- pauseAuction: () => executeCommand('pauseAuction', Commands.pauseAuction),
52
- resumeAuction: () => executeCommand('resumeAuction', Commands.resumeAuction),
53
- destroyAuction: () => executeCommand('destroyAuction', Commands.destroyAuction)
54
- }), [executeCommand]);
24
+ loadBanner: () => {
25
+ if (viewRef.current) Commands.loadBanner(viewRef.current);
26
+ },
27
+ showBanner: () => {
28
+ if (viewRef.current) Commands.showBanner(viewRef.current);
29
+ },
30
+ hideBanner: () => {
31
+ if (viewRef.current) Commands.hideBanner(viewRef.current);
32
+ },
33
+ loadInterstitial: () => {
34
+ if (viewRef.current) Commands.loadInterstitial(viewRef.current);
35
+ },
36
+ showInterstitial: () => {
37
+ if (viewRef.current) Commands.showInterstitial(viewRef.current);
38
+ },
39
+ hideInterstitial: () => {
40
+ if (viewRef.current) Commands.hideInterstitial(viewRef.current);
41
+ },
42
+ pauseAuction: () => {
43
+ if (viewRef.current) Commands.pauseAuction(viewRef.current);
44
+ },
45
+ resumeAuction: () => {
46
+ if (viewRef.current) Commands.resumeAuction(viewRef.current);
47
+ },
48
+ destroyAuction: () => {
49
+ if (viewRef.current) Commands.destroyAuction(viewRef.current);
50
+ }
51
+ }), []);
55
52
  const handleAdLoaded = useCallback(event => {
56
53
  const data = event.nativeEvent;
57
54
  console.log('Ad loaded:', data);
@@ -1 +1 @@
1
- {"version":3,"names":["useRef","useImperativeHandle","forwardRef","useCallback","UIManager","findNodeHandle","StyleSheet","View","VeonPrebidReactNativeView","jsx","_jsx","Commands","loadBanner","showBanner","hideBanner","loadInterstitial","showInterstitial","hideInterstitial","pauseAuction","resumeAuction","destroyAuction","VeonPrebidAd","props","ref","adType","configId","adUnitId","width","height","refreshInterval","onAdLoaded","onAdDisplayed","onAdFailed","onAdClicked","onAdClosed","style","viewRef","executeCommand","commandName","commandId","node","current","console","warn","log","dispatchViewManagerCommand","handleAdLoaded","event","data","nativeEvent","handleAdDisplayed","handleAdFailed","error","sdkType","handleAdClicked","handleAdClosed","containerStyle","overflow","children","absoluteFill","displayName"],"sourceRoot":"../../src","sources":["VeonPrebidAd.tsx"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,mBAAmB,EAAEC,UAAU,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B,UAAU,CAACqD,YAAa;MAC/BnC,MAAM,EAAEA,MAAO;MACfC,QAAQ,EAAEA,QAAS;MACnBC,QAAQ,EAAEA,QAAS;MACnBC,KAAK,EAAEA,KAAgB;MACvBC,MAAM,EAAEA,MAAiB;MACzBC,eAAe,EAAEA,eAA0B;MAC3CC,UAAU,EAAEgB,cAAe;MAC3Bf,aAAa,EAAEmB,iBAAkB;MACjClB,UAAU,EAAEmB,cAAe;MAC3BlB,WAAW,EAAEqB,eAAgB;MAC7BpB,UAAU,EAAEqB;IAAe,CAC5B;EAAC,CACE,CAAC;AAEX,CACF,CAAC;AAEDlC,YAAY,CAACuC,WAAW,GAAG,cAAc;AAEzC,eAAevC,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["useRef","useImperativeHandle","forwardRef","useCallback","StyleSheet","View","VeonPrebidReactNativeView","Commands","jsx","_jsx","VeonPrebidAd","props","ref","adType","configId","adUnitId","width","height","refreshInterval","onAdLoaded","onAdDisplayed","onAdFailed","onAdClicked","onAdClosed","style","viewRef","loadBanner","current","showBanner","hideBanner","loadInterstitial","showInterstitial","hideInterstitial","pauseAuction","resumeAuction","destroyAuction","handleAdLoaded","event","data","nativeEvent","console","log","handleAdDisplayed","handleAdFailed","error","sdkType","handleAdClicked","handleAdClosed","containerStyle","overflow","children","absoluteFill","displayName"],"sourceRoot":"../../src","sources":["VeonPrebidAd.tsx"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,mBAAmB,EAAEC,UAAU,EAAEC,WAAW,QAAQ,OAAO;AAC5E,SACEC,UAAU,EACVC,IAAI,QAEC,cAAc;AACrB,OAAOC,yBAAyB,IAAIC,QAAQ,QAAQ,4CAA4C;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGjG,MAAMC,YAAY,gBAAGR,UAAU,CAC7B,CAACS,KAAK,EAAEC,GAAG,KAAK;EACd,MAAM;IACJC,MAAM;IACNC,QAAQ;IACRC,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,eAAe,GA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,CAC/BkC,KAAU,IAAK;IACd,MAAMC,IAAiB,GAAGD,KAAK,CAACE,WAAW;IAC3CC,OAAO,CAACC,GAAG,CAAC,YAAY,EAAEH,IAAI,CAAC;IAC/Bf,UAAU,GAAGe,IAAI,CAAC;EACpB,CAAC,EACD,CAACf,UAAU,CACb,CAAC;EAED,MAAMyB,cAAyB,GAAG;IAChCC,QAAQ,EAAE,QAAQ;IAClB,IAAIpC,MAAM,KAAK,QAAQ,IAAIG,KAAK,IAAIC,MAAM,GACtC;MAAED,KAAK;MAAEC;IAAO,CAAC,GACjB;MAAED,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC,CAAC;IAC5B,IAAIO,KAAK,IAAI,CAAC,CAAC;EACjB,CAAC;EAED,oBACEf,IAAA,CAACJ,IAAI;IAACmB,KAAK,EAAEwB,cAAe;IAAAE,QAAA,eAC1BzC,IAAA,CAACH,yBAAyB;MACxBM,GAAG,EAAEa,OAAQ;MACbD,KAAK,EAAEpB,UAAU,CAAC+C,YAAa;MAC/BtC,MAAM,EAAEA,MAAO;MACfC,QAAQ,EAAEA,QAAS;MACnBC,QAAQ,EAAEA,QAAS;MACnBC,KAAK,EAAEA,KAAgB;MACvBC,MAAM,EAAEA,MAAiB;MACzBC,eAAe,EAAEA,eAA0B;MAC3CC,UAAU,EAAEiB,cAAe;MAC3BhB,aAAa,EAAEsB,iBAAkB;MACjCrB,UAAU,EAAEsB,cAAe;MAC3BrB,WAAW,EAAEwB,eAAgB;MAC7BvB,UAAU,EAAEwB;IAAe,CAC5B;EAAC,CACE,CAAC;AAEX,CACF,CAAC;AAEDrC,YAAY,CAAC0C,WAAW,GAAG,cAAc;AAEzC,eAAe1C,YAAY","ignoreList":[]}
@@ -0,0 +1,81 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import type {
3
+ Int32,
4
+ DirectEventHandler,
5
+ } from 'react-native/Libraries/Types/CodegenTypes';
6
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
8
+
9
+ /**
10
+ * Event payload for ad events
11
+ */
12
+ export interface AdEventPayload {
13
+ adId?: string;
14
+ sdk?: string;
15
+ message?: string;
16
+ error?: string;
17
+ sdkType?: string;
18
+ }
19
+
20
+ /**
21
+ * Native Props for VeonPrebidReactNativeView
22
+ */
23
+ export interface NativeProps extends ViewProps {
24
+ /** Ad type: banner, interstitial, or rewardVideo */
25
+ adType?: string;
26
+
27
+ /** Prebid config ID */
28
+ configId?: string;
29
+
30
+ /** Google Ad Manager ad unit ID */
31
+ adUnitId?: string;
32
+
33
+ /** Ad width (required for banners) */
34
+ width?: Int32;
35
+
36
+ /** Ad height (required for banners) */
37
+ height?: Int32;
38
+
39
+ /** Refresh interval in seconds (30-120, for banners only) */
40
+ refreshInterval?: Int32;
41
+
42
+ // Event handlers
43
+ onAdLoaded?: DirectEventHandler<AdEventPayload>;
44
+ onAdDisplayed?: DirectEventHandler<AdEventPayload>;
45
+ onAdFailed?: DirectEventHandler<AdEventPayload>;
46
+ onAdClicked?: DirectEventHandler<AdEventPayload>;
47
+ onAdClosed?: DirectEventHandler<AdEventPayload>;
48
+ }
49
+
50
+ type ComponentType = HostComponent<NativeProps>;
51
+
52
+ export interface NativeCommands {
53
+ loadBanner: (viewRef: React.ElementRef<ComponentType>) => void;
54
+ showBanner: (viewRef: React.ElementRef<ComponentType>) => void;
55
+ hideBanner: (viewRef: React.ElementRef<ComponentType>) => void;
56
+ loadInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
57
+ showInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
58
+ hideInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
59
+ pauseAuction: (viewRef: React.ElementRef<ComponentType>) => void;
60
+ resumeAuction: (viewRef: React.ElementRef<ComponentType>) => void;
61
+ destroyAuction: (viewRef: React.ElementRef<ComponentType>) => void;
62
+ }
63
+
64
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
65
+ supportedCommands: [
66
+ 'loadBanner',
67
+ 'showBanner',
68
+ 'hideBanner',
69
+ 'loadInterstitial',
70
+ 'showInterstitial',
71
+ 'hideInterstitial',
72
+ 'pauseAuction',
73
+ 'resumeAuction',
74
+ 'destroyAuction',
75
+ ],
76
+ });
77
+
78
+ /**
79
+ * Native component for Veon Prebid ads
80
+ */
81
+ export default codegenNativeComponent<NativeProps>('VeonPrebidReactNativeView');
@@ -1,9 +1,10 @@
1
- import type { ViewProps } from 'react-native';
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
2
  import type {
3
3
  Int32,
4
4
  DirectEventHandler,
5
5
  } from 'react-native/Libraries/Types/CodegenTypes';
6
6
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
7
8
 
8
9
  /**
9
10
  * Event payload for ad events
@@ -12,6 +13,8 @@ export interface AdEventPayload {
12
13
  adId?: string;
13
14
  sdk?: string;
14
15
  message?: string;
16
+ error?: string;
17
+ sdkType?: string;
15
18
  }
16
19
 
17
20
  /**
@@ -44,6 +47,34 @@ export interface NativeProps extends ViewProps {
44
47
  onAdClosed?: DirectEventHandler<AdEventPayload>;
45
48
  }
46
49
 
50
+ type ComponentType = HostComponent<NativeProps>;
51
+
52
+ export interface NativeCommands {
53
+ loadBanner: (viewRef: React.ElementRef<ComponentType>) => void;
54
+ showBanner: (viewRef: React.ElementRef<ComponentType>) => void;
55
+ hideBanner: (viewRef: React.ElementRef<ComponentType>) => void;
56
+ loadInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
57
+ showInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
58
+ hideInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
59
+ pauseAuction: (viewRef: React.ElementRef<ComponentType>) => void;
60
+ resumeAuction: (viewRef: React.ElementRef<ComponentType>) => void;
61
+ destroyAuction: (viewRef: React.ElementRef<ComponentType>) => void;
62
+ }
63
+
64
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
65
+ supportedCommands: [
66
+ 'loadBanner',
67
+ 'showBanner',
68
+ 'hideBanner',
69
+ 'loadInterstitial',
70
+ 'showInterstitial',
71
+ 'hideInterstitial',
72
+ 'pauseAuction',
73
+ 'resumeAuction',
74
+ 'destroyAuction',
75
+ ],
76
+ });
77
+
47
78
  /**
48
79
  * Native component for Veon Prebid ads
49
80
  */
@@ -1 +1 @@
1
- {"version":3,"file":"VeonPrebidAd.d.ts","sourceRoot":"","sources":["../../../src/VeonPrebidAd.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAe,MAAM,SAAS,CAAC;AAe5E,QAAA,MAAM,YAAY,4GAkIjB,CAAC;AAIF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"VeonPrebidAd.d.ts","sourceRoot":"","sources":["../../../src/VeonPrebidAd.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAe,MAAM,SAAS,CAAC;AAE5E,QAAA,MAAM,YAAY,4GA8HjB,CAAC;AAIF,eAAe,YAAY,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ViewProps } from 'react-native';
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
2
  import type { Int32, DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
3
3
  /**
4
4
  * Event payload for ad events
@@ -7,6 +7,8 @@ export interface AdEventPayload {
7
7
  adId?: string;
8
8
  sdk?: string;
9
9
  message?: string;
10
+ error?: string;
11
+ sdkType?: string;
10
12
  }
11
13
  /**
12
14
  * Native Props for VeonPrebidReactNativeView
@@ -30,6 +32,19 @@ export interface NativeProps extends ViewProps {
30
32
  onAdClicked?: DirectEventHandler<AdEventPayload>;
31
33
  onAdClosed?: DirectEventHandler<AdEventPayload>;
32
34
  }
35
+ type ComponentType = HostComponent<NativeProps>;
36
+ export interface NativeCommands {
37
+ loadBanner: (viewRef: React.ElementRef<ComponentType>) => void;
38
+ showBanner: (viewRef: React.ElementRef<ComponentType>) => void;
39
+ hideBanner: (viewRef: React.ElementRef<ComponentType>) => void;
40
+ loadInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
41
+ showInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
42
+ hideInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
43
+ pauseAuction: (viewRef: React.ElementRef<ComponentType>) => void;
44
+ resumeAuction: (viewRef: React.ElementRef<ComponentType>) => void;
45
+ destroyAuction: (viewRef: React.ElementRef<ComponentType>) => void;
46
+ }
47
+ export declare const Commands: NativeCommands;
33
48
  /**
34
49
  * Native component for Veon Prebid ads
35
50
  */
@@ -1 +1 @@
1
- {"version":3,"file":"VeonPrebidReactNativeViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/VeonPrebidReactNativeViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,KAAK,EACL,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAGnD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,sCAAsC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd,uCAAuC;IACvC,MAAM,CAAC,EAAE,KAAK,CAAC;IAEf,6DAA6D;IAC7D,eAAe,CAAC,EAAE,KAAK,CAAC;IAGxB,UAAU,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAChD,aAAa,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAChD,WAAW,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CACjD;AAED;;GAEG;;;;AACH,wBAAgF"}
1
+ {"version":3,"file":"VeonPrebidReactNativeViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/VeonPrebidReactNativeViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EACV,KAAK,EACL,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAInD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,sCAAsC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd,uCAAuC;IACvC,MAAM,CAAC,EAAE,KAAK,CAAC;IAEf,6DAA6D;IAC7D,eAAe,CAAC,EAAE,KAAK,CAAC;IAGxB,UAAU,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAChD,aAAa,CAAC,EAAE,kB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
2
  "name": "setupad-prebid-react-native",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Prebid SDK for React Native",
5
5
  "main": "./lib/module/index.js",
6
+ "expo": {
7
+ "configPlugin": "./app.plugin.js"
8
+ },
6
9
  "types": "./lib/typescript/src/index.d.ts",
7
10
  "exports": {
8
11
  ".": {
@@ -10,6 +13,8 @@
10
13
  "types": "./lib/typescript/src/index.d.ts",
11
14
  "default": "./lib/module/index.js"
12
15
  },
16
+ "./app.plugin.js": "./app.plugin.js",
17
+ "./app.plugin": "./app.plugin.js",
13
18
  "./package.json": "./package.json"
14
19
  },
15
20
  "files": [
@@ -38,7 +43,7 @@
38
43
  "typecheck": "tsc",
39
44
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
40
45
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
41
- "prepare": "bob build",
46
+ "prepare": "bob build && node -e \"const fs=require('fs');const p='lib/module/VeonPrebidReactNativeViewNativeComponent';if(fs.existsSync(p+'.ts')&&!fs.existsSync(p+'.js')){fs.copyFileSync(p+'.ts',p+'.js')}\"",
42
47
  "release": "release-it --only-version"
43
48
  },
44
49
  "keywords": [
@@ -65,6 +70,7 @@
65
70
  "@eslint/eslintrc": "^3.3.1",
66
71
  "@eslint/js": "^9.35.0",
67
72
  "@evilmartians/lefthook": "^1.12.3",
73
+ "@expo/config-plugins": "^55.0.6",
68
74
  "@react-native-community/cli": "20.0.1",
69
75
  "@react-native/babel-preset": "0.81.1",
70
76
  "@react-native/eslint-config": "^0.81.1",
@@ -86,9 +92,15 @@
86
92
  "typescript": "^5.9.2"
87
93
  },
88
94
  "peerDependencies": {
95
+ "@expo/config-plugins": ">=7.0.0",
89
96
  "react": ">=18.0.0",
90
97
  "react-native": ">=0.76.0"
91
98
  },
99
+ "peerDependenciesMeta": {
100
+ "@expo/config-plugins": {
101
+ "optional": true
102
+ }
103
+ },
92
104
  "workspaces": [
93
105
  "example"
94
106
  ],
@@ -1,27 +1,12 @@
1
1
  import { useRef, useImperativeHandle, forwardRef, useCallback } from 'react';
2
2
  import {
3
- UIManager,
4
- findNodeHandle,
5
3
  StyleSheet,
6
4
  View,
7
5
  type ViewStyle,
8
6
  } from 'react-native';
9
- import VeonPrebidReactNativeView from './VeonPrebidReactNativeViewNativeComponent';
7
+ import VeonPrebidReactNativeView, { Commands } from './VeonPrebidReactNativeViewNativeComponent';
10
8
  import type { VeonPrebidAdProps, AdController, AdEventData } from './types';
11
9
 
12
- // Command IDs - must match ViewManager (starts from 0 in iOS Old Architecture!)
13
- const Commands = {
14
- loadBanner: 0,
15
- showBanner: 1,
16
- hideBanner: 2,
17
- loadInterstitial: 3,
18
- showInterstitial: 4,
19
- hideInterstitial: 5,
20
- pauseAuction: 6,
21
- resumeAuction: 7,
22
- destroyAuction: 8,
23
- } as const;
24
-
25
10
  const VeonPrebidAd = forwardRef<AdController, VeonPrebidAdProps>(
26
11
  (props, ref) => {
27
12
  const {
@@ -41,42 +26,38 @@ const VeonPrebidAd = forwardRef<AdController, VeonPrebidAdProps>(
41
26
 
42
27
  const viewRef = useRef<any>(null);
43
28
 
44
- const executeCommand = useCallback(
45
- (commandName: string, commandId: number) => {
46
- const node = findNodeHandle(viewRef.current);
47
- if (!node) {
48
- console.warn(`Cannot execute ${commandName} - view not mounted`);
49
- return;
50
- }
51
-
52
- console.log(
53
- `Executing ${commandName} (ID: ${commandId}) on node: ${node}`
54
- );
55
- UIManager.dispatchViewManagerCommand(node, commandId, []);
56
- },
57
- []
58
- );
59
-
60
29
  useImperativeHandle(
61
30
  ref,
62
31
  () => ({
63
- loadBanner: () => executeCommand('loadBanner', Commands.loadBanner),
64
- showBanner: () => executeCommand('showBanner', Commands.showBanner),
65
- hideBanner: () => executeCommand('hideBanner', Commands.hideBanner),
66
- loadInterstitial: () =>
67
- executeCommand('loadInterstitial', Commands.loadInterstitial),
68
- showInterstitial: () =>
69
- executeCommand('showInterstitial', Commands.showInterstitial),
70
- hideInterstitial: () =>
71
- executeCommand('hideInterstitial', Commands.hideInterstitial),
72
- pauseAuction: () =>
73
- executeCommand('pauseAuction', Commands.pauseAuction),
74
- resumeAuction: () =>
75
- executeCommand('resumeAuction', Commands.resumeAuction),
76
- destroyAuction: () =>
77
- executeCommand('destroyAuction', Commands.destroyAuction),
32
+ loadBanner: () => {
33
+ if (viewRef.current) Commands.loadBanner(viewRef.current);
34
+ },
35
+ showBanner: () => {
36
+ if (viewRef.current) Commands.showBanner(viewRef.current);
37
+ },
38
+ hideBanner: () => {
39
+ if (viewRef.current) Commands.hideBanner(viewRef.current);
40
+ },
41
+ loadInterstitial: () => {
42
+ if (viewRef.current) Commands.loadInterstitial(viewRef.current);
43
+ },
44
+ showInterstitial: () => {
45
+ if (viewRef.current) Commands.showInterstitial(viewRef.current);
46
+ },
47
+ hideInterstitial: () => {
48
+ if (viewRef.current) Commands.hideInterstitial(viewRef.current);
49
+ },
50
+ pauseAuction: () => {
51
+ if (viewRef.current) Commands.pauseAuction(viewRef.current);
52
+ },
53
+ resumeAuction: () => {
54
+ if (viewRef.current) Commands.resumeAuction(viewRef.current);
55
+ },
56
+ destroyAuction: () => {
57
+ if (viewRef.current) Commands.destroyAuction(viewRef.current);
58
+ },
78
59
  }),
79
- [executeCommand]
60
+ []
80
61
  );
81
62
 
82
63
  const handleAdLoaded = useCallback(
@@ -1,9 +1,10 @@
1
- import type { ViewProps } from 'react-native';
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
2
  import type {
3
3
  Int32,
4
4
  DirectEventHandler,
5
5
  } from 'react-native/Libraries/Types/CodegenTypes';
6
6
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
7
8
 
8
9
  /**
9
10
  * Event payload for ad events
@@ -12,6 +13,8 @@ export interface AdEventPayload {
12
13
  adId?: string;
13
14
  sdk?: string;
14
15
  message?: string;
16
+ error?: string;
17
+ sdkType?: string;
15
18
  }
16
19
 
17
20
  /**
@@ -44,6 +47,34 @@ export interface NativeProps extends ViewProps {
44
47
  onAdClosed?: DirectEventHandler<AdEventPayload>;
45
48
  }
46
49
 
50
+ type ComponentType = HostComponent<NativeProps>;
51
+
52
+ export interface NativeCommands {
53
+ loadBanner: (viewRef: React.ElementRef<ComponentType>) => void;
54
+ showBanner: (viewRef: React.ElementRef<ComponentType>) => void;
55
+ hideBanner: (viewRef: React.ElementRef<ComponentType>) => void;
56
+ loadInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
57
+ showInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
58
+ hideInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
59
+ pauseAuction: (viewRef: React.ElementRef<ComponentType>) => void;
60
+ resumeAuction: (viewRef: React.ElementRef<ComponentType>) => void;
61
+ destroyAuction: (viewRef: React.ElementRef<ComponentType>) => void;
62
+ }
63
+
64
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
65
+ supportedCommands: [
66
+ 'loadBanner',
67
+ 'showBanner',
68
+ 'hideBanner',
69
+ 'loadInterstitial',
70
+ 'showInterstitial',
71
+ 'hideInterstitial',
72
+ 'pauseAuction',
73
+ 'resumeAuction',
74
+ 'destroyAuction',
75
+ ],
76
+ });
77
+
47
78
  /**
48
79
  * Native component for Veon Prebid ads
49
80
  */