@didomi/react-native 1.5.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativedidomi/DidomiModule.kt +205 -13
- package/android/src/main/java/com/reactnativedidomi/EventTypes.kt +5 -2
- package/ios/Didomi.m +98 -17
- package/ios/RNDidomi.swift +321 -131
- package/lib/commonjs/Constants.js +1 -1
- package/lib/commonjs/Constants.js.map +1 -1
- package/lib/commonjs/Didomi.js +102 -4
- package/lib/commonjs/Didomi.js.map +1 -1
- package/lib/commonjs/DidomiListener.js +2 -0
- package/lib/commonjs/DidomiListener.js.map +1 -1
- package/lib/commonjs/DidomiTypes.js +3 -0
- package/lib/commonjs/DidomiTypes.js.map +1 -1
- package/lib/module/Constants.js +1 -1
- package/lib/module/Constants.js.map +1 -1
- package/lib/module/Didomi.js +102 -4
- package/lib/module/Didomi.js.map +1 -1
- package/lib/module/DidomiListener.js +2 -0
- package/lib/module/DidomiListener.js.map +1 -1
- package/lib/module/DidomiTypes.js +3 -0
- package/lib/module/DidomiTypes.js.map +1 -1
- package/lib/typescript/Constants.d.ts +1 -1
- package/lib/typescript/Didomi.d.ts +72 -4
- package/lib/typescript/DidomiTypes.d.ts +6 -2
- package/package.json +1 -4
- package/react-native-didomi.podspec +1 -1
- package/src/Constants.ts +1 -1
- package/src/Didomi.ts +190 -18
- package/src/DidomiListener.ts +2 -0
- package/src/DidomiTypes.ts +5 -1
package/src/Didomi.ts
CHANGED
|
@@ -25,12 +25,12 @@ export const Didomi = {
|
|
|
25
25
|
disableDidomiRemoteConfig: boolean = false,
|
|
26
26
|
languageCode?: string,
|
|
27
27
|
noticeId?: string
|
|
28
|
-
) => {
|
|
28
|
+
): Promise<void> => {
|
|
29
29
|
// Init listener
|
|
30
30
|
DidomiListener.init();
|
|
31
31
|
|
|
32
32
|
// Trigger native SDK init
|
|
33
|
-
RNDidomi.initialize(
|
|
33
|
+
return RNDidomi.initialize(
|
|
34
34
|
DIDOMI_USER_AGENT_NAME,
|
|
35
35
|
DIDOMI_VERSION,
|
|
36
36
|
apiKey,
|
|
@@ -81,7 +81,7 @@ export const Didomi = {
|
|
|
81
81
|
*
|
|
82
82
|
* @param minLevel: Minimum level of messages to log
|
|
83
83
|
*/
|
|
84
|
-
setLogLevel: (level: number): Promise<
|
|
84
|
+
setLogLevel: (level: number): Promise<void> => RNDidomi.setLogLevel(level),
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* Add an event listener
|
|
@@ -109,48 +109,64 @@ export const Didomi = {
|
|
|
109
109
|
/**
|
|
110
110
|
* Method used to get an array of disabled purposes.
|
|
111
111
|
* @returns: array of disabled purposes.
|
|
112
|
+
* @deprecated use {@link #getUserStatus()} instead. The result of this method
|
|
113
|
+
* has been replaced by getUserStatus().getPurposes().getConsent().getDisabled().
|
|
112
114
|
*/
|
|
113
115
|
getDisabledPurposes: (): Promise<any[]> => RNDidomi.getDisabledPurposes(),
|
|
114
116
|
|
|
115
117
|
/**
|
|
116
118
|
* Method used to get a set of disabled purpose IDs.
|
|
117
119
|
* @returns: set that contains the IDs of disabled purposes.
|
|
120
|
+
* @deprecated use {@link #getUserStatus()} instead. The result of this method
|
|
121
|
+
* has been replaced by getUserStatus().getPurposes().getConsent().getDisabled().
|
|
118
122
|
*/
|
|
119
123
|
getDisabledPurposeIds: (): Promise<any[]> => RNDidomi.getDisabledPurposeIds(),
|
|
120
124
|
|
|
121
125
|
/**
|
|
122
126
|
* Method used to get an array of disabled vendors.
|
|
123
127
|
* @returns: array of disabled vendors.
|
|
128
|
+
* @deprecated use {@link #getUserStatus()} instead. The result of this method
|
|
129
|
+
* has been replaced by getUserStatus().getVendors().getConsent().getDisabled().
|
|
124
130
|
*/
|
|
125
131
|
getDisabledVendors: (): Promise<any[]> => RNDidomi.getDisabledVendors(),
|
|
126
132
|
|
|
127
133
|
/**
|
|
128
134
|
* Method used to get a set of disabled vendor IDs.
|
|
129
135
|
* @returns: set that contains the IDs of disabled vendors.
|
|
136
|
+
* @deprecated use {@link #getUserStatus()} instead. The result of this method
|
|
137
|
+
* has been replaced by getUserStatus().getVendors().getConsent().getDisabled().
|
|
130
138
|
*/
|
|
131
139
|
getDisabledVendorIds: (): Promise<any[]> => RNDidomi.getDisabledVendorIds(),
|
|
132
140
|
|
|
133
141
|
/**
|
|
134
142
|
* Method used to get an array of enabled purposes.
|
|
135
143
|
* @returns: array of enabled purposes.
|
|
144
|
+
* @deprecated use {@link #getUserStatus()} instead. The result of this method
|
|
145
|
+
* has been replaced by getUserStatus().getPurposes().getConsent().getEnabled().
|
|
136
146
|
*/
|
|
137
147
|
getEnabledPurposes: (): Promise<any[]> => RNDidomi.getEnabledPurposes(),
|
|
138
148
|
|
|
139
149
|
/**
|
|
140
150
|
* Method used to get a set of enabled purpose IDs.
|
|
141
151
|
* @returns: set that contains the IDs of enabled purposes.
|
|
152
|
+
* @deprecated use {@link #getUserStatus()} instead. The result of this method
|
|
153
|
+
* has been replaced by getUserStatus().getPurposes().getConsent().getEnabled().
|
|
142
154
|
*/
|
|
143
155
|
getEnabledPurposeIds: (): Promise<any[]> => RNDidomi.getEnabledPurposeIds(),
|
|
144
156
|
|
|
145
157
|
/**
|
|
146
158
|
* Method used to get an array of enabled vendors.
|
|
147
159
|
* @returns: array of enabled vendors.
|
|
160
|
+
* @deprecated use {@link #getUserStatus()} instead. The result of this method
|
|
161
|
+
* has been replaced by getUserStatus().getVendors().getConsent().getEnabled().
|
|
148
162
|
*/
|
|
149
163
|
getEnabledVendors: (): Promise<any[]> => RNDidomi.getEnabledVendors(),
|
|
150
164
|
|
|
151
165
|
/**
|
|
152
166
|
* Method used to get a set of enabled vendor IDs.
|
|
153
167
|
* @returns: set that contains the IDs of enabled vendors.
|
|
168
|
+
* @deprecated use {@link #getUserStatus()} instead. The result of this method
|
|
169
|
+
* has been replaced by getUserStatus().getVendors().getConsent().getEnabled().
|
|
154
170
|
*/
|
|
155
171
|
getEnabledVendorIds: (): Promise<any[]> => RNDidomi.getEnabledVendorIds(),
|
|
156
172
|
|
|
@@ -356,29 +372,185 @@ export const Didomi = {
|
|
|
356
372
|
isReady: (): Promise<boolean> => RNDidomi.isReady(),
|
|
357
373
|
|
|
358
374
|
/**
|
|
359
|
-
*
|
|
375
|
+
* Clear user information
|
|
376
|
+
*/
|
|
377
|
+
clearUser: (): Promise<void> => RNDidomi.clearUser(),
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Set user information without authentication
|
|
360
381
|
*
|
|
361
382
|
* @param id Organization user ID
|
|
362
|
-
* @param algorithm
|
|
363
|
-
* @param secretId
|
|
364
|
-
* @param salt
|
|
365
|
-
* @param digest
|
|
383
|
+
* @param algorithm Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
384
|
+
* @param secretId Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
385
|
+
* @param salt Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
386
|
+
* @param digest Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
366
387
|
*/
|
|
367
388
|
setUser: (
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
389
|
+
id: string,
|
|
390
|
+
algorithm?: string,
|
|
391
|
+
secretId?: string,
|
|
392
|
+
salt?: string,
|
|
393
|
+
digest?: string
|
|
373
394
|
): Promise<void> =>
|
|
374
395
|
RNDidomi.setUser(
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
396
|
+
id,
|
|
397
|
+
algorithm,
|
|
398
|
+
secretId,
|
|
399
|
+
salt,
|
|
400
|
+
digest
|
|
380
401
|
),
|
|
381
402
|
|
|
403
|
+
/**
|
|
404
|
+
* Set user information without authentication and check for missing consent
|
|
405
|
+
*
|
|
406
|
+
* @param id Organization user ID
|
|
407
|
+
*/
|
|
408
|
+
setUserAndSetupUI: (id: string): Promise<void> => RNDidomi.setUserAndSetupUI(id),
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Set user information with Hash authentication
|
|
412
|
+
*
|
|
413
|
+
* @param id Organization user ID
|
|
414
|
+
* @param algorithm Algorithm used for computing the digest
|
|
415
|
+
* @param secretId ID of the secret used for computing the digest
|
|
416
|
+
* @param digest Digest of the organization user ID and secret
|
|
417
|
+
* @param salt Salt used for computing the digest (optional)
|
|
418
|
+
* @param expiration Expiration date as timestamp (to prevent replay attacks)
|
|
419
|
+
*/
|
|
420
|
+
setUserWithHashAuth: (
|
|
421
|
+
id: string,
|
|
422
|
+
algorithm: string,
|
|
423
|
+
secretId: string,
|
|
424
|
+
digest: string,
|
|
425
|
+
salt?: string,
|
|
426
|
+
expiration?: BigInt
|
|
427
|
+
): void => {
|
|
428
|
+
if (expiration === undefined) {
|
|
429
|
+
RNDidomi.setUserWithHashAuth(
|
|
430
|
+
id,
|
|
431
|
+
algorithm,
|
|
432
|
+
secretId,
|
|
433
|
+
digest,
|
|
434
|
+
salt
|
|
435
|
+
);
|
|
436
|
+
} else {
|
|
437
|
+
RNDidomi.setUserWithHashAuthWithExpiration(
|
|
438
|
+
id,
|
|
439
|
+
algorithm,
|
|
440
|
+
secretId,
|
|
441
|
+
digest,
|
|
442
|
+
salt,
|
|
443
|
+
expiration
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Set user information with Hash authentication and check for missing consent
|
|
450
|
+
*
|
|
451
|
+
* @param id Organization user ID
|
|
452
|
+
* @param algorithm Algorithm used for computing the digest
|
|
453
|
+
* @param secretId ID of the secret used for computing the digest
|
|
454
|
+
* @param digest Digest of the organization user ID and secret
|
|
455
|
+
* @param salt Salt used for computing the digest (optional)
|
|
456
|
+
* @param expiration Expiration date as timestamp (to prevent replay attacks)
|
|
457
|
+
*/
|
|
458
|
+
setUserWithHashAuthAndSetupUI: (
|
|
459
|
+
id: string,
|
|
460
|
+
algorithm: string,
|
|
461
|
+
secretId: string,
|
|
462
|
+
digest: string,
|
|
463
|
+
salt?: string,
|
|
464
|
+
expiration?: BigInt
|
|
465
|
+
): void => {
|
|
466
|
+
if (expiration === undefined) {
|
|
467
|
+
RNDidomi.setUserWithHashAuthAndSetupUI(
|
|
468
|
+
id,
|
|
469
|
+
algorithm,
|
|
470
|
+
secretId,
|
|
471
|
+
digest,
|
|
472
|
+
salt
|
|
473
|
+
);
|
|
474
|
+
} else {
|
|
475
|
+
RNDidomi.setUserWithHashAuthWithExpirationAndSetupUI(
|
|
476
|
+
id,
|
|
477
|
+
algorithm,
|
|
478
|
+
secretId,
|
|
479
|
+
digest,
|
|
480
|
+
salt,
|
|
481
|
+
expiration
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Set user information with Encryption authentication
|
|
488
|
+
*
|
|
489
|
+
* @param id Organization user ID
|
|
490
|
+
* @param algorithm Algorithm used for computing the digest
|
|
491
|
+
* @param secretId ID of the secret used for computing the digest
|
|
492
|
+
* @param initializationVector Initialization Vector used for computing the user ID
|
|
493
|
+
* @param expiration Expiration date as timestamp (to prevent replay attacks)
|
|
494
|
+
*/
|
|
495
|
+
setUserWithEncryptionAuth: (
|
|
496
|
+
id: string,
|
|
497
|
+
algorithm: string,
|
|
498
|
+
secretId: string,
|
|
499
|
+
initializationVector: string,
|
|
500
|
+
expiration?: BigInt
|
|
501
|
+
): void => {
|
|
502
|
+
if (expiration === undefined) {
|
|
503
|
+
RNDidomi.setUserWithEncryptionAuth(
|
|
504
|
+
id,
|
|
505
|
+
algorithm,
|
|
506
|
+
secretId,
|
|
507
|
+
initializationVector
|
|
508
|
+
);
|
|
509
|
+
} else {
|
|
510
|
+
RNDidomi.setUserWithEncryptionAuthWithExpiration(
|
|
511
|
+
id,
|
|
512
|
+
algorithm,
|
|
513
|
+
secretId,
|
|
514
|
+
initializationVector,
|
|
515
|
+
expiration
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Set user information with Encryption authentication and check for missing consent
|
|
522
|
+
*
|
|
523
|
+
* @param id Organization user ID
|
|
524
|
+
* @param algorithm Algorithm used for computing the digest
|
|
525
|
+
* @param secretId ID of the secret used for computing the digest
|
|
526
|
+
* @param initializationVector Initialization Vector used for computing the user ID
|
|
527
|
+
* @param expiration Expiration date as timestamp (to prevent replay attacks)
|
|
528
|
+
*/
|
|
529
|
+
setUserWithEncryptionAuthAndSetupUI: (
|
|
530
|
+
id: string,
|
|
531
|
+
algorithm: string,
|
|
532
|
+
secretId: string,
|
|
533
|
+
initializationVector: string,
|
|
534
|
+
expiration?: BigInt
|
|
535
|
+
): void => {
|
|
536
|
+
if (expiration === undefined) {
|
|
537
|
+
RNDidomi.setUserWithEncryptionAuthAndSetupUI(
|
|
538
|
+
id,
|
|
539
|
+
algorithm,
|
|
540
|
+
secretId,
|
|
541
|
+
initializationVector
|
|
542
|
+
);
|
|
543
|
+
} else {
|
|
544
|
+
RNDidomi.setUserWithEncryptionAuthWithExpirationAndSetupUI(
|
|
545
|
+
id,
|
|
546
|
+
algorithm,
|
|
547
|
+
secretId,
|
|
548
|
+
initializationVector,
|
|
549
|
+
expiration
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
|
|
382
554
|
/**
|
|
383
555
|
* Show the consent notice (if required, not disabled in the config and not already displayed)
|
|
384
556
|
*/
|
package/src/DidomiListener.ts
CHANGED
|
@@ -15,6 +15,8 @@ export const DidomiListener = {
|
|
|
15
15
|
init: () => {
|
|
16
16
|
// Register all native event listeners
|
|
17
17
|
Object.values(DidomiEventType).forEach((eventTypeValue) => {
|
|
18
|
+
// Remove previous listeners, as init() can be called several times in some configs
|
|
19
|
+
DidomiListener.eventEmitter.removeAllListeners(eventTypeValue);
|
|
18
20
|
DidomiListener.eventEmitter.addListener(eventTypeValue, (_event: any) => {
|
|
19
21
|
let events = DidomiListener.listeners.get(eventTypeValue);
|
|
20
22
|
if (events) {
|
package/src/DidomiTypes.ts
CHANGED
|
@@ -30,6 +30,9 @@ export enum DidomiEventType {
|
|
|
30
30
|
PREFERENCES_CLICK_DISAGREE_TO_ALL_PURPOSES = 'on_preferences_click_disagree_to_all_purposes',
|
|
31
31
|
PREFERENCES_CLICK_RESET_ALL_PURPOSES = 'on_preferences_click_reset_all_purposes',
|
|
32
32
|
SYNC_DONE = 'on_sync_done',
|
|
33
|
+
SYNC_ERROR = 'on_sync_error',
|
|
34
|
+
LANGUAGE_UPDATED = "on_language_updated",
|
|
35
|
+
LANGUAGE_UPDATE_FAILED = "on_language_update_failed",
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
export interface Vendor {
|
|
@@ -50,7 +53,7 @@ export interface VendorNamespaces {
|
|
|
50
53
|
|
|
51
54
|
export interface Purpose {
|
|
52
55
|
id: string;
|
|
53
|
-
|
|
56
|
+
iabId: string;
|
|
54
57
|
name: string;
|
|
55
58
|
description: string;
|
|
56
59
|
descriptionLegal: string;
|
|
@@ -85,6 +88,7 @@ export interface UserStatus {
|
|
|
85
88
|
updated: string;
|
|
86
89
|
consentString: string;
|
|
87
90
|
additionalConsent: string;
|
|
91
|
+
regulation: string;
|
|
88
92
|
}
|
|
89
93
|
|
|
90
94
|
export interface UserStatusPurposes {
|