setupad-prebid-react-native 0.1.9 → 0.2.1
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.
|
@@ -23,8 +23,8 @@ Pod::Spec.new do |s|
|
|
|
23
23
|
# Fabric (New Architecture) dependencies
|
|
24
24
|
install_modules_dependencies(s)
|
|
25
25
|
s.dependency "Google-Mobile-Ads-SDK", "12.3.0"
|
|
26
|
-
s.dependency "VeonPrebidMobileGAMEventHandlers", "0.0.
|
|
27
|
-
s.dependency "VeonPrebidMobile", "0.0.
|
|
26
|
+
s.dependency "VeonPrebidMobileGAMEventHandlers", "0.0.5"
|
|
27
|
+
s.dependency "VeonPrebidMobile", "0.0.5"
|
|
28
28
|
|
|
29
29
|
s.static_framework = true
|
|
30
30
|
s.swift_version = "5.0"
|
package/android/build.gradle
CHANGED
|
@@ -83,8 +83,8 @@ dependencies {
|
|
|
83
83
|
implementation 'com.google.android.gms:play-services-ads:22.2.0'
|
|
84
84
|
|
|
85
85
|
// Veon Prebid SDK
|
|
86
|
-
implementation 'com.github.veonadtech.prebid-android-sdk:core:0.1.
|
|
87
|
-
implementation 'com.github.veonadtech.prebid-android-sdk:eventhandlers:0.1.
|
|
88
|
-
implementation 'com.github.veonadtech.prebid-android-sdk:mobile:0.1.
|
|
89
|
-
implementation 'com.github.veonadtech.prebid-android-sdk:prebidorg:0.1.
|
|
86
|
+
implementation 'com.github.veonadtech.prebid-android-sdk:core:0.1.1'
|
|
87
|
+
implementation 'com.github.veonadtech.prebid-android-sdk:eventhandlers:0.1.1'
|
|
88
|
+
implementation 'com.github.veonadtech.prebid-android-sdk:mobile:0.1.1'
|
|
89
|
+
implementation 'com.github.veonadtech.prebid-android-sdk:prebidorg:0.1.1'
|
|
90
90
|
}
|
|
@@ -1,67 +1,7 @@
|
|
|
1
|
-
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
-
import type {
|
|
3
|
-
Int32,
|
|
4
|
-
DirectEventHandler,
|
|
5
|
-
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
6
1
|
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
7
2
|
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
8
3
|
|
|
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>({
|
|
4
|
+
export const Commands = codegenNativeCommands({
|
|
65
5
|
supportedCommands: [
|
|
66
6
|
'loadBanner',
|
|
67
7
|
'showBanner',
|
|
@@ -75,7 +15,4 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
|
75
15
|
],
|
|
76
16
|
});
|
|
77
17
|
|
|
78
|
-
|
|
79
|
-
* Native component for Veon Prebid ads
|
|
80
|
-
*/
|
|
81
|
-
export default codegenNativeComponent<NativeProps>('VeonPrebidReactNativeView');
|
|
18
|
+
export default codegenNativeComponent('VeonPrebidReactNativeView');
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "setupad-prebid-react-native",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Prebid SDK for React Native",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
|
-
"expo": {
|
|
7
|
-
"configPlugin": "./app.plugin.js"
|
|
8
|
-
},
|
|
9
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
10
7
|
"exports": {
|
|
11
8
|
".": {
|
|
@@ -13,8 +10,6 @@
|
|
|
13
10
|
"types": "./lib/typescript/src/index.d.ts",
|
|
14
11
|
"default": "./lib/module/index.js"
|
|
15
12
|
},
|
|
16
|
-
"./app.plugin.js": "./app.plugin.js",
|
|
17
|
-
"./app.plugin": "./app.plugin.js",
|
|
18
13
|
"./package.json": "./package.json"
|
|
19
14
|
},
|
|
20
15
|
"files": [
|
|
@@ -24,7 +19,7 @@
|
|
|
24
19
|
"ios",
|
|
25
20
|
"cpp",
|
|
26
21
|
"*.podspec",
|
|
27
|
-
"
|
|
22
|
+
"scripts",
|
|
28
23
|
"react-native.config.js",
|
|
29
24
|
"!ios/build",
|
|
30
25
|
"!android/build",
|
|
@@ -43,7 +38,7 @@
|
|
|
43
38
|
"typecheck": "tsc",
|
|
44
39
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
45
40
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
46
|
-
"prepare": "bob build && node -
|
|
41
|
+
"prepare": "bob build && node scripts/generate-native-component-js.js",
|
|
47
42
|
"release": "release-it --only-version"
|
|
48
43
|
},
|
|
49
44
|
"keywords": [
|
|
@@ -70,7 +65,6 @@
|
|
|
70
65
|
"@eslint/eslintrc": "^3.3.1",
|
|
71
66
|
"@eslint/js": "^9.35.0",
|
|
72
67
|
"@evilmartians/lefthook": "^1.12.3",
|
|
73
|
-
"@expo/config-plugins": "^55.0.6",
|
|
74
68
|
"@react-native-community/cli": "20.0.1",
|
|
75
69
|
"@react-native/babel-preset": "0.81.1",
|
|
76
70
|
"@react-native/eslint-config": "^0.81.1",
|
|
@@ -92,15 +86,9 @@
|
|
|
92
86
|
"typescript": "^5.9.2"
|
|
93
87
|
},
|
|
94
88
|
"peerDependencies": {
|
|
95
|
-
"@expo/config-plugins": ">=7.0.0",
|
|
96
89
|
"react": ">=18.0.0",
|
|
97
90
|
"react-native": ">=0.76.0"
|
|
98
91
|
},
|
|
99
|
-
"peerDependenciesMeta": {
|
|
100
|
-
"@expo/config-plugins": {
|
|
101
|
-
"optional": true
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
92
|
"workspaces": [
|
|
105
93
|
"example"
|
|
106
94
|
],
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This script generates a plain JavaScript version of VeonPrebidReactNativeViewNativeComponent
|
|
3
|
+
* after bob build. Builder-bob may skip codegen spec files, so we need to ensure
|
|
4
|
+
* the lib/module/ output contains a valid .js file without TypeScript syntax.
|
|
5
|
+
*
|
|
6
|
+
* Bare React Native CLI projects require clean JS for codegen validation,
|
|
7
|
+
* otherwise 'Commands' is not recognized as a valid codegenNativeCommands export.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
|
|
13
|
+
const outputPath = path.join(
|
|
14
|
+
__dirname,
|
|
15
|
+
'..',
|
|
16
|
+
'lib',
|
|
17
|
+
'module',
|
|
18
|
+
'VeonPrebidReactNativeViewNativeComponent.js'
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
// Only generate if the .js file doesn't exist or still contains TypeScript syntax
|
|
22
|
+
const needsGeneration = (() => {
|
|
23
|
+
if (!fs.existsSync(outputPath)) return true;
|
|
24
|
+
const content = fs.readFileSync(outputPath, 'utf8');
|
|
25
|
+
// If it contains TypeScript-only syntax, it needs to be regenerated
|
|
26
|
+
return content.includes('interface ') || content.includes(': NativeCommands');
|
|
27
|
+
})();
|
|
28
|
+
|
|
29
|
+
if (needsGeneration) {
|
|
30
|
+
const jsContent = `import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
31
|
+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
32
|
+
|
|
33
|
+
export const Commands = codegenNativeCommands({
|
|
34
|
+
supportedCommands: [
|
|
35
|
+
'loadBanner',
|
|
36
|
+
'showBanner',
|
|
37
|
+
'hideBanner',
|
|
38
|
+
'loadInterstitial',
|
|
39
|
+
'showInterstitial',
|
|
40
|
+
'hideInterstitial',
|
|
41
|
+
'pauseAuction',
|
|
42
|
+
'resumeAuction',
|
|
43
|
+
'destroyAuction',
|
|
44
|
+
],
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export default codegenNativeComponent('VeonPrebidReactNativeView');
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
fs.writeFileSync(outputPath, jsContent, 'utf8');
|
|
51
|
+
console.log(
|
|
52
|
+
'Generated clean JS for VeonPrebidReactNativeViewNativeComponent'
|
|
53
|
+
);
|
|
54
|
+
}
|
package/app.plugin.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const { withDangerousMod } = require('@expo/config-plugins');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Expo config plugin for setupad-prebid-react-native
|
|
7
|
-
*
|
|
8
|
-
* Automatically configures the consumer's iOS Podfile with:
|
|
9
|
-
* - use_frameworks! :linkage => :static (required for Swift module resolution)
|
|
10
|
-
* - Explicit VeonPrebid pod dependencies
|
|
11
|
-
* - post_install hooks for DEFINES_MODULE and Swift module resolution
|
|
12
|
-
*/
|
|
13
|
-
module.exports = function withVeonPrebid(config) {
|
|
14
|
-
return withDangerousMod(config, [
|
|
15
|
-
'ios',
|
|
16
|
-
async (cfg) => {
|
|
17
|
-
const podfilePath = path.join(
|
|
18
|
-
cfg.modRequest.platformProjectRoot,
|
|
19
|
-
'Podfile'
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
if (!fs.existsSync(podfilePath)) {
|
|
23
|
-
return cfg;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
let podfile = fs.readFileSync(podfilePath, 'utf8');
|
|
27
|
-
|
|
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
|
|
39
|
-
if (!podfile.includes("pod 'VeonPrebidMobile'")) {
|
|
40
|
-
podfile = podfile.replace(
|
|
41
|
-
/use_react_native!\(/,
|
|
42
|
-
`# Veon Prebid Dependencies\n pod 'Google-Mobile-Ads-SDK', '12.3.0'\n pod 'VeonPrebidMobile', '0.0.4'\n pod 'VeonPrebidMobileGAMEventHandlers', '0.0.4'\n\n use_react_native!(`
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// 3. Add post_install hook for VeonPrebid module fixes
|
|
47
|
-
if (!podfile.includes('VeonPrebidMobile Swift module')) {
|
|
48
|
-
const postInstallHook = `
|
|
49
|
-
# Fix for VeonPrebidMobile Swift module resolution
|
|
50
|
-
installer.pods_project.targets.each do |target|
|
|
51
|
-
if ['VeonPrebidMobile', 'VeonPrebidMobileGAMEventHandlers'].include?(target.name)
|
|
52
|
-
target.build_configurations.each do |build_config|
|
|
53
|
-
build_config.build_settings['DEFINES_MODULE'] = 'YES'
|
|
54
|
-
build_config.build_settings['SWIFT_VERSION'] = '5.0'
|
|
55
|
-
build_config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
|
|
56
|
-
build_config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end`;
|
|
60
|
-
|
|
61
|
-
podfile = podfile.replace(
|
|
62
|
-
/(react_native_post_install\([^)]*\)[\s\S]*?\))/,
|
|
63
|
-
`$1\n${postInstallHook}`
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
fs.writeFileSync(podfilePath, podfile);
|
|
68
|
-
return cfg;
|
|
69
|
-
},
|
|
70
|
-
]);
|
|
71
|
-
};
|