@didomi/react-native 2.7.0 → 2.9.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 +6 -6
- package/android/build.gradle +16 -12
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +3 -1
- package/android/gradle.properties +4 -4
- package/android/gradlew +28 -13
- package/android/gradlew.bat +19 -16
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/{com/reactnativedidomi → io/didomi/reactnative}/DidomiModule.kt +17 -6
- package/android/src/main/java/{com/reactnativedidomi → io/didomi/reactnative}/DidomiPackage.kt +1 -2
- package/android/src/main/java/{com/reactnativedidomi → io/didomi/reactnative}/EventTypes.kt +11 -1
- package/ios/Didomi.m +3 -0
- package/ios/RNDidomi.swift +9 -11
- package/lib/commonjs/Constants.js +1 -1
- package/lib/commonjs/Constants.js.map +1 -1
- package/lib/commonjs/CurrentUserStatusTransaction.js.map +1 -1
- package/lib/commonjs/Didomi.js +6 -1
- package/lib/commonjs/Didomi.js.map +1 -1
- package/lib/commonjs/DidomiListener.js +4 -14
- package/lib/commonjs/DidomiListener.js.map +1 -1
- package/lib/commonjs/DidomiTypes.js +34 -0
- package/lib/commonjs/DidomiTypes.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/module/Constants.js +3 -1
- package/lib/module/Constants.js.map +1 -1
- package/lib/module/CurrentUserStatusTransaction.js +2 -0
- package/lib/module/CurrentUserStatusTransaction.js.map +1 -1
- package/lib/module/Didomi.js +8 -1
- package/lib/module/Didomi.js.map +1 -1
- package/lib/module/DidomiListener.js +6 -14
- package/lib/module/DidomiListener.js.map +1 -1
- package/lib/module/DidomiTypes.js +36 -0
- package/lib/module/DidomiTypes.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/typescript/Constants.d.ts +2 -1
- package/lib/typescript/Constants.d.ts.map +1 -0
- package/lib/typescript/CurrentUserStatusTransaction.d.ts +1 -0
- package/lib/typescript/CurrentUserStatusTransaction.d.ts.map +1 -0
- package/lib/typescript/Didomi.d.ts +7 -1
- package/lib/typescript/Didomi.d.ts.map +1 -0
- package/lib/typescript/DidomiListener.d.ts +1 -0
- package/lib/typescript/DidomiListener.d.ts.map +1 -0
- package/lib/typescript/DidomiTypes.d.ts +26 -0
- package/lib/typescript/DidomiTypes.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +22 -87
- package/react-native-didomi.podspec +1 -1
- package/src/Constants.ts +1 -1
- package/src/Didomi.ts +7 -1
- package/src/DidomiListener.ts +5 -21
- package/src/DidomiTypes.ts +26 -2
package/README.md
CHANGED
|
@@ -75,19 +75,19 @@ For complete instructions on installing and using the plugin, please read our do
|
|
|
75
75
|
|
|
76
76
|
## Example applications
|
|
77
77
|
|
|
78
|
-
Sources contain 2 applications: ``/
|
|
78
|
+
Sources contain 2 applications: ``/test`` (an app designed mostly for UI testing ) and ``/sample`` (more human friendly app).
|
|
79
79
|
|
|
80
80
|
They can be run with:
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
|
-
#
|
|
84
|
-
cd
|
|
83
|
+
# test or sample Application
|
|
84
|
+
cd sample
|
|
85
85
|
cd ios && pod install
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
cd ..
|
|
87
|
+
npx react-native run-ios
|
|
88
|
+
# or npx react-native run-android
|
|
88
89
|
```
|
|
89
90
|
|
|
90
|
-
|
|
91
91
|
## Suggesting improvements
|
|
92
92
|
|
|
93
93
|
To file bugs, make feature requests, or to suggest other improvements, please use [Github's issue tracker](https://github.com/didomi/reat-native/issues).
|
package/android/build.gradle
CHANGED
|
@@ -5,13 +5,12 @@ buildscript {
|
|
|
5
5
|
def kotlin_version = project.properties["Didomi_kotlinVersion"]
|
|
6
6
|
|
|
7
7
|
repositories {
|
|
8
|
-
mavenCentral()
|
|
9
8
|
google()
|
|
9
|
+
mavenCentral()
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
dependencies {
|
|
13
|
-
classpath "com.android.tools.build:gradle:
|
|
14
|
-
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "com.android.tools.build:gradle:8.5.2"
|
|
15
14
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
16
15
|
}
|
|
17
16
|
}
|
|
@@ -30,13 +29,12 @@ def getExtOrIntegerDefault(name) {
|
|
|
30
29
|
def parsedPackage = new JsonSlurper().parseText(file("../package.json").text)
|
|
31
30
|
|
|
32
31
|
android {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
namespace "com.reactnativedidomi"
|
|
32
|
+
compileSdk getExtOrIntegerDefault("compileSdkVersion")
|
|
33
|
+
namespace "io.didomi.reactnative"
|
|
36
34
|
|
|
37
35
|
defaultConfig {
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
minSdk getExtOrIntegerDefault("minSdkVersion")
|
|
37
|
+
targetSdk getExtOrIntegerDefault("targetSdkVersion")
|
|
40
38
|
versionCode 1
|
|
41
39
|
versionName "${parsedPackage.version}"
|
|
42
40
|
|
|
@@ -52,14 +50,20 @@ android {
|
|
|
52
50
|
disable "GradleCompatible"
|
|
53
51
|
}
|
|
54
52
|
compileOptions {
|
|
55
|
-
sourceCompatibility JavaVersion.
|
|
56
|
-
targetCompatibility JavaVersion.
|
|
53
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
54
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
kotlinOptions {
|
|
58
|
+
jvmTarget = JavaVersion.VERSION_17
|
|
57
59
|
}
|
|
60
|
+
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
repositories {
|
|
61
|
-
mavenCentral()
|
|
62
64
|
google()
|
|
65
|
+
mavenLocal()
|
|
66
|
+
mavenCentral()
|
|
63
67
|
|
|
64
68
|
def found = false
|
|
65
69
|
def defaultDir = null
|
|
@@ -126,5 +130,5 @@ dependencies {
|
|
|
126
130
|
|
|
127
131
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
128
132
|
|
|
129
|
-
implementation "io.didomi.sdk:android:2.
|
|
133
|
+
implementation "io.didomi.sdk:android:2.18.0"
|
|
130
134
|
}
|
|
Binary file
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
|
|
4
|
+
networkTimeout=10000
|
|
5
|
+
validateDistributionUrl=true
|
|
4
6
|
zipStoreBase=GRADLE_USER_HOME
|
|
5
7
|
zipStorePath=wrapper/dists
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Didomi_kotlinVersion=1.
|
|
1
|
+
Didomi_kotlinVersion=1.9.24
|
|
2
2
|
|
|
3
|
-
Didomi_buildToolsVersion=
|
|
4
|
-
Didomi_compileSdkVersion=
|
|
3
|
+
Didomi_buildToolsVersion=34.0.0
|
|
4
|
+
Didomi_compileSdkVersion=34
|
|
5
5
|
Didomi_minSdkVersion=21
|
|
6
|
-
Didomi_targetSdkVersion=
|
|
6
|
+
Didomi_targetSdkVersion=34
|
package/android/gradlew
CHANGED
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
# Darwin, MinGW, and NonStop.
|
|
56
56
|
#
|
|
57
57
|
# (3) This script is generated from the Groovy template
|
|
58
|
-
# https://github.com/gradle/gradle/blob/
|
|
58
|
+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
59
59
|
# within the Gradle project.
|
|
60
60
|
#
|
|
61
61
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
@@ -80,13 +80,11 @@ do
|
|
|
80
80
|
esac
|
|
81
81
|
done
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
APP_NAME="Gradle"
|
|
83
|
+
# This is normally unused
|
|
84
|
+
# shellcheck disable=SC2034
|
|
86
85
|
APP_BASE_NAME=${0##*/}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
86
|
+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
|
87
|
+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
|
90
88
|
|
|
91
89
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
92
90
|
MAX_FD=maximum
|
|
@@ -133,22 +131,29 @@ location of your Java installation."
|
|
|
133
131
|
fi
|
|
134
132
|
else
|
|
135
133
|
JAVACMD=java
|
|
136
|
-
|
|
134
|
+
if ! command -v java >/dev/null 2>&1
|
|
135
|
+
then
|
|
136
|
+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
137
137
|
|
|
138
138
|
Please set the JAVA_HOME variable in your environment to match the
|
|
139
139
|
location of your Java installation."
|
|
140
|
+
fi
|
|
140
141
|
fi
|
|
141
142
|
|
|
142
143
|
# Increase the maximum file descriptors if we can.
|
|
143
144
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
144
145
|
case $MAX_FD in #(
|
|
145
146
|
max*)
|
|
147
|
+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
|
148
|
+
# shellcheck disable=SC2039,SC3045
|
|
146
149
|
MAX_FD=$( ulimit -H -n ) ||
|
|
147
150
|
warn "Could not query maximum file descriptor limit"
|
|
148
151
|
esac
|
|
149
152
|
case $MAX_FD in #(
|
|
150
153
|
'' | soft) :;; #(
|
|
151
154
|
*)
|
|
155
|
+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
|
156
|
+
# shellcheck disable=SC2039,SC3045
|
|
152
157
|
ulimit -n "$MAX_FD" ||
|
|
153
158
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
154
159
|
esac
|
|
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
|
|
193
198
|
done
|
|
194
199
|
fi
|
|
195
200
|
|
|
196
|
-
|
|
197
|
-
#
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
#
|
|
201
|
+
|
|
202
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
203
|
+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
204
|
+
|
|
205
|
+
# Collect all arguments for the java command:
|
|
206
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
|
207
|
+
# and any embedded shellness will be escaped.
|
|
208
|
+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
|
209
|
+
# treated as '${Hostname}' itself on the command line.
|
|
201
210
|
|
|
202
211
|
set -- \
|
|
203
212
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
|
@@ -205,6 +214,12 @@ set -- \
|
|
|
205
214
|
org.gradle.wrapper.GradleWrapperMain \
|
|
206
215
|
"$@"
|
|
207
216
|
|
|
217
|
+
# Stop when "xargs" is not available.
|
|
218
|
+
if ! command -v xargs >/dev/null 2>&1
|
|
219
|
+
then
|
|
220
|
+
die "xargs is not available"
|
|
221
|
+
fi
|
|
222
|
+
|
|
208
223
|
# Use "xargs" to parse quoted args.
|
|
209
224
|
#
|
|
210
225
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
package/android/gradlew.bat
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
@rem limitations under the License.
|
|
15
15
|
@rem
|
|
16
16
|
|
|
17
|
-
@if "%DEBUG%"
|
|
17
|
+
@if "%DEBUG%"=="" @echo off
|
|
18
18
|
@rem ##########################################################################
|
|
19
19
|
@rem
|
|
20
20
|
@rem Gradle startup script for Windows
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
if "%OS%"=="Windows_NT" setlocal
|
|
26
26
|
|
|
27
27
|
set DIRNAME=%~dp0
|
|
28
|
-
if "%DIRNAME%"
|
|
28
|
+
if "%DIRNAME%"=="" set DIRNAME=.
|
|
29
|
+
@rem This is normally unused
|
|
29
30
|
set APP_BASE_NAME=%~n0
|
|
30
31
|
set APP_HOME=%DIRNAME%
|
|
31
32
|
|
|
@@ -40,13 +41,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|
|
40
41
|
|
|
41
42
|
set JAVA_EXE=java.exe
|
|
42
43
|
%JAVA_EXE% -version >NUL 2>&1
|
|
43
|
-
if
|
|
44
|
+
if %ERRORLEVEL% equ 0 goto execute
|
|
44
45
|
|
|
45
|
-
echo.
|
|
46
|
-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
47
|
-
echo.
|
|
48
|
-
echo Please set the JAVA_HOME variable in your environment to match the
|
|
49
|
-
echo location of your Java installation.
|
|
46
|
+
echo. 1>&2
|
|
47
|
+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
|
48
|
+
echo. 1>&2
|
|
49
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
50
|
+
echo location of your Java installation. 1>&2
|
|
50
51
|
|
|
51
52
|
goto fail
|
|
52
53
|
|
|
@@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
|
56
57
|
|
|
57
58
|
if exist "%JAVA_EXE%" goto execute
|
|
58
59
|
|
|
59
|
-
echo.
|
|
60
|
-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
61
|
-
echo.
|
|
62
|
-
echo Please set the JAVA_HOME variable in your environment to match the
|
|
63
|
-
echo location of your Java installation.
|
|
60
|
+
echo. 1>&2
|
|
61
|
+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
|
62
|
+
echo. 1>&2
|
|
63
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
64
|
+
echo location of your Java installation. 1>&2
|
|
64
65
|
|
|
65
66
|
goto fail
|
|
66
67
|
|
|
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
|
75
76
|
|
|
76
77
|
:end
|
|
77
78
|
@rem End local scope for the variables with windows NT shell
|
|
78
|
-
if
|
|
79
|
+
if %ERRORLEVEL% equ 0 goto mainEnd
|
|
79
80
|
|
|
80
81
|
:fail
|
|
81
82
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
82
83
|
rem the _cmd.exe /c_ return code!
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
set EXIT_CODE=%ERRORLEVEL%
|
|
85
|
+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
|
86
|
+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
87
|
+
exit /b %EXIT_CODE%
|
|
85
88
|
|
|
86
89
|
:mainEnd
|
|
87
90
|
if "%OS%"=="Windows_NT" endlocal
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
<manifest
|
|
2
|
-
package="com.reactnativedidomi"/>
|
|
1
|
+
<manifest />
|
package/android/src/main/java/{com/reactnativedidomi → io/didomi/reactnative}/DidomiModule.kt
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
@file:Suppress("unused")
|
|
2
|
-
|
|
3
|
-
package com.reactnativedidomi
|
|
2
|
+
package io.didomi.reactnative
|
|
4
3
|
|
|
5
4
|
import android.util.Log
|
|
6
5
|
import androidx.fragment.app.FragmentActivity
|
|
@@ -15,9 +14,9 @@ import io.didomi.sdk.DidomiInitializeParameters
|
|
|
15
14
|
import io.didomi.sdk.events.*
|
|
16
15
|
import io.didomi.sdk.exceptions.DidomiNotReadyException
|
|
17
16
|
import io.didomi.sdk.models.CurrentUserStatus
|
|
18
|
-
import io.didomi.sdk.user.UserAuthParams
|
|
19
|
-
import io.didomi.sdk.user.UserAuthWithEncryptionParams
|
|
20
|
-
import io.didomi.sdk.user.UserAuthWithHashParams
|
|
17
|
+
import io.didomi.sdk.user.model.UserAuthParams
|
|
18
|
+
import io.didomi.sdk.user.model.UserAuthWithEncryptionParams
|
|
19
|
+
import io.didomi.sdk.user.model.UserAuthWithHashParams
|
|
21
20
|
import org.json.JSONArray
|
|
22
21
|
import org.json.JSONException
|
|
23
22
|
import org.json.JSONObject
|
|
@@ -309,6 +308,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
309
308
|
map.putArray(entry.key, Arguments.makeNativeArray(listValues))
|
|
310
309
|
}
|
|
311
310
|
}
|
|
311
|
+
|
|
312
312
|
is Boolean -> map.putBoolean(entry.key, value)
|
|
313
313
|
is Int -> map.putInt(entry.key, value)
|
|
314
314
|
is Double -> map.putDouble(entry.key, value)
|
|
@@ -551,6 +551,15 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
+
@ReactMethod
|
|
555
|
+
fun getApplicableRegulation(promise: Promise) {
|
|
556
|
+
try {
|
|
557
|
+
promise.resolve(Didomi.getInstance().applicableRegulation.value)
|
|
558
|
+
} catch (e: DidomiNotReadyException) {
|
|
559
|
+
promise.reject(e)
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
554
563
|
@ReactMethod
|
|
555
564
|
fun hideNotice(promise: Promise) {
|
|
556
565
|
try {
|
|
@@ -590,6 +599,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
590
599
|
}
|
|
591
600
|
|
|
592
601
|
@ReactMethod
|
|
602
|
+
@Deprecated("Use shouldUserStatusBeCollected instead", replaceWith = ReplaceWith("shouldUserStatusBeCollected()"))
|
|
593
603
|
fun isUserConsentStatusPartial(promise: Promise) {
|
|
594
604
|
try {
|
|
595
605
|
promise.resolve(Didomi.getInstance().isUserConsentStatusPartial)
|
|
@@ -1084,7 +1094,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
1084
1094
|
syncAcknowledgedCallbacks.remove(callbackIndex)
|
|
1085
1095
|
if (result != null) {
|
|
1086
1096
|
promise.resolve(result)
|
|
1087
|
-
} else
|
|
1097
|
+
} else {
|
|
1088
1098
|
promise.reject(java.lang.IllegalStateException("SyncAcknowledged: Native callback not found. The method can be called only once."))
|
|
1089
1099
|
}
|
|
1090
1100
|
}
|
|
@@ -1108,6 +1118,7 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
|
|
|
1108
1118
|
val callbackIndex = syncAcknowledgedCallbackIndex++
|
|
1109
1119
|
syncAcknowledgedCallbacks[callbackIndex] = event.syncAcknowledged
|
|
1110
1120
|
val params = WritableNativeMap().apply {
|
|
1121
|
+
putString("organizationUserId", event.organizationUserId)
|
|
1111
1122
|
putBoolean("statusApplied", event.statusApplied)
|
|
1112
1123
|
putInt("syncAcknowledgedIndex", callbackIndex)
|
|
1113
1124
|
}
|
package/android/src/main/java/{com/reactnativedidomi → io/didomi/reactnative}/DidomiPackage.kt
RENAMED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
package
|
|
1
|
+
package io.didomi.reactnative
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.ReactPackage
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.uimanager.ViewManager
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
class DidomiPackage : ReactPackage {
|
|
10
9
|
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
11
10
|
return listOf(DidomiModule(reactContext))
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
package
|
|
1
|
+
package io.didomi.reactnative
|
|
2
2
|
|
|
3
3
|
enum class EventTypes(val event: String) {
|
|
4
4
|
// Consent
|
|
5
5
|
CONSENT_CHANGED("on_consent_changed"),
|
|
6
|
+
|
|
6
7
|
// SDK lifecycle events
|
|
7
8
|
ERROR("on_error"),
|
|
8
9
|
ERROR_CALLBACK("on_error_callback"),
|
|
9
10
|
READY("on_ready"),
|
|
10
11
|
READY_CALLBACK("on_ready_callback"),
|
|
12
|
+
|
|
11
13
|
// Notice
|
|
12
14
|
HIDE_NOTICE("on_hide_notice"),
|
|
13
15
|
SHOW_NOTICE("on_show_notice"),
|
|
@@ -17,13 +19,16 @@ enum class EventTypes(val event: String) {
|
|
|
17
19
|
NOTICE_CLICK_VIEW_SPI_PURPOSES("on_notice_click_view_spi_purposes"),
|
|
18
20
|
NOTICE_CLICK_MORE_INFO("on_notice_click_more_info"),
|
|
19
21
|
NOTICE_CLICK_PRIVACY_POLICY("on_notice_click_privacy_policy"),
|
|
22
|
+
|
|
20
23
|
// Preferences
|
|
21
24
|
HIDE_PREFERENCES("on_hide_preferences"),
|
|
22
25
|
SHOW_PREFERENCES("on_show_preferences"),
|
|
26
|
+
|
|
23
27
|
// Preferences - Views
|
|
24
28
|
PREFERENCES_CLICK_VIEW_PURPOSES("on_preferences_click_view_purposes"),
|
|
25
29
|
PREFERENCES_CLICK_VIEW_VENDORS("on_preferences_click_view_vendors"),
|
|
26
30
|
PREFERENCES_CLICK_VIEW_SPI_PURPOSES("on_preferences_click_view_spi_purposes"),
|
|
31
|
+
|
|
27
32
|
// Preferences - Purpose
|
|
28
33
|
PREFERENCES_CLICK_AGREE_TO_ALL("on_preferences_click_agree_to_all"),
|
|
29
34
|
PREFERENCES_CLICK_DISAGREE_TO_ALL("on_preferences_click_disagree_to_all"),
|
|
@@ -35,25 +40,30 @@ enum class EventTypes(val event: String) {
|
|
|
35
40
|
PREFERENCES_CLICK_CATEGORY_AGREE("on_preferences_click_category_agree"),
|
|
36
41
|
PREFERENCES_CLICK_CATEGORY_DISAGREE("on_preferences_click_category_disagree"),
|
|
37
42
|
PREFERENCES_CLICK_SAVE_CHOICES("on_preferences_click_save_choices"),
|
|
43
|
+
|
|
38
44
|
// Preferences - Vendor
|
|
39
45
|
PREFERENCES_CLICK_AGREE_TO_ALL_VENDORS("on_preferences_click_agree_to_all_vendors"),
|
|
40
46
|
PREFERENCES_CLICK_DISAGREE_TO_ALL_VENDORS("on_preferences_click_disagree_to_all_vendors"),
|
|
41
47
|
PREFERENCES_CLICK_VENDOR_AGREE("on_preferences_click_vendor_agree"),
|
|
42
48
|
PREFERENCES_CLICK_VENDOR_DISAGREE("on_preferences_click_vendor_disagree"),
|
|
43
49
|
PREFERENCES_CLICK_VENDOR_SAVE_CHOICES("on_preferences_click_vendor_save_choices"),
|
|
50
|
+
|
|
44
51
|
// Preferences - Sensitive Personal Information
|
|
45
52
|
PREFERENCES_CLICK_SPI_PURPOSE_AGREE("on_preferences_click_spi_purpose_agree"),
|
|
46
53
|
PREFERENCES_CLICK_SPI_PURPOSE_DISAGREE("on_preferences_click_spi_purpose_disagree"),
|
|
47
54
|
PREFERENCES_CLICK_SPI_CATEGORY_AGREE("on_preferences_click_spi_category_agree"),
|
|
48
55
|
PREFERENCES_CLICK_SPI_CATEGORY_DISAGREE("on_preferences_click_spi_category_disagree"),
|
|
49
56
|
PREFERENCES_CLICK_SPI_PURPOSE_SAVE_CHOICES("on_preferences_click_spi_purpose_save_choices"),
|
|
57
|
+
|
|
50
58
|
// Sync
|
|
51
59
|
SYNC_DONE("on_sync_done"),
|
|
52
60
|
SYNC_READY("on_sync_ready"),
|
|
53
61
|
SYNC_ERROR("on_sync_error"),
|
|
62
|
+
|
|
54
63
|
// Language
|
|
55
64
|
LANGUAGE_UPDATED("on_language_updated"),
|
|
56
65
|
LANGUAGE_UPDATE_FAILED("on_language_update_failed"),
|
|
66
|
+
|
|
57
67
|
// Vendor Status
|
|
58
68
|
VENDOR_STATUS_CHANGE_PREFIX("on_vendor_status_change_");
|
|
59
69
|
}
|
package/ios/Didomi.m
CHANGED
|
@@ -53,6 +53,9 @@ RCT_EXTERN_METHOD(getCurrentUserStatus:(RCTPromiseResolveBlock)resolve
|
|
|
53
53
|
RCT_EXTERN_METHOD(getUserStatus:(RCTPromiseResolveBlock)resolve
|
|
54
54
|
reject:(RCTPromiseRejectBlock)reject)
|
|
55
55
|
|
|
56
|
+
RCT_EXTERN_METHOD(getApplicableRegulation:(RCTPromiseResolveBlock)resolve
|
|
57
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
58
|
+
|
|
56
59
|
RCT_EXTERN_METHOD(setCurrentUserStatus:(NSString *)currentUserStatusAsString
|
|
57
60
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
58
61
|
reject:(RCTPromiseRejectBlock)reject)
|
package/ios/RNDidomi.swift
CHANGED
|
@@ -104,6 +104,11 @@ class RNDidomi: RCTEventEmitter {
|
|
|
104
104
|
let userStatus = try? JSONSerialization.jsonObject(with: encoder.encode(Didomi.shared.getUserStatus())) as? [String: Any]
|
|
105
105
|
resolve(userStatus)
|
|
106
106
|
}
|
|
107
|
+
|
|
108
|
+
@objc(getApplicableRegulation:reject:)
|
|
109
|
+
func getApplicableRegulation(resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) {
|
|
110
|
+
resolve(Didomi.shared.applicableRegulation.description)
|
|
111
|
+
}
|
|
107
112
|
|
|
108
113
|
@objc(setCurrentUserStatus:resolve:reject:)
|
|
109
114
|
func setCurrentUserStatus(currentUserStatusAsString: String, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) {
|
|
@@ -269,18 +274,10 @@ class RNDidomi: RCTEventEmitter {
|
|
|
269
274
|
|
|
270
275
|
@objc(showPreferences:resolve:reject:)
|
|
271
276
|
dynamic func showPreferences(view: String?, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) {
|
|
272
|
-
|
|
273
|
-
|
|
277
|
+
DispatchQueue.main.async {
|
|
278
|
+
if let containerController = RCTPresentedViewController() {
|
|
274
279
|
if let view = view {
|
|
275
|
-
|
|
276
|
-
switch view.lowercased() {
|
|
277
|
-
case "sensitive-personal-information":
|
|
278
|
-
preferencesView = .sensitivePersonalInformation
|
|
279
|
-
case "vendors":
|
|
280
|
-
preferencesView = .vendors
|
|
281
|
-
default:
|
|
282
|
-
preferencesView = .purposes
|
|
283
|
-
}
|
|
280
|
+
let preferencesView: Didomi.Views = view.lowercased() == "vendors" ? .vendors : .purposes
|
|
284
281
|
Didomi.shared.showPreferences(controller: containerController, view: preferencesView)
|
|
285
282
|
} else {
|
|
286
283
|
Didomi.shared.showPreferences(controller: containerController)
|
|
@@ -841,6 +838,7 @@ extension RNDidomi {
|
|
|
841
838
|
self?.syncAcknowledgedCallbackIndex += 1
|
|
842
839
|
self?.syncAcknowledgedCallbacks[callbackIndex] = event.syncAcknowledged
|
|
843
840
|
let result = [
|
|
841
|
+
"organizationUserId": event.organizationUserId,
|
|
844
842
|
"statusApplied": event.statusApplied,
|
|
845
843
|
"syncAcknowledgedIndex": callbackIndex
|
|
846
844
|
]
|
|
@@ -7,5 +7,5 @@ exports.DIDOMI_VERSION = exports.DIDOMI_USER_AGENT_NAME = void 0;
|
|
|
7
7
|
// User agent name
|
|
8
8
|
const DIDOMI_USER_AGENT_NAME = exports.DIDOMI_USER_AGENT_NAME = "Didomi React-Native SDK";
|
|
9
9
|
// User agent version
|
|
10
|
-
const DIDOMI_VERSION = exports.DIDOMI_VERSION = "2.
|
|
10
|
+
const DIDOMI_VERSION = exports.DIDOMI_VERSION = "2.9.0";
|
|
11
11
|
//# sourceMappingURL=Constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DIDOMI_USER_AGENT_NAME","exports","DIDOMI_VERSION"],"
|
|
1
|
+
{"version":3,"names":["DIDOMI_USER_AGENT_NAME","exports","DIDOMI_VERSION"],"sourceRoot":"../../src","sources":["Constants.ts"],"mappings":";;;;;;AAAA;AACO,MAAMA,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,yBAAyB;AAC/D;AACO,MAAME,cAAc,GAAAD,OAAA,CAAAC,cAAA,GAAG,OAAO","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createCurrentUserStatusTransaction","nativeCallback","purposesStatus","vendorsStatus","enablePurposes","ids","forEach","enablePurpose","transaction","id","enabled","enableVendors","enableVendor","disablePurposes","disablePurpose","disableVendors","disableVendor","commit","vendorIdsFromStatus","getIdsFromStatus","purposeIdsFromStatus","result","disabled","exports","status","keys","Object","key","value","push"],"
|
|
1
|
+
{"version":3,"names":["createCurrentUserStatusTransaction","nativeCallback","purposesStatus","vendorsStatus","enablePurposes","ids","forEach","enablePurpose","transaction","id","enabled","enableVendors","enableVendor","disablePurposes","disablePurpose","disableVendors","disableVendor","commit","vendorIdsFromStatus","getIdsFromStatus","purposeIdsFromStatus","result","disabled","exports","status","keys","Object","key","value","push"],"sourceRoot":"../../src","sources":["CurrentUserStatusTransaction.ts"],"mappings":";;;;;;AAEA;;AA+BA;;AAMA;;AAQA;AACA;AACO,MAAMA,kCAAkC,GAAIC,cAA8B,IAAmC;EAElH;EACA,IAAIC,cAAgD,GAAG,CAAC,CAAC;EACzD,IAAIC,aAA8C,GAAG,CAAC,CAAC;EAEvD,MAAMC,cAAc,GAAIC,GAAa,IAAmC;IACtEA,GAAG,CAACC,OAAO,CAACC,aAAa,CAAC;IAC1B,OAAOC,WAAW;EACpB,CAAC;EAED,MAAMD,aAAa,GAAIE,EAAU,IAAmC;IAClEP,cAAc,CAACO,EAAE,CAAC,GAAG;MAAEA,EAAE;MAAEC,OAAO,EAAE;IAAK,CAAC;IAC1C,OAAOF,WAAW;EACpB,CAAC;EAED,MAAMG,aAAa,GAAIN,GAAa,IAAmC;IACrEA,GAAG,CAACC,OAAO,CAACM,YAAY,CAAC;IACzB,OAAOJ,WAAW;EACpB,CAAC;EAED,MAAMI,YAAY,GAAIH,EAAU,IAAmC;IACjEN,aAAa,CAACM,EAAE,CAAC,GAAG;MAAEA,EAAE;MAAEC,OAAO,EAAE;IAAK,CAAC;IACzC,OAAOF,WAAW;EACpB,CAAC;EAED,MAAMK,eAAe,GAAIR,GAAa,IAAmC;IACvEA,GAAG,CAACC,OAAO,CAACQ,cAAc,CAAC;IAC3B,OAAON,WAAW;EACpB,CAAC;EAED,MAAMM,cAAc,GAAIL,EAAU,IAAmC;IACnEP,cAAc,CAACO,EAAE,CAAC,GAAG;MAAEA,EAAE;MAAEC,OAAO,EAAE;IAAM,CAAC;IAC3C,OAAOF,WAAW;EACpB,CAAC;EAED,MAAMO,cAAc,GAAIV,GAAa,IAAK;IACxCA,GAAG,CAACC,OAAO,CAACU,aAAa,CAAC;IAC1B,OAAOR,WAAW;EACpB,CAAC;EAED,MAAMQ,aAAa,GAAIP,EAAU,IAAmC;IAClEN,aAAa,CAACM,EAAE,CAAC,GAAG;MAAEA,EAAE;MAAEC,OAAO,EAAE;IAAM,CAAC;IAC1C,OAAOF,WAAW;EACpB,CAAC;EAED,MAAMS,MAAM,GAAGA,CAAA,KAAwB;IACrC,MAAMC,mBAAmB,GAAGC,gBAAgB,CAAChB,aAAa,CAAC;IAC3D,MAAMiB,oBAAoB,GAAGD,gBAAgB,CAACjB,cAAc,CAAC;IAE7D,MAAMmB,MAAM,GAAGpB,cAAc,CAC3BmB,oBAAoB,CAACV,OAAO,EAC5BU,oBAAoB,CAACE,QAAQ,EAC7BJ,mBAAmB,CAACR,OAAO,EAC3BQ,mBAAmB,CAACI,QACtB,CAAC;IAED,OAAOD,MAAM;EACf,CAAC;EAED,MAAMb,WAAyC,GAAG;IAChDD,aAAa;IACbH,cAAc;IACdQ,YAAY;IACZD,aAAa;IACbG,cAAc;IACdD,eAAe;IACfG,aAAa;IACbD,cAAc;IACdE;EACF,CAAC;EAED,OAAOT,WAAW;AACpB,CAAC;;AAED;AAAAe,OAAA,CAAAvB,kCAAA,GAAAA,kCAAA;AACA,MAAMmB,gBAAgB,GAAIK,MAA0E,IAAgB;EAClH,IAAId,OAAiB,GAAG,EAAE;EAC1B,IAAIY,QAAkB,GAAG,EAAE;EAC3B,MAAMG,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACD,MAAM,CAAC;EAChCC,IAAI,CAACnB,OAAO,CAAEqB,GAAG,IAAK;IACpB,MAAMC,KAAK,GAAGJ,MAAM,CAACG,GAAG,CAAC;IACzB,IAAIC,KAAK,CAAClB,OAAO,EAAE;MACjBA,OAAO,CAACmB,IAAI,CAACF,GAAG,CAAC;IACnB,CAAC,MAAM;MACLL,QAAQ,CAACO,IAAI,CAACF,GAAG,CAAC;IACpB;EACF,CAAC,CAAC;EAEF,OAAO;IAAEjB,OAAO;IAAEY;EAAS,CAAC;AAC9B,CAAC","ignoreList":[]}
|
package/lib/commonjs/Didomi.js
CHANGED
|
@@ -287,6 +287,11 @@ const Didomi = exports.Didomi = {
|
|
|
287
287
|
* getUserStatus().vendors.global.disabled.
|
|
288
288
|
*/
|
|
289
289
|
getUserStatusForVendor: vendorId => RNDidomi.getUserStatusForVendor(vendorId),
|
|
290
|
+
/**
|
|
291
|
+
* Determine the regulation applicable for the user.
|
|
292
|
+
* @returns: the regulation applicable for the current user. If no regulation is applicable, will return "none".
|
|
293
|
+
*/
|
|
294
|
+
getApplicableRegulation: () => RNDidomi.getApplicableRegulation(),
|
|
290
295
|
/**
|
|
291
296
|
* Method used to get a Vendor based on its ID.
|
|
292
297
|
* @param vendorId: vendor ID used in the search.
|
|
@@ -465,7 +470,7 @@ const Didomi = exports.Didomi = {
|
|
|
465
470
|
showNotice: () => RNDidomi.showNotice(),
|
|
466
471
|
/**
|
|
467
472
|
* Show the preferences screen when/if the SDK is ready. By default the purposes list will be displayed.
|
|
468
|
-
* @param view: It can be `purposes
|
|
473
|
+
* @param view: It can be `purposes` or `vendors`. Note: `sensitive-personal-information` is deprecated and should not be used, as SPI purposes are now displayed in the `purposes` screen.
|
|
469
474
|
*/
|
|
470
475
|
showPreferences: view => RNDidomi.showPreferences(view),
|
|
471
476
|
/**
|