@thealteroffice/react-native-adgeist 0.0.5 → 0.0.7

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 (28) hide show
  1. package/Adgeist.podspec +1 -1
  2. package/README.md +249 -40
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/com/adgeist/implementation/AdgeistModuleImpl.kt +20 -8
  5. package/android/src/newarch/java/com/AdgeistModule.kt +4 -0
  6. package/android/src/oldarch/java/com/AdgeistModule.kt +5 -0
  7. package/ios/AdgeistImpl.swift +14 -4
  8. package/lib/module/NativeAdgeist.js.map +1 -1
  9. package/lib/module/components/AdgeistProvider.js +20 -3
  10. package/lib/module/components/AdgeistProvider.js.map +1 -1
  11. package/lib/module/components/BannerAd.js +24 -10
  12. package/lib/module/components/BannerAd.js.map +1 -1
  13. package/lib/typescript/src/NativeAdgeist.d.ts +1 -0
  14. package/lib/typescript/src/NativeAdgeist.d.ts.map +1 -1
  15. package/lib/typescript/src/components/AdgeistProvider.d.ts +2 -0
  16. package/lib/typescript/src/components/AdgeistProvider.d.ts.map +1 -1
  17. package/lib/typescript/src/components/BannerAd.d.ts +1 -0
  18. package/lib/typescript/src/components/BannerAd.d.ts.map +1 -1
  19. package/package.json +4 -1
  20. package/src/NativeAdgeist.ts +1 -0
  21. package/src/components/AdgeistProvider.tsx +23 -2
  22. package/src/components/BannerAd.tsx +49 -27
  23. package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeAdgeistSpec.java +0 -42
  24. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -36
  25. package/android/app/build/generated/source/codegen/jni/RNAdgeistSpec-generated.cpp +0 -38
  26. package/android/app/build/generated/source/codegen/jni/RNAdgeistSpec.h +0 -31
  27. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI-generated.cpp +0 -45
  28. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI.h +0 -80
package/Adgeist.podspec CHANGED
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
17
17
  s.private_header_files = "ios/**/*.h"
18
18
 
19
- s.dependency "AdgeistKit", '= 0.0.1'
19
+ s.dependency "AdgeistKit", '= 0.0.3'
20
20
 
21
21
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
22
22
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
package/README.md CHANGED
@@ -4,72 +4,281 @@
4
4
 
5
5
  # @thealteroffice/react-native-adgeist
6
6
 
7
- A React Native library that allows publishers can integrate our SDK to connect their ad spaces to the AdGeist marketplace.
8
- Written in Kotlin, Swift and Typescript. It supports both the Old and New React Native architecture.
7
+ A React Native SDK that enables publishers to seamlessly integrate their ad spaces with the AdGeist marketplace. Built with TypeScript, Kotlin, and Swift, supporting both Old and New React Native architectures with TurboModule support.
9
8
 
10
- ## Installation
9
+ ## 🚀 Features
11
10
 
12
- ### React Native Bare
11
+ - **Cross-platform**: iOS and Android support
12
+ - ✅ **Modern Architecture**: Support for both legacy and new React Native architectures
13
+ - ✅ **TurboModule**: Enhanced performance with TurboModule implementation
14
+ - ✅ **TypeScript**: Full TypeScript support with type definitions
15
+ - ✅ **Expo Compatible**: Config plugin for seamless Expo integration
16
+ - ✅ **Analytics**: Built-in impression and click tracking
17
+ - ✅ **Customizable**: Flexible ad display options
13
18
 
14
- You can install the package via npm or yarn:
19
+ ## 📦 Installation
15
20
 
16
- ```sh
17
- npm install @thealteroffice/react-native-adgeist
18
- ```
21
+ ### React Native CLI
19
22
 
20
- ```sh
23
+ ```bash
24
+ npm install @thealteroffice/react-native-adgeist
25
+ # or
21
26
  yarn add @thealteroffice/react-native-adgeist
22
27
  ```
23
28
 
24
- Don't forget to run pod-install.
25
-
26
- ### Expo
29
+ For iOS, run pod install:
30
+ ```bash
31
+ cd ios && pod install
32
+ ```
27
33
 
28
- You can install the package like any other Expo package, using the following command:
34
+ ### Expo Managed Workflow
29
35
 
30
- ```sh
36
+ ```bash
31
37
  npx expo install @thealteroffice/react-native-adgeist
32
38
  ```
33
39
 
34
- ## Setup
40
+ Rebuild your app:
41
+ ```bash
42
+ npx expo prebuild --clean
43
+ ```
44
+
45
+ > **Note**: Requires Expo SDK 50+ and Kotlin template support.
35
46
 
36
- ### Expo
47
+ ## 🔧 Setup & Configuration
37
48
 
38
- Simply add the library plugin to your `app.json` file:
49
+ ### Basic Setup
39
50
 
40
- ```json
41
- {
42
- "expo": {
43
- "plugins": ["@thealteroffice/react-native-adgeist"]
44
- }
51
+ Wrap your app with `AdgeistProvider` to configure global settings:
52
+
53
+ ```tsx
54
+ import React from 'react';
55
+ import { AdgeistProvider, BannerAd } from '@thealteroffice/react-native-adgeist';
56
+
57
+ export default function App() {
58
+ return (
59
+ <AdgeistProvider
60
+ publisherId="your-publisher-id"
61
+ apiKey="your-api-key"
62
+ domain="your-domain"
63
+ isTestEnvironment="your-environment"
64
+ >
65
+ <YourAppContent />
66
+ </AdgeistProvider>
67
+ );
45
68
  }
46
69
  ```
47
70
 
48
- This way, Expo will handle the native setup for you during `prebuild`. You can prebuild using
71
+ ### Environment Configuration
49
72
 
50
- ```sh
51
- npx expo prebuild --clean
73
+ Set `isTestEnvironment` based on your app's environment:
74
+
75
+ ```tsx
76
+ const isTestMode = __DEV__ || process.env.NODE_ENV === 'development';
77
+
78
+ <AdgeistProvider
79
+ publisherId="your-publisher-id"
80
+ apiKey="your-api-key"
81
+ domain="your-domain"
82
+ isTestEnvironment={isTestMode}
83
+ >
52
84
  ```
53
85
 
54
- > Note: only SDK 50 and above are supported, the plugin is configured to handle only the kotlin template.
86
+ ## 📱 Components
87
+
88
+ ### AdgeistProvider
89
+
90
+ The root provider component that configures the SDK globally.
91
+
92
+ #### Props
55
93
 
56
- ## Usage
94
+ | Prop | Type | Required | Default | Description |
95
+ |------|------|----------|---------|-------------|
96
+ | `children` | `React.ReactNode` | ✅ | - | Child components |
97
+ | `publisherId` | `string` | ✅ | - | Your publisher ID from AdGeist dashboard |
98
+ | `apiKey` | `string` | ✅ | - | Your API key from AdGeist dashboard |
99
+ | `domain` | `string` | ✅ | - | Your registered domain (e.g., "https://adgeist.ai") |
100
+ | `isTestEnvironment` | `boolean` | ✅ | - | Enable test mode for development |
57
101
 
58
- ```js
102
+ #### Example
103
+
104
+ ```tsx
105
+ <AdgeistProvider
106
+ publisherId="67f8ad1350ff1e0870da3f5b"
107
+ apiKey="7f6b3361bd6d804edfb40cecf3f42e5ebc0b11bd88d96c8a6d64188b93447ad9"
108
+ domain="https://adgeist.ai"
109
+ isTestEnvironment={false}
110
+ >
111
+ <App />
112
+ </AdgeistProvider>
113
+ ```
114
+
115
+ ### BannerAd
116
+
117
+ Display banner advertisements in your app.
118
+
119
+ #### Props
120
+
121
+ | Prop | Type | Required | Default | Description |
122
+ |------|------|----------|---------|-------------|
123
+ | `dataAdSlot` | `string` | ✅ | - | Ad slot ID from your AdGeist dashboard |
124
+ | `width` | `number` | ❌ | Device width | Width of the ad banner |
125
+ | `height` | `number` | ❌ | `300` | Height of the ad banner |
126
+
127
+ #### Example
128
+
129
+ ```tsx
59
130
  import { BannerAd } from '@thealteroffice/react-native-adgeist';
60
- import { BottomBannerAd } from '@thealteroffice/react-native-adgeist';
61
131
 
62
- // ...
132
+ function MyScreen() {
133
+ return (
134
+ <View>
135
+ <BannerAd
136
+ dataAdSlot="686149fac1fd09fff371e53c"
137
+ width={350}
138
+ height={250}
139
+ />
140
+ </View>
141
+ );
142
+ }
143
+ ```
144
+
145
+ ## 🔧 Native Module API
146
+
147
+ For advanced use cases, you can directly use the native module:
148
+
149
+ ```tsx
150
+ import Adgeist from '@thealteroffice/react-native-adgeist/src/NativeAdgeist';
151
+
152
+ // Fetch creative data
153
+ const adData = await Adgeist.fetchCreative(
154
+ apiKey,
155
+ origin,
156
+ adSpaceId,
157
+ publisherId,
158
+ isTestEnvironment
159
+ );
160
+
161
+ // Send analytics
162
+ await Adgeist.sendCreativeAnalytic(
163
+ campaignId,
164
+ adSpaceId,
165
+ publisherId,
166
+ eventType, // 'IMPRESSION' | 'CLICK'
167
+ origin,
168
+ apiKey,
169
+ bidId,
170
+ isTestEnvironment
171
+ );
172
+ ```
173
+
174
+ ### Native Module Methods
175
+
176
+ #### `fetchCreative`
177
+
178
+ Fetches ad creative data from the AdGeist API.
179
+
180
+ | Parameter | Type | Required | Description |
181
+ |-----------|------|----------|-------------|
182
+ | `apiKey` | `string` | ✅ | Your API key |
183
+ | `origin` | `string` | ✅ | App domain/origin |
184
+ | `adSpaceId` | `string` | ✅ | Ad space identifier |
185
+ | `publisherId` | `string` | ✅ | Publisher identifier |
186
+ | `isTestEnvironment` | `boolean` | ✅ | Test mode flag |
187
+
188
+ **Returns**: `Promise<AdData>`
189
+
190
+ #### `sendCreativeAnalytic`
191
+
192
+ Sends analytics data for ad interactions.
193
+
194
+ | Parameter | Type | Required | Description |
195
+ |-----------|------|----------|-------------|
196
+ | `campaignId` | `string` | ✅ | Campaign identifier |
197
+ | `adSpaceId` | `string` | ✅ | Ad space identifier |
198
+ | `publisherId` | `string` | ✅ | Publisher identifier |
199
+ | `eventType` | `string` | ✅ | Event type ('IMPRESSION' or 'CLICK') |
200
+ | `origin` | `string` | ✅ | App domain/origin |
201
+ | `apiKey` | `string` | ✅ | Your API key |
202
+ | `bidId` | `string` | ✅ | Bid identifier |
203
+ | `isTestEnvironment` | `boolean` | ✅ | Test mode flag |
204
+
205
+ **Returns**: `Promise<Object>`
206
+
207
+ ## 📊 Data Types
208
+
209
+ ### AdData Interface
210
+
211
+ ```tsx
212
+ interface AdData {
213
+ id: string;
214
+ bidId: string;
215
+ cur: string;
216
+ seatBid: SeatBid[];
217
+ }
218
+
219
+ interface SeatBid {
220
+ bidId: string;
221
+ bid: Bid[];
222
+ }
63
223
 
64
- <BannerAd
65
- dataPublisherId={PUBLISHER_ID}
66
- dataAdSlot={ADSPACE_ID}
67
- width={400}
68
- height={300}
69
- />
224
+ interface Bid {
225
+ id: string;
226
+ impId: string;
227
+ price: number;
228
+ ext: BidExtension;
229
+ }
230
+
231
+ interface BidExtension {
232
+ creativeUrl: string;
233
+ ctaUrl: string;
234
+ creativeTitle: string;
235
+ creativeDescription: string;
236
+ creativeBrandName?: string;
237
+ }
238
+ ```
239
+
240
+ ## 🎨 Customization
241
+
242
+ ### Custom Ad Loader
243
+
244
+ Create your own ad loading component:
245
+
246
+ ```tsx
247
+ import React, { useState, useEffect } from 'react';
248
+ import { useAdgeistContext } from '@thealteroffice/react-native-adgeist';
249
+ import Adgeist from '@thealteroffice/react-native-adgeist/src/NativeAdgeist';
250
+
251
+ function CustomAdLoader({ adSlotId }) {
252
+ const [adData, setAdData] = useState(null);
253
+ const [loading, setLoading] = useState(true);
254
+ const { publisherId, apiKey, domain, isTestEnvironment } = useAdgeistContext();
255
+
256
+ useEffect(() => {
257
+ loadAd();
258
+ }, []);
259
+
260
+ const loadAd = async () => {
261
+ try {
262
+ const response = await Adgeist.fetchCreative(
263
+ apiKey,
264
+ domain,
265
+ adSlotId,
266
+ publisherId,
267
+ isTestEnvironment
268
+ );
269
+ setAdData(response.data);
270
+ } catch (error) {
271
+ console.error('Failed to load ad:', error);
272
+ } finally {
273
+ setLoading(false);
274
+ }
275
+ };
276
+
277
+ if (loading) return <LoadingSpinner />;
278
+ if (!adData) return null;
279
+
280
+ return <YourCustomAdDisplay data={adData} />;
281
+ }
282
+ ```
70
283
 
71
- <BottomBannerAd
72
- dataPublisherId={PUBLISHER_ID}
73
- dataAdSlot={ADSPACE_ID}
74
- />
75
284
  ```
@@ -101,7 +101,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
101
101
 
102
102
  dependencies {
103
103
  implementation "com.facebook.react:react-android"
104
- implementation "ai.adgeist:adgeistkit:0.0.6"
104
+ implementation "ai.adgeist:adgeistkit:0.0.7"
105
105
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
106
106
  }
107
107
 
@@ -5,6 +5,8 @@ import com.facebook.react.bridge.ReactApplicationContext
5
5
  import com.facebook.react.bridge.Arguments
6
6
  import com.facebook.react.bridge.WritableMap
7
7
  import com.adgeistkit.AdgeistCore
8
+ import com.adgeistkit.FetchCreative
9
+ import com.adgeistkit.CreativeAnalytics
8
10
  import com.adgeistkit.CreativeDataModel
9
11
  import com.adgeistkit.BidResponseData
10
12
  import com.adgeistkit.SeatBid
@@ -14,33 +16,43 @@ import com.adgeistkit.BidExtension
14
16
 
15
17
  class AdgeistModuleImpl internal constructor(private val context: ReactApplicationContext) {
16
18
 
17
- private val adgeistInstanceFromLibrary = AdgeistCore.initialize(context.applicationContext)
18
- private val getAd = adgeistInstanceFromLibrary.getCreative()
19
- private val postCreativeAnalytic = adgeistInstanceFromLibrary.postCreativeAnalytics()
19
+ private var adgeistInstance: AdgeistCore? = null
20
+ private var getAd: FetchCreative? = null
21
+ private var postCreativeAnalytic: CreativeAnalytics? = null
22
+
23
+ fun initializeSdk(customDomain: String?, promise: Promise) {
24
+ try {
25
+ adgeistInstance = AdgeistCore.initialize(context.applicationContext, customDomain)
26
+ getAd = adgeistInstance?.getCreative()
27
+ postCreativeAnalytic = adgeistInstance?.postCreativeAnalytics()
28
+ promise.resolve("SDK initialized with domain: ${customDomain ?: "default"}")
29
+ } catch (e: Exception) {
30
+ promise.reject("INIT_FAILED", "SDK initialization failed", e)
31
+ }
32
+ }
20
33
 
21
34
  fun fetchCreative(apiKey: String, origin: String, adSpaceId: String, publisherId: String, isTestEnvironment: Boolean, promise: Promise) {
22
- getAd.fetchCreative(apiKey, origin, adSpaceId, publisherId, isTestEnvironment) { adData ->
35
+ getAd?.fetchCreative(apiKey, origin, adSpaceId, publisherId, isTestEnvironment) { adData ->
23
36
  if (adData != null) {
24
37
  promise.resolve(adData.toWritableMap())
25
38
  } else {
26
39
  promise.reject("NO_AD", "Ad data not available")
27
40
  }
28
- }
41
+ } ?: promise.reject("NOT_INITIALIZED", "SDK not initialized")
29
42
  }
30
43
 
31
44
  fun sendCreativeAnalytic(campaignId: String, adSpaceId: String, publisherId: String, eventType: String, origin: String, apiKey: String, bidId: String, isTestEnvironment: Boolean = true, promise: Promise) {
32
- postCreativeAnalytic.sendTrackingData(campaignId, adSpaceId, publisherId, eventType, origin, apiKey, bidId, isTestEnvironment) { adData ->
45
+ postCreativeAnalytic?.sendTrackingData(campaignId, adSpaceId, publisherId, eventType, origin, apiKey, bidId, isTestEnvironment) { adData ->
33
46
  if (adData != null) {
34
47
  promise.resolve(adData)
35
48
  } else {
36
49
  promise.reject("NO_AD", "Couldn't find the campaign to update analytics")
37
50
  }
38
- }
51
+ } ?: promise.reject("NOT_INITIALIZED", "SDK not initialized")
39
52
  }
40
53
 
41
54
  companion object {
42
55
  const val NAME = "Adgeist"
43
-
44
56
  }
45
57
  }
46
58
 
@@ -11,6 +11,10 @@ class AdgeistModule internal constructor(reactContext: ReactApplicationContext)
11
11
 
12
12
  override fun getName(): String = AdgeistModuleImpl.NAME
13
13
 
14
+ override fun initializeSdk(customDomain: String, promise: Promise) {
15
+ implementation.initializeSdk(customDomain, promise)
16
+ }
17
+
14
18
  override fun fetchCreative(apiKey: String, origin: String, adSpaceId: String, publisherId: String, isTestEnvironment: Boolean, promise: Promise) {
15
19
  implementation.fetchCreative(apiKey, origin, adSpaceId, publisherId, isTestEnvironment, promise)
16
20
  }
@@ -13,6 +13,11 @@ class AdgeistModule internal constructor(reactContext: ReactApplicationContext)
13
13
 
14
14
  override fun getName(): String = AdgeistModuleImpl.NAME
15
15
 
16
+ @ReactMethod
17
+ fun initializeSdk(customDomain: String, promise: Promise) {
18
+ implementation.initializeSdk(customDomain, promise)
19
+ }
20
+
16
21
  @ReactMethod
17
22
  fun fetchCreative(apiKey: String, origin: String, adSpaceId: String, publisherId: String, isTestEnvironment: Boolean, promise: Promise) {
18
23
  implementation.fetchCreative(apiKey, origin, adSpaceId, publisherId, isTestEnvironment, promise)
@@ -9,11 +9,17 @@ import React
9
9
  origin: String,
10
10
  adSpaceId: String,
11
11
  publisherId: String,
12
- isTestEnvironment: Boolean,
12
+ isTestEnvironment: Bool,
13
13
  resolver: @escaping RCTPromiseResolveBlock,
14
14
  rejecter: @escaping RCTPromiseRejectBlock
15
15
  ) {
16
- AdgeistImpl.adGeist.getCreative().fetchCreative(adSpaceId: adSpaceId, publisherId: publisherId) { creativeData in
16
+ AdgeistImpl.adGeist.getCreative().fetchCreative(
17
+ apiKey: apiKey,
18
+ origin: origin,
19
+ adSpaceId: adSpaceId,
20
+ companyId: publisherId,
21
+ isTestEnvironment: isTestEnvironment
22
+ ) { creativeData in
17
23
  if let creativeData = creativeData {
18
24
  do {
19
25
  let encoder = JSONEncoder()
@@ -40,7 +46,7 @@ import React
40
46
  origin: String,
41
47
  apiKey: String,
42
48
  bidId: String,
43
- isTestEnvironment: Boolean,
49
+ isTestEnvironment: Bool,
44
50
  resolver: @escaping RCTPromiseResolveBlock,
45
51
  rejecter: @escaping RCTPromiseRejectBlock
46
52
  ) {
@@ -48,7 +54,11 @@ import React
48
54
  campaignId: campaignId,
49
55
  adSpaceId: adSpaceId,
50
56
  publisherId: publisherId,
51
- eventType: eventType
57
+ eventType: eventType,
58
+ origin: origin,
59
+ apiKey: apiKey,
60
+ bidId: bidId,
61
+ isTestEnvironment: isTestEnvironment
52
62
  ) { response in
53
63
  if let response = response {
54
64
  resolver(response)
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeAdgeist.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAsBlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeAdgeist.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAuBlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
@@ -1,26 +1,43 @@
1
1
  "use strict";
2
2
 
3
- import React, { createContext, useContext } from 'react';
3
+ import React, { createContext, useContext, useEffect, useState } from 'react';
4
+ import Adgeist from "../NativeAdgeist.js";
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  const AdgeistContext = /*#__PURE__*/createContext({
6
7
  publisherId: '',
7
8
  apiKey: '',
8
9
  domain: '',
9
- isTestEnvironment: true
10
+ isTestEnvironment: true,
11
+ isInitialized: false
10
12
  });
11
13
  export const AdgeistProvider = ({
12
14
  children,
13
15
  publisherId = '',
14
16
  apiKey = '',
15
17
  domain = '',
18
+ customAdgeistApiOrigin = 'bg-services-qa-api.adgeist.ai',
16
19
  isTestEnvironment = true
17
20
  }) => {
21
+ const [isInitialized, setIsInitialized] = useState(false);
22
+ useEffect(() => {
23
+ const initializeAdgeist = async () => {
24
+ try {
25
+ await Adgeist.initializeSdk(customAdgeistApiOrigin);
26
+ setIsInitialized(true);
27
+ } catch (error) {
28
+ console.error('Error initializing Adgeist SDK:', error);
29
+ setIsInitialized(false);
30
+ }
31
+ };
32
+ initializeAdgeist();
33
+ }, [customAdgeistApiOrigin]);
18
34
  return /*#__PURE__*/_jsx(AdgeistContext.Provider, {
19
35
  value: {
20
36
  publisherId,
21
37
  apiKey,
22
38
  domain,
23
- isTestEnvironment
39
+ isTestEnvironment,
40
+ isInitialized
24
41
  },
25
42
  children: children
26
43
  });
@@ -1 +1 @@
1
- {"version":3,"names":["React","createContext","useContext","jsx","_jsx","AdgeistContext","publisherId","apiKey","domain","isTestEnvironment","AdgeistProvider","children","Provider","value","useAdgeistContext"],"sourceRoot":"../../../src","sources":["components/AdgeistProvider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAiBzD,MAAMC,cAAc,gBAAGJ,aAAa,CAAqB;EACvDK,WAAW,EAAE,EAAE;EACfC,MAAM,EAAE,EAAE;EACVC,MAAM,EAAE,EAAE;EACVC,iBAAiB,EAAE;AACrB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAmD,GAAGA,CAAC;EAClEC,QAAQ;EACRL,WAAW,GAAG,EAAE;EAChBC,MAAM,GAAG,EAAE;EACXC,MAAM,GAAG,EAAE;EACXC,iBAAiB,GAAG;AACtB,CAAC,KAAK;EACJ,oBACEL,IAAA,CAACC,cAAc,CAACO,QAAQ;IACtBC,KAAK,EAAE;MAAEP,WAAW;MAAEC,MAAM;MAAEC,MAAM;MAAEC;IAAkB,CAAE;IAAAE,QAAA,EAEzDA;EAAQ,CACc,CAAC;AAE9B,CAAC;AAED,OAAO,MAAMG,iBAAiB,GAAGA,CAAA,KAAMZ,UAAU,CAACG,cAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","createContext","useContext","useEffect","useState","Adgeist","jsx","_jsx","AdgeistContext","publisherId","apiKey","domain","isTestEnvironment","isInitialized","AdgeistProvider","children","customAdgeistApiOrigin","setIsInitialized","initializeAdgeist","initializeSdk","error","console","Provider","value","useAdgeistContext"],"sourceRoot":"../../../src","sources":["components/AdgeistProvider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC7E,OAAOC,OAAO,MAAM,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAmBvC,MAAMC,cAAc,gBAAGP,aAAa,CAAqB;EACvDQ,WAAW,EAAE,EAAE;EACfC,MAAM,EAAE,EAAE;EACVC,MAAM,EAAE,EAAE;EACVC,iBAAiB,EAAE,IAAI;EACvBC,aAAa,EAAE;AACjB,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAmD,GAAGA,CAAC;EAClEC,QAAQ;EACRN,WAAW,GAAG,EAAE;EAChBC,MAAM,GAAG,EAAE;EACXC,MAAM,GAAG,EAAE;EACXK,sBAAsB,GAAG,+BAA+B;EACxDJ,iBAAiB,GAAG;AACtB,CAAC,KAAK;EACJ,MAAM,CAACC,aAAa,EAAEI,gBAAgB,CAAC,GAAGb,QAAQ,CAAC,KAAK,CAAC;EAEzDD,SAAS,CAAC,MAAM;IACd,MAAMe,iBAAiB,GAAG,MAAAA,CAAA,KAAY;MACpC,IAAI;QACF,MAAMb,OAAO,CAACc,aAAa,CAACH,sBAAsB,CAAC;QACnDC,gBAAgB,CAAC,IAAI,CAAC;MACxB,CAAC,CAAC,OAAOG,KAAK,EAAE;QACdC,OAAO,CAACD,KAAK,CAAC,iCAAiC,EAAEA,KAAK,CAAC;QACvDH,gBAAgB,CAAC,KAAK,CAAC;MACzB;IACF,CAAC;IAEDC,iBAAiB,CAAC,CAAC;EACrB,CAAC,EAAE,CAACF,sBAAsB,CAAC,CAAC;EAE5B,oBACET,IAAA,CAACC,cAAc,CAACc,QAAQ;IACtBC,KAAK,EAAE;MAAEd,WAAW;MAAEC,MAAM;MAAEC,MAAM;MAAEC,iBAAiB;MAAEC;IAAc,CAAE;IAAAE,QAAA,EAExEA;EAAQ,CACc,CAAC;AAE9B,CAAC;AAED,OAAO,MAAMS,iBAAiB,GAAGA,CAAA,KAAMtB,UAAU,CAACM,cAAc,CAAC","ignoreList":[]}
@@ -4,13 +4,16 @@ import React, { useEffect, useState } from 'react';
4
4
  import { Dimensions, Image, Linking, StyleSheet, Text, View, TouchableWithoutFeedback, ActivityIndicator } from 'react-native';
5
5
  import Adgeist from "../NativeAdgeist.js";
6
6
  import { useAdgeistContext } from "./AdgeistProvider.js";
7
+ import Video from 'react-native-video';
7
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
9
  export const BannerAd = ({
9
- dataAdSlot
10
+ dataAdSlot,
11
+ dataSlotType = 'banner'
10
12
  }) => {
11
13
  const [adData, setAdData] = useState(null);
12
14
  const [isLoading, setIsLoading] = useState(false);
13
15
  const {
16
+ isInitialized,
14
17
  publisherId,
15
18
  apiKey,
16
19
  domain,
@@ -20,19 +23,21 @@ export const BannerAd = ({
20
23
  useEffect(() => {
21
24
  (async () => {
22
25
  try {
23
- setIsLoading(true);
24
- const response = await Adgeist.fetchCreative(apiKey, domain, dataAdSlot, publisherId, isTestEnvironment);
25
- const creative = response;
26
- setAdData(creative.data);
27
- setIsLoading(false);
28
- if (creative.data.seatBid.length > 0) {
29
- await Adgeist.sendCreativeAnalytic(creative.data.seatBid?.[0]?.bid?.[0]?.id || '', dataAdSlot, publisherId, 'IMPRESSION', domain, apiKey, creative.data.id, isTestEnvironment);
26
+ if (isInitialized) {
27
+ setIsLoading(true);
28
+ const response = await Adgeist.fetchCreative(apiKey, domain, dataAdSlot, publisherId, isTestEnvironment);
29
+ const creative = response;
30
+ setAdData(creative.data);
31
+ setIsLoading(false);
32
+ if (creative.data.seatBid.length > 0) {
33
+ await Adgeist.sendCreativeAnalytic(creative.data.seatBid?.[0]?.bid?.[0]?.id || '', dataAdSlot, publisherId, 'IMPRESSION', domain, apiKey, creative.data.id, isTestEnvironment);
34
+ }
30
35
  }
31
36
  } catch (error) {
32
37
  console.error('Ad load failed:', error);
33
38
  }
34
39
  })();
35
- }, [publisherId, dataAdSlot, apiKey, domain, isTestEnvironment]);
40
+ }, [isInitialized, publisherId, dataAdSlot, apiKey, domain, isTestEnvironment]);
36
41
  const handleClick = async () => {
37
42
  if (adData && adData?.seatBid.length > 0) {
38
43
  await Adgeist.sendCreativeAnalytic(adData?.seatBid?.[0]?.bid?.[0]?.id || '', dataAdSlot, publisherId, 'CLICK', domain, apiKey, adData.id, isTestEnvironment);
@@ -54,7 +59,7 @@ export const BannerAd = ({
54
59
  accessibilityLabel: "Ad Banner",
55
60
  children: /*#__PURE__*/_jsxs(View, {
56
61
  style: styles.adContainer,
57
- children: [/*#__PURE__*/_jsx(Image, {
62
+ children: [dataSlotType == 'banner' ? /*#__PURE__*/_jsx(Image, {
58
63
  style: [styles.creative, {
59
64
  width: '100%',
60
65
  height: 300
@@ -62,6 +67,15 @@ export const BannerAd = ({
62
67
  source: {
63
68
  uri: creativeData.creativeUrl
64
69
  }
70
+ }) : /*#__PURE__*/_jsx(Video, {
71
+ source: {
72
+ uri: creativeData.creativeUrl
73
+ },
74
+ style: {
75
+ width: '100%',
76
+ aspectRatio: 16 / 9,
77
+ height: 300
78
+ }
65
79
  }), /*#__PURE__*/_jsxs(View, {
66
80
  style: styles.adContent,
67
81
  children: [/*#__PURE__*/_jsxs(View, {
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useState","Dimensions","Image","Linking","StyleSheet","Text","View","TouchableWithoutFeedback","ActivityIndicator","Adgeist","useAdgeistContext","jsx","_jsx","jsxs","_jsxs","BannerAd","dataAdSlot","adData","setAdData","isLoading","setIsLoading","publisherId","apiKey","domain","isTestEnvironment","creativeData","seatBid","bid","ext","response","fetchCreative","creative","data","length","sendCreativeAnalytic","id","error","console","handleClick","openURL","ctaUrl","catch","err","style","styles","loadingOverlayContainer","children","size","color","creativeUrl","accessible","accessibilityLabel","adContainer","width","height","source","uri","adContent","contentContainer","title","numberOfLines","ellipsizeMode","creativeTitle","description","creativeDescription","brandName","creativeBrandName","onPress","linkButton","create","get","backgroundColor","borderRadius","alignItems","justifyContent","resizeMode","borderTopLeftRadius","borderTopRightRadius","flexDirection","paddingVertical","paddingHorizontal","borderBottomLeftRadius","borderBottomRightRadius","fontSize","fontWeight","opacity","marginTop"],"sourceRoot":"../../../src","sources":["components/BannerAd.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SACEC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,UAAU,EACVC,IAAI,EACJC,IAAI,EACJC,wBAAwB,EACxBC,iBAAiB,QACZ,cAAc;AACrB,OAAOC,OAAO,MAAM,qBAAkB;AACtC,SAASC,iBAAiB,QAAQ,sBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAA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AU,CAACqE,GAAG,CAAC,QAAQ,CAAC,CAACjB,KAAK;IACrCkB,eAAe,EAAE,OAAO;IACxBC,YAAY,EAAE;EAChB,CAAC;EACD3B,uBAAuB,EAAE;IACvBQ,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,GAAG;IACXmB,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACD3C,QAAQ,EAAE;IACR4C,UAAU,EAAE,OAAO;IACnBC,mBAAmB,EAAE,CAAC;IACtBC,oBAAoB,EAAE;EACxB,CAAC;EACDpB,SAAS,EAAE;IACTJ,KAAK,EAAE,MAAM;IACbkB,eAAe,EAAE,OAAO;IACxBO,aAAa,EAAE,KAAK;IACpBJ,cAAc,EAAE,eAAe;IAC/BK,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE,EAAE;IACrBP,UAAU,EAAE,QAAQ;IACpBQ,sBAAsB,EAAE,CAAC;IACzBC,uBAAuB,EAAE;EAC3B,CAAC;EACDxB,gBAAgB,EAAE;IAChBL,KAAK,EAAEpD,UAAU,CAACqE,GAAG,CAAC,QAAQ,CAAC,CAACjB,KAAK,GAAG;EAC1C,CAAC;EACDM,KAAK,EAAE;IACLX,KAAK,EAAE,OAAO;IACdmC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDrB,WAAW,EAAE;IACXf,KAAK,EAAE,OAAO;IACdmC,QAAQ,EAAE;EACZ,CAAC;EACDlB,SAAS,EAAE;IACTjB,KAAK,EAAE,OAAO;IACdmC,QAAQ,EAAE,EAAE;IACZE,OAAO,EAAE,GAAG;IACZC,SAAS,EAAE,CAAC;IACZF,UAAU,EAAE;EACd,CAAC;EACDhB,UAAU,EAAE;IACVf,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useEffect","useState","Dimensions","Image","Linking","StyleSheet","Text","View","TouchableWithoutFeedback","ActivityIndicator","Adgeist","useAdgeistContext","Video","jsx","_jsx","jsxs","_jsxs","BannerAd","dataAdSlot","dataSlotType","adData","setAdData","isLoading","setIsLoading","isInitialized","publisherId","apiKey","domain","isTestEnvironment","creativeData","seatBid","bid","ext","response","fetchCreative","creative","data","length","sendCreativeAnalytic","id","error","console","handleClick","openURL","ctaUrl","catch","err","style","styles","loadingOverlayContainer","children","size","color","creativeUrl","accessible","accessibilityLabel","adContainer","width","height","source","uri","aspectRatio","adContent","contentContainer","title","numberOfLines","ellipsizeMode","creativeTitle","description","creativeDescription","brandName","creativeBrandName","onPress","linkButton","create","get","backgroundColor","borderRadius","alignItems","justifyContent","resizeMode","borderTopLeftRadius","borderTopRightRadius","flexDirection","paddingVertical","paddingHorizontal","borderBottomLeftRadius","borderBottomRightRadius","fontSize","fontWeight","opacity","marginTop"],"sourceRoot":"../../../src","sources":["components/BannerAd.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SACEC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,UAAU,EACVC,IAAI,EACJC,IAAI,EACJC,wBAAwB,EACxBC,iBAAiB,QACZ,cAAc;AACrB,OAAOC,OAAO,MAAM,qBAAkB;AACtC,SAASC,iBAAiB,QAAQ,sBAAmB;AACrD,OAAOC,KAAK,MAAM,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAmCvC,OAAO,MAAMC,QAAiC,GAAGA,CAAC;EAChDC,UAAU;EACVC,YAAY,GAAG;AACjB,CAAC,KAAK;EACJ,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGpB,QAAQ,CAAgB,IAAI,CAAC;EACzD,MAAM,CAACqB,SAAS,EAAEC,YAAY,CAAC,GAAGtB,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM;IAAEuB,aAAa;IAAEC,WAAW;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAkB,CAAC,G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yE,GAAG,CAAC,QAAQ,CAAC,CAAClB,KAAK;IACrCmB,eAAe,EAAE,OAAO;IACxBC,YAAY,EAAE;EAChB,CAAC;EACD5B,uBAAuB,EAAE;IACvBQ,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,GAAG;IACXoB,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACD5C,QAAQ,EAAE;IACR6C,UAAU,EAAE,OAAO;IACnBC,mBAAmB,EAAE,CAAC;IACtBC,oBAAoB,EAAE;EACxB,CAAC;EACDpB,SAAS,EAAE;IACTL,KAAK,EAAE,MAAM;IACbmB,eAAe,EAAE,OAAO;IACxBO,aAAa,EAAE,KAAK;IACpBJ,cAAc,EAAE,eAAe;IAC/BK,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE,EAAE;IACrBP,UAAU,EAAE,QAAQ;IACpBQ,sBAAsB,EAAE,CAAC;IACzBC,uBAAuB,EAAE;EAC3B,CAAC;EACDxB,gBAAgB,EAAE;IAChBN,KAAK,EAAEvD,UAAU,CAACyE,GAAG,CAAC,QAAQ,CAAC,CAAClB,KAAK,GAAG;EAC1C,CAAC;EACDO,KAAK,EAAE;IACLZ,KAAK,EAAE,OAAO;IACdoC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDrB,WAAW,EAAE;IACXhB,KAAK,EAAE,OAAO;IACdoC,QAAQ,EAAE;EACZ,CAAC;EACDlB,SAAS,EAAE;IACTlB,KAAK,EAAE,OAAO;IACdoC,QAAQ,EAAE,EAAE;IACZE,OAAO,EAAE,GAAG;IACZC,SAAS,EAAE,CAAC;IACZF,UAAU,EAAE;EACd,CAAC;EACDhB,UAAU,EAAE;IACVhB,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  import type { TurboModule } from 'react-native';
2
2
  export interface Spec extends TurboModule {
3
+ initializeSdk(customDomain: string): Promise<boolean>;
3
4
  fetchCreative(apiKey: string, origin: string, adSpaceId: string, publisherId: string, isTestEnvironment: boolean): Promise<Object>;
4
5
  sendCreativeAnalytic(campaignId: string, adSpaceId: string, publisherId: string, eventType: string, origin: string, apiKey: string, bidId: string, isTestEnvironment: boolean): Promise<Object>;
5
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NativeAdgeist.d.ts","sourceRoot":"","sources":["../../../src/NativeAdgeist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,aAAa,CACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,OAAO,GACzB,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,oBAAoB,CAClB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,iBAAiB,EAAE,OAAO,GACzB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;;AAED,wBAAiE"}
1
+ {"version":3,"file":"NativeAdgeist.d.ts","sourceRoot":"","sources":["../../../src/NativeAdgeist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtD,aAAa,CACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,OAAO,GACzB,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,oBAAoB,CAClB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,iBAAiB,EAAE,OAAO,GACzB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;;AAED,wBAAiE"}
@@ -4,9 +4,11 @@ interface AdgeistContextType {
4
4
  apiKey: string;
5
5
  domain: string;
6
6
  isTestEnvironment: boolean;
7
+ isInitialized: boolean;
7
8
  }
8
9
  interface AdgeistProviderPropsType {
9
10
  children: React.ReactNode;
11
+ customAdgeistApiOrigin?: string;
10
12
  publisherId: string;
11
13
  apiKey: string;
12
14
  domain: string;
@@ -1 +1 @@
1
- {"version":3,"file":"AdgeistProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/AdgeistProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,UAAU,kBAAkB;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,UAAU,wBAAwB;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AASD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAc9D,CAAC;AAEF,eAAO,MAAM,iBAAiB,0BAAmC,CAAC"}
1
+ {"version":3,"file":"AdgeistProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/AdgeistProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAG9E,UAAU,kBAAkB;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,UAAU,wBAAwB;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAUD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA+B9D,CAAC;AAEF,eAAO,MAAM,iBAAiB,0BAAmC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  interface AdBannerTypes {
3
3
  dataAdSlot: string;
4
+ dataSlotType: 'banner' | 'video';
4
5
  width: number;
5
6
  height: number;
6
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BannerAd.d.ts","sourceRoot":"","sources":["../../../../src/components/BannerAd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAwCnD,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAqH5C,CAAC"}
1
+ {"version":3,"file":"BannerAd.d.ts","sourceRoot":"","sources":["../../../../src/components/BannerAd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAyCnD,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,QAAQ,GAAG,OAAO,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAyI5C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thealteroffice/react-native-adgeist",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Publishers can integrate our SDK to connect their ad spaces to the AdGeist marketplace.",
5
5
  "main": "./lib/module/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -167,5 +167,8 @@
167
167
  "type": "turbo-module",
168
168
  "languages": "kotlin-objc",
169
169
  "version": "0.49.8"
170
+ },
171
+ "dependencies": {
172
+ "react-native-video": "^6.16.0"
170
173
  }
171
174
  }
@@ -2,6 +2,7 @@ import type { TurboModule } from 'react-native';
2
2
  import { TurboModuleRegistry } from 'react-native';
3
3
 
4
4
  export interface Spec extends TurboModule {
5
+ initializeSdk(customDomain: string): Promise<boolean>;
5
6
  fetchCreative(
6
7
  apiKey: string,
7
8
  origin: string,
@@ -1,14 +1,17 @@
1
- import React, { createContext, useContext } from 'react';
1
+ import React, { createContext, useContext, useEffect, useState } from 'react';
2
+ import Adgeist from '../NativeAdgeist';
2
3
 
3
4
  interface AdgeistContextType {
4
5
  publisherId: string;
5
6
  apiKey: string;
6
7
  domain: string;
7
8
  isTestEnvironment: boolean;
9
+ isInitialized: boolean;
8
10
  }
9
11
 
10
12
  interface AdgeistProviderPropsType {
11
13
  children: React.ReactNode;
14
+ customAdgeistApiOrigin?: string;
12
15
  publisherId: string;
13
16
  apiKey: string;
14
17
  domain: string;
@@ -20,6 +23,7 @@ const AdgeistContext = createContext<AdgeistContextType>({
20
23
  apiKey: '',
21
24
  domain: '',
22
25
  isTestEnvironment: true,
26
+ isInitialized: false,
23
27
  });
24
28
 
25
29
  export const AdgeistProvider: React.FC<AdgeistProviderPropsType> = ({
@@ -27,11 +31,28 @@ export const AdgeistProvider: React.FC<AdgeistProviderPropsType> = ({
27
31
  publisherId = '',
28
32
  apiKey = '',
29
33
  domain = '',
34
+ customAdgeistApiOrigin = 'bg-services-qa-api.adgeist.ai',
30
35
  isTestEnvironment = true,
31
36
  }) => {
37
+ const [isInitialized, setIsInitialized] = useState(false);
38
+
39
+ useEffect(() => {
40
+ const initializeAdgeist = async () => {
41
+ try {
42
+ await Adgeist.initializeSdk(customAdgeistApiOrigin);
43
+ setIsInitialized(true);
44
+ } catch (error) {
45
+ console.error('Error initializing Adgeist SDK:', error);
46
+ setIsInitialized(false);
47
+ }
48
+ };
49
+
50
+ initializeAdgeist();
51
+ }, [customAdgeistApiOrigin]);
52
+
32
53
  return (
33
54
  <AdgeistContext.Provider
34
- value={{ publisherId, apiKey, domain, isTestEnvironment }}
55
+ value={{ publisherId, apiKey, domain, isTestEnvironment, isInitialized }}
35
56
  >
36
57
  {children}
37
58
  </AdgeistContext.Provider>
@@ -11,6 +11,7 @@ import {
11
11
  } from 'react-native';
12
12
  import Adgeist from '../NativeAdgeist';
13
13
  import { useAdgeistContext } from './AdgeistProvider';
14
+ import Video from 'react-native-video';
14
15
 
15
16
  interface AdData {
16
17
  id: string;
@@ -40,14 +41,18 @@ interface BidExtension {
40
41
  }
41
42
  interface AdBannerTypes {
42
43
  dataAdSlot: string;
44
+ dataSlotType: 'banner' | 'video';
43
45
  width: number;
44
46
  height: number;
45
47
  }
46
48
 
47
- export const BannerAd: React.FC<AdBannerTypes> = ({ dataAdSlot }) => {
49
+ export const BannerAd: React.FC<AdBannerTypes> = ({
50
+ dataAdSlot,
51
+ dataSlotType = 'banner',
52
+ }) => {
48
53
  const [adData, setAdData] = useState<AdData | null>(null);
49
54
  const [isLoading, setIsLoading] = useState(false);
50
- const { publisherId, apiKey, domain, isTestEnvironment } =
55
+ const { isInitialized, publisherId, apiKey, domain, isTestEnvironment } =
51
56
  useAdgeistContext();
52
57
 
53
58
  const creativeData = adData?.seatBid?.[0]?.bid?.[0]?.ext as BidExtension;
@@ -55,36 +60,45 @@ export const BannerAd: React.FC<AdBannerTypes> = ({ dataAdSlot }) => {
55
60
  useEffect(() => {
56
61
  (async () => {
57
62
  try {
58
- setIsLoading(true);
59
- const response: Object = await Adgeist.fetchCreative(
60
- apiKey,
61
- domain,
62
- dataAdSlot,
63
- publisherId,
64
- isTestEnvironment
65
- );
66
-
67
- const creative: { data: AdData } = response as { data: AdData };
68
- setAdData(creative.data);
69
- setIsLoading(false);
70
-
71
- if (creative.data.seatBid.length > 0) {
72
- await Adgeist.sendCreativeAnalytic(
73
- creative.data.seatBid?.[0]?.bid?.[0]?.id || '',
63
+ if (isInitialized) {
64
+ setIsLoading(true);
65
+ const response: Object = await Adgeist.fetchCreative(
66
+ apiKey,
67
+ domain,
74
68
  dataAdSlot,
75
69
  publisherId,
76
- 'IMPRESSION',
77
- domain,
78
- apiKey,
79
- creative.data.id,
80
70
  isTestEnvironment
81
71
  );
72
+
73
+ const creative: { data: AdData } = response as { data: AdData };
74
+ setAdData(creative.data);
75
+ setIsLoading(false);
76
+
77
+ if (creative.data.seatBid.length > 0) {
78
+ await Adgeist.sendCreativeAnalytic(
79
+ creative.data.seatBid?.[0]?.bid?.[0]?.id || '',
80
+ dataAdSlot,
81
+ publisherId,
82
+ 'IMPRESSION',
83
+ domain,
84
+ apiKey,
85
+ creative.data.id,
86
+ isTestEnvironment
87
+ );
88
+ }
82
89
  }
83
90
  } catch (error) {
84
91
  console.error('Ad load failed:', error);
85
92
  }
86
93
  })();
87
- }, [publisherId, dataAdSlot, apiKey, domain, isTestEnvironment]);
94
+ }, [
95
+ isInitialized,
96
+ publisherId,
97
+ dataAdSlot,
98
+ apiKey,
99
+ domain,
100
+ isTestEnvironment,
101
+ ]);
88
102
 
89
103
  const handleClick = async () => {
90
104
  if (adData && adData?.seatBid.length > 0) {
@@ -117,10 +131,18 @@ export const BannerAd: React.FC<AdBannerTypes> = ({ dataAdSlot }) => {
117
131
  return (
118
132
  <TouchableWithoutFeedback accessible accessibilityLabel="Ad Banner">
119
133
  <View style={styles.adContainer}>
120
- <Image
121
- style={[styles.creative, { width: '100%', height: 300 }]}
122
- source={{ uri: creativeData.creativeUrl }}
123
- />
134
+ {dataSlotType == 'banner' ? (
135
+ <Image
136
+ style={[styles.creative, { width: '100%', height: 300 }]}
137
+ source={{ uri: creativeData.creativeUrl }}
138
+ />
139
+ ) : (
140
+ <Video
141
+ source={{ uri: creativeData.creativeUrl }}
142
+ style={{ width: '100%', aspectRatio: 16 / 9, height: 300 }}
143
+ />
144
+ )}
145
+
124
146
  <View style={styles.adContent}>
125
147
  <View style={styles.contentContainer}>
126
148
  <Text style={styles.title} numberOfLines={1} ellipsizeMode="tail">
@@ -1,42 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJavaSpec.js
9
- *
10
- * @nolint
11
- */
12
-
13
- package com.facebook.fbreact.specs;
14
-
15
- import com.facebook.proguard.annotations.DoNotStrip;
16
- import com.facebook.react.bridge.Promise;
17
- import com.facebook.react.bridge.ReactApplicationContext;
18
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
19
- import com.facebook.react.bridge.ReactMethod;
20
- import com.facebook.react.turbomodule.core.interfaces.TurboModule;
21
- import javax.annotation.Nonnull;
22
-
23
- public abstract class NativeAdgeistSpec extends ReactContextBaseJavaModule implements TurboModule {
24
- public static final String NAME = "Adgeist";
25
-
26
- public NativeAdgeistSpec(ReactApplicationContext reactContext) {
27
- super(reactContext);
28
- }
29
-
30
- @Override
31
- public @Nonnull String getName() {
32
- return NAME;
33
- }
34
-
35
- @ReactMethod
36
- @DoNotStrip
37
- public abstract void fetchCreative(String apiKey, String origin, String adSpaceId, String publisherId, boolean isTestEnvironment, Promise promise);
38
-
39
- @ReactMethod
40
- @DoNotStrip
41
- public abstract void sendCreativeAnalytic(String campaignId, String adSpaceId, String publisherId, String eventType, String origin, String apiKey, String bidId, boolean isTestEnvironment, Promise promise);
42
- }
@@ -1,36 +0,0 @@
1
- # Copyright (c) Meta Platforms, Inc. and affiliates.
2
- #
3
- # This source code is licensed under the MIT license found in the
4
- # LICENSE file in the root directory of this source tree.
5
-
6
- cmake_minimum_required(VERSION 3.13)
7
- set(CMAKE_VERBOSE_MAKEFILE on)
8
-
9
- file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNAdgeistSpec/*.cpp)
10
-
11
- add_library(
12
- react_codegen_RNAdgeistSpec
13
- OBJECT
14
- ${react_codegen_SRCS}
15
- )
16
-
17
- target_include_directories(react_codegen_RNAdgeistSpec PUBLIC . react/renderer/components/RNAdgeistSpec)
18
-
19
- target_link_libraries(
20
- react_codegen_RNAdgeistSpec
21
- fbjni
22
- jsi
23
- # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
- # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
- reactnative
26
- )
27
-
28
- target_compile_options(
29
- react_codegen_RNAdgeistSpec
30
- PRIVATE
31
- -DLOG_TAG=\"ReactNative\"
32
- -fexceptions
33
- -frtti
34
- -std=c++20
35
- -Wall
36
- )
@@ -1,38 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJniCpp.js
9
- */
10
-
11
- #include "RNAdgeistSpec.h"
12
-
13
- namespace facebook::react {
14
-
15
- static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_fetchCreative(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
- static jmethodID cachedMethodId = nullptr;
17
- return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "fetchCreative", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
18
- }
19
-
20
- static facebook::jsi::Value __hostFunction_NativeAdgeistSpecJSI_sendCreativeAnalytic(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
- static jmethodID cachedMethodId = nullptr;
22
- return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "sendCreativeAnalytic", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
23
- }
24
-
25
- NativeAdgeistSpecJSI::NativeAdgeistSpecJSI(const JavaTurboModule::InitParams &params)
26
- : JavaTurboModule(params) {
27
- methodMap_["fetchCreative"] = MethodMetadata {5, __hostFunction_NativeAdgeistSpecJSI_fetchCreative};
28
- methodMap_["sendCreativeAnalytic"] = MethodMetadata {8, __hostFunction_NativeAdgeistSpecJSI_sendCreativeAnalytic};
29
- }
30
-
31
- std::shared_ptr<TurboModule> RNAdgeistSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
32
- if (moduleName == "Adgeist") {
33
- return std::make_shared<NativeAdgeistSpecJSI>(params);
34
- }
35
- return nullptr;
36
- }
37
-
38
- } // namespace facebook::react
@@ -1,31 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJniH.js
9
- */
10
-
11
- #pragma once
12
-
13
- #include <ReactCommon/JavaTurboModule.h>
14
- #include <ReactCommon/TurboModule.h>
15
- #include <jsi/jsi.h>
16
-
17
- namespace facebook::react {
18
-
19
- /**
20
- * JNI C++ class for module 'NativeAdgeist'
21
- */
22
- class JSI_EXPORT NativeAdgeistSpecJSI : public JavaTurboModule {
23
- public:
24
- NativeAdgeistSpecJSI(const JavaTurboModule::InitParams &params);
25
- };
26
-
27
-
28
- JSI_EXPORT
29
- std::shared_ptr<TurboModule> RNAdgeistSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
-
31
- } // namespace facebook::react
@@ -1,45 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleCpp.js
8
- */
9
-
10
- #include "RNAdgeistSpecJSI.h"
11
-
12
- namespace facebook::react {
13
-
14
- static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_fetchCreative(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
- return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->fetchCreative(
16
- rt,
17
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
18
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
19
- count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
20
- count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt),
21
- count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asBool()
22
- );
23
- }
24
- static jsi::Value __hostFunction_NativeAdgeistCxxSpecJSI_sendCreativeAnalytic(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
25
- return static_cast<NativeAdgeistCxxSpecJSI *>(&turboModule)->sendCreativeAnalytic(
26
- rt,
27
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
28
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
29
- count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
30
- count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asString(rt),
31
- count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asString(rt),
32
- count <= 5 ? throw jsi::JSError(rt, "Expected argument in position 5 to be passed") : args[5].asString(rt),
33
- count <= 6 ? throw jsi::JSError(rt, "Expected argument in position 6 to be passed") : args[6].asString(rt),
34
- count <= 7 ? throw jsi::JSError(rt, "Expected argument in position 7 to be passed") : args[7].asBool()
35
- );
36
- }
37
-
38
- NativeAdgeistCxxSpecJSI::NativeAdgeistCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
39
- : TurboModule("Adgeist", jsInvoker) {
40
- methodMap_["fetchCreative"] = MethodMetadata {5, __hostFunction_NativeAdgeistCxxSpecJSI_fetchCreative};
41
- methodMap_["sendCreativeAnalytic"] = MethodMetadata {8, __hostFunction_NativeAdgeistCxxSpecJSI_sendCreativeAnalytic};
42
- }
43
-
44
-
45
- } // namespace facebook::react
@@ -1,80 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleH.js
8
- */
9
-
10
- #pragma once
11
-
12
- #include <ReactCommon/TurboModule.h>
13
- #include <react/bridging/Bridging.h>
14
-
15
- namespace facebook::react {
16
-
17
-
18
- class JSI_EXPORT NativeAdgeistCxxSpecJSI : public TurboModule {
19
- protected:
20
- NativeAdgeistCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
-
22
- public:
23
- virtual jsi::Value fetchCreative(jsi::Runtime &rt, jsi::String apiKey, jsi::String origin, jsi::String adSpaceId, jsi::String publisherId, bool isTestEnvironment) = 0;
24
- virtual jsi::Value sendCreativeAnalytic(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String publisherId, jsi::String eventType, jsi::String origin, jsi::String apiKey, jsi::String bidId, bool isTestEnvironment) = 0;
25
-
26
- };
27
-
28
- template <typename T>
29
- class JSI_EXPORT NativeAdgeistCxxSpec : public TurboModule {
30
- public:
31
- jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
32
- return delegate_.create(rt, propName);
33
- }
34
-
35
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
36
- return delegate_.getPropertyNames(runtime);
37
- }
38
-
39
- static constexpr std::string_view kModuleName = "Adgeist";
40
-
41
- protected:
42
- NativeAdgeistCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
43
- : TurboModule(std::string{NativeAdgeistCxxSpec::kModuleName}, jsInvoker),
44
- delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
45
-
46
-
47
- private:
48
- class Delegate : public NativeAdgeistCxxSpecJSI {
49
- public:
50
- Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
51
- NativeAdgeistCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
52
-
53
- }
54
-
55
- jsi::Value fetchCreative(jsi::Runtime &rt, jsi::String apiKey, jsi::String origin, jsi::String adSpaceId, jsi::String publisherId, bool isTestEnvironment) override {
56
- static_assert(
57
- bridging::getParameterCount(&T::fetchCreative) == 6,
58
- "Expected fetchCreative(...) to have 6 parameters");
59
-
60
- return bridging::callFromJs<jsi::Value>(
61
- rt, &T::fetchCreative, jsInvoker_, instance_, std::move(apiKey), std::move(origin), std::move(adSpaceId), std::move(publisherId), std::move(isTestEnvironment));
62
- }
63
- jsi::Value sendCreativeAnalytic(jsi::Runtime &rt, jsi::String campaignId, jsi::String adSpaceId, jsi::String publisherId, jsi::String eventType, jsi::String origin, jsi::String apiKey, jsi::String bidId, bool isTestEnvironment) override {
64
- static_assert(
65
- bridging::getParameterCount(&T::sendCreativeAnalytic) == 9,
66
- "Expected sendCreativeAnalytic(...) to have 9 parameters");
67
-
68
- return bridging::callFromJs<jsi::Value>(
69
- rt, &T::sendCreativeAnalytic, jsInvoker_, instance_, std::move(campaignId), std::move(adSpaceId), std::move(publisherId), std::move(eventType), std::move(origin), std::move(apiKey), std::move(bidId), std::move(isTestEnvironment));
70
- }
71
-
72
- private:
73
- friend class NativeAdgeistCxxSpec;
74
- T *instance_;
75
- };
76
-
77
- Delegate delegate_;
78
- };
79
-
80
- } // namespace facebook::react