@prelude.so/react-native-sdk 0.3.3 → 0.3.5
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/CHANGELOG.md +9 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/so/prelude/reactnative/sdk/PreludeReactNativeSdkModule.kt +16 -7
- package/build/index.d.ts +20 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +20 -1
- package/build/index.js.map +1 -1
- package/ios/PreludeReactNativeSdkModule.swift +10 -10
- package/package.json +2 -2
- package/src/index.ts +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Prelude React Native SDK Change Log
|
|
4
4
|
|
|
5
|
+
## [0.3.5] - 2026-01-22
|
|
6
|
+
|
|
7
|
+
- Update native Android SDK to version 0.2.5. Adds network-bound DNS resolver for improved Silent Network Authentication (SNA) reliability.
|
|
8
|
+
|
|
9
|
+
## [0.3.4] - 2025-12-17
|
|
10
|
+
- Expose `max_retries` argument to allow for customizing the number of automatic retries for network requests
|
|
11
|
+
- Update native components to Android version 0.2.4 and iOS version 0.2.5. New defaults for timeouts and retries included
|
|
12
|
+
- Updated method documentation
|
|
13
|
+
|
|
5
14
|
## [0.3.3] - 2025-09-23
|
|
6
15
|
|
|
7
16
|
- Update native components to Android version 0.2.3 and iOS version 0.2.4 which added Silent Verification support for Bouygues
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
|
|
3
3
|
group = 'so.prelude.reactnative.sdk'
|
|
4
|
-
version = '0.2.
|
|
4
|
+
version = '0.2.5'
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -44,5 +44,5 @@ android {
|
|
|
44
44
|
|
|
45
45
|
dependencies {
|
|
46
46
|
compileOnly('com.squareup.okhttp3:okhttp:4.12.0')
|
|
47
|
-
implementation('so.prelude.android:sdk:0.2.
|
|
47
|
+
implementation('so.prelude.android:sdk:0.2.5')
|
|
48
48
|
}
|
|
@@ -16,12 +16,19 @@ class PreludeReactNativeSdkModule : Module() {
|
|
|
16
16
|
Name("PreludeReactNativeSdk")
|
|
17
17
|
|
|
18
18
|
AsyncFunction("dispatchSignals") Coroutine {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
sdkKey: String,
|
|
20
|
+
endpointUrl: String?,
|
|
21
|
+
timeoutMilliseconds: Long?,
|
|
22
|
+
implementedFeaturesRawValue: Long?,
|
|
23
|
+
maxRetries: Int?,
|
|
23
24
|
->
|
|
24
|
-
dispatchSignals(
|
|
25
|
+
dispatchSignals(
|
|
26
|
+
endpointUrl,
|
|
27
|
+
sdkKey,
|
|
28
|
+
timeoutMilliseconds ?: 10000L,
|
|
29
|
+
implementedFeaturesRawValue ?: 0L,
|
|
30
|
+
maxRetries ?: 3
|
|
31
|
+
)
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
AsyncFunction("verifySilent") Coroutine { sdkKey: String, requestUrl: String ->
|
|
@@ -35,8 +42,9 @@ class PreludeReactNativeSdkModule : Module() {
|
|
|
35
42
|
private suspend fun dispatchSignals(
|
|
36
43
|
endpointUrl: String?,
|
|
37
44
|
sdkKey: String,
|
|
38
|
-
timeoutMilliseconds: Long
|
|
45
|
+
timeoutMilliseconds: Long,
|
|
39
46
|
implementedFeaturesRawValue: Long = 0L,
|
|
47
|
+
maxRetries: Int,
|
|
40
48
|
): String {
|
|
41
49
|
val endpoint: Endpoint =
|
|
42
50
|
endpointUrl?.let {
|
|
@@ -56,8 +64,9 @@ class PreludeReactNativeSdkModule : Module() {
|
|
|
56
64
|
context = context.applicationContext,
|
|
57
65
|
sdkKey = sdkKey,
|
|
58
66
|
endpoint = endpoint,
|
|
59
|
-
requestTimeout = timeoutMilliseconds
|
|
67
|
+
requestTimeout = timeoutMilliseconds,
|
|
60
68
|
implementedFeatures = Features.fromRawValue(implementedFeaturesRawValue),
|
|
69
|
+
maxRetries = maxRetries,
|
|
61
70
|
)
|
|
62
71
|
val prelude = Prelude(config)
|
|
63
72
|
|
package/build/index.d.ts
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dispatches signals to the Prelude service.
|
|
3
|
+
*
|
|
4
|
+
* @param configuration - Configuration options for dispatching signals
|
|
5
|
+
* @param configuration.sdk_key - Your Prelude SDK key
|
|
6
|
+
* @param configuration.timeout_milliseconds - Optional timeout in milliseconds for the network requests
|
|
7
|
+
* @param configuration.implemented_features - Optional array of implemented features. Required for certain features like Silent Verification
|
|
8
|
+
* @param configuration.max_retries - Optional maximum number of automatic network retries in case of server failures
|
|
9
|
+
* @returns A promise that resolves with the dispatchId result
|
|
10
|
+
*/
|
|
1
11
|
export declare function dispatchSignals(configuration?: {
|
|
2
12
|
sdk_key: string;
|
|
3
13
|
endpoint?: string;
|
|
4
14
|
timeout_milliseconds?: number;
|
|
5
15
|
implemented_features?: Features[];
|
|
16
|
+
max_retries?: number;
|
|
6
17
|
}): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Initiates a silent verification process of the user's phone number.
|
|
20
|
+
* The signals have to be dispatched beforehand using `dispatchSignals` with the `SilentVerification` feature enabled.
|
|
21
|
+
*
|
|
22
|
+
* @param configuration - Configuration options for verification
|
|
23
|
+
* @param configuration.sdk_key - Your Prelude SDK key
|
|
24
|
+
* @param configuration.request_url - The URL to verify
|
|
25
|
+
* @returns A promise that resolves with the verification result
|
|
26
|
+
*/
|
|
7
27
|
export declare function verifySilent(configuration: {
|
|
8
28
|
sdk_key: string;
|
|
9
29
|
request_url: string;
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,wBAAsB,eAAe,CACnC,aAAa,GAAE;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,QAAQ,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,aAAa,GAAE;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACN,GAAG,OAAO,CAAC,MAAM,CAAC,CAQpC;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,aAAa,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAE3G;AAED,oBAAY,QAAQ;IAClB,kBAAkB,IAAS;CAC5B"}
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import PreludeReactNativeSdkModule from './PreludeReactNativeSdkModule';
|
|
2
|
+
/**
|
|
3
|
+
* Dispatches signals to the Prelude service.
|
|
4
|
+
*
|
|
5
|
+
* @param configuration - Configuration options for dispatching signals
|
|
6
|
+
* @param configuration.sdk_key - Your Prelude SDK key
|
|
7
|
+
* @param configuration.timeout_milliseconds - Optional timeout in milliseconds for the network requests
|
|
8
|
+
* @param configuration.implemented_features - Optional array of implemented features. Required for certain features like Silent Verification
|
|
9
|
+
* @param configuration.max_retries - Optional maximum number of automatic network retries in case of server failures
|
|
10
|
+
* @returns A promise that resolves with the dispatchId result
|
|
11
|
+
*/
|
|
2
12
|
export async function dispatchSignals(configuration = { sdk_key: '' }) {
|
|
3
|
-
return await PreludeReactNativeSdkModule.dispatchSignals(configuration.sdk_key, configuration.endpoint, configuration.timeout_milliseconds, toRawValue(configuration.implemented_features || []));
|
|
13
|
+
return await PreludeReactNativeSdkModule.dispatchSignals(configuration.sdk_key, configuration.endpoint, configuration.timeout_milliseconds, toRawValue(configuration.implemented_features || []), configuration.max_retries);
|
|
4
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Initiates a silent verification process of the user's phone number.
|
|
17
|
+
* The signals have to be dispatched beforehand using `dispatchSignals` with the `SilentVerification` feature enabled.
|
|
18
|
+
*
|
|
19
|
+
* @param configuration - Configuration options for verification
|
|
20
|
+
* @param configuration.sdk_key - Your Prelude SDK key
|
|
21
|
+
* @param configuration.request_url - The URL to verify
|
|
22
|
+
* @returns A promise that resolves with the verification result
|
|
23
|
+
*/
|
|
5
24
|
export async function verifySilent(configuration) {
|
|
6
25
|
return await PreludeReactNativeSdkModule.verifySilent(configuration.sdk_key, configuration.request_url);
|
|
7
26
|
}
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,MAAM,+BAA+B,CAAC;AAExE,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,MAAM,+BAA+B,CAAC;AAExE;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,gBAMI,EAAC,OAAO,EAAE,EAAE,EAAC;IACjB,OAAO,MAAM,2BAA2B,CAAC,eAAe,CACpD,aAAa,CAAC,OAAO,EACrB,aAAa,CAAC,QAAQ,EACtB,aAAa,CAAC,oBAAoB,EAClC,UAAU,CAAC,aAAa,CAAC,oBAAoB,IAAI,EAAE,CAAC,EACpD,aAAa,CAAC,WAAW,CAC5B,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,aAAuD;IACxF,OAAO,MAAM,2BAA2B,CAAC,YAAY,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;AAC1G,CAAC;AAED,MAAM,CAAN,IAAY,QAEX;AAFD,WAAY,QAAQ;IAClB,mEAA2B,CAAA;AAC7B,CAAC,EAFW,QAAQ,KAAR,QAAQ,QAEnB;AAED,SAAS,UAAU,CAAC,QAAoB;IACtC,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import PreludeReactNativeSdkModule from './PreludeReactNativeSdkModule';\n\n/**\n * Dispatches signals to the Prelude service.\n *\n * @param configuration - Configuration options for dispatching signals\n * @param configuration.sdk_key - Your Prelude SDK key\n * @param configuration.timeout_milliseconds - Optional timeout in milliseconds for the network requests\n * @param configuration.implemented_features - Optional array of implemented features. Required for certain features like Silent Verification\n * @param configuration.max_retries - Optional maximum number of automatic network retries in case of server failures\n * @returns A promise that resolves with the dispatchId result\n */\nexport async function dispatchSignals(\n configuration: {\n sdk_key: string;\n endpoint?: string;\n timeout_milliseconds?: number;\n implemented_features?: Features[];\n max_retries?: number;\n } = {sdk_key: ''}): Promise<string> {\n return await PreludeReactNativeSdkModule.dispatchSignals(\n configuration.sdk_key,\n configuration.endpoint,\n configuration.timeout_milliseconds,\n toRawValue(configuration.implemented_features || []),\n configuration.max_retries\n );\n}\n\n/**\n * Initiates a silent verification process of the user's phone number.\n * The signals have to be dispatched beforehand using `dispatchSignals` with the `SilentVerification` feature enabled.\n *\n * @param configuration - Configuration options for verification\n * @param configuration.sdk_key - Your Prelude SDK key\n * @param configuration.request_url - The URL to verify\n * @returns A promise that resolves with the verification result\n */\nexport async function verifySilent(configuration: { sdk_key: string, request_url: string }): Promise<string> {\n return await PreludeReactNativeSdkModule.verifySilent(configuration.sdk_key, configuration.request_url);\n}\n\nexport enum Features {\n SilentVerification = 1 << 0,\n}\n\nfunction toRawValue(features: Features[]): number {\n return features.reduce((acc, feature) => acc | feature, 0);\n}"]}
|
|
@@ -4,10 +4,10 @@ public class PreludeReactNativeSdkModule: Module {
|
|
|
4
4
|
public func definition() -> ModuleDefinition {
|
|
5
5
|
Name("PreludeReactNativeSdk")
|
|
6
6
|
|
|
7
|
-
AsyncFunction("dispatchSignals") { (sdkKey: String, endpointUrl: String?, timeoutMilliseconds: Int64?, implementedFeaturesRawValue: Int64?) in
|
|
7
|
+
AsyncFunction("dispatchSignals") { (sdkKey: String, endpointUrl: String?, timeoutMilliseconds: Int64?, implementedFeaturesRawValue: Int64?, maxRetries: Int?) in
|
|
8
8
|
let endpoint = endpointUrl != nil ? Endpoint.custom(endpointUrl!) : .default
|
|
9
|
-
let timeout = timeoutMilliseconds != nil ? TimeInterval(timeoutMilliseconds!) / 1000 :
|
|
10
|
-
|
|
9
|
+
let timeout = timeoutMilliseconds != nil ? TimeInterval(timeoutMilliseconds!) / 1000 : 10.0
|
|
10
|
+
|
|
11
11
|
let implementedFeatures: Features
|
|
12
12
|
if let rawValue = implementedFeaturesRawValue {
|
|
13
13
|
let uintRawValue = rawValue >= 0 ? rawValue : 0
|
|
@@ -15,12 +15,14 @@ public class PreludeReactNativeSdkModule: Module {
|
|
|
15
15
|
} else {
|
|
16
16
|
implementedFeatures = []
|
|
17
17
|
}
|
|
18
|
+
let maxRetries = maxRetries ?? 3
|
|
18
19
|
|
|
19
20
|
let configuration = Configuration(
|
|
20
21
|
sdkKey: sdkKey,
|
|
21
22
|
endpoint: endpoint,
|
|
22
23
|
implementedFeatures: implementedFeatures,
|
|
23
|
-
timeout: timeout
|
|
24
|
+
timeout: timeout,
|
|
25
|
+
maxRetries: maxRetries
|
|
24
26
|
)
|
|
25
27
|
|
|
26
28
|
let prelude = Prelude(configuration)
|
|
@@ -32,21 +34,19 @@ public class PreludeReactNativeSdkModule: Module {
|
|
|
32
34
|
if sdkKey.isEmpty || requestUrl.isEmpty {
|
|
33
35
|
throw Exception(name: "IllegalArguments",
|
|
34
36
|
description: "SDK Key and Request URL must both be provided.",
|
|
35
|
-
code: "ILLEGAL_ARGUMENTS_EMPTY_FIELD"
|
|
36
|
-
)
|
|
37
|
+
code: "ILLEGAL_ARGUMENTS_EMPTY_FIELD")
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
let configuration = Configuration(
|
|
40
|
-
sdkKey: sdkKey
|
|
41
|
-
|
|
41
|
+
sdkKey: sdkKey
|
|
42
|
+
)
|
|
42
43
|
|
|
43
44
|
let prelude = Prelude(configuration)
|
|
44
45
|
|
|
45
46
|
guard let url = URL(string: requestUrl) else {
|
|
46
47
|
throw Exception(name: "IllegalArguments",
|
|
47
48
|
description: "Request URL must be a valid URL.",
|
|
48
|
-
code: "ILLEGAL_ARGUMENTS_INVALID_URL"
|
|
49
|
-
)
|
|
49
|
+
code: "ILLEGAL_ARGUMENTS_INVALID_URL")
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
return try await prelude.verifySilent(url: url)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prelude.so/react-native-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Prelude SDK for React Native",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
"react-native": "*"
|
|
55
55
|
},
|
|
56
56
|
"so_prelude": {
|
|
57
|
-
"apple_sdk_tag": "0.2.
|
|
57
|
+
"apple_sdk_tag": "0.2.5"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,20 +1,41 @@
|
|
|
1
1
|
import PreludeReactNativeSdkModule from './PreludeReactNativeSdkModule';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Dispatches signals to the Prelude service.
|
|
5
|
+
*
|
|
6
|
+
* @param configuration - Configuration options for dispatching signals
|
|
7
|
+
* @param configuration.sdk_key - Your Prelude SDK key
|
|
8
|
+
* @param configuration.timeout_milliseconds - Optional timeout in milliseconds for the network requests
|
|
9
|
+
* @param configuration.implemented_features - Optional array of implemented features. Required for certain features like Silent Verification
|
|
10
|
+
* @param configuration.max_retries - Optional maximum number of automatic network retries in case of server failures
|
|
11
|
+
* @returns A promise that resolves with the dispatchId result
|
|
12
|
+
*/
|
|
3
13
|
export async function dispatchSignals(
|
|
4
14
|
configuration: {
|
|
5
15
|
sdk_key: string;
|
|
6
16
|
endpoint?: string;
|
|
7
17
|
timeout_milliseconds?: number;
|
|
8
18
|
implemented_features?: Features[];
|
|
19
|
+
max_retries?: number;
|
|
9
20
|
} = {sdk_key: ''}): Promise<string> {
|
|
10
21
|
return await PreludeReactNativeSdkModule.dispatchSignals(
|
|
11
22
|
configuration.sdk_key,
|
|
12
23
|
configuration.endpoint,
|
|
13
24
|
configuration.timeout_milliseconds,
|
|
14
25
|
toRawValue(configuration.implemented_features || []),
|
|
26
|
+
configuration.max_retries
|
|
15
27
|
);
|
|
16
28
|
}
|
|
17
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Initiates a silent verification process of the user's phone number.
|
|
32
|
+
* The signals have to be dispatched beforehand using `dispatchSignals` with the `SilentVerification` feature enabled.
|
|
33
|
+
*
|
|
34
|
+
* @param configuration - Configuration options for verification
|
|
35
|
+
* @param configuration.sdk_key - Your Prelude SDK key
|
|
36
|
+
* @param configuration.request_url - The URL to verify
|
|
37
|
+
* @returns A promise that resolves with the verification result
|
|
38
|
+
*/
|
|
18
39
|
export async function verifySilent(configuration: { sdk_key: string, request_url: string }): Promise<string> {
|
|
19
40
|
return await PreludeReactNativeSdkModule.verifySilent(configuration.sdk_key, configuration.request_url);
|
|
20
41
|
}
|