setupad-prebid-react-native 0.1.7 → 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
+ };
@@ -118,6 +118,8 @@ using namespace facebook::react;
118
118
  if (event[@"adId"]) data.adId = std::string([event[@"adId"] UTF8String]);
119
119
  if (event[@"sdk"]) data.sdk = std::string([event[@"sdk"] UTF8String]);
120
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]);
121
123
  emitter->onAdLoaded(data);
122
124
  }
123
125
  };
@@ -131,6 +133,8 @@ using namespace facebook::react;
131
133
  if (event[@"adId"]) data.adId = std::string([event[@"adId"] UTF8String]);
132
134
  if (event[@"sdk"]) data.sdk = std::string([event[@"sdk"] UTF8String]);
133
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]);
134
138
  emitter->onAdDisplayed(data);
135
139
  }
136
140
  };
@@ -144,6 +148,8 @@ using namespace facebook::react;
144
148
  if (event[@"adId"]) data.adId = std::string([event[@"adId"] UTF8String]);
145
149
  if (event[@"sdk"]) data.sdk = std::string([event[@"sdk"] UTF8String]);
146
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]);
147
153
  emitter->onAdFailed(data);
148
154
  }
149
155
  };
@@ -157,6 +163,8 @@ using namespace facebook::react;
157
163
  if (event[@"adId"]) data.adId = std::string([event[@"adId"] UTF8String]);
158
164
  if (event[@"sdk"]) data.sdk = std::string([event[@"sdk"] UTF8String]);
159
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]);
160
168
  emitter->onAdClicked(data);
161
169
  }
162
170
  };
@@ -170,6 +178,8 @@ using namespace facebook::react;
170
178
  if (event[@"adId"]) data.adId = std::string([event[@"adId"] UTF8String]);
171
179
  if (event[@"sdk"]) data.sdk = std::string([event[@"sdk"] UTF8String]);
172
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]);
173
183
  emitter->onAdClosed(data);
174
184
  }
175
185
  };
@@ -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');
@@ -13,6 +13,8 @@ export interface AdEventPayload {
13
13
  adId?: string;
14
14
  sdk?: string;
15
15
  message?: string;
16
+ error?: string;
17
+ sdkType?: string;
16
18
  }
17
19
 
18
20
  /**
@@ -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
@@ -1 +1 @@
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,kBAAk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AU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IACrE,gBAAgB,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IACrE,gBAAgB,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IACrE,YAAY,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IACjE,aAAa,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IAClE,cAAc,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;CACpE;AAED,eAAO,MAAM,QAAQ,EAAE,cAYrB,CAAC;AAEH;;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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UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IAClE,cAAc,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;CACpE;AAED,eAAO,MAAM,QAAQ,EAAE,cAYrB,CAAC;AAEH;;GAEG;;;;AACH,wBAAgF"}
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "setupad-prebid-react-native",
3
- "version": "0.1.7",
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
  ],
@@ -13,6 +13,8 @@ export interface AdEventPayload {
13
13
  adId?: string;
14
14
  sdk?: string;
15
15
  message?: string;
16
+ error?: string;
17
+ sdkType?: string;
16
18
  }
17
19
 
18
20
  /**