setupad-prebid-react-native 0.1.7 → 0.1.9

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
@@ -1,4 +1,4 @@
1
- const { withDangerousMod, withPlugins } = require('@expo/config-plugins');
1
+ const { withDangerousMod } = require('@expo/config-plugins');
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
 
@@ -6,14 +6,18 @@ const path = require('path');
6
6
  * Expo config plugin for setupad-prebid-react-native
7
7
  *
8
8
  * Automatically configures the consumer's iOS Podfile with:
9
+ * - use_frameworks! :linkage => :static (required for Swift module resolution)
9
10
  * - Explicit VeonPrebid pod dependencies
10
11
  * - post_install hooks for DEFINES_MODULE and Swift module resolution
11
12
  */
12
- function withVeonPrebidIOS(config) {
13
+ module.exports = function withVeonPrebid(config) {
13
14
  return withDangerousMod(config, [
14
15
  'ios',
15
16
  async (cfg) => {
16
- const podfilePath = path.join(cfg.modRequest.platformProjectRoot, 'Podfile');
17
+ const podfilePath = path.join(
18
+ cfg.modRequest.platformProjectRoot,
19
+ 'Podfile'
20
+ );
17
21
 
18
22
  if (!fs.existsSync(podfilePath)) {
19
23
  return cfg;
@@ -21,7 +25,17 @@ function withVeonPrebidIOS(config) {
21
25
 
22
26
  let podfile = fs.readFileSync(podfilePath, 'utf8');
23
27
 
24
- // Add explicit Veon Prebid pod dependencies if not already present
28
+ // 1. Add use_frameworks! directly in Podfile
29
+ // Cannot rely on Podfile.properties.json because pod install reads it
30
+ // BEFORE dangerous mods write to it during first prebuild.
31
+ if (!podfile.includes("use_frameworks! :linkage => :static")) {
32
+ podfile = podfile.replace(
33
+ /use_react_native!\(/,
34
+ `use_frameworks! :linkage => :static\n\n use_react_native!(`
35
+ );
36
+ }
37
+
38
+ // 2. Add explicit Veon Prebid pod dependencies
25
39
  if (!podfile.includes("pod 'VeonPrebidMobile'")) {
26
40
  podfile = podfile.replace(
27
41
  /use_react_native!\(/,
@@ -29,7 +43,7 @@ function withVeonPrebidIOS(config) {
29
43
  );
30
44
  }
31
45
 
32
- // Add post_install hook for VeonPrebid module fixes
46
+ // 3. Add post_install hook for VeonPrebid module fixes
33
47
  if (!podfile.includes('VeonPrebidMobile Swift module')) {
34
48
  const postInstallHook = `
35
49
  # Fix for VeonPrebidMobile Swift module resolution
@@ -44,7 +58,6 @@ function withVeonPrebidIOS(config) {
44
58
  end
45
59
  end`;
46
60
 
47
- // Insert before the last `end` of post_install block
48
61
  podfile = podfile.replace(
49
62
  /(react_native_post_install\([^)]*\)[\s\S]*?\))/,
50
63
  `$1\n${postInstallHook}`
@@ -55,8 +68,4 @@ function withVeonPrebidIOS(config) {
55
68
  return cfg;
56
69
  },
57
70
  ]);
58
- }
59
-
60
- module.exports = function withVeonPrebid(config) {
61
- return withPlugins(config, [withVeonPrebidIOS]);
62
- };
71
+ };
@@ -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,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;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,cAA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
+ {"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,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,KAAK,aAAa,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAEhD,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IAC/D,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IAC/D,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IAC/D,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,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"}
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.9",
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
  /**