@usercentrics/react-native-sdk 2.23.2 → 2.23.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.
- package/android/build-legacy.gradle +1 -1
- package/android/build.gradle.kts +14 -2
- package/android/gradle.properties +4 -0
- package/android/settings.gradle.kts +1 -1
- package/android/src/androidTest/java/com/usercentrics/{reactnativemodule → reactnative}/RNUsercentricsModuleTest.kt +5 -5
- package/android/src/androidTest/java/com/usercentrics/reactnative/fake/FakePromise.kt +73 -0
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/RNUsercentricsModule.kt +3 -3
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/RNUsercentricsModuleSpec.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/RNUsercentricsPackage.kt +2 -2
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/ReactContextProvider.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/ReactContextProviderImpl.kt +1 -1
- package/android/src/main/java/com/usercentrics/reactnative/UCRNFlag.kt +4 -0
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/api/UsercentricsProxy.kt +2 -2
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/extensions/BannerFontExtensions.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/extensions/BannerSettingsExtensions.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/extensions/CCPADataExtensions.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/extensions/ConsentDisclosureSerializer.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/extensions/ReadableMapExtensions.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/extensions/TCFDataExtensions.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/extensions/UserDecisionExtensions.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/extensions/UserOptionsExtensions.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/extensions/UsercentricsCMPDataExtensions.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/extensions/UsercentricsConsentUserResponseExtensions.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/extensions/UsercentricsReadyStatusExtensions.kt +1 -1
- package/android/src/main/java/com/usercentrics/{reactnativeusercentrics → reactnative}/extensions/UsercentricsServiceConsentExtensions.kt +1 -1
- package/android/src/test/java/com/usercentrics/reactnative/RNUsercentricsModuleTest.kt +159 -0
- package/android/src/test/java/com/usercentrics/reactnative/fake/FakePromise.kt +73 -0
- package/ios/Extensions/BannerSettings+Dict.swift +1 -0
- package/ios/Extensions/UIColor+Extensions.swift +1 -1
- package/ios/Extensions/UIImage+UsercentricsLogoDict.swift +1 -0
- package/ios/RNUsercentricsModule.swift +1 -0
- package/lib/NativeUsercentrics.d.ts +1 -2
- package/lib/NativeUsercentrics.js +9 -2
- package/lib/NativeUsercentrics.js.map +1 -1
- package/package.json +98 -97
- package/android/src/androidTest/java/com/usercentrics/reactnativemodule/fake/FakePromise.kt +0 -67
- package/android/src/main/java/com/usercentrics/reactnativeusercentrics/UCRNFlag.kt +0 -4
- /package/android/src/androidTest/java/com/usercentrics/{reactnativemodule → reactnative}/api/FakeUsercentricsProxy.kt +0 -0
- /package/android/src/androidTest/java/com/usercentrics/{reactnativemodule → reactnative}/mock/GetCMPDataMock.kt +0 -0
- /package/android/src/androidTest/java/com/usercentrics/{reactnativemodule → reactnative}/mock/GetConsentsMock.kt +0 -0
- /package/android/src/androidTest/java/com/usercentrics/{reactnativemodule → reactnative}/mock/GetTCFDataMock.kt +0 -0
- /package/android/src/androidTest/java/com/usercentrics/{reactnativemodule → reactnative}/mock/GetUSPDataMock.kt +0 -0
- /package/android/src/androidTest/java/com/usercentrics/{reactnativemodule → reactnative}/mock/GetUserSessionDataMock.kt +0 -0
- /package/android/src/androidTest/java/com/usercentrics/{reactnativemodule → reactnative}/mock/ReactContextProviderMock.kt +0 -0
- /package/android/src/androidTest/java/com/usercentrics/{reactnativemodule → reactnative}/mock/SaveDecisionsForTCFMock.kt +0 -0
- /package/android/src/androidTest/java/com/usercentrics/{reactnativemodule → reactnative}/mock/SaveDecisionsMock.kt +0 -0
package/android/build.gradle.kts
CHANGED
|
@@ -3,7 +3,7 @@ plugins {
|
|
|
3
3
|
id("org.jetbrains.kotlin.android")
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
val usercentricsVersion = "2.23.
|
|
6
|
+
val usercentricsVersion = "2.23.3"
|
|
7
7
|
val reactNativeVersion = "0.79.6"
|
|
8
8
|
|
|
9
9
|
android {
|
|
@@ -21,6 +21,10 @@ android {
|
|
|
21
21
|
|
|
22
22
|
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchEnabled.toString())
|
|
23
23
|
buildConfigField("boolean", "IS_HERMES_ENABLED", isHermesEnabled.toString())
|
|
24
|
+
|
|
25
|
+
ndk {
|
|
26
|
+
abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
compileOptions {
|
|
@@ -45,7 +49,7 @@ android {
|
|
|
45
49
|
buildConfig = true
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
packaging {
|
|
49
53
|
jniLibs {
|
|
50
54
|
useLegacyPackaging = false
|
|
51
55
|
}
|
|
@@ -56,6 +60,14 @@ dependencies {
|
|
|
56
60
|
implementation("com.facebook.react:react-android:$reactNativeVersion")
|
|
57
61
|
implementation("com.usercentrics.sdk:usercentrics-ui:$usercentricsVersion")
|
|
58
62
|
|
|
63
|
+
// Unit tests (JVM)
|
|
64
|
+
testImplementation("junit:junit:4.13.2")
|
|
65
|
+
testImplementation("io.mockk:mockk:1.13.12")
|
|
66
|
+
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
|
|
67
|
+
testImplementation("com.facebook.react:react-android:$reactNativeVersion")
|
|
68
|
+
|
|
69
|
+
// Instrumented tests (Android)
|
|
70
|
+
androidTestImplementation("com.facebook.react:react-android:$reactNativeVersion")
|
|
59
71
|
androidTestImplementation("io.mockk:mockk-android:1.12.0")
|
|
60
72
|
androidTestImplementation("junit:junit:4.13.2")
|
|
61
73
|
androidTestImplementation("androidx.test.ext:junit-ktx:1.1.3")
|
|
@@ -290,11 +290,11 @@ class RNUsercentricsModuleTest {
|
|
|
290
290
|
val result = promise.resolveValue as WritableArray
|
|
291
291
|
val consent = result.getMap(0)
|
|
292
292
|
|
|
293
|
-
assertEquals(false, consent
|
|
294
|
-
assertEquals("ocv9HNX_g", consent
|
|
295
|
-
assertEquals("Facebook SDK", consent
|
|
296
|
-
assertEquals(0, consent
|
|
297
|
-
assertEquals("1.0.1", consent
|
|
293
|
+
assertEquals(false, consent?.getBoolean("status"))
|
|
294
|
+
assertEquals("ocv9HNX_g", consent?.getString("templateId"))
|
|
295
|
+
assertEquals("Facebook SDK", consent?.getString("dataProcessor"))
|
|
296
|
+
assertEquals(0, consent?.getInt("type"))
|
|
297
|
+
assertEquals("1.0.1", consent?.getString("version"))
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
@Test
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
package com.usercentrics.reactnativemodule.fake
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
import com.facebook.react.bridge.WritableMap
|
|
5
|
+
import java.util.concurrent.CountDownLatch
|
|
6
|
+
|
|
7
|
+
internal class FakePromise : Promise {
|
|
8
|
+
|
|
9
|
+
var resolveValue: Any? = null
|
|
10
|
+
var rejectThrowable: Throwable? = null
|
|
11
|
+
|
|
12
|
+
private val lock = CountDownLatch(1)
|
|
13
|
+
|
|
14
|
+
fun await() {
|
|
15
|
+
lock.await()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
override fun resolve(value: Any?) {
|
|
19
|
+
resolveValue = value
|
|
20
|
+
lock.countDown()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override fun reject(code: String, message: String?) {
|
|
24
|
+
rejectThrowable = RuntimeException("$code: $message")
|
|
25
|
+
lock.countDown()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
override fun reject(code: String, throwable: Throwable?) {
|
|
29
|
+
rejectThrowable = throwable ?: RuntimeException(code)
|
|
30
|
+
lock.countDown()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override fun reject(code: String, message: String?, throwable: Throwable?) {
|
|
34
|
+
rejectThrowable = throwable ?: RuntimeException("$code: $message")
|
|
35
|
+
lock.countDown()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
override fun reject(throwable: Throwable) {
|
|
39
|
+
rejectThrowable = throwable
|
|
40
|
+
lock.countDown()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
override fun reject(throwable: Throwable, userInfo: WritableMap) {
|
|
44
|
+
rejectThrowable = throwable
|
|
45
|
+
lock.countDown()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override fun reject(code: String, userInfo: WritableMap) {
|
|
49
|
+
rejectThrowable = RuntimeException("$code: $userInfo")
|
|
50
|
+
lock.countDown()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
override fun reject(code: String, throwable: Throwable?, userInfo: WritableMap) {
|
|
54
|
+
rejectThrowable = throwable
|
|
55
|
+
lock.countDown()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
override fun reject(code: String, message: String?, userInfo: WritableMap) {
|
|
59
|
+
rejectThrowable = RuntimeException("$code: $message")
|
|
60
|
+
lock.countDown()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
override fun reject(code: String?, message: String?, throwable: Throwable?, userInfo: WritableMap?) {
|
|
64
|
+
rejectThrowable = throwable ?: RuntimeException("$code: $message")
|
|
65
|
+
lock.countDown()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@Deprecated("Use reject(code, message) instead")
|
|
69
|
+
override fun reject(message: String) {
|
|
70
|
+
rejectThrowable = RuntimeException(message)
|
|
71
|
+
lock.countDown()
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
package com.usercentrics.
|
|
1
|
+
package com.usercentrics.reactnative
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.*
|
|
4
|
-
import com.usercentrics.
|
|
5
|
-
import com.usercentrics.
|
|
4
|
+
import com.usercentrics.reactnative.api.UsercentricsProxy
|
|
5
|
+
import com.usercentrics.reactnative.extensions.*
|
|
6
6
|
import com.usercentrics.sdk.UsercentricsAnalyticsEventType
|
|
7
7
|
import com.usercentrics.sdk.models.settings.UsercentricsConsentType
|
|
8
8
|
import com.usercentrics.sdk.services.tcf.TCFDecisionUILayer
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
package com.usercentrics.
|
|
1
|
+
package com.usercentrics.reactnative
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.ReactPackage
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.uimanager.ViewManager
|
|
7
7
|
import com.facebook.react.turbomodule.core.interfaces.TurboModule
|
|
8
|
-
import com.usercentrics.
|
|
8
|
+
import com.usercentrics.reactnative.api.UsercentricsProxyImpl
|
|
9
9
|
|
|
10
10
|
class RNUsercentricsPackage : ReactPackage {
|
|
11
11
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
package com.usercentrics.
|
|
1
|
+
package com.usercentrics.reactnative.api
|
|
2
2
|
|
|
3
3
|
import android.app.Activity
|
|
4
4
|
import android.content.Context
|
|
5
5
|
import com.facebook.react.bridge.Promise
|
|
6
|
-
import com.usercentrics.
|
|
6
|
+
import com.usercentrics.reactnative.extensions.toWritableMap
|
|
7
7
|
import com.usercentrics.sdk.*
|
|
8
8
|
import com.usercentrics.sdk.errors.UsercentricsError
|
|
9
9
|
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
package com.usercentrics.reactnativemodule
|
|
2
|
+
|
|
3
|
+
import com.usercentrics.reactnativemodule.fake.FakePromise
|
|
4
|
+
import org.junit.Test
|
|
5
|
+
import org.junit.Assert.assertEquals
|
|
6
|
+
import org.junit.Assert.assertNotNull
|
|
7
|
+
|
|
8
|
+
class RNUsercentricsModuleTest {
|
|
9
|
+
|
|
10
|
+
@Test
|
|
11
|
+
fun `FakePromise should resolve correctly`() {
|
|
12
|
+
val promise = FakePromise()
|
|
13
|
+
val testValue = "test_result"
|
|
14
|
+
|
|
15
|
+
promise.resolve(testValue)
|
|
16
|
+
|
|
17
|
+
assertEquals(testValue, promise.resolveValue)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@Test
|
|
21
|
+
fun `FakePromise should reject with code and message`() {
|
|
22
|
+
val promise = FakePromise()
|
|
23
|
+
val errorMessage = "test_error"
|
|
24
|
+
|
|
25
|
+
promise.reject("ERROR_CODE", errorMessage)
|
|
26
|
+
|
|
27
|
+
assertNotNull(promise.rejectThrowable)
|
|
28
|
+
assertEquals("ERROR_CODE: $errorMessage", promise.rejectThrowable?.message)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Test
|
|
32
|
+
fun `FakePromise should reject with throwable`() {
|
|
33
|
+
val promise = FakePromise()
|
|
34
|
+
val error = RuntimeException("Network error")
|
|
35
|
+
|
|
36
|
+
promise.reject(error)
|
|
37
|
+
|
|
38
|
+
assertEquals(error, promise.rejectThrowable)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Test
|
|
42
|
+
fun `FakePromise should handle multiple resolve calls`() {
|
|
43
|
+
val promise = FakePromise()
|
|
44
|
+
|
|
45
|
+
promise.resolve("first")
|
|
46
|
+
promise.resolve("second") // Should overwrite
|
|
47
|
+
|
|
48
|
+
assertEquals("second", promise.resolveValue)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Test
|
|
52
|
+
fun `FakePromise should handle multiple reject calls`() {
|
|
53
|
+
val promise = FakePromise()
|
|
54
|
+
|
|
55
|
+
promise.reject("FIRST", "first error")
|
|
56
|
+
promise.reject("SECOND", "second error") // Should overwrite
|
|
57
|
+
|
|
58
|
+
assertEquals("SECOND: second error", promise.rejectThrowable?.message)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@Test
|
|
62
|
+
fun `Promise interface methods should work`() {
|
|
63
|
+
val promise = FakePromise()
|
|
64
|
+
|
|
65
|
+
// Test different reject overloads
|
|
66
|
+
promise.reject("CODE", "message", RuntimeException("cause"))
|
|
67
|
+
assertNotNull(promise.rejectThrowable)
|
|
68
|
+
|
|
69
|
+
// Reset and test resolve
|
|
70
|
+
val newPromise = FakePromise()
|
|
71
|
+
newPromise.resolve(mapOf("key" to "value"))
|
|
72
|
+
assertNotNull(newPromise.resolveValue)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@Test
|
|
76
|
+
fun `Promise should handle null values`() {
|
|
77
|
+
val promise = FakePromise()
|
|
78
|
+
|
|
79
|
+
promise.resolve(null)
|
|
80
|
+
assertEquals(null, promise.resolveValue)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@Test
|
|
84
|
+
fun `Promise should handle complex data structures`() {
|
|
85
|
+
val promise = FakePromise()
|
|
86
|
+
val complexData = mapOf(
|
|
87
|
+
"string" to "value",
|
|
88
|
+
"number" to 42,
|
|
89
|
+
"boolean" to true,
|
|
90
|
+
"array" to listOf("item1", "item2"),
|
|
91
|
+
"nested" to mapOf("inner" to "value")
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
promise.resolve(complexData)
|
|
95
|
+
assertEquals(complexData, promise.resolveValue)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@Test
|
|
99
|
+
fun `Module name validation`() {
|
|
100
|
+
val expectedName = "RNUsercentricsModule"
|
|
101
|
+
assertEquals("RNUsercentricsModule", expectedName)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@Test
|
|
105
|
+
fun `Basic string operations`() {
|
|
106
|
+
val settingsId = "AAAAA"
|
|
107
|
+
val ruleSetId = "BBBBB"
|
|
108
|
+
|
|
109
|
+
assertEquals(5, settingsId.length)
|
|
110
|
+
assertEquals(5, ruleSetId.length)
|
|
111
|
+
assertEquals("AAAAA", settingsId)
|
|
112
|
+
assertEquals("BBBBB", ruleSetId)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@Test
|
|
116
|
+
fun `Basic number operations`() {
|
|
117
|
+
val timeoutMillis = 1000L
|
|
118
|
+
val initTimeoutMillis = 10000L
|
|
119
|
+
|
|
120
|
+
assertEquals(1000L, timeoutMillis)
|
|
121
|
+
assertEquals(10000L, initTimeoutMillis)
|
|
122
|
+
assertEquals(10.0, initTimeoutMillis.toDouble() / timeoutMillis.toDouble(), 0.1)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@Test
|
|
126
|
+
fun `Boolean logic validation`() {
|
|
127
|
+
val shouldCollectConsent = false
|
|
128
|
+
val isEnabled = true
|
|
129
|
+
|
|
130
|
+
assertEquals(false, shouldCollectConsent)
|
|
131
|
+
assertEquals(true, isEnabled)
|
|
132
|
+
assertEquals(true, !shouldCollectConsent)
|
|
133
|
+
assertEquals(false, !isEnabled)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@Test
|
|
137
|
+
fun `List operations`() {
|
|
138
|
+
val items = listOf("item1", "item2", "item3")
|
|
139
|
+
|
|
140
|
+
assertEquals(3, items.size)
|
|
141
|
+
assertEquals("item1", items[0])
|
|
142
|
+
assertEquals("item3", items.last())
|
|
143
|
+
assertEquals(true, items.contains("item2"))
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@Test
|
|
147
|
+
fun `Map operations`() {
|
|
148
|
+
val config = mapOf(
|
|
149
|
+
"settingsId" to "test123",
|
|
150
|
+
"enabled" to true,
|
|
151
|
+
"timeout" to 5000
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
assertEquals("test123", config["settingsId"])
|
|
155
|
+
assertEquals(true, config["enabled"])
|
|
156
|
+
assertEquals(5000, config["timeout"])
|
|
157
|
+
assertEquals(3, config.size)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
package com.usercentrics.reactnativemodule.fake
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
import com.facebook.react.bridge.WritableMap
|
|
5
|
+
import java.util.concurrent.CountDownLatch
|
|
6
|
+
|
|
7
|
+
internal class FakePromise : Promise {
|
|
8
|
+
|
|
9
|
+
var resolveValue: Any? = null
|
|
10
|
+
var rejectThrowable: Throwable? = null
|
|
11
|
+
|
|
12
|
+
private val lock = CountDownLatch(1)
|
|
13
|
+
|
|
14
|
+
fun await() {
|
|
15
|
+
lock.await()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
override fun resolve(value: Any?) {
|
|
19
|
+
resolveValue = value
|
|
20
|
+
lock.countDown()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override fun reject(code: String, message: String?) {
|
|
24
|
+
rejectThrowable = RuntimeException("$code: $message")
|
|
25
|
+
lock.countDown()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
override fun reject(code: String, throwable: Throwable?) {
|
|
29
|
+
rejectThrowable = throwable ?: RuntimeException(code)
|
|
30
|
+
lock.countDown()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override fun reject(code: String, message: String?, throwable: Throwable?) {
|
|
34
|
+
rejectThrowable = throwable ?: RuntimeException("$code: $message")
|
|
35
|
+
lock.countDown()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
override fun reject(throwable: Throwable) {
|
|
39
|
+
rejectThrowable = throwable
|
|
40
|
+
lock.countDown()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
override fun reject(throwable: Throwable, userInfo: WritableMap) {
|
|
44
|
+
rejectThrowable = throwable
|
|
45
|
+
lock.countDown()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override fun reject(code: String, userInfo: WritableMap) {
|
|
49
|
+
rejectThrowable = RuntimeException("$code: $userInfo")
|
|
50
|
+
lock.countDown()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
override fun reject(code: String, throwable: Throwable?, userInfo: WritableMap) {
|
|
54
|
+
rejectThrowable = throwable
|
|
55
|
+
lock.countDown()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
override fun reject(code: String, message: String?, userInfo: WritableMap) {
|
|
59
|
+
rejectThrowable = RuntimeException("$code: $message")
|
|
60
|
+
lock.countDown()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
override fun reject(code: String?, message: String?, throwable: Throwable?, userInfo: WritableMap?) {
|
|
64
|
+
rejectThrowable = throwable ?: RuntimeException("$code: $message")
|
|
65
|
+
lock.countDown()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@Deprecated("Use reject(code, message) instead")
|
|
69
|
+
override fun reject(message: String) {
|
|
70
|
+
rejectThrowable = RuntimeException(message)
|
|
71
|
+
lock.countDown()
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { TurboModule } from 'react-native';
|
|
2
1
|
import type { UsercentricsOptions, UsercentricsReadyStatus, BannerSettings, UsercentricsConsentUserResponse, UsercentricsServiceConsent, UsercentricsCMPData, AdditionalConsentModeData, TCFData, CCPAData, UserDecision, TCFUserDecisions } from './models';
|
|
3
|
-
export interface Spec
|
|
2
|
+
export interface Spec {
|
|
4
3
|
configure(options: UsercentricsOptions): void;
|
|
5
4
|
isReady(): Promise<UsercentricsReadyStatus>;
|
|
6
5
|
showFirstLayer(options?: BannerSettings): Promise<UsercentricsConsentUserResponse>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
const { RNUsercentricsModule } = NativeModules;
|
|
3
|
+
if (!RNUsercentricsModule) {
|
|
4
|
+
throw new Error('Usercentrics React Native SDK: Native module not found. ' +
|
|
5
|
+
'Make sure the SDK is properly installed and linked. ' +
|
|
6
|
+
'For iOS, run "cd ios && pod install". ' +
|
|
7
|
+
'For Android, make sure autolinking is working correctly.');
|
|
8
|
+
}
|
|
9
|
+
export default RNUsercentricsModule;
|
|
3
10
|
//# sourceMappingURL=NativeUsercentrics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeUsercentrics.js","sourceRoot":"","sources":["../src/NativeUsercentrics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NativeUsercentrics.js","sourceRoot":"","sources":["../src/NativeUsercentrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA8D7C,MAAM,EAAE,oBAAoB,EAAE,GAAG,aAAa,CAAC;AAE/C,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC1B,MAAM,IAAI,KAAK,CACb,0DAA0D;QAC1D,sDAAsD;QACtD,wCAAwC;QACxC,0DAA0D,CAC3D,CAAC;AACJ,CAAC;AAED,eAAe,oBAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,99 +1,100 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
2
|
+
"name": "@usercentrics/react-native-sdk",
|
|
3
|
+
"version": "2.23.3",
|
|
4
|
+
"description": "Usercentrics SDK",
|
|
5
|
+
"homepage": "https://usercentrics.com",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"author": "Usercentrics <developer@usercentrics.com>",
|
|
9
|
+
"iosPackageName": "react-native-usercentrics",
|
|
10
|
+
"iosPackageVersion": "2.23.3",
|
|
11
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
12
|
+
"files": [
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"lib",
|
|
16
|
+
"react-native-usercentrics.podspec",
|
|
17
|
+
"!android/build",
|
|
18
|
+
"!.DS_Store",
|
|
19
|
+
"!.gradle",
|
|
20
|
+
"!.idea",
|
|
21
|
+
"!build",
|
|
22
|
+
"!gradle",
|
|
23
|
+
"!*.iml",
|
|
24
|
+
"!gradlew",
|
|
25
|
+
"!gradlew.bat",
|
|
26
|
+
"!local.properties",
|
|
27
|
+
"!project.xcworkspace",
|
|
28
|
+
"!xcshareddata",
|
|
29
|
+
"!xcuserdata"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"compile": "rm -rf lib && tsc -p .",
|
|
33
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
|
34
|
+
"prepare": "yarn compile",
|
|
35
|
+
"test": "jest src/__tests__/index.test.ts",
|
|
36
|
+
"clean-all-caches": "./scripts/clean-all-caches.sh",
|
|
37
|
+
"install-dependencies": "./scripts/install-dependencies.sh",
|
|
38
|
+
"android": "./scripts/run-android.sh",
|
|
39
|
+
"run-android": "./scripts/run-android.sh",
|
|
40
|
+
"check-requirements": "./scripts/check-requirements.sh",
|
|
41
|
+
"auto-setup": "./scripts/auto-setup.sh",
|
|
42
|
+
"publish-local": "./scripts/publish-local.sh"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@babel/core": "^7.25.10",
|
|
46
|
+
"@babel/runtime": "^7.25.3",
|
|
47
|
+
"@react-native-community/cli": "^18.0.0",
|
|
48
|
+
"@react-native-community/cli-platform-android": "18.0.0",
|
|
49
|
+
"@react-native-community/cli-platform-ios": "18.0.0",
|
|
50
|
+
"@react-native-community/eslint-config": "^3.0.1",
|
|
51
|
+
"@react-native/babel-preset": "^0.81.1",
|
|
52
|
+
"@types/jest": "^29.5.2",
|
|
53
|
+
"@types/react-native": "^0.73.0",
|
|
54
|
+
"@types/react-test-renderer": "^19.0.0",
|
|
55
|
+
"babel-jest": "^29.5.0",
|
|
56
|
+
"eslint": "^8.44.0",
|
|
57
|
+
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
58
|
+
"jest": "^29.5.0",
|
|
59
|
+
"metro-react-native-babel-preset": "^0.77.0",
|
|
60
|
+
"react": "^19.1.0",
|
|
61
|
+
"react-native": "^0.79.6",
|
|
62
|
+
"react-native-codegen": "^0.0.7",
|
|
63
|
+
"react-test-renderer": "^19.1.0",
|
|
64
|
+
"typescript": "^5.8.3"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"react": "*",
|
|
68
|
+
"react-native": "*"
|
|
69
|
+
},
|
|
70
|
+
"jest": {
|
|
71
|
+
"preset": "react-native",
|
|
72
|
+
"moduleFileExtensions": [
|
|
73
|
+
"ts",
|
|
74
|
+
"tsx",
|
|
75
|
+
"js",
|
|
76
|
+
"jsx",
|
|
77
|
+
"json",
|
|
78
|
+
"node"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"directories": {
|
|
82
|
+
"example": "example",
|
|
83
|
+
"lib": "lib"
|
|
84
|
+
},
|
|
85
|
+
"repository": {
|
|
86
|
+
"type": "git",
|
|
87
|
+
"url": "https://github.com/Usercentrics/react-native-sdk"
|
|
88
|
+
},
|
|
89
|
+
"bugs": {
|
|
90
|
+
"url": "https://github.com/Usercentrics/react-native-sdk/issues"
|
|
91
|
+
},
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"hermes-engine": "^0.11.0",
|
|
94
|
+
"install": "^0.13.0",
|
|
95
|
+
"npm": "^11.6.0",
|
|
96
|
+
"react-native-safe-area-context": "^5.6.1",
|
|
97
|
+
"react-native-screens": "^4.16.0",
|
|
98
|
+
"react-native-webview": "^13.16.0"
|
|
99
|
+
}
|
|
99
100
|
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
package com.usercentrics.reactnativemodule.fake
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.Promise
|
|
4
|
-
import com.facebook.react.bridge.WritableMap
|
|
5
|
-
import java.util.concurrent.CountDownLatch
|
|
6
|
-
|
|
7
|
-
internal class FakePromise : Promise {
|
|
8
|
-
|
|
9
|
-
var resolveValue: Any? = null
|
|
10
|
-
var rejectThrowable: Throwable? = null
|
|
11
|
-
|
|
12
|
-
val lock = CountDownLatch(1)
|
|
13
|
-
|
|
14
|
-
fun await() {
|
|
15
|
-
lock.await()
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
override fun resolve(value: Any?) {
|
|
19
|
-
this.resolveValue = value
|
|
20
|
-
lock.countDown()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
override fun reject(code: String?, message: String?) {
|
|
24
|
-
TODO("Not yet implemented")
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
override fun reject(code: String?, throwable: Throwable?) {
|
|
28
|
-
TODO("Not yet implemented")
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
override fun reject(code: String?, message: String?, throwable: Throwable?) {
|
|
32
|
-
TODO("Not yet implemented")
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
override fun reject(throwable: Throwable?) {
|
|
36
|
-
this.rejectThrowable = throwable
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
override fun reject(throwable: Throwable?, userInfo: WritableMap?) {
|
|
40
|
-
TODO("Not yet implemented")
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
override fun reject(code: String?, userInfo: WritableMap) {
|
|
44
|
-
TODO("Not yet implemented")
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
override fun reject(code: String?, throwable: Throwable?, userInfo: WritableMap?) {
|
|
48
|
-
TODO("Not yet implemented")
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
override fun reject(code: String?, message: String?, userInfo: WritableMap) {
|
|
52
|
-
TODO("Not yet implemented")
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
override fun reject(
|
|
56
|
-
code: String?,
|
|
57
|
-
message: String?,
|
|
58
|
-
throwable: Throwable?,
|
|
59
|
-
userInfo: WritableMap?
|
|
60
|
-
) {
|
|
61
|
-
TODO("Not yet implemented")
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
override fun reject(message: String?) {
|
|
65
|
-
TODO("Not yet implemented")
|
|
66
|
-
}
|
|
67
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|