@thealteroffice/react-native-adgeist 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Adgeist.podspec +1 -1
- package/README.md +41 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/adgeist/implementation/AdgeistModuleImpl.kt +47 -1
- package/android/src/newarch/java/com/AdgeistModule.kt +18 -0
- package/android/src/oldarch/java/com/AdgeistModule.kt +20 -0
- package/ios/Adgeist.mm +13 -1
- package/ios/AdgeistImpl.swift +27 -0
- package/lib/module/NativeAdgeist.js.map +1 -1
- package/lib/module/cdpclient/index.js +16 -0
- package/lib/module/cdpclient/index.js.map +1 -0
- package/lib/module/components/AdgeistProvider.js +18 -7
- package/lib/module/components/AdgeistProvider.js.map +1 -1
- package/lib/module/components/ConsentModal.js +88 -0
- package/lib/module/components/ConsentModal.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeAdgeist.d.ts +14 -0
- package/lib/typescript/src/NativeAdgeist.d.ts.map +1 -1
- package/lib/typescript/src/cdpclient/index.d.ts +6 -0
- package/lib/typescript/src/cdpclient/index.d.ts.map +1 -0
- package/lib/typescript/src/components/AdgeistProvider.d.ts +1 -0
- package/lib/typescript/src/components/AdgeistProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/ConsentModal.d.ts +6 -0
- package/lib/typescript/src/components/ConsentModal.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +4 -5
- package/src/NativeAdgeist.ts +21 -0
- package/src/cdpclient/index.ts +17 -0
- package/src/components/AdgeistProvider.tsx +27 -4
- package/src/components/ConsentModal.tsx +84 -0
- package/src/index.tsx +2 -0
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.
|
|
19
|
+
s.dependency "AdgeistKit", '= 0.0.6'
|
|
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
|
@@ -44,6 +44,47 @@ npx expo prebuild --clean
|
|
|
44
44
|
|
|
45
45
|
> **Note**: Requires Expo SDK 50+ and Kotlin template support.
|
|
46
46
|
|
|
47
|
+
## ⚙️ Peer Dependencies
|
|
48
|
+
|
|
49
|
+
This package uses `react-native-video` internally for media rendering.
|
|
50
|
+
|
|
51
|
+
### Why Peer Dependency?
|
|
52
|
+
React Native native modules like `react-native-video` should not be bundled inside libraries to prevent native build conflicts.
|
|
53
|
+
|
|
54
|
+
We declare `react-native-video` as a peer dependency, so your app controls the version.
|
|
55
|
+
|
|
56
|
+
### What You Need to Do
|
|
57
|
+
- **If your app already uses `react-native-video`**: No action needed.
|
|
58
|
+
- **If your app does not have `react-native-video` installed**: Please install it manually:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install react-native-video@^4.5.2
|
|
62
|
+
```
|
|
63
|
+
or
|
|
64
|
+
```bash
|
|
65
|
+
yarn add react-native-video@^4.5.2
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### What Happens If You Skip This?
|
|
69
|
+
If `react-native-video` is not installed, your app will crash at runtime with:
|
|
70
|
+
|
|
71
|
+
```javascript
|
|
72
|
+
Error: Cannot find module 'react-native-video'
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Why Not Include It in dependencies?
|
|
76
|
+
Adding `react-native-video` to dependencies directly in this library would:
|
|
77
|
+
|
|
78
|
+
- ❌ Cause duplicate native module linking
|
|
79
|
+
- ❌ Lead to iOS/Android build failures
|
|
80
|
+
- ❌ Break compatibility with apps already using `react-native-video`
|
|
81
|
+
|
|
82
|
+
### Dependency Summary
|
|
83
|
+
|
|
84
|
+
| Package | Install It? | Why? |
|
|
85
|
+
|---------|-------------|------|
|
|
86
|
+
| `react-native-video` | ✅ **Yes (required)** | Your app must install this manually to satisfy the peer dependency |
|
|
87
|
+
|
|
47
88
|
## 🔧 Setup & Configuration
|
|
48
89
|
|
|
49
90
|
### Basic Setup
|
package/android/build.gradle
CHANGED
|
@@ -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:
|
|
104
|
+
implementation "ai.adgeist:adgeistkit:1.0.1"
|
|
105
105
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -12,7 +12,9 @@ import com.adgeistkit.BidResponseData
|
|
|
12
12
|
import com.adgeistkit.SeatBid
|
|
13
13
|
import com.adgeistkit.Bid
|
|
14
14
|
import com.adgeistkit.BidExtension
|
|
15
|
-
|
|
15
|
+
import com.adgeistkit.UserDetails
|
|
16
|
+
import com.adgeistkit.Event
|
|
17
|
+
import com.facebook.react.bridge.ReadableMap
|
|
16
18
|
|
|
17
19
|
class AdgeistModuleImpl internal constructor(private val context: ReactApplicationContext) {
|
|
18
20
|
|
|
@@ -51,11 +53,55 @@ class AdgeistModuleImpl internal constructor(private val context: ReactApplicati
|
|
|
51
53
|
} ?: promise.reject("NOT_INITIALIZED", "SDK not initialized")
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
fun setUserDetails(userDetailsMap: ReadableMap) {
|
|
57
|
+
val userDetails = UserDetails(
|
|
58
|
+
userId = userDetailsMap.getStringSafe("userId"),
|
|
59
|
+
userName = userDetailsMap.getStringSafe("userName"),
|
|
60
|
+
email = userDetailsMap.getStringSafe("email"),
|
|
61
|
+
phone = userDetailsMap.getStringSafe("phone")
|
|
62
|
+
)
|
|
63
|
+
adgeistInstance?.setUserDetails(userDetails)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
fun logEvent(eventMap: ReadableMap) {
|
|
67
|
+
val eventType = eventMap.getStringSafe("eventType")
|
|
68
|
+
|
|
69
|
+
if (eventType.isNullOrEmpty()) {
|
|
70
|
+
throw IllegalArgumentException("Event must have a non-empty eventType")
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
val props = if (eventMap.hasKey("eventProperties")) eventMap.getMap("eventProperties") else null
|
|
74
|
+
val eventProps = props?.toHashMap() ?: emptyMap<String, Any>()
|
|
75
|
+
|
|
76
|
+
val event = Event(
|
|
77
|
+
eventType = eventType,
|
|
78
|
+
eventProperties = eventProps
|
|
79
|
+
)
|
|
80
|
+
adgeistInstance?.logEvent(event)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
fun getConsentStatus(promise: Promise) {
|
|
84
|
+
try {
|
|
85
|
+
val consent = adgeistInstance?.getConsentStatus() ?: false
|
|
86
|
+
promise.resolve(consent)
|
|
87
|
+
} catch (e: Exception) {
|
|
88
|
+
promise.reject("CONSENT_ERROR", "Failed to get consent status", e)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
fun updateConsentStatus(consent: Boolean) {
|
|
93
|
+
adgeistInstance?.updateConsentStatus(consent)
|
|
94
|
+
}
|
|
95
|
+
|
|
54
96
|
companion object {
|
|
55
97
|
const val NAME = "Adgeist"
|
|
56
98
|
}
|
|
57
99
|
}
|
|
58
100
|
|
|
101
|
+
fun ReadableMap.getStringSafe(key: String): String? =
|
|
102
|
+
if (this.hasKey(key) && !this.isNull(key)) this.getString(key) else null
|
|
103
|
+
|
|
104
|
+
|
|
59
105
|
// Extension function to convert CreativeDataModel to WritableMap
|
|
60
106
|
fun CreativeDataModel.toWritableMap(): WritableMap {
|
|
61
107
|
val map = Arguments.createMap()
|
|
@@ -3,6 +3,9 @@ package com.adgeist
|
|
|
3
3
|
import com.facebook.react.bridge.Promise
|
|
4
4
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
5
|
import com.adgeist.implementation.AdgeistModuleImpl
|
|
6
|
+
import com.adgeistkit.UserDetails
|
|
7
|
+
import com.adgeistkit.Event
|
|
8
|
+
import com.facebook.react.bridge.ReadableMap
|
|
6
9
|
|
|
7
10
|
class AdgeistModule internal constructor(reactContext: ReactApplicationContext) :
|
|
8
11
|
NativeAdgeistSpec(reactContext) {
|
|
@@ -23,4 +26,19 @@ class AdgeistModule internal constructor(reactContext: ReactApplicationContext)
|
|
|
23
26
|
implementation.sendCreativeAnalytic(campaignId, adSpaceId, publisherId, eventType, origin, apiKey, bidId, isTestEnvironment, promise)
|
|
24
27
|
}
|
|
25
28
|
|
|
29
|
+
override fun setUserDetails(userDetails: ReadableMap) {
|
|
30
|
+
implementation.setUserDetails(userDetails)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override fun logEvent(event: ReadableMap) {
|
|
34
|
+
implementation.logEvent(event)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun getConsentStatus(promise: Promise) {
|
|
38
|
+
implementation.getConsentStatus(promise)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun updateConsentStatus(consent: Boolean) {
|
|
42
|
+
implementation.updateConsentStatus(consent)
|
|
43
|
+
}
|
|
26
44
|
}
|
|
@@ -5,6 +5,7 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
5
5
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
6
6
|
import com.facebook.react.bridge.ReactMethod
|
|
7
7
|
import com.adgeist.implementation.AdgeistModuleImpl
|
|
8
|
+
import com.facebook.react.bridge.ReadableMap
|
|
8
9
|
|
|
9
10
|
class AdgeistModule internal constructor(reactContext: ReactApplicationContext) :
|
|
10
11
|
ReactContextBaseJavaModule(reactContext) {
|
|
@@ -28,4 +29,23 @@ class AdgeistModule internal constructor(reactContext: ReactApplicationContext)
|
|
|
28
29
|
implementation.sendCreativeAnalytic(campaignId, adSpaceId, publisherId, eventType, origin, apiKey, bidId, isTestEnvironment, promise)
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
@ReactMethod
|
|
33
|
+
fun setUserDetails(userDetails: ReadableMap) {
|
|
34
|
+
implementation.setUserDetails(userDetails)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@ReactMethod
|
|
38
|
+
fun logEvent(event: ReadableMap) {
|
|
39
|
+
implementation.logEvent(event)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@ReactMethod
|
|
43
|
+
fun getConsentStatus(promise: Promise) {
|
|
44
|
+
implementation.getConsentStatus(promise)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@ReactMethod
|
|
48
|
+
fun updateConsentStatus(consent: Boolean) {
|
|
49
|
+
implementation.updateConsentStatus(consent)
|
|
50
|
+
}
|
|
31
51
|
}
|
package/ios/Adgeist.mm
CHANGED
|
@@ -70,6 +70,18 @@ RCT_EXPORT_METHOD(sendCreativeAnalytic:(NSString *)campaignId
|
|
|
70
70
|
rejecter:reject];
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
RCT_EXPORT_METHOD(setUserDetails:(NSObject *)userDetails) {
|
|
74
|
+
[adgeist setUserDetails:userDetails];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
RCT_EXPORT_METHOD(updateConsentStatus:(BOOL)consent) {
|
|
78
|
+
[adgeist updateConsentStatus:consent];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
RCT_EXPORT_METHOD(logEvent:(NSObject *)eventDict) {
|
|
82
|
+
[adgeist logEvent:eventDict];
|
|
83
|
+
}
|
|
84
|
+
|
|
73
85
|
// TurboModule support for the new architecture
|
|
74
86
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
75
87
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
@@ -79,4 +91,4 @@ RCT_EXPORT_METHOD(sendCreativeAnalytic:(NSString *)campaignId
|
|
|
79
91
|
}
|
|
80
92
|
#endif
|
|
81
93
|
|
|
82
|
-
@end
|
|
94
|
+
@end
|
package/ios/AdgeistImpl.swift
CHANGED
|
@@ -96,6 +96,33 @@ import React
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
@objc public func setUserDetails(_ userDetailsDict: [String: Any]) {
|
|
100
|
+
let userDetails = UserDetails(
|
|
101
|
+
userId: userDetailsDict["userId"] as? String,
|
|
102
|
+
userName: userDetailsDict["userName"] as? String,
|
|
103
|
+
email: userDetailsDict["email"] as? String,
|
|
104
|
+
phone: userDetailsDict["phone"] as? String
|
|
105
|
+
)
|
|
106
|
+
adgeistInstance?.setUserDetails(userDetails)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@objc public func updateConsentStatus(_ consent: Bool) {
|
|
110
|
+
adgeistInstance?.updateConsentStatus(consent)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@objc public func logEvent(_ eventDict: NSDictionary) {
|
|
115
|
+
print("Event must have a non-empty eventType")
|
|
116
|
+
guard let eventType = eventDict["eventType"] as? String, !eventType.isEmpty else {
|
|
117
|
+
print("Event must have a non-empty eventType")
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let eventProps = eventDict["eventProperties"] as? [String: Any] ?? [:]
|
|
122
|
+
let event = Event(eventType: eventType, eventProperties: eventProps)
|
|
123
|
+
adgeistInstance?.logEvent(event)
|
|
124
|
+
}
|
|
125
|
+
|
|
99
126
|
@objc public static func requiresMainQueueSetup() -> Bool {
|
|
100
127
|
return true
|
|
101
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeAdgeist.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeAdgeist.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AA4ClD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Adgeist from "../NativeAdgeist.js";
|
|
4
|
+
export const setUserDetails = userDetails => {
|
|
5
|
+
Adgeist.setUserDetails(userDetails);
|
|
6
|
+
};
|
|
7
|
+
export const logEvent = event => {
|
|
8
|
+
Adgeist.logEvent(event);
|
|
9
|
+
};
|
|
10
|
+
export const getConsentStatus = async () => {
|
|
11
|
+
return (await Adgeist.getConsentStatus()) === true ? 'ACCEPTED' : 'DENIED';
|
|
12
|
+
};
|
|
13
|
+
export const updateConsentStatus = consent => {
|
|
14
|
+
Adgeist.updateConsentStatus(consent);
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Adgeist","setUserDetails","userDetails","logEvent","event","getConsentStatus","updateConsentStatus","consent"],"sourceRoot":"../../../src","sources":["cdpclient/index.ts"],"mappings":";;AAAA,OAAOA,OAAO,MAAwC,qBAAkB;AAExE,OAAO,MAAMC,cAAc,GAAIC,WAAwB,IAAK;EAC1DF,OAAO,CAACC,cAAc,CAACC,WAAW,CAAC;AACrC,CAAC;AAED,OAAO,MAAMC,QAAQ,GAAIC,KAAY,IAAK;EACxCJ,OAAO,CAACG,QAAQ,CAACC,KAAK,CAAC;AACzB,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAAA,KAAY;EAC1C,OAAO,CAAC,MAAML,OAAO,CAACK,gBAAgB,CAAC,CAAC,MAAM,IAAI,GAAG,UAAU,GAAG,QAAQ;AAC5E,CAAC;AAED,OAAO,MAAMC,mBAAmB,GAAIC,OAAgB,IAAK;EACvDP,OAAO,CAACM,mBAAmB,CAACC,OAAO,CAAC;AACtC,CAAC","ignoreList":[]}
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { createContext, useContext, useEffect, useState } from 'react';
|
|
4
4
|
import Adgeist from "../NativeAdgeist.js";
|
|
5
|
-
import {
|
|
5
|
+
import { ConsentModal } from "./ConsentModal.js";
|
|
6
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
7
|
const AdgeistContext = /*#__PURE__*/createContext({
|
|
7
8
|
publisherId: '',
|
|
8
9
|
apiKey: '',
|
|
9
10
|
domain: '',
|
|
10
11
|
isTestEnvironment: true,
|
|
11
|
-
isInitialized: false
|
|
12
|
+
isInitialized: false,
|
|
13
|
+
setAdgeistConsentModal: () => {}
|
|
12
14
|
});
|
|
13
15
|
export const AdgeistProvider = ({
|
|
14
16
|
children,
|
|
@@ -19,27 +21,36 @@ export const AdgeistProvider = ({
|
|
|
19
21
|
isTestEnvironment = true
|
|
20
22
|
}) => {
|
|
21
23
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
24
|
+
const [adgeistConsentModal, setAdgeistConsentModal] = useState(false);
|
|
25
|
+
const [isKotlinInitializationFailed, setIsKotlinInitializationFailed] = useState(false);
|
|
22
26
|
useEffect(() => {
|
|
23
27
|
const initializeAdgeist = async () => {
|
|
28
|
+
setIsKotlinInitializationFailed(false);
|
|
29
|
+
setIsInitialized(false);
|
|
24
30
|
try {
|
|
25
31
|
await Adgeist.initializeSdk(customAdgeistApiOrigin);
|
|
26
32
|
setIsInitialized(true);
|
|
27
|
-
} catch
|
|
28
|
-
|
|
33
|
+
} catch {
|
|
34
|
+
setIsKotlinInitializationFailed(true);
|
|
29
35
|
setIsInitialized(false);
|
|
30
36
|
}
|
|
31
37
|
};
|
|
32
38
|
initializeAdgeist();
|
|
33
39
|
}, [customAdgeistApiOrigin]);
|
|
34
|
-
return /*#__PURE__*/
|
|
40
|
+
return /*#__PURE__*/_jsxs(AdgeistContext.Provider, {
|
|
35
41
|
value: {
|
|
36
42
|
publisherId,
|
|
37
43
|
apiKey,
|
|
38
44
|
domain,
|
|
39
45
|
isTestEnvironment,
|
|
40
|
-
isInitialized
|
|
46
|
+
isInitialized,
|
|
47
|
+
setAdgeistConsentModal
|
|
41
48
|
},
|
|
42
|
-
children:
|
|
49
|
+
children: [isKotlinInitializationFailed && /*#__PURE__*/_jsx(_Fragment, {
|
|
50
|
+
children: children
|
|
51
|
+
}), isInitialized && /*#__PURE__*/_jsxs(_Fragment, {
|
|
52
|
+
children: [adgeistConsentModal && /*#__PURE__*/_jsx(ConsentModal, {}), children]
|
|
53
|
+
})]
|
|
43
54
|
});
|
|
44
55
|
};
|
|
45
56
|
export const useAdgeistContext = () => useContext(AdgeistContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","createContext","useContext","useEffect","useState","Adgeist","jsx","_jsx","AdgeistContext","publisherId","apiKey","domain","isTestEnvironment","isInitialized","AdgeistProvider","children","customAdgeistApiOrigin","setIsInitialized","
|
|
1
|
+
{"version":3,"names":["React","createContext","useContext","useEffect","useState","Adgeist","ConsentModal","Fragment","_Fragment","jsx","_jsx","jsxs","_jsxs","AdgeistContext","publisherId","apiKey","domain","isTestEnvironment","isInitialized","setAdgeistConsentModal","AdgeistProvider","children","customAdgeistApiOrigin","setIsInitialized","adgeistConsentModal","isKotlinInitializationFailed","setIsKotlinInitializationFailed","initializeAdgeist","initializeSdk","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;AACtC,SAASC,YAAY,QAAQ,mBAAgB;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAoB9C,MAAMC,cAAc,gBAAGZ,aAAa,CAAqB;EACvDa,WAAW,EAAE,EAAE;EACfC,MAAM,EAAE,EAAE;EACVC,MAAM,EAAE,EAAE;EACVC,iBAAiB,EAAE,IAAI;EACvBC,aAAa,EAAE,KAAK;EACpBC,sBAAsB,EAAEA,CAAA,KAAM,CAAC;AACjC,CAAC,CAAC;AAEF,OAAO,MAAMC,eAAmD,GAAGA,CAAC;EAClEC,QAAQ;EACRP,WAAW,GAAG,EAAE;EAChBC,MAAM,GAAG,EAAE;EACXC,MAAM,GAAG,EAAE;EACXM,sBAAsB,GAAG,+BAA+B;EACxDL,iBAAiB,GAAG;AACtB,CAAC,KAAK;EACJ,MAAM,CAACC,aAAa,EAAEK,gBAAgB,CAAC,GAAGnB,QAAQ,CAAC,KAAK,CAAC;EACzD,MAAM,CAACoB,mBAAmB,EAAEL,sBAAsB,CAAC,GAAGf,QAAQ,CAAC,KAAK,CAAC;EACrE,MAAM,CAACqB,4BAA4B,EAAEC,+BAA+B,CAAC,GACnEtB,QAAQ,CAAC,KAAK,CAAC;EAEjBD,SAAS,CAAC,MAAM;IACd,MAAMwB,iBAAiB,GAAG,MAAAA,CAAA,KAAY;MACpCD,+BAA+B,CAAC,KAAK,CAAC;MACtCH,gBAAgB,CAAC,KAAK,CAAC;MAEvB,IAAI;QACF,MAAMlB,OAAO,CAACuB,aAAa,CAACN,sBAAsB,CAAC;QACnDC,gBAAgB,CAAC,IAAI,CAAC;MACxB,CAAC,CAAC,MAAM;QACNG,+BAA+B,CAAC,IAAI,CAAC;QACrCH,gBAAgB,CAAC,KAAK,CAAC;MACzB;IACF,CAAC;IAEDI,iBAAiB,CAAC,CAAC;EACrB,CAAC,EAAE,CAACL,sBAAsB,CAAC,CAAC;EAE5B,oBACEV,KAAA,CAACC,cAAc,CAACgB,QAAQ;IACtBC,KAAK,EAAE;MACLhB,WAAW;MACXC,MAAM;MACNC,MAAM;MACNC,iBAAiB;MACjBC,aAAa;MACbC;IACF,CAAE;IAAAE,QAAA,GAEDI,4BAA4B,iBAAIf,IAAA,CAAAF,SAAA;MAAAa,QAAA,EAAGA;IAAQ,CAAG,CAAC,EAE/CH,aAAa,iBACZN,KAAA,CAAAJ,SAAA;MAAAa,QAAA,GACGG,mBAAmB,iBAAId,IAAA,CAACJ,YAAY,IAAE,CAAC,EACvCe,QAAQ;IAAA,CACT,CACH;EAAA,CACsB,CAAC;AAE9B,CAAC;AAED,OAAO,MAAMU,iBAAiB,GAAGA,CAAA,KAAM7B,UAAU,CAACW,cAAc,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Dimensions, StyleSheet, View, Text, Pressable } from 'react-native';
|
|
5
|
+
import { useAdgeistContext } from "./AdgeistProvider.js";
|
|
6
|
+
import Adgeist from "../NativeAdgeist.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
export const ConsentModal = () => {
|
|
9
|
+
const {
|
|
10
|
+
setAdgeistConsentModal
|
|
11
|
+
} = useAdgeistContext();
|
|
12
|
+
return /*#__PURE__*/_jsx(View, {
|
|
13
|
+
style: styles.modalContainer,
|
|
14
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
15
|
+
style: styles.modalInnerContainer,
|
|
16
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
17
|
+
style: styles.headerContainer,
|
|
18
|
+
children: "Your privacy matters"
|
|
19
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
20
|
+
style: styles.textContainer,
|
|
21
|
+
children: "We use data to provide and improve our services, deliver safer and more relevant ads, and measure performance."
|
|
22
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
23
|
+
style: styles.buttonContainer,
|
|
24
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
25
|
+
style: styles.button,
|
|
26
|
+
onPress: () => setAdgeistConsentModal(false),
|
|
27
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
28
|
+
style: styles.buttonText,
|
|
29
|
+
children: "Decline"
|
|
30
|
+
})
|
|
31
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
32
|
+
style: styles.button,
|
|
33
|
+
onPress: () => {
|
|
34
|
+
Adgeist.updateConsentStatus(true);
|
|
35
|
+
setAdgeistConsentModal(false);
|
|
36
|
+
},
|
|
37
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
38
|
+
style: styles.buttonText,
|
|
39
|
+
children: "Accept"
|
|
40
|
+
})
|
|
41
|
+
})]
|
|
42
|
+
})]
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const styles = StyleSheet.create({
|
|
47
|
+
modalContainer: {
|
|
48
|
+
width: Dimensions.get('window').width,
|
|
49
|
+
height: Dimensions.get('window').height,
|
|
50
|
+
position: 'absolute',
|
|
51
|
+
top: 0,
|
|
52
|
+
left: 0,
|
|
53
|
+
zIndex: 1000,
|
|
54
|
+
backgroundColor: '#00000044',
|
|
55
|
+
padding: 20,
|
|
56
|
+
flex: 1,
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
alignItems: 'center'
|
|
59
|
+
},
|
|
60
|
+
modalInnerContainer: {
|
|
61
|
+
backgroundColor: 'white',
|
|
62
|
+
borderRadius: 10,
|
|
63
|
+
padding: 15
|
|
64
|
+
},
|
|
65
|
+
headerContainer: {
|
|
66
|
+
fontSize: 18,
|
|
67
|
+
fontWeight: 'bold',
|
|
68
|
+
marginBottom: 5
|
|
69
|
+
},
|
|
70
|
+
textContainer: {
|
|
71
|
+
fontSize: 14,
|
|
72
|
+
marginBottom: 5
|
|
73
|
+
},
|
|
74
|
+
buttonContainer: {
|
|
75
|
+
flexDirection: 'row',
|
|
76
|
+
justifyContent: 'flex-end',
|
|
77
|
+
gap: 5
|
|
78
|
+
},
|
|
79
|
+
button: {
|
|
80
|
+
backgroundColor: '#63AA75',
|
|
81
|
+
padding: 10,
|
|
82
|
+
borderRadius: 5
|
|
83
|
+
},
|
|
84
|
+
buttonText: {
|
|
85
|
+
color: 'black'
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=ConsentModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Dimensions","StyleSheet","View","Text","Pressable","useAdgeistContext","Adgeist","jsx","_jsx","jsxs","_jsxs","ConsentModal","setAdgeistConsentModal","style","styles","modalContainer","children","modalInnerContainer","headerContainer","textContainer","buttonContainer","button","onPress","buttonText","updateConsentStatus","create","width","get","height","position","top","left","zIndex","backgroundColor","padding","flex","justifyContent","alignItems","borderRadius","fontSize","fontWeight","marginBottom","flexDirection","gap","color"],"sourceRoot":"../../../src","sources":["components/ConsentModal.tsx"],"mappings":"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","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,0BAAuB;AACrC,cAAc,iCAA8B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,0BAAuB;AACrC,cAAc,iCAA8B;AAE5C,cAAc,sBAAmB","ignoreList":[]}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface UserDetails {
|
|
3
|
+
userId?: string;
|
|
4
|
+
userName?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
phone?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Event {
|
|
9
|
+
eventType: string;
|
|
10
|
+
eventProperties: Object;
|
|
11
|
+
}
|
|
2
12
|
export interface Spec extends TurboModule {
|
|
3
13
|
initializeSdk(customDomain: string): Promise<boolean>;
|
|
4
14
|
fetchCreative(apiKey: string, origin: string, adSpaceId: string, publisherId: string, isTestEnvironment: boolean): Promise<Object>;
|
|
5
15
|
sendCreativeAnalytic(campaignId: string, adSpaceId: string, publisherId: string, eventType: string, origin: string, apiKey: string, bidId: string, isTestEnvironment: boolean): Promise<Object>;
|
|
16
|
+
setUserDetails(user: UserDetails): void;
|
|
17
|
+
logEvent(event: Event): void;
|
|
18
|
+
getConsentStatus(): Promise<boolean>;
|
|
19
|
+
updateConsentStatus(consent: boolean): void;
|
|
6
20
|
}
|
|
7
21
|
declare const _default: Spec;
|
|
8
22
|
export default _default;
|
|
@@ -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,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;
|
|
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,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,KAAK;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;CACzB;AACD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtD,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;IAEnB,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;IAEnB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAExC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAE7B,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAErC,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7C;;AAED,wBAAiE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type UserDetails, type Event } from '../NativeAdgeist';
|
|
2
|
+
export declare const setUserDetails: (userDetails: UserDetails) => void;
|
|
3
|
+
export declare const logEvent: (event: Event) => void;
|
|
4
|
+
export declare const getConsentStatus: () => Promise<"ACCEPTED" | "DENIED">;
|
|
5
|
+
export declare const updateConsentStatus: (consent: boolean) => void;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cdpclient/index.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzE,eAAO,MAAM,cAAc,GAAI,aAAa,WAAW,SAEtD,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,OAAO,KAAK,SAEpC,CAAC;AAEF,eAAO,MAAM,gBAAgB,sCAE5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,SAAS,OAAO,SAEnD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdgeistProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/AdgeistProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AdgeistProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/AdgeistProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAI9E,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;IACvB,sBAAsB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAClD;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;AAWD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAmD9D,CAAC;AAEF,eAAO,MAAM,iBAAiB,0BAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsentModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ConsentModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,qBAAqB;CAAG;AAElC,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAgCxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAE7C,cAAc,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thealteroffice/react-native-adgeist",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
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",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"react": "19.0.0",
|
|
81
81
|
"react-native": "0.79.2",
|
|
82
82
|
"react-native-builder-bob": "^0.40.10",
|
|
83
|
+
"react-native-video": "^6.16.1",
|
|
83
84
|
"release-it": "^17.10.0",
|
|
84
85
|
"turbo": "^1.10.7",
|
|
85
86
|
"typescript": "^5.2.2"
|
|
@@ -87,7 +88,8 @@
|
|
|
87
88
|
"peerDependencies": {
|
|
88
89
|
"expo": ">=47.0.0",
|
|
89
90
|
"react": "*",
|
|
90
|
-
"react-native": "*"
|
|
91
|
+
"react-native": "*",
|
|
92
|
+
"react-native-video": "^6.16.0"
|
|
91
93
|
},
|
|
92
94
|
"peerDependenciesMeta": {
|
|
93
95
|
"expo": {
|
|
@@ -167,8 +169,5 @@
|
|
|
167
169
|
"type": "turbo-module",
|
|
168
170
|
"languages": "kotlin-objc",
|
|
169
171
|
"version": "0.49.8"
|
|
170
|
-
},
|
|
171
|
-
"dependencies": {
|
|
172
|
-
"react-native-video": "^6.16.0"
|
|
173
172
|
}
|
|
174
173
|
}
|
package/src/NativeAdgeist.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import type { TurboModule } from 'react-native';
|
|
2
2
|
import { TurboModuleRegistry } from 'react-native';
|
|
3
3
|
|
|
4
|
+
export interface UserDetails {
|
|
5
|
+
userId?: string;
|
|
6
|
+
userName?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
phone?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface Event {
|
|
12
|
+
eventType: string;
|
|
13
|
+
eventProperties: Object;
|
|
14
|
+
}
|
|
4
15
|
export interface Spec extends TurboModule {
|
|
5
16
|
initializeSdk(customDomain: string): Promise<boolean>;
|
|
17
|
+
|
|
6
18
|
fetchCreative(
|
|
7
19
|
apiKey: string,
|
|
8
20
|
origin: string,
|
|
@@ -10,6 +22,7 @@ export interface Spec extends TurboModule {
|
|
|
10
22
|
publisherId: string,
|
|
11
23
|
isTestEnvironment: boolean
|
|
12
24
|
): Promise<Object>;
|
|
25
|
+
|
|
13
26
|
sendCreativeAnalytic(
|
|
14
27
|
campaignId: string,
|
|
15
28
|
adSpaceId: string,
|
|
@@ -20,6 +33,14 @@ export interface Spec extends TurboModule {
|
|
|
20
33
|
bidId: string,
|
|
21
34
|
isTestEnvironment: boolean
|
|
22
35
|
): Promise<Object>;
|
|
36
|
+
|
|
37
|
+
setUserDetails(user: UserDetails): void;
|
|
38
|
+
|
|
39
|
+
logEvent(event: Event): void;
|
|
40
|
+
|
|
41
|
+
getConsentStatus(): Promise<boolean>;
|
|
42
|
+
|
|
43
|
+
updateConsentStatus(consent: boolean): void;
|
|
23
44
|
}
|
|
24
45
|
|
|
25
46
|
export default TurboModuleRegistry.getEnforcing<Spec>('Adgeist');
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Adgeist, { type UserDetails, type Event } from '../NativeAdgeist';
|
|
2
|
+
|
|
3
|
+
export const setUserDetails = (userDetails: UserDetails) => {
|
|
4
|
+
Adgeist.setUserDetails(userDetails);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const logEvent = (event: Event) => {
|
|
8
|
+
Adgeist.logEvent(event);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const getConsentStatus = async () => {
|
|
12
|
+
return (await Adgeist.getConsentStatus()) === true ? 'ACCEPTED' : 'DENIED';
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const updateConsentStatus = (consent: boolean) => {
|
|
16
|
+
Adgeist.updateConsentStatus(consent);
|
|
17
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { createContext, useContext, useEffect, useState } from 'react';
|
|
2
2
|
import Adgeist from '../NativeAdgeist';
|
|
3
|
+
import { ConsentModal } from './ConsentModal';
|
|
3
4
|
|
|
4
5
|
interface AdgeistContextType {
|
|
5
6
|
publisherId: string;
|
|
@@ -7,6 +8,7 @@ interface AdgeistContextType {
|
|
|
7
8
|
domain: string;
|
|
8
9
|
isTestEnvironment: boolean;
|
|
9
10
|
isInitialized: boolean;
|
|
11
|
+
setAdgeistConsentModal: (value: boolean) => void;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
interface AdgeistProviderPropsType {
|
|
@@ -24,6 +26,7 @@ const AdgeistContext = createContext<AdgeistContextType>({
|
|
|
24
26
|
domain: '',
|
|
25
27
|
isTestEnvironment: true,
|
|
26
28
|
isInitialized: false,
|
|
29
|
+
setAdgeistConsentModal: () => {},
|
|
27
30
|
});
|
|
28
31
|
|
|
29
32
|
export const AdgeistProvider: React.FC<AdgeistProviderPropsType> = ({
|
|
@@ -35,14 +38,20 @@ export const AdgeistProvider: React.FC<AdgeistProviderPropsType> = ({
|
|
|
35
38
|
isTestEnvironment = true,
|
|
36
39
|
}) => {
|
|
37
40
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
41
|
+
const [adgeistConsentModal, setAdgeistConsentModal] = useState(false);
|
|
42
|
+
const [isKotlinInitializationFailed, setIsKotlinInitializationFailed] =
|
|
43
|
+
useState(false);
|
|
38
44
|
|
|
39
45
|
useEffect(() => {
|
|
40
46
|
const initializeAdgeist = async () => {
|
|
47
|
+
setIsKotlinInitializationFailed(false);
|
|
48
|
+
setIsInitialized(false);
|
|
49
|
+
|
|
41
50
|
try {
|
|
42
51
|
await Adgeist.initializeSdk(customAdgeistApiOrigin);
|
|
43
52
|
setIsInitialized(true);
|
|
44
|
-
} catch
|
|
45
|
-
|
|
53
|
+
} catch {
|
|
54
|
+
setIsKotlinInitializationFailed(true);
|
|
46
55
|
setIsInitialized(false);
|
|
47
56
|
}
|
|
48
57
|
};
|
|
@@ -52,9 +61,23 @@ export const AdgeistProvider: React.FC<AdgeistProviderPropsType> = ({
|
|
|
52
61
|
|
|
53
62
|
return (
|
|
54
63
|
<AdgeistContext.Provider
|
|
55
|
-
value={{
|
|
64
|
+
value={{
|
|
65
|
+
publisherId,
|
|
66
|
+
apiKey,
|
|
67
|
+
domain,
|
|
68
|
+
isTestEnvironment,
|
|
69
|
+
isInitialized,
|
|
70
|
+
setAdgeistConsentModal,
|
|
71
|
+
}}
|
|
56
72
|
>
|
|
57
|
-
{children}
|
|
73
|
+
{isKotlinInitializationFailed && <>{children}</>}
|
|
74
|
+
|
|
75
|
+
{isInitialized && (
|
|
76
|
+
<>
|
|
77
|
+
{adgeistConsentModal && <ConsentModal />}
|
|
78
|
+
{children}
|
|
79
|
+
</>
|
|
80
|
+
)}
|
|
58
81
|
</AdgeistContext.Provider>
|
|
59
82
|
);
|
|
60
83
|
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Dimensions, StyleSheet, View, Text, Pressable } from 'react-native';
|
|
4
|
+
import { useAdgeistContext } from './AdgeistProvider';
|
|
5
|
+
import Adgeist from '../NativeAdgeist';
|
|
6
|
+
|
|
7
|
+
interface ConsentModalPropsType {}
|
|
8
|
+
|
|
9
|
+
export const ConsentModal: React.FC<ConsentModalPropsType> = () => {
|
|
10
|
+
const { setAdgeistConsentModal } = useAdgeistContext();
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<View style={styles.modalContainer}>
|
|
14
|
+
<View style={styles.modalInnerContainer}>
|
|
15
|
+
<Text style={styles.headerContainer}>Your privacy matters</Text>
|
|
16
|
+
<Text style={styles.textContainer}>
|
|
17
|
+
We use data to provide and improve our services, deliver safer and
|
|
18
|
+
more relevant ads, and measure performance.
|
|
19
|
+
</Text>
|
|
20
|
+
|
|
21
|
+
<View style={styles.buttonContainer}>
|
|
22
|
+
<Pressable
|
|
23
|
+
style={styles.button}
|
|
24
|
+
onPress={() => setAdgeistConsentModal(false)}
|
|
25
|
+
>
|
|
26
|
+
<Text style={styles.buttonText}>Decline</Text>
|
|
27
|
+
</Pressable>
|
|
28
|
+
<Pressable
|
|
29
|
+
style={styles.button}
|
|
30
|
+
onPress={() => {
|
|
31
|
+
Adgeist.updateConsentStatus(true);
|
|
32
|
+
setAdgeistConsentModal(false);
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<Text style={styles.buttonText}>Accept</Text>
|
|
36
|
+
</Pressable>
|
|
37
|
+
</View>
|
|
38
|
+
</View>
|
|
39
|
+
</View>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const styles = StyleSheet.create({
|
|
44
|
+
modalContainer: {
|
|
45
|
+
width: Dimensions.get('window').width,
|
|
46
|
+
height: Dimensions.get('window').height,
|
|
47
|
+
position: 'absolute',
|
|
48
|
+
top: 0,
|
|
49
|
+
left: 0,
|
|
50
|
+
zIndex: 1000,
|
|
51
|
+
backgroundColor: '#00000044',
|
|
52
|
+
padding: 20,
|
|
53
|
+
flex: 1,
|
|
54
|
+
justifyContent: 'center',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
},
|
|
57
|
+
modalInnerContainer: {
|
|
58
|
+
backgroundColor: 'white',
|
|
59
|
+
borderRadius: 10,
|
|
60
|
+
padding: 15,
|
|
61
|
+
},
|
|
62
|
+
headerContainer: {
|
|
63
|
+
fontSize: 18,
|
|
64
|
+
fontWeight: 'bold',
|
|
65
|
+
marginBottom: 5,
|
|
66
|
+
},
|
|
67
|
+
textContainer: {
|
|
68
|
+
fontSize: 14,
|
|
69
|
+
marginBottom: 5,
|
|
70
|
+
},
|
|
71
|
+
buttonContainer: {
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
justifyContent: 'flex-end',
|
|
74
|
+
gap: 5,
|
|
75
|
+
},
|
|
76
|
+
button: {
|
|
77
|
+
backgroundColor: '#63AA75',
|
|
78
|
+
padding: 10,
|
|
79
|
+
borderRadius: 5,
|
|
80
|
+
},
|
|
81
|
+
buttonText: {
|
|
82
|
+
color: 'black',
|
|
83
|
+
},
|
|
84
|
+
});
|
package/src/index.tsx
CHANGED