@didomi/react-native 1.1.0 → 1.5.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/README.md +1 -1
- package/android/build.gradle +6 -2
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/java/com/reactnativedidomi/DidomiModule.kt +52 -21
- package/android/src/main/java/com/reactnativedidomi/EventTypes.kt +2 -0
- package/ios/Didomi.m +7 -11
- package/ios/RNDidomi.swift +46 -22
- package/lib/commonjs/Constants.js +13 -0
- package/lib/commonjs/Constants.js.map +1 -0
- package/lib/commonjs/Didomi.js +35 -6
- package/lib/commonjs/Didomi.js.map +1 -1
- package/lib/commonjs/DidomiTypes.js +2 -0
- package/lib/commonjs/DidomiTypes.js.map +1 -1
- package/lib/module/Constants.js +5 -0
- package/lib/module/Constants.js.map +1 -0
- package/lib/module/Didomi.js +34 -6
- package/lib/module/Didomi.js.map +1 -1
- package/lib/module/DidomiTypes.js +2 -0
- package/lib/module/DidomiTypes.js.map +1 -1
- package/lib/typescript/Constants.d.ts +2 -0
- package/lib/typescript/Didomi.d.ts +31 -5
- package/lib/typescript/DidomiTypes.d.ts +28 -0
- package/package.json +2 -2
- package/react-native-didomi.podspec +1 -1
- package/src/Constants.ts +4 -0
- package/src/Didomi.ts +47 -38
- package/src/DidomiTypes.ts +32 -0
package/src/Didomi.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
2
|
import { DidomiListener } from './DidomiListener';
|
|
3
3
|
import { DidomiEventType } from './DidomiTypes';
|
|
4
|
+
import { DIDOMI_USER_AGENT_NAME, DIDOMI_VERSION } from './Constants';
|
|
4
5
|
|
|
5
6
|
const { Didomi: RNDidomi } = NativeModules;
|
|
6
7
|
|
|
@@ -30,6 +31,8 @@ export const Didomi = {
|
|
|
30
31
|
|
|
31
32
|
// Trigger native SDK init
|
|
32
33
|
RNDidomi.initialize(
|
|
34
|
+
DIDOMI_USER_AGENT_NAME,
|
|
35
|
+
DIDOMI_VERSION,
|
|
33
36
|
apiKey,
|
|
34
37
|
localConfigurationPath,
|
|
35
38
|
remoteConfigurationUrl,
|
|
@@ -42,17 +45,17 @@ export const Didomi = {
|
|
|
42
45
|
|
|
43
46
|
/**
|
|
44
47
|
* Listen to SDK ready state
|
|
45
|
-
|
|
48
|
+
*/
|
|
46
49
|
onReady: (): Promise<void> => DidomiListener.onReady(),
|
|
47
50
|
|
|
48
51
|
/**
|
|
49
52
|
* Listen to SDK errors
|
|
50
|
-
|
|
53
|
+
*/
|
|
51
54
|
onError: (): Promise<any> => DidomiListener.onError(),
|
|
52
55
|
|
|
53
56
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
* Provide the objects required to display UI elements
|
|
58
|
+
*/
|
|
56
59
|
setupUI: (): Promise<void> => RNDidomi.setupUI(),
|
|
57
60
|
|
|
58
61
|
/**
|
|
@@ -158,19 +161,16 @@ export const Didomi = {
|
|
|
158
161
|
* @param extra: Extra JavaScript to inject in the returned code
|
|
159
162
|
* @returns: JavaScript code to inject in a WebView
|
|
160
163
|
*/
|
|
161
|
-
getJavaScriptForWebView: (): Promise<string> =>
|
|
162
|
-
RNDidomi.getJavaScriptForWebView(),
|
|
164
|
+
getJavaScriptForWebView: (extra?: string | null): Promise<string> => RNDidomi.getJavaScriptForWebView(extra),
|
|
163
165
|
|
|
164
|
-
getQueryStringForWebView: (): Promise<string> =>
|
|
165
|
-
RNDidomi.getQueryStringForWebView(),
|
|
166
|
+
getQueryStringForWebView: (): Promise<string> => RNDidomi.getQueryStringForWebView(),
|
|
166
167
|
|
|
167
168
|
/**
|
|
168
169
|
* Method used to get a Purpose based on its ID.
|
|
169
170
|
* @param purposeId: purpose ID used in the search.
|
|
170
171
|
* @returns: purpose found in the array.
|
|
171
172
|
*/
|
|
172
|
-
getPurpose: (purposeId: string): Promise<any> =>
|
|
173
|
-
RNDidomi.getPurpose(purposeId),
|
|
173
|
+
getPurpose: (purposeId: string): Promise<any> => RNDidomi.getPurpose(purposeId),
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
176
|
* Method used to get an array of required purposes.
|
|
@@ -226,72 +226,83 @@ export const Didomi = {
|
|
|
226
226
|
* @param key: used to find its corresponding value in one of the different sources.
|
|
227
227
|
* @returns: a translated string if a translation was found, the same key that was passed otherwise.
|
|
228
228
|
*/
|
|
229
|
-
getTranslatedText: (key: string): Promise<string> =>
|
|
230
|
-
RNDidomi.getTranslatedText(key),
|
|
229
|
+
getTranslatedText: (key: string): Promise<string> => RNDidomi.getTranslatedText(key),
|
|
231
230
|
|
|
232
231
|
/**
|
|
233
232
|
* Get the user consent status for a specific purpose
|
|
234
233
|
* @param purposeId: The purpose ID to check consent for
|
|
235
234
|
* @returns: The user consent status for the specified purpose
|
|
235
|
+
* @deprecated use {@link #getUserStatus()} instead. Search the purposeId in
|
|
236
|
+
* getUserStatus().getPurposes().getConsent().getEnabled() or
|
|
237
|
+
* getUserStatus().getPurposes().getConsent().getDisabled().
|
|
236
238
|
*/
|
|
237
|
-
getUserConsentStatusForPurpose: (purposeId: string): Promise<boolean> =>
|
|
238
|
-
RNDidomi.getUserConsentStatusForPurpose(purposeId),
|
|
239
|
+
getUserConsentStatusForPurpose: (purposeId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForPurpose(purposeId),
|
|
239
240
|
|
|
240
241
|
/**
|
|
241
242
|
* Get the user consent status for a specific vendor
|
|
242
243
|
* @param vendorId: The vendor ID to check consent for
|
|
243
244
|
* @returns: The user consent status for the specified vendor
|
|
245
|
+
* @deprecated use {@link #getUserStatus()} instead. Search the vendorId in
|
|
246
|
+
* getUserStatus().getVendors().getConsent().getEnabled() or
|
|
247
|
+
* getUserStatus().getVendors().getConsent().getDisabled().
|
|
244
248
|
*/
|
|
245
|
-
getUserConsentStatusForVendor: (vendorId: string): Promise<boolean> =>
|
|
246
|
-
RNDidomi.getUserConsentStatusForVendor(vendorId),
|
|
249
|
+
getUserConsentStatusForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForVendor(vendorId),
|
|
247
250
|
|
|
248
251
|
/**
|
|
249
252
|
* Get the user consent status for a specific vendor and all its purposes
|
|
250
253
|
* @param vendorId: The ID of the vendor
|
|
251
254
|
* @returns: The user consent status corresponding to the specified vendor and all its required purposes.
|
|
255
|
+
* @deprecated use {@link #getUserStatus()} instead. The result of this method has been replaced
|
|
256
|
+
* by getUserStatus().getVendors().getGlobalConsent().getEnabled() or
|
|
257
|
+
* getUserStatus().getVendors().getGlobalConsent().getDisabled().
|
|
252
258
|
*/
|
|
253
|
-
getUserConsentStatusForVendorAndRequiredPurposes: (
|
|
254
|
-
vendorId: string
|
|
255
|
-
): Promise<boolean> =>
|
|
256
|
-
RNDidomi.getUserConsentStatusForVendorAndRequiredPurposes(vendorId),
|
|
259
|
+
getUserConsentStatusForVendorAndRequiredPurposes: (vendorId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForVendorAndRequiredPurposes(vendorId),
|
|
257
260
|
|
|
258
261
|
/**
|
|
259
262
|
* Get the user legitimate interest status for a specific purpose.
|
|
260
263
|
* @param purposeId: purpose ID.
|
|
261
264
|
* @returns: LI status of a purpose.
|
|
265
|
+
* @deprecated use {@link #getUserStatus()} instead. Search the purposeId in
|
|
266
|
+
* getUserStatus().getPurposes().getLegitimateInterest().getEnabled() or
|
|
267
|
+
* getUserStatus().getPurposes().getLegitimateInterest().getDisabled().
|
|
262
268
|
*/
|
|
263
|
-
getUserLegitimateInterestStatusForPurpose: (
|
|
264
|
-
purposeId: string
|
|
265
|
-
): Promise<boolean> =>
|
|
266
|
-
RNDidomi.getUserLegitimateInterestStatusForPurpose(purposeId),
|
|
269
|
+
getUserLegitimateInterestStatusForPurpose: (purposeId: string): Promise<boolean> => RNDidomi.getUserLegitimateInterestStatusForPurpose(purposeId),
|
|
267
270
|
|
|
268
271
|
/**
|
|
269
272
|
* Get the user legitimate interest status for a specific vendor.
|
|
270
273
|
* @param vendorId: vendor ID.
|
|
271
274
|
* @returns: LI status of a vendor.
|
|
275
|
+
* @deprecated use {@link #getUserStatus()} instead. Search the vendorId in
|
|
276
|
+
* getUserStatus().getVendors().getLegitimateInterest().getEnabled() or
|
|
277
|
+
* getUserStatus().getVendors().getLegitimateInterest().getDisabled().
|
|
272
278
|
*/
|
|
273
|
-
getUserLegitimateInterestForVendor: (vendorId: string): Promise<boolean> =>
|
|
274
|
-
RNDidomi.getUserLegitimateInterestStatusForVendor(vendorId),
|
|
279
|
+
getUserLegitimateInterestForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserLegitimateInterestStatusForVendor(vendorId),
|
|
275
280
|
|
|
276
281
|
/**
|
|
277
282
|
* Get the user LI status for a specific vendor and all its purposes.
|
|
278
283
|
* @param vendorId: vendor ID.
|
|
279
284
|
* @returns: The user LI status corresponding to the specified vendor and all its required purposes.
|
|
285
|
+
* @deprecated use {@link #getUserStatus()} instead. Search the purposeId in
|
|
286
|
+
* getUserStatus().getVendors().getGlobalLegitimateInterest().getEnabled() or
|
|
287
|
+
* getUserStatus().getVendors().getGlobalLegitimateInterest().getDisabled().
|
|
280
288
|
*/
|
|
281
|
-
getUserLegitimateInterestStatusForVendorAndRequiredPurposes: (
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
289
|
+
getUserLegitimateInterestStatusForVendorAndRequiredPurposes: (vendorId: string): boolean => RNDidomi.getUserLegitimateInterestStatusForVendorAndRequiredPurposes(vendorId),
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Get the user consent status.
|
|
293
|
+
* @returns: status that represents user consent.
|
|
294
|
+
*/
|
|
295
|
+
getUserStatus: (): Promise<any> => RNDidomi.getUserStatus(),
|
|
287
296
|
|
|
288
297
|
/**
|
|
289
298
|
* Get the user consent and legitimate interest status for a specific vendor.
|
|
290
299
|
* @param vendorId: vendor ID.
|
|
291
300
|
* @returns: status that represents both consent and legitimate interest status of a vendor.
|
|
301
|
+
* @deprecated use {@link #getUserStatus()} instead. Search the vendorId in
|
|
302
|
+
* getUserStatus().getVendors().getGlobal().getEnabled() or
|
|
303
|
+
* getUserStatus().getVendors().getGlobal().getDisabled().
|
|
292
304
|
*/
|
|
293
|
-
getUserStatusForVendor: (vendorId: string): Promise<boolean> =>
|
|
294
|
-
RNDidomi.getUserStatusForVendor(vendorId),
|
|
305
|
+
getUserStatusForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserStatusForVendor(vendorId),
|
|
295
306
|
|
|
296
307
|
/**
|
|
297
308
|
* Method used to get a Vendor based on its ID.
|
|
@@ -323,8 +334,7 @@ export const Didomi = {
|
|
|
323
334
|
* Determine if consent information is available for all purposes and vendors that are required
|
|
324
335
|
* @returns: **true** if consent is required and consent information is available, **false** otherwise.
|
|
325
336
|
*/
|
|
326
|
-
isUserConsentStatusPartial: (): Promise<boolean> =>
|
|
327
|
-
RNDidomi.isUserConsentStatusPartial(),
|
|
337
|
+
isUserConsentStatusPartial: (): Promise<boolean> => RNDidomi.isUserConsentStatusPartial(),
|
|
328
338
|
|
|
329
339
|
/**
|
|
330
340
|
* Check if the consent notice is currently displayed
|
|
@@ -378,8 +388,7 @@ export const Didomi = {
|
|
|
378
388
|
* Show the preferences screen when/if the SDK is ready. By default the purposes list will be displayed.
|
|
379
389
|
* @param view: It can be `purposes` or `vendors`
|
|
380
390
|
*/
|
|
381
|
-
showPreferences: (view?: string): Promise<void> =>
|
|
382
|
-
RNDidomi.showPreferences(view),
|
|
391
|
+
showPreferences: (view?: string): Promise<void> => RNDidomi.showPreferences(view),
|
|
383
392
|
|
|
384
393
|
/**
|
|
385
394
|
* Remove all consents for the user
|
package/src/DidomiTypes.ts
CHANGED
|
@@ -10,6 +10,8 @@ export enum DidomiEventType {
|
|
|
10
10
|
NOTICE_CLICK_MORE_INFO = 'on_notice_click_more_info',
|
|
11
11
|
NOTICE_CLICK_VIEW_VENDORS = 'on_notice_click_view_vendors',
|
|
12
12
|
NOTICE_CLICK_PRIVACY_POLICY = 'on_notice_click_privacy_policy',
|
|
13
|
+
HIDE_PREFERENCES = 'on_hide_preferences',
|
|
14
|
+
SHOW_PREFERENCES = 'on_show_preferences',
|
|
13
15
|
PREFERENCES_CLICK_AGREE_TO_ALL = 'on_preferences_click_agree_to_all',
|
|
14
16
|
PREFERENCES_CLICK_DISAGREE_TO_ALL = 'on_preferences_click_disagree_to_all',
|
|
15
17
|
PREFERENCES_CLICK_PURPOSE_AGREE = 'on_preferences_click_purpose_agree',
|
|
@@ -74,3 +76,33 @@ export interface Map<T> {
|
|
|
74
76
|
[index: string]: T;
|
|
75
77
|
[index: number]: T;
|
|
76
78
|
}
|
|
79
|
+
|
|
80
|
+
export interface UserStatus {
|
|
81
|
+
purposes: UserStatusPurposes;
|
|
82
|
+
vendors: UserStatusVendors;
|
|
83
|
+
userId: string;
|
|
84
|
+
created: string;
|
|
85
|
+
updated: string;
|
|
86
|
+
consentString: string;
|
|
87
|
+
additionalConsent: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface UserStatusPurposes {
|
|
91
|
+
global: UserStatusIds;
|
|
92
|
+
consent: UserStatusIds;
|
|
93
|
+
legitimateInterest: UserStatusIds;
|
|
94
|
+
essential: UserStatusIds;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface UserStatusVendors {
|
|
98
|
+
global: UserStatusIds;
|
|
99
|
+
globalConsent: UserStatusIds;
|
|
100
|
+
globalLegitimateInterest: UserStatusIds;
|
|
101
|
+
consent: UserStatusIds;
|
|
102
|
+
legitimateInterest: UserStatusIds;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface UserStatusIds {
|
|
106
|
+
disabled: string[];
|
|
107
|
+
enabled: string[];
|
|
108
|
+
}
|