@reclaimprotocol/inapp-rn-sdk 0.7.3 → 0.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/InappRnSdk.podspec +1 -1
- package/README.md +8 -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 +105 -25
- package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/InappRnSdkModule.kt +46 -9
- package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/JsonExtension.kt +18 -0
- package/ios/InappRnSdk.mm +267 -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 +105 -25
- 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 +23 -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 +23 -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 +25 -2
package/ios/InappRnSdk.mm
CHANGED
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
RCT_EXPORT_MODULE()
|
|
15
15
|
|
|
16
16
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
17
|
-
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
18
|
-
{
|
|
17
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
19
18
|
return std::make_shared<facebook::react::NativeInappRnSdkSpecJSI>(params);
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
Api *api = [[Api alloc] init];
|
|
23
22
|
|
|
24
|
-
- (void)ping:(nonnull RCTPromiseResolveBlock)resolve
|
|
25
|
-
|
|
23
|
+
- (void)ping:(nonnull RCTPromiseResolveBlock)resolve
|
|
24
|
+
reject:(nonnull RCTPromiseRejectBlock)reject {
|
|
25
|
+
|
|
26
26
|
BOOL pingResult = [api ping];
|
|
27
27
|
if (pingResult) {
|
|
28
28
|
resolve(@true);
|
|
@@ -35,18 +35,25 @@ Api *api = [[Api alloc] init];
|
|
|
35
35
|
[api replyWithReplyId:replyId reply:reply];
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
- (void)replyWithString:(nonnull NSString *)replyId
|
|
38
|
+
- (void)replyWithString:(nonnull NSString *)replyId
|
|
39
|
+
value:(nonnull NSString *)value {
|
|
39
40
|
[api replyWithStringWithReplyId:replyId value:value];
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
- (void)startVerification:(JS::NativeInappRnSdk::Request &)request
|
|
43
|
+
- (void)startVerification:(JS::NativeInappRnSdk::Request &)request
|
|
44
|
+
resolve:(nonnull RCTPromiseResolveBlock)resolve
|
|
45
|
+
reject:(nonnull RCTPromiseRejectBlock)reject {
|
|
43
46
|
NSLog(@"[InappRnSdk] starting verification");
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
NSMutableDictionary<NSString *, NSString *> *providerVersion =
|
|
49
|
+
[NSMutableDictionary dictionary];
|
|
50
|
+
if (request.providerVersion().has_value()) {
|
|
51
|
+
providerVersion[@"resolvedVersion"] =
|
|
52
|
+
request.providerVersion().value().resolvedVersion();
|
|
53
|
+
providerVersion[@"versionExpression"] =
|
|
54
|
+
request.providerVersion().value().versionExpression();
|
|
48
55
|
}
|
|
49
|
-
|
|
56
|
+
|
|
50
57
|
NSString *sessionId = nil;
|
|
51
58
|
NSString *timestamp = nil;
|
|
52
59
|
NSString *signature = nil;
|
|
@@ -55,7 +62,7 @@ Api *api = [[Api alloc] init];
|
|
|
55
62
|
timestamp = request.session().value().timestamp();
|
|
56
63
|
signature = request.session().value().signature();
|
|
57
64
|
}
|
|
58
|
-
|
|
65
|
+
|
|
59
66
|
NSDictionary<NSString *, NSString *> *parameters = @{};
|
|
60
67
|
if (request.parameters() != nil) {
|
|
61
68
|
id potentialParameters = request.parameters();
|
|
@@ -64,167 +71,264 @@ Api *api = [[Api alloc] init];
|
|
|
64
71
|
NSDictionary *tempDictionary = (NSDictionary *)potentialParameters;
|
|
65
72
|
BOOL allStrings = YES;
|
|
66
73
|
for (id key in tempDictionary) {
|
|
67
|
-
if (![key isKindOfClass:[NSString class]] ||
|
|
74
|
+
if (![key isKindOfClass:[NSString class]] ||
|
|
75
|
+
![tempDictionary[key] isKindOfClass:[NSString class]]) {
|
|
68
76
|
allStrings = NO;
|
|
69
77
|
break;
|
|
70
78
|
}
|
|
71
79
|
}
|
|
72
|
-
if (allStrings){
|
|
80
|
+
if (allStrings) {
|
|
73
81
|
// should always be the case
|
|
74
|
-
parameters =
|
|
82
|
+
parameters =
|
|
83
|
+
(NSDictionary<NSString *, NSString *> *)potentialParameters;
|
|
75
84
|
} else {
|
|
76
|
-
NSLog(@"[InappRnSdk] request.parameters() contains non string key or
|
|
85
|
+
NSLog(@"[InappRnSdk] request.parameters() contains non string key or "
|
|
86
|
+
@"value");
|
|
77
87
|
}
|
|
78
88
|
} else {
|
|
79
89
|
NSLog(@"[InappRnSdk] request.parameters() is not a dictionary.");
|
|
80
90
|
}
|
|
81
91
|
}
|
|
82
|
-
|
|
92
|
+
|
|
83
93
|
NSLog(@"[InappRnSdk] starting verification now");
|
|
84
|
-
[api startVerificationWithAppId:request.appId()
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
[api startVerificationWithAppId:request.appId()
|
|
95
|
+
secret:request.secret()
|
|
96
|
+
providerId:request.providerId()
|
|
97
|
+
sessionTimestamp:timestamp
|
|
98
|
+
sessionSessionId:sessionId
|
|
99
|
+
sessionSignature:signature
|
|
100
|
+
context:request.contextString()
|
|
101
|
+
parameters:parameters
|
|
102
|
+
providerVersion:providerVersion
|
|
103
|
+
completionHandler:^(
|
|
104
|
+
NSDictionary<NSString *, id> *_Nullable result,
|
|
105
|
+
NSError *_Nullable error) {
|
|
106
|
+
if (error != nil) {
|
|
107
|
+
NSLog(@"[InappRnSdk] Api Error: %@", error);
|
|
108
|
+
reject(@"VERIFICATION_ERROR", @"Verification Error", error);
|
|
109
|
+
} else {
|
|
110
|
+
resolve(result);
|
|
111
|
+
}
|
|
112
|
+
}];
|
|
92
113
|
}
|
|
93
114
|
|
|
94
|
-
- (void)startVerificationFromUrl:(nonnull NSString *)requestUrl
|
|
115
|
+
- (void)startVerificationFromUrl:(nonnull NSString *)requestUrl
|
|
116
|
+
resolve:(nonnull RCTPromiseResolveBlock)resolve
|
|
117
|
+
reject:(nonnull RCTPromiseRejectBlock)reject {
|
|
95
118
|
NSLog(@"[InappRnSdk] starting verification");
|
|
96
|
-
|
|
119
|
+
|
|
97
120
|
NSLog(@"[InappRnSdk] starting verification now");
|
|
98
|
-
[api startVerificationFromUrlWithUrl:requestUrl
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
121
|
+
[api startVerificationFromUrlWithUrl:requestUrl
|
|
122
|
+
completionHandler:^(
|
|
123
|
+
NSDictionary<NSString *, id> *_Nullable result,
|
|
124
|
+
NSError *_Nullable error) {
|
|
125
|
+
if (error != nil) {
|
|
126
|
+
NSLog(@"[InappRnSdk] Api Error: %@", error);
|
|
127
|
+
reject(@"VERIFICATION_ERROR", @"Verification Error",
|
|
128
|
+
error);
|
|
129
|
+
} else {
|
|
130
|
+
resolve(result);
|
|
131
|
+
}
|
|
132
|
+
}];
|
|
106
133
|
}
|
|
107
134
|
|
|
108
|
-
- (void)setOverrides:(JS::NativeInappRnSdk::Overrides &)overrides
|
|
109
|
-
|
|
110
|
-
|
|
135
|
+
- (void)setOverrides:(JS::NativeInappRnSdk::Overrides &)overrides
|
|
136
|
+
resolve:(nonnull RCTPromiseResolveBlock)resolve
|
|
137
|
+
reject:(nonnull RCTPromiseRejectBlock)reject {
|
|
138
|
+
|
|
139
|
+
OverridenProviderInformation *_Nullable overridenProvider = nil;
|
|
111
140
|
if (overrides.provider().has_value()) {
|
|
112
|
-
JS::NativeInappRnSdk::ProviderInformation provider =
|
|
141
|
+
JS::NativeInappRnSdk::ProviderInformation provider =
|
|
142
|
+
overrides.provider().value();
|
|
113
143
|
if (provider.url() != nil && provider.url().length > 0) {
|
|
114
|
-
overridenProvider =
|
|
115
|
-
|
|
116
|
-
|
|
144
|
+
overridenProvider =
|
|
145
|
+
[[OverridenProviderInformation alloc] initWithUrl:provider.url()
|
|
146
|
+
jsonString:nil
|
|
147
|
+
callback:nil];
|
|
148
|
+
} else if (provider.jsonString() != nil &&
|
|
149
|
+
provider.jsonString().length > 0) {
|
|
150
|
+
overridenProvider = [[OverridenProviderInformation alloc]
|
|
151
|
+
initWithUrl:nil
|
|
152
|
+
jsonString:provider.jsonString()
|
|
153
|
+
callback:nil];
|
|
117
154
|
} else if (provider.canFetchProviderInformationFromHost()) {
|
|
118
|
-
OverridenProviderCallbackHandler *
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
155
|
+
OverridenProviderCallbackHandler *callback =
|
|
156
|
+
[[OverridenProviderCallbackHandler alloc]
|
|
157
|
+
initWith_fetchProviderInformation:^(
|
|
158
|
+
NSString *_Nonnull appId, NSString *_Nonnull providerId,
|
|
159
|
+
NSString *_Nonnull sessionId, NSString *_Nonnull signature,
|
|
160
|
+
NSString *_Nonnull timestamp, NSString *_Nonnull resolvedVersion, NSString *_Nonnull replyId) {
|
|
161
|
+
[self emitOnProviderInformationRequest:@{
|
|
162
|
+
@"appId" : appId,
|
|
163
|
+
@"providerId" : providerId,
|
|
164
|
+
@"sessionId" : sessionId,
|
|
165
|
+
@"signature" : signature,
|
|
166
|
+
@"timestamp" : timestamp,
|
|
167
|
+
@"resolvedVersion": resolvedVersion,
|
|
168
|
+
@"replyId" : replyId
|
|
169
|
+
}];
|
|
170
|
+
}];
|
|
171
|
+
overridenProvider =
|
|
172
|
+
[[OverridenProviderInformation alloc] initWithUrl:nil
|
|
173
|
+
jsonString:nil
|
|
174
|
+
callback:callback];
|
|
129
175
|
}
|
|
130
176
|
}
|
|
131
|
-
|
|
132
|
-
OverridenFeatureOptions *
|
|
177
|
+
|
|
178
|
+
OverridenFeatureOptions *_Nullable overridenFeatureOptions = nil;
|
|
133
179
|
if (overrides.featureOptions().has_value()) {
|
|
134
|
-
JS::NativeInappRnSdk::FeatureOptions featureOptions =
|
|
135
|
-
|
|
136
|
-
|
|
180
|
+
JS::NativeInappRnSdk::FeatureOptions featureOptions =
|
|
181
|
+
overrides.featureOptions().value();
|
|
182
|
+
overridenFeatureOptions =
|
|
183
|
+
[[OverridenFeatureOptions alloc] initWithCookiePersist:nil
|
|
184
|
+
singleReclaimRequest:nil
|
|
185
|
+
idleTimeThresholdForManualVerificationTrigger:nil
|
|
186
|
+
sessionTimeoutForManualVerificationTrigger:nil
|
|
187
|
+
attestorBrowserRpcUrl:nil
|
|
188
|
+
isAIFlowEnabled:nil
|
|
189
|
+
manualReviewMessage:nil
|
|
190
|
+
loginPromptMessage:nil];
|
|
191
|
+
|
|
137
192
|
if (featureOptions.cookiePersist().has_value()) {
|
|
138
|
-
overridenFeatureOptions.cookiePersist =
|
|
193
|
+
overridenFeatureOptions.cookiePersist =
|
|
194
|
+
[NSNumber numberWithBool:featureOptions.cookiePersist().value()];
|
|
139
195
|
}
|
|
140
196
|
if (featureOptions.singleReclaimRequest().has_value()) {
|
|
141
|
-
overridenFeatureOptions.singleReclaimRequest = [NSNumber
|
|
197
|
+
overridenFeatureOptions.singleReclaimRequest = [NSNumber
|
|
198
|
+
numberWithBool:featureOptions.singleReclaimRequest().value()];
|
|
142
199
|
}
|
|
143
|
-
if (featureOptions.idleTimeThresholdForManualVerificationTrigger()
|
|
144
|
-
|
|
200
|
+
if (featureOptions.idleTimeThresholdForManualVerificationTrigger()
|
|
201
|
+
.has_value()) {
|
|
202
|
+
overridenFeatureOptions
|
|
203
|
+
.idleTimeThresholdForManualVerificationTrigger = [NSNumber
|
|
204
|
+
numberWithDouble:featureOptions
|
|
205
|
+
.idleTimeThresholdForManualVerificationTrigger()
|
|
206
|
+
.value()];
|
|
145
207
|
}
|
|
146
|
-
if (featureOptions.sessionTimeoutForManualVerificationTrigger()
|
|
147
|
-
|
|
208
|
+
if (featureOptions.sessionTimeoutForManualVerificationTrigger()
|
|
209
|
+
.has_value()) {
|
|
210
|
+
overridenFeatureOptions.sessionTimeoutForManualVerificationTrigger =
|
|
211
|
+
[NSNumber
|
|
212
|
+
numberWithDouble:featureOptions
|
|
213
|
+
.sessionTimeoutForManualVerificationTrigger()
|
|
214
|
+
.value()];
|
|
148
215
|
}
|
|
149
|
-
if (featureOptions.attestorBrowserRpcUrl() != nil &&
|
|
150
|
-
|
|
216
|
+
if (featureOptions.attestorBrowserRpcUrl() != nil &&
|
|
217
|
+
featureOptions.attestorBrowserRpcUrl().length > 0) {
|
|
218
|
+
overridenFeatureOptions.attestorBrowserRpcUrl =
|
|
219
|
+
featureOptions.attestorBrowserRpcUrl();
|
|
151
220
|
}
|
|
152
221
|
if (featureOptions.isAIFlowEnabled().has_value()) {
|
|
153
|
-
overridenFeatureOptions.isAIFlowEnabled =
|
|
222
|
+
overridenFeatureOptions.isAIFlowEnabled =
|
|
223
|
+
[NSNumber numberWithBool:featureOptions.isAIFlowEnabled().value()];
|
|
154
224
|
}
|
|
155
225
|
}
|
|
156
|
-
|
|
157
|
-
OverridenLogConsumer *
|
|
226
|
+
|
|
227
|
+
OverridenLogConsumer *_Nullable overridenLogConsumer = nil;
|
|
158
228
|
if (overrides.logConsumer().has_value()) {
|
|
159
229
|
BOOL canSDKCollectTelemetry = true;
|
|
160
230
|
if (overrides.logConsumer().value().canSdkCollectTelemetry().has_value()) {
|
|
161
|
-
canSDKCollectTelemetry =
|
|
231
|
+
canSDKCollectTelemetry =
|
|
232
|
+
overrides.logConsumer().value().canSdkCollectTelemetry().value();
|
|
162
233
|
}
|
|
163
|
-
NSNumber
|
|
234
|
+
NSNumber *_Nullable canSdkPrintLogs = nil;
|
|
164
235
|
if (overrides.logConsumer().value().canSdkPrintLogs().has_value()) {
|
|
165
|
-
canSdkPrintLogs = [NSNumber numberWithBool:overrides.logConsumer()
|
|
236
|
+
canSdkPrintLogs = [NSNumber numberWithBool:overrides.logConsumer()
|
|
237
|
+
.value()
|
|
238
|
+
.canSdkPrintLogs()
|
|
239
|
+
.value()];
|
|
166
240
|
}
|
|
167
|
-
OverridenLogHandler *
|
|
241
|
+
OverridenLogHandler *_Nullable logHandler;
|
|
168
242
|
if (overrides.logConsumer().value().enableLogHandler()) {
|
|
169
|
-
logHandler = [[OverridenLogHandler alloc]
|
|
170
|
-
|
|
171
|
-
|
|
243
|
+
logHandler = [[OverridenLogHandler alloc]
|
|
244
|
+
initOnLogs:^(NSString *_Nonnull logJsonString) {
|
|
245
|
+
[self emitOnLogs:logJsonString];
|
|
246
|
+
}];
|
|
172
247
|
}
|
|
173
|
-
overridenLogConsumer =
|
|
248
|
+
overridenLogConsumer =
|
|
249
|
+
[[OverridenLogConsumer alloc] initWithLogHandler:logHandler
|
|
250
|
+
canSdkCollectTelemetry:canSDKCollectTelemetry
|
|
251
|
+
canSdkPrintLogs:canSdkPrintLogs];
|
|
174
252
|
}
|
|
175
|
-
|
|
176
|
-
OverridenSessionManagement *
|
|
253
|
+
|
|
254
|
+
OverridenSessionManagement *_Nullable sessionManagement;
|
|
177
255
|
if (overrides.sessionManagement().has_value()) {
|
|
178
|
-
sessionManagement = [[OverridenSessionManagement alloc]
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
256
|
+
sessionManagement = [[OverridenSessionManagement alloc]
|
|
257
|
+
initWithHandler:[[OverridenSessionHandler alloc]
|
|
258
|
+
initWith_createSession:^(
|
|
259
|
+
NSString *_Nonnull appId,
|
|
260
|
+
NSString *_Nonnull providerId,
|
|
261
|
+
NSString *_Nonnull timestamp,
|
|
262
|
+
NSString *_Nonnull signature,
|
|
263
|
+
NSString *_Nonnull providerVersion,
|
|
264
|
+
NSString *_Nonnull replyId) {
|
|
265
|
+
[self emitOnSessionCreateRequest:@{
|
|
266
|
+
@"appId" : appId,
|
|
267
|
+
@"providerId" : providerId,
|
|
268
|
+
@"timestamp" : timestamp,
|
|
269
|
+
@"signature" : signature,
|
|
270
|
+
@"providerVersion": providerVersion,
|
|
271
|
+
@"replyId" : replyId
|
|
272
|
+
}];
|
|
273
|
+
}
|
|
274
|
+
_updateSession:^(NSString *_Nonnull sessionId,
|
|
275
|
+
NSString *_Nonnull status,
|
|
276
|
+
NSString *_Nonnull replyId) {
|
|
277
|
+
[self emitOnSessionUpdateRequest:@{
|
|
278
|
+
@"sessionId" : sessionId,
|
|
279
|
+
@"status" : status,
|
|
280
|
+
@"replyId" : replyId
|
|
281
|
+
}];
|
|
282
|
+
}
|
|
283
|
+
_logSession:^(NSString *_Nonnull appId,
|
|
284
|
+
NSString *_Nonnull providerId,
|
|
285
|
+
NSString *_Nonnull sessionId,
|
|
286
|
+
NSString *_Nonnull logType) {
|
|
287
|
+
[self emitOnSessionLogs:@{
|
|
288
|
+
@"appId" : appId,
|
|
289
|
+
@"providerId" : providerId,
|
|
290
|
+
@"sessionId" : sessionId,
|
|
291
|
+
@"logType" : logType
|
|
292
|
+
}];
|
|
293
|
+
}]];
|
|
200
294
|
}
|
|
201
|
-
|
|
202
|
-
OverridenReclaimAppInfo *
|
|
295
|
+
|
|
296
|
+
OverridenReclaimAppInfo *_Nullable overridenAppInfo = nil;
|
|
203
297
|
if (overrides.appInfo().has_value()) {
|
|
204
298
|
JS::NativeInappRnSdk::ReclaimAppInfo appInfo = overrides.appInfo().value();
|
|
205
|
-
NSNumber
|
|
299
|
+
NSNumber *_Nullable isRecurring = nil;
|
|
206
300
|
if (appInfo.isRecurring().has_value()) {
|
|
207
301
|
isRecurring = [NSNumber numberWithBool:appInfo.isRecurring().value()];
|
|
208
302
|
}
|
|
209
|
-
overridenAppInfo =
|
|
303
|
+
overridenAppInfo =
|
|
304
|
+
[[OverridenReclaimAppInfo alloc] initWithAppName:appInfo.appName()
|
|
305
|
+
appImageUrl:appInfo.appImageUrl()
|
|
306
|
+
isRecurring:isRecurring];
|
|
210
307
|
}
|
|
211
|
-
|
|
212
|
-
NSString *
|
|
308
|
+
|
|
309
|
+
NSString *_Nullable capabilityAccessToken = nil;
|
|
213
310
|
if (overrides.capabilityAccessToken() != nil) {
|
|
214
311
|
capabilityAccessToken = overrides.capabilityAccessToken();
|
|
215
312
|
}
|
|
216
|
-
|
|
217
|
-
[api setOverridesWithProvider:overridenProvider
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
313
|
+
|
|
314
|
+
[api setOverridesWithProvider:overridenProvider
|
|
315
|
+
featureOptions:overridenFeatureOptions
|
|
316
|
+
logConsumer:overridenLogConsumer
|
|
317
|
+
sessionManagement:sessionManagement
|
|
318
|
+
appInfo:overridenAppInfo
|
|
319
|
+
capabilityAccessToken:capabilityAccessToken
|
|
320
|
+
completionHandler:^(NSError *_Nullable error) {
|
|
321
|
+
if (error != nil) {
|
|
322
|
+
reject(@"OVERRIDE_ERROR", @"Error on override", error);
|
|
323
|
+
} else {
|
|
324
|
+
resolve(nil);
|
|
325
|
+
}
|
|
326
|
+
}];
|
|
224
327
|
}
|
|
225
328
|
|
|
226
|
-
- (void)clearAllOverrides:(nonnull RCTPromiseResolveBlock)resolve
|
|
227
|
-
|
|
329
|
+
- (void)clearAllOverrides:(nonnull RCTPromiseResolveBlock)resolve
|
|
330
|
+
reject:(nonnull RCTPromiseRejectBlock)reject {
|
|
331
|
+
[api clearAllOverridesWithCompletionHandler:^(NSError *_Nullable error) {
|
|
228
332
|
if (error != nil) {
|
|
229
333
|
reject(@"OVERRIDE_ERROR", @"Error on clearing overrides", error);
|
|
230
334
|
} else {
|
|
@@ -233,32 +337,57 @@ Api *api = [[Api alloc] init];
|
|
|
233
337
|
}];
|
|
234
338
|
}
|
|
235
339
|
|
|
236
|
-
- (void)setVerificationOptions:
|
|
237
|
-
|
|
340
|
+
- (void)setVerificationOptions:
|
|
341
|
+
(JS::NativeInappRnSdk::VerificationOptionsOptional &)args
|
|
342
|
+
resolve:(nonnull RCTPromiseResolveBlock)resolve
|
|
343
|
+
reject:(nonnull RCTPromiseRejectBlock)reject {
|
|
344
|
+
ReclaimApiVerificationOptions *_Nullable options = nil;
|
|
238
345
|
if (args.options().has_value()) {
|
|
239
|
-
JS::NativeInappRnSdk::VerificationOptions inputOptions =
|
|
240
|
-
|
|
346
|
+
JS::NativeInappRnSdk::VerificationOptions inputOptions =
|
|
347
|
+
args.options().value();
|
|
348
|
+
|
|
241
349
|
if (inputOptions.canUseAttestorAuthenticationRequest()) {
|
|
242
|
-
options = [[ReclaimApiVerificationOptions alloc]
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
350
|
+
options = [[ReclaimApiVerificationOptions alloc]
|
|
351
|
+
initWithCanDeleteCookiesBeforeVerificationStarts:
|
|
352
|
+
inputOptions.canDeleteCookiesBeforeVerificationStarts()
|
|
353
|
+
fetchAttestorAuthenticationRequest:^(
|
|
354
|
+
NSString *_Nonnull reclaimHttpProviderJsonString,
|
|
355
|
+
NSString *_Nonnull replyId) {
|
|
356
|
+
[self emitOnReclaimAttestorAuthRequest:@{
|
|
357
|
+
@"reclaimHttpProviderJsonString" :
|
|
358
|
+
reclaimHttpProviderJsonString,
|
|
359
|
+
@"replyId" : replyId
|
|
360
|
+
}];
|
|
361
|
+
}
|
|
362
|
+
claimCreationType:
|
|
363
|
+
inputOptions.claimCreationType()
|
|
364
|
+
canAutoSubmit:inputOptions
|
|
365
|
+
.canAutoSubmit()
|
|
366
|
+
isCloseButtonVisible:
|
|
367
|
+
inputOptions.isCloseButtonVisible()];
|
|
249
368
|
} else {
|
|
250
|
-
options = [[ReclaimApiVerificationOptions alloc]
|
|
369
|
+
options = [[ReclaimApiVerificationOptions alloc]
|
|
370
|
+
initWithCanDeleteCookiesBeforeVerificationStarts:
|
|
371
|
+
inputOptions.canDeleteCookiesBeforeVerificationStarts()
|
|
372
|
+
fetchAttestorAuthenticationRequest:nil
|
|
373
|
+
claimCreationType:
|
|
374
|
+
inputOptions.claimCreationType()
|
|
375
|
+
canAutoSubmit:inputOptions
|
|
376
|
+
.canAutoSubmit()
|
|
377
|
+
isCloseButtonVisible:
|
|
378
|
+
inputOptions.isCloseButtonVisible()];
|
|
251
379
|
}
|
|
252
|
-
|
|
253
380
|
}
|
|
254
|
-
[api setVerificationOptionsWithOptions:options
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
381
|
+
[api setVerificationOptionsWithOptions:options
|
|
382
|
+
completionHandler:^(NSError *_Nullable error) {
|
|
383
|
+
if (error != nil) {
|
|
384
|
+
reject(@"VERIFICATION_OPTIONS_ERROR",
|
|
385
|
+
@"Error on setting verification options",
|
|
386
|
+
error);
|
|
387
|
+
} else {
|
|
388
|
+
resolve(nil);
|
|
389
|
+
}
|
|
390
|
+
}];
|
|
261
391
|
}
|
|
262
392
|
|
|
263
|
-
|
|
264
393
|
@end
|
|
@@ -56,6 +56,12 @@
|
|
|
56
56
|
return facebook::react::managedPointer<JS::NativeInappRnSdk::SessionInformation>(json);
|
|
57
57
|
}
|
|
58
58
|
@end
|
|
59
|
+
@implementation RCTCxxConvert (NativeInappRnSdk_ProviderVersion)
|
|
60
|
+
+ (RCTManagedPointer *)JS_NativeInappRnSdk_ProviderVersion:(id)json
|
|
61
|
+
{
|
|
62
|
+
return facebook::react::managedPointer<JS::NativeInappRnSdk::ProviderVersion>(json);
|
|
63
|
+
}
|
|
64
|
+
@end
|
|
59
65
|
@implementation RCTCxxConvert (NativeInappRnSdk_Request)
|
|
60
66
|
+ (RCTManagedPointer *)JS_NativeInappRnSdk_Request:(id)json
|
|
61
67
|
{
|
|
@@ -120,6 +126,10 @@ namespace facebook::react {
|
|
|
120
126
|
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "startVerificationFromUrl", @selector(startVerificationFromUrl:resolve:reject:), args, count);
|
|
121
127
|
}
|
|
122
128
|
|
|
129
|
+
static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_startVerificationFromJson(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
130
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "startVerificationFromJson", @selector(startVerificationFromJson:resolve:reject:), args, count);
|
|
131
|
+
}
|
|
132
|
+
|
|
123
133
|
static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_setOverrides(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
124
134
|
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "setOverrides", @selector(setOverrides:resolve:reject:), args, count);
|
|
125
135
|
}
|
|
@@ -153,6 +163,9 @@ namespace facebook::react {
|
|
|
153
163
|
methodMap_["startVerificationFromUrl"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_startVerificationFromUrl};
|
|
154
164
|
|
|
155
165
|
|
|
166
|
+
methodMap_["startVerificationFromJson"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_startVerificationFromJson};
|
|
167
|
+
|
|
168
|
+
|
|
156
169
|
methodMap_["setOverrides"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_setOverrides};
|
|
157
170
|
setMethodArgConversionSelector(@"setOverrides", 0, @"JS_NativeInappRnSdk_Overrides:");
|
|
158
171
|
|
|
@@ -49,6 +49,22 @@ namespace JS {
|
|
|
49
49
|
@interface RCTCxxConvert (NativeInappRnSdk_SessionInformation)
|
|
50
50
|
+ (RCTManagedPointer *)JS_NativeInappRnSdk_SessionInformation:(id)json;
|
|
51
51
|
@end
|
|
52
|
+
namespace JS {
|
|
53
|
+
namespace NativeInappRnSdk {
|
|
54
|
+
struct ProviderVersion {
|
|
55
|
+
NSString *resolvedVersion() const;
|
|
56
|
+
NSString *versionExpression() const;
|
|
57
|
+
|
|
58
|
+
ProviderVersion(NSDictionary *const v) : _v(v) {}
|
|
59
|
+
private:
|
|
60
|
+
NSDictionary *_v;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@interface RCTCxxConvert (NativeInappRnSdk_ProviderVersion)
|
|
66
|
+
+ (RCTManagedPointer *)JS_NativeInappRnSdk_ProviderVersion:(id)json;
|
|
67
|
+
@end
|
|
52
68
|
namespace JS {
|
|
53
69
|
namespace NativeInappRnSdk {
|
|
54
70
|
struct Request {
|
|
@@ -58,8 +74,7 @@ namespace JS {
|
|
|
58
74
|
std::optional<JS::NativeInappRnSdk::SessionInformation> session() const;
|
|
59
75
|
NSString *contextString() const;
|
|
60
76
|
id<NSObject> _Nullable parameters() const;
|
|
61
|
-
std::optional<
|
|
62
|
-
NSString *webhookUrl() const;
|
|
77
|
+
std::optional<JS::NativeInappRnSdk::ProviderVersion> providerVersion() const;
|
|
63
78
|
|
|
64
79
|
Request(NSDictionary *const v) : _v(v) {}
|
|
65
80
|
private:
|
|
@@ -97,6 +112,8 @@ namespace JS {
|
|
|
97
112
|
std::optional<double> sessionTimeoutForManualVerificationTrigger() const;
|
|
98
113
|
NSString *attestorBrowserRpcUrl() const;
|
|
99
114
|
std::optional<bool> isAIFlowEnabled() const;
|
|
115
|
+
NSString *manualReviewMessage() const;
|
|
116
|
+
NSString *loginPromptMessage() const;
|
|
100
117
|
|
|
101
118
|
FeatureOptions(NSDictionary *const v) : _v(v) {}
|
|
102
119
|
private:
|
|
@@ -219,6 +236,9 @@ namespace JS {
|
|
|
219
236
|
- (void)startVerificationFromUrl:(NSString *)requestUrl
|
|
220
237
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
221
238
|
reject:(RCTPromiseRejectBlock)reject;
|
|
239
|
+
- (void)startVerificationFromJson:(NSString *)templateJsonString
|
|
240
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
241
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
222
242
|
- (void)setOverrides:(JS::NativeInappRnSdk::Overrides &)overrides
|
|
223
243
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
224
244
|
reject:(RCTPromiseRejectBlock)reject;
|
|
@@ -275,6 +295,16 @@ inline NSString *JS::NativeInappRnSdk::SessionInformation::signature() const
|
|
|
275
295
|
id const p = _v[@"signature"];
|
|
276
296
|
return RCTBridgingToString(p);
|
|
277
297
|
}
|
|
298
|
+
inline NSString *JS::NativeInappRnSdk::ProviderVersion::resolvedVersion() const
|
|
299
|
+
{
|
|
300
|
+
id const p = _v[@"resolvedVersion"];
|
|
301
|
+
return RCTBridgingToString(p);
|
|
302
|
+
}
|
|
303
|
+
inline NSString *JS::NativeInappRnSdk::ProviderVersion::versionExpression() const
|
|
304
|
+
{
|
|
305
|
+
id const p = _v[@"versionExpression"];
|
|
306
|
+
return RCTBridgingToString(p);
|
|
307
|
+
}
|
|
278
308
|
inline NSString *JS::NativeInappRnSdk::Request::appId() const
|
|
279
309
|
{
|
|
280
310
|
id const p = _v[@"appId"];
|
|
@@ -305,15 +335,10 @@ inline id<NSObject> _Nullable JS::NativeInappRnSdk::Request::parameters() const
|
|
|
305
335
|
id const p = _v[@"parameters"];
|
|
306
336
|
return p;
|
|
307
337
|
}
|
|
308
|
-
inline std::optional<
|
|
338
|
+
inline std::optional<JS::NativeInappRnSdk::ProviderVersion> JS::NativeInappRnSdk::Request::providerVersion() const
|
|
309
339
|
{
|
|
310
|
-
id const p = _v[@"
|
|
311
|
-
return
|
|
312
|
-
}
|
|
313
|
-
inline NSString *JS::NativeInappRnSdk::Request::webhookUrl() const
|
|
314
|
-
{
|
|
315
|
-
id const p = _v[@"webhookUrl"];
|
|
316
|
-
return RCTBridgingToOptionalString(p);
|
|
340
|
+
id const p = _v[@"providerVersion"];
|
|
341
|
+
return (p == nil ? std::nullopt : std::make_optional(JS::NativeInappRnSdk::ProviderVersion(p)));
|
|
317
342
|
}
|
|
318
343
|
inline NSString *JS::NativeInappRnSdk::ProviderInformation::url() const
|
|
319
344
|
{
|
|
@@ -360,6 +385,16 @@ inline std::optional<bool> JS::NativeInappRnSdk::FeatureOptions::isAIFlowEnabled
|
|
|
360
385
|
id const p = _v[@"isAIFlowEnabled"];
|
|
361
386
|
return RCTBridgingToOptionalBool(p);
|
|
362
387
|
}
|
|
388
|
+
inline NSString *JS::NativeInappRnSdk::FeatureOptions::manualReviewMessage() const
|
|
389
|
+
{
|
|
390
|
+
id const p = _v[@"manualReviewMessage"];
|
|
391
|
+
return RCTBridgingToOptionalString(p);
|
|
392
|
+
}
|
|
393
|
+
inline NSString *JS::NativeInappRnSdk::FeatureOptions::loginPromptMessage() const
|
|
394
|
+
{
|
|
395
|
+
id const p = _v[@"loginPromptMessage"];
|
|
396
|
+
return RCTBridgingToOptionalString(p);
|
|
397
|
+
}
|
|
363
398
|
inline bool JS::NativeInappRnSdk::LogConsumer::enableLogHandler() const
|
|
364
399
|
{
|
|
365
400
|
id const p = _v[@"enableLogHandler"];
|