@didomi/react-native 1.27.0 → 2.0.1
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/src/main/java/com/reactnativedidomi/DidomiModule.kt +32 -216
- package/android/src/main/java/com/reactnativedidomi/EventTypes.kt +3 -1
- package/ios/Didomi.m +8 -56
- package/ios/RNDidomi.swift +46 -184
- package/lib/commonjs/Constants.js +1 -1
- package/lib/commonjs/Constants.js.map +1 -1
- package/lib/commonjs/Didomi.js +20 -6
- package/lib/commonjs/Didomi.js.map +1 -1
- package/lib/commonjs/DidomiListener.js +25 -0
- package/lib/commonjs/DidomiListener.js.map +1 -1
- package/lib/commonjs/DidomiTypes.js.map +1 -1
- package/lib/commonjs/index.js +0 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Constants.js +1 -1
- package/lib/module/Constants.js.map +1 -1
- package/lib/module/Didomi.js +20 -6
- package/lib/module/Didomi.js.map +1 -1
- package/lib/module/DidomiListener.js +25 -0
- package/lib/module/DidomiListener.js.map +1 -1
- package/lib/module/DidomiTypes.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/Constants.d.ts +1 -1
- package/lib/typescript/Didomi.d.ts +15 -7
- package/lib/typescript/DidomiListener.d.ts +4 -1
- package/lib/typescript/DidomiTypes.d.ts +5 -29
- package/lib/typescript/index.d.ts +1 -1
- package/package.json +1 -1
- package/react-native-didomi.podspec +1 -1
- package/src/Constants.ts +1 -1
- package/src/Didomi.ts +26 -20
- package/src/DidomiListener.ts +32 -1
- package/src/DidomiTypes.ts +5 -30
- package/src/index.tsx +1 -1
|
@@ -42,22 +42,16 @@ export declare enum DidomiEventType {
|
|
|
42
42
|
}
|
|
43
43
|
export interface Vendor {
|
|
44
44
|
id: string;
|
|
45
|
-
iabId: string;
|
|
46
45
|
name: string;
|
|
47
|
-
policyUrl: string;
|
|
48
|
-
urls: VendorUrls[];
|
|
49
|
-
namespace: string;
|
|
50
46
|
namespaces: VendorNamespaces;
|
|
51
|
-
|
|
47
|
+
policyUrl: string;
|
|
52
48
|
purposeIds: string[];
|
|
53
|
-
|
|
54
|
-
specialPurposeIds: string[];
|
|
49
|
+
flexibleIds: string[];
|
|
55
50
|
legIntPurposeIds: string[];
|
|
51
|
+
flexiblePurposeIds: string[];
|
|
56
52
|
specialFeatureIds: string[];
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
cookieMaxAgeSeconds: number;
|
|
60
|
-
usesNonCookieAccess: boolean;
|
|
53
|
+
specialPurposeIds: string[];
|
|
54
|
+
urls: VendorUrls[];
|
|
61
55
|
}
|
|
62
56
|
export interface VendorNamespaces {
|
|
63
57
|
iab2: string;
|
|
@@ -74,26 +68,8 @@ export interface VendorDataRetention {
|
|
|
74
68
|
}
|
|
75
69
|
export interface Purpose {
|
|
76
70
|
id: string;
|
|
77
|
-
iabId: string;
|
|
78
71
|
name: string;
|
|
79
72
|
description: string;
|
|
80
|
-
descriptionLegal: string;
|
|
81
|
-
illustrations: string[];
|
|
82
|
-
custom: boolean;
|
|
83
|
-
essential: boolean;
|
|
84
|
-
specialFeature: boolean;
|
|
85
|
-
legitimateInterest: boolean;
|
|
86
|
-
consent: boolean;
|
|
87
|
-
category: PurposeCategory;
|
|
88
|
-
}
|
|
89
|
-
export interface PurposeCategory {
|
|
90
|
-
id: string;
|
|
91
|
-
purposeId: string;
|
|
92
|
-
icon: string;
|
|
93
|
-
type: string;
|
|
94
|
-
name: Map<string>;
|
|
95
|
-
description: Map<string>;
|
|
96
|
-
children: PurposeCategory[];
|
|
97
73
|
}
|
|
98
74
|
export interface Map<T> {
|
|
99
75
|
[index: string]: T;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Didomi } from './Didomi';
|
|
2
|
-
export { DidomiEventType, Vendor, VendorNamespaces, Purpose,
|
|
2
|
+
export { DidomiEventType, Vendor, VendorNamespaces, Purpose, UserStatus, UserStatusPurposes, UserStatusVendors, UserStatusIds, CurrentUserStatus, PurposeStatus, VendorStatus } from './DidomiTypes';
|
package/package.json
CHANGED
package/src/Constants.ts
CHANGED
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 } from './DidomiTypes';
|
|
3
|
+
import { DidomiEventType, Purpose, Vendor, UserStatus, CurrentUserStatus, VendorStatus } from './DidomiTypes';
|
|
4
4
|
import { DIDOMI_USER_AGENT_NAME, DIDOMI_VERSION } from './Constants';
|
|
5
5
|
|
|
6
6
|
const { Didomi: RNDidomi } = NativeModules;
|
|
@@ -106,6 +106,29 @@ export const Didomi = {
|
|
|
106
106
|
callback: (data: any) => void
|
|
107
107
|
) => DidomiListener.addEventListener(eventType, callback),
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Add a listener to be triggered when the user status for the selected vendor changes
|
|
111
|
+
* The callback will be registered after the SDK is ready
|
|
112
|
+
* @param vendorId: the id of the vendor
|
|
113
|
+
* @param callback: the callback to trigger when the user status for the selected vendor changes
|
|
114
|
+
*/
|
|
115
|
+
addVendorStatusListener: (
|
|
116
|
+
vendorId: string,
|
|
117
|
+
callback: (vendorStatus: VendorStatus) => void
|
|
118
|
+
) => {
|
|
119
|
+
RNDidomi.listenToVendorStatus(vendorId)
|
|
120
|
+
DidomiListener.addVendorStatusListener(vendorId, callback);
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Remove one or multiple previously added vendor status listeners
|
|
125
|
+
* @param vendorId the id of the vendor
|
|
126
|
+
*/
|
|
127
|
+
removeVendorStatusListener: (vendorId: string) => {
|
|
128
|
+
RNDidomi.stopListeningToVendorStatus(vendorId)
|
|
129
|
+
DidomiListener.removeVendorStatusListener(vendorId);
|
|
130
|
+
},
|
|
131
|
+
|
|
109
132
|
/**
|
|
110
133
|
* Remove an event listener
|
|
111
134
|
* @param listener:
|
|
@@ -415,25 +438,8 @@ export const Didomi = {
|
|
|
415
438
|
* Set user information without authentication
|
|
416
439
|
*
|
|
417
440
|
* @param id Organization user ID
|
|
418
|
-
* @param algorithm Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
419
|
-
* @param secretId Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
420
|
-
* @param salt Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
421
|
-
* @param digest Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
422
441
|
*/
|
|
423
|
-
setUser: (
|
|
424
|
-
id: string,
|
|
425
|
-
algorithm?: string,
|
|
426
|
-
secretId?: string,
|
|
427
|
-
salt?: string,
|
|
428
|
-
digest?: string
|
|
429
|
-
): Promise<void> =>
|
|
430
|
-
RNDidomi.setUser(
|
|
431
|
-
id,
|
|
432
|
-
algorithm,
|
|
433
|
-
secretId,
|
|
434
|
-
salt,
|
|
435
|
-
digest
|
|
436
|
-
),
|
|
442
|
+
setUser: (id: string): Promise<void> => RNDidomi.setUser(id),
|
|
437
443
|
|
|
438
444
|
/**
|
|
439
445
|
* Set user information without authentication and check for missing consent
|
|
@@ -593,7 +599,7 @@ export const Didomi = {
|
|
|
593
599
|
|
|
594
600
|
/**
|
|
595
601
|
* Show the preferences screen when/if the SDK is ready. By default the purposes list will be displayed.
|
|
596
|
-
* @param view: It can be `purposes` or `
|
|
602
|
+
* @param view: It can be `purposes`, `vendors` or `senstive-personal-information`.
|
|
597
603
|
*/
|
|
598
604
|
showPreferences: (view?: string): Promise<void> => RNDidomi.showPreferences(view),
|
|
599
605
|
|
package/src/DidomiListener.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { NativeModules, NativeEventEmitter, EmitterSubscription } from 'react-native';
|
|
2
|
-
import { DidomiEventType } from './DidomiTypes';
|
|
2
|
+
import { DidomiEventType, VendorStatus } from './DidomiTypes';
|
|
3
3
|
|
|
4
4
|
const { Didomi: RNDidomi } = NativeModules;
|
|
5
5
|
|
|
6
6
|
enum InternalEventType {
|
|
7
7
|
READY_CALLBACK = 'on_ready_callback',
|
|
8
8
|
ERROR_CALLBACK = 'on_error_callback',
|
|
9
|
+
VENDOR_STATUS_CHANGE_PREFIX = 'on_vendor_status_change_',
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export const DidomiListener = {
|
|
12
13
|
listeners: new Map(),
|
|
14
|
+
vendorStatusListeners: new Map(),
|
|
13
15
|
eventEmitter: new NativeEventEmitter(RNDidomi),
|
|
14
16
|
|
|
15
17
|
init: () => {
|
|
@@ -99,4 +101,33 @@ export const DidomiListener = {
|
|
|
99
101
|
);
|
|
100
102
|
});
|
|
101
103
|
},
|
|
104
|
+
|
|
105
|
+
addVendorStatusListener: (
|
|
106
|
+
vendorId: string,
|
|
107
|
+
callback: (vendorStatus: VendorStatus) => void
|
|
108
|
+
) => {
|
|
109
|
+
let events = DidomiListener.vendorStatusListeners.get(vendorId);
|
|
110
|
+
if (!events) {
|
|
111
|
+
events = [];
|
|
112
|
+
DidomiListener.vendorStatusListeners.set(vendorId, events);
|
|
113
|
+
|
|
114
|
+
DidomiListener.eventEmitter.addListener(InternalEventType.VENDOR_STATUS_CHANGE_PREFIX + vendorId, (_event: any) => {
|
|
115
|
+
let events = DidomiListener.vendorStatusListeners.get(vendorId);
|
|
116
|
+
if (events) {
|
|
117
|
+
events.forEach((el: any) => {
|
|
118
|
+
el(_event);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
events.push(callback);
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
removeVendorStatusListener: (vendorId: string) => {
|
|
127
|
+
let events = DidomiListener.vendorStatusListeners.get(vendorId);
|
|
128
|
+
if (events) {
|
|
129
|
+
DidomiListener.eventEmitter.removeAllListeners(InternalEventType.VENDOR_STATUS_CHANGE_PREFIX + vendorId);
|
|
130
|
+
DidomiListener.vendorStatusListeners.set(vendorId, undefined);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
102
133
|
};
|
package/src/DidomiTypes.ts
CHANGED
|
@@ -54,22 +54,16 @@ export enum DidomiEventType {
|
|
|
54
54
|
|
|
55
55
|
export interface Vendor {
|
|
56
56
|
id: string;
|
|
57
|
-
iabId: string
|
|
58
57
|
name: string;
|
|
59
|
-
policyUrl: string;
|
|
60
|
-
urls: VendorUrls[];
|
|
61
|
-
namespace: string;
|
|
62
58
|
namespaces: VendorNamespaces;
|
|
63
|
-
|
|
59
|
+
policyUrl: string;
|
|
64
60
|
purposeIds: string[];
|
|
65
|
-
|
|
66
|
-
specialPurposeIds: string[];
|
|
61
|
+
flexibleIds: string[];
|
|
67
62
|
legIntPurposeIds: string[];
|
|
63
|
+
flexiblePurposeIds: string[];
|
|
68
64
|
specialFeatureIds: string[];
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
cookieMaxAgeSeconds: number;
|
|
72
|
-
usesNonCookieAccess: boolean;
|
|
65
|
+
specialPurposeIds: string[];
|
|
66
|
+
urls: VendorUrls[];
|
|
73
67
|
}
|
|
74
68
|
|
|
75
69
|
export interface VendorNamespaces {
|
|
@@ -90,27 +84,8 @@ export interface VendorDataRetention {
|
|
|
90
84
|
|
|
91
85
|
export interface Purpose {
|
|
92
86
|
id: string;
|
|
93
|
-
iabId: string;
|
|
94
87
|
name: string;
|
|
95
88
|
description: string;
|
|
96
|
-
descriptionLegal: string;
|
|
97
|
-
illustrations: string[];
|
|
98
|
-
custom: boolean;
|
|
99
|
-
essential: boolean;
|
|
100
|
-
specialFeature: boolean;
|
|
101
|
-
legitimateInterest: boolean;
|
|
102
|
-
consent: boolean;
|
|
103
|
-
category: PurposeCategory;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export interface PurposeCategory {
|
|
107
|
-
id: string;
|
|
108
|
-
purposeId: string;
|
|
109
|
-
icon: string;
|
|
110
|
-
type: string;
|
|
111
|
-
name: Map<string>;
|
|
112
|
-
description: Map<string>;
|
|
113
|
-
children: PurposeCategory[];
|
|
114
89
|
}
|
|
115
90
|
|
|
116
91
|
export interface Map<T> {
|
package/src/index.tsx
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Didomi } from './Didomi';
|
|
2
|
-
export { DidomiEventType, Vendor, VendorNamespaces, Purpose,
|
|
2
|
+
export { DidomiEventType, Vendor, VendorNamespaces, Purpose, UserStatus, UserStatusPurposes, UserStatusVendors, UserStatusIds, CurrentUserStatus, PurposeStatus, VendorStatus } from './DidomiTypes';
|