@didomi/react-native 1.0.0 → 1.4.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 +23 -9
- package/android/build.gradle +3 -1
- package/android/src/main/java/com/reactnativedidomi/DidomiModule.kt +33 -4
- package/android/src/main/java/com/reactnativedidomi/EventTypes.kt +4 -0
- package/ios/Didomi.m +10 -0
- package/ios/RNDidomi.swift +69 -18
- package/lib/commonjs/Didomi.js +257 -213
- package/lib/commonjs/Didomi.js.map +1 -1
- package/lib/commonjs/DidomiListener.js +27 -0
- package/lib/commonjs/DidomiListener.js.map +1 -1
- package/lib/commonjs/DidomiTypes.js +2 -0
- package/lib/commonjs/DidomiTypes.js.map +1 -1
- package/lib/module/Didomi.js +257 -213
- package/lib/module/Didomi.js.map +1 -1
- package/lib/module/DidomiListener.js +27 -0
- package/lib/module/DidomiListener.js.map +1 -1
- package/lib/module/DidomiTypes.js +2 -0
- package/lib/module/DidomiTypes.js.map +1 -1
- package/lib/typescript/Didomi.d.ts +256 -216
- package/lib/typescript/DidomiListener.d.ts +2 -0
- package/lib/typescript/DidomiTypes.d.ts +28 -0
- package/package.json +8 -7
- package/react-native-didomi.podspec +3 -3
- package/src/Didomi.ts +288 -266
- package/src/DidomiListener.ts +37 -0
- package/src/DidomiTypes.ts +32 -0
package/src/Didomi.ts
CHANGED
|
@@ -6,16 +6,16 @@ const { Didomi: RNDidomi } = NativeModules;
|
|
|
6
6
|
|
|
7
7
|
export const Didomi = {
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
* Initialize the Didomi SDK
|
|
10
|
+
*
|
|
11
|
+
* @param apiKey: Public API key of the organization from the Didomi Console.
|
|
12
|
+
* @param localConfigurationPath: Path to your local config file. Defaults to didomi_config.json if null.
|
|
13
|
+
* @param remoteConfigurationURL: URL to a remote configuration file to load during initialization. This parameter is not used yet. Set it to null for now.
|
|
14
|
+
* @param providerId: Your provider ID (if any).
|
|
15
|
+
* @param disableDidomiRemoteConfig: Whether to disable loading the remove configuration from the Didomi config. Keep this to "false" for loading configuration from the Didomi Console.
|
|
16
|
+
* @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.
|
|
17
|
+
* @param noticeId: Notice id for the remote configuration.
|
|
18
|
+
*/
|
|
19
19
|
initialize: (
|
|
20
20
|
apiKey: string,
|
|
21
21
|
localConfigurationPath?: string,
|
|
@@ -41,300 +41,326 @@ export const Didomi = {
|
|
|
41
41
|
},
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
|
|
44
|
+
* Listen to SDK ready state
|
|
45
|
+
* */
|
|
46
|
+
onReady: (): Promise<void> => DidomiListener.onReady(),
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Listen to SDK errors
|
|
50
|
+
* */
|
|
51
|
+
onError: (): Promise<any> => DidomiListener.onError(),
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
Provide the objects required to display UI elements
|
|
45
55
|
*/
|
|
46
56
|
setupUI: (): Promise<void> => RNDidomi.setupUI(),
|
|
47
57
|
|
|
48
58
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
* Set the minimum level of messages to log
|
|
60
|
+
* You can decide what level of messages should be logged by the SDK by calling the setLogLevel function before initialize
|
|
61
|
+
*
|
|
62
|
+
* Messages with a level below `minLevel` will not be logged.
|
|
63
|
+
*
|
|
64
|
+
* For iOS:
|
|
65
|
+
* Levels are standard levels from `OSLogType` (https://developer.apple.com/documentation/os/logging/choosing_the_log_level_for_a_message):
|
|
66
|
+
* - OSLogType.info (1)
|
|
67
|
+
* - OSLogType.debug (2)
|
|
68
|
+
* - OSLogType.error (16)
|
|
69
|
+
* - OSLogType.fault (17)
|
|
70
|
+
*
|
|
71
|
+
* We recommend setting `OSLogType.error` (16) in production
|
|
72
|
+
*
|
|
73
|
+
* For Android:
|
|
74
|
+
* Use the standard log levels supported by android.util.Log: VERBOSE, DEBUG, INFO, WARN and ERROR.
|
|
75
|
+
* (https://developer.android.com/reference/android/util/Log#constants_1)
|
|
76
|
+
*
|
|
77
|
+
* We recommend setting `Log.INFO` (4) in production
|
|
78
|
+
*
|
|
79
|
+
* @param minLevel: Minimum level of messages to log
|
|
80
|
+
*/
|
|
62
81
|
setLogLevel: (level: number): Promise<number> => RNDidomi.setLogLevel(level),
|
|
63
82
|
|
|
64
83
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
84
|
+
* Add an event listener
|
|
85
|
+
* @param listener:
|
|
86
|
+
*/
|
|
68
87
|
addEventListener: (
|
|
69
88
|
eventType: DidomiEventType,
|
|
70
89
|
callback: (data: any) => void
|
|
71
90
|
) => DidomiListener.addEventListener(eventType, callback),
|
|
72
91
|
|
|
73
92
|
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
93
|
+
* Remove an event listener
|
|
94
|
+
* @param listener:
|
|
95
|
+
*/
|
|
77
96
|
removeEventListener: (
|
|
78
97
|
eventType: DidomiEventType,
|
|
79
98
|
callback: (data: any) => void
|
|
80
99
|
) => DidomiListener.removeEventListener(eventType, callback),
|
|
81
100
|
|
|
82
101
|
/**
|
|
83
|
-
|
|
84
|
-
|
|
102
|
+
* Remove all event listeners
|
|
103
|
+
*/
|
|
85
104
|
removeAllEventListeners: () => DidomiListener.reset(),
|
|
86
105
|
|
|
87
106
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
107
|
+
* Method used to get an array of disabled purposes.
|
|
108
|
+
* @returns: array of disabled purposes.
|
|
109
|
+
*/
|
|
91
110
|
getDisabledPurposes: (): Promise<any[]> => RNDidomi.getDisabledPurposes(),
|
|
92
111
|
|
|
93
112
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
113
|
+
* Method used to get a set of disabled purpose IDs.
|
|
114
|
+
* @returns: set that contains the IDs of disabled purposes.
|
|
115
|
+
*/
|
|
97
116
|
getDisabledPurposeIds: (): Promise<any[]> => RNDidomi.getDisabledPurposeIds(),
|
|
98
117
|
|
|
99
118
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
119
|
+
* Method used to get an array of disabled vendors.
|
|
120
|
+
* @returns: array of disabled vendors.
|
|
121
|
+
*/
|
|
103
122
|
getDisabledVendors: (): Promise<any[]> => RNDidomi.getDisabledVendors(),
|
|
104
123
|
|
|
105
124
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
125
|
+
* Method used to get a set of disabled vendor IDs.
|
|
126
|
+
* @returns: set that contains the IDs of disabled vendors.
|
|
127
|
+
*/
|
|
109
128
|
getDisabledVendorIds: (): Promise<any[]> => RNDidomi.getDisabledVendorIds(),
|
|
110
129
|
|
|
111
130
|
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
131
|
+
* Method used to get an array of enabled purposes.
|
|
132
|
+
* @returns: array of enabled purposes.
|
|
133
|
+
*/
|
|
115
134
|
getEnabledPurposes: (): Promise<any[]> => RNDidomi.getEnabledPurposes(),
|
|
116
135
|
|
|
117
136
|
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
137
|
+
* Method used to get a set of enabled purpose IDs.
|
|
138
|
+
* @returns: set that contains the IDs of enabled purposes.
|
|
139
|
+
*/
|
|
121
140
|
getEnabledPurposeIds: (): Promise<any[]> => RNDidomi.getEnabledPurposeIds(),
|
|
122
141
|
|
|
123
142
|
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
143
|
+
* Method used to get an array of enabled vendors.
|
|
144
|
+
* @returns: array of enabled vendors.
|
|
145
|
+
*/
|
|
127
146
|
getEnabledVendors: (): Promise<any[]> => RNDidomi.getEnabledVendors(),
|
|
128
147
|
|
|
129
148
|
/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
149
|
+
* Method used to get a set of enabled vendor IDs.
|
|
150
|
+
* @returns: set that contains the IDs of enabled vendors.
|
|
151
|
+
*/
|
|
133
152
|
getEnabledVendorIds: (): Promise<any[]> => RNDidomi.getEnabledVendorIds(),
|
|
134
153
|
|
|
135
154
|
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
getJavaScriptForWebView: (): Promise<string> =>
|
|
143
|
-
RNDidomi.getJavaScriptForWebView(),
|
|
155
|
+
* Get JavaScript to embed into a WebView to pass the consent status from the app
|
|
156
|
+
* to the Didomi Web SDK embedded into the WebView
|
|
157
|
+
* Inject the returned JavaScript into a WebView
|
|
158
|
+
* @param extra: Extra JavaScript to inject in the returned code
|
|
159
|
+
* @returns: JavaScript code to inject in a WebView
|
|
160
|
+
*/
|
|
161
|
+
getJavaScriptForWebView: (extra?: string | null): Promise<string> => RNDidomi.getJavaScriptForWebView(extra),
|
|
144
162
|
|
|
145
|
-
getQueryStringForWebView: (): Promise<string> =>
|
|
146
|
-
RNDidomi.getQueryStringForWebView(),
|
|
163
|
+
getQueryStringForWebView: (): Promise<string> => RNDidomi.getQueryStringForWebView(),
|
|
147
164
|
|
|
148
165
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
getPurpose: (purposeId: string): Promise<any
|
|
154
|
-
RNDidomi.getPurpose(purposeId),
|
|
166
|
+
* Method used to get a Purpose based on its ID.
|
|
167
|
+
* @param purposeId: purpose ID used in the search.
|
|
168
|
+
* @returns: purpose found in the array.
|
|
169
|
+
*/
|
|
170
|
+
getPurpose: (purposeId: string): Promise<any> => RNDidomi.getPurpose(purposeId),
|
|
155
171
|
|
|
156
172
|
/**
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
173
|
+
* Method used to get an array of required purposes.
|
|
174
|
+
*
|
|
175
|
+
* @returns: array of required purposes.
|
|
176
|
+
*/
|
|
161
177
|
getRequiredPurposes: (): Promise<any[]> => RNDidomi.getRequiredPurposes(),
|
|
162
178
|
|
|
163
179
|
/**
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
180
|
+
* Get the configured purpose IDs
|
|
181
|
+
* @returns: set of purpose IDs.
|
|
182
|
+
*/
|
|
167
183
|
getRequiredPurposeIds: (): Promise<any[]> => RNDidomi.getRequiredPurposeIds(),
|
|
168
184
|
|
|
169
185
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
186
|
+
* Method used to get an array of required vendors.
|
|
187
|
+
* @returns: array of required vendors.
|
|
188
|
+
*/
|
|
173
189
|
getRequiredVendors: (): Promise<any[]> => RNDidomi.getRequiredVendors(),
|
|
174
190
|
|
|
175
191
|
/**
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
192
|
+
* Get the configured vendor IDs
|
|
193
|
+
* @returns: set of vendor IDs.
|
|
194
|
+
*/
|
|
179
195
|
getRequiredVendorIds: (): Promise<any[]> => RNDidomi.getRequiredVendorIds(),
|
|
180
196
|
|
|
181
197
|
/**
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
198
|
+
* Method used to get a dictionary/map in the form of { "en": "Key in English", "fr": "Key in French." }
|
|
199
|
+
* for a given key.
|
|
200
|
+
* @param key: used to find its corresponding value in the dictionary/map.
|
|
201
|
+
* @returns: dictionary containing the different translations for a given key.
|
|
202
|
+
*/
|
|
187
203
|
getText: (key: string): Promise<any[]> => RNDidomi.getText(key),
|
|
188
204
|
|
|
189
205
|
/**
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
getTranslatedText: (key: string): Promise<string> =>
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
)
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
)
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
206
|
+
* Method used to get a translated text based on the key being passed.
|
|
207
|
+
* The language and the source of this translated text will depend on the availability of the translation for the specific key.
|
|
208
|
+
* 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.
|
|
209
|
+
*
|
|
210
|
+
* These are the attempts performed by the SDK to try to find a translation for the specific key:
|
|
211
|
+
* - Get translated value in user locale (selected language) from `didomi_config.json` (either local or remote).
|
|
212
|
+
* - Get translated value in default locale (from the config) from `didomi_config.json` (either local or remote).
|
|
213
|
+
* - Get translated value in user locale (selected language) from `didomi_master_config.json` (bundled within the Didomi SDK).
|
|
214
|
+
* - Get translated value in default locale (from the config) from `didomi_master_config.json` (bundled within the Didomi SDK).
|
|
215
|
+
*
|
|
216
|
+
* If no translation can be found after these 4 attempts, the key will be returned.
|
|
217
|
+
*
|
|
218
|
+
* App developers can provide these translated texts through the `didomi_config.json` file (locally or remotely) in 3 different ways:
|
|
219
|
+
* - Custom texts for the consent notice: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-notice#texts
|
|
220
|
+
* - Custom texts for the preferences: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-preferences-popup#text
|
|
221
|
+
* - Custom texts for custom notices: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-theme#translatable-texts-for-custom-notices
|
|
222
|
+
*
|
|
223
|
+
* @param key: used to find its corresponding value in one of the different sources.
|
|
224
|
+
* @returns: a translated string if a translation was found, the same key that was passed otherwise.
|
|
225
|
+
*/
|
|
226
|
+
getTranslatedText: (key: string): Promise<string> => RNDidomi.getTranslatedText(key),
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Get the user consent status for a specific purpose
|
|
230
|
+
* @param purposeId: The purpose ID to check consent for
|
|
231
|
+
* @returns: The user consent status for the specified purpose
|
|
232
|
+
* @deprecated use {@link #getUserStatus()} instead. Search the purposeId in
|
|
233
|
+
* getUserStatus().getPurposes().getConsent().getEnabled() or
|
|
234
|
+
* getUserStatus().getPurposes().getConsent().getDisabled().
|
|
235
|
+
*/
|
|
236
|
+
getUserConsentStatusForPurpose: (purposeId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForPurpose(purposeId),
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Get the user consent status for a specific vendor
|
|
240
|
+
* @param vendorId: The vendor ID to check consent for
|
|
241
|
+
* @returns: The user consent status for the specified vendor
|
|
242
|
+
* @deprecated use {@link #getUserStatus()} instead. Search the vendorId in
|
|
243
|
+
* getUserStatus().getVendors().getConsent().getEnabled() or
|
|
244
|
+
* getUserStatus().getVendors().getConsent().getDisabled().
|
|
245
|
+
*/
|
|
246
|
+
getUserConsentStatusForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForVendor(vendorId),
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Get the user consent status for a specific vendor and all its purposes
|
|
250
|
+
* @param vendorId: The ID of the vendor
|
|
251
|
+
* @returns: The user consent status corresponding to the specified vendor and all its required purposes.
|
|
252
|
+
* @deprecated use {@link #getUserStatus()} instead. The result of this method has been replaced
|
|
253
|
+
* by getUserStatus().getVendors().getGlobalConsent().getEnabled() or
|
|
254
|
+
* getUserStatus().getVendors().getGlobalConsent().getDisabled().
|
|
255
|
+
*/
|
|
256
|
+
getUserConsentStatusForVendorAndRequiredPurposes: (vendorId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForVendorAndRequiredPurposes(vendorId),
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Get the user legitimate interest status for a specific purpose.
|
|
260
|
+
* @param purposeId: purpose ID.
|
|
261
|
+
* @returns: LI status of a purpose.
|
|
262
|
+
* @deprecated use {@link #getUserStatus()} instead. Search the purposeId in
|
|
263
|
+
* getUserStatus().getPurposes().getLegitimateInterest().getEnabled() or
|
|
264
|
+
* getUserStatus().getPurposes().getLegitimateInterest().getDisabled().
|
|
265
|
+
*/
|
|
266
|
+
getUserLegitimateInterestStatusForPurpose: (purposeId: string): Promise<boolean> => RNDidomi.getUserLegitimateInterestStatusForPurpose(purposeId),
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Get the user legitimate interest status for a specific vendor.
|
|
270
|
+
* @param vendorId: vendor ID.
|
|
271
|
+
* @returns: LI status of a vendor.
|
|
272
|
+
* @deprecated use {@link #getUserStatus()} instead. Search the vendorId in
|
|
273
|
+
* getUserStatus().getVendors().getLegitimateInterest().getEnabled() or
|
|
274
|
+
* getUserStatus().getVendors().getLegitimateInterest().getDisabled().
|
|
275
|
+
*/
|
|
276
|
+
getUserLegitimateInterestForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserLegitimateInterestStatusForVendor(vendorId),
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Get the user LI status for a specific vendor and all its purposes.
|
|
280
|
+
* @param vendorId: vendor ID.
|
|
281
|
+
* @returns: The user LI status corresponding to the specified vendor and all its required purposes.
|
|
282
|
+
* @deprecated use {@link #getUserStatus()} instead. Search the purposeId in
|
|
283
|
+
* getUserStatus().getVendors().getGlobalLegitimateInterest().getEnabled() or
|
|
284
|
+
* getUserStatus().getVendors().getGlobalLegitimateInterest().getDisabled().
|
|
285
|
+
*/
|
|
286
|
+
getUserLegitimateInterestStatusForVendorAndRequiredPurposes: (vendorId: string): boolean => RNDidomi.getUserLegitimateInterestStatusForVendorAndRequiredPurposes(vendorId),
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Get the user consent status.
|
|
290
|
+
* @returns: status that represents user consent.
|
|
291
|
+
*/
|
|
292
|
+
getUserStatus: (): Promise<any> => RNDidomi.getUserStatus(),
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Get the user consent and legitimate interest status for a specific vendor.
|
|
296
|
+
* @param vendorId: vendor ID.
|
|
297
|
+
* @returns: status that represents both consent and legitimate interest status of a vendor.
|
|
298
|
+
* @deprecated use {@link #getUserStatus()} instead. Search the vendorId in
|
|
299
|
+
* getUserStatus().getVendors().getGlobal().getEnabled() or
|
|
300
|
+
* getUserStatus().getVendors().getGlobal().getDisabled().
|
|
301
|
+
*/
|
|
302
|
+
getUserStatusForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserStatusForVendor(vendorId),
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Method used to get a Vendor based on its ID.
|
|
306
|
+
* @param vendorId: vendor ID used in the search.
|
|
307
|
+
* @returns: vendor found in the array.
|
|
308
|
+
*/
|
|
309
|
+
getVendor: (vendorId: string): Promise<any> => RNDidomi.getVendor(vendorId),
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Hide the notice if it is currently displayed
|
|
313
|
+
*/
|
|
287
314
|
hideNotice: (): Promise<void> => RNDidomi.hideNotice(),
|
|
288
315
|
|
|
289
316
|
/**
|
|
290
|
-
|
|
291
|
-
|
|
317
|
+
* Hide the preferences popup for purposes
|
|
318
|
+
*/
|
|
292
319
|
hidePreferences: (): Promise<void> => RNDidomi.hidePreferences(),
|
|
293
320
|
|
|
294
321
|
/**
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
322
|
+
* Determine if consent is required for the user. The rules are (OR):
|
|
323
|
+
* - The user country is in the EU.
|
|
324
|
+
* - The company is from the EU.
|
|
325
|
+
* - The user country is unknown and the app has chosen to collect consent when unknown.
|
|
326
|
+
* @returns: **true** if consent is required, **false** if it is not required.
|
|
327
|
+
*/
|
|
301
328
|
isConsentRequired: (): Promise<boolean> => RNDidomi.isConsentRequired(),
|
|
302
329
|
|
|
303
330
|
/**
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
isUserConsentStatusPartial: (): Promise<boolean> =>
|
|
308
|
-
RNDidomi.isUserConsentStatusPartial(),
|
|
331
|
+
* Determine if consent information is available for all purposes and vendors that are required
|
|
332
|
+
* @returns: **true** if consent is required and consent information is available, **false** otherwise.
|
|
333
|
+
*/
|
|
334
|
+
isUserConsentStatusPartial: (): Promise<boolean> => RNDidomi.isUserConsentStatusPartial(),
|
|
309
335
|
|
|
310
336
|
/**
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
337
|
+
* Check if the consent notice is currently displayed
|
|
338
|
+
* @returns: **true** if the notice is displayed, **false** if is not.
|
|
339
|
+
*/
|
|
314
340
|
isNoticeVisible: (): Promise<boolean> => RNDidomi.isNoticeVisible(),
|
|
315
341
|
|
|
316
342
|
/**
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
343
|
+
* Method used to check if the Preferences view is visible.
|
|
344
|
+
* @returns: **true** if Preferences view is visible, **false** otherwise.
|
|
345
|
+
*/
|
|
320
346
|
isPreferencesVisible: (): Promise<boolean> => RNDidomi.isPreferencesVisible(),
|
|
321
347
|
|
|
322
348
|
isError: (): Promise<boolean> => RNDidomi.isError(),
|
|
323
349
|
|
|
324
350
|
/**
|
|
325
|
-
|
|
326
|
-
|
|
351
|
+
* Is the Didomi SDK ready?
|
|
352
|
+
*/
|
|
327
353
|
isReady: (): Promise<boolean> => RNDidomi.isReady(),
|
|
328
354
|
|
|
329
355
|
/**
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
356
|
+
* Set user information with authentication
|
|
357
|
+
*
|
|
358
|
+
* @param id Organization user ID
|
|
359
|
+
* @param algorithm Algorithm used for computing the digest
|
|
360
|
+
* @param secretId ID of the secret used for computing the digest
|
|
361
|
+
* @param salt Salt used for computing the digest (optional)
|
|
362
|
+
* @param digest Digest of the organization user ID and secret
|
|
363
|
+
*/
|
|
338
364
|
setUser: (
|
|
339
365
|
organizationUserId: string,
|
|
340
366
|
organizationUserIdAuthAlgorithm: string,
|
|
@@ -351,37 +377,35 @@ export const Didomi = {
|
|
|
351
377
|
),
|
|
352
378
|
|
|
353
379
|
/**
|
|
354
|
-
|
|
355
|
-
|
|
380
|
+
* Show the consent notice (if required, not disabled in the config and not already displayed)
|
|
381
|
+
*/
|
|
356
382
|
showNotice: (): Promise<void> => RNDidomi.showNotice(),
|
|
357
383
|
|
|
358
384
|
/**
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
showPreferences: (view?: string): Promise<void> =>
|
|
364
|
-
RNDidomi.showPreferences(view),
|
|
385
|
+
* Show the preferences screen when/if the SDK is ready. By default the purposes list will be displayed.
|
|
386
|
+
* @param view: It can be `purposes` or `vendors`
|
|
387
|
+
*/
|
|
388
|
+
showPreferences: (view?: string): Promise<void> => RNDidomi.showPreferences(view),
|
|
365
389
|
|
|
366
390
|
/**
|
|
367
|
-
|
|
368
|
-
|
|
391
|
+
* Remove all consents for the user
|
|
392
|
+
*/
|
|
369
393
|
reset: (): Promise<void> => RNDidomi.reset(),
|
|
370
394
|
|
|
371
395
|
/**
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
396
|
+
* Method that allows to enable consent and legitimate interest for all the required purposes.
|
|
397
|
+
* @returns: **true** if consent status has been updated, **false** otherwise.
|
|
398
|
+
*/
|
|
375
399
|
setUserAgreeToAll: (): Promise<boolean> => RNDidomi.setUserAgreeToAll(),
|
|
376
400
|
|
|
377
401
|
/**
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
402
|
+
* Set the user consent status.
|
|
403
|
+
* @param enabledPurposeIds: set containing **enabled purpose ids**
|
|
404
|
+
* @param disabledPurposeIds: set containing **disabled purpose ids**
|
|
405
|
+
* @param enabledVendorIds: set containing **enabled vendor ids**
|
|
406
|
+
* @param disabledVendorIds: set containing **disabled purpose ids**
|
|
407
|
+
* @returns: **true** if consent status has been updated, **false** otherwise.
|
|
408
|
+
*/
|
|
385
409
|
setUserConsentStatus: (
|
|
386
410
|
enabledPurposeIds: string[],
|
|
387
411
|
disabledPurposeIds: string[],
|
|
@@ -396,19 +420,19 @@ export const Didomi = {
|
|
|
396
420
|
),
|
|
397
421
|
|
|
398
422
|
/**
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
423
|
+
* Method that allows to disable consent and legitimate interest for all the required purposes and vendors.
|
|
424
|
+
* @returns: **true** if consent status has been updated, **false** otherwise.
|
|
425
|
+
*/
|
|
402
426
|
setUserDisagreeToAll: (): Promise<boolean> => RNDidomi.setUserDisagreeToAll(),
|
|
403
427
|
|
|
404
428
|
/**
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
429
|
+
* Set the user status for purposes and vendors for consent and legitimate interest.
|
|
430
|
+
* @param purposesConsentStatus: boolean used to determine if consent will be enabled or disabled for all purposes.
|
|
431
|
+
* @param purposesLIStatus: boolean used to determine if legitimate interest will be enabled or disabled for all purposes.
|
|
432
|
+
* @param vendorsConsentStatus: boolean used to determine if consent will be enabled or disabled for all vendors.
|
|
433
|
+
* @param vendorsLIStatus: boolean used to determine if legitimate interest will be enabled or disabled for all vendors.
|
|
434
|
+
* @returns: **true** if consent status has been updated, **false** otherwise.
|
|
435
|
+
*/
|
|
412
436
|
setUserStatus: (
|
|
413
437
|
purposesConsentStatus: boolean,
|
|
414
438
|
purposesLIStatus: boolean,
|
|
@@ -423,17 +447,16 @@ export const Didomi = {
|
|
|
423
447
|
),
|
|
424
448
|
|
|
425
449
|
/**
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
*/
|
|
450
|
+
* Set the user status for purposes and vendors for consent and legitimate interest.
|
|
451
|
+
* @param enabledConsentPurposeIds: List of purpose IDs to enable for consent.
|
|
452
|
+
* @param disabledConsentPurposeIds: List of purpose IDs to disable for consent.
|
|
453
|
+
* @param enabledLIPurposeIds: List of purpose IDs to enable for LI.
|
|
454
|
+
* @param disabledLIPurposeIds: List of purpose IDs to disable for LI.
|
|
455
|
+
* @param enabledConsentVendorIds: List of vendor IDs to enable for consent.
|
|
456
|
+
* @param disabledConsentVendorIds: List of vendor IDs to disable for consent.
|
|
457
|
+
* @param enabledLIVendorIds: List of vendor IDs to enable for LI.
|
|
458
|
+
* @param disabledLIVendorIds: List of vendor IDs to disable for LI.
|
|
459
|
+
*/
|
|
437
460
|
setUserStatusSets: (
|
|
438
461
|
enabledConsentPurposeIds: string[],
|
|
439
462
|
disabledConsentPurposeIds: string[],
|
|
@@ -456,19 +479,18 @@ export const Didomi = {
|
|
|
456
479
|
),
|
|
457
480
|
|
|
458
481
|
/**
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
482
|
+
* 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
|
|
483
|
+
* @returns: A boolean depending if the consent should be collected or not
|
|
484
|
+
*/
|
|
462
485
|
shouldConsentBeCollected: (): Promise<boolean> =>
|
|
463
486
|
RNDidomi.shouldConsentBeCollected(),
|
|
464
487
|
|
|
465
488
|
/**
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
*/
|
|
489
|
+
* Method used to update the selected language of the Didomi SDK and any property that depends on it.
|
|
490
|
+
* 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.
|
|
491
|
+
* 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.
|
|
492
|
+
* @param languageCode: string containing the language code e.g.: "es", "fr", etc.
|
|
493
|
+
*/
|
|
472
494
|
updateSelectedLanguage: (languageCode: string): Promise<void> =>
|
|
473
495
|
RNDidomi.updateSelectedLanguage(languageCode),
|
|
474
496
|
};
|