@didomi/react-native 1.4.0 → 1.7.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.
@@ -6,33 +6,49 @@ import AppTrackingTransparency
6
6
  class RNDidomi: RCTEventEmitter {
7
7
 
8
8
  public static var initialized = false
9
- let didomiEventListener = EventListener()
10
-
9
+ var didomiEventListener: EventListener
10
+
11
+ override init() {
12
+ didomiEventListener = EventListener()
13
+ super.init()
14
+ initEventListener()
15
+ }
16
+
11
17
  override static func requiresMainQueueSetup() -> Bool {
12
18
  return true
13
19
  }
14
20
 
15
- @objc(initialize:localConfigurationPath:remoteConfigurationURL:providerId:disableDidomiRemoteConfig:languageCode:noticeId:)
16
- func initialize(apiKey: String, localConfigurationPath: String?, remoteConfigurationURL: String?, providerId: String?, disableDidomiRemoteConfig: Bool = false, languageCode: String? = nil, noticeId: String? = nil) {
21
+ @objc(initialize:userAgentVersion:apiKey:localConfigurationPath:remoteConfigurationURL:providerId:disableDidomiRemoteConfig:languageCode:noticeId:)
22
+ func initialize(userAgentName: String, userAgentVersion: String, apiKey: String, localConfigurationPath: String?, remoteConfigurationURL: String?, providerId: String?, disableDidomiRemoteConfig: Bool = false, languageCode: String? = nil, noticeId: String? = nil) {
17
23
  onReady()
18
24
  onError()
19
25
  if !RNDidomi.initialized {
20
26
  initEventListener()
21
- let newLanguageCode = Locale.current.languageCode ?? ""
22
- Didomi.shared.initialize(apiKey: apiKey, localConfigurationPath: localConfigurationPath, remoteConfigurationURL: remoteConfigurationURL, providerId: providerId, disableDidomiRemoteConfig: disableDidomiRemoteConfig, languageCode: languageCode != nil ? languageCode : newLanguageCode, noticeId: noticeId)
27
+
28
+ Didomi.shared.setUserAgent(name: userAgentName, version: userAgentVersion)
29
+
30
+ Didomi.shared.initialize(DidomiInitializeParameters(
31
+ apiKey: apiKey,
32
+ localConfigurationPath: localConfigurationPath,
33
+ remoteConfigurationURL: remoteConfigurationURL,
34
+ providerID: providerId,
35
+ disableDidomiRemoteConfig: disableDidomiRemoteConfig,
36
+ languageCode: languageCode ?? Locale.current.languageCode ?? "",
37
+ noticeID: noticeId
38
+ ))
23
39
  }
24
40
  RNDidomi.initialized = true
25
41
  }
26
42
 
27
43
  private func onReady() {
28
44
  Didomi.shared.onReady {
29
- self.sendEvent(withName: "on_ready_callback", body: nil)
45
+ self.dispatchEvent(withName: "on_ready_callback", body: nil)
30
46
  }
31
47
  }
32
48
 
33
49
  private func onError() {
34
50
  Didomi.shared.onError { error in
35
- self.sendEvent(withName: "on_error_callback", body: error.descriptionText)
51
+ self.dispatchEvent(withName: "on_error_callback", body: error.descriptionText)
36
52
  }
37
53
  }
38
54
 
@@ -41,11 +57,6 @@ class RNDidomi: RCTEventEmitter {
41
57
  resolve(Didomi.shared.getQueryStringForWebView())
42
58
  }
43
59
 
44
- @objc(setUserAgent:version:)
45
- func setUserAgent(name: String, version: String) {
46
- Didomi.shared.setUserAgent(name: name, version: version)
47
- }
48
-
49
60
  @objc(setUserConsentStatus:disabledPurposeIds:enabledVendorIds:disabledVendorIds:resolve:reject:)
50
61
  func setUserConsentStatus(enabledPurposeIds: Set<String>, disabledPurposeIds: Set<String>, enabledVendorIds: Set<String>, disabledVendorIds: Set<String>, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) {
51
62
  resolve(Didomi.shared.setUserConsentStatus(enabledPurposeIds: Set(enabledPurposeIds), disabledPurposeIds: Set(disabledPurposeIds), enabledVendorIds: Set(enabledVendorIds), disabledVendorIds: Set(disabledVendorIds)))
@@ -150,7 +161,6 @@ class RNDidomi: RCTEventEmitter {
150
161
  resolve(Array(Didomi.shared.getRequiredVendorIds()))
151
162
  }
152
163
 
153
-
154
164
  @objc(isReady:reject:)
155
165
  func isReady(resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) {
156
166
  resolve(Didomi.shared.isReady())
@@ -163,8 +173,6 @@ class RNDidomi: RCTEventEmitter {
163
173
  resolve(purposes)
164
174
  }
165
175
 
166
-
167
-
168
176
  @objc(getRequiredVendors:reject:)
169
177
  func getRequiredVendors(resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) {
170
178
  let encoder = JSONEncoder()
@@ -179,7 +187,6 @@ class RNDidomi: RCTEventEmitter {
179
187
  resolve(purposes)
180
188
  }
181
189
 
182
-
183
190
  @objc(getEnabledPurposeIds:reject:)
184
191
  func getEnabledPurposeIds(resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) {
185
192
  resolve(Array(Didomi.shared.getEnabledPurposeIds()))
@@ -249,7 +256,6 @@ class RNDidomi: RCTEventEmitter {
249
256
  Didomi.shared.updateSelectedLanguage(languageCode: languageCode)
250
257
  }
251
258
 
252
-
253
259
  // MARK: ViewProviderDelegate
254
260
 
255
261
  @objc(getNoticeViewController:resolve:reject:)
@@ -262,7 +268,6 @@ class RNDidomi: RCTEventEmitter {
262
268
  resolve(Didomi.shared.getPreferencesViewController())
263
269
  }
264
270
 
265
-
266
271
  // MARK: Didomi extension
267
272
 
268
273
  @objc(setupUI)
@@ -364,17 +369,60 @@ class RNDidomi: RCTEventEmitter {
364
369
 
365
370
  Didomi.shared.setLogLevel(minLevel: level)
366
371
  }
367
-
368
- @objc(setUser:)
369
- dynamic func setUser(id: String) {
370
- Didomi.shared.setUser(id: id)
371
- }
372
-
372
+
373
373
  @objc(setUser:algorithm:secretId:salt:digest:)
374
- dynamic func setUser(id: String, algorithm: String, secretId: String, salt: String?, digest: String) {
375
- Didomi.shared.setUser(id: id, algorithm: algorithm, secretId: secretId, salt: salt, digest: digest)
374
+ dynamic func setUser(id: String, algorithm: String?, secretId: String?, salt: String?, digest: String?) {
375
+ if let algorithm = algorithm, let secretId = secretId, let digest = digest {
376
+ Didomi.shared.setUser(id: id, algorithm: algorithm, secretId: secretId, salt: salt, digest: digest)
377
+ } else {
378
+ Didomi.shared.setUser(id: id)
379
+ }
376
380
  }
377
-
381
+
382
+ @objc(setUserWithHashAuth:algorithm:secretId:digest:salt:)
383
+ dynamic func setUserWithHashAuth(id: String, algorithm: String, secretId: String, digest: String, salt: String?) {
384
+ Didomi.shared.setUser(
385
+ userAuthParams: UserAuthWithHashParams(
386
+ id: id,
387
+ algorithm: algorithm,
388
+ secretID: secretId,
389
+ digest: digest,
390
+ salt: salt))
391
+ }
392
+
393
+ @objc(setUserWithHashAuthWithExpiration:algorithm:secretId:digest:salt:expiration:)
394
+ dynamic func setUserWithHashAuthWithExpiration(id: String, algorithm: String, secretId: String, digest: String, salt: String?, expiration: Double) {
395
+ Didomi.shared.setUser(
396
+ userAuthParams: UserAuthWithHashParams(
397
+ id: id,
398
+ algorithm: algorithm,
399
+ secretID: secretId,
400
+ digest: digest,
401
+ salt: salt,
402
+ legacyExpiration: expiration))
403
+ }
404
+
405
+ @objc(setUserWithEncryptionAuth:algorithm:secretId:initializationVector:)
406
+ dynamic func setUserWithEncryptionAuth(id: String, algorithm: String, secretId: String, initializationVector: String) {
407
+ Didomi.shared.setUser(
408
+ userAuthParams: UserAuthWithEncryptionParams(
409
+ id: id,
410
+ algorithm: algorithm,
411
+ secretID: secretId,
412
+ initializationVector: initializationVector))
413
+ }
414
+
415
+ @objc(setUserWithEncryptionAuthWithExpiration:algorithm:secretId:initializationVector:expiration:)
416
+ dynamic func setUserWithEncryptionAuthWithExpiration(id: String, algorithm: String, secretId: String, initializationVector: String, expiration: Double) {
417
+ Didomi.shared.setUser(
418
+ userAuthParams: UserAuthWithEncryptionParams(
419
+ id: id,
420
+ algorithm: algorithm,
421
+ secretID: secretId,
422
+ initializationVector: initializationVector,
423
+ legacyExpiration: expiration))
424
+ }
425
+
378
426
  @objc public enum Views : Int, RawRepresentable {
379
427
 
380
428
  case purposes = 0
@@ -484,135 +532,149 @@ extension RNDidomi {
484
532
  "on_preferences_click_vendor_agree",
485
533
  "on_preferences_click_vendor_disagree",
486
534
  "on_preferences_click_vendor_save_choices",
487
- "on_sync_done"
535
+ "on_sync_done",
536
+ "on_sync_error"
488
537
  ]
489
538
  }
539
+
540
+ private func initEventListener() {
490
541
 
491
-
492
- private func initEventListener(){
493
-
494
542
  didomiEventListener.onConsentChanged = { event in
495
- self.sendEvent(withName: "on_consent_changed", body:"")
543
+ self.dispatchEvent(withName: "on_consent_changed", body:"")
496
544
  }
497
545
 
498
546
  didomiEventListener.onReady = { event in
499
- self.sendEvent(withName: "on_ready", body: "")
547
+ self.dispatchEvent(withName: "on_ready", body: "")
500
548
  }
501
549
 
502
550
  didomiEventListener.onError = { event in
503
- self.sendEvent(withName: "on_error", body: "")
551
+ self.dispatchEvent(withName: "on_error", body: "")
504
552
  }
505
553
 
506
554
  didomiEventListener.onShowNotice = { event in
507
- self.sendEvent(withName: "on_show_notice", body: "")
555
+ self.dispatchEvent(withName: "on_show_notice", body: "")
508
556
  }
509
557
 
510
558
  didomiEventListener.onHideNotice = { event in
511
- self.sendEvent(withName: "on_hide_notice", body: "")
559
+ self.dispatchEvent(withName: "on_hide_notice", body: "")
512
560
  }
513
561
 
514
562
  didomiEventListener.onNoticeClickAgree = { event in
515
- self.sendEvent(withName: "on_notice_click_agree", body: "")
563
+ self.dispatchEvent(withName: "on_notice_click_agree", body: "")
516
564
  }
517
565
 
518
566
  didomiEventListener.onNoticeClickDisagree = { event in
519
- self.sendEvent(withName: "on_notice_click_disagree", body: "")
567
+ self.dispatchEvent(withName: "on_notice_click_disagree", body: "")
520
568
  }
521
569
 
522
570
  didomiEventListener.onNoticeClickMoreInfo = { event in
523
- self.sendEvent(withName: "on_notice_click_more_info", body: "")
571
+ self.dispatchEvent(withName: "on_notice_click_more_info", body: "")
524
572
  }
525
-
573
+
526
574
  didomiEventListener.onNoticeClickViewVendors = { event in
527
- self.sendEvent(withName: "on_notice_click_view_vendors", body: "")
575
+ self.dispatchEvent(withName: "on_notice_click_view_vendors", body: "")
528
576
  }
529
-
577
+
530
578
  didomiEventListener.onNoticeClickPrivacyPolicy = { event in
531
- self.sendEvent(withName: "on_notice_click_privacy_policy", body: "")
579
+ self.dispatchEvent(withName: "on_notice_click_privacy_policy", body: "")
532
580
  }
533
581
 
534
582
  didomiEventListener.onShowPreferences = { event in
535
- self.sendEvent(withName: "on_show_preferences", body: "")
583
+ self.dispatchEvent(withName: "on_show_preferences", body: "")
536
584
  }
537
585
 
538
586
  didomiEventListener.onHidePreferences = { event in
539
- self.sendEvent(withName: "on_hide_preferences", body: "")
587
+ self.dispatchEvent(withName: "on_hide_preferences", body: "")
540
588
  }
541
589
 
542
590
  didomiEventListener.onPreferencesClickAgreeToAll = { event in
543
- self.sendEvent(withName: "on_preferences_click_agree_to_all", body: "")
591
+ self.dispatchEvent(withName: "on_preferences_click_agree_to_all", body: "")
544
592
  }
545
593
 
546
594
  didomiEventListener.onPreferencesClickDisagreeToAll = { event in
547
- self.sendEvent(withName: "on_preferences_click_disagree_to_all", body: "")
595
+ self.dispatchEvent(withName: "on_preferences_click_disagree_to_all", body: "")
548
596
  }
549
597
 
550
598
  didomiEventListener.onPreferencesClickAgreeToAllPurposes = { event in
551
- self.sendEvent(withName: "on_preferences_click_agree_to_all_purposes", body: "")
599
+ self.dispatchEvent(withName: "on_preferences_click_agree_to_all_purposes", body: "")
552
600
  }
553
601
 
554
602
  didomiEventListener.onPreferencesClickDisagreeToAllPurposes = { event in
555
- self.sendEvent(withName: "on_preferences_click_disagree_to_all_purposes", body: "")
603
+ self.dispatchEvent(withName: "on_preferences_click_disagree_to_all_purposes", body: "")
556
604
  }
557
605
 
558
606
  didomiEventListener.onPreferencesClickResetAllPurposes = { event in
559
- self.sendEvent(withName: "on_preferences_click_reset_all_purposes", body: "")
607
+ self.dispatchEvent(withName: "on_preferences_click_reset_all_purposes", body: "")
560
608
  }
561
609
 
562
610
  didomiEventListener.onPreferencesClickAgreeToAllVendors = { event in
563
- self.sendEvent(withName: "on_preferences_click_agree_to_all_vendors", body: "")
611
+ self.dispatchEvent(withName: "on_preferences_click_agree_to_all_vendors", body: "")
564
612
  }
565
613
 
566
614
  didomiEventListener.onPreferencesClickDisagreeToAllVendors = { event in
567
- self.sendEvent(withName: "on_preferences_click_disagree_to_all_vendors", body: "")
615
+ self.dispatchEvent(withName: "on_preferences_click_disagree_to_all_vendors", body: "")
568
616
  }
569
617
 
570
618
  didomiEventListener.onPreferencesClickPurposeAgree = { event, purposeId in
571
- self.sendEvent(withName: "on_preferences_click_purpose_agree", body: purposeId)
619
+ self.dispatchEvent(withName: "on_preferences_click_purpose_agree", body: purposeId)
572
620
  }
573
621
 
574
622
  didomiEventListener.onPreferencesClickPurposeDisagree = { event, purposeId in
575
- self.sendEvent(withName: "on_preferences_click_purpose_disagree", body: purposeId)
623
+ self.dispatchEvent(withName: "on_preferences_click_purpose_disagree", body: purposeId)
576
624
  }
577
625
 
578
626
  didomiEventListener.onPreferencesClickCategoryAgree = { event, categoryId in
579
- self.sendEvent(withName: "on_preferences_click_category_agree", body: categoryId)
627
+ self.dispatchEvent(withName: "on_preferences_click_category_agree", body: categoryId)
580
628
  }
581
629
 
582
630
  didomiEventListener.onPreferencesClickCategoryDisagree = { event, categoryId in
583
- self.sendEvent(withName: "on_preferences_click_category_disagree", body: categoryId)
631
+ self.dispatchEvent(withName: "on_preferences_click_category_disagree", body: categoryId)
584
632
  }
585
633
 
586
634
  didomiEventListener.onPreferencesClickViewVendors = { event in
587
- self.sendEvent(withName: "on_preferences_click_view_vendors", body: "")
635
+ self.dispatchEvent(withName: "on_preferences_click_view_vendors", body: "")
588
636
  }
589
637
 
590
638
  didomiEventListener.onPreferencesClickViewPurposes = { event in
591
- self.sendEvent(withName: "on_preferences_click_view_purposes", body: "")
639
+ self.dispatchEvent(withName: "on_preferences_click_view_purposes", body: "")
592
640
  }
593
641
 
594
642
  didomiEventListener.onPreferencesClickSaveChoices = { event in
595
- self.sendEvent(withName: "on_preferences_click_save_choices", body: "")
643
+ self.dispatchEvent(withName: "on_preferences_click_save_choices", body: "")
596
644
  }
597
645
 
598
646
  didomiEventListener.onPreferencesClickVendorAgree = { event, vendorId in
599
- self.sendEvent(withName: "on_preferences_click_vendor_agree", body: vendorId)
647
+ self.dispatchEvent(withName: "on_preferences_click_vendor_agree", body: vendorId)
600
648
  }
601
649
 
602
650
  didomiEventListener.onPreferencesClickVendorDisagree = { event, vendorId in
603
- self.sendEvent(withName: "on_preferences_click_vendor_disagree", body: vendorId)
651
+ self.dispatchEvent(withName: "on_preferences_click_vendor_disagree", body: vendorId)
604
652
  }
605
653
 
606
654
  didomiEventListener.onPreferencesClickVendorSaveChoices = { event in
607
- self.sendEvent(withName: "on_preferences_click_vendor_save_choices", body: "")
655
+ self.dispatchEvent(withName: "on_preferences_click_vendor_save_choices", body: "")
608
656
  }
609
657
 
610
658
  didomiEventListener.onSyncDone = { event, organizationUserId in
611
- self.sendEvent(withName: "on_sync_done", body: organizationUserId)
659
+ self.dispatchEvent(withName: "on_sync_done", body: organizationUserId)
612
660
  }
613
-
661
+
662
+ didomiEventListener.onSyncError = { event, error in
663
+ self.dispatchEvent(withName: "on_sync_error", body: error)
664
+ }
665
+
614
666
  Didomi.shared.addEventListener(listener: didomiEventListener)
615
667
  }
668
+
669
+ /// Sends the specified event only if the react-native bridge is still valid
670
+ private func dispatchEvent(withName: String, body: String?) {
671
+ if self.bridge != nil {
672
+ self.sendEvent(withName: withName, body: body)
673
+ } else {
674
+ // Event emitter is not valid anymore, remove event listener
675
+ Didomi.shared.removeEventListener(listener: didomiEventListener)
676
+ }
677
+ }
616
678
  }
617
679
 
618
680
  extension Int {
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DIDOMI_VERSION = exports.DIDOMI_USER_AGENT_NAME = void 0;
7
+ // User agent name
8
+ const DIDOMI_USER_AGENT_NAME = "Didomi React-Native SDK"; // User agent version
9
+
10
+ exports.DIDOMI_USER_AGENT_NAME = DIDOMI_USER_AGENT_NAME;
11
+ const DIDOMI_VERSION = "1.7.0";
12
+ exports.DIDOMI_VERSION = DIDOMI_VERSION;
13
+ //# sourceMappingURL=Constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Constants.ts"],"names":["DIDOMI_USER_AGENT_NAME","DIDOMI_VERSION"],"mappings":";;;;;;AAAA;AACO,MAAMA,sBAAsB,GAAG,yBAA/B,C,CACP;;;AACO,MAAMC,cAAc,GAAG,OAAvB","sourcesContent":["// User agent name\nexport const DIDOMI_USER_AGENT_NAME = \"Didomi React-Native SDK\"\n// User agent version\nexport const DIDOMI_VERSION = \"1.7.0\"\n"]}
@@ -9,6 +9,8 @@ var _reactNative = require("react-native");
9
9
 
10
10
  var _DidomiListener = require("./DidomiListener");
11
11
 
12
+ var _Constants = require("./Constants");
13
+
12
14
  const {
13
15
  Didomi: RNDidomi
14
16
  } = _reactNative.NativeModules;
@@ -29,22 +31,22 @@ const Didomi = {
29
31
  _DidomiListener.DidomiListener.init(); // Trigger native SDK init
30
32
 
31
33
 
32
- RNDidomi.initialize(apiKey, localConfigurationPath, remoteConfigurationUrl, providerId, disableDidomiRemoteConfig, languageCode, noticeId);
34
+ RNDidomi.initialize(_Constants.DIDOMI_USER_AGENT_NAME, _Constants.DIDOMI_VERSION, apiKey, localConfigurationPath, remoteConfigurationUrl, providerId, disableDidomiRemoteConfig, languageCode, noticeId);
33
35
  },
34
36
 
35
37
  /**
36
38
  * Listen to SDK ready state
37
- * */
39
+ */
38
40
  onReady: () => _DidomiListener.DidomiListener.onReady(),
39
41
 
40
42
  /**
41
43
  * Listen to SDK errors
42
- * */
44
+ */
43
45
  onError: () => _DidomiListener.DidomiListener.onError(),
44
46
 
45
47
  /**
46
- Provide the objects required to display UI elements
47
- */
48
+ * Provide the objects required to display UI elements
49
+ */
48
50
  setupUI: () => RNDidomi.setupUI(),
49
51
 
50
52
  /**
@@ -337,15 +339,50 @@ const Didomi = {
337
339
  isReady: () => RNDidomi.isReady(),
338
340
 
339
341
  /**
340
- * Set user information with authentication
342
+ * Set user information without authentication
343
+ *
344
+ * @param id Organization user ID
345
+ * @param algorithm Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
346
+ * @param secretId Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
347
+ * @param salt Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
348
+ * @param digest Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
349
+ */
350
+ setUser: (organizationUserId, organizationUserIdAuthAlgorithm, organizationUserIdAuthSid, organizationUserIdAuthSalt, organizationUserIdAuthDigest) => RNDidomi.setUser(organizationUserId, organizationUserIdAuthAlgorithm, organizationUserIdAuthSid, organizationUserIdAuthSalt, organizationUserIdAuthDigest),
351
+
352
+ /**
353
+ * Set user information with Hash authentication
341
354
  *
342
355
  * @param id Organization user ID
343
356
  * @param algorithm Algorithm used for computing the digest
344
357
  * @param secretId ID of the secret used for computing the digest
345
- * @param salt Salt used for computing the digest (optional)
346
358
  * @param digest Digest of the organization user ID and secret
347
- */
348
- setUser: (organizationUserId, organizationUserIdAuthAlgorithm, organizationUserIdAuthSid, organizationUserIdAuthSalt, organizationUserIdAuthDigest) => RNDidomi.setUser(organizationUserId, organizationUserIdAuthAlgorithm, organizationUserIdAuthSid, organizationUserIdAuthSalt, organizationUserIdAuthDigest),
359
+ * @param salt Salt used for computing the digest (optional)
360
+ * @param expiration Expiration date as timestamp (to prevent replay attacks)
361
+ */
362
+ setUserWithHashAuth: (organizationUserId, algorithm, secretId, digest, salt, expiration) => {
363
+ if (expiration === undefined) {
364
+ RNDidomi.setUserWithHashAuth(organizationUserId, algorithm, secretId, digest, salt);
365
+ } else {
366
+ RNDidomi.setUserWithHashAuthWithExpiration(organizationUserId, algorithm, secretId, digest, salt, expiration);
367
+ }
368
+ },
369
+
370
+ /**
371
+ * Set user information with Encryption authentication
372
+ *
373
+ * @param id Organization user ID
374
+ * @param algorithm Algorithm used for computing the digest
375
+ * @param secretId ID of the secret used for computing the digest
376
+ * @param initializationVector Initialization Vector used for computing the user ID
377
+ * @param expiration Expiration date as timestamp (to prevent replay attacks)
378
+ */
379
+ setUserWithEncryptionAuth: (organizationUserId, algorithm, secretId, initializationVector, expiration) => {
380
+ if (expiration === undefined) {
381
+ RNDidomi.setUserWithEncryptionAuth(organizationUserId, algorithm, secretId, initializationVector);
382
+ } else {
383
+ RNDidomi.setUserWithEncryptionAuthWithExpiration(organizationUserId, algorithm, secretId, initializationVector, expiration);
384
+ }
385
+ },
349
386
 
350
387
  /**
351
388
  * Show the consent notice (if required, not disabled in the config and not already displayed)
@@ -1 +1 @@
1
- {"version":3,"sources":["Didomi.ts"],"names":["Didomi","RNDidomi","NativeModules","initialize","apiKey","localConfigurationPath","remoteConfigurationUrl","providerId","disableDidomiRemoteConfig","languageCode","noticeId","DidomiListener","init","onReady","onError","setupUI","setLogLevel","level","addEventListener","eventType","callback","removeEventListener","removeAllEventListeners","reset","getDisabledPurposes","getDisabledPurposeIds","getDisabledVendors","getDisabledVendorIds","getEnabledPurposes","getEnabledPurposeIds","getEnabledVendors","getEnabledVendorIds","getJavaScriptForWebView","extra","getQueryStringForWebView","getPurpose","purposeId","getRequiredPurposes","getRequiredPurposeIds","getRequiredVendors","getRequiredVendorIds","getText","key","getTranslatedText","getUserConsentStatusForPurpose","getUserConsentStatusForVendor","vendorId","getUserConsentStatusForVendorAndRequiredPurposes","getUserLegitimateInterestStatusForPurpose","getUserLegitimateInterestForVendor","getUserLegitimateInterestStatusForVendor","getUserLegitimateInterestStatusForVendorAndRequiredPurposes","getUserStatus","getUserStatusForVendor","getVendor","hideNotice","hidePreferences","isConsentRequired","isUserConsentStatusPartial","isNoticeVisible","isPreferencesVisible","isError","isReady","setUser","organizationUserId","organizationUserIdAuthAlgorithm","organizationUserIdAuthSid","organizationUserIdAuthSalt","organizationUserIdAuthDigest","showNotice","showPreferences","view","setUserAgreeToAll","setUserConsentStatus","enabledPurposeIds","disabledPurposeIds","enabledVendorIds","disabledVendorIds","setUserDisagreeToAll","setUserStatus","purposesConsentStatus","purposesLIStatus","vendorsConsentStatus","vendorsLIStatus","setUserStatusSets","enabledConsentPurposeIds","disabledConsentPurposeIds","enabledLIPurposeIds","disabledLIPurposeIds","enabledConsentVendorIds","disabledConsentVendorIds","enabledLIVendorIds","disabledLIVendorIds","shouldConsentBeCollected","updateSelectedLanguage"],"mappings":";;;;;;;AAAA;;AACA;;AAGA,MAAM;AAAEA,EAAAA,MAAM,EAAEC;AAAV,IAAuBC,0BAA7B;AAEO,MAAMF,MAAM,GAAG;AACpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEG,EAAAA,UAAU,EAAE,CACVC,MADU,EAEVC,sBAFU,EAGVC,sBAHU,EAIVC,UAJU,EAKVC,yBAAkC,GAAG,KAL3B,EAMVC,YANU,EAOVC,QAPU,KAQP;AACH;AACAC,mCAAeC,IAAf,GAFG,CAIH;;;AACAX,IAAAA,QAAQ,CAACE,UAAT,CACEC,MADF,EAEEC,sBAFF,EAGEC,sBAHF,EAIEC,UAJF,EAKEC,yBALF,EAMEC,YANF,EAOEC,QAPF;AASD,GAlCmB;;AAoCpB;AACF;AACA;AACEG,EAAAA,OAAO,EAAE,MAAqBF,+BAAeE,OAAf,EAvCV;;AAyCpB;AACF;AACA;AACEC,EAAAA,OAAO,EAAE,MAAoBH,+BAAeG,OAAf,EA5CT;;AA8CpB;AACF;AACA;AACEC,EAAAA,OAAO,EAAE,MAAqBd,QAAQ,CAACc,OAAT,EAjDV;;AAmDpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,WAAW,EAAGC,KAAD,IAAoChB,QAAQ,CAACe,WAAT,CAAqBC,KAArB,CA1E7B;;AA4EpB;AACF;AACA;AACA;AACEC,EAAAA,gBAAgB,EAAE,CAChBC,SADgB,EAEhBC,QAFgB,KAGbT,+BAAeO,gBAAf,CAAgCC,SAAhC,EAA2CC,QAA3C,CAnFe;;AA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C,eAJF,CAnbkB;;AA0bpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,iBAAiB,EAAE,CACjBC,wBADiB,EAEjBC,yBAFiB,EAGjBC,mBAHiB,EAIjBC,oBAJiB,EAKjBC,uBALiB,EAMjBC,wBANiB,EAOjBC,kBAPiB,EAQjBC,mBARiB,KAUjB3F,QAAQ,CAACmF,iBAAT,CACEC,wBADF,EAEEC,yBAFF,EAGEC,mBAHF,EAIEC,oBAJF,EAKEC,uBALF,EAMEC,wBANF,EAOEC,kBAPF,EAQEC,mBARF,CA/ckB;;AA0dpB;AACF;AACA;AACA;AACEC,EAAAA,wBAAwB,EAAE,MACxB5F,QAAQ,CAAC4F,wBAAT,EA/dkB;;AAiepB;AACF;AACA;AACA;AACA;AACA;AACEC,EAAAA,sBAAsB,EAAGrF,YAAD,IACtBR,QAAQ,CAAC6F,sBAAT,CAAgCrF,YAAhC;AAxekB,CAAf","sourcesContent":["import { NativeModules } from 'react-native';\nimport { DidomiListener } from './DidomiListener';\nimport { DidomiEventType } from './DidomiTypes';\n\nconst { Didomi: RNDidomi } = NativeModules;\n\nexport const Didomi = {\n /**\n * Initialize the Didomi SDK\n *\n * @param apiKey: Public API key of the organization from the Didomi Console.\n * @param localConfigurationPath: Path to your local config file. Defaults to didomi_config.json if null.\n * @param remoteConfigurationURL: URL to a remote configuration file to load during initialization. This parameter is not used yet. Set it to null for now.\n * @param providerId: Your provider ID (if any).\n * @param disableDidomiRemoteConfig: Whether to disable loading the remove configuration from the Didomi config. Keep this to \"false\" for loading configuration from the Didomi Console.\n * @param languageCode: Language in which the consent UI should be displayed. By default, the consent UI is displayed in the language configured in the device settings. This property allows you to override the default setting and specify a language to display the UI in. String containing the language code e.g.: \"es\", \"fr\", etc.\n * @param noticeId: Notice id for the remote configuration.\n */\n initialize: (\n apiKey: string,\n localConfigurationPath?: string,\n remoteConfigurationUrl?: string,\n providerId?: string,\n disableDidomiRemoteConfig: boolean = false,\n languageCode?: string,\n noticeId?: string\n ) => {\n // Init listener\n DidomiListener.init();\n\n // Trigger native SDK init\n RNDidomi.initialize(\n apiKey,\n localConfigurationPath,\n remoteConfigurationUrl,\n providerId,\n disableDidomiRemoteConfig,\n languageCode,\n noticeId\n );\n },\n\n /**\n * Listen to SDK ready state\n * */\n onReady: (): Promise<void> => DidomiListener.onReady(),\n\n /**\n * Listen to SDK errors\n * */\n onError: (): Promise<any> => DidomiListener.onError(),\n\n /**\n Provide the objects required to display UI elements\n */\n setupUI: (): Promise<void> => RNDidomi.setupUI(),\n\n /**\n * Set the minimum level of messages to log\n * You can decide what level of messages should be logged by the SDK by calling the setLogLevel function before initialize\n *\n * Messages with a level below `minLevel` will not be logged.\n *\n * For iOS:\n * Levels are standard levels from `OSLogType` (https://developer.apple.com/documentation/os/logging/choosing_the_log_level_for_a_message):\n * - OSLogType.info (1)\n * - OSLogType.debug (2)\n * - OSLogType.error (16)\n * - OSLogType.fault (17)\n *\n * We recommend setting `OSLogType.error` (16) in production\n *\n * For Android:\n * Use the standard log levels supported by android.util.Log: VERBOSE, DEBUG, INFO, WARN and ERROR.\n * (https://developer.android.com/reference/android/util/Log#constants_1)\n *\n * We recommend setting `Log.INFO` (4) in production\n *\n * @param minLevel: Minimum level of messages to log\n */\n setLogLevel: (level: number): Promise<number> => RNDidomi.setLogLevel(level),\n\n /**\n * Add an event listener\n * @param listener:\n */\n addEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => DidomiListener.addEventListener(eventType, callback),\n\n /**\n * Remove an event listener\n * @param listener:\n */\n removeEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => DidomiListener.removeEventListener(eventType, callback),\n\n /**\n * Remove all event listeners\n */\n removeAllEventListeners: () => DidomiListener.reset(),\n\n /**\n * Method used to get an array of disabled purposes.\n * @returns: array of disabled purposes.\n */\n getDisabledPurposes: (): Promise<any[]> => RNDidomi.getDisabledPurposes(),\n\n /**\n * Method used to get a set of disabled purpose IDs.\n * @returns: set that contains the IDs of disabled purposes.\n */\n getDisabledPurposeIds: (): Promise<any[]> => RNDidomi.getDisabledPurposeIds(),\n\n /**\n * Method used to get an array of disabled vendors.\n * @returns: array of disabled vendors.\n */\n getDisabledVendors: (): Promise<any[]> => RNDidomi.getDisabledVendors(),\n\n /**\n * Method used to get a set of disabled vendor IDs.\n * @returns: set that contains the IDs of disabled vendors.\n */\n getDisabledVendorIds: (): Promise<any[]> => RNDidomi.getDisabledVendorIds(),\n\n /**\n * Method used to get an array of enabled purposes.\n * @returns: array of enabled purposes.\n */\n getEnabledPurposes: (): Promise<any[]> => RNDidomi.getEnabledPurposes(),\n\n /**\n * Method used to get a set of enabled purpose IDs.\n * @returns: set that contains the IDs of enabled purposes.\n */\n getEnabledPurposeIds: (): Promise<any[]> => RNDidomi.getEnabledPurposeIds(),\n\n /**\n * Method used to get an array of enabled vendors.\n * @returns: array of enabled vendors.\n */\n getEnabledVendors: (): Promise<any[]> => RNDidomi.getEnabledVendors(),\n\n /**\n * Method used to get a set of enabled vendor IDs.\n * @returns: set that contains the IDs of enabled vendors.\n */\n getEnabledVendorIds: (): Promise<any[]> => RNDidomi.getEnabledVendorIds(),\n\n /**\n * Get JavaScript to embed into a WebView to pass the consent status from the app\n * to the Didomi Web SDK embedded into the WebView\n * Inject the returned JavaScript into a WebView\n * @param extra: Extra JavaScript to inject in the returned code\n * @returns: JavaScript code to inject in a WebView\n */\n getJavaScriptForWebView: (extra?: string | null): Promise<string> => RNDidomi.getJavaScriptForWebView(extra),\n\n getQueryStringForWebView: (): Promise<string> => RNDidomi.getQueryStringForWebView(),\n\n /**\n * Method used to get a Purpose based on its ID.\n * @param purposeId: purpose ID used in the search.\n * @returns: purpose found in the array.\n */\n getPurpose: (purposeId: string): Promise<any> => RNDidomi.getPurpose(purposeId),\n\n /**\n * Method used to get an array of required purposes.\n *\n * @returns: array of required purposes.\n */\n getRequiredPurposes: (): Promise<any[]> => RNDidomi.getRequiredPurposes(),\n\n /**\n * Get the configured purpose IDs\n * @returns: set of purpose IDs.\n */\n getRequiredPurposeIds: (): Promise<any[]> => RNDidomi.getRequiredPurposeIds(),\n\n /**\n * Method used to get an array of required vendors.\n * @returns: array of required vendors.\n */\n getRequiredVendors: (): Promise<any[]> => RNDidomi.getRequiredVendors(),\n\n /**\n * Get the configured vendor IDs\n * @returns: set of vendor IDs.\n */\n getRequiredVendorIds: (): Promise<any[]> => RNDidomi.getRequiredVendorIds(),\n\n /**\n * Method used to get a dictionary/map in the form of { \"en\": \"Key in English\", \"fr\": \"Key in French.\" }\n * for a given key.\n * @param key: used to find its corresponding value in the dictionary/map.\n * @returns: dictionary containing the different translations for a given key.\n */\n getText: (key: string): Promise<any[]> => RNDidomi.getText(key),\n\n /**\n * Method used to get a translated text based on the key being passed.\n * The language and the source of this translated text will depend on the availability of the translation for the specific key.\n * The language being used will be either the selected language of the SDK (based on device Locale and other parameters) or the language specified by app developers as the default language being used by the SDK. The source can be either the `didomi_config.json` file which can be either local or remote, or the `didomi_master_config.json` file which is bundled within the SDK.\n *\n * These are the attempts performed by the SDK to try to find a translation for the specific key:\n * - Get translated value in user locale (selected language) from `didomi_config.json` (either local or remote).\n * - Get translated value in default locale (from the config) from `didomi_config.json` (either local or remote).\n * - Get translated value in user locale (selected language) from `didomi_master_config.json` (bundled within the Didomi SDK).\n * - Get translated value in default locale (from the config) from `didomi_master_config.json` (bundled within the Didomi SDK).\n *\n * If no translation can be found after these 4 attempts, the key will be returned.\n *\n * App developers can provide these translated texts through the `didomi_config.json` file (locally or remotely) in 3 different ways:\n * - Custom texts for the consent notice: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-notice#texts\n * - Custom texts for the preferences: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-preferences-popup#text\n * - Custom texts for custom notices: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-theme#translatable-texts-for-custom-notices\n *\n * @param key: used to find its corresponding value in one of the different sources.\n * @returns: a translated string if a translation was found, the same key that was passed otherwise.\n */\n getTranslatedText: (key: string): Promise<string> => RNDidomi.getTranslatedText(key),\n\n /**\n * Get the user consent status for a specific purpose\n * @param purposeId: The purpose ID to check consent for\n * @returns: The user consent status for the specified purpose\n * @deprecated use {@link #getUserStatus()} instead. Search the purposeId in\n * getUserStatus().getPurposes().getConsent().getEnabled() or\n * getUserStatus().getPurposes().getConsent().getDisabled().\n */\n getUserConsentStatusForPurpose: (purposeId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForPurpose(purposeId),\n\n /**\n * Get the user consent status for a specific vendor\n * @param vendorId: The vendor ID to check consent for\n * @returns: The user consent status for the specified vendor\n * @deprecated use {@link #getUserStatus()} instead. Search the vendorId in\n * getUserStatus().getVendors().getConsent().getEnabled() or\n * getUserStatus().getVendors().getConsent().getDisabled().\n */\n getUserConsentStatusForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForVendor(vendorId),\n\n /**\n * Get the user consent status for a specific vendor and all its purposes\n * @param vendorId: The ID of the vendor\n * @returns: The user consent status corresponding to the specified vendor and all its required purposes.\n * @deprecated use {@link #getUserStatus()} instead. The result of this method has been replaced\n * by getUserStatus().getVendors().getGlobalConsent().getEnabled() or\n * getUserStatus().getVendors().getGlobalConsent().getDisabled().\n */\n getUserConsentStatusForVendorAndRequiredPurposes: (vendorId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForVendorAndRequiredPurposes(vendorId),\n\n /**\n * Get the user legitimate interest status for a specific purpose.\n * @param purposeId: purpose ID.\n * @returns: LI status of a purpose.\n * @deprecated use {@link #getUserStatus()} instead. Search the purposeId in\n * getUserStatus().getPurposes().getLegitimateInterest().getEnabled() or\n * getUserStatus().getPurposes().getLegitimateInterest().getDisabled().\n */\n getUserLegitimateInterestStatusForPurpose: (purposeId: string): Promise<boolean> => RNDidomi.getUserLegitimateInterestStatusForPurpose(purposeId),\n\n /**\n * Get the user legitimate interest status for a specific vendor.\n * @param vendorId: vendor ID.\n * @returns: LI status of a vendor.\n * @deprecated use {@link #getUserStatus()} instead. Search the vendorId in\n * getUserStatus().getVendors().getLegitimateInterest().getEnabled() or\n * getUserStatus().getVendors().getLegitimateInterest().getDisabled().\n */\n getUserLegitimateInterestForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserLegitimateInterestStatusForVendor(vendorId),\n\n /**\n * Get the user LI status for a specific vendor and all its purposes.\n * @param vendorId: vendor ID.\n * @returns: The user LI status corresponding to the specified vendor and all its required purposes.\n * @deprecated use {@link #getUserStatus()} instead. Search the purposeId in\n * getUserStatus().getVendors().getGlobalLegitimateInterest().getEnabled() or\n * getUserStatus().getVendors().getGlobalLegitimateInterest().getDisabled().\n */\n getUserLegitimateInterestStatusForVendorAndRequiredPurposes: (vendorId: string): boolean => RNDidomi.getUserLegitimateInterestStatusForVendorAndRequiredPurposes(vendorId),\n\n /**\n * Get the user consent status.\n * @returns: status that represents user consent.\n */\n getUserStatus: (): Promise<any> => RNDidomi.getUserStatus(),\n\n /**\n * Get the user consent and legitimate interest status for a specific vendor.\n * @param vendorId: vendor ID.\n * @returns: status that represents both consent and legitimate interest status of a vendor.\n * @deprecated use {@link #getUserStatus()} instead. Search the vendorId in\n * getUserStatus().getVendors().getGlobal().getEnabled() or\n * getUserStatus().getVendors().getGlobal().getDisabled().\n */\n getUserStatusForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserStatusForVendor(vendorId),\n\n /**\n * Method used to get a Vendor based on its ID.\n * @param vendorId: vendor ID used in the search.\n * @returns: vendor found in the array.\n */\n getVendor: (vendorId: string): Promise<any> => RNDidomi.getVendor(vendorId),\n\n /**\n * Hide the notice if it is currently displayed\n */\n hideNotice: (): Promise<void> => RNDidomi.hideNotice(),\n\n /**\n * Hide the preferences popup for purposes\n */\n hidePreferences: (): Promise<void> => RNDidomi.hidePreferences(),\n\n /**\n * Determine if consent is required for the user. The rules are (OR):\n * - The user country is in the EU.\n * - The company is from the EU.\n * - The user country is unknown and the app has chosen to collect consent when unknown.\n * @returns: **true** if consent is required, **false** if it is not required.\n */\n isConsentRequired: (): Promise<boolean> => RNDidomi.isConsentRequired(),\n\n /**\n * Determine if consent information is available for all purposes and vendors that are required\n * @returns: **true** if consent is required and consent information is available, **false** otherwise.\n */\n isUserConsentStatusPartial: (): Promise<boolean> => RNDidomi.isUserConsentStatusPartial(),\n\n /**\n * Check if the consent notice is currently displayed\n * @returns: **true** if the notice is displayed, **false** if is not.\n */\n isNoticeVisible: (): Promise<boolean> => RNDidomi.isNoticeVisible(),\n\n /**\n * Method used to check if the Preferences view is visible.\n * @returns: **true** if Preferences view is visible, **false** otherwise.\n */\n isPreferencesVisible: (): Promise<boolean> => RNDidomi.isPreferencesVisible(),\n\n isError: (): Promise<boolean> => RNDidomi.isError(),\n\n /**\n * Is the Didomi SDK ready?\n */\n isReady: (): Promise<boolean> => RNDidomi.isReady(),\n\n /**\n * Set user information with authentication\n *\n * @param id Organization user ID\n * @param algorithm Algorithm used for computing the digest\n * @param secretId ID of the secret used for computing the digest\n * @param salt Salt used for computing the digest (optional)\n * @param digest Digest of the organization user ID and secret\n */\n setUser: (\n organizationUserId: string,\n organizationUserIdAuthAlgorithm: string,\n organizationUserIdAuthSid: string,\n organizationUserIdAuthSalt: string,\n organizationUserIdAuthDigest: string\n ): Promise<void> =>\n RNDidomi.setUser(\n organizationUserId,\n organizationUserIdAuthAlgorithm,\n organizationUserIdAuthSid,\n organizationUserIdAuthSalt,\n organizationUserIdAuthDigest\n ),\n\n /**\n * Show the consent notice (if required, not disabled in the config and not already displayed)\n */\n showNotice: (): Promise<void> => RNDidomi.showNotice(),\n\n /**\n * Show the preferences screen when/if the SDK is ready. By default the purposes list will be displayed.\n * @param view: It can be `purposes` or `vendors`\n */\n showPreferences: (view?: string): Promise<void> => RNDidomi.showPreferences(view),\n\n /**\n * Remove all consents for the user\n */\n reset: (): Promise<void> => RNDidomi.reset(),\n\n /**\n * Method that allows to enable consent and legitimate interest for all the required purposes.\n * @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserAgreeToAll: (): Promise<boolean> => RNDidomi.setUserAgreeToAll(),\n\n /**\n * Set the user consent status.\n * @param enabledPurposeIds: set containing **enabled purpose ids**\n * @param disabledPurposeIds: set containing **disabled purpose ids**\n * @param enabledVendorIds: set containing **enabled vendor ids**\n * @param disabledVendorIds: set containing **disabled purpose ids**\n * @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserConsentStatus: (\n enabledPurposeIds: string[],\n disabledPurposeIds: string[],\n enabledVendorIds: string[],\n disabledVendorIds: string[]\n ): Promise<boolean> =>\n RNDidomi.setUserConsentStatus(\n enabledPurposeIds,\n disabledPurposeIds,\n enabledVendorIds,\n disabledVendorIds\n ),\n\n /**\n * Method that allows to disable consent and legitimate interest for all the required purposes and vendors.\n * @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserDisagreeToAll: (): Promise<boolean> => RNDidomi.setUserDisagreeToAll(),\n\n /**\n * Set the user status for purposes and vendors for consent and legitimate interest.\n * @param purposesConsentStatus: boolean used to determine if consent will be enabled or disabled for all purposes.\n * @param purposesLIStatus: boolean used to determine if legitimate interest will be enabled or disabled for all purposes.\n * @param vendorsConsentStatus: boolean used to determine if consent will be enabled or disabled for all vendors.\n * @param vendorsLIStatus: boolean used to determine if legitimate interest will be enabled or disabled for all vendors.\n * @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserStatus: (\n purposesConsentStatus: boolean,\n purposesLIStatus: boolean,\n vendorsConsentStatus: boolean,\n vendorsLIStatus: boolean\n ): Promise<boolean> =>\n RNDidomi.setUserStatus(\n purposesConsentStatus,\n purposesLIStatus,\n vendorsConsentStatus,\n vendorsLIStatus\n ),\n\n /**\n * Set the user status for purposes and vendors for consent and legitimate interest.\n * @param enabledConsentPurposeIds: List of purpose IDs to enable for consent.\n * @param disabledConsentPurposeIds: List of purpose IDs to disable for consent.\n * @param enabledLIPurposeIds: List of purpose IDs to enable for LI.\n * @param disabledLIPurposeIds: List of purpose IDs to disable for LI.\n * @param enabledConsentVendorIds: List of vendor IDs to enable for consent.\n * @param disabledConsentVendorIds: List of vendor IDs to disable for consent.\n * @param enabledLIVendorIds: List of vendor IDs to enable for LI.\n * @param disabledLIVendorIds: List of vendor IDs to disable for LI.\n */\n setUserStatusSets: (\n enabledConsentPurposeIds: string[],\n disabledConsentPurposeIds: string[],\n enabledLIPurposeIds: string[],\n disabledLIPurposeIds: string[],\n enabledConsentVendorIds: string[],\n disabledConsentVendorIds: string[],\n enabledLIVendorIds: string[],\n disabledLIVendorIds: string[]\n ): Promise<boolean> =>\n RNDidomi.setUserStatusSets(\n enabledConsentPurposeIds,\n disabledConsentPurposeIds,\n enabledLIPurposeIds,\n disabledLIPurposeIds,\n enabledConsentVendorIds,\n disabledConsentVendorIds,\n enabledLIVendorIds,\n disabledLIVendorIds\n ),\n\n /**\n * Check if the consent should be collected depending on if we have any consents or if we have some consents but the number of days before displaying the notice again has not expired yet\n * @returns: A boolean depending if the consent should be collected or not\n */\n shouldConsentBeCollected: (): Promise<boolean> =>\n RNDidomi.shouldConsentBeCollected(),\n\n /**\n * Method used to update the selected language of the Didomi SDK and any property that depends on it.\n * In most cases this method doesn't need to be called. It would only be required for those apps that allow language change on-the-fly, i.e.: from within the app rather than from the device settings.\n * In order to update the language of the views displayed by the Didomi SDK, this method needs to be called before these views are displayed.\n * @param languageCode: string containing the language code e.g.: \"es\", \"fr\", etc.\n */\n updateSelectedLanguage: (languageCode: string): Promise<void> =>\n RNDidomi.updateSelectedLanguage(languageCode),\n};\n"]}
1
+ {"version":3,"sources":["Didomi.ts"],"names":["Didomi","RNDidomi","NativeModules","initialize","apiKey","localConfigurationPath","remoteConfigurationUrl","providerId","disableDidomiRemoteConfig","languageCode","noticeId","DidomiListener","init","DIDOMI_USER_AGENT_NAME","DIDOMI_VERSION","onReady","onError","setupUI","setLogLevel","level","addEventListener","eventType","callback","removeEventListener","removeAllEventListeners","reset","getDisabledPurposes","getDisabledPurposeIds","getDisabledVendors","getDisabledVendorIds","getEnabledPurposes","getEnabledPurposeIds","getEnabledVendors","getEnabledVendorIds","getJavaScriptForWebView","extra","getQueryStringForWebView","getPurpose","purposeId","getRequiredPurposes","getRequiredPurposeIds","getRequiredVendors","getRequiredVendorIds","getText","key","getTranslatedText","getUserConsentStatusForPurpose","getUserConsentStatusForVendor","vendorId","getUserConsentStatusForVendorAndRequiredPurposes","getUserLegitimateInterestStatusForPurpose","getUserLegitimateInterestForVendor","getUserLegitimateInterestStatusForVendor","getUserLegitimateInterestStatusForVendorAndRequiredPurposes","getUserStatus","getUserStatusForVendor","getVendor","hideNotice","hidePreferences","isConsentRequired","isUserConsentStatusPartial","isNoticeVisible","isPreferencesVisible","isError","isReady","setUser","organizationUserId","organizationUserIdAuthAlgorithm","organizationUserIdAuthSid","organizationUserIdAuthSalt","organizationUserIdAuthDigest","setUserWithHashAuth","algorithm","secretId","digest","salt","expiration","undefined","setUserWithHashAuthWithExpiration","setUserWithEncryptionAuth","initializationVector","setUserWithEncryptionAuthWithExpiration","showNotice","showPreferences","view","setUserAgreeToAll","setUserConsentStatus","enabledPurposeIds","disabledPurposeIds","enabledVendorIds","disabledVendorIds","setUserDisagreeToAll","setUserStatus","purposesConsentStatus","purposesLIStatus","vendorsConsentStatus","vendorsLIStatus","setUserStatusSets","enabledConsentPurposeIds","disabledConsentPurposeIds","enabledLIPurposeIds","disabledLIPurposeIds","enabledConsentVendorIds","disabledConsentVendorIds","enabledLIVendorIds","disabledLIVendorIds","shouldConsentBeCollected","updateSelectedLanguage"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAEA,MAAM;AAAEA,EAAAA,MAAM,EAAEC;AAAV,IAAuBC,0BAA7B;AAEO,MAAMF,MAAM,GAAG;AACpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEG,EAAAA,UAAU,EAAE,CACVC,MADU,EAEVC,sBAFU,EAGVC,sBAHU,EAIVC,UAJU,EAKVC,yBAAkC,GAAG,KAL3B,EAMVC,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AAA,oBAAoB,EAAE,CACpBC,iBADoB,EAEpBC,kBAFoB,EAGpBC,gBAHoB,EAIpBC,iBAJoB,KAMpBzF,QAAQ,CAACqF,oBAAT,CACEC,iBADF,EAEEC,kBAFF,EAGEC,gBAHF,EAIEC,iBAJF,CAlekB;;AAyepB;AACF;AACA;AACA;AACEC,EAAAA,oBAAoB,EAAE,MAAwB1F,QAAQ,CAAC0F,oBAAT,EA7e1B;;AA+epB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,aAAa,EAAE,CACbC,qBADa,EAEbC,gBAFa,EAGbC,oBAHa,EAIbC,eAJa,KAMb/F,QAAQ,CAAC2F,aAAT,CACEC,qBADF,EAEEC,gBAFF,EAGEC,oBAHF,EAIEC,eAJF,CA7fkB;;AAogBpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,iBAAiB,EAAE,CACjBC,wBADiB,EAEjBC,yBAFiB,EAGjBC,mBAHiB,EAIjBC,oBAJiB,EAKjBC,uBALiB,EAMjBC,wBANiB,EAOjBC,kBAPiB,EAQjBC,mBARiB,KAUjBxG,QAAQ,CAACgG,iBAAT,CACEC,wBADF,EAEEC,yBAFF,EAGEC,mBAHF,EAIEC,oBAJF,EAKEC,uBALF,EAMEC,wBANF,EAOEC,kBAPF,EAQEC,mBARF,CAzhBkB;;AAoiBpB;AACF;AACA;AACA;AACEC,EAAAA,wBAAwB,EAAE,MACxBzG,QAAQ,CAACyG,wBAAT,EAziBkB;;AA2iBpB;AACF;AACA;AACA;AACA;AACA;AACEC,EAAAA,sBAAsB,EAAGlG,YAAD,IACtBR,QAAQ,CAAC0G,sBAAT,CAAgClG,YAAhC;AAljBkB,CAAf","sourcesContent":["import { NativeModules } from 'react-native';\nimport { DidomiListener } from './DidomiListener';\nimport { DidomiEventType } from './DidomiTypes';\nimport { DIDOMI_USER_AGENT_NAME, DIDOMI_VERSION } from './Constants';\n\nconst { Didomi: RNDidomi } = NativeModules;\n\nexport const Didomi = {\n /**\n * Initialize the Didomi SDK\n *\n * @param apiKey: Public API key of the organization from the Didomi Console.\n * @param localConfigurationPath: Path to your local config file. Defaults to didomi_config.json if null.\n * @param remoteConfigurationURL: URL to a remote configuration file to load during initialization. This parameter is not used yet. Set it to null for now.\n * @param providerId: Your provider ID (if any).\n * @param disableDidomiRemoteConfig: Whether to disable loading the remove configuration from the Didomi config. Keep this to \"false\" for loading configuration from the Didomi Console.\n * @param languageCode: Language in which the consent UI should be displayed. By default, the consent UI is displayed in the language configured in the device settings. This property allows you to override the default setting and specify a language to display the UI in. String containing the language code e.g.: \"es\", \"fr\", etc.\n * @param noticeId: Notice id for the remote configuration.\n */\n initialize: (\n apiKey: string,\n localConfigurationPath?: string,\n remoteConfigurationUrl?: string,\n providerId?: string,\n disableDidomiRemoteConfig: boolean = false,\n languageCode?: string,\n noticeId?: string\n ) => {\n // Init listener\n DidomiListener.init();\n\n // Trigger native SDK init\n RNDidomi.initialize(\n DIDOMI_USER_AGENT_NAME,\n DIDOMI_VERSION,\n apiKey,\n localConfigurationPath,\n remoteConfigurationUrl,\n providerId,\n disableDidomiRemoteConfig,\n languageCode,\n noticeId\n );\n },\n\n /**\n * Listen to SDK ready state\n */\n onReady: (): Promise<void> => DidomiListener.onReady(),\n\n /**\n * Listen to SDK errors\n */\n onError: (): Promise<any> => DidomiListener.onError(),\n\n /**\n * Provide the objects required to display UI elements\n */\n setupUI: (): Promise<void> => RNDidomi.setupUI(),\n\n /**\n * Set the minimum level of messages to log\n * You can decide what level of messages should be logged by the SDK by calling the setLogLevel function before initialize\n *\n * Messages with a level below `minLevel` will not be logged.\n *\n * For iOS:\n * Levels are standard levels from `OSLogType` (https://developer.apple.com/documentation/os/logging/choosing_the_log_level_for_a_message):\n * - OSLogType.info (1)\n * - OSLogType.debug (2)\n * - OSLogType.error (16)\n * - OSLogType.fault (17)\n *\n * We recommend setting `OSLogType.error` (16) in production\n *\n * For Android:\n * Use the standard log levels supported by android.util.Log: VERBOSE, DEBUG, INFO, WARN and ERROR.\n * (https://developer.android.com/reference/android/util/Log#constants_1)\n *\n * We recommend setting `Log.INFO` (4) in production\n *\n * @param minLevel: Minimum level of messages to log\n */\n setLogLevel: (level: number): Promise<number> => RNDidomi.setLogLevel(level),\n\n /**\n * Add an event listener\n * @param listener:\n */\n addEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => DidomiListener.addEventListener(eventType, callback),\n\n /**\n * Remove an event listener\n * @param listener:\n */\n removeEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => DidomiListener.removeEventListener(eventType, callback),\n\n /**\n * Remove all event listeners\n */\n removeAllEventListeners: () => DidomiListener.reset(),\n\n /**\n * Method used to get an array of disabled purposes.\n * @returns: array of disabled purposes.\n */\n getDisabledPurposes: (): Promise<any[]> => RNDidomi.getDisabledPurposes(),\n\n /**\n * Method used to get a set of disabled purpose IDs.\n * @returns: set that contains the IDs of disabled purposes.\n */\n getDisabledPurposeIds: (): Promise<any[]> => RNDidomi.getDisabledPurposeIds(),\n\n /**\n * Method used to get an array of disabled vendors.\n * @returns: array of disabled vendors.\n */\n getDisabledVendors: (): Promise<any[]> => RNDidomi.getDisabledVendors(),\n\n /**\n * Method used to get a set of disabled vendor IDs.\n * @returns: set that contains the IDs of disabled vendors.\n */\n getDisabledVendorIds: (): Promise<any[]> => RNDidomi.getDisabledVendorIds(),\n\n /**\n * Method used to get an array of enabled purposes.\n * @returns: array of enabled purposes.\n */\n getEnabledPurposes: (): Promise<any[]> => RNDidomi.getEnabledPurposes(),\n\n /**\n * Method used to get a set of enabled purpose IDs.\n * @returns: set that contains the IDs of enabled purposes.\n */\n getEnabledPurposeIds: (): Promise<any[]> => RNDidomi.getEnabledPurposeIds(),\n\n /**\n * Method used to get an array of enabled vendors.\n * @returns: array of enabled vendors.\n */\n getEnabledVendors: (): Promise<any[]> => RNDidomi.getEnabledVendors(),\n\n /**\n * Method used to get a set of enabled vendor IDs.\n * @returns: set that contains the IDs of enabled vendors.\n */\n getEnabledVendorIds: (): Promise<any[]> => RNDidomi.getEnabledVendorIds(),\n\n /**\n * Get JavaScript to embed into a WebView to pass the consent status from the app\n * to the Didomi Web SDK embedded into the WebView\n * Inject the returned JavaScript into a WebView\n * @param extra: Extra JavaScript to inject in the returned code\n * @returns: JavaScript code to inject in a WebView\n */\n getJavaScriptForWebView: (extra?: string | null): Promise<string> => RNDidomi.getJavaScriptForWebView(extra),\n\n getQueryStringForWebView: (): Promise<string> => RNDidomi.getQueryStringForWebView(),\n\n /**\n * Method used to get a Purpose based on its ID.\n * @param purposeId: purpose ID used in the search.\n * @returns: purpose found in the array.\n */\n getPurpose: (purposeId: string): Promise<any> => RNDidomi.getPurpose(purposeId),\n\n /**\n * Method used to get an array of required purposes.\n *\n * @returns: array of required purposes.\n */\n getRequiredPurposes: (): Promise<any[]> => RNDidomi.getRequiredPurposes(),\n\n /**\n * Get the configured purpose IDs\n * @returns: set of purpose IDs.\n */\n getRequiredPurposeIds: (): Promise<any[]> => RNDidomi.getRequiredPurposeIds(),\n\n /**\n * Method used to get an array of required vendors.\n * @returns: array of required vendors.\n */\n getRequiredVendors: (): Promise<any[]> => RNDidomi.getRequiredVendors(),\n\n /**\n * Get the configured vendor IDs\n * @returns: set of vendor IDs.\n */\n getRequiredVendorIds: (): Promise<any[]> => RNDidomi.getRequiredVendorIds(),\n\n /**\n * Method used to get a dictionary/map in the form of { \"en\": \"Key in English\", \"fr\": \"Key in French.\" }\n * for a given key.\n * @param key: used to find its corresponding value in the dictionary/map.\n * @returns: dictionary containing the different translations for a given key.\n */\n getText: (key: string): Promise<any[]> => RNDidomi.getText(key),\n\n /**\n * Method used to get a translated text based on the key being passed.\n * The language and the source of this translated text will depend on the availability of the translation for the specific key.\n * The language being used will be either the selected language of the SDK (based on device Locale and other parameters) or the language specified by app developers as the default language being used by the SDK. The source can be either the `didomi_config.json` file which can be either local or remote, or the `didomi_master_config.json` file which is bundled within the SDK.\n *\n * These are the attempts performed by the SDK to try to find a translation for the specific key:\n * - Get translated value in user locale (selected language) from `didomi_config.json` (either local or remote).\n * - Get translated value in default locale (from the config) from `didomi_config.json` (either local or remote).\n * - Get translated value in user locale (selected language) from `didomi_master_config.json` (bundled within the Didomi SDK).\n * - Get translated value in default locale (from the config) from `didomi_master_config.json` (bundled within the Didomi SDK).\n *\n * If no translation can be found after these 4 attempts, the key will be returned.\n *\n * App developers can provide these translated texts through the `didomi_config.json` file (locally or remotely) in 3 different ways:\n * - Custom texts for the consent notice: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-notice#texts\n * - Custom texts for the preferences: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-preferences-popup#text\n * - Custom texts for custom notices: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-theme#translatable-texts-for-custom-notices\n *\n * @param key: used to find its corresponding value in one of the different sources.\n * @returns: a translated string if a translation was found, the same key that was passed otherwise.\n */\n getTranslatedText: (key: string): Promise<string> => RNDidomi.getTranslatedText(key),\n\n /**\n * Get the user consent status for a specific purpose\n * @param purposeId: The purpose ID to check consent for\n * @returns: The user consent status for the specified purpose\n * @deprecated use {@link #getUserStatus()} instead. Search the purposeId in\n * getUserStatus().getPurposes().getConsent().getEnabled() or\n * getUserStatus().getPurposes().getConsent().getDisabled().\n */\n getUserConsentStatusForPurpose: (purposeId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForPurpose(purposeId),\n\n /**\n * Get the user consent status for a specific vendor\n * @param vendorId: The vendor ID to check consent for\n * @returns: The user consent status for the specified vendor\n * @deprecated use {@link #getUserStatus()} instead. Search the vendorId in\n * getUserStatus().getVendors().getConsent().getEnabled() or\n * getUserStatus().getVendors().getConsent().getDisabled().\n */\n getUserConsentStatusForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForVendor(vendorId),\n\n /**\n * Get the user consent status for a specific vendor and all its purposes\n * @param vendorId: The ID of the vendor\n * @returns: The user consent status corresponding to the specified vendor and all its required purposes.\n * @deprecated use {@link #getUserStatus()} instead. The result of this method has been replaced\n * by getUserStatus().getVendors().getGlobalConsent().getEnabled() or\n * getUserStatus().getVendors().getGlobalConsent().getDisabled().\n */\n getUserConsentStatusForVendorAndRequiredPurposes: (vendorId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForVendorAndRequiredPurposes(vendorId),\n\n /**\n * Get the user legitimate interest status for a specific purpose.\n * @param purposeId: purpose ID.\n * @returns: LI status of a purpose.\n * @deprecated use {@link #getUserStatus()} instead. Search the purposeId in\n * getUserStatus().getPurposes().getLegitimateInterest().getEnabled() or\n * getUserStatus().getPurposes().getLegitimateInterest().getDisabled().\n */\n getUserLegitimateInterestStatusForPurpose: (purposeId: string): Promise<boolean> => RNDidomi.getUserLegitimateInterestStatusForPurpose(purposeId),\n\n /**\n * Get the user legitimate interest status for a specific vendor.\n * @param vendorId: vendor ID.\n * @returns: LI status of a vendor.\n * @deprecated use {@link #getUserStatus()} instead. Search the vendorId in\n * getUserStatus().getVendors().getLegitimateInterest().getEnabled() or\n * getUserStatus().getVendors().getLegitimateInterest().getDisabled().\n */\n getUserLegitimateInterestForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserLegitimateInterestStatusForVendor(vendorId),\n\n /**\n * Get the user LI status for a specific vendor and all its purposes.\n * @param vendorId: vendor ID.\n * @returns: The user LI status corresponding to the specified vendor and all its required purposes.\n * @deprecated use {@link #getUserStatus()} instead. Search the purposeId in\n * getUserStatus().getVendors().getGlobalLegitimateInterest().getEnabled() or\n * getUserStatus().getVendors().getGlobalLegitimateInterest().getDisabled().\n */\n getUserLegitimateInterestStatusForVendorAndRequiredPurposes: (vendorId: string): boolean => RNDidomi.getUserLegitimateInterestStatusForVendorAndRequiredPurposes(vendorId),\n\n /**\n * Get the user consent status.\n * @returns: status that represents user consent.\n */\n getUserStatus: (): Promise<any> => RNDidomi.getUserStatus(),\n\n /**\n * Get the user consent and legitimate interest status for a specific vendor.\n * @param vendorId: vendor ID.\n * @returns: status that represents both consent and legitimate interest status of a vendor.\n * @deprecated use {@link #getUserStatus()} instead. Search the vendorId in\n * getUserStatus().getVendors().getGlobal().getEnabled() or\n * getUserStatus().getVendors().getGlobal().getDisabled().\n */\n getUserStatusForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserStatusForVendor(vendorId),\n\n /**\n * Method used to get a Vendor based on its ID.\n * @param vendorId: vendor ID used in the search.\n * @returns: vendor found in the array.\n */\n getVendor: (vendorId: string): Promise<any> => RNDidomi.getVendor(vendorId),\n\n /**\n * Hide the notice if it is currently displayed\n */\n hideNotice: (): Promise<void> => RNDidomi.hideNotice(),\n\n /**\n * Hide the preferences popup for purposes\n */\n hidePreferences: (): Promise<void> => RNDidomi.hidePreferences(),\n\n /**\n * Determine if consent is required for the user. The rules are (OR):\n * - The user country is in the EU.\n * - The company is from the EU.\n * - The user country is unknown and the app has chosen to collect consent when unknown.\n * @returns: **true** if consent is required, **false** if it is not required.\n */\n isConsentRequired: (): Promise<boolean> => RNDidomi.isConsentRequired(),\n\n /**\n * Determine if consent information is available for all purposes and vendors that are required\n * @returns: **true** if consent is required and consent information is available, **false** otherwise.\n */\n isUserConsentStatusPartial: (): Promise<boolean> => RNDidomi.isUserConsentStatusPartial(),\n\n /**\n * Check if the consent notice is currently displayed\n * @returns: **true** if the notice is displayed, **false** if is not.\n */\n isNoticeVisible: (): Promise<boolean> => RNDidomi.isNoticeVisible(),\n\n /**\n * Method used to check if the Preferences view is visible.\n * @returns: **true** if Preferences view is visible, **false** otherwise.\n */\n isPreferencesVisible: (): Promise<boolean> => RNDidomi.isPreferencesVisible(),\n\n isError: (): Promise<boolean> => RNDidomi.isError(),\n\n /**\n * Is the Didomi SDK ready?\n */\n isReady: (): Promise<boolean> => RNDidomi.isReady(),\n\n /**\n * Set user information without authentication\n *\n * @param id Organization user ID\n * @param algorithm Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.\n * @param secretId Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.\n * @param salt Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.\n * @param digest Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.\n */\n setUser: (\n organizationUserId: string,\n organizationUserIdAuthAlgorithm?: string,\n organizationUserIdAuthSid?: string,\n organizationUserIdAuthSalt?: string,\n organizationUserIdAuthDigest?: string\n ): Promise<void> =>\n RNDidomi.setUser(\n organizationUserId,\n organizationUserIdAuthAlgorithm,\n organizationUserIdAuthSid,\n organizationUserIdAuthSalt,\n organizationUserIdAuthDigest\n ),\n\n /**\n * Set user information with Hash authentication\n *\n * @param id Organization user ID\n * @param algorithm Algorithm used for computing the digest\n * @param secretId ID of the secret used for computing the digest\n * @param digest Digest of the organization user ID and secret\n * @param salt Salt used for computing the digest (optional)\n * @param expiration Expiration date as timestamp (to prevent replay attacks)\n */\n setUserWithHashAuth: (\n organizationUserId: string,\n algorithm: string,\n secretId: string,\n digest: string,\n salt?: string,\n expiration?: BigInt\n ): void => {\n if (expiration === undefined) {\n RNDidomi.setUserWithHashAuth(\n organizationUserId,\n algorithm,\n secretId,\n digest,\n salt\n );\n } else {\n RNDidomi.setUserWithHashAuthWithExpiration(\n organizationUserId,\n algorithm,\n secretId,\n digest,\n salt,\n expiration\n );\n }\n },\n\n /**\n * Set user information with Encryption authentication\n *\n * @param id Organization user ID\n * @param algorithm Algorithm used for computing the digest\n * @param secretId ID of the secret used for computing the digest\n * @param initializationVector Initialization Vector used for computing the user ID\n * @param expiration Expiration date as timestamp (to prevent replay attacks)\n */\n setUserWithEncryptionAuth: (\n organizationUserId: string,\n algorithm: string,\n secretId: string,\n initializationVector: string,\n expiration?: BigInt\n ): void => {\n if (expiration === undefined) {\n RNDidomi.setUserWithEncryptionAuth(\n organizationUserId,\n algorithm,\n secretId,\n initializationVector\n );\n } else {\n RNDidomi.setUserWithEncryptionAuthWithExpiration(\n organizationUserId,\n algorithm,\n secretId,\n initializationVector,\n expiration\n );\n }\n },\n\n /**\n * Show the consent notice (if required, not disabled in the config and not already displayed)\n */\n showNotice: (): Promise<void> => RNDidomi.showNotice(),\n\n /**\n * Show the preferences screen when/if the SDK is ready. By default the purposes list will be displayed.\n * @param view: It can be `purposes` or `vendors`\n */\n showPreferences: (view?: string): Promise<void> => RNDidomi.showPreferences(view),\n\n /**\n * Remove all consents for the user\n */\n reset: (): Promise<void> => RNDidomi.reset(),\n\n /**\n * Method that allows to enable consent and legitimate interest for all the required purposes.\n * @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserAgreeToAll: (): Promise<boolean> => RNDidomi.setUserAgreeToAll(),\n\n /**\n * Set the user consent status.\n * @param enabledPurposeIds: set containing **enabled purpose ids**\n * @param disabledPurposeIds: set containing **disabled purpose ids**\n * @param enabledVendorIds: set containing **enabled vendor ids**\n * @param disabledVendorIds: set containing **disabled purpose ids**\n * @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserConsentStatus: (\n enabledPurposeIds: string[],\n disabledPurposeIds: string[],\n enabledVendorIds: string[],\n disabledVendorIds: string[]\n ): Promise<boolean> =>\n RNDidomi.setUserConsentStatus(\n enabledPurposeIds,\n disabledPurposeIds,\n enabledVendorIds,\n disabledVendorIds\n ),\n\n /**\n * Method that allows to disable consent and legitimate interest for all the required purposes and vendors.\n * @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserDisagreeToAll: (): Promise<boolean> => RNDidomi.setUserDisagreeToAll(),\n\n /**\n * Set the user status for purposes and vendors for consent and legitimate interest.\n * @param purposesConsentStatus: boolean used to determine if consent will be enabled or disabled for all purposes.\n * @param purposesLIStatus: boolean used to determine if legitimate interest will be enabled or disabled for all purposes.\n * @param vendorsConsentStatus: boolean used to determine if consent will be enabled or disabled for all vendors.\n * @param vendorsLIStatus: boolean used to determine if legitimate interest will be enabled or disabled for all vendors.\n * @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserStatus: (\n purposesConsentStatus: boolean,\n purposesLIStatus: boolean,\n vendorsConsentStatus: boolean,\n vendorsLIStatus: boolean\n ): Promise<boolean> =>\n RNDidomi.setUserStatus(\n purposesConsentStatus,\n purposesLIStatus,\n vendorsConsentStatus,\n vendorsLIStatus\n ),\n\n /**\n * Set the user status for purposes and vendors for consent and legitimate interest.\n * @param enabledConsentPurposeIds: List of purpose IDs to enable for consent.\n * @param disabledConsentPurposeIds: List of purpose IDs to disable for consent.\n * @param enabledLIPurposeIds: List of purpose IDs to enable for LI.\n * @param disabledLIPurposeIds: List of purpose IDs to disable for LI.\n * @param enabledConsentVendorIds: List of vendor IDs to enable for consent.\n * @param disabledConsentVendorIds: List of vendor IDs to disable for consent.\n * @param enabledLIVendorIds: List of vendor IDs to enable for LI.\n * @param disabledLIVendorIds: List of vendor IDs to disable for LI.\n */\n setUserStatusSets: (\n enabledConsentPurposeIds: string[],\n disabledConsentPurposeIds: string[],\n enabledLIPurposeIds: string[],\n disabledLIPurposeIds: string[],\n enabledConsentVendorIds: string[],\n disabledConsentVendorIds: string[],\n enabledLIVendorIds: string[],\n disabledLIVendorIds: string[]\n ): Promise<boolean> =>\n RNDidomi.setUserStatusSets(\n enabledConsentPurposeIds,\n disabledConsentPurposeIds,\n enabledLIPurposeIds,\n disabledLIPurposeIds,\n enabledConsentVendorIds,\n disabledConsentVendorIds,\n enabledLIVendorIds,\n disabledLIVendorIds\n ),\n\n /**\n * Check if the consent should be collected depending on if we have any consents or if we have some consents but the number of days before displaying the notice again has not expired yet\n * @returns: A boolean depending if the consent should be collected or not\n */\n shouldConsentBeCollected: (): Promise<boolean> =>\n RNDidomi.shouldConsentBeCollected(),\n\n /**\n * Method used to update the selected language of the Didomi SDK and any property that depends on it.\n * In most cases this method doesn't need to be called. It would only be required for those apps that allow language change on-the-fly, i.e.: from within the app rather than from the device settings.\n * In order to update the language of the views displayed by the Didomi SDK, this method needs to be called before these views are displayed.\n * @param languageCode: string containing the language code e.g.: \"es\", \"fr\", etc.\n */\n updateSelectedLanguage: (languageCode: string): Promise<void> =>\n RNDidomi.updateSelectedLanguage(languageCode),\n};\n"]}
@@ -25,6 +25,8 @@ const DidomiListener = {
25
25
  init: () => {
26
26
  // Register all native event listeners
27
27
  Object.values(_DidomiTypes.DidomiEventType).forEach(eventTypeValue => {
28
+ // Remove previous listeners, as init() can be called several times in some configs
29
+ DidomiListener.eventEmitter.removeAllListeners(eventTypeValue);
28
30
  DidomiListener.eventEmitter.addListener(eventTypeValue, _event => {
29
31
  let events = DidomiListener.listeners.get(eventTypeValue);
30
32