@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.
Files changed (40) hide show
  1. package/InappRnSdk.podspec +1 -1
  2. package/README.md +7 -6
  3. package/android/build.gradle +1 -1
  4. package/android/generated/java/com/reclaimprotocol/inapp_rn_sdk/NativeInappRnSdkSpec.java +4 -0
  5. package/android/generated/jni/RNInappRnSdkSpec-generated.cpp +6 -0
  6. package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI-generated.cpp +7 -0
  7. package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI.h +95 -22
  8. package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/InappRnSdkModule.kt +44 -9
  9. package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/JsonExtension.kt +18 -0
  10. package/ios/InappRnSdk.mm +266 -138
  11. package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec-generated.mm +13 -0
  12. package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec.h +45 -10
  13. package/ios/generated/RNInappRnSdkSpecJSI-generated.cpp +7 -0
  14. package/ios/generated/RNInappRnSdkSpecJSI.h +95 -22
  15. package/ios/inapp_rn_sdk/Api.swift +322 -154
  16. package/lib/commonjs/index.js +36 -1
  17. package/lib/commonjs/index.js.map +1 -1
  18. package/lib/commonjs/specs/NativeInappRnSdk.js.map +1 -1
  19. package/lib/module/index.js +36 -1
  20. package/lib/module/index.js.map +1 -1
  21. package/lib/module/specs/NativeInappRnSdk.js.map +1 -1
  22. package/lib/typescript/commonjs/src/index.d.ts +18 -2
  23. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  24. package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts +22 -2
  25. package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/user-workspace/src/App.d.ts +2 -0
  27. package/lib/typescript/commonjs/user-workspace/src/App.d.ts.map +1 -0
  28. package/lib/typescript/commonjs/user-workspace/src/App.overrides.d.ts +2 -0
  29. package/lib/typescript/commonjs/user-workspace/src/App.overrides.d.ts.map +1 -0
  30. package/lib/typescript/module/src/index.d.ts +18 -2
  31. package/lib/typescript/module/src/index.d.ts.map +1 -1
  32. package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts +22 -2
  33. package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts.map +1 -1
  34. package/lib/typescript/module/user-workspace/src/App.d.ts +2 -0
  35. package/lib/typescript/module/user-workspace/src/App.d.ts.map +1 -0
  36. package/lib/typescript/module/user-workspace/src/App.overrides.d.ts +2 -0
  37. package/lib/typescript/module/user-workspace/src/App.overrides.d.ts.map +1 -0
  38. package/package.json +8 -7
  39. package/src/index.ts +59 -3
  40. package/src/specs/NativeInappRnSdk.ts +24 -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 reject:(nonnull RCTPromiseRejectBlock)reject {
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 value:(nonnull NSString *)value {
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 resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
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
- bool acceptAiProviders = false;
46
- if (request.acceptAiProviders().has_value()) {
47
- acceptAiProviders = request.acceptAiProviders().value();
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,263 @@ 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]] || ![tempDictionary[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 = (NSDictionary<NSString *, NSString *> *)potentialParameters;
82
+ parameters =
83
+ (NSDictionary<NSString *, NSString *> *)potentialParameters;
75
84
  } else {
76
- NSLog(@"[InappRnSdk] request.parameters() contains non string key or value");
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() secret:request.secret() providerId:request.providerId() sessionTimestamp:timestamp sessionSessionId:sessionId sessionSignature:signature context:request.contextString() parameters:parameters acceptAiProviders:acceptAiProviders webhookUrl:request.webhookUrl() completionHandler:^(NSDictionary<NSString *,id> * _Nullable result, NSError * _Nullable error) {
85
- if (error != nil) {
86
- NSLog(@"[InappRnSdk] Api Error: %@", error);
87
- reject(@"VERIFICATION_ERROR", @"Verification Error", error);
88
- } else {
89
- resolve(result);
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 resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
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 completionHandler:^(NSDictionary<NSString *,id> * _Nullable result, NSError * _Nullable error) {
99
- if (error != nil) {
100
- NSLog(@"[InappRnSdk] Api Error: %@", error);
101
- reject(@"VERIFICATION_ERROR", @"Verification Error", error);
102
- } else {
103
- resolve(result);
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 resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
109
-
110
- OverridenProviderInformation * _Nullable overridenProvider = nil;
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 = overrides.provider().value();
141
+ JS::NativeInappRnSdk::ProviderInformation provider =
142
+ overrides.provider().value();
113
143
  if (provider.url() != nil && provider.url().length > 0) {
114
- overridenProvider = [[OverridenProviderInformation alloc] initWithUrl:provider.url() jsonString:nil callback:nil];
115
- } else if (provider.jsonString() != nil && provider.jsonString().length > 0) {
116
- overridenProvider = [[OverridenProviderInformation alloc] initWithUrl:nil jsonString:provider.jsonString() callback:nil];
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 * callback = [[OverridenProviderCallbackHandler alloc] initWith_fetchProviderInformation:^(NSString * _Nonnull appId, NSString * _Nonnull providerId, NSString * _Nonnull sessionId, NSString * _Nonnull signature, NSString * _Nonnull timestamp, NSString * _Nonnull replyId) {
119
- [self emitOnProviderInformationRequest:@{
120
- @"appId": appId,
121
- @"providerId": providerId,
122
- @"sessionId": sessionId,
123
- @"signature": signature,
124
- @"timestamp": timestamp,
125
- @"replyId": replyId
126
- }];
127
- }];
128
- overridenProvider = [[OverridenProviderInformation alloc] initWithUrl:nil jsonString:nil callback:callback];
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 replyId) {
161
+ [self emitOnProviderInformationRequest:@{
162
+ @"appId" : appId,
163
+ @"providerId" : providerId,
164
+ @"sessionId" : sessionId,
165
+ @"signature" : signature,
166
+ @"timestamp" : timestamp,
167
+ @"replyId" : replyId
168
+ }];
169
+ }];
170
+ overridenProvider =
171
+ [[OverridenProviderInformation alloc] initWithUrl:nil
172
+ jsonString:nil
173
+ callback:callback];
129
174
  }
130
175
  }
131
-
132
- OverridenFeatureOptions * _Nullable overridenFeatureOptions = nil;
176
+
177
+ OverridenFeatureOptions *_Nullable overridenFeatureOptions = nil;
133
178
  if (overrides.featureOptions().has_value()) {
134
- JS::NativeInappRnSdk::FeatureOptions featureOptions = overrides.featureOptions().value();
135
- overridenFeatureOptions = [[OverridenFeatureOptions alloc] initWithCookiePersist:nil singleReclaimRequest:nil idleTimeThresholdForManualVerificationTrigger:nil sessionTimeoutForManualVerificationTrigger:nil attestorBrowserRpcUrl:nil isAIFlowEnabled:nil];
136
-
179
+ JS::NativeInappRnSdk::FeatureOptions featureOptions =
180
+ overrides.featureOptions().value();
181
+ overridenFeatureOptions =
182
+ [[OverridenFeatureOptions alloc] initWithCookiePersist:nil
183
+ singleReclaimRequest:nil
184
+ idleTimeThresholdForManualVerificationTrigger:nil
185
+ sessionTimeoutForManualVerificationTrigger:nil
186
+ attestorBrowserRpcUrl:nil
187
+ isAIFlowEnabled:nil
188
+ manualReviewMessage:nil
189
+ loginPromptMessage:nil];
190
+
137
191
  if (featureOptions.cookiePersist().has_value()) {
138
- overridenFeatureOptions.cookiePersist = [NSNumber numberWithBool:featureOptions.cookiePersist().value()];
192
+ overridenFeatureOptions.cookiePersist =
193
+ [NSNumber numberWithBool:featureOptions.cookiePersist().value()];
139
194
  }
140
195
  if (featureOptions.singleReclaimRequest().has_value()) {
141
- overridenFeatureOptions.singleReclaimRequest = [NSNumber numberWithBool:featureOptions.singleReclaimRequest().value()];
196
+ overridenFeatureOptions.singleReclaimRequest = [NSNumber
197
+ numberWithBool:featureOptions.singleReclaimRequest().value()];
142
198
  }
143
- if (featureOptions.idleTimeThresholdForManualVerificationTrigger().has_value()) {
144
- overridenFeatureOptions.idleTimeThresholdForManualVerificationTrigger = [NSNumber numberWithDouble:featureOptions.idleTimeThresholdForManualVerificationTrigger().value()];
199
+ if (featureOptions.idleTimeThresholdForManualVerificationTrigger()
200
+ .has_value()) {
201
+ overridenFeatureOptions
202
+ .idleTimeThresholdForManualVerificationTrigger = [NSNumber
203
+ numberWithDouble:featureOptions
204
+ .idleTimeThresholdForManualVerificationTrigger()
205
+ .value()];
145
206
  }
146
- if (featureOptions.sessionTimeoutForManualVerificationTrigger().has_value()) {
147
- overridenFeatureOptions.sessionTimeoutForManualVerificationTrigger = [NSNumber numberWithDouble:featureOptions.sessionTimeoutForManualVerificationTrigger().value()];
207
+ if (featureOptions.sessionTimeoutForManualVerificationTrigger()
208
+ .has_value()) {
209
+ overridenFeatureOptions.sessionTimeoutForManualVerificationTrigger =
210
+ [NSNumber
211
+ numberWithDouble:featureOptions
212
+ .sessionTimeoutForManualVerificationTrigger()
213
+ .value()];
148
214
  }
149
- if (featureOptions.attestorBrowserRpcUrl() != nil && featureOptions.attestorBrowserRpcUrl().length > 0) {
150
- overridenFeatureOptions.attestorBrowserRpcUrl = featureOptions.attestorBrowserRpcUrl();
215
+ if (featureOptions.attestorBrowserRpcUrl() != nil &&
216
+ featureOptions.attestorBrowserRpcUrl().length > 0) {
217
+ overridenFeatureOptions.attestorBrowserRpcUrl =
218
+ featureOptions.attestorBrowserRpcUrl();
151
219
  }
152
220
  if (featureOptions.isAIFlowEnabled().has_value()) {
153
- overridenFeatureOptions.isAIFlowEnabled = [NSNumber numberWithBool:featureOptions.isAIFlowEnabled().value()];
221
+ overridenFeatureOptions.isAIFlowEnabled =
222
+ [NSNumber numberWithBool:featureOptions.isAIFlowEnabled().value()];
154
223
  }
155
224
  }
156
-
157
- OverridenLogConsumer * _Nullable overridenLogConsumer = nil;
225
+
226
+ OverridenLogConsumer *_Nullable overridenLogConsumer = nil;
158
227
  if (overrides.logConsumer().has_value()) {
159
228
  BOOL canSDKCollectTelemetry = true;
160
229
  if (overrides.logConsumer().value().canSdkCollectTelemetry().has_value()) {
161
- canSDKCollectTelemetry =overrides.logConsumer().value().canSdkCollectTelemetry().value();
230
+ canSDKCollectTelemetry =
231
+ overrides.logConsumer().value().canSdkCollectTelemetry().value();
162
232
  }
163
- NSNumber * _Nullable canSdkPrintLogs = nil;
233
+ NSNumber *_Nullable canSdkPrintLogs = nil;
164
234
  if (overrides.logConsumer().value().canSdkPrintLogs().has_value()) {
165
- canSdkPrintLogs = [NSNumber numberWithBool:overrides.logConsumer().value().canSdkPrintLogs().value()];
235
+ canSdkPrintLogs = [NSNumber numberWithBool:overrides.logConsumer()
236
+ .value()
237
+ .canSdkPrintLogs()
238
+ .value()];
166
239
  }
167
- OverridenLogHandler * _Nullable logHandler;
240
+ OverridenLogHandler *_Nullable logHandler;
168
241
  if (overrides.logConsumer().value().enableLogHandler()) {
169
- logHandler = [[OverridenLogHandler alloc] initOnLogs:^(NSString * _Nonnull logJsonString) {
170
- [self emitOnLogs:logJsonString];
171
- }];
242
+ logHandler = [[OverridenLogHandler alloc]
243
+ initOnLogs:^(NSString *_Nonnull logJsonString) {
244
+ [self emitOnLogs:logJsonString];
245
+ }];
172
246
  }
173
- overridenLogConsumer = [[OverridenLogConsumer alloc] initWithLogHandler: logHandler canSdkCollectTelemetry: canSDKCollectTelemetry canSdkPrintLogs: canSdkPrintLogs];
247
+ overridenLogConsumer =
248
+ [[OverridenLogConsumer alloc] initWithLogHandler:logHandler
249
+ canSdkCollectTelemetry:canSDKCollectTelemetry
250
+ canSdkPrintLogs:canSdkPrintLogs];
174
251
  }
175
-
176
- OverridenSessionManagement * _Nullable sessionManagement;
252
+
253
+ OverridenSessionManagement *_Nullable sessionManagement;
177
254
  if (overrides.sessionManagement().has_value()) {
178
- sessionManagement = [[OverridenSessionManagement alloc] initWithHandler:[[OverridenSessionHandler alloc] initWith_createSession:^(NSString * _Nonnull appId, NSString * _Nonnull providerId, NSString * _Nonnull timestamp, NSString * _Nonnull signature, NSString * _Nonnull replyId) {
179
- [self emitOnSessionCreateRequest:@{
180
- @"appId": appId,
181
- @"providerId": providerId,
182
- @"timestamp": timestamp,
183
- @"signature": signature,
184
- @"replyId": replyId
185
- }];
186
- } _updateSession:^(NSString * _Nonnull sessionId, NSString * _Nonnull status, NSString * _Nonnull replyId) {
187
- [self emitOnSessionUpdateRequest:@{
188
- @"sessionId": sessionId,
189
- @"status": status,
190
- @"replyId": replyId
191
- }];
192
- } _logSession:^(NSString * _Nonnull appId, NSString * _Nonnull providerId, NSString * _Nonnull sessionId, NSString * _Nonnull logType) {
193
- [self emitOnSessionLogs:@{
194
- @"appId": appId,
195
- @"providerId": providerId,
196
- @"sessionId": sessionId,
197
- @"logType": logType
198
- }];
199
- }]];
255
+ sessionManagement = [[OverridenSessionManagement alloc]
256
+ initWithHandler:[[OverridenSessionHandler alloc]
257
+ initWith_createSession:^(
258
+ NSString *_Nonnull appId,
259
+ NSString *_Nonnull providerId,
260
+ NSString *_Nonnull timestamp,
261
+ NSString *_Nonnull signature,
262
+ NSString *_Nonnull providerVersion,
263
+ NSString *_Nonnull replyId) {
264
+ [self emitOnSessionCreateRequest:@{
265
+ @"appId" : appId,
266
+ @"providerId" : providerId,
267
+ @"timestamp" : timestamp,
268
+ @"signature" : signature,
269
+ @"providerVersion": providerVersion,
270
+ @"replyId" : replyId
271
+ }];
272
+ }
273
+ _updateSession:^(NSString *_Nonnull sessionId,
274
+ NSString *_Nonnull status,
275
+ NSString *_Nonnull replyId) {
276
+ [self emitOnSessionUpdateRequest:@{
277
+ @"sessionId" : sessionId,
278
+ @"status" : status,
279
+ @"replyId" : replyId
280
+ }];
281
+ }
282
+ _logSession:^(NSString *_Nonnull appId,
283
+ NSString *_Nonnull providerId,
284
+ NSString *_Nonnull sessionId,
285
+ NSString *_Nonnull logType) {
286
+ [self emitOnSessionLogs:@{
287
+ @"appId" : appId,
288
+ @"providerId" : providerId,
289
+ @"sessionId" : sessionId,
290
+ @"logType" : logType
291
+ }];
292
+ }]];
200
293
  }
201
-
202
- OverridenReclaimAppInfo * _Nullable overridenAppInfo = nil;
294
+
295
+ OverridenReclaimAppInfo *_Nullable overridenAppInfo = nil;
203
296
  if (overrides.appInfo().has_value()) {
204
297
  JS::NativeInappRnSdk::ReclaimAppInfo appInfo = overrides.appInfo().value();
205
- NSNumber * _Nullable isRecurring = nil;
298
+ NSNumber *_Nullable isRecurring = nil;
206
299
  if (appInfo.isRecurring().has_value()) {
207
300
  isRecurring = [NSNumber numberWithBool:appInfo.isRecurring().value()];
208
301
  }
209
- overridenAppInfo = [[OverridenReclaimAppInfo alloc] initWithAppName:appInfo.appName() appImageUrl:appInfo.appImageUrl() isRecurring:isRecurring];
302
+ overridenAppInfo =
303
+ [[OverridenReclaimAppInfo alloc] initWithAppName:appInfo.appName()
304
+ appImageUrl:appInfo.appImageUrl()
305
+ isRecurring:isRecurring];
210
306
  }
211
-
212
- NSString * _Nullable capabilityAccessToken = nil;
307
+
308
+ NSString *_Nullable capabilityAccessToken = nil;
213
309
  if (overrides.capabilityAccessToken() != nil) {
214
310
  capabilityAccessToken = overrides.capabilityAccessToken();
215
311
  }
216
-
217
- [api setOverridesWithProvider:overridenProvider featureOptions:overridenFeatureOptions logConsumer:overridenLogConsumer sessionManagement: sessionManagement appInfo:overridenAppInfo capabilityAccessToken: capabilityAccessToken completionHandler:^(NSError * _Nullable error) {
218
- if (error != nil) {
219
- reject(@"OVERRIDE_ERROR", @"Error on override", error);
220
- } else {
221
- resolve(nil);
222
- }
223
- }];
312
+
313
+ [api setOverridesWithProvider:overridenProvider
314
+ featureOptions:overridenFeatureOptions
315
+ logConsumer:overridenLogConsumer
316
+ sessionManagement:sessionManagement
317
+ appInfo:overridenAppInfo
318
+ capabilityAccessToken:capabilityAccessToken
319
+ completionHandler:^(NSError *_Nullable error) {
320
+ if (error != nil) {
321
+ reject(@"OVERRIDE_ERROR", @"Error on override", error);
322
+ } else {
323
+ resolve(nil);
324
+ }
325
+ }];
224
326
  }
225
327
 
226
- - (void)clearAllOverrides:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
227
- [api clearAllOverridesWithCompletionHandler:^(NSError * _Nullable error) {
328
+ - (void)clearAllOverrides:(nonnull RCTPromiseResolveBlock)resolve
329
+ reject:(nonnull RCTPromiseRejectBlock)reject {
330
+ [api clearAllOverridesWithCompletionHandler:^(NSError *_Nullable error) {
228
331
  if (error != nil) {
229
332
  reject(@"OVERRIDE_ERROR", @"Error on clearing overrides", error);
230
333
  } else {
@@ -233,32 +336,57 @@ Api *api = [[Api alloc] init];
233
336
  }];
234
337
  }
235
338
 
236
- - (void)setVerificationOptions:(JS::NativeInappRnSdk::VerificationOptionsOptional &)args resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
237
- ReclaimApiVerificationOptions * _Nullable options = nil;
339
+ - (void)setVerificationOptions:
340
+ (JS::NativeInappRnSdk::VerificationOptionsOptional &)args
341
+ resolve:(nonnull RCTPromiseResolveBlock)resolve
342
+ reject:(nonnull RCTPromiseRejectBlock)reject {
343
+ ReclaimApiVerificationOptions *_Nullable options = nil;
238
344
  if (args.options().has_value()) {
239
- JS::NativeInappRnSdk::VerificationOptions inputOptions = args.options().value();
240
-
345
+ JS::NativeInappRnSdk::VerificationOptions inputOptions =
346
+ args.options().value();
347
+
241
348
  if (inputOptions.canUseAttestorAuthenticationRequest()) {
242
- options = [[ReclaimApiVerificationOptions alloc] initWithCanDeleteCookiesBeforeVerificationStarts:inputOptions.canDeleteCookiesBeforeVerificationStarts() fetchAttestorAuthenticationRequest:^(NSString * _Nonnull reclaimHttpProviderJsonString, NSString * _Nonnull replyId) {
243
- [self emitOnReclaimAttestorAuthRequest:@{
244
- @"reclaimHttpProviderJsonString": reclaimHttpProviderJsonString,
245
- @"replyId": replyId
246
- }];
247
- } claimCreationType:inputOptions.claimCreationType() canAutoSubmit:inputOptions.canAutoSubmit() isCloseButtonVisible:inputOptions.isCloseButtonVisible()
248
- ];
349
+ options = [[ReclaimApiVerificationOptions alloc]
350
+ initWithCanDeleteCookiesBeforeVerificationStarts:
351
+ inputOptions.canDeleteCookiesBeforeVerificationStarts()
352
+ fetchAttestorAuthenticationRequest:^(
353
+ NSString *_Nonnull reclaimHttpProviderJsonString,
354
+ NSString *_Nonnull replyId) {
355
+ [self emitOnReclaimAttestorAuthRequest:@{
356
+ @"reclaimHttpProviderJsonString" :
357
+ reclaimHttpProviderJsonString,
358
+ @"replyId" : replyId
359
+ }];
360
+ }
361
+ claimCreationType:
362
+ inputOptions.claimCreationType()
363
+ canAutoSubmit:inputOptions
364
+ .canAutoSubmit()
365
+ isCloseButtonVisible:
366
+ inputOptions.isCloseButtonVisible()];
249
367
  } else {
250
- options = [[ReclaimApiVerificationOptions alloc] initWithCanDeleteCookiesBeforeVerificationStarts:inputOptions.canDeleteCookiesBeforeVerificationStarts() fetchAttestorAuthenticationRequest:nil claimCreationType:inputOptions.claimCreationType() canAutoSubmit:inputOptions.canAutoSubmit() isCloseButtonVisible:inputOptions.isCloseButtonVisible()];
368
+ options = [[ReclaimApiVerificationOptions alloc]
369
+ initWithCanDeleteCookiesBeforeVerificationStarts:
370
+ inputOptions.canDeleteCookiesBeforeVerificationStarts()
371
+ fetchAttestorAuthenticationRequest:nil
372
+ claimCreationType:
373
+ inputOptions.claimCreationType()
374
+ canAutoSubmit:inputOptions
375
+ .canAutoSubmit()
376
+ isCloseButtonVisible:
377
+ inputOptions.isCloseButtonVisible()];
251
378
  }
252
-
253
379
  }
254
- [api setVerificationOptionsWithOptions:options completionHandler:^(NSError * _Nullable error) {
255
- if (error != nil) {
256
- reject(@"VERIFICATION_OPTIONS_ERROR", @"Error on setting verification options", error);
257
- } else {
258
- resolve(nil);
259
- }
260
- }];
380
+ [api setVerificationOptionsWithOptions:options
381
+ completionHandler:^(NSError *_Nullable error) {
382
+ if (error != nil) {
383
+ reject(@"VERIFICATION_OPTIONS_ERROR",
384
+ @"Error on setting verification options",
385
+ error);
386
+ } else {
387
+ resolve(nil);
388
+ }
389
+ }];
261
390
  }
262
391
 
263
-
264
392
  @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<bool> acceptAiProviders() const;
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<bool> JS::NativeInappRnSdk::Request::acceptAiProviders() const
338
+ inline std::optional<JS::NativeInappRnSdk::ProviderVersion> JS::NativeInappRnSdk::Request::providerVersion() const
309
339
  {
310
- id const p = _v[@"acceptAiProviders"];
311
- return RCTBridgingToOptionalBool(p);
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"];