@didomi/react-native 2.3.0 → 2.4.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.
@@ -124,5 +124,5 @@ dependencies {
124
124
 
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
126
126
 
127
- implementation "io.didomi.sdk:android:2.6.0"
127
+ implementation "io.didomi.sdk:android:2.7.0"
128
128
  }
@@ -15,8 +15,12 @@ import io.didomi.sdk.DidomiInitializeParameters
15
15
  import io.didomi.sdk.events.*
16
16
  import io.didomi.sdk.exceptions.DidomiNotReadyException
17
17
  import io.didomi.sdk.models.CurrentUserStatus
18
+ import io.didomi.sdk.user.UserAuthParams
18
19
  import io.didomi.sdk.user.UserAuthWithEncryptionParams
19
20
  import io.didomi.sdk.user.UserAuthWithHashParams
21
+ import org.json.JSONArray
22
+ import org.json.JSONException
23
+ import org.json.JSONObject
20
24
 
21
25
  class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
22
26
 
@@ -231,6 +235,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
231
235
  */
232
236
  override fun languageUpdateFailed(event: LanguageUpdateFailedEvent) = prepareEvent(EventTypes.LANGUAGE_UPDATE_FAILED.event, event.reason)
233
237
  }
238
+
234
239
  private val vendorStatusListeners: MutableSet<String> = mutableSetOf()
235
240
  private val syncAcknowledgedCallbacks: MutableMap<Int, () -> Boolean> = mutableMapOf()
236
241
  private var syncAcknowledgedCallbackIndex = 0
@@ -261,7 +266,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
261
266
  val set = mutableSetOf<String>()
262
267
 
263
268
  for (i in 0 until size()) {
264
- set.add(getString(i).orEmpty())
269
+ set.add(getString(i))
265
270
  }
266
271
 
267
272
  return set
@@ -323,6 +328,8 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
323
328
  noticeId: String?,
324
329
  androidTvNoticeId: String?,
325
330
  androidTvEnabled: Boolean,
331
+ countryCode: String?,
332
+ regionCode: String?,
326
333
  promise: Promise
327
334
  ) {
328
335
  try {
@@ -339,7 +346,9 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
339
346
  languageCode,
340
347
  noticeId,
341
348
  androidTvNoticeId,
342
- androidTvEnabled
349
+ androidTvEnabled,
350
+ countryCode,
351
+ regionCode
343
352
  )
344
353
 
345
354
  val application = currentActivity?.application ?: throw IllegalStateException("No activity present")
@@ -615,6 +624,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
615
624
  }
616
625
 
617
626
  @ReactMethod
627
+ @Deprecated("Use setUserWithAuthParams instead", replaceWith = ReplaceWith("setUserWithAuthParams()"))
618
628
  fun setUserWithHashAuth(
619
629
  organizationUserId: String,
620
630
  algorithm: String,
@@ -636,6 +646,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
636
646
  }
637
647
 
638
648
  @ReactMethod
649
+ @Deprecated("Use setUserWithAuthParamsAndSetupUI instead", replaceWith = ReplaceWith("setUserWithAuthParamsAndSetupUI()"))
639
650
  fun setUserWithHashAuthAndSetupUI(
640
651
  organizationUserId: String,
641
652
  algorithm: String,
@@ -658,6 +669,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
658
669
  }
659
670
 
660
671
  @ReactMethod
672
+ @Deprecated("Use setUserWithAuthParams instead", replaceWith = ReplaceWith("setUserWithAuthParams()"))
661
673
  fun setUserWithHashAuthWithExpiration(
662
674
  organizationUserId: String,
663
675
  algorithm: String,
@@ -681,6 +693,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
681
693
  }
682
694
 
683
695
  @ReactMethod
696
+ @Deprecated("Use setUserWithAuthParamsAndSetupUI instead", replaceWith = ReplaceWith("setUserWithAuthParamsAndSetupUI()"))
684
697
  fun setUserWithHashAuthWithExpirationAndSetupUI(
685
698
  organizationUserId: String,
686
699
  algorithm: String,
@@ -705,6 +718,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
705
718
  }
706
719
 
707
720
  @ReactMethod
721
+ @Deprecated("Use setUserWithAuthParams instead", replaceWith = ReplaceWith("setUserWithAuthParams()"))
708
722
  fun setUserWithEncryptionAuth(
709
723
  organizationUserId: String,
710
724
  algorithm: String,
@@ -724,6 +738,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
724
738
  }
725
739
 
726
740
  @ReactMethod
741
+ @Deprecated("Use setUserWithAuthParamsAndSetupUI instead", replaceWith = ReplaceWith("setUserWithAuthParamsAndSetupUI()"))
727
742
  fun setUserWithEncryptionAuthAndSetupUI(
728
743
  organizationUserId: String,
729
744
  algorithm: String,
@@ -744,6 +759,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
744
759
  }
745
760
 
746
761
  @ReactMethod
762
+ @Deprecated("Use setUserWithAuthParams instead", replaceWith = ReplaceWith("setUserWithAuthParams()"))
747
763
  fun setUserWithEncryptionAuthWithExpiration(
748
764
  organizationUserId: String,
749
765
  algorithm: String,
@@ -765,6 +781,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
765
781
  }
766
782
 
767
783
  @ReactMethod
784
+ @Deprecated("Use setUserWithAuthParamsAndSetupUI instead", replaceWith = ReplaceWith("setUserWithAuthParamsAndSetupUI()"))
768
785
  fun setUserWithEncryptionAuthWithExpirationAndSetupUI(
769
786
  organizationUserId: String,
770
787
  algorithm: String,
@@ -786,6 +803,61 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
786
803
  promise.resolve(0)
787
804
  }
788
805
 
806
+ @ReactMethod
807
+ fun setUserWithAuthParams(
808
+ jsonUserAuthParams: String,
809
+ jsonSynchronizedUsers: String?,
810
+ promise: Promise
811
+ ) {
812
+ try {
813
+ val userAuthParams = buildUserAuthParams(JSONObject(jsonUserAuthParams))
814
+
815
+ val synchronizedUsers = jsonSynchronizedUsers?.let {
816
+ JSONArray(it).run {
817
+ List(length()) { i -> buildUserAuthParams(getJSONObject(i)) }
818
+ }
819
+ } ?: emptyList()
820
+
821
+ Didomi.getInstance().setUser(
822
+ userAuthParams = userAuthParams,
823
+ synchronizedUsers = synchronizedUsers,
824
+ )
825
+
826
+ promise.resolve(0)
827
+ } catch (e: JSONException) {
828
+ Log.e("setUserWithAuthParams", "Error while parsing user with auth params", e)
829
+ promise.reject(e)
830
+ }
831
+ }
832
+
833
+ @ReactMethod
834
+ fun setUserWithAuthParamsAndSetupUI(
835
+ jsonUserAuthParams: String,
836
+ jsonSynchronizedUsers: String?,
837
+ promise: Promise
838
+ ) {
839
+ try {
840
+ val userAuthParams = buildUserAuthParams(JSONObject(jsonUserAuthParams))
841
+
842
+ val synchronizedUsers = jsonSynchronizedUsers?.let {
843
+ JSONArray(it).run {
844
+ List(length()) { i -> buildUserAuthParams(getJSONObject(i)) }
845
+ }
846
+ } ?: emptyList()
847
+
848
+ Didomi.getInstance().setUser(
849
+ userAuthParams = userAuthParams,
850
+ synchronizedUsers = synchronizedUsers,
851
+ activity = currentActivity as? FragmentActivity,
852
+ )
853
+
854
+ promise.resolve(0)
855
+ } catch (e: JSONException) {
856
+ Log.e("setUserWithAuthParams", "Error while parsing user with auth params", e)
857
+ promise.reject(e)
858
+ }
859
+ }
860
+
789
861
  @ReactMethod
790
862
  fun showNotice(promise: Promise) {
791
863
  try {
@@ -1018,4 +1090,35 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
1018
1090
  private fun readableArrayToStringArray(readableArray: ReadableArray): Array<String> {
1019
1091
  return Array(readableArray.size()) { i -> readableArray.getString(i) }
1020
1092
  }
1093
+
1094
+ private fun buildUserAuthParams(jsonParameters: JSONObject): UserAuthParams {
1095
+
1096
+ val id = jsonParameters.getString("id")
1097
+ val algorithm = jsonParameters.getString("algorithm")
1098
+ val secretId = jsonParameters.getString("secretId")
1099
+
1100
+ return if (jsonParameters.has("initializationVector")) {
1101
+ val expiration = if (jsonParameters.has("expiration")) jsonParameters.getLong("expiration") else null
1102
+ val initializationVector = jsonParameters.getString("initializationVector")
1103
+ UserAuthWithEncryptionParams(
1104
+ id = id,
1105
+ algorithm = algorithm,
1106
+ secretId = secretId,
1107
+ initializationVector = initializationVector,
1108
+ expiration = expiration
1109
+ )
1110
+ } else {
1111
+ val expiration = if (jsonParameters.has("expiration")) jsonParameters.getLong("expiration") else null
1112
+ val digest = jsonParameters.getString("digest")
1113
+ val salt = if (jsonParameters.has("salt")) jsonParameters.getString("salt") else null
1114
+ UserAuthWithHashParams(
1115
+ id = id,
1116
+ algorithm = algorithm,
1117
+ secretId = secretId,
1118
+ digest = digest,
1119
+ salt = salt,
1120
+ expiration = expiration
1121
+ )
1122
+ }
1123
+ }
1021
1124
  }
package/ios/Didomi.m CHANGED
@@ -14,6 +14,8 @@ RCT_EXTERN_METHOD(initialize:(NSString *)userAgentName
14
14
  noticeId:(nullable NSString *)noticeId
15
15
  androidTvNoticeId:(nullable NSString *)androidTvNoticeId
16
16
  androidTvEnabled:(BOOL)androidTvEnabled
17
+ countryCode:(nullable NSString *)countryCode
18
+ regionCode:(nullable NSString *)regionCode
17
19
  resolve:(RCTPromiseResolveBlock)resolve
18
20
  reject:(RCTPromiseRejectBlock)reject)
19
21
 
@@ -79,16 +81,6 @@ RCT_EXTERN_METHOD(setUserAgreeToAll:(RCTPromiseResolveBlock)resolve
79
81
  RCT_EXTERN_METHOD(setUserDisagreeToAll:(RCTPromiseResolveBlock)resolve
80
82
  reject:(RCTPromiseRejectBlock)reject)
81
83
 
82
- // @objc(onReady:)
83
- // func onReady(callback: @escaping RCTResponseSenderBlock) {
84
- // Didomi.shared.onReady(callback: callback)
85
- // }
86
-
87
- // @objc(onError:)
88
- // func onError(callback: @escaping (Didomi.DidomiErrorEvent)) {
89
- // Didomi.shared.onError(callback: callback)
90
- // }
91
-
92
84
  RCT_EXTERN_METHOD(reset:(RCTPromiseResolveBlock)resolve
93
85
  reject:(RCTPromiseRejectBlock)reject)
94
86
 
@@ -242,6 +234,16 @@ RCT_EXTERN_METHOD(setUserWithEncryptionAuthWithExpirationAndSetupUI:(NSString *)
242
234
  resolve:(RCTPromiseResolveBlock)resolve
243
235
  reject:(RCTPromiseRejectBlock)reject)
244
236
 
237
+ RCT_EXTERN_METHOD(setUserWithAuthParams:(NSString *)jsonUserAuthParams
238
+ jsonSynchronizedUsers:(NSString)jsonSynchronizedUsers
239
+ resolve:(RCTPromiseResolveBlock)resolve
240
+ reject:(RCTPromiseRejectBlock)reject)
241
+
242
+ RCT_EXTERN_METHOD(setUserWithAuthParamsAndSetupUI:(NSString *)jsonUserAuthParams
243
+ jsonSynchronizedUsers:(NSString)jsonSynchronizedUsers
244
+ resolve:(RCTPromiseResolveBlock)resolve
245
+ reject:(RCTPromiseRejectBlock)reject)
246
+
245
247
  RCT_EXTERN_METHOD(listenToVendorStatus:(NSString *)vendorId
246
248
  resolve:(RCTPromiseResolveBlock)resolve
247
249
  reject:(RCTPromiseRejectBlock)reject)
@@ -1,6 +1,7 @@
1
1
  import Didomi
2
2
  import AdSupport
3
3
  import AppTrackingTransparency
4
+ import Foundation
4
5
 
5
6
  @objc(Didomi)
6
7
  class RNDidomi: RCTEventEmitter {
@@ -20,8 +21,8 @@ class RNDidomi: RCTEventEmitter {
20
21
  return true
21
22
  }
22
23
 
23
- @objc(initialize:userAgentVersion:apiKey:localConfigurationPath:remoteConfigurationURL:providerId:disableDidomiRemoteConfig:languageCode:noticeId:androidTvNoticeId:androidTvEnabled:resolve:reject:)
24
- func initialize(userAgentName: String, userAgentVersion: String, apiKey: String, localConfigurationPath: String?, remoteConfigurationURL: String?, providerId: String?, disableDidomiRemoteConfig: Bool = false, languageCode: String? = nil, noticeId: String? = nil, androidTvNoticeId: String? = nil, androidTvEnabled: Bool = false, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) {
24
+ @objc(initialize:userAgentVersion:apiKey:localConfigurationPath:remoteConfigurationURL:providerId:disableDidomiRemoteConfig:languageCode:noticeId:androidTvNoticeId:androidTvEnabled:countryCode:regionCode:resolve:reject:)
25
+ func initialize(userAgentName: String, userAgentVersion: String, apiKey: String, localConfigurationPath: String?, remoteConfigurationURL: String?, providerId: String?, disableDidomiRemoteConfig: Bool = false, languageCode: String? = nil, noticeId: String? = nil, androidTvNoticeId: String? = nil, androidTvEnabled: Bool = false, countryCode: String? = nil, regionCode: String? = nil, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) {
25
26
  Didomi.shared.setUserAgent(name: userAgentName, version: userAgentVersion)
26
27
 
27
28
  Didomi.shared.initialize(DidomiInitializeParameters(
@@ -31,7 +32,9 @@ class RNDidomi: RCTEventEmitter {
31
32
  providerID: providerId,
32
33
  disableDidomiRemoteConfig: disableDidomiRemoteConfig,
33
34
  languageCode: languageCode ?? Locale.current.languageCode ?? "",
34
- noticeID: noticeId
35
+ noticeID: noticeId,
36
+ countryCode: countryCode,
37
+ regionCode: regionCode
35
38
  ))
36
39
 
37
40
  resolve(0)
@@ -477,6 +480,48 @@ class RNDidomi: RCTEventEmitter {
477
480
  }
478
481
  resolve(0)
479
482
  }
483
+
484
+ @objc(setUserWithAuthParams:jsonSynchronizedUsers:resolve:reject:)
485
+ dynamic func setUserWithAuthParams(jsonUserAuthParams: String, jsonSynchronizedUsers: String?, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) {
486
+ do {
487
+ let userAuthParams = try buildUserAuthParams(from: jsonUserAuthParams)
488
+ let synchronizedUsers = try jsonSynchronizedUsers.flatMap { try buildUserAuthParamsArray(from: $0) } ?? []
489
+
490
+ Didomi.shared.setUser(
491
+ userAuthParams: userAuthParams,
492
+ synchronizedUsers: synchronizedUsers
493
+ )
494
+ resolve(0)
495
+ } catch {
496
+ reject("Error", "Error while setting user with auth params", error)
497
+ }
498
+ }
499
+
500
+ @objc(setUserWithAuthParamsAndSetupUI:jsonSynchronizedUsers:resolve:reject:)
501
+ dynamic func setUserWithAuthParamsAndSetupUI(jsonUserAuthParams: String, jsonSynchronizedUsers: String?, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) {
502
+ do {
503
+ let userAuthParams = try buildUserAuthParams(from: jsonUserAuthParams)
504
+ let synchronizedUsers = try jsonSynchronizedUsers.flatMap { try buildUserAuthParamsArray(from: $0) } ?? []
505
+
506
+ DispatchQueue.main.async {
507
+ if let containerController = RCTPresentedViewController() {
508
+ Didomi.shared.setUser(
509
+ userAuthParams: userAuthParams,
510
+ synchronizedUsers: synchronizedUsers,
511
+ containerController: containerController
512
+ )
513
+ } else {
514
+ Didomi.shared.setUser(
515
+ userAuthParams: userAuthParams,
516
+ synchronizedUsers: synchronizedUsers
517
+ )
518
+ }
519
+ }
520
+ resolve(0)
521
+ } catch {
522
+ reject("Error", "Error while setting user with auth params", error)
523
+ }
524
+ }
480
525
 
481
526
  @objc(listenToVendorStatus:resolve:reject:)
482
527
  dynamic func listenToVendorStatus(vendorId: String, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) {
@@ -811,6 +856,75 @@ extension RNDidomi {
811
856
  Didomi.shared.removeEventListener(listener: didomiEventListener)
812
857
  }
813
858
  }
859
+
860
+ /// Build the user auth params from the JSON parameters
861
+ private func buildUserAuthParams(from jsonString: String) throws -> UserAuthParams {
862
+ let data = jsonString.data(using: .utf8)!
863
+ let json = try JSONSerialization.jsonObject(with: data, options: []) as! [String: Any]
864
+
865
+ guard let id = json["id"] as? String,
866
+ let algorithm = json["algorithm"] as? String,
867
+ let secretID = json["secretId"] as? String else {
868
+ fatalError("Missing required parameters")
869
+ }
870
+
871
+ let expiration = json["expiration"] as? CLong
872
+ let initializationVector = json["initializationVector"] as? String
873
+ let digest = json["digest"] as? String
874
+ let salt = json["salt"] as? String
875
+
876
+ if let initializationVector = initializationVector {
877
+ if let expiration = expiration {
878
+ return UserAuthWithEncryptionParams(
879
+ id: id,
880
+ algorithm: algorithm,
881
+ secretID: secretID,
882
+ initializationVector: initializationVector,
883
+ legacyExpiration: Double(expiration)
884
+ )
885
+ } else {
886
+ return UserAuthWithEncryptionParams(
887
+ id: id,
888
+ algorithm: algorithm,
889
+ secretID: secretID,
890
+ initializationVector: initializationVector
891
+ )
892
+ }
893
+ } else {
894
+ guard let digest = digest else {
895
+ fatalError("Missing required digest parameter")
896
+ }
897
+ if let expiration = expiration {
898
+ return UserAuthWithHashParams(
899
+ id: id,
900
+ algorithm: algorithm,
901
+ secretID: secretID,
902
+ digest: digest,
903
+ salt: salt,
904
+ legacyExpiration: Double(expiration)
905
+ )
906
+ } else {
907
+ return UserAuthWithHashParams(
908
+ id: id,
909
+ algorithm: algorithm,
910
+ secretID: secretID,
911
+ digest: digest,
912
+ salt: salt
913
+ )
914
+ }
915
+ }
916
+ }
917
+
918
+ /// Build the user auth params list from the JSON parameters
919
+ private func buildUserAuthParamsArray(from jsonString: String) throws -> [UserAuthParams] {
920
+ let jsonData = jsonString.data(using: .utf8)!
921
+ let jsonArray = try JSONSerialization.jsonObject(with: jsonData, options: []) as! [[String: Any]]
922
+ return try jsonArray.map { dictionary in
923
+ let jsonData = try JSONSerialization.data(withJSONObject: dictionary, options: [])
924
+ let jsonString = String(data: jsonData, encoding: .utf8)!
925
+ return try buildUserAuthParams(from: jsonString)
926
+ }
927
+ }
814
928
  }
815
929
 
816
930
  extension Int {
@@ -7,5 +7,5 @@ exports.DIDOMI_VERSION = exports.DIDOMI_USER_AGENT_NAME = void 0;
7
7
  // User agent name
8
8
  const DIDOMI_USER_AGENT_NAME = exports.DIDOMI_USER_AGENT_NAME = "Didomi React-Native SDK";
9
9
  // User agent version
10
- const DIDOMI_VERSION = exports.DIDOMI_VERSION = "2.3.0";
10
+ const DIDOMI_VERSION = exports.DIDOMI_VERSION = "2.4.0";
11
11
  //# sourceMappingURL=Constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DIDOMI_USER_AGENT_NAME","exports","DIDOMI_VERSION"],"sources":["Constants.ts"],"sourcesContent":["// User agent name\nexport const DIDOMI_USER_AGENT_NAME = \"Didomi React-Native SDK\"\n// User agent version\nexport const DIDOMI_VERSION = \"2.3.0\"\n"],"mappings":";;;;;;AAAA;AACO,MAAMA,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,yBAAyB;AAC/D;AACO,MAAME,cAAc,GAAAD,OAAA,CAAAC,cAAA,GAAG,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["DIDOMI_USER_AGENT_NAME","exports","DIDOMI_VERSION"],"sources":["Constants.ts"],"sourcesContent":["// User agent name\nexport const DIDOMI_USER_AGENT_NAME = \"Didomi React-Native SDK\"\n// User agent version\nexport const DIDOMI_VERSION = \"2.4.0\"\n"],"mappings":";;;;;;AAAA;AACO,MAAMA,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,yBAAyB;AAC/D;AACO,MAAME,cAAc,GAAAD,OAAA,CAAAC,cAAA,GAAG,OAAO","ignoreList":[]}
@@ -24,13 +24,15 @@ const Didomi = exports.Didomi = {
24
24
  * @param noticeId: Notice id for the remote configuration.
25
25
  * @param androidTvNoticeId: Notice id for the remote configuration when running on Android TV device (ignored on iOS / tvOS). Note that using remote configuration is mandatory for TV devices.
26
26
  * @param androidTvEnabled: Whether to allow Didomi SDK to run on Android TV, default to "false".
27
+ * @param countryCode: Override user country code when determining the privacy regulation to apply. Keep undefined to let the Didomi SDK determine the user country.
28
+ * @param regionCode: Override user region code when determining the privacy regulation to apply. Keep undefined to let the Didomi SDK determine the user region. Ignored if countryCode is not set.
27
29
  */
28
- initialize: (apiKey, localConfigurationPath, remoteConfigurationUrl, providerId, disableDidomiRemoteConfig = false, languageCode, noticeId, androidTvNoticeId, androidTvEnabled = false) => {
30
+ initialize: (apiKey, localConfigurationPath, remoteConfigurationUrl, providerId, disableDidomiRemoteConfig = false, languageCode, noticeId, androidTvNoticeId, androidTvEnabled = false, countryCode, regionCode) => {
29
31
  // Init listener
30
32
  _DidomiListener.DidomiListener.init();
31
33
 
32
34
  // Trigger native SDK init
33
- return RNDidomi.initialize(_Constants.DIDOMI_USER_AGENT_NAME, _Constants.DIDOMI_VERSION, apiKey, localConfigurationPath, remoteConfigurationUrl, providerId, disableDidomiRemoteConfig, languageCode, noticeId, androidTvNoticeId, androidTvEnabled);
35
+ return RNDidomi.initialize(_Constants.DIDOMI_USER_AGENT_NAME, _Constants.DIDOMI_VERSION, apiKey, localConfigurationPath, remoteConfigurationUrl, providerId, disableDidomiRemoteConfig, languageCode, noticeId, androidTvNoticeId, androidTvEnabled, countryCode, regionCode);
34
36
  },
35
37
  /**
36
38
  * Listen to SDK ready state
@@ -382,6 +384,7 @@ const Didomi = exports.Didomi = {
382
384
  * @param digest Digest of the organization user ID and secret
383
385
  * @param salt Salt used for computing the digest (optional)
384
386
  * @param expiration Expiration date as timestamp (to prevent replay attacks)
387
+ * @deprecated use {@link #setUserWithAuthParams()} instead.
385
388
  */
386
389
  setUserWithHashAuth: (id, algorithm, secretId, digest, salt, expiration) => {
387
390
  if (expiration === undefined) {
@@ -399,6 +402,7 @@ const Didomi = exports.Didomi = {
399
402
  * @param digest Digest of the organization user ID and secret
400
403
  * @param salt Salt used for computing the digest (optional)
401
404
  * @param expiration Expiration date as timestamp (to prevent replay attacks)
405
+ * @deprecated use {@link #setUserWithAuthParamsAndSetupUI()} instead.
402
406
  */
403
407
  setUserWithHashAuthAndSetupUI: (id, algorithm, secretId, digest, salt, expiration) => {
404
408
  if (expiration === undefined) {
@@ -415,6 +419,7 @@ const Didomi = exports.Didomi = {
415
419
  * @param secretId ID of the secret used for computing the digest
416
420
  * @param initializationVector Initialization Vector used for computing the user ID
417
421
  * @param expiration Expiration date as timestamp (to prevent replay attacks)
422
+ * @deprecated use {@link #setUserWithAuthParams()} instead.
418
423
  */
419
424
  setUserWithEncryptionAuth: (id, algorithm, secretId, initializationVector, expiration) => {
420
425
  if (expiration === undefined) {
@@ -431,6 +436,7 @@ const Didomi = exports.Didomi = {
431
436
  * @param secretId ID of the secret used for computing the digest
432
437
  * @param initializationVector Initialization Vector used for computing the user ID
433
438
  * @param expiration Expiration date as timestamp (to prevent replay attacks)
439
+ * @deprecated use {@link #setUserWithAuthParamsAndSetupUI()} instead.
434
440
  */
435
441
  setUserWithEncryptionAuthAndSetupUI: (id, algorithm, secretId, initializationVector, expiration) => {
436
442
  if (expiration === undefined) {
@@ -439,6 +445,20 @@ const Didomi = exports.Didomi = {
439
445
  RNDidomi.setUserWithEncryptionAuthWithExpirationAndSetupUI(id, algorithm, secretId, initializationVector, expiration);
440
446
  }
441
447
  },
448
+ /**
449
+ * Set user information with authentication (Hash or Encryption)
450
+ *
451
+ * @param userAuthParams as UserAuthParams (use UserAuthWithEncryptionParams or UserAuthWithHashParams)
452
+ * @param synchronizedUsers as UserAuthParams[] (optional)
453
+ */
454
+ setUserWithAuthParams: (userAuthParams, synchronizedUsers) => RNDidomi.setUserWithAuthParams(JSON.stringify(userAuthParams), JSON.stringify(synchronizedUsers)),
455
+ /**
456
+ * Set user information with authentication (Hash or Encryption) and check for missing consent
457
+ *
458
+ * @param userAuthParams as UserAuthParams (use UserAuthWithEncryptionParams or UserAuthWithHashParams)
459
+ * @param synchronizedUsers as UserAuthParams[] (optional)
460
+ */
461
+ setUserWithAuthParamsAndSetupUI: (userAuthParams, synchronizedUsers) => RNDidomi.setUserWithAuthParamsAndSetupUI(JSON.stringify(userAuthParams), JSON.stringify(synchronizedUsers)),
442
462
  /**
443
463
  * Show the consent notice (if required, not disabled in the config and not already displayed)
444
464
  */