@usercentrics/react-native-sdk 2.2.2-RC1 → 2.3.0
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/CHANGELOG.md +58 -0
- package/android/build.gradle +1 -1
- package/android/src/androidTest/java/com/usercentrics/reactnativemodule/RNUsercentricsModuleTest.kt +7 -113
- package/android/src/androidTest/java/com/usercentrics/reactnativemodule/api/FakeUsercentricsProxy.kt +0 -20
- package/android/src/main/java/com/usercentrics/reactnativeusercentrics/RNUsercentricsModule.kt +0 -45
- package/android/src/main/java/com/usercentrics/reactnativeusercentrics/api/UsercentricsProxy.kt +0 -22
- package/android/src/main/java/com/usercentrics/reactnativeusercentrics/extensions/BannerFontExtensions.kt +26 -0
- package/android/src/main/java/com/usercentrics/reactnativeusercentrics/extensions/FirstLayerOptionsExtensions.kt +15 -14
- package/android/src/main/java/com/usercentrics/reactnativeusercentrics/extensions/UsercentricsReadyStatusExtensions.kt +1 -1
- package/ios/Extensions/BannerSettings+Dict.swift +62 -15
- package/ios/Extensions/ReadyStatus+Dict.swift +1 -1
- package/ios/Manager/UsercentricsManager.swift +4 -11
- package/ios/RNUsercentricsModule.swift +9 -45
- package/ios/RNUsercentricsModule.xcodeproj/project.pbxproj +0 -8
- package/lib/Usercentrics.d.ts +1 -5
- package/lib/Usercentrics.js +0 -7
- package/lib/Usercentrics.js.map +1 -1
- package/lib/models/BannerSettings.d.ts +16 -4
- package/lib/models/BannerSettings.js +14 -0
- package/lib/models/BannerSettings.js.map +1 -1
- package/lib/models/FirstLayerOptions.d.ts +13 -10
- package/lib/models/FirstLayerOptions.js +9 -6
- package/lib/models/FirstLayerOptions.js.map +1 -1
- package/lib/models/UsercentricsReadyStatus.d.ts +2 -2
- package/lib/models/UsercentricsReadyStatus.js +2 -2
- package/lib/models/UsercentricsReadyStatus.js.map +1 -1
- package/lib/models/index.d.ts +1 -2
- package/lib/models/index.js +1 -2
- package/lib/models/index.js.map +1 -1
- package/package.json +2 -2
- package/android/src/main/java/com/usercentrics/reactnativeusercentrics/extensions/UsercentricsUserInterfaceExtensions.kt +0 -45
- package/ios/Extensions/UIFont+UsercentricsFontDict.swift +0 -15
- package/ios/Extensions/UsercentricsUISettings+Dict.swift +0 -27
- package/lib/models/UsercentricsUIOptions.d.ts +0 -18
- package/lib/models/UsercentricsUIOptions.js +0 -21
- package/lib/models/UsercentricsUIOptions.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[Release Notes](https://docs.usercentrics.com/cmp_in_app_sdk/latest/about/history/)
|
|
2
|
+
|
|
3
|
+
# 2.3.0
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **[API Update]** `shouldShowCMP` has been deprecated in favor of `shouldCollectConsent`. See [Initializing the SDK](https://docs.usercentrics.com/cmp_in_app_sdk/latest/getting_started/initialize/#initializing-the-sdk)
|
|
8
|
+
- **[Banner API v2]** Banner API v1 is now discontinued and removed from the SDK. If you don't wish to upgrade, please stick to v2.0.3 to avoid unexpected behaviour. See the [alert in the "Banner API V1" tab](https://docs.usercentrics.com/cmp_in_app_sdk/latest/collect_consent/present_cmp/)
|
|
9
|
+
- **[Banner API v2]** BannerSettings now requires a BannerFont object to pass a Bold and Regular font separately to apply for both layers. See [Banner Settings](https://docs.usercentrics.com/cmp_in_app_sdk/latest/collect_consent/customize_cmp/#banner-style-settings)
|
|
10
|
+
- **[Demo App]** You can now find a demo app in our documentation to test out your configuration before writing a single line of code. See [Sample Apps](https://docs.usercentrics.com/cmp_in_app_sdk/latest/samples/ios-android-demos/).
|
|
11
|
+
|
|
12
|
+
## Improvements
|
|
13
|
+
|
|
14
|
+
- Updates to TCF 2.0 framework.
|
|
15
|
+
|
|
16
|
+
## Resolved Issues
|
|
17
|
+
|
|
18
|
+
- Issue with position of logo on Second Layer is now solved.
|
|
19
|
+
- UI/UX improvements and fixes.
|
|
20
|
+
|
|
21
|
+
# 2.2.1
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- **[Banner API v2]** A complete revamp of our banner API will enable you to have high customisation and versatility to build a end-user friendly consent banner. We can't wait for you to give it a try. For more details, see: Presenting the Banner.
|
|
26
|
+
- Add a Header Image to your banner.
|
|
27
|
+
- Have full control over the layour of your action buttons with Column, Row or Grid configurations.
|
|
28
|
+
- Launch the second layer directly.
|
|
29
|
+
- Landscape Mode support.
|
|
30
|
+
- You can now add a "More Information" link to your banner message to forward users to the 2nd Layer. Appearance > Settings > More Information Link in Banner Message. Then you will be able to add this link in the banner message text editor.
|
|
31
|
+
- **[Usability]** Collect consent only at a category level. Option available in your Admin Interface: Configure > Legal Specifications > Settings > Category Consent.
|
|
32
|
+
- **[CNIL]** "Continue wthout Accepting" feature is now supported. (French regulation)
|
|
33
|
+
- **[Fonts]** Admin Interface fonts are now deprecated for App. To enable custom fonts, please inject the font via banner API.
|
|
34
|
+
|
|
35
|
+
## Improvements
|
|
36
|
+
|
|
37
|
+
- **[API]** Expose user's consent history.
|
|
38
|
+
- **[TCF 2.0]** Adding support to actively inform users when vendors are sharing data outside a region.
|
|
39
|
+
- **[CCPA]** Improve API to facilitate compliance with new Banner API.
|
|
40
|
+
|
|
41
|
+
## Resolved Issues
|
|
42
|
+
- **[TCF 2.0]** Minor design upgrades to improve usability.
|
|
43
|
+
- **[iOS]** Edge case with RestoreUserSession failing is now solved.
|
|
44
|
+
- **[iOS]** Issue with local and remote images losing quality is now solved.
|
|
45
|
+
- UI/UX improvements and fixes.
|
|
46
|
+
|
|
47
|
+
# 2.0.3
|
|
48
|
+
|
|
49
|
+
- Minor fix on UI related to consent toggles.
|
|
50
|
+
- Corner radius on iOS.
|
|
51
|
+
|
|
52
|
+
# 2.0.2
|
|
53
|
+
|
|
54
|
+
- Custom UI API.
|
|
55
|
+
|
|
56
|
+
# 2.0.1
|
|
57
|
+
|
|
58
|
+
- Initial version of the library.
|
package/android/build.gradle
CHANGED
package/android/src/androidTest/java/com/usercentrics/reactnativemodule/RNUsercentricsModuleTest.kt
CHANGED
|
@@ -2,7 +2,10 @@ package com.usercentrics.reactnativemodule
|
|
|
2
2
|
|
|
3
3
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
|
4
4
|
import androidx.test.platform.app.InstrumentationRegistry
|
|
5
|
-
import com.facebook.react.bridge
|
|
5
|
+
import com.facebook.react.bridge.JavaOnlyMap
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
|
+
import com.facebook.react.bridge.WritableArray
|
|
8
|
+
import com.facebook.react.bridge.WritableMap
|
|
6
9
|
import com.facebook.soloader.SoLoader
|
|
7
10
|
import com.usercentrics.reactnativemodule.api.FakeUsercentricsProxy
|
|
8
11
|
import com.usercentrics.reactnativemodule.fake.FakePromise
|
|
@@ -20,7 +23,6 @@ import io.mockk.every
|
|
|
20
23
|
import io.mockk.mockk
|
|
21
24
|
import io.mockk.verify
|
|
22
25
|
import org.junit.Assert.assertEquals
|
|
23
|
-
import org.junit.Assert.assertThrows
|
|
24
26
|
import org.junit.Before
|
|
25
27
|
import org.junit.Test
|
|
26
28
|
import org.junit.runner.RunWith
|
|
@@ -45,7 +47,7 @@ class RNUsercentricsModuleTest {
|
|
|
45
47
|
)
|
|
46
48
|
|
|
47
49
|
private val usercentricsReadyStatus = UsercentricsReadyStatus(
|
|
48
|
-
|
|
50
|
+
shouldCollectConsent = false,
|
|
49
51
|
consents = listOf(
|
|
50
52
|
UsercentricsServiceConsent(
|
|
51
53
|
templateId = "ocv9HNX_g",
|
|
@@ -58,37 +60,6 @@ class RNUsercentricsModuleTest {
|
|
|
58
60
|
)
|
|
59
61
|
)
|
|
60
62
|
)
|
|
61
|
-
|
|
62
|
-
private val usercentricsUIOptions = JavaOnlyMap().apply {
|
|
63
|
-
putBoolean("showCloseButton", false)
|
|
64
|
-
putMap("customLogo", JavaOnlyMap().apply {
|
|
65
|
-
putString("logoName", "logo.png")
|
|
66
|
-
putString(
|
|
67
|
-
"logoPath",
|
|
68
|
-
"http://10.0.2.2:8081/assets/assets/images/logo.png"
|
|
69
|
-
)
|
|
70
|
-
})
|
|
71
|
-
putMap("customFont", JavaOnlyMap().apply {
|
|
72
|
-
putString("fontName", "Lora")
|
|
73
|
-
putInt("fontSize", 14)
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private val usercentricsConsentUserResponse = UsercentricsConsentUserResponse(
|
|
78
|
-
consents = listOf(
|
|
79
|
-
UsercentricsServiceConsent(
|
|
80
|
-
templateId = "ocv9HNX_g",
|
|
81
|
-
status = false,
|
|
82
|
-
dataProcessor = "Facebook SDK",
|
|
83
|
-
type = UsercentricsConsentType.EXPLICIT,
|
|
84
|
-
version = "1.0.1",
|
|
85
|
-
isEssential = false,
|
|
86
|
-
history = usercentricsConsentHistoryEntries
|
|
87
|
-
)
|
|
88
|
-
),
|
|
89
|
-
controllerId = "8620135313b043696b806868b20da905886a3a2598ddddc2b52973f9807d6b45",
|
|
90
|
-
userInteraction = UsercentricsUserInteraction.ACCEPT_ALL
|
|
91
|
-
)
|
|
92
63
|
}
|
|
93
64
|
|
|
94
65
|
@Before
|
|
@@ -148,7 +119,7 @@ class RNUsercentricsModuleTest {
|
|
|
148
119
|
val consent = result.getArray("consents")?.getMap(0)!!
|
|
149
120
|
|
|
150
121
|
assertEquals(1, usercentricsProxy.isReadyCount)
|
|
151
|
-
assertEquals(false, result.getBoolean("
|
|
122
|
+
assertEquals(false, result.getBoolean("shouldCollectConsent"))
|
|
152
123
|
assertEquals(false, consent.getBoolean("status"))
|
|
153
124
|
assertEquals("ocv9HNX_g", consent.getString("templateId"))
|
|
154
125
|
assertEquals("Facebook SDK", consent.getString("dataProcessor"))
|
|
@@ -191,7 +162,7 @@ class RNUsercentricsModuleTest {
|
|
|
191
162
|
val result = promise.resolveValue as WritableMap
|
|
192
163
|
val consent = result.getArray("consents")?.getMap(0)!!
|
|
193
164
|
|
|
194
|
-
assertEquals(false, result.getBoolean("
|
|
165
|
+
assertEquals(false, result.getBoolean("shouldCollectConsent"))
|
|
195
166
|
assertEquals(false, consent.getBoolean("status"))
|
|
196
167
|
assertEquals("ocv9HNX_g", consent.getString("templateId"))
|
|
197
168
|
assertEquals("Facebook SDK", consent.getString("dataProcessor"))
|
|
@@ -248,83 +219,6 @@ class RNUsercentricsModuleTest {
|
|
|
248
219
|
assertEquals("abc", promise.resolveValue)
|
|
249
220
|
}
|
|
250
221
|
|
|
251
|
-
@Test
|
|
252
|
-
fun testShowCMP() {
|
|
253
|
-
val usercentricsProxy = FakeUsercentricsProxy()
|
|
254
|
-
usercentricsProxy.createIntentValue = mockk(relaxed = true)
|
|
255
|
-
|
|
256
|
-
val contextMock = mockk<ReactApplicationContext>(relaxed = true)
|
|
257
|
-
val module = RNUsercentricsModule(contextMock, usercentricsProxy)
|
|
258
|
-
val promise = FakePromise()
|
|
259
|
-
|
|
260
|
-
module.showCMP(usercentricsUIOptions, promise)
|
|
261
|
-
|
|
262
|
-
val responseUsercentricsOptions = usercentricsProxy.usercentricsOptions!!
|
|
263
|
-
val customLogoURL =
|
|
264
|
-
(responseUsercentricsOptions.customLogo as UsercentricsImage.ImageUrl).imageUrl
|
|
265
|
-
|
|
266
|
-
assertEquals(false, responseUsercentricsOptions.showCloseButton)
|
|
267
|
-
assertEquals(
|
|
268
|
-
"http://10.0.2.2:8081/assets/assets/images/logo.png",
|
|
269
|
-
customLogoURL
|
|
270
|
-
)
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
@Test
|
|
274
|
-
fun testOnActivityResultWithOtherCode() {
|
|
275
|
-
val usercentricsProxy = FakeUsercentricsProxy()
|
|
276
|
-
val contextMock = mockk<ReactApplicationContext>(relaxed = true)
|
|
277
|
-
val module = RNUsercentricsModule(contextMock, usercentricsProxy)
|
|
278
|
-
|
|
279
|
-
val otherRequestCode = 123
|
|
280
|
-
val consumed = module.parseActivityResult(otherRequestCode, 123, null)
|
|
281
|
-
|
|
282
|
-
assertEquals(false, consumed)
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
@Test
|
|
286
|
-
fun testOnActivityResultWithNoPendingResult() {
|
|
287
|
-
val usercentricsProxy = FakeUsercentricsProxy()
|
|
288
|
-
val contextMock = mockk<ReactApplicationContext>(relaxed = true)
|
|
289
|
-
val module = RNUsercentricsModule(contextMock, usercentricsProxy)
|
|
290
|
-
|
|
291
|
-
assertThrows(AssertionError::class.java) {
|
|
292
|
-
module.parseActivityResult(81420, 123, null)
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
@Test
|
|
297
|
-
fun testOnActivityResultWithPendingResult() {
|
|
298
|
-
val resultCode = 123
|
|
299
|
-
val usercentricsProxy = FakeUsercentricsProxy()
|
|
300
|
-
usercentricsProxy.createIntentValue = mockk(relaxed = true)
|
|
301
|
-
usercentricsProxy.parseResultValue = usercentricsConsentUserResponse
|
|
302
|
-
|
|
303
|
-
val contextMock = mockk<ReactApplicationContext>(relaxed = true)
|
|
304
|
-
val module = RNUsercentricsModule(contextMock, usercentricsProxy)
|
|
305
|
-
|
|
306
|
-
val promise = FakePromise()
|
|
307
|
-
module.showCMP(usercentricsUIOptions, promise)
|
|
308
|
-
|
|
309
|
-
module.parseActivityResult(81420, resultCode, null)
|
|
310
|
-
|
|
311
|
-
assertEquals(resultCode, usercentricsProxy.parseResultResultCodeArgument)
|
|
312
|
-
|
|
313
|
-
val result = promise.resolveValue as WritableMap
|
|
314
|
-
val consent = result.getArray("consents")?.getMap(0)!!
|
|
315
|
-
|
|
316
|
-
assertEquals(
|
|
317
|
-
"8620135313b043696b806868b20da905886a3a2598ddddc2b52973f9807d6b45",
|
|
318
|
-
result.getString("controllerId")
|
|
319
|
-
)
|
|
320
|
-
assertEquals(0, result.getInt("userInteraction"))
|
|
321
|
-
assertEquals(false, consent.getBoolean("status"))
|
|
322
|
-
assertEquals("ocv9HNX_g", consent.getString("templateId"))
|
|
323
|
-
assertEquals("Facebook SDK", consent.getString("dataProcessor"))
|
|
324
|
-
assertEquals(0, consent.getInt("type"))
|
|
325
|
-
assertEquals("1.0.1", consent.getString("version"))
|
|
326
|
-
}
|
|
327
|
-
|
|
328
222
|
@Test
|
|
329
223
|
fun testGetConsents() {
|
|
330
224
|
val usercentricsSDK = mockk<UsercentricsSDK>()
|
package/android/src/androidTest/java/com/usercentrics/reactnativemodule/api/FakeUsercentricsProxy.kt
CHANGED
|
@@ -42,26 +42,6 @@ internal class FakeUsercentricsProxy(
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
var createIntentValue: Intent? = null
|
|
46
|
-
var usercentricsOptions: UsercentricsUISettings? = null
|
|
47
|
-
private set
|
|
48
|
-
|
|
49
|
-
override fun createIntent(
|
|
50
|
-
context: Context,
|
|
51
|
-
usercentricsOptions: UsercentricsUISettings
|
|
52
|
-
): Intent {
|
|
53
|
-
this.usercentricsOptions = usercentricsOptions
|
|
54
|
-
return createIntentValue!!
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var parseResultResultCodeArgument: Int = 0
|
|
58
|
-
private set
|
|
59
|
-
var parseResultValue: UsercentricsConsentUserResponse? = null
|
|
60
|
-
override fun parseResult(resultCode: Int, data: Intent?): UsercentricsConsentUserResponse? {
|
|
61
|
-
this.parseResultResultCodeArgument = resultCode
|
|
62
|
-
return parseResultValue
|
|
63
|
-
}
|
|
64
|
-
|
|
65
45
|
var resetCount: Int = 0
|
|
66
46
|
private set
|
|
67
47
|
|
package/android/src/main/java/com/usercentrics/reactnativeusercentrics/RNUsercentricsModule.kt
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
package com.usercentrics.reactnativeusercentrics
|
|
2
2
|
|
|
3
|
-
import android.app.Activity
|
|
4
|
-
import android.content.Intent
|
|
5
3
|
import com.facebook.react.bridge.*
|
|
6
4
|
import com.usercentrics.reactnativeusercentrics.api.UsercentricsProxy
|
|
7
5
|
import com.usercentrics.reactnativeusercentrics.extensions.*
|
|
8
6
|
import com.usercentrics.sdk.UsercentricsBanner
|
|
9
|
-
import com.usercentrics.sdk.UsercentricsLayout
|
|
10
7
|
import com.usercentrics.sdk.models.settings.UsercentricsConsentType
|
|
11
8
|
import com.usercentrics.sdk.services.tcf.TCFDecisionUILayer
|
|
12
|
-
import java.lang.Exception
|
|
13
9
|
|
|
14
10
|
internal class RNUsercentricsModule(
|
|
15
11
|
reactContext: ReactApplicationContext,
|
|
@@ -19,26 +15,6 @@ internal class RNUsercentricsModule(
|
|
|
19
15
|
|
|
20
16
|
override fun getName() = "RNUsercentricsModule"
|
|
21
17
|
|
|
22
|
-
private var pendingPromise: Promise? = null
|
|
23
|
-
private val listener: ActivityEventListener = object : BaseActivityEventListener() {
|
|
24
|
-
override fun onActivityResult(
|
|
25
|
-
activity: Activity?,
|
|
26
|
-
requestCode: Int,
|
|
27
|
-
resultCode: Int,
|
|
28
|
-
data: Intent?
|
|
29
|
-
) {
|
|
30
|
-
parseActivityResult(requestCode, resultCode, data)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
init {
|
|
35
|
-
reactApplicationContext.addActivityEventListener(listener)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
companion object {
|
|
39
|
-
private const val showCMPRequestCode = 81420
|
|
40
|
-
}
|
|
41
|
-
|
|
42
18
|
@ReactMethod
|
|
43
19
|
fun configure(options: ReadableMap) {
|
|
44
20
|
var alreadyConfigured = false
|
|
@@ -63,15 +39,6 @@ internal class RNUsercentricsModule(
|
|
|
63
39
|
})
|
|
64
40
|
}
|
|
65
41
|
|
|
66
|
-
@ReactMethod
|
|
67
|
-
fun showCMP(options: ReadableMap, promise: Promise) {
|
|
68
|
-
val usercentricsOptions = options.usercentricsUISettingsFromMap(currentActivity!!.assets)
|
|
69
|
-
this.pendingPromise = promise
|
|
70
|
-
|
|
71
|
-
val intent = usercentricsProxy.createIntent(reactApplicationContext, usercentricsOptions)
|
|
72
|
-
currentActivity?.startActivityForResult(intent, showCMPRequestCode)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
42
|
@ReactMethod
|
|
76
43
|
fun showFirstLayer(options: ReadableMap, promise: Promise) {
|
|
77
44
|
UiThreadUtil.runOnUiThread {
|
|
@@ -121,18 +88,6 @@ internal class RNUsercentricsModule(
|
|
|
121
88
|
}
|
|
122
89
|
}
|
|
123
90
|
|
|
124
|
-
internal fun parseActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean {
|
|
125
|
-
if (requestCode != showCMPRequestCode) return false
|
|
126
|
-
assert(pendingPromise != null)
|
|
127
|
-
|
|
128
|
-
val response = usercentricsProxy.parseResult(resultCode, data)?.toWritableMap()
|
|
129
|
-
|
|
130
|
-
pendingPromise?.resolve(response)
|
|
131
|
-
pendingPromise = null
|
|
132
|
-
|
|
133
|
-
return true
|
|
134
|
-
}
|
|
135
|
-
|
|
136
91
|
@ReactMethod
|
|
137
92
|
fun restoreUserSession(controllerId: String, promise: Promise) {
|
|
138
93
|
usercentricsProxy.instance.restoreUserSession(controllerId, {
|
package/android/src/main/java/com/usercentrics/reactnativeusercentrics/api/UsercentricsProxy.kt
CHANGED
|
@@ -24,13 +24,6 @@ interface UsercentricsProxy {
|
|
|
24
24
|
onFailure: (UsercentricsError) -> Unit
|
|
25
25
|
)
|
|
26
26
|
|
|
27
|
-
fun createIntent(
|
|
28
|
-
context: Context,
|
|
29
|
-
usercentricsOptions: UsercentricsUISettings
|
|
30
|
-
): Intent
|
|
31
|
-
|
|
32
|
-
fun parseResult(resultCode: Int, data: Intent?): UsercentricsConsentUserResponse?
|
|
33
|
-
|
|
34
27
|
fun showFirstLayer(
|
|
35
28
|
activity: Activity,
|
|
36
29
|
layout: UsercentricsLayout,
|
|
@@ -62,21 +55,6 @@ internal class UsercentricsProxyImpl : UsercentricsProxy {
|
|
|
62
55
|
onFailure: (UsercentricsError) -> Unit
|
|
63
56
|
) = Usercentrics.isReady(onSuccess, onFailure)
|
|
64
57
|
|
|
65
|
-
override fun createIntent(
|
|
66
|
-
context: Context,
|
|
67
|
-
usercentricsOptions: UsercentricsUISettings
|
|
68
|
-
): Intent {
|
|
69
|
-
return UsercentricsActivityContract().createIntent(
|
|
70
|
-
context,
|
|
71
|
-
usercentricsOptions
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
override fun parseResult(resultCode: Int, data: Intent?): UsercentricsConsentUserResponse? {
|
|
76
|
-
return UsercentricsActivityContract()
|
|
77
|
-
.parseResult(resultCode, data)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
58
|
override fun showFirstLayer(
|
|
81
59
|
activity: Activity,
|
|
82
60
|
layout: UsercentricsLayout,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package com.usercentrics.reactnativeusercentrics.extensions
|
|
2
|
+
|
|
3
|
+
import android.content.res.AssetManager
|
|
4
|
+
import android.graphics.Typeface
|
|
5
|
+
import com.facebook.react.bridge.ReadableMap
|
|
6
|
+
import com.usercentrics.sdk.BannerFont
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
internal fun ReadableMap.bannerFontFromMap(assetManager: AssetManager): BannerFont? {
|
|
10
|
+
val size = getDoubleOrNull("fontSize") ?: return null
|
|
11
|
+
val regularTypeface = assetManager.createFontFromName(getString("regularFont")) ?: return null
|
|
12
|
+
val boldTypeface = assetManager.createFontFromName(getString("boldFont")) ?: return null
|
|
13
|
+
|
|
14
|
+
return BannerFont(
|
|
15
|
+
regularTypeface,
|
|
16
|
+
boldTypeface,
|
|
17
|
+
size.toFloat()
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
internal fun AssetManager.createFontFromName(fontName: String?): Typeface? {
|
|
22
|
+
if (fontName == null) { return null }
|
|
23
|
+
val fontsFolder = this.list("fonts")
|
|
24
|
+
val regularFontName = fontsFolder?.firstOrNull { it.startsWith(fontName) } ?: return null
|
|
25
|
+
return Typeface.createFromAsset(this, "fonts/$regularFontName")
|
|
26
|
+
}
|
|
@@ -21,11 +21,16 @@ internal fun ReadableMap.bannerSettingsFromMap(assetManager: AssetManager): Bann
|
|
|
21
21
|
val customLogo = getMap("logo")
|
|
22
22
|
|
|
23
23
|
return BannerSettings(
|
|
24
|
-
customFont?.
|
|
25
|
-
customLogo?.
|
|
24
|
+
customFont?.bannerFontFromMap(assetManager),
|
|
25
|
+
customLogo?.bannerLogoFromMap()
|
|
26
26
|
)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
internal fun ReadableMap.bannerLogoFromMap(): UsercentricsImage? {
|
|
30
|
+
val logoPath = getString("logoPath") ?: return null
|
|
31
|
+
return UsercentricsImage.ImageUrl(logoPath)
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
internal fun ReadableMap.firstLayerStyleSettingsFromMap(assetManager: AssetManager): FirstLayerStyleSettings {
|
|
30
35
|
return FirstLayerStyleSettings(
|
|
31
36
|
headerImage = getMap("headerImage")?.headerImageFromMap(),
|
|
@@ -44,7 +49,7 @@ internal fun ReadableMap.headerImageFromMap(): HeaderImageSettings? {
|
|
|
44
49
|
return HeaderImageSettings.Hidden
|
|
45
50
|
}
|
|
46
51
|
|
|
47
|
-
val image = getMap("image")?.
|
|
52
|
+
val image = getMap("image")?.bannerLogoFromMap() ?: return null
|
|
48
53
|
|
|
49
54
|
val isExtended = getBooleanOrNull("isExtended") ?: false
|
|
50
55
|
return if (isExtended) {
|
|
@@ -59,21 +64,18 @@ internal fun ReadableMap.headerImageFromMap(): HeaderImageSettings? {
|
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
internal fun ReadableMap.titleFromMap(assetManager: AssetManager): TitleSettings {
|
|
62
|
-
val font = getMap("font")?.usercentricsFontFromMap(assetManager)
|
|
63
67
|
return TitleSettings(
|
|
64
68
|
alignment = getString("alignment")?.sectionAlignmentFromMap(),
|
|
65
69
|
textColor = getString("textColorHex")?.deserializeColor(),
|
|
66
|
-
font =
|
|
67
|
-
textSizeInSp =
|
|
70
|
+
font = assetManager.createFontFromName(getString("fontName")),
|
|
71
|
+
textSizeInSp = getDoubleOrNull("textSize")?.toFloat()
|
|
68
72
|
)
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
internal fun ReadableMap.messageFromMap(assetManager: AssetManager): MessageSettings {
|
|
72
|
-
val font = getMap("font")?.usercentricsFontFromMap(assetManager)
|
|
73
|
-
|
|
74
76
|
return MessageSettings(
|
|
75
|
-
font =
|
|
76
|
-
textSizeInSp =
|
|
77
|
+
font = assetManager.createFontFromName(getString("fontName")),
|
|
78
|
+
textSizeInSp = getDoubleOrNull("textSize")?.toFloat(),
|
|
77
79
|
textColor = getString("textColorHex")?.deserializeColor(),
|
|
78
80
|
alignment = getString("alignment")?.sectionAlignmentFromMap(),
|
|
79
81
|
linkTextColor = getString("linkTextColorHex")?.deserializeColor(),
|
|
@@ -129,15 +131,14 @@ internal fun ReadableMap.buttonLayoutFromMap(
|
|
|
129
131
|
internal fun ReadableMap.buttonSettingsFromMap(
|
|
130
132
|
assetManager: AssetManager
|
|
131
133
|
): ButtonSettings {
|
|
132
|
-
|
|
133
|
-
return ButtonSettings(
|
|
134
|
+
return ButtonSettings(
|
|
134
135
|
type = getString("buttonType")!!.deserializeButtonType(),
|
|
135
136
|
isAllCaps = getBooleanOrNull("isAllCaps"),
|
|
136
|
-
font =
|
|
137
|
+
font = assetManager.createFontFromName(getString("fontName")),
|
|
137
138
|
textColor = getString("textColorHex")?.deserializeColor(),
|
|
138
139
|
backgroundColor = getString("backgroundColorHex")?.deserializeColor(),
|
|
139
140
|
cornerRadius = getIntOrNull("cornerRadius"),
|
|
140
|
-
textSizeInSp =
|
|
141
|
+
textSizeInSp = getDoubleOrNull("textSize")?.toFloat()
|
|
141
142
|
)
|
|
142
143
|
}
|
|
143
144
|
|
|
@@ -6,7 +6,7 @@ import com.usercentrics.sdk.UsercentricsReadyStatus
|
|
|
6
6
|
|
|
7
7
|
internal fun UsercentricsReadyStatus.toWritableMap(): WritableMap {
|
|
8
8
|
return Arguments.createMap().apply {
|
|
9
|
-
putBoolean("
|
|
9
|
+
putBoolean("shouldCollectConsent", shouldCollectConsent)
|
|
10
10
|
putArray("consents", consents.toWritableArray())
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -5,19 +5,57 @@ extension BannerSettings {
|
|
|
5
5
|
init?(from dictionary: NSDictionary?) {
|
|
6
6
|
guard let dictionary = dictionary else { return nil }
|
|
7
7
|
|
|
8
|
-
self.init(font:
|
|
8
|
+
self.init(font: BannerFontHolder(from: dictionary["font"] as? NSDictionary)?.font,
|
|
9
9
|
logo: UIImage(from: dictionary["logo"] as? NSDictionary))
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
struct BannerFontHolder {
|
|
14
|
+
public let font: BannerFont
|
|
15
|
+
|
|
16
|
+
public let regularFont: UIFont
|
|
17
|
+
public let boldFont: UIFont
|
|
18
|
+
|
|
14
19
|
init?(from dictionary: NSDictionary?) {
|
|
20
|
+
guard let dictionary = dictionary,
|
|
21
|
+
let regularFontName: String = dictionary["regularFont"] as? String,
|
|
22
|
+
let boldFontName: String = dictionary["boldFont"] as? String,
|
|
23
|
+
let fontSize: CGFloat = dictionary["fontSize"] as? CGFloat,
|
|
24
|
+
let regularFont = UIFont(name: regularFontName, size: fontSize),
|
|
25
|
+
let boldFont = UIFont(name: boldFontName, size: fontSize)
|
|
26
|
+
else { return nil }
|
|
27
|
+
|
|
28
|
+
self.regularFont = regularFont
|
|
29
|
+
self.boldFont = boldFont
|
|
30
|
+
self.font = .init(regularFont: regularFont, boldFont: boldFont)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
extension UIFont {
|
|
35
|
+
static func initialize(from fontName: String?, fontSizeValue: CGFloat?, fallbackFont: UIFont?) -> UIFont? {
|
|
36
|
+
let fontSize = fontSizeValue ?? UIFont.systemFontSize
|
|
37
|
+
|
|
38
|
+
// System font with custom size
|
|
39
|
+
if fontName == nil, fontSizeValue != nil {
|
|
40
|
+
return fallbackFont?.withSize(fontSize) ?? UIFont.systemFont(ofSize: fontSize)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if let fontName = fontName {
|
|
44
|
+
return UIFont(name: fontName, size: fontSize)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return fallbackFont?.withSize(fontSize)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
extension FirstLayerStyleSettings {
|
|
52
|
+
init?(from dictionary: NSDictionary?, bannerFontHolder: BannerFontHolder?) {
|
|
15
53
|
guard let dictionary = dictionary else { return nil }
|
|
16
54
|
|
|
17
55
|
self.init(headerImage: HeaderImageSettings.from(dictionary: dictionary["headerImage"] as? NSDictionary),
|
|
18
|
-
title: TitleSettings(from: dictionary["title"] as? NSDictionary),
|
|
19
|
-
message: MessageSettings(from: dictionary["message"] as? NSDictionary),
|
|
20
|
-
buttonLayout: ButtonLayout.from(dictionary: dictionary["buttonLayout"] as? NSDictionary),
|
|
56
|
+
title: TitleSettings(from: dictionary["title"] as? NSDictionary, fallbackFont: bannerFontHolder?.boldFont),
|
|
57
|
+
message: MessageSettings(from: dictionary["message"] as? NSDictionary, fallbackFont: bannerFontHolder?.regularFont),
|
|
58
|
+
buttonLayout: ButtonLayout.from(dictionary: dictionary["buttonLayout"] as? NSDictionary, fallbackFont: bannerFontHolder?.boldFont),
|
|
21
59
|
backgroundColor: UIColor(unsafeHex: dictionary["backgroundColorHex"] as? String),
|
|
22
60
|
cornerRadius: dictionary["cornerRadius"] as? CGFloat,
|
|
23
61
|
overlayColor: UIColor(unsafeHex: dictionary["overlayColorHex"] as? String))
|
|
@@ -50,10 +88,13 @@ extension HeaderImageSettings {
|
|
|
50
88
|
}
|
|
51
89
|
|
|
52
90
|
extension TitleSettings {
|
|
53
|
-
init?(from dictionary: NSDictionary?) {
|
|
91
|
+
init?(from dictionary: NSDictionary?, fallbackFont: UIFont? = nil) {
|
|
54
92
|
guard let dictionary = dictionary else { return nil }
|
|
55
93
|
|
|
56
|
-
|
|
94
|
+
let fontName: String? = dictionary["fontName"] as? String
|
|
95
|
+
let fontSize: CGFloat? = dictionary["textSize"] as? CGFloat
|
|
96
|
+
|
|
97
|
+
self.init(font: UIFont.initialize(from: fontName, fontSizeValue: fontSize, fallbackFont: fallbackFont),
|
|
57
98
|
textColor: UIColor(unsafeHex: dictionary["textColorHex"] as? String ?? ""),
|
|
58
99
|
textAlignment: NSTextAlignment.from(enumString: dictionary["textAlignment"] as? String))
|
|
59
100
|
}
|
|
@@ -61,10 +102,13 @@ extension TitleSettings {
|
|
|
61
102
|
|
|
62
103
|
|
|
63
104
|
extension MessageSettings {
|
|
64
|
-
init?(from dictionary: NSDictionary?) {
|
|
105
|
+
init?(from dictionary: NSDictionary?, fallbackFont: UIFont? = nil) {
|
|
65
106
|
guard let dictionary = dictionary else { return nil }
|
|
66
107
|
|
|
67
|
-
|
|
108
|
+
let fontName: String? = dictionary["fontName"] as? String
|
|
109
|
+
let textSize: CGFloat? = dictionary["textSize"] as? CGFloat
|
|
110
|
+
|
|
111
|
+
self.init(font: UIFont.initialize(from: fontName, fontSizeValue: textSize, fallbackFont: fallbackFont),
|
|
68
112
|
textColor: UIColor(unsafeHex: dictionary["textColorHex"] as? String ?? ""),
|
|
69
113
|
textAlignment: NSTextAlignment.from(enumString: dictionary["textAlignment"] as? String),
|
|
70
114
|
linkTextColor: UIColor(unsafeHex: dictionary["linkTextColorHex"] as? String ?? ""),
|
|
@@ -73,7 +117,7 @@ extension MessageSettings {
|
|
|
73
117
|
}
|
|
74
118
|
|
|
75
119
|
extension ButtonLayout {
|
|
76
|
-
static func from(dictionary: NSDictionary?) -> ButtonLayout? {
|
|
120
|
+
static func from(dictionary: NSDictionary?, fallbackFont: UIFont? = nil) -> ButtonLayout? {
|
|
77
121
|
guard let dictionary = dictionary else { return nil }
|
|
78
122
|
|
|
79
123
|
let layoutDict = dictionary["layout"] as? String
|
|
@@ -81,11 +125,11 @@ extension ButtonLayout {
|
|
|
81
125
|
|
|
82
126
|
switch layoutDict {
|
|
83
127
|
case "ROW":
|
|
84
|
-
return .row(buttons: buttons.flatMap { $0 }.compactMap { ButtonSettings(from: $0) })
|
|
128
|
+
return .row(buttons: buttons.flatMap { $0 }.compactMap { ButtonSettings(from: $0, fallbackFont: fallbackFont) })
|
|
85
129
|
case "COLUMN":
|
|
86
|
-
return .column(buttons: buttons.flatMap { $0 }.compactMap { ButtonSettings(from: $0) })
|
|
130
|
+
return .column(buttons: buttons.flatMap { $0 }.compactMap { ButtonSettings(from: $0, fallbackFont: fallbackFont) })
|
|
87
131
|
case "GRID":
|
|
88
|
-
let gridButtons = buttons.map { $0.compactMap { button in ButtonSettings(from: button) }}
|
|
132
|
+
let gridButtons = buttons.map { $0.compactMap { button in ButtonSettings(from: button, fallbackFont: fallbackFont) }}
|
|
89
133
|
return .grid(buttons: gridButtons)
|
|
90
134
|
default:
|
|
91
135
|
break
|
|
@@ -96,15 +140,18 @@ extension ButtonLayout {
|
|
|
96
140
|
}
|
|
97
141
|
|
|
98
142
|
extension ButtonSettings {
|
|
99
|
-
init?(from dictionary: NSDictionary?) {
|
|
143
|
+
init?(from dictionary: NSDictionary?, fallbackFont: UIFont? = nil) {
|
|
100
144
|
guard
|
|
101
145
|
let dictionary = dictionary,
|
|
102
146
|
let buttonTypeDict = dictionary["buttonType"] as? String,
|
|
103
147
|
let buttonType = ButtonType.from(enumString: buttonTypeDict)
|
|
104
148
|
else { return nil }
|
|
105
149
|
|
|
150
|
+
let fontName: String? = dictionary["fontName"] as? String
|
|
151
|
+
let textSize: CGFloat? = dictionary["textSize"] as? CGFloat
|
|
152
|
+
|
|
106
153
|
self.init(type: buttonType,
|
|
107
|
-
font: UIFont(from:
|
|
154
|
+
font: UIFont.initialize(from: fontName, fontSizeValue: textSize, fallbackFont: fallbackFont),
|
|
108
155
|
textColor: UIColor(unsafeHex: dictionary["textColorHex"] as? String),
|
|
109
156
|
backgroundColor: UIColor(unsafeHex: dictionary["backgroundColorHex"] as? String),
|
|
110
157
|
cornerRadius: dictionary["cornerRadius"] as? CGFloat)
|
|
@@ -8,16 +8,14 @@ public protocol UsercentricsManager {
|
|
|
8
8
|
func isReady(onSuccess: @escaping ((UsercentricsReadyStatus) -> Void), onFailure: @escaping ((Error) -> Void))
|
|
9
9
|
func restoreUserSession(controllerId: String, onSuccess: @escaping ((UsercentricsReadyStatus) -> Void), onFailure: @escaping ((Error) -> Void))
|
|
10
10
|
|
|
11
|
-
func getPredefinedUI(settings: UsercentricsUISettings?, dismissViewHandler: @escaping (UsercentricsConsentUserResponse) -> Void) -> UIViewController
|
|
12
|
-
|
|
13
11
|
func showFirstLayer(bannerSettings: BannerSettings?,
|
|
14
|
-
hostView:
|
|
12
|
+
hostView: UIViewController,
|
|
15
13
|
layout: UsercentricsLayout,
|
|
16
14
|
settings: FirstLayerStyleSettings?,
|
|
17
15
|
dismissViewHandler: @escaping (UsercentricsConsentUserResponse) -> Void)
|
|
18
16
|
|
|
19
17
|
func showSecondLayer(bannerSettings: BannerSettings?,
|
|
20
|
-
hostView:
|
|
18
|
+
hostView: UIViewController,
|
|
21
19
|
showCloseButton: Bool,
|
|
22
20
|
dismissViewHandler: @escaping (UsercentricsConsentUserResponse) -> Void)
|
|
23
21
|
|
|
@@ -71,12 +69,8 @@ final class UsercentricsManagerImplementation: UsercentricsManager {
|
|
|
71
69
|
UsercentricsCore.reset()
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
func getPredefinedUI(settings: UsercentricsUISettings?, dismissViewHandler: @escaping (UsercentricsConsentUserResponse) -> Void) -> UIViewController {
|
|
75
|
-
return UsercentricsUserInterface.getPredefinedUI(settings: settings, dismissViewHandler: dismissViewHandler)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
72
|
func showFirstLayer(bannerSettings: BannerSettings?,
|
|
79
|
-
hostView:
|
|
73
|
+
hostView: UIViewController,
|
|
80
74
|
layout: UsercentricsLayout,
|
|
81
75
|
settings: FirstLayerStyleSettings?,
|
|
82
76
|
dismissViewHandler: @escaping (UsercentricsConsentUserResponse) -> Void) {
|
|
@@ -87,12 +81,11 @@ final class UsercentricsManagerImplementation: UsercentricsManager {
|
|
|
87
81
|
}
|
|
88
82
|
|
|
89
83
|
func showSecondLayer(bannerSettings: BannerSettings?,
|
|
90
|
-
hostView:
|
|
84
|
+
hostView: UIViewController,
|
|
91
85
|
showCloseButton: Bool,
|
|
92
86
|
dismissViewHandler: @escaping (UsercentricsConsentUserResponse) -> Void) {
|
|
93
87
|
UsercentricsBanner(bannerSettings: bannerSettings).showSecondLayer(hostView: hostView,
|
|
94
88
|
showCloseButton: showCloseButton,
|
|
95
|
-
presentationMode: .present,
|
|
96
89
|
completionHandler: dismissViewHandler)
|
|
97
90
|
}
|
|
98
91
|
|
|
@@ -37,27 +37,6 @@ class RNUsercentricsModule: NSObject, RCTBridgeModule {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
@objc func showCMP(_ dict: NSDictionary, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
41
|
-
queue.async { [weak self] in
|
|
42
|
-
guard
|
|
43
|
-
let self = self,
|
|
44
|
-
let rootVC = self.rootVC,
|
|
45
|
-
let settings = UsercentricsUISettings(from: dict)
|
|
46
|
-
else {
|
|
47
|
-
reject("usercentrics_reactNative_showCMP_error", RNUsercentricsModuleError.invalidData.localizedDescription, RNUsercentricsModuleError.invalidData)
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let predefinedUI = self.usercentricsManager.getPredefinedUI(settings: settings) { response in
|
|
52
|
-
resolve(response.toDictionary())
|
|
53
|
-
rootVC.dismiss(animated: true)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if #available(iOS 13.0, *) { predefinedUI.isModalInPresentation = true }
|
|
57
|
-
rootVC.present(predefinedUI)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
40
|
@objc func showFirstLayer(_ dict: NSDictionary, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
62
41
|
queue.async { [weak self] in
|
|
63
42
|
guard
|
|
@@ -69,23 +48,17 @@ class RNUsercentricsModule: NSObject, RCTBridgeModule {
|
|
|
69
48
|
reject("usercentrics_reactNative_showFirstLayer_error", RNUsercentricsModuleError.invalidData.localizedDescription, RNUsercentricsModuleError.invalidData)
|
|
70
49
|
return
|
|
71
50
|
}
|
|
72
|
-
|
|
73
|
-
let nav = UINavigationController()
|
|
74
|
-
nav.setNavigationBarHidden(true, animated: false)
|
|
75
|
-
nav.modalPresentationStyle = .overFullScreen
|
|
76
|
-
if #available(iOS 13.0, *) {
|
|
77
|
-
nav.isModalInPresentation = true
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
rootVC.present(nav)
|
|
51
|
+
|
|
81
52
|
let bannerSettingsDict = dict["bannerSettings"] as? NSDictionary
|
|
82
53
|
let styleSettingsDict = dict["styleSettings"] as? NSDictionary
|
|
54
|
+
|
|
55
|
+
let bannerSettings = BannerSettings(from: bannerSettingsDict)
|
|
56
|
+
let bannerFont = BannerFontHolder(from: bannerSettingsDict?["font"] as? NSDictionary)
|
|
83
57
|
|
|
84
|
-
self.usercentricsManager.showFirstLayer(bannerSettings:
|
|
85
|
-
hostView:
|
|
58
|
+
self.usercentricsManager.showFirstLayer(bannerSettings: bannerSettings,
|
|
59
|
+
hostView: rootVC as! UIViewController,
|
|
86
60
|
layout: layout,
|
|
87
|
-
settings: FirstLayerStyleSettings(from: styleSettingsDict)) { response in
|
|
88
|
-
rootVC.dismiss(animated: true)
|
|
61
|
+
settings: FirstLayerStyleSettings(from: styleSettingsDict, bannerFontHolder: bannerFont)) { response in
|
|
89
62
|
resolve(response.toDictionary())
|
|
90
63
|
}
|
|
91
64
|
}
|
|
@@ -102,18 +75,9 @@ class RNUsercentricsModule: NSObject, RCTBridgeModule {
|
|
|
102
75
|
}
|
|
103
76
|
let bannerSettingsDict = dict["bannerSettings"] as? NSDictionary
|
|
104
77
|
let showCloseButton = (dict["showCloseButton"] as? Bool) ?? false
|
|
105
|
-
|
|
106
|
-
let nav = UINavigationController()
|
|
107
|
-
nav.setNavigationBarHidden(true, animated: false)
|
|
108
|
-
nav.modalPresentationStyle = .overFullScreen
|
|
109
|
-
if #available(iOS 13.0, *) {
|
|
110
|
-
nav.isModalInPresentation = true
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
rootVC.present(nav)
|
|
114
|
-
|
|
78
|
+
|
|
115
79
|
self.usercentricsManager.showSecondLayer(bannerSettings: BannerSettings(from: bannerSettingsDict),
|
|
116
|
-
hostView:
|
|
80
|
+
hostView: rootVC as! UIViewController,
|
|
117
81
|
showCloseButton: showCloseButton) { response in
|
|
118
82
|
rootVC.dismiss(animated: true)
|
|
119
83
|
resolve(response.toDictionary())
|
|
@@ -13,9 +13,7 @@
|
|
|
13
13
|
A22EDF9F271DA49900F5BB8C /* ReadyStatus+Dict.swift in Sources */ = {isa = PBXBuildFile; fileRef = A22EDF9A271DA49900F5BB8C /* ReadyStatus+Dict.swift */; };
|
|
14
14
|
A22EDFA0271DA49900F5BB8C /* UsercentricsUserInteraction+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = A22EDF9B271DA49900F5BB8C /* UsercentricsUserInteraction+String.swift */; };
|
|
15
15
|
A22EDFA1271DA49900F5BB8C /* UserResponse+Dict.swift in Sources */ = {isa = PBXBuildFile; fileRef = A22EDF9C271DA49900F5BB8C /* UserResponse+Dict.swift */; };
|
|
16
|
-
A22EDFA2271DA49900F5BB8C /* UsercentricsUISettings+Dict.swift in Sources */ = {isa = PBXBuildFile; fileRef = A22EDF9D271DA49900F5BB8C /* UsercentricsUISettings+Dict.swift */; };
|
|
17
16
|
A2390F8227B52ADA00F355C1 /* UIImage+UsercentricsLogoDict.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2390F8127B52ADA00F355C1 /* UIImage+UsercentricsLogoDict.swift */; };
|
|
18
|
-
A2390F8427B52B0800F355C1 /* UIFont+UsercentricsFontDict.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2390F8327B52B0800F355C1 /* UIFont+UsercentricsFontDict.swift */; };
|
|
19
17
|
A2390F8627B52B2700F355C1 /* UIColor+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2390F8527B52B2700F355C1 /* UIColor+Extensions.swift */; };
|
|
20
18
|
A24E4EA327313492001093C7 /* UserDecision+Dict.swift in Sources */ = {isa = PBXBuildFile; fileRef = A24E4EA227313492001093C7 /* UserDecision+Dict.swift */; };
|
|
21
19
|
A24E4EAB273186FD001093C7 /* TCFData+Dict.swift in Sources */ = {isa = PBXBuildFile; fileRef = A24E4EAA273186FD001093C7 /* TCFData+Dict.swift */; };
|
|
@@ -51,9 +49,7 @@
|
|
|
51
49
|
A22EDF9A271DA49900F5BB8C /* ReadyStatus+Dict.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ReadyStatus+Dict.swift"; sourceTree = "<group>"; };
|
|
52
50
|
A22EDF9B271DA49900F5BB8C /* UsercentricsUserInteraction+String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UsercentricsUserInteraction+String.swift"; sourceTree = "<group>"; };
|
|
53
51
|
A22EDF9C271DA49900F5BB8C /* UserResponse+Dict.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UserResponse+Dict.swift"; sourceTree = "<group>"; };
|
|
54
|
-
A22EDF9D271DA49900F5BB8C /* UsercentricsUISettings+Dict.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UsercentricsUISettings+Dict.swift"; sourceTree = "<group>"; };
|
|
55
52
|
A2390F8127B52ADA00F355C1 /* UIImage+UsercentricsLogoDict.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+UsercentricsLogoDict.swift"; sourceTree = "<group>"; };
|
|
56
|
-
A2390F8327B52B0800F355C1 /* UIFont+UsercentricsFontDict.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+UsercentricsFontDict.swift"; sourceTree = "<group>"; };
|
|
57
53
|
A2390F8527B52B2700F355C1 /* UIColor+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Extensions.swift"; sourceTree = "<group>"; };
|
|
58
54
|
A24E4EA227313492001093C7 /* UserDecision+Dict.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserDecision+Dict.swift"; sourceTree = "<group>"; };
|
|
59
55
|
A24E4EAA273186FD001093C7 /* TCFData+Dict.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TCFData+Dict.swift"; sourceTree = "<group>"; };
|
|
@@ -88,7 +84,6 @@
|
|
|
88
84
|
children = (
|
|
89
85
|
A22EDF9A271DA49900F5BB8C /* ReadyStatus+Dict.swift */,
|
|
90
86
|
A22EDF99271DA49900F5BB8C /* UsercentricsOptions+Dict.swift */,
|
|
91
|
-
A22EDF9D271DA49900F5BB8C /* UsercentricsUISettings+Dict.swift */,
|
|
92
87
|
A22EDF9B271DA49900F5BB8C /* UsercentricsUserInteraction+String.swift */,
|
|
93
88
|
A22EDF9C271DA49900F5BB8C /* UserResponse+Dict.swift */,
|
|
94
89
|
A21D32A3272AE191004ED33E /* UsercentricsServiceConsents+Dict.swift */,
|
|
@@ -101,7 +96,6 @@
|
|
|
101
96
|
A20E7C9327B28D88004DC947 /* BannerSettings+Dict.swift */,
|
|
102
97
|
A2390F8127B52ADA00F355C1 /* UIImage+UsercentricsLogoDict.swift */,
|
|
103
98
|
A2390F8527B52B2700F355C1 /* UIColor+Extensions.swift */,
|
|
104
|
-
A2390F8327B52B0800F355C1 /* UIFont+UsercentricsFontDict.swift */,
|
|
105
99
|
);
|
|
106
100
|
path = Extensions;
|
|
107
101
|
sourceTree = "<group>";
|
|
@@ -215,11 +209,9 @@
|
|
|
215
209
|
A2F0B086272C483300A99DD3 /* TCFUserDecisions+Dict.swift in Sources */,
|
|
216
210
|
A22EDF9F271DA49900F5BB8C /* ReadyStatus+Dict.swift in Sources */,
|
|
217
211
|
A24E4EAB273186FD001093C7 /* TCFData+Dict.swift in Sources */,
|
|
218
|
-
A22EDFA2271DA49900F5BB8C /* UsercentricsUISettings+Dict.swift in Sources */,
|
|
219
212
|
A2DC25402722A91400AA9DD8 /* UCRNFlag.swift in Sources */,
|
|
220
213
|
A2DC252727216CFC00AA9DD8 /* DispatchQueueManager.swift in Sources */,
|
|
221
214
|
A20E7C9427B28D88004DC947 /* BannerSettings+Dict.swift in Sources */,
|
|
222
|
-
A2390F8427B52B0800F355C1 /* UIFont+UsercentricsFontDict.swift in Sources */,
|
|
223
215
|
A22EDF9E271DA49900F5BB8C /* UsercentricsOptions+Dict.swift in Sources */,
|
|
224
216
|
A2F0B080272C367B00A99DD3 /* UsercentricsConsentType+Int.swift in Sources */,
|
|
225
217
|
A2DC25362721A05500AA9DD8 /* RNUsercentricsModuleError.swift in Sources */,
|
package/lib/Usercentrics.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { UsercentricsOptions, UsercentricsServiceConsent,
|
|
1
|
+
import { UsercentricsOptions, UsercentricsServiceConsent, UsercentricsConsentUserResponse, UsercentricsReadyStatus, UsercentricsCMPData, CCPAData, TCFData, UsercentricsConsentType, TCFDecisionUILayer, UserDecision, TCFUserDecisions, FirstLayerOptions, SecondLayerOptions } from './models';
|
|
2
2
|
export declare const Usercentrics: {
|
|
3
3
|
configure: (options: UsercentricsOptions) => void;
|
|
4
4
|
status: () => Promise<UsercentricsReadyStatus>;
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated showCMP is deprecated: This API will soon be removed in favor of showFirstLayer and showSecondLayer, check our documentation for more details: https://docs.usercentrics.com/cmp_in_app_sdk/latest/collect_consent/present_cmp/
|
|
7
|
-
*/
|
|
8
|
-
showCMP: (options: UsercentricsUIOptions) => Promise<UsercentricsConsentUserResponse>;
|
|
9
5
|
showFirstLayer: (options: FirstLayerOptions) => Promise<UsercentricsConsentUserResponse>;
|
|
10
6
|
showSecondLayer: (options: SecondLayerOptions) => Promise<UsercentricsConsentUserResponse>;
|
|
11
7
|
restoreUserSession: (controllerId: string) => Promise<UsercentricsReadyStatus>;
|
package/lib/Usercentrics.js
CHANGED
|
@@ -7,13 +7,6 @@ export const Usercentrics = {
|
|
|
7
7
|
status: () => {
|
|
8
8
|
return RNUsercentricsModule.isReady();
|
|
9
9
|
},
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated showCMP is deprecated: This API will soon be removed in favor of showFirstLayer and showSecondLayer, check our documentation for more details: https://docs.usercentrics.com/cmp_in_app_sdk/latest/collect_consent/present_cmp/
|
|
12
|
-
*/
|
|
13
|
-
showCMP: async (options) => {
|
|
14
|
-
await RNUsercentricsModule.isReady();
|
|
15
|
-
return RNUsercentricsModule.showCMP(options);
|
|
16
|
-
},
|
|
17
10
|
showFirstLayer: async (options) => {
|
|
18
11
|
await RNUsercentricsModule.isReady();
|
|
19
12
|
return RNUsercentricsModule.showFirstLayer(options);
|
package/lib/Usercentrics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Usercentrics.js","sourceRoot":"","sources":["../src/Usercentrics.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"Usercentrics.js","sourceRoot":"","sources":["../src/Usercentrics.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAiB5C,MAAM,EAAE,oBAAoB,EAAE,GAAG,aAAa,CAAC;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,SAAS,EAAE,CAAC,OAA4B,EAAE,EAAE;QACxC,oBAAoB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAC3C,CAA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OAAO,EAAE,CAAC;QACrC,OAAO,oBAAoB,CAAC,aAAa,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACtE,CAAC;IAED,mBAAmB,EAAE,KAAK,EAAE,YAA8B,EAAE,SAA6B,EAAE,SAAyB,EAAE,WAAoC,EAAyC,EAAE;QACjM,MAAM,oBAAoB,CAAC,OAAO,EAAE,CAAC;QACrC,OAAO,oBAAoB,CAAC,mBAAmB,CAAC,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IACrG,CAAC;IAED,iBAAiB,EAAE,KAAK,EAAE,UAAmB,EAAE,WAAoC,EAAyC,EAAE;QAC1H,MAAM,oBAAoB,CAAC,OAAO,EAAE,CAAC;QACrC,OAAO,oBAAoB,CAAC,iBAAiB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC3E,CAAC;IAED,QAAQ,EAAE,CAAC,EAAU,EAAE,EAAE;QACrB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,EAAE,GAAG,EAAE;QACR,oBAAoB,CAAC,KAAK,EAAE,CAAA;IAChC,CAAC;CACJ,CAAA"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ImageResolvedAssetSource } from "react-native";
|
|
2
|
+
export declare class BannerLogo {
|
|
3
|
+
logoName: string;
|
|
4
|
+
logoPath: string;
|
|
5
|
+
logoUrl?: String;
|
|
6
|
+
constructor(logoName: string, logoPath: ImageResolvedAssetSource, logoUrl?: String);
|
|
7
|
+
}
|
|
8
|
+
export declare class BannerFont {
|
|
9
|
+
regularFont: string;
|
|
10
|
+
boldFont: string;
|
|
11
|
+
fontSize: number;
|
|
12
|
+
constructor(regularFont: string, boldFont: string, fontSize: number);
|
|
13
|
+
}
|
|
2
14
|
export declare class BannerSettings {
|
|
3
|
-
logo?:
|
|
4
|
-
font?:
|
|
5
|
-
constructor(logo?:
|
|
15
|
+
logo?: BannerLogo;
|
|
16
|
+
font?: BannerFont;
|
|
17
|
+
constructor(logo?: BannerLogo, font?: BannerFont);
|
|
6
18
|
}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
export class BannerLogo {
|
|
2
|
+
constructor(logoName, logoPath, logoUrl) {
|
|
3
|
+
this.logoName = logoName;
|
|
4
|
+
this.logoPath = logoPath.uri;
|
|
5
|
+
this.logoUrl = logoUrl;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export class BannerFont {
|
|
9
|
+
constructor(regularFont, boldFont, fontSize) {
|
|
10
|
+
this.regularFont = regularFont;
|
|
11
|
+
this.boldFont = boldFont;
|
|
12
|
+
this.fontSize = fontSize;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
1
15
|
export class BannerSettings {
|
|
2
16
|
constructor(logo, font) {
|
|
3
17
|
this.logo = logo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerSettings.js","sourceRoot":"","sources":["../../src/models/BannerSettings.tsx"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAc;IAIvB,YAAY,
|
|
1
|
+
{"version":3,"file":"BannerSettings.js","sourceRoot":"","sources":["../../src/models/BannerSettings.tsx"],"names":[],"mappings":"AAEA,MAAM,OAAO,UAAU;IAKnB,YAAY,QAAgB,EAAE,QAAkC,EAAE,OAAgB;QAC9E,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;CACJ;AAED,MAAM,OAAO,UAAU;IAKnB,YAAY,WAAmB,EAAE,QAAgB,EAAE,QAAgB;QAC/D,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ;AAED,MAAM,OAAO,cAAc;IAIvB,YAAY,IAAiB,EAAE,IAAiB;QAC5C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BannerLogo, BannerSettings } from ".";
|
|
2
2
|
export declare class FirstLayerOptions {
|
|
3
3
|
layout: UsercentricsLayout;
|
|
4
4
|
bannerSettings?: BannerSettings;
|
|
@@ -18,27 +18,29 @@ export declare class FirstLayerStyleSettings {
|
|
|
18
18
|
export declare class HeaderImageSettings {
|
|
19
19
|
isExtended: Boolean;
|
|
20
20
|
isHidden: Boolean;
|
|
21
|
-
image?:
|
|
21
|
+
image?: BannerLogo;
|
|
22
22
|
height?: Number;
|
|
23
23
|
alignment?: SectionAlignment;
|
|
24
24
|
private constructor();
|
|
25
|
-
static extended(image:
|
|
26
|
-
static logo(image:
|
|
25
|
+
static extended(image: BannerLogo): HeaderImageSettings;
|
|
26
|
+
static logo(image: BannerLogo, height?: Number, alignment?: SectionAlignment): HeaderImageSettings;
|
|
27
27
|
static hidden(): HeaderImageSettings;
|
|
28
28
|
}
|
|
29
29
|
export declare class TitleSettings {
|
|
30
|
-
|
|
30
|
+
fontName?: string;
|
|
31
|
+
textSize?: number;
|
|
31
32
|
textColorHex?: String;
|
|
32
33
|
textAlignment?: SectionAlignment;
|
|
33
|
-
constructor(
|
|
34
|
+
constructor(fontName?: string, textSize?: number, textColorHex?: String, textAlignment?: SectionAlignment);
|
|
34
35
|
}
|
|
35
36
|
export declare class MessageSettings {
|
|
36
|
-
|
|
37
|
+
fontName?: string;
|
|
38
|
+
textSize?: number;
|
|
37
39
|
textColorHex?: String;
|
|
38
40
|
textAlignment?: SectionAlignment;
|
|
39
41
|
linkTextColorHex?: String;
|
|
40
42
|
linkTextUnderline?: Boolean;
|
|
41
|
-
constructor(
|
|
43
|
+
constructor(fontName?: string, textSize?: number, textColorHex?: String, textAlignment?: SectionAlignment, linkTextColorHex?: String, linkTextUnderline?: Boolean);
|
|
42
44
|
}
|
|
43
45
|
export declare class ButtonLayout {
|
|
44
46
|
buttons: ButtonSettings[][];
|
|
@@ -55,12 +57,13 @@ declare enum InternalButtonLayout {
|
|
|
55
57
|
}
|
|
56
58
|
export declare class ButtonSettings {
|
|
57
59
|
buttonType: ButtonType;
|
|
58
|
-
|
|
60
|
+
fontName?: string;
|
|
61
|
+
textSize?: number;
|
|
59
62
|
textColorHex?: String;
|
|
60
63
|
backgroundColorHex?: String;
|
|
61
64
|
cornerRadius?: number;
|
|
62
65
|
isAllCaps?: Boolean;
|
|
63
|
-
constructor(buttonType: ButtonType,
|
|
66
|
+
constructor(buttonType: ButtonType, fontName?: string, textSize?: number, textColorHex?: String, backgroundColorHex?: String, cornerRadius?: number, isAllCaps?: Boolean);
|
|
64
67
|
}
|
|
65
68
|
export declare enum ButtonType {
|
|
66
69
|
acceptAll = "ACCEPT_ALL",
|
|
@@ -35,15 +35,17 @@ export class HeaderImageSettings {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
export class TitleSettings {
|
|
38
|
-
constructor(
|
|
39
|
-
this.
|
|
38
|
+
constructor(fontName, textSize, textColorHex, textAlignment) {
|
|
39
|
+
this.fontName = fontName;
|
|
40
|
+
this.textSize = textSize;
|
|
40
41
|
this.textColorHex = textColorHex;
|
|
41
42
|
this.textAlignment = textAlignment;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
export class MessageSettings {
|
|
45
|
-
constructor(
|
|
46
|
-
this.
|
|
46
|
+
constructor(fontName, textSize, textColorHex, textAlignment, linkTextColorHex, linkTextUnderline) {
|
|
47
|
+
this.fontName = fontName;
|
|
48
|
+
this.textSize = textSize;
|
|
47
49
|
this.textColorHex = textColorHex;
|
|
48
50
|
this.textAlignment = textAlignment;
|
|
49
51
|
this.linkTextColorHex = linkTextColorHex;
|
|
@@ -72,9 +74,10 @@ var InternalButtonLayout;
|
|
|
72
74
|
InternalButtonLayout["column"] = "COLUMN";
|
|
73
75
|
})(InternalButtonLayout || (InternalButtonLayout = {}));
|
|
74
76
|
export class ButtonSettings {
|
|
75
|
-
constructor(buttonType,
|
|
77
|
+
constructor(buttonType, fontName, textSize, textColorHex, backgroundColorHex, cornerRadius, isAllCaps) {
|
|
76
78
|
this.buttonType = buttonType;
|
|
77
|
-
this.
|
|
79
|
+
this.fontName = fontName;
|
|
80
|
+
this.textSize = textSize;
|
|
78
81
|
this.textColorHex = textColorHex;
|
|
79
82
|
this.backgroundColorHex = backgroundColorHex;
|
|
80
83
|
this.cornerRadius = cornerRadius;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirstLayerOptions.js","sourceRoot":"","sources":["../../src/models/FirstLayerOptions.tsx"],"names":[],"mappings":"AAEA,MAAM,OAAO,iBAAiB;IAK1B,YAAY,MAA0B,EAAE,cAA+B,EAAE,aAAuC;QAC5G,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACvC,CAAC;CACJ;AAED,MAAM,OAAO,uBAAuB;IAShC,YAAY,WAAiC,EACzC,KAAqB,EACrB,OAAyB,EACzB,YAA2B,EAC3B,kBAA2B,EAC3B,YAAqB,EACrB,eAAwB;QAExB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,kBAAkB,GAAE,kBAAkB,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IAC3C,CAAC;CACJ;AAED,MAAM,OAAO,mBAAmB;IAO5B,YAAoB,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,WAAY,kBAAkB;IAC1B,mCAAa,CAAA;IACb,qCAAe,CAAA;IACf,kDAA4B,CAAA;IAC5B,kDAA4B,CAAA;AAChC,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UsercentricsServiceConsent } from ".";
|
|
2
2
|
export declare class UsercentricsReadyStatus {
|
|
3
|
-
|
|
3
|
+
shouldCollectConsent: boolean;
|
|
4
4
|
consents: [UsercentricsServiceConsent];
|
|
5
|
-
constructor(
|
|
5
|
+
constructor(shouldCollectConsent: boolean, consents: [UsercentricsServiceConsent]);
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UsercentricsReadyStatus.js","sourceRoot":"","sources":["../../src/models/UsercentricsReadyStatus.tsx"],"names":[],"mappings":"AAEA,MAAM,OAAO,uBAAuB;IAIhC,YAAY,
|
|
1
|
+
{"version":3,"file":"UsercentricsReadyStatus.js","sourceRoot":"","sources":["../../src/models/UsercentricsReadyStatus.tsx"],"names":[],"mappings":"AAEA,MAAM,OAAO,uBAAuB;IAIhC,YAAY,oBAA6B,EAAE,QAAsC;QAC7E,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAA;QAChD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC5B,CAAC;CACJ"}
|
package/lib/models/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export { UsercentricsOptions } from "./UsercentricsOptions";
|
|
|
2
2
|
export { UsercentricsConsentType } from "./UsercentricsConsentType";
|
|
3
3
|
export { UsercentricsLoggerLevel } from "./UsercentricsLoggerLevel";
|
|
4
4
|
export { UsercentricsServiceConsent } from "./UsercentricsServiceConsent";
|
|
5
|
-
export { UsercentricsUIOptions, UsercentricsFont, UsercentricsLogo } from "./UsercentricsUIOptions";
|
|
6
5
|
export { UsercentricsUserInteraction } from './UsercentricsUserInteraction';
|
|
7
6
|
export { UsercentricsConsentUserResponse } from './UsercentricsConsentUserResponse';
|
|
8
7
|
export { UsercentricsReadyStatus } from './UsercentricsReadyStatus';
|
|
@@ -15,4 +14,4 @@ export { UserDecision } from './UserDecision';
|
|
|
15
14
|
export { TCFUserDecisions, TCFUserDecisionOnPurpose, TCFUserDecisionOnSpecialFeature, TCFUserDecisionOnVendor } from './TCFUserDecisions';
|
|
16
15
|
export { FirstLayerOptions, FirstLayerStyleSettings, HeaderImageSettings, TitleSettings, SectionAlignment, MessageSettings, UsercentricsLayout, ButtonLayout, ButtonType, ButtonSettings } from './FirstLayerOptions';
|
|
17
16
|
export { SecondLayerOptions } from './SecondLayerOptions';
|
|
18
|
-
export { BannerSettings } from "./BannerSettings";
|
|
17
|
+
export { BannerSettings, BannerFont, BannerLogo } from "./BannerSettings";
|
package/lib/models/index.js
CHANGED
|
@@ -2,7 +2,6 @@ export { UsercentricsOptions } from "./UsercentricsOptions";
|
|
|
2
2
|
export { UsercentricsConsentType } from "./UsercentricsConsentType";
|
|
3
3
|
export { UsercentricsLoggerLevel } from "./UsercentricsLoggerLevel";
|
|
4
4
|
export { UsercentricsServiceConsent } from "./UsercentricsServiceConsent";
|
|
5
|
-
export { UsercentricsUIOptions, UsercentricsFont, UsercentricsLogo } from "./UsercentricsUIOptions";
|
|
6
5
|
export { UsercentricsUserInteraction } from './UsercentricsUserInteraction';
|
|
7
6
|
export { UsercentricsConsentUserResponse } from './UsercentricsConsentUserResponse';
|
|
8
7
|
export { UsercentricsReadyStatus } from './UsercentricsReadyStatus';
|
|
@@ -15,5 +14,5 @@ export { UserDecision } from './UserDecision';
|
|
|
15
14
|
export { TCFUserDecisions, TCFUserDecisionOnPurpose, TCFUserDecisionOnSpecialFeature, TCFUserDecisionOnVendor } from './TCFUserDecisions';
|
|
16
15
|
export { FirstLayerOptions, FirstLayerStyleSettings, HeaderImageSettings, TitleSettings, SectionAlignment, MessageSettings, UsercentricsLayout, ButtonLayout, ButtonType, ButtonSettings } from './FirstLayerOptions';
|
|
17
16
|
export { SecondLayerOptions } from './SecondLayerOptions';
|
|
18
|
-
export { BannerSettings } from "./BannerSettings";
|
|
17
|
+
export { BannerSettings, BannerFont, BannerLogo } from "./BannerSettings";
|
|
19
18
|
//# sourceMappingURL=index.js.map
|
package/lib/models/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC1I,OAAO,EACH,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,cAAc,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usercentrics/react-native-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Usercentrics SDK",
|
|
5
5
|
"homepage": "https://usercentrics.com",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
8
8
|
"author": "Usercentrics <developer@usercentrics.com>",
|
|
9
9
|
"iosPackageName": "react-native-usercentrics",
|
|
10
|
-
"iosPackageVersion": "2.
|
|
10
|
+
"iosPackageVersion": "2.3.0",
|
|
11
11
|
"license": "SEE LICENSE IN LICENSE",
|
|
12
12
|
"files": [
|
|
13
13
|
"android",
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
package com.usercentrics.reactnativeusercentrics.extensions
|
|
2
|
-
|
|
3
|
-
import android.content.res.AssetManager
|
|
4
|
-
import android.graphics.Bitmap
|
|
5
|
-
import android.graphics.BitmapFactory
|
|
6
|
-
import android.graphics.Typeface
|
|
7
|
-
import com.facebook.react.bridge.ReadableMap
|
|
8
|
-
import com.usercentrics.reactnativeusercentrics.R
|
|
9
|
-
import com.usercentrics.sdk.UsercentricsFont
|
|
10
|
-
import com.usercentrics.sdk.UsercentricsImage
|
|
11
|
-
import com.usercentrics.sdk.UsercentricsOptions
|
|
12
|
-
import com.usercentrics.sdk.UsercentricsUISettings
|
|
13
|
-
import com.usercentrics.sdk.models.common.UsercentricsLoggerLevel
|
|
14
|
-
|
|
15
|
-
internal fun ReadableMap.usercentricsUISettingsFromMap(assetManager: AssetManager): UsercentricsUISettings {
|
|
16
|
-
val showCloseButton = getBooleanOrNull("showCloseButton") == true
|
|
17
|
-
val customFont = getMap("customFont")
|
|
18
|
-
val customLogo = getMap("customLogo")
|
|
19
|
-
|
|
20
|
-
return UsercentricsUISettings(
|
|
21
|
-
customFont?.usercentricsFontFromMap(assetManager),
|
|
22
|
-
customLogo?.usercentricsImageFromMap(),
|
|
23
|
-
showCloseButton
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
internal fun ReadableMap.usercentricsImageFromMap(): UsercentricsImage? {
|
|
28
|
-
val logoPath = getString("logoPath") ?: return null
|
|
29
|
-
return UsercentricsImage.ImageUrl(logoPath)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
internal fun ReadableMap.usercentricsFontFromMap(assetManager: AssetManager): UsercentricsFont? {
|
|
33
|
-
val fontName = getString("fontName") ?: return null
|
|
34
|
-
val fontSize = getDoubleOrNull("fontSize") ?: return null
|
|
35
|
-
|
|
36
|
-
val fontsFolder = assetManager.list("fonts")
|
|
37
|
-
val firstName = fontsFolder?.firstOrNull { it.startsWith(fontName) } ?: return null
|
|
38
|
-
|
|
39
|
-
val typeface = Typeface.createFromAsset(assetManager, "fonts/$firstName")
|
|
40
|
-
|
|
41
|
-
return UsercentricsFont(
|
|
42
|
-
typeface,
|
|
43
|
-
fontSize.toFloat()
|
|
44
|
-
)
|
|
45
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
extension UIFont {
|
|
5
|
-
convenience init?(from dictionary: NSDictionary?) {
|
|
6
|
-
guard let dictionary = dictionary else { return nil }
|
|
7
|
-
|
|
8
|
-
if let customFontName = dictionary["fontName"] as? String,
|
|
9
|
-
let customFontSize = dictionary["fontSize"] as? CGFloat {
|
|
10
|
-
self.init(name: customFontName, size: customFontSize)
|
|
11
|
-
} else {
|
|
12
|
-
return nil
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import UsercentricsUI
|
|
3
|
-
|
|
4
|
-
public extension UsercentricsUISettings {
|
|
5
|
-
init?(from dictionary: NSDictionary) {
|
|
6
|
-
let showCloseButton = dictionary["showCloseButton"] as? Bool == true
|
|
7
|
-
|
|
8
|
-
var customFont: UIFont?
|
|
9
|
-
if let usercentricsFontDict = dictionary["customFont"] as? NSDictionary,
|
|
10
|
-
let customFontName = usercentricsFontDict["fontName"] as? String,
|
|
11
|
-
let customFontSize = usercentricsFontDict["fontSize"] as? CGFloat {
|
|
12
|
-
|
|
13
|
-
customFont = UIFont(name: customFontName, size: customFontSize)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
var customImage: UIImage?
|
|
17
|
-
if let customLogoDict = dictionary["customLogo"] as? NSDictionary,
|
|
18
|
-
let logoName = customLogoDict["logoName"] as? String {
|
|
19
|
-
customImage = UIImage(named: logoName)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
self.init(customFont: customFont,
|
|
23
|
-
customLogo: customImage,
|
|
24
|
-
showCloseButton: showCloseButton)
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ImageResolvedAssetSource } from "react-native";
|
|
2
|
-
export declare class UsercentricsUIOptions {
|
|
3
|
-
showCloseButton: boolean;
|
|
4
|
-
customLogo?: UsercentricsLogo;
|
|
5
|
-
customFont?: UsercentricsFont;
|
|
6
|
-
constructor(showCloseButton: boolean, customLogo?: UsercentricsLogo, customFont?: UsercentricsFont);
|
|
7
|
-
}
|
|
8
|
-
export declare class UsercentricsLogo {
|
|
9
|
-
logoName: string;
|
|
10
|
-
logoPath: string;
|
|
11
|
-
logoUrl?: String;
|
|
12
|
-
constructor(logoName: string, logoPath: ImageResolvedAssetSource, logoUrl?: String);
|
|
13
|
-
}
|
|
14
|
-
export declare class UsercentricsFont {
|
|
15
|
-
fontName: string;
|
|
16
|
-
fontSize: number;
|
|
17
|
-
constructor(fontName: string, fontSize: number);
|
|
18
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export class UsercentricsUIOptions {
|
|
2
|
-
constructor(showCloseButton, customLogo, customFont) {
|
|
3
|
-
this.showCloseButton = showCloseButton;
|
|
4
|
-
this.customLogo = customLogo;
|
|
5
|
-
this.customFont = customFont;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export class UsercentricsLogo {
|
|
9
|
-
constructor(logoName, logoPath, logoUrl) {
|
|
10
|
-
this.logoName = logoName;
|
|
11
|
-
this.logoPath = logoPath.uri;
|
|
12
|
-
this.logoUrl = logoUrl;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export class UsercentricsFont {
|
|
16
|
-
constructor(fontName, fontSize) {
|
|
17
|
-
this.fontName = fontName;
|
|
18
|
-
this.fontSize = fontSize;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=UsercentricsUIOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UsercentricsUIOptions.js","sourceRoot":"","sources":["../../src/models/UsercentricsUIOptions.tsx"],"names":[],"mappings":"AAEA,MAAM,OAAO,qBAAqB;IAK9B,YAAY,eAAwB,EAAE,UAA6B,EAAE,UAA6B;QAC9F,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;CACJ;AAED,MAAM,OAAO,gBAAgB;IAKzB,YAAY,QAAgB,EAAE,QAAkC,EAAE,OAAgB;QAC9E,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;CACJ;AAED,MAAM,OAAO,gBAAgB;IAIzB,YAAY,QAAgB,EAAE,QAAgB;QAC1C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ"}
|