setupad-prebid-react-native 0.1.3

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 (66) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +325 -0
  3. package/VeonPrebidReactNative.podspec +59 -0
  4. package/android/build.gradle +90 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +4 -0
  7. package/android/src/main/java/com/setupadprebidreactnative/VeonPrebidReactNativeModule.kt +130 -0
  8. package/android/src/main/java/com/setupadprebidreactnative/VeonPrebidReactNativePackage.kt +20 -0
  9. package/android/src/main/java/com/setupadprebidreactnative/VeonPrebidReactNativeView.kt +425 -0
  10. package/android/src/main/java/com/setupadprebidreactnative/VeonPrebidReactNativeViewManager.kt +186 -0
  11. package/ios/RCTFabricComponentsPlugins.h +12 -0
  12. package/ios/VeonPrebidReactNative-Bridging-Header.h +9 -0
  13. package/ios/VeonPrebidReactNativeModule.m +17 -0
  14. package/ios/VeonPrebidReactNativeModule.swift +108 -0
  15. package/ios/VeonPrebidReactNativeView+Delegates.swift +217 -0
  16. package/ios/VeonPrebidReactNativeView.h +5 -0
  17. package/ios/VeonPrebidReactNativeView.swift +381 -0
  18. package/ios/VeonPrebidReactNativeViewComponentView.h +13 -0
  19. package/ios/VeonPrebidReactNativeViewComponentView.mm +166 -0
  20. package/ios/VeonPrebidReactNativeViewManager.m +49 -0
  21. package/ios/VeonPrebidReactNativeViewManager.swift +105 -0
  22. package/lib/module/CodegenTypes.d.js +2 -0
  23. package/lib/module/CodegenTypes.d.js.map +1 -0
  24. package/lib/module/Commands.js +14 -0
  25. package/lib/module/Commands.js.map +1 -0
  26. package/lib/module/VeonPrebidAd.js +112 -0
  27. package/lib/module/VeonPrebidAd.js.map +1 -0
  28. package/lib/module/VeonPrebidModule.js +132 -0
  29. package/lib/module/VeonPrebidModule.js.map +1 -0
  30. package/lib/module/VeonPrebidReactNativeViewNativeComponent.ts +50 -0
  31. package/lib/module/VeonPrebidView.js +14 -0
  32. package/lib/module/VeonPrebidView.js.map +1 -0
  33. package/lib/module/index.js +8 -0
  34. package/lib/module/index.js.map +1 -0
  35. package/lib/module/package.json +1 -0
  36. package/lib/module/types.js +8 -0
  37. package/lib/module/types.js.map +1 -0
  38. package/lib/module/useVeonPrebidAd.js +154 -0
  39. package/lib/module/useVeonPrebidAd.js.map +1 -0
  40. package/lib/typescript/package.json +1 -0
  41. package/lib/typescript/src/Commands.d.ts +14 -0
  42. package/lib/typescript/src/Commands.d.ts.map +1 -0
  43. package/lib/typescript/src/VeonPrebidAd.d.ts +4 -0
  44. package/lib/typescript/src/VeonPrebidAd.d.ts.map +1 -0
  45. package/lib/typescript/src/VeonPrebidModule.d.ts +59 -0
  46. package/lib/typescript/src/VeonPrebidModule.d.ts.map +1 -0
  47. package/lib/typescript/src/VeonPrebidReactNativeViewNativeComponent.d.ts +40 -0
  48. package/lib/typescript/src/VeonPrebidReactNativeViewNativeComponent.d.ts.map +1 -0
  49. package/lib/typescript/src/VeonPrebidView.d.ts +5 -0
  50. package/lib/typescript/src/VeonPrebidView.d.ts.map +1 -0
  51. package/lib/typescript/src/index.d.ts +7 -0
  52. package/lib/typescript/src/index.d.ts.map +1 -0
  53. package/lib/typescript/src/types.d.ts +89 -0
  54. package/lib/typescript/src/types.d.ts.map +1 -0
  55. package/lib/typescript/src/useVeonPrebidAd.d.ts +52 -0
  56. package/lib/typescript/src/useVeonPrebidAd.d.ts.map +1 -0
  57. package/package.json +169 -0
  58. package/src/CodegenTypes.d.ts +16 -0
  59. package/src/Commands.ts +25 -0
  60. package/src/VeonPrebidAd.tsx +159 -0
  61. package/src/VeonPrebidModule.ts +159 -0
  62. package/src/VeonPrebidReactNativeViewNativeComponent.ts +50 -0
  63. package/src/VeonPrebidView.tsx +13 -0
  64. package/src/index.tsx +12 -0
  65. package/src/types.ts +64 -0
  66. package/src/useVeonPrebidAd.ts +156 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Commands.d.ts","sourceRoot":"","sources":["../../../src/Commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAEvE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,KAAK,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,KAAK,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,KAAK,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,KAAK,CAAC;CAChC;AAED,eAAO,MAAM,kBAAkB,EAAE,kBAUhC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { VeonPrebidAdProps, AdController } from './types';
2
+ declare const VeonPrebidAd: import("react").ForwardRefExoticComponent<VeonPrebidAdProps & import("react").RefAttributes<AdController>>;
3
+ export default VeonPrebidAd;
4
+ //# sourceMappingURL=VeonPrebidAd.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,59 @@
1
+ import type { PrebidConfig } from './types';
2
+ /**
3
+ * Veon Prebid SDK Module
4
+ * Handles SDK initialization and global SDK operations
5
+ */
6
+ declare class VeonPrebidSDK {
7
+ private static instance;
8
+ private isInitialized;
9
+ private initializationPromise;
10
+ private constructor();
11
+ /**
12
+ * Get singleton instance
13
+ */
14
+ static getInstance(): VeonPrebidSDK;
15
+ /**
16
+ * Initialize Prebid Mobile SDK
17
+ *
18
+ * @param config - Prebid configuration
19
+ * @returns Promise that resolves when SDK is initialized
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * await VeonPrebidSDK.getInstance().initialize({
24
+ * prebidHost: 'https://prebid.veonadx.com/openrtb2/auction',
25
+ * configHost: 'https://config.veonadx.com',
26
+ * accountId: 'YOUR_ACCOUNT_ID',
27
+ * timeoutMillis: 3000,
28
+ * pbsDebug: __DEV__,
29
+ * });
30
+ * ```
31
+ */
32
+ initialize(config: PrebidConfig): Promise<string>;
33
+ /**
34
+ * Get Prebid SDK version
35
+ *
36
+ * @returns Promise that resolves with SDK version string
37
+ */
38
+ getSDKVersion(): Promise<string>;
39
+ /**
40
+ * Check if SDK is initialized
41
+ */
42
+ isSDKInitialized(): boolean;
43
+ /**
44
+ * Add listener for SDK initialization events
45
+ *
46
+ * @param event - Event name ('prebidSdkInitialized' or 'prebidSdkInitializeFailed')
47
+ * @param listener - Callback function
48
+ * @returns Subscription object with remove() method
49
+ */
50
+ addListener(event: 'prebidSdkInitialized' | 'prebidSdkInitializeFailed', listener: (data: any) => void): import("react-native").EventSubscription;
51
+ /**
52
+ * Remove all listeners for specific event
53
+ *
54
+ * @param event - Event name
55
+ */
56
+ removeAllListeners(event: 'prebidSdkInitialized' | 'prebidSdkInitializeFailed'): void;
57
+ }
58
+ export default VeonPrebidSDK;
59
+ //# sourceMappingURL=VeonPrebidModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VeonPrebidModule.d.ts","sourceRoot":"","sources":["../../../src/VeonPrebidModule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAsB5C;;;GAGG;AACH,cAAM,aAAa;IACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAgB;IACvC,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,qBAAqB,CAAgC;IAE7D,OAAO;IAEP;;OAEG;WACW,WAAW,IAAI,aAAa;IAO1C;;;;;;;;;;;;;;;;OAgBG;IACU,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAkD9D;;;;OAIG;IACU,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAS7C;;OAEG;IACI,gBAAgB,IAAI,OAAO;IAIlC;;;;;;OAMG;IACI,WAAW,CAChB,KAAK,EAAE,sBAAsB,GAAG,2BAA2B,EAC3D,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI;IAK/B;;;;OAIG;IACI,kBAAkB,CACvB,KAAK,EAAE,sBAAsB,GAAG,2BAA2B;CAI9D;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import type { Int32, DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
3
+ /**
4
+ * Event payload for ad events
5
+ */
6
+ export interface AdEventPayload {
7
+ adId?: string;
8
+ sdk?: string;
9
+ message?: string;
10
+ }
11
+ /**
12
+ * Native Props for VeonPrebidReactNativeView
13
+ */
14
+ export interface NativeProps extends ViewProps {
15
+ /** Ad type: banner, interstitial, or rewardVideo */
16
+ adType?: string;
17
+ /** Prebid config ID */
18
+ configId?: string;
19
+ /** Google Ad Manager ad unit ID */
20
+ adUnitId?: string;
21
+ /** Ad width (required for banners) */
22
+ width?: Int32;
23
+ /** Ad height (required for banners) */
24
+ height?: Int32;
25
+ /** Refresh interval in seconds (30-120, for banners only) */
26
+ refreshInterval?: Int32;
27
+ onAdLoaded?: DirectEventHandler<AdEventPayload>;
28
+ onAdDisplayed?: DirectEventHandler<AdEventPayload>;
29
+ onAdFailed?: DirectEventHandler<AdEventPayload>;
30
+ onAdClicked?: DirectEventHandler<AdEventPayload>;
31
+ onAdClosed?: DirectEventHandler<AdEventPayload>;
32
+ }
33
+ /**
34
+ * Native component for Veon Prebid ads
35
+ */
36
+ declare const _default: (props: Omit<NativeProps, "ref"> & {
37
+ ref?: React.Ref<import("react-native").HostInstance>;
38
+ }) => React.ReactNode;
39
+ export default _default;
40
+ //# sourceMappingURL=VeonPrebidReactNativeViewNativeComponent.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { VeonPrebidViewProps } from './types';
3
+ export declare const VeonPrebidView: React.ForwardRefExoticComponent<VeonPrebidViewProps & React.RefAttributes<any>>;
4
+ export default VeonPrebidView;
5
+ //# sourceMappingURL=VeonPrebidView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VeonPrebidView.d.ts","sourceRoot":"","sources":["../../../src/VeonPrebidView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,cAAc,iFAI1B,CAAC;AAIF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { VeonPrebidView } from './VeonPrebidView';
2
+ export { VeonPrebidCommands } from './Commands';
3
+ export { default as VeonPrebidAd } from './VeonPrebidAd';
4
+ export { default as VeonPrebidSDK } from './VeonPrebidModule';
5
+ export { AdType } from './types';
6
+ export type { VeonPrebidViewProps, AdEventData, AdController, VeonPrebidAdProps, PrebidConfig } from './types';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACb,MAAM,SAAS,CAAC"}
@@ -0,0 +1,89 @@
1
+ export declare const AdType: {
2
+ BANNER: "banner";
3
+ INTERSTITIAL: "interstitial";
4
+ REWARD_VIDEO: "rewardvideo";
5
+ };
6
+ export type AdType = typeof AdType[keyof typeof AdType];
7
+ export interface VeonPrebidViewProps {
8
+ adType: AdType;
9
+ configId: string;
10
+ adUnitId: string;
11
+ width?: number;
12
+ height?: number;
13
+ refreshInterval?: number;
14
+ style?: any;
15
+ onAdLoaded?: (event: {
16
+ nativeEvent: {
17
+ adId?: string;
18
+ sdk?: string;
19
+ message?: string;
20
+ };
21
+ }) => void;
22
+ onAdDisplayed?: (event: {
23
+ nativeEvent: {
24
+ adId?: string;
25
+ sdk?: string;
26
+ message?: string;
27
+ };
28
+ }) => void;
29
+ onAdFailed?: (event: {
30
+ nativeEvent: {
31
+ adId?: string;
32
+ sdk?: string;
33
+ message?: string;
34
+ };
35
+ }) => void;
36
+ onAdClicked?: (event: {
37
+ nativeEvent: {
38
+ adId?: string;
39
+ sdk?: string;
40
+ message?: string;
41
+ };
42
+ }) => void;
43
+ onAdClosed?: (event: {
44
+ nativeEvent: {
45
+ adId?: string;
46
+ sdk?: string;
47
+ message?: string;
48
+ };
49
+ }) => void;
50
+ }
51
+ export interface AdEventData {
52
+ configId?: string;
53
+ adUnitId?: string;
54
+ sdkType?: string;
55
+ error?: string;
56
+ }
57
+ export interface AdController {
58
+ loadBanner: () => void;
59
+ showBanner: () => void;
60
+ hideBanner: () => void;
61
+ loadInterstitial: () => void;
62
+ showInterstitial: () => void;
63
+ hideInterstitial: () => void;
64
+ pauseAuction: () => void;
65
+ resumeAuction: () => void;
66
+ destroyAuction: () => void;
67
+ }
68
+ export interface VeonPrebidAdProps {
69
+ adType: AdType;
70
+ configId: string;
71
+ adUnitId: string;
72
+ width?: number;
73
+ height?: number;
74
+ refreshInterval?: number;
75
+ style?: any;
76
+ onAdLoaded?: (data: AdEventData) => void;
77
+ onAdDisplayed?: (data: AdEventData) => void;
78
+ onAdFailed?: (data: AdEventData) => void;
79
+ onAdClicked?: (data: AdEventData) => void;
80
+ onAdClosed?: (data: AdEventData) => void;
81
+ }
82
+ export interface PrebidConfig {
83
+ prebidHost: string;
84
+ configHost: string;
85
+ accountId: string;
86
+ timeoutMillis?: number;
87
+ pbsDebug?: boolean;
88
+ }
89
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,52 @@
1
+ import type { AdController, VeonPrebidAdProps } from './types';
2
+ /**
3
+ * Hook for managing Veon Prebid ads programmatically
4
+ *
5
+ * @param config - Ad configuration
6
+ * @param eventListener - Optional event listener
7
+ * @returns AdController reference and helper functions
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * function MyComponent() {
12
+ * const { adRef, loadBanner, showBanner } = useVeonPrebidAd(
13
+ * {
14
+ * adType: AdType.BANNER,
15
+ * configId: 'YOUR_CONFIG_ID',
16
+ * adUnitId: 'YOUR_AD_UNIT_ID',
17
+ * width: 300,
18
+ * height: 250,
19
+ * },
20
+ * {
21
+ * onAdLoaded: (data) => console.log('Ad loaded', data),
22
+ * onAdFailed: (error) => console.error('Ad failed', error),
23
+ * }
24
+ * );
25
+ *
26
+ * useEffect(() => {
27
+ * loadBanner();
28
+ * }, []);
29
+ *
30
+ * return (
31
+ * <VeonPrebidAd
32
+ * ref={adRef}
33
+ * {...config}
34
+ * {...eventListener}
35
+ * />
36
+ * );
37
+ * }
38
+ * ```
39
+ */
40
+ export declare function useVeonPrebidAd(config: Pick<VeonPrebidAdProps, 'adType' | 'configId' | 'adUnitId' | 'width' | 'height' | 'refreshInterval'>): {
41
+ adRef: import("react").RefObject<AdController | null>;
42
+ loadBanner: () => void;
43
+ showBanner: () => void;
44
+ hideBanner: () => void;
45
+ loadInterstitial: () => void;
46
+ showInterstitial: () => void;
47
+ hideInterstitial: () => void;
48
+ pauseAuction: () => void;
49
+ resumeAuction: () => void;
50
+ destroyAuction: () => void;
51
+ };
52
+ //# sourceMappingURL=useVeonPrebidAd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVeonPrebidAd.d.ts","sourceRoot":"","sources":["../../../src/useVeonPrebidAd.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,iBAAiB,CAAC;;;;;;;;;;;EAiH7G"}
package/package.json ADDED
@@ -0,0 +1,169 @@
1
+ {
2
+ "name": "setupad-prebid-react-native",
3
+ "version": "0.1.3",
4
+ "description": "Prebid SDK for React Native",
5
+ "main": "./lib/module/index.js",
6
+ "types": "./lib/typescript/src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "source": "./src/index.tsx",
10
+ "types": "./lib/typescript/src/index.d.ts",
11
+ "default": "./lib/module/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "src",
17
+ "lib",
18
+ "android",
19
+ "ios",
20
+ "cpp",
21
+ "*.podspec",
22
+ "react-native.config.js",
23
+ "!ios/build",
24
+ "!android/build",
25
+ "!android/gradle",
26
+ "!android/gradlew",
27
+ "!android/gradlew.bat",
28
+ "!android/local.properties",
29
+ "!**/__tests__",
30
+ "!**/__fixtures__",
31
+ "!**/__mocks__",
32
+ "!**/.*"
33
+ ],
34
+ "scripts": {
35
+ "example": "yarn workspace setupad-prebid-react-native-example",
36
+ "test": "jest",
37
+ "typecheck": "tsc",
38
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
39
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
40
+ "prepare": "bob build",
41
+ "release": "release-it --only-version"
42
+ },
43
+ "keywords": [
44
+ "react-native",
45
+ "ios",
46
+ "android"
47
+ ],
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/veonadtech/veon-prebid-react-native.git"
51
+ },
52
+ "author": "jahonov <asilbekjahonov2001@gmail.com> (https://github.com/JahonovAsilbek)",
53
+ "license": "MIT",
54
+ "bugs": {
55
+ "url": "https://github.com/veonadtech/veon-prebid-react-native/issues"
56
+ },
57
+ "homepage": "https://github.com/veonadtech/veon-prebid-react-native#readme",
58
+ "publishConfig": {
59
+ "registry": "https://registry.npmjs.org/"
60
+ },
61
+ "devDependencies": {
62
+ "@commitlint/config-conventional": "^19.8.1",
63
+ "@eslint/compat": "^1.3.2",
64
+ "@eslint/eslintrc": "^3.3.1",
65
+ "@eslint/js": "^9.35.0",
66
+ "@evilmartians/lefthook": "^1.12.3",
67
+ "@react-native-community/cli": "20.0.1",
68
+ "@react-native/babel-preset": "0.81.1",
69
+ "@react-native/eslint-config": "^0.81.1",
70
+ "@release-it/conventional-changelog": "^10.0.1",
71
+ "@types/jest": "^29.5.14",
72
+ "@types/react": "^19.1.0",
73
+ "commitlint": "^19.8.1",
74
+ "del-cli": "^6.0.0",
75
+ "eslint": "^9.35.0",
76
+ "eslint-config-prettier": "^10.1.8",
77
+ "eslint-plugin-prettier": "^5.5.4",
78
+ "jest": "^29.7.0",
79
+ "prettier": "^3.6.2",
80
+ "react": "19.1.0",
81
+ "react-native": "0.81.1",
82
+ "react-native-builder-bob": "^0.40.14",
83
+ "release-it": "^19.0.4",
84
+ "turbo": "^2.5.6",
85
+ "typescript": "^5.9.2"
86
+ },
87
+ "peerDependencies": {
88
+ "react": ">=18.0.0",
89
+ "react-native": ">=0.76.0"
90
+ },
91
+ "workspaces": [
92
+ "example"
93
+ ],
94
+ "packageManager": "yarn@3.6.1",
95
+ "jest": {
96
+ "preset": "react-native",
97
+ "modulePathIgnorePatterns": [
98
+ "<rootDir>/example/node_modules",
99
+ "<rootDir>/lib/"
100
+ ]
101
+ },
102
+ "commitlint": {
103
+ "extends": [
104
+ "@commitlint/config-conventional"
105
+ ]
106
+ },
107
+ "release-it": {
108
+ "git": {
109
+ "commitMessage": "chore: release ${version}",
110
+ "tagName": "v${version}"
111
+ },
112
+ "npm": {
113
+ "publish": true
114
+ },
115
+ "github": {
116
+ "release": true
117
+ },
118
+ "plugins": {
119
+ "@release-it/conventional-changelog": {
120
+ "preset": {
121
+ "name": "angular"
122
+ }
123
+ }
124
+ }
125
+ },
126
+ "prettier": {
127
+ "quoteProps": "consistent",
128
+ "singleQuote": true,
129
+ "tabWidth": 2,
130
+ "trailingComma": "es5",
131
+ "useTabs": false
132
+ },
133
+ "react-native-builder-bob": {
134
+ "source": "src",
135
+ "output": "lib",
136
+ "targets": [
137
+ [
138
+ "module",
139
+ {
140
+ "esm": true
141
+ }
142
+ ],
143
+ [
144
+ "typescript",
145
+ {
146
+ "project": "tsconfig.build.json"
147
+ }
148
+ ]
149
+ ]
150
+ },
151
+ "codegenConfig": {
152
+ "name": "VeonPrebidReactNativeViewSpec",
153
+ "type": "all",
154
+ "jsSrcsDir": "src",
155
+ "android": {
156
+ "javaPackageName": "com.setupadprebidreactnative"
157
+ },
158
+ "ios": {
159
+ "componentProvider": {
160
+ "VeonPrebidReactNativeView": "VeonPrebidReactNativeView"
161
+ }
162
+ }
163
+ },
164
+ "create-react-native-library": {
165
+ "languages": "kotlin-objc",
166
+ "type": "fabric-view",
167
+ "version": "0.54.8"
168
+ }
169
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Local type definitions for React Native Codegen types
3
+ * This file provides type definitions when react-native/Libraries/Types/CodegenTypes is not available
4
+ */
5
+
6
+ declare module 'react-native/Libraries/Types/CodegenTypes' {
7
+ /**
8
+ * Int32 type for codegen
9
+ */
10
+ export type Int32 = number;
11
+
12
+ /**
13
+ * Direct event handler type for codegen
14
+ */
15
+ export type DirectEventHandler<T> = (event: { nativeEvent: T }) => void;
16
+ }
@@ -0,0 +1,25 @@
1
+ import type { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
2
+
3
+ export interface VeonPrebidCommands {
4
+ readonly loadBanner: Int32;
5
+ readonly showBanner: Int32;
6
+ readonly hideBanner: Int32;
7
+ readonly loadInterstitial: Int32;
8
+ readonly showInterstitial: Int32;
9
+ readonly hideInterstitial: Int32;
10
+ readonly pauseAuction: Int32;
11
+ readonly resumeAuction: Int32;
12
+ readonly destroyAuction: Int32;
13
+ }
14
+
15
+ export const VeonPrebidCommands: VeonPrebidCommands = {
16
+ loadBanner: 1,
17
+ showBanner: 2,
18
+ hideBanner: 3,
19
+ loadInterstitial: 4,
20
+ showInterstitial: 5,
21
+ hideInterstitial: 6,
22
+ pauseAuction: 7,
23
+ resumeAuction: 8,
24
+ destroyAuction: 9,
25
+ };
@@ -0,0 +1,159 @@
1
+ import { useRef, useImperativeHandle, forwardRef, useCallback } from 'react';
2
+ import {
3
+ UIManager,
4
+ findNodeHandle,
5
+ StyleSheet,
6
+ View,
7
+ type ViewStyle,
8
+ } from 'react-native';
9
+ import VeonPrebidReactNativeView from './VeonPrebidReactNativeViewNativeComponent';
10
+ import type { VeonPrebidAdProps, AdController, AdEventData } from './types';
11
+
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
+ const VeonPrebidAd = forwardRef<AdController, VeonPrebidAdProps>(
26
+ (props, ref) => {
27
+ const {
28
+ adType,
29
+ configId,
30
+ adUnitId,
31
+ width,
32
+ height,
33
+ refreshInterval = 30,
34
+ onAdLoaded,
35
+ onAdDisplayed,
36
+ onAdFailed,
37
+ onAdClicked,
38
+ onAdClosed,
39
+ style,
40
+ } = props;
41
+
42
+ const viewRef = useRef<any>(null);
43
+
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
+ useImperativeHandle(
61
+ ref,
62
+ () => ({
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),
78
+ }),
79
+ [executeCommand]
80
+ );
81
+
82
+ const handleAdLoaded = useCallback(
83
+ (event: any) => {
84
+ const data: AdEventData = event.nativeEvent;
85
+ console.log('Ad loaded:', data);
86
+ onAdLoaded?.(data);
87
+ },
88
+ [onAdLoaded]
89
+ );
90
+
91
+ const handleAdDisplayed = useCallback(
92
+ (event: any) => {
93
+ const data: AdEventData = event.nativeEvent;
94
+ console.log('Ad displayed:', data);
95
+ onAdDisplayed?.(data);
96
+ },
97
+ [onAdDisplayed]
98
+ );
99
+
100
+ const handleAdFailed = useCallback(
101
+ (event: any) => {
102
+ const data: AdEventData = event.nativeEvent;
103
+ console.error('Ad failed:', data.error, `SDK: ${data.sdkType}`);
104
+ onAdFailed?.(data);
105
+ },
106
+ [onAdFailed]
107
+ );
108
+
109
+ const handleAdClicked = useCallback(
110
+ (event: any) => {
111
+ const data: AdEventData = event.nativeEvent;
112
+ console.log('Ad clicked:', data);
113
+ onAdClicked?.(data);
114
+ },
115
+ [onAdClicked]
116
+ );
117
+
118
+ const handleAdClosed = useCallback(
119
+ (event: any) => {
120
+ const data: AdEventData = event.nativeEvent;
121
+ console.log('Ad closed:', data);
122
+ onAdClosed?.(data);
123
+ },
124
+ [onAdClosed]
125
+ );
126
+
127
+ const containerStyle: ViewStyle = {
128
+ overflow: 'hidden',
129
+ ...(adType === 'banner' && width && height
130
+ ? { width, height }
131
+ : { width: 1, height: 1 }),
132
+ ...(style || {}),
133
+ };
134
+
135
+ return (
136
+ <View style={containerStyle}>
137
+ <VeonPrebidReactNativeView
138
+ ref={viewRef}
139
+ style={StyleSheet.absoluteFill}
140
+ adType={adType}
141
+ configId={configId}
142
+ adUnitId={adUnitId}
143
+ width={width as number}
144
+ height={height as number}
145
+ refreshInterval={refreshInterval as number}
146
+ onAdLoaded={handleAdLoaded}
147
+ onAdDisplayed={handleAdDisplayed}
148
+ onAdFailed={handleAdFailed}
149
+ onAdClicked={handleAdClicked}
150
+ onAdClosed={handleAdClosed}
151
+ />
152
+ </View>
153
+ );
154
+ }
155
+ );
156
+
157
+ VeonPrebidAd.displayName = 'VeonPrebidAd';
158
+
159
+ export default VeonPrebidAd;