@didomi/react-native 1.11.1 → 1.13.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 +14 -22
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +6 -4
- package/android/gradlew +154 -103
- package/android/gradlew.bat +7 -18
- package/android/src/main/java/com/reactnativedidomi/DidomiModule.kt +186 -111
- package/ios/Didomi.m +4 -13
- package/ios/Didomi.xcodeproj/project.pbxproj +4 -4
- package/ios/RNDidomi.swift +23 -38
- package/lib/commonjs/Constants.js +3 -3
- package/lib/commonjs/Constants.js.map +1 -1
- package/lib/commonjs/Didomi.js +18 -65
- package/lib/commonjs/Didomi.js.map +1 -1
- package/lib/commonjs/DidomiListener.js +16 -18
- package/lib/commonjs/DidomiListener.js.map +1 -1
- package/lib/commonjs/DidomiTypes.js +0 -1
- package/lib/commonjs/DidomiTypes.js.map +1 -1
- package/lib/commonjs/index.js +0 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Constants.js +3 -3
- package/lib/module/Constants.js.map +1 -1
- package/lib/module/Didomi.js +18 -60
- package/lib/module/Didomi.js.map +1 -1
- package/lib/module/DidomiListener.js +16 -15
- package/lib/module/DidomiListener.js.map +1 -1
- package/lib/module/DidomiTypes.js +0 -1
- package/lib/module/DidomiTypes.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/Constants.d.ts +1 -1
- package/lib/typescript/Didomi.d.ts +9 -9
- package/lib/typescript/DidomiListener.d.ts +2 -2
- package/package.json +6 -7
- package/react-native-didomi.podspec +2 -2
- package/src/Constants.ts +1 -1
- package/src/Didomi.ts +10 -2
- package/src/DidomiListener.ts +24 -14
|
@@ -4,12 +4,10 @@ const {
|
|
|
4
4
|
Didomi: RNDidomi
|
|
5
5
|
} = NativeModules;
|
|
6
6
|
var InternalEventType;
|
|
7
|
-
|
|
8
7
|
(function (InternalEventType) {
|
|
9
8
|
InternalEventType["READY_CALLBACK"] = "on_ready_callback";
|
|
10
9
|
InternalEventType["ERROR_CALLBACK"] = "on_error_callback";
|
|
11
10
|
})(InternalEventType || (InternalEventType = {}));
|
|
12
|
-
|
|
13
11
|
export const DidomiListener = {
|
|
14
12
|
listeners: new Map(),
|
|
15
13
|
eventEmitter: new NativeEventEmitter(RNDidomi),
|
|
@@ -20,7 +18,6 @@ export const DidomiListener = {
|
|
|
20
18
|
DidomiListener.eventEmitter.removeAllListeners(eventTypeValue);
|
|
21
19
|
DidomiListener.eventEmitter.addListener(eventTypeValue, _event => {
|
|
22
20
|
let events = DidomiListener.listeners.get(eventTypeValue);
|
|
23
|
-
|
|
24
21
|
if (events) {
|
|
25
22
|
events.forEach(el => {
|
|
26
23
|
el(_event);
|
|
@@ -35,43 +32,47 @@ export const DidomiListener = {
|
|
|
35
32
|
},
|
|
36
33
|
addEventListener: (eventType, callback) => {
|
|
37
34
|
let events = DidomiListener.listeners.get(eventType);
|
|
38
|
-
|
|
39
35
|
if (!events) {
|
|
40
36
|
events = [];
|
|
41
37
|
DidomiListener.listeners.set(eventType, events);
|
|
42
38
|
}
|
|
43
|
-
|
|
44
39
|
events.push(callback);
|
|
45
40
|
},
|
|
46
41
|
removeEventListener: (eventType, callback) => {
|
|
47
42
|
let events = DidomiListener.listeners.get(eventType);
|
|
48
|
-
|
|
49
43
|
if (events) {
|
|
50
44
|
var index = events.indexOf(callback);
|
|
51
|
-
|
|
52
45
|
if (index !== -1) {
|
|
53
46
|
events.splice(index, 1);
|
|
54
47
|
}
|
|
55
48
|
}
|
|
56
49
|
},
|
|
57
|
-
|
|
50
|
+
setOnReadyListener: () => {
|
|
58
51
|
return new Promise(resolve => {
|
|
52
|
+
let subscription;
|
|
59
53
|
const listener = _event => {
|
|
60
54
|
resolve();
|
|
61
|
-
|
|
55
|
+
if (subscription) {
|
|
56
|
+
subscription.remove();
|
|
57
|
+
} else if ('removeListener' in DidomiListener.eventEmitter) {
|
|
58
|
+
DidomiListener.eventEmitter.removeListener(InternalEventType.READY_CALLBACK, listener);
|
|
59
|
+
}
|
|
62
60
|
};
|
|
63
|
-
|
|
64
|
-
DidomiListener.eventEmitter.addListener(InternalEventType.READY_CALLBACK, listener);
|
|
61
|
+
subscription = DidomiListener.eventEmitter.addListener(InternalEventType.READY_CALLBACK, listener);
|
|
65
62
|
});
|
|
66
63
|
},
|
|
67
|
-
|
|
64
|
+
setOnErrorListener: () => {
|
|
68
65
|
return new Promise(resolve => {
|
|
66
|
+
let subscription;
|
|
69
67
|
const listener = _event => {
|
|
70
68
|
resolve(_event);
|
|
71
|
-
|
|
69
|
+
if (subscription) {
|
|
70
|
+
subscription.remove();
|
|
71
|
+
} else if ('removeListener' in DidomiListener.eventEmitter) {
|
|
72
|
+
DidomiListener.eventEmitter.removeListener(InternalEventType.ERROR_CALLBACK, listener);
|
|
73
|
+
}
|
|
72
74
|
};
|
|
73
|
-
|
|
74
|
-
DidomiListener.eventEmitter.addListener(InternalEventType.ERROR_CALLBACK, listener);
|
|
75
|
+
subscription = DidomiListener.eventEmitter.addListener(InternalEventType.ERROR_CALLBACK, listener);
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["NativeModules","NativeEventEmitter","DidomiEventType","Didomi","RNDidomi","InternalEventType","DidomiListener","listeners","Map","eventEmitter","init","Object","values","forEach","eventTypeValue","removeAllListeners","addListener","_event","events","get","el","reset","addEventListener","eventType","callback","set","push","removeEventListener","index","indexOf","splice","setOnReadyListener","Promise","resolve","subscription","listener","remove","removeListener","READY_CALLBACK","setOnErrorListener","ERROR_CALLBACK"],"sources":["DidomiListener.ts"],"sourcesContent":["import { NativeModules, NativeEventEmitter, EmitterSubscription } from 'react-native';\nimport { DidomiEventType } from './DidomiTypes';\n\nconst { Didomi: RNDidomi } = NativeModules;\n\nenum InternalEventType {\n READY_CALLBACK = 'on_ready_callback',\n ERROR_CALLBACK = 'on_error_callback',\n}\n\nexport const DidomiListener = {\n listeners: new Map(),\n eventEmitter: new NativeEventEmitter(RNDidomi),\n\n init: () => {\n // Register all native event listeners\n Object.values(DidomiEventType).forEach((eventTypeValue) => {\n // Remove previous listeners, as init() can be called several times in some configs\n DidomiListener.eventEmitter.removeAllListeners(eventTypeValue);\n DidomiListener.eventEmitter.addListener(eventTypeValue, (_event: any) => {\n let events = DidomiListener.listeners.get(eventTypeValue);\n if (events) {\n events.forEach((el: any) => {\n el(_event);\n });\n }\n });\n });\n },\n\n reset: () => {\n // Reset listeners\n DidomiListener.listeners = new Map();\n },\n\n addEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => {\n let events = DidomiListener.listeners.get(eventType);\n if (!events) {\n events = [];\n DidomiListener.listeners.set(eventType, events);\n }\n events.push(callback);\n },\n\n removeEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => {\n let events = DidomiListener.listeners.get(eventType);\n if (events) {\n var index = events.indexOf(callback);\n if (index !== -1) {\n events.splice(index, 1);\n }\n }\n },\n\n setOnReadyListener: (): Promise<void> => {\n return new Promise<void>((resolve) => {\n let subscription: EmitterSubscription;\n const listener = (_event: any) => {\n resolve();\n if (subscription) {\n subscription.remove();\n } else if ('removeListener' in DidomiListener.eventEmitter) {\n DidomiListener.eventEmitter.removeListener(\n InternalEventType.READY_CALLBACK,\n listener\n );\n }\n };\n subscription = DidomiListener.eventEmitter.addListener(\n InternalEventType.READY_CALLBACK,\n listener\n );\n });\n },\n\n setOnErrorListener: (): Promise<void> => {\n return new Promise<void>((resolve) => {\n let subscription: EmitterSubscription;\n const listener = (_event: any) => {\n resolve(_event);\n if (subscription) {\n subscription.remove();\n } else if ('removeListener' in DidomiListener.eventEmitter) {\n DidomiListener.eventEmitter.removeListener(\n InternalEventType.ERROR_CALLBACK,\n listener\n );\n }\n };\n subscription = DidomiListener.eventEmitter.addListener(\n In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AAgB,IAAI9B,cAAc,CAACG,YAAY,EAAE;UAC1DH,cAAc,CAACG,YAAY,CAAC4B,cAAc,CACxChC,iBAAiB,CAACmC,cAAc,EAChCL,QAAQ,CACT;QACH;MACF,CAAC;MACDD,YAAY,GAAG5B,cAAc,CAACG,YAAY,CAACO,WAAW,CACpDX,iBAAiB,CAACmC,cAAc,EAChCL,QAAQ,CACT;IACH,CAAC,CAAC;EACJ;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["DidomiEventType"],"sources":["DidomiTypes.ts"],"sourcesContent":["// TODO\nexport enum DidomiEventType {\n READY = 'on_ready',\n ERROR = 'on_error',\n CONSENT_CHANGED = 'on_consent_changed',\n HIDE_NOTICE = 'on_hide_notice',\n SHOW_NOTICE = 'on_show_notice',\n NOTICE_CLICK_AGREE = 'on_notice_click_agree',\n NOTICE_CLICK_DISAGREE = 'on_notice_click_disagree',\n NOTICE_CLICK_MORE_INFO = 'on_notice_click_more_info',\n NOTICE_CLICK_VIEW_VENDORS = 'on_notice_click_view_vendors',\n NOTICE_CLICK_PRIVACY_POLICY = 'on_notice_click_privacy_policy',\n HIDE_PREFERENCES = 'on_hide_preferences',\n SHOW_PREFERENCES = 'on_show_preferences',\n PREFERENCES_CLICK_AGREE_TO_ALL = 'on_preferences_click_agree_to_all',\n PREFERENCES_CLICK_DISAGREE_TO_ALL = 'on_preferences_click_disagree_to_all',\n PREFERENCES_CLICK_PURPOSE_AGREE = 'on_preferences_click_purpose_agree',\n PREFERENCES_CLICK_PURPOSE_DISAGREE = 'on_preferences_click_purpose_disagree',\n PREFERENCES_CLICK_VIEW_VENDORS = 'on_preferences_click_view_vendors',\n PREFERENCES_CLICK_SAVE_CHOICES = 'on_preferences_click_save_choices',\n PREFERENCES_CLICK_VENDOR_AGREE = 'on_preferences_click_vendor_agree',\n PREFERENCES_CLICK_VENDOR_DISAGREE = 'on_preferences_click_vendor_disagree',\n PREFERENCES_CLICK_CATEGORY_AGREE = 'on_preferences_click_category_agree',\n PREFERENCES_CLICK_CATEGORY_DISAGREE = 'on_preferences_click_category_disagree',\n PREFERENCES_CLICK_AGREE_TO_ALL_VENDORS = 'on_preferences_click_agree_to_all_vendors',\n PREFERENCES_CLICK_DISAGREE_TO_ALL_VENDORS = 'on_preferences_click_disagree_to_all_vendors',\n PREFERENCES_CLICK_VENDOR_SAVE_CHOICES = 'on_preferences_click_vendor_save_choices',\n PREFERENCES_CLICK_VIEW_PURPOSES = 'on_preferences_click_view_purposes',\n PREFERENCES_CLICK_AGREE_TO_ALL_PURPOSES = 'on_preferences_click_agree_to_all_purposes',\n PREFERENCES_CLICK_DISAGREE_TO_ALL_PURPOSES = 'on_preferences_click_disagree_to_all_purposes',\n PREFERENCES_CLICK_RESET_ALL_PURPOSES = 'on_preferences_click_reset_all_purposes',\n SYNC_DONE = 'on_sync_done',\n SYNC_ERROR = 'on_sync_error',\n LANGUAGE_UPDATED = \"on_language_updated\",\n LANGUAGE_UPDATE_FAILED = \"on_language_update_failed\",\n}\n\nexport interface Vendor {\n id: string;\n iabId: string\n name: string;\n policyUrl: string;\n namespace: string;\n namespaces: VendorNamespaces;\n iabVendor: boolean;\n purposeIds: string[];\n flexiblePurposeIds: string[];\n specialPurposeIds: string[];\n legIntPurposeIds: string[];\n specialFeatureIds: string[];\n cookieMaxAgeSeconds: number\n usesNonCookieAccess: boolean;\n}\n\nexport interface VendorNamespaces {\n iab2: string;\n}\n\nexport interface Purpose {\n id: string;\n iabId: string;\n name: string;\n description: string;\n descriptionLegal: string;\n custom: boolean;\n essential: boolean;\n specialFeature: boolean;\n legitimateInterest: boolean;\n consent: boolean;\n category: PurposeCategory;\n}\n\nexport interface PurposeCategory {\n id: string;\n purposeId: string;\n icon: string;\n type: string;\n name: Map<string>;\n description: Map<string>;\n children: PurposeCategory[];\n}\n\nexport interface Map<T> {\n [index: string]: T;\n [index: number]: T;\n}\n\nexport interface UserStatus {\n purposes: UserStatusPurposes;\n vendors: UserStatusVendors;\n user_id: string;\n created: string;\n updated: string;\n consent_string: string;\n additional_consent: string;\n regulation: string;\n}\n\nexport interface UserStatusPurposes {\n global: UserStatusIds;\n consent: UserStatusIds;\n legitimate_interest: UserStatusIds;\n essential: UserStatusIds;\n}\n\nexport interface UserStatusVendors {\n global: UserStatusIds;\n global_consent: UserStatusIds;\n global_legitimate_interest: UserStatusIds;\n consent: UserStatusIds;\n legitimate_interest: UserStatusIds;\n}\n\nexport interface UserStatusIds {\n disabled: string[];\n enabled: string[];\n}\n"],"mappings":"AAAA;AACA,WAAYA,eAAe;AAkC1B,WAlCWA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;AAAA,GAAfA,eAAe,KAAfA,eAAe"}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["Didomi","DidomiEventType"],"sources":["index.tsx"],"sourcesContent":["export { Didomi } from './Didomi';\nexport { DidomiEventType } from './DidomiTypes';\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,eAAe,QAAQ,eAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const DIDOMI_USER_AGENT_NAME = "Didomi React-Native SDK";
|
|
2
|
-
export declare const DIDOMI_VERSION = "1.
|
|
2
|
+
export declare const DIDOMI_VERSION = "1.13.0";
|
|
@@ -13,7 +13,7 @@ export declare const Didomi: {
|
|
|
13
13
|
* @param androidTvNoticeId: Notice id for the remote configuration when running on Android TV device (ignored on iOS / tvOS). Note that using remote configuration is mandatory for TV devices.
|
|
14
14
|
* @param androidTvEnabled: Whether to allow Didomi SDK to run on Android TV, default to "false".
|
|
15
15
|
*/
|
|
16
|
-
initialize: (apiKey: string, localConfigurationPath?: string
|
|
16
|
+
initialize: (apiKey: string, localConfigurationPath?: string, remoteConfigurationUrl?: string, providerId?: string, disableDidomiRemoteConfig?: boolean, languageCode?: string, noticeId?: string, androidTvNoticeId?: string, androidTvEnabled?: boolean) => Promise<void>;
|
|
17
17
|
/**
|
|
18
18
|
* Listen to SDK ready state
|
|
19
19
|
*/
|
|
@@ -21,7 +21,7 @@ export declare const Didomi: {
|
|
|
21
21
|
/**
|
|
22
22
|
* Listen to SDK errors
|
|
23
23
|
*/
|
|
24
|
-
onError: () => Promise<
|
|
24
|
+
onError: () => Promise<void>;
|
|
25
25
|
/**
|
|
26
26
|
* Provide the objects required to display UI elements
|
|
27
27
|
*/
|
|
@@ -127,7 +127,7 @@ export declare const Didomi: {
|
|
|
127
127
|
* @param extra: Extra JavaScript to inject in the returned code
|
|
128
128
|
* @returns: JavaScript code to inject in a WebView
|
|
129
129
|
*/
|
|
130
|
-
getJavaScriptForWebView: (extra?: string | null
|
|
130
|
+
getJavaScriptForWebView: (extra?: string | null) => Promise<string>;
|
|
131
131
|
getQueryStringForWebView: () => Promise<string>;
|
|
132
132
|
/**
|
|
133
133
|
* Method used to get a Purpose based on its ID.
|
|
@@ -308,7 +308,7 @@ export declare const Didomi: {
|
|
|
308
308
|
* @param salt Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
309
309
|
* @param digest Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
310
310
|
*/
|
|
311
|
-
setUser: (id: string, algorithm?: string
|
|
311
|
+
setUser: (id: string, algorithm?: string, secretId?: string, salt?: string, digest?: string) => Promise<void>;
|
|
312
312
|
/**
|
|
313
313
|
* Set user information without authentication and check for missing consent
|
|
314
314
|
*
|
|
@@ -325,7 +325,7 @@ export declare const Didomi: {
|
|
|
325
325
|
* @param salt Salt used for computing the digest (optional)
|
|
326
326
|
* @param expiration Expiration date as timestamp (to prevent replay attacks)
|
|
327
327
|
*/
|
|
328
|
-
setUserWithHashAuth: (id: string, algorithm: string, secretId: string, digest: string, salt?: string
|
|
328
|
+
setUserWithHashAuth: (id: string, algorithm: string, secretId: string, digest: string, salt?: string, expiration?: BigInt) => void;
|
|
329
329
|
/**
|
|
330
330
|
* Set user information with Hash authentication and check for missing consent
|
|
331
331
|
*
|
|
@@ -336,7 +336,7 @@ export declare const Didomi: {
|
|
|
336
336
|
* @param salt Salt used for computing the digest (optional)
|
|
337
337
|
* @param expiration Expiration date as timestamp (to prevent replay attacks)
|
|
338
338
|
*/
|
|
339
|
-
setUserWithHashAuthAndSetupUI: (id: string, algorithm: string, secretId: string, digest: string, salt?: string
|
|
339
|
+
setUserWithHashAuthAndSetupUI: (id: string, algorithm: string, secretId: string, digest: string, salt?: string, expiration?: BigInt) => void;
|
|
340
340
|
/**
|
|
341
341
|
* Set user information with Encryption authentication
|
|
342
342
|
*
|
|
@@ -346,7 +346,7 @@ export declare const Didomi: {
|
|
|
346
346
|
* @param initializationVector Initialization Vector used for computing the user ID
|
|
347
347
|
* @param expiration Expiration date as timestamp (to prevent replay attacks)
|
|
348
348
|
*/
|
|
349
|
-
setUserWithEncryptionAuth: (id: string, algorithm: string, secretId: string, initializationVector: string, expiration?: BigInt
|
|
349
|
+
setUserWithEncryptionAuth: (id: string, algorithm: string, secretId: string, initializationVector: string, expiration?: BigInt) => void;
|
|
350
350
|
/**
|
|
351
351
|
* Set user information with Encryption authentication and check for missing consent
|
|
352
352
|
*
|
|
@@ -356,7 +356,7 @@ export declare const Didomi: {
|
|
|
356
356
|
* @param initializationVector Initialization Vector used for computing the user ID
|
|
357
357
|
* @param expiration Expiration date as timestamp (to prevent replay attacks)
|
|
358
358
|
*/
|
|
359
|
-
setUserWithEncryptionAuthAndSetupUI: (id: string, algorithm: string, secretId: string, initializationVector: string, expiration?: BigInt
|
|
359
|
+
setUserWithEncryptionAuthAndSetupUI: (id: string, algorithm: string, secretId: string, initializationVector: string, expiration?: BigInt) => void;
|
|
360
360
|
/**
|
|
361
361
|
* Show the consent notice (if required, not disabled in the config and not already displayed)
|
|
362
362
|
*/
|
|
@@ -365,7 +365,7 @@ export declare const Didomi: {
|
|
|
365
365
|
* Show the preferences screen when/if the SDK is ready. By default the purposes list will be displayed.
|
|
366
366
|
* @param view: It can be `purposes` or `vendors`
|
|
367
367
|
*/
|
|
368
|
-
showPreferences: (view?: string
|
|
368
|
+
showPreferences: (view?: string) => Promise<void>;
|
|
369
369
|
/**
|
|
370
370
|
* Remove all consents for the user
|
|
371
371
|
*/
|
|
@@ -7,6 +7,6 @@ export declare const DidomiListener: {
|
|
|
7
7
|
reset: () => void;
|
|
8
8
|
addEventListener: (eventType: DidomiEventType, callback: (data: any) => void) => void;
|
|
9
9
|
removeEventListener: (eventType: DidomiEventType, callback: (data: any) => void) => void;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
setOnReadyListener: () => Promise<void>;
|
|
11
|
+
setOnErrorListener: () => Promise<void>;
|
|
12
12
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@didomi/react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Didomi React Native SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -56,15 +56,15 @@
|
|
|
56
56
|
"@types/react": "^16.9.19",
|
|
57
57
|
"@types/react-native": "0.62.13",
|
|
58
58
|
"commitlint": "^11.0.0",
|
|
59
|
-
"eslint": "^7.
|
|
59
|
+
"eslint": "^7.32.0",
|
|
60
60
|
"eslint-config-prettier": "^7.0.0",
|
|
61
61
|
"eslint-plugin-prettier": "^3.1.3",
|
|
62
62
|
"husky": "^4.2.5",
|
|
63
|
-
"jest": "^26.
|
|
63
|
+
"jest": "^26.6.3",
|
|
64
64
|
"pod-install": "^0.1.0",
|
|
65
65
|
"prettier": "^2.0.5",
|
|
66
|
-
"react": "
|
|
67
|
-
"react-native": "0.
|
|
66
|
+
"react": "17.0.2",
|
|
67
|
+
"react-native": "0.68.5",
|
|
68
68
|
"react-native-builder-bob": "^0.18.0",
|
|
69
69
|
"release-it": "^14.2.2",
|
|
70
70
|
"typescript": "^4.1.3"
|
|
@@ -151,6 +151,5 @@
|
|
|
151
151
|
}
|
|
152
152
|
]
|
|
153
153
|
]
|
|
154
|
-
}
|
|
155
|
-
"dependencies": {}
|
|
154
|
+
}
|
|
156
155
|
}
|
|
@@ -10,11 +10,11 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.license = package["license"]
|
|
11
11
|
s.authors = package["author"]
|
|
12
12
|
|
|
13
|
-
s.platforms = { :ios => "
|
|
13
|
+
s.platforms = { :ios => "11.0", :tvos => "11.0" }
|
|
14
14
|
s.source = { :git => "https://github.com/didomi/react-native.git", :tag => "#{s.version}" }
|
|
15
15
|
|
|
16
16
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
17
|
|
|
18
18
|
s.dependency "React-Core"
|
|
19
|
-
s.dependency "Didomi-XCFramework", "1.
|
|
19
|
+
s.dependency "Didomi-XCFramework", "1.84.1"
|
|
20
20
|
end
|
package/src/Constants.ts
CHANGED
package/src/Didomi.ts
CHANGED
|
@@ -52,12 +52,20 @@ export const Didomi = {
|
|
|
52
52
|
/**
|
|
53
53
|
* Listen to SDK ready state
|
|
54
54
|
*/
|
|
55
|
-
onReady: (): Promise<void> =>
|
|
55
|
+
onReady: (): Promise<void> => {
|
|
56
|
+
var promise = DidomiListener.setOnReadyListener();
|
|
57
|
+
RNDidomi.onReady();
|
|
58
|
+
return promise;
|
|
59
|
+
},
|
|
56
60
|
|
|
57
61
|
/**
|
|
58
62
|
* Listen to SDK errors
|
|
59
63
|
*/
|
|
60
|
-
onError: (): Promise<
|
|
64
|
+
onError: (): Promise<void> => {
|
|
65
|
+
var promise = DidomiListener.setOnErrorListener();
|
|
66
|
+
RNDidomi.onError();
|
|
67
|
+
return promise;
|
|
68
|
+
},
|
|
61
69
|
|
|
62
70
|
/**
|
|
63
71
|
* Provide the objects required to display UI elements
|
package/src/DidomiListener.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NativeModules, NativeEventEmitter } from 'react-native';
|
|
1
|
+
import { NativeModules, NativeEventEmitter, EmitterSubscription } from 'react-native';
|
|
2
2
|
import { DidomiEventType } from './DidomiTypes';
|
|
3
3
|
|
|
4
4
|
const { Didomi: RNDidomi } = NativeModules;
|
|
@@ -58,32 +58,42 @@ export const DidomiListener = {
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
setOnReadyListener: (): Promise<void> => {
|
|
62
62
|
return new Promise<void>((resolve) => {
|
|
63
|
+
let subscription: EmitterSubscription;
|
|
63
64
|
const listener = (_event: any) => {
|
|
64
65
|
resolve();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
if (subscription) {
|
|
67
|
+
subscription.remove();
|
|
68
|
+
} else if ('removeListener' in DidomiListener.eventEmitter) {
|
|
69
|
+
DidomiListener.eventEmitter.removeListener(
|
|
70
|
+
InternalEventType.READY_CALLBACK,
|
|
71
|
+
listener
|
|
72
|
+
);
|
|
73
|
+
}
|
|
69
74
|
};
|
|
70
|
-
DidomiListener.eventEmitter.addListener(
|
|
75
|
+
subscription = DidomiListener.eventEmitter.addListener(
|
|
71
76
|
InternalEventType.READY_CALLBACK,
|
|
72
77
|
listener
|
|
73
78
|
);
|
|
74
79
|
});
|
|
75
80
|
},
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
return new Promise<
|
|
82
|
+
setOnErrorListener: (): Promise<void> => {
|
|
83
|
+
return new Promise<void>((resolve) => {
|
|
84
|
+
let subscription: EmitterSubscription;
|
|
79
85
|
const listener = (_event: any) => {
|
|
80
86
|
resolve(_event);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
if (subscription) {
|
|
88
|
+
subscription.remove();
|
|
89
|
+
} else if ('removeListener' in DidomiListener.eventEmitter) {
|
|
90
|
+
DidomiListener.eventEmitter.removeListener(
|
|
91
|
+
InternalEventType.ERROR_CALLBACK,
|
|
92
|
+
listener
|
|
93
|
+
);
|
|
94
|
+
}
|
|
85
95
|
};
|
|
86
|
-
DidomiListener.eventEmitter.addListener(
|
|
96
|
+
subscription = DidomiListener.eventEmitter.addListener(
|
|
87
97
|
InternalEventType.ERROR_CALLBACK,
|
|
88
98
|
listener
|
|
89
99
|
);
|