@reclaimprotocol/inapp-rn-sdk 0.7.2 → 0.8.3
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/InappRnSdk.podspec +1 -1
- package/README.md +7 -6
- package/android/build.gradle +1 -1
- package/android/generated/java/com/reclaimprotocol/inapp_rn_sdk/NativeInappRnSdkSpec.java +4 -0
- package/android/generated/jni/RNInappRnSdkSpec-generated.cpp +6 -0
- package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI-generated.cpp +7 -0
- package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI.h +95 -22
- package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/InappRnSdkModule.kt +44 -9
- package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/JsonExtension.kt +18 -0
- package/ios/InappRnSdk.mm +266 -138
- package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec-generated.mm +13 -0
- package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec.h +45 -10
- package/ios/generated/RNInappRnSdkSpecJSI-generated.cpp +7 -0
- package/ios/generated/RNInappRnSdkSpecJSI.h +95 -22
- package/ios/inapp_rn_sdk/Api.swift +322 -154
- package/lib/commonjs/index.js +36 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeInappRnSdk.js.map +1 -1
- package/lib/module/index.js +36 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeInappRnSdk.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +18 -2
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts +22 -2
- package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts.map +1 -1
- package/lib/typescript/commonjs/user-workspace/src/App.d.ts +2 -0
- package/lib/typescript/commonjs/user-workspace/src/App.d.ts.map +1 -0
- package/lib/typescript/commonjs/user-workspace/src/App.overrides.d.ts +2 -0
- package/lib/typescript/commonjs/user-workspace/src/App.overrides.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +18 -2
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts +22 -2
- package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts.map +1 -1
- package/lib/typescript/module/user-workspace/src/App.d.ts +2 -0
- package/lib/typescript/module/user-workspace/src/App.d.ts.map +1 -0
- package/lib/typescript/module/user-workspace/src/App.overrides.d.ts +2 -0
- package/lib/typescript/module/user-workspace/src/App.overrides.d.ts.map +1 -0
- package/package.json +8 -7
- package/src/index.ts +59 -3
- package/src/specs/NativeInappRnSdk.ts +24 -2
package/InappRnSdk.podspec
CHANGED
|
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
|
|
18
18
|
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
|
|
19
19
|
s.private_header_files = "ios/generated/**/*.h"
|
|
20
|
-
s.dependency "ReclaimInAppSdk", "~> 0.
|
|
20
|
+
s.dependency "ReclaimInAppSdk", "~> 0.8.3"
|
|
21
21
|
|
|
22
22
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
23
23
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
package/README.md
CHANGED
|
@@ -110,13 +110,13 @@ Ignore if you already have this declaration in your `Podfile`.
|
|
|
110
110
|
|
|
111
111
|
```ruby
|
|
112
112
|
# Cocoapods is the recommended way to install the SDK.
|
|
113
|
-
pod 'ReclaimInAppSdk', '~> 0.
|
|
113
|
+
pod 'ReclaimInAppSdk', '~> 0.8.3'
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
##### From a specific tag
|
|
117
117
|
|
|
118
118
|
```ruby
|
|
119
|
-
pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :tag => '0.
|
|
119
|
+
pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :tag => '0.8.3'
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
##### From git HEAD
|
|
@@ -153,7 +153,7 @@ target 'InappRnSdkExample' do
|
|
|
153
153
|
)
|
|
154
154
|
|
|
155
155
|
# This is the line that you may need to add in your podfile.
|
|
156
|
-
pod 'ReclaimInAppSdk', '~> 0.
|
|
156
|
+
pod 'ReclaimInAppSdk', '~> 0.8.3'
|
|
157
157
|
|
|
158
158
|
pre_install do |installer|
|
|
159
159
|
system("cd ../../ && npx bob build --target codegen")
|
|
@@ -292,13 +292,14 @@ error.innerError
|
|
|
292
292
|
|
|
293
293
|
## Troubleshooting
|
|
294
294
|
|
|
295
|
-
### Build failures for iOS in 0.7.
|
|
295
|
+
### Build failures for iOS in 0.7.x
|
|
296
296
|
|
|
297
|
-
- An accidental breaking change
|
|
297
|
+
- An accidental breaking change may cause 0.7.0, 0.7.1, 0.7.2 to fail with build failures for Android and iOS. Update 0.7.3 fixes this issue.
|
|
298
298
|
|
|
299
299
|
## Migration
|
|
300
300
|
|
|
301
|
-
- Migration steps for [0.
|
|
301
|
+
- Migration steps for [0.8.3](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#083)
|
|
302
|
+
- Migration steps for [0.7.3](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#073)
|
|
302
303
|
- Migration steps for [0.6.0](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#060)
|
|
303
304
|
- Migration steps for [0.3.1](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#031)
|
|
304
305
|
- Migration steps for [0.3.0](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#030)
|
package/android/build.gradle
CHANGED
|
@@ -118,7 +118,7 @@ dependencies {
|
|
|
118
118
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
119
119
|
|
|
120
120
|
//noinspection UseTomlInstead
|
|
121
|
-
implementation "org.reclaimprotocol:inapp_sdk:0.
|
|
121
|
+
implementation "org.reclaimprotocol:inapp_sdk:0.8.3"
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
if (isNewArchitectureEnabled()) {
|
|
@@ -69,6 +69,10 @@ public abstract class NativeInappRnSdkSpec extends ReactContextBaseJavaModule im
|
|
|
69
69
|
@DoNotStrip
|
|
70
70
|
public abstract void startVerificationFromUrl(String requestUrl, Promise promise);
|
|
71
71
|
|
|
72
|
+
@ReactMethod
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
public abstract void startVerificationFromJson(String templateJsonString, Promise promise);
|
|
75
|
+
|
|
72
76
|
@ReactMethod
|
|
73
77
|
@DoNotStrip
|
|
74
78
|
public abstract void setOverrides(ReadableMap overrides, Promise promise);
|
|
@@ -22,6 +22,11 @@ static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_startVerifica
|
|
|
22
22
|
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "startVerificationFromUrl", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_startVerificationFromJson(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
26
|
+
static jmethodID cachedMethodId = nullptr;
|
|
27
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "startVerificationFromJson", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_setOverrides(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
26
31
|
static jmethodID cachedMethodId = nullptr;
|
|
27
32
|
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "setOverrides", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
@@ -56,6 +61,7 @@ NativeInappRnSdkSpecJSI::NativeInappRnSdkSpecJSI(const JavaTurboModule::InitPara
|
|
|
56
61
|
: JavaTurboModule(params) {
|
|
57
62
|
methodMap_["startVerification"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_startVerification};
|
|
58
63
|
methodMap_["startVerificationFromUrl"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_startVerificationFromUrl};
|
|
64
|
+
methodMap_["startVerificationFromJson"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_startVerificationFromJson};
|
|
59
65
|
methodMap_["setOverrides"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_setOverrides};
|
|
60
66
|
methodMap_["clearAllOverrides"] = MethodMetadata {0, __hostFunction_NativeInappRnSdkSpecJSI_clearAllOverrides};
|
|
61
67
|
methodMap_["setVerificationOptions"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_setVerificationOptions};
|
|
@@ -23,6 +23,12 @@ static jsi::Value __hostFunction_NativeInappRnSdkCxxSpecJSI_startVerificationFro
|
|
|
23
23
|
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
|
+
static jsi::Value __hostFunction_NativeInappRnSdkCxxSpecJSI_startVerificationFromJson(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
27
|
+
return static_cast<NativeInappRnSdkCxxSpecJSI *>(&turboModule)->startVerificationFromJson(
|
|
28
|
+
rt,
|
|
29
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
26
32
|
static jsi::Value __hostFunction_NativeInappRnSdkCxxSpecJSI_setOverrides(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
27
33
|
return static_cast<NativeInappRnSdkCxxSpecJSI *>(&turboModule)->setOverrides(
|
|
28
34
|
rt,
|
|
@@ -66,6 +72,7 @@ NativeInappRnSdkCxxSpecJSI::NativeInappRnSdkCxxSpecJSI(std::shared_ptr<CallInvok
|
|
|
66
72
|
: TurboModule("InappRnSdk", jsInvoker) {
|
|
67
73
|
methodMap_["startVerification"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkCxxSpecJSI_startVerification};
|
|
68
74
|
methodMap_["startVerificationFromUrl"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkCxxSpecJSI_startVerificationFromUrl};
|
|
75
|
+
methodMap_["startVerificationFromJson"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkCxxSpecJSI_startVerificationFromJson};
|
|
69
76
|
methodMap_["setOverrides"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkCxxSpecJSI_setOverrides};
|
|
70
77
|
methodMap_["clearAllOverrides"] = MethodMetadata {0, __hostFunction_NativeInappRnSdkCxxSpecJSI_clearAllOverrides};
|
|
71
78
|
methodMap_["setVerificationOptions"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkCxxSpecJSI_setVerificationOptions};
|
package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI.h
CHANGED
|
@@ -18,7 +18,7 @@ namespace facebook::react {
|
|
|
18
18
|
|
|
19
19
|
#pragma mark - NativeInappRnSdkFeatureOptions
|
|
20
20
|
|
|
21
|
-
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5>
|
|
21
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
|
22
22
|
struct NativeInappRnSdkFeatureOptions {
|
|
23
23
|
P0 cookiePersist;
|
|
24
24
|
P1 singleReclaimRequest;
|
|
@@ -26,8 +26,10 @@ struct NativeInappRnSdkFeatureOptions {
|
|
|
26
26
|
P3 sessionTimeoutForManualVerificationTrigger;
|
|
27
27
|
P4 attestorBrowserRpcUrl;
|
|
28
28
|
P5 isAIFlowEnabled;
|
|
29
|
+
P6 manualReviewMessage;
|
|
30
|
+
P7 loginPromptMessage;
|
|
29
31
|
bool operator==(const NativeInappRnSdkFeatureOptions &other) const {
|
|
30
|
-
return cookiePersist == other.cookiePersist && singleReclaimRequest == other.singleReclaimRequest && idleTimeThresholdForManualVerificationTrigger == other.idleTimeThresholdForManualVerificationTrigger && sessionTimeoutForManualVerificationTrigger == other.sessionTimeoutForManualVerificationTrigger && attestorBrowserRpcUrl == other.attestorBrowserRpcUrl && isAIFlowEnabled == other.isAIFlowEnabled;
|
|
32
|
+
return cookiePersist == other.cookiePersist && singleReclaimRequest == other.singleReclaimRequest && idleTimeThresholdForManualVerificationTrigger == other.idleTimeThresholdForManualVerificationTrigger && sessionTimeoutForManualVerificationTrigger == other.sessionTimeoutForManualVerificationTrigger && attestorBrowserRpcUrl == other.attestorBrowserRpcUrl && isAIFlowEnabled == other.isAIFlowEnabled && manualReviewMessage == other.manualReviewMessage && loginPromptMessage == other.loginPromptMessage;
|
|
31
33
|
}
|
|
32
34
|
};
|
|
33
35
|
|
|
@@ -45,7 +47,9 @@ struct NativeInappRnSdkFeatureOptionsBridging {
|
|
|
45
47
|
bridging::fromJs<decltype(types.idleTimeThresholdForManualVerificationTrigger)>(rt, value.getProperty(rt, "idleTimeThresholdForManualVerificationTrigger"), jsInvoker),
|
|
46
48
|
bridging::fromJs<decltype(types.sessionTimeoutForManualVerificationTrigger)>(rt, value.getProperty(rt, "sessionTimeoutForManualVerificationTrigger"), jsInvoker),
|
|
47
49
|
bridging::fromJs<decltype(types.attestorBrowserRpcUrl)>(rt, value.getProperty(rt, "attestorBrowserRpcUrl"), jsInvoker),
|
|
48
|
-
bridging::fromJs<decltype(types.isAIFlowEnabled)>(rt, value.getProperty(rt, "isAIFlowEnabled"), jsInvoker)
|
|
50
|
+
bridging::fromJs<decltype(types.isAIFlowEnabled)>(rt, value.getProperty(rt, "isAIFlowEnabled"), jsInvoker),
|
|
51
|
+
bridging::fromJs<decltype(types.manualReviewMessage)>(rt, value.getProperty(rt, "manualReviewMessage"), jsInvoker),
|
|
52
|
+
bridging::fromJs<decltype(types.loginPromptMessage)>(rt, value.getProperty(rt, "loginPromptMessage"), jsInvoker)};
|
|
49
53
|
return result;
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -73,6 +77,14 @@ struct NativeInappRnSdkFeatureOptionsBridging {
|
|
|
73
77
|
static std::optional<bool> isAIFlowEnabledToJs(jsi::Runtime &rt, decltype(types.isAIFlowEnabled) value) {
|
|
74
78
|
return bridging::toJs(rt, value);
|
|
75
79
|
}
|
|
80
|
+
|
|
81
|
+
static std::optional<jsi::String> manualReviewMessageToJs(jsi::Runtime &rt, decltype(types.manualReviewMessage) value) {
|
|
82
|
+
return bridging::toJs(rt, value);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static std::optional<jsi::String> loginPromptMessageToJs(jsi::Runtime &rt, decltype(types.loginPromptMessage) value) {
|
|
86
|
+
return bridging::toJs(rt, value);
|
|
87
|
+
}
|
|
76
88
|
#endif
|
|
77
89
|
|
|
78
90
|
static jsi::Object toJs(
|
|
@@ -98,6 +110,12 @@ struct NativeInappRnSdkFeatureOptionsBridging {
|
|
|
98
110
|
if (value.isAIFlowEnabled) {
|
|
99
111
|
result.setProperty(rt, "isAIFlowEnabled", bridging::toJs(rt, value.isAIFlowEnabled.value(), jsInvoker));
|
|
100
112
|
}
|
|
113
|
+
if (value.manualReviewMessage) {
|
|
114
|
+
result.setProperty(rt, "manualReviewMessage", bridging::toJs(rt, value.manualReviewMessage.value(), jsInvoker));
|
|
115
|
+
}
|
|
116
|
+
if (value.loginPromptMessage) {
|
|
117
|
+
result.setProperty(rt, "loginPromptMessage", bridging::toJs(rt, value.loginPromptMessage.value(), jsInvoker));
|
|
118
|
+
}
|
|
101
119
|
return result;
|
|
102
120
|
}
|
|
103
121
|
};
|
|
@@ -386,6 +404,54 @@ struct NativeInappRnSdkProviderInformationRequestBridging {
|
|
|
386
404
|
|
|
387
405
|
|
|
388
406
|
|
|
407
|
+
#pragma mark - NativeInappRnSdkProviderVersion
|
|
408
|
+
|
|
409
|
+
template <typename P0, typename P1>
|
|
410
|
+
struct NativeInappRnSdkProviderVersion {
|
|
411
|
+
P0 resolvedVersion;
|
|
412
|
+
P1 versionExpression;
|
|
413
|
+
bool operator==(const NativeInappRnSdkProviderVersion &other) const {
|
|
414
|
+
return resolvedVersion == other.resolvedVersion && versionExpression == other.versionExpression;
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
template <typename T>
|
|
419
|
+
struct NativeInappRnSdkProviderVersionBridging {
|
|
420
|
+
static T types;
|
|
421
|
+
|
|
422
|
+
static T fromJs(
|
|
423
|
+
jsi::Runtime &rt,
|
|
424
|
+
const jsi::Object &value,
|
|
425
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
426
|
+
T result{
|
|
427
|
+
bridging::fromJs<decltype(types.resolvedVersion)>(rt, value.getProperty(rt, "resolvedVersion"), jsInvoker),
|
|
428
|
+
bridging::fromJs<decltype(types.versionExpression)>(rt, value.getProperty(rt, "versionExpression"), jsInvoker)};
|
|
429
|
+
return result;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
#ifdef DEBUG
|
|
433
|
+
static jsi::String resolvedVersionToJs(jsi::Runtime &rt, decltype(types.resolvedVersion) value) {
|
|
434
|
+
return bridging::toJs(rt, value);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
static jsi::String versionExpressionToJs(jsi::Runtime &rt, decltype(types.versionExpression) value) {
|
|
438
|
+
return bridging::toJs(rt, value);
|
|
439
|
+
}
|
|
440
|
+
#endif
|
|
441
|
+
|
|
442
|
+
static jsi::Object toJs(
|
|
443
|
+
jsi::Runtime &rt,
|
|
444
|
+
const T &value,
|
|
445
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
446
|
+
auto result = facebook::jsi::Object(rt);
|
|
447
|
+
result.setProperty(rt, "resolvedVersion", bridging::toJs(rt, value.resolvedVersion, jsInvoker));
|
|
448
|
+
result.setProperty(rt, "versionExpression", bridging::toJs(rt, value.versionExpression, jsInvoker));
|
|
449
|
+
return result;
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
389
455
|
#pragma mark - NativeInappRnSdkReclaimAppInfo
|
|
390
456
|
|
|
391
457
|
template <typename P0, typename P1, typename P2>
|
|
@@ -548,7 +614,7 @@ struct NativeInappRnSdkReclaimSessionIdentityUpdateBridging {
|
|
|
548
614
|
|
|
549
615
|
#pragma mark - NativeInappRnSdkRequest
|
|
550
616
|
|
|
551
|
-
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6
|
|
617
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
|
552
618
|
struct NativeInappRnSdkRequest {
|
|
553
619
|
P0 appId;
|
|
554
620
|
P1 secret;
|
|
@@ -556,10 +622,9 @@ struct NativeInappRnSdkRequest {
|
|
|
556
622
|
P3 session;
|
|
557
623
|
P4 contextString;
|
|
558
624
|
P5 parameters;
|
|
559
|
-
P6
|
|
560
|
-
P7 webhookUrl;
|
|
625
|
+
P6 providerVersion;
|
|
561
626
|
bool operator==(const NativeInappRnSdkRequest &other) const {
|
|
562
|
-
return appId == other.appId && secret == other.secret && providerId == other.providerId && session == other.session && contextString == other.contextString && parameters == other.parameters &&
|
|
627
|
+
return appId == other.appId && secret == other.secret && providerId == other.providerId && session == other.session && contextString == other.contextString && parameters == other.parameters && providerVersion == other.providerVersion;
|
|
563
628
|
}
|
|
564
629
|
};
|
|
565
630
|
|
|
@@ -578,8 +643,7 @@ struct NativeInappRnSdkRequestBridging {
|
|
|
578
643
|
bridging::fromJs<decltype(types.session)>(rt, value.getProperty(rt, "session"), jsInvoker),
|
|
579
644
|
bridging::fromJs<decltype(types.contextString)>(rt, value.getProperty(rt, "contextString"), jsInvoker),
|
|
580
645
|
bridging::fromJs<decltype(types.parameters)>(rt, value.getProperty(rt, "parameters"), jsInvoker),
|
|
581
|
-
bridging::fromJs<decltype(types.
|
|
582
|
-
bridging::fromJs<decltype(types.webhookUrl)>(rt, value.getProperty(rt, "webhookUrl"), jsInvoker)};
|
|
646
|
+
bridging::fromJs<decltype(types.providerVersion)>(rt, value.getProperty(rt, "providerVersion"), jsInvoker)};
|
|
583
647
|
return result;
|
|
584
648
|
}
|
|
585
649
|
|
|
@@ -608,11 +672,7 @@ struct NativeInappRnSdkRequestBridging {
|
|
|
608
672
|
return bridging::toJs(rt, value);
|
|
609
673
|
}
|
|
610
674
|
|
|
611
|
-
static
|
|
612
|
-
return bridging::toJs(rt, value);
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
static std::optional<jsi::String> webhookUrlToJs(jsi::Runtime &rt, decltype(types.webhookUrl) value) {
|
|
675
|
+
static std::optional<jsi::Object> providerVersionToJs(jsi::Runtime &rt, decltype(types.providerVersion) value) {
|
|
616
676
|
return bridging::toJs(rt, value);
|
|
617
677
|
}
|
|
618
678
|
#endif
|
|
@@ -634,11 +694,8 @@ struct NativeInappRnSdkRequestBridging {
|
|
|
634
694
|
if (value.parameters) {
|
|
635
695
|
result.setProperty(rt, "parameters", bridging::toJs(rt, value.parameters.value(), jsInvoker));
|
|
636
696
|
}
|
|
637
|
-
if (value.
|
|
638
|
-
result.setProperty(rt, "
|
|
639
|
-
}
|
|
640
|
-
if (value.webhookUrl) {
|
|
641
|
-
result.setProperty(rt, "webhookUrl", bridging::toJs(rt, value.webhookUrl.value(), jsInvoker));
|
|
697
|
+
if (value.providerVersion) {
|
|
698
|
+
result.setProperty(rt, "providerVersion", bridging::toJs(rt, value.providerVersion.value(), jsInvoker));
|
|
642
699
|
}
|
|
643
700
|
return result;
|
|
644
701
|
}
|
|
@@ -703,15 +760,16 @@ struct NativeInappRnSdkResponseBridging {
|
|
|
703
760
|
|
|
704
761
|
#pragma mark - NativeInappRnSdkSessionCreateRequestEvent
|
|
705
762
|
|
|
706
|
-
template <typename P0, typename P1, typename P2, typename P3, typename P4>
|
|
763
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5>
|
|
707
764
|
struct NativeInappRnSdkSessionCreateRequestEvent {
|
|
708
765
|
P0 appId;
|
|
709
766
|
P1 providerId;
|
|
710
767
|
P2 timestamp;
|
|
711
768
|
P3 signature;
|
|
712
|
-
P4
|
|
769
|
+
P4 providerVersion;
|
|
770
|
+
P5 replyId;
|
|
713
771
|
bool operator==(const NativeInappRnSdkSessionCreateRequestEvent &other) const {
|
|
714
|
-
return appId == other.appId && providerId == other.providerId && timestamp == other.timestamp && signature == other.signature && replyId == other.replyId;
|
|
772
|
+
return appId == other.appId && providerId == other.providerId && timestamp == other.timestamp && signature == other.signature && providerVersion == other.providerVersion && replyId == other.replyId;
|
|
715
773
|
}
|
|
716
774
|
};
|
|
717
775
|
|
|
@@ -728,6 +786,7 @@ struct NativeInappRnSdkSessionCreateRequestEventBridging {
|
|
|
728
786
|
bridging::fromJs<decltype(types.providerId)>(rt, value.getProperty(rt, "providerId"), jsInvoker),
|
|
729
787
|
bridging::fromJs<decltype(types.timestamp)>(rt, value.getProperty(rt, "timestamp"), jsInvoker),
|
|
730
788
|
bridging::fromJs<decltype(types.signature)>(rt, value.getProperty(rt, "signature"), jsInvoker),
|
|
789
|
+
bridging::fromJs<decltype(types.providerVersion)>(rt, value.getProperty(rt, "providerVersion"), jsInvoker),
|
|
731
790
|
bridging::fromJs<decltype(types.replyId)>(rt, value.getProperty(rt, "replyId"), jsInvoker)};
|
|
732
791
|
return result;
|
|
733
792
|
}
|
|
@@ -749,6 +808,10 @@ struct NativeInappRnSdkSessionCreateRequestEventBridging {
|
|
|
749
808
|
return bridging::toJs(rt, value);
|
|
750
809
|
}
|
|
751
810
|
|
|
811
|
+
static jsi::String providerVersionToJs(jsi::Runtime &rt, decltype(types.providerVersion) value) {
|
|
812
|
+
return bridging::toJs(rt, value);
|
|
813
|
+
}
|
|
814
|
+
|
|
752
815
|
static jsi::String replyIdToJs(jsi::Runtime &rt, decltype(types.replyId) value) {
|
|
753
816
|
return bridging::toJs(rt, value);
|
|
754
817
|
}
|
|
@@ -763,6 +826,7 @@ struct NativeInappRnSdkSessionCreateRequestEventBridging {
|
|
|
763
826
|
result.setProperty(rt, "providerId", bridging::toJs(rt, value.providerId, jsInvoker));
|
|
764
827
|
result.setProperty(rt, "timestamp", bridging::toJs(rt, value.timestamp, jsInvoker));
|
|
765
828
|
result.setProperty(rt, "signature", bridging::toJs(rt, value.signature, jsInvoker));
|
|
829
|
+
result.setProperty(rt, "providerVersion", bridging::toJs(rt, value.providerVersion, jsInvoker));
|
|
766
830
|
result.setProperty(rt, "replyId", bridging::toJs(rt, value.replyId, jsInvoker));
|
|
767
831
|
return result;
|
|
768
832
|
}
|
|
@@ -1102,6 +1166,7 @@ protected:
|
|
|
1102
1166
|
public:
|
|
1103
1167
|
virtual jsi::Value startVerification(jsi::Runtime &rt, jsi::Object request) = 0;
|
|
1104
1168
|
virtual jsi::Value startVerificationFromUrl(jsi::Runtime &rt, jsi::String requestUrl) = 0;
|
|
1169
|
+
virtual jsi::Value startVerificationFromJson(jsi::Runtime &rt, jsi::String templateJsonString) = 0;
|
|
1105
1170
|
virtual jsi::Value setOverrides(jsi::Runtime &rt, jsi::Object overrides) = 0;
|
|
1106
1171
|
virtual jsi::Value clearAllOverrides(jsi::Runtime &rt) = 0;
|
|
1107
1172
|
virtual jsi::Value setVerificationOptions(jsi::Runtime &rt, jsi::Object args) = 0;
|
|
@@ -1208,6 +1273,14 @@ private:
|
|
|
1208
1273
|
return bridging::callFromJs<jsi::Value>(
|
|
1209
1274
|
rt, &T::startVerificationFromUrl, jsInvoker_, instance_, std::move(requestUrl));
|
|
1210
1275
|
}
|
|
1276
|
+
jsi::Value startVerificationFromJson(jsi::Runtime &rt, jsi::String templateJsonString) override {
|
|
1277
|
+
static_assert(
|
|
1278
|
+
bridging::getParameterCount(&T::startVerificationFromJson) == 2,
|
|
1279
|
+
"Expected startVerificationFromJson(...) to have 2 parameters");
|
|
1280
|
+
|
|
1281
|
+
return bridging::callFromJs<jsi::Value>(
|
|
1282
|
+
rt, &T::startVerificationFromJson, jsInvoker_, instance_, std::move(templateJsonString));
|
|
1283
|
+
}
|
|
1211
1284
|
jsi::Value setOverrides(jsi::Runtime &rt, jsi::Object overrides) override {
|
|
1212
1285
|
static_assert(
|
|
1213
1286
|
bridging::getParameterCount(&T::setOverrides) == 2,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.reclaimprotocol.inapp_rn_sdk
|
|
2
2
|
|
|
3
|
+
import android.util.JsonReader
|
|
3
4
|
import android.util.Log
|
|
4
5
|
import com.facebook.react.bridge.Arguments
|
|
5
6
|
import com.facebook.react.bridge.Promise
|
|
@@ -12,6 +13,7 @@ import org.json.JSONObject
|
|
|
12
13
|
import org.reclaimprotocol.inapp_sdk.ReclaimOverrides
|
|
13
14
|
import org.reclaimprotocol.inapp_sdk.ReclaimSessionStatus
|
|
14
15
|
import org.reclaimprotocol.inapp_sdk.ReclaimVerification
|
|
16
|
+
import org.reclaimprotocol.inapp_sdk.ReclaimVerification.Request.ProviderVersion
|
|
15
17
|
import java.util.UUID
|
|
16
18
|
|
|
17
19
|
@ReactModule(name = InappRnSdkModule.NAME)
|
|
@@ -86,8 +88,12 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
|
-
val
|
|
90
|
-
|
|
91
|
+
val providerVersion = request.getMap("providerVersion").let { providerVersion ->
|
|
92
|
+
ProviderVersion(
|
|
93
|
+
resolvedVersion = getString(providerVersion, "resolvedVersion") ?: "",
|
|
94
|
+
versionExpression = getString(providerVersion, "versionExpression") ?: ""
|
|
95
|
+
)
|
|
96
|
+
}
|
|
91
97
|
if (appId.isNullOrBlank() && secret.isNullOrBlank()) {
|
|
92
98
|
verificationRequest = ReclaimVerification.Request.fromManifestMetaData(
|
|
93
99
|
context = reactContext.applicationContext,
|
|
@@ -99,8 +105,7 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
99
105
|
signature = getString(session, "signature") ?: "",
|
|
100
106
|
),
|
|
101
107
|
parameters = parameters,
|
|
102
|
-
|
|
103
|
-
webhookUrl = webhookUrl,
|
|
108
|
+
providerVersion = providerVersion,
|
|
104
109
|
)
|
|
105
110
|
} else {
|
|
106
111
|
verificationRequest = ReclaimVerification.Request(
|
|
@@ -114,8 +119,7 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
114
119
|
signature = getString(session, "signature") ?: "",
|
|
115
120
|
),
|
|
116
121
|
parameters = parameters,
|
|
117
|
-
|
|
118
|
-
webhookUrl = webhookUrl,
|
|
122
|
+
providerVersion = providerVersion,
|
|
119
123
|
)
|
|
120
124
|
}
|
|
121
125
|
ReclaimVerification.startVerification(
|
|
@@ -140,6 +144,20 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
140
144
|
}
|
|
141
145
|
}
|
|
142
146
|
|
|
147
|
+
override fun startVerificationFromJson(templateJsonString: String, promise: Promise?) {
|
|
148
|
+
Log.d(NAME, "startVerificationFromJson")
|
|
149
|
+
val templateJson = HashMap<Any?, Any?>()
|
|
150
|
+
JSONObject(templateJsonString).toMap().forEach { (key, value) ->
|
|
151
|
+
templateJson[key] = value
|
|
152
|
+
}
|
|
153
|
+
val handler = ReclaimVerificationResultHandlerImpl(promise)
|
|
154
|
+
reactContext.runOnUiQueueThread {
|
|
155
|
+
ReclaimVerification.startVerificationFromJson(
|
|
156
|
+
context = reactContext.applicationContext, template = templateJson, handler = handler
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
143
161
|
override fun setOverrides(overrides: ReadableMap?, promise: Promise?) {
|
|
144
162
|
return setOverrides(
|
|
145
163
|
provider = getMap(overrides, "provider"),
|
|
@@ -276,7 +294,9 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
276
294
|
featureOptions, "sessionTimeoutForManualVerificationTrigger"
|
|
277
295
|
)?.toLong(),
|
|
278
296
|
attestorBrowserRpcUrl = getString(featureOptions, "attestorBrowserRpcUrl"),
|
|
279
|
-
isAIFlowEnabled = getBoolean(featureOptions, "isAIFlowEnabled")
|
|
297
|
+
isAIFlowEnabled = getBoolean(featureOptions, "isAIFlowEnabled"),
|
|
298
|
+
manualReviewMessage = getString(featureOptions, "manualReviewMessage"),
|
|
299
|
+
loginPromptMessage = getString(featureOptions, "loginPromptMessage")
|
|
280
300
|
),
|
|
281
301
|
logConsumer = if (logConsumer == null) null else ReclaimOverrides.LogConsumer(
|
|
282
302
|
logHandler = if (getBoolean(logConsumer, "enableLogHandler") != true) null else object :
|
|
@@ -298,16 +318,31 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
298
318
|
providerId: String,
|
|
299
319
|
timestamp: String,
|
|
300
320
|
signature: String,
|
|
301
|
-
|
|
321
|
+
providerVersion: String,
|
|
322
|
+
callback: (Result<ReclaimOverrides.SessionManagement.InitResponse>) -> Unit
|
|
302
323
|
) {
|
|
303
324
|
val args = Arguments.createMap()
|
|
304
325
|
args.putString("appId", appId)
|
|
305
326
|
args.putString("providerId", providerId)
|
|
306
327
|
args.putString("timestamp", timestamp)
|
|
307
328
|
args.putString("signature", signature)
|
|
329
|
+
args.putString("providerVersion", providerVersion)
|
|
308
330
|
val replyId = UUID.randomUUID().toString()
|
|
309
331
|
args.putString("replyId", replyId)
|
|
310
|
-
replyWithString[replyId] =
|
|
332
|
+
replyWithString[replyId] = { it ->
|
|
333
|
+
callback(it.fold(
|
|
334
|
+
onSuccess = { value ->
|
|
335
|
+
val value = JSONObject(value)
|
|
336
|
+
Result.success(ReclaimOverrides.SessionManagement.InitResponse(
|
|
337
|
+
sessionId = value.getString("sessionId"),
|
|
338
|
+
resolvedProviderVersion = value.getString("resolvedProviderVersion")
|
|
339
|
+
))
|
|
340
|
+
},
|
|
341
|
+
onFailure = { error ->
|
|
342
|
+
Result.failure(error)
|
|
343
|
+
}
|
|
344
|
+
))
|
|
345
|
+
}
|
|
311
346
|
emitOnSessionCreateRequest(args)
|
|
312
347
|
}
|
|
313
348
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package com.reclaimprotocol.inapp_rn_sdk
|
|
2
|
+
|
|
3
|
+
import org.json.JSONArray
|
|
4
|
+
import org.json.JSONObject
|
|
5
|
+
|
|
6
|
+
fun JSONObject.toMap(): Map<String, *> = keys().asSequence().associateWith {
|
|
7
|
+
when (val value = this[it])
|
|
8
|
+
{
|
|
9
|
+
is JSONArray ->
|
|
10
|
+
{
|
|
11
|
+
val map = (0 until value.length()).associate { Pair(it.toString(), value[it]) }
|
|
12
|
+
JSONObject(map).toMap().values.toList()
|
|
13
|
+
}
|
|
14
|
+
is JSONObject -> value.toMap()
|
|
15
|
+
JSONObject.NULL -> null
|
|
16
|
+
else -> value
|
|
17
|
+
}
|
|
18
|
+
}
|