@didomi/react-native 2.9.0 → 2.10.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.
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,mm,swift}"
17
17
 
18
18
  s.dependency "React-Core"
19
- s.dependency "Didomi-XCFramework", "2.18.0"
19
+ s.dependency "Didomi-XCFramework", "2.19.0"
20
20
  end
package/src/Constants.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  // User agent name
2
2
  export const DIDOMI_USER_AGENT_NAME = "Didomi React-Native SDK"
3
3
  // User agent version
4
- export const DIDOMI_VERSION = "2.9.0"
4
+ export const DIDOMI_VERSION = "2.10.0"
package/src/Didomi.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NativeModules } from 'react-native';
2
2
  import { DidomiListener } from './DidomiListener';
3
- import { DidomiEventType, Purpose, Vendor, UserStatus, CurrentUserStatus, VendorStatus, UserAuthParams } from './DidomiTypes';
3
+ import { DidomiEventType, Purpose, Vendor, UserStatus, CurrentUserStatus, VendorStatus, UserAuthParams, DidomiInitializeParameters, DidomiUserParameters } from './DidomiTypes';
4
4
  import { DIDOMI_USER_AGENT_NAME, DIDOMI_VERSION } from './Constants';
5
5
  import { CurrentUserStatusTransaction, createCurrentUserStatusTransaction } from './CurrentUserStatusTransaction';
6
6
 
@@ -21,6 +21,7 @@ export const Didomi = {
21
21
  * @param androidTvEnabled: Whether to allow Didomi SDK to run on Android TV, default to "false".
22
22
  * @param countryCode: Override user country code when determining the privacy regulation to apply. Keep undefined to let the Didomi SDK determine the user country.
23
23
  * @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.
24
+ * @deprecated Use {@link #initializeWithParameters} instead
24
25
  */
25
26
  initialize: (
26
27
  apiKey: string,
@@ -56,6 +57,23 @@ export const Didomi = {
56
57
  );
57
58
  },
58
59
 
60
+ /**
61
+ * Initialize the Didomi SDK with parameters
62
+ * @param parameters: Parameters to initialize the Didomi SDK
63
+ * @returns: Promise that resolves we have called the native initialize method
64
+ */
65
+ initializeWithParameters: (parameters: DidomiInitializeParameters): Promise<void> => {
66
+ // Init listener
67
+ DidomiListener.init();
68
+
69
+ // Trigger native SDK init
70
+ return RNDidomi.initializeWithParameters(
71
+ DIDOMI_USER_AGENT_NAME,
72
+ DIDOMI_VERSION,
73
+ JSON.stringify(parameters)
74
+ );
75
+ },
76
+
59
77
  /**
60
78
  * Listen to SDK ready state
61
79
  */
@@ -473,7 +491,7 @@ export const Didomi = {
473
491
  * @param digest Digest of the organization user ID and secret
474
492
  * @param salt Salt used for computing the digest (optional)
475
493
  * @param expiration Expiration date as timestamp (to prevent replay attacks)
476
- * @deprecated use {@link #setUserWithAuthParams()} instead.
494
+ * @deprecated Use {@link setUserWithParameters} instead
477
495
  */
478
496
  setUserWithHashAuth: (
479
497
  id: string,
@@ -512,7 +530,7 @@ export const Didomi = {
512
530
  * @param digest Digest of the organization user ID and secret
513
531
  * @param salt Salt used for computing the digest (optional)
514
532
  * @param expiration Expiration date as timestamp (to prevent replay attacks)
515
- * @deprecated use {@link #setUserWithAuthParamsAndSetupUI()} instead.
533
+ * @deprecated Use {@link setUserWithParametersAndSetupUI} instead
516
534
  */
517
535
  setUserWithHashAuthAndSetupUI: (
518
536
  id: string,
@@ -550,7 +568,7 @@ export const Didomi = {
550
568
  * @param secretId ID of the secret used for computing the digest
551
569
  * @param initializationVector Initialization Vector used for computing the user ID
552
570
  * @param expiration Expiration date as timestamp (to prevent replay attacks)
553
- * @deprecated use {@link #setUserWithAuthParams()} instead.
571
+ * @deprecated Use {@link setUserWithParameters} instead
554
572
  */
555
573
  setUserWithEncryptionAuth: (
556
574
  id: string,
@@ -585,7 +603,7 @@ export const Didomi = {
585
603
  * @param secretId ID of the secret used for computing the digest
586
604
  * @param initializationVector Initialization Vector used for computing the user ID
587
605
  * @param expiration Expiration date as timestamp (to prevent replay attacks)
588
- * @deprecated use {@link #setUserWithAuthParamsAndSetupUI()} instead.
606
+ * @deprecated Use {@link setUserWithParametersAndSetupUI} instead
589
607
  */
590
608
  setUserWithEncryptionAuthAndSetupUI: (
591
609
  id: string,
@@ -617,6 +635,7 @@ export const Didomi = {
617
635
  *
618
636
  * @param userAuthParams as UserAuthParams (use UserAuthWithEncryptionParams or UserAuthWithHashParams)
619
637
  * @param synchronizedUsers as UserAuthParams[] (optional)
638
+ * @deprecated Use {@link setUserWithParameters} instead
620
639
  */
621
640
  setUserWithAuthParams: (
622
641
  userAuthParams: UserAuthParams,
@@ -628,12 +647,27 @@ export const Didomi = {
628
647
  *
629
648
  * @param userAuthParams as UserAuthParams (use UserAuthWithEncryptionParams or UserAuthWithHashParams)
630
649
  * @param synchronizedUsers as UserAuthParams[] (optional)
650
+ * @deprecated Use {@link setUserWithParametersAndSetupUI} instead
631
651
  */
632
652
  setUserWithAuthParamsAndSetupUI: (
633
653
  userAuthParams: UserAuthParams,
634
654
  synchronizedUsers?: UserAuthParams[] | undefined
635
655
  ): void => RNDidomi.setUserWithAuthParamsAndSetupUI(JSON.stringify(userAuthParams), JSON.stringify(synchronizedUsers)),
636
656
 
657
+ /**
658
+ * Set user information with parameters
659
+ *
660
+ * @param parameters as DidomiUserParameters
661
+ */
662
+ setUserWithParameters: (parameters: DidomiUserParameters): void => RNDidomi.setUserWithParameters(JSON.stringify(parameters)),
663
+
664
+ /**
665
+ * Set user information with parameters and check for missing consent
666
+ *
667
+ * @param parameters as DidomiUserParameters
668
+ */
669
+ setUserWithParametersAndSetupUI: (parameters: DidomiUserParameters): void => RNDidomi.setUserWithParametersAndSetupUI(JSON.stringify(parameters)),
670
+
637
671
  /**
638
672
  * Show the consent notice (if required, not disabled in the config and not already displayed)
639
673
  */
@@ -178,8 +178,11 @@ export interface SyncReadyEvent {
178
178
  syncAcknowledged: () => Promise<boolean>;
179
179
  }
180
180
 
181
- export interface UserAuthParams {
181
+ export interface UserAuth {
182
182
  id: string;
183
+ }
184
+
185
+ export interface UserAuthParams extends UserAuth {
183
186
  algorithm: string;
184
187
  secretId: string;
185
188
  expiration?: number;
@@ -193,3 +196,120 @@ export interface UserAuthWithHashParams extends UserAuthParams {
193
196
  digest: string;
194
197
  salt?: string;
195
198
  }
199
+
200
+ /**
201
+ * Initialization parameters for Didomi SDK
202
+ * @interface
203
+ */
204
+ export interface DidomiInitializeParameters {
205
+ /**
206
+ * Public API key of the organization from the Didomi Console.
207
+ * @property
208
+ */
209
+ apiKey: string;
210
+ /**
211
+ * Path to your local config file. Defaults to didomi_config.json if nil.
212
+ * @property
213
+ */
214
+ localConfigurationPath?: string;
215
+ /**
216
+ * URL to a remote configuration file to load during initialization. This parameter is not used yet. Set it to nil for now.
217
+ * @property
218
+ */
219
+ remoteConfigurationUrl?: string;
220
+ /**
221
+ * The provider ID (if any).
222
+ * @property
223
+ */
224
+ providerId?: string;
225
+ /**
226
+ * Whether to disable loading the remove configuration from the Didomi config. Keep this to `false` for loading configuration from the Didomi Console.
227
+ * @property
228
+ * @deprecated In the future, it will be mandatory to create your notice from the console (see https://developers.didomi.io/cmp/mobile-sdk/android/setup#from-the-console-recommended for more information).
229
+ */
230
+ disableDidomiRemoteConfig?: boolean;
231
+ /**
232
+ * Language in which the consent UI should be displayed. By default, the consent UI is displayed in the language configured in the device settings.
233
+ * 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.
234
+ * @property
235
+ */
236
+ languageCode?: string;
237
+ /**
238
+ * ID of the notice configuration to load from the Didomi Console.
239
+ * @property
240
+ */
241
+ noticeId?: string;
242
+ /**
243
+ * ID of the notice to display on Android TV
244
+ * @property
245
+ */
246
+ androidTvNoticeId?: string;
247
+ /**
248
+ * Enable/disable Android TV specific features
249
+ * @property
250
+ */
251
+ androidTvEnabled?: boolean;
252
+ /**
253
+ * Override user country code when determining the privacy regulation to apply.
254
+ * Keep `undefined` to let the Didomi SDK determine the user country.
255
+ * @property
256
+ */
257
+ countryCode?: string;
258
+ /**
259
+ * Override user region code when determining the privacy regulation to apply.
260
+ * Keep `undefined` to let the Didomi SDK determine the user region.
261
+ * Ignored if `countryCode` is not set.
262
+ * @property
263
+ */
264
+ regionCode?: string;
265
+ /**
266
+ * If set to `true`, the SDK will only display the underage notice (`false` by default).
267
+ * @property
268
+ */
269
+ isUnderage?: boolean;
270
+ }
271
+
272
+ /**
273
+ * Object that contains the parameters for the setUser method.
274
+ * @interface
275
+ */
276
+ export interface DidomiUserParameters {
277
+ /**
278
+ * @property
279
+ */
280
+ userId?: string;
281
+ /**
282
+ * Main user authentication
283
+ * - [UserAuthWithEncryptionParams] (encryption)
284
+ * - [UserAuthWithHashParams] (hash)
285
+ * - [UserAuthWithoutParams] (ID only)
286
+ * @property
287
+ */
288
+ userAuth?: UserAuth;
289
+ /**
290
+ * User authentication for Didomi Consent String
291
+ * - [UserAuthWithEncryptionParams] (encryption)
292
+ * - [UserAuthWithHashParams] (hash)
293
+ * @property
294
+ */
295
+ dcsUserAuth?: UserAuthParams;
296
+ /**
297
+ * If the user is underage (undefined will keep the previous setting)
298
+ * @property
299
+ */
300
+ isUnderage?: boolean;
301
+ }
302
+
303
+ /**
304
+ * Object that contains the parameters for the setUser method including synchronized users.
305
+ * @interface
306
+ */
307
+ export interface DidomiMultiUserParameters extends DidomiUserParameters {
308
+ /**
309
+ * Synchronized user list
310
+ * - [UserAuthWithEncryptionParams] (encryption)
311
+ * - [UserAuthWithHashParams] (hash)
312
+ * @property
313
+ */
314
+ synchronizedUsers?: UserAuthParams[];
315
+ }
package/src/index.tsx CHANGED
@@ -12,5 +12,6 @@ export {
12
12
  PurposeStatus,
13
13
  VendorStatus,
14
14
  UserAuthWithEncryptionParams,
15
- UserAuthWithHashParams
15
+ UserAuthWithHashParams,
16
+ DidomiInitializeParameters
16
17
  } from './DidomiTypes';