@reclaimprotocol/inapp-rn-sdk 0.1.7 → 0.2.1
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 +10 -6
- package/android/build.gradle +3 -3
- package/android/generated/java/com/reclaimprotocol/inapp_rn_sdk/NativeInappRnSdkSpec.java +16 -0
- package/android/generated/jni/RNInappRnSdkSpec-generated.cpp +14 -0
- package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI-generated.cpp +15 -0
- package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI.h +192 -20
- package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/InappRnSdkModule.kt +99 -20
- package/ios/InappRnSdk.mm +35 -8
- package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec-generated.mm +24 -0
- package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec.h +18 -6
- package/ios/generated/RNInappRnSdkSpecJSI-generated.cpp +15 -0
- package/ios/generated/RNInappRnSdkSpecJSI.h +192 -20
- package/ios/inapp_rn_sdk/Api.swift +73 -7
- package/lib/commonjs/ReclaimVerificationPlatformChannel.js +120 -36
- package/lib/commonjs/ReclaimVerificationPlatformChannel.js.map +1 -1
- package/lib/commonjs/index.js +11 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeInappRnSdk.js +1 -0
- package/lib/commonjs/specs/NativeInappRnSdk.js.map +1 -1
- package/lib/module/ReclaimVerificationPlatformChannel.js +117 -34
- package/lib/module/ReclaimVerificationPlatformChannel.js.map +1 -1
- package/lib/module/index.js +7 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeInappRnSdk.js +2 -0
- package/lib/module/specs/NativeInappRnSdk.js.map +1 -1
- package/lib/typescript/commonjs/src/ReclaimVerificationPlatformChannel.d.ts +29 -4
- package/lib/typescript/commonjs/src/ReclaimVerificationPlatformChannel.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +4 -3
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts +22 -4
- package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts.map +1 -1
- package/lib/typescript/module/src/ReclaimVerificationPlatformChannel.d.ts +29 -4
- package/lib/typescript/module/src/ReclaimVerificationPlatformChannel.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +4 -3
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts +22 -4
- package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ReclaimVerificationPlatformChannel.ts +149 -41
- package/src/index.ts +8 -4
- package/src/specs/NativeInappRnSdk.ts +32 -6
|
@@ -174,15 +174,16 @@ struct NativeInappRnSdkLogConsumerBridging {
|
|
|
174
174
|
|
|
175
175
|
#pragma mark - NativeInappRnSdkOverrides
|
|
176
176
|
|
|
177
|
-
template <typename P0, typename P1, typename P2, typename P3, typename P4>
|
|
177
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5>
|
|
178
178
|
struct NativeInappRnSdkOverrides {
|
|
179
179
|
P0 provider;
|
|
180
180
|
P1 featureOptions;
|
|
181
181
|
P2 logConsumer;
|
|
182
182
|
P3 sessionManagement;
|
|
183
183
|
P4 appInfo;
|
|
184
|
+
P5 capabilityAccessToken;
|
|
184
185
|
bool operator==(const NativeInappRnSdkOverrides &other) const {
|
|
185
|
-
return provider == other.provider && featureOptions == other.featureOptions && logConsumer == other.logConsumer && sessionManagement == other.sessionManagement && appInfo == other.appInfo;
|
|
186
|
+
return provider == other.provider && featureOptions == other.featureOptions && logConsumer == other.logConsumer && sessionManagement == other.sessionManagement && appInfo == other.appInfo && capabilityAccessToken == other.capabilityAccessToken;
|
|
186
187
|
}
|
|
187
188
|
};
|
|
188
189
|
|
|
@@ -199,7 +200,8 @@ struct NativeInappRnSdkOverridesBridging {
|
|
|
199
200
|
bridging::fromJs<decltype(types.featureOptions)>(rt, value.getProperty(rt, "featureOptions"), jsInvoker),
|
|
200
201
|
bridging::fromJs<decltype(types.logConsumer)>(rt, value.getProperty(rt, "logConsumer"), jsInvoker),
|
|
201
202
|
bridging::fromJs<decltype(types.sessionManagement)>(rt, value.getProperty(rt, "sessionManagement"), jsInvoker),
|
|
202
|
-
bridging::fromJs<decltype(types.appInfo)>(rt, value.getProperty(rt, "appInfo"), jsInvoker)
|
|
203
|
+
bridging::fromJs<decltype(types.appInfo)>(rt, value.getProperty(rt, "appInfo"), jsInvoker),
|
|
204
|
+
bridging::fromJs<decltype(types.capabilityAccessToken)>(rt, value.getProperty(rt, "capabilityAccessToken"), jsInvoker)};
|
|
203
205
|
return result;
|
|
204
206
|
}
|
|
205
207
|
|
|
@@ -223,6 +225,10 @@ struct NativeInappRnSdkOverridesBridging {
|
|
|
223
225
|
static std::optional<jsi::Object> appInfoToJs(jsi::Runtime &rt, decltype(types.appInfo) value) {
|
|
224
226
|
return bridging::toJs(rt, value);
|
|
225
227
|
}
|
|
228
|
+
|
|
229
|
+
static std::optional<jsi::String> capabilityAccessTokenToJs(jsi::Runtime &rt, decltype(types.capabilityAccessToken) value) {
|
|
230
|
+
return bridging::toJs(rt, value);
|
|
231
|
+
}
|
|
226
232
|
#endif
|
|
227
233
|
|
|
228
234
|
static jsi::Object toJs(
|
|
@@ -245,6 +251,9 @@ struct NativeInappRnSdkOverridesBridging {
|
|
|
245
251
|
if (value.appInfo) {
|
|
246
252
|
result.setProperty(rt, "appInfo", bridging::toJs(rt, value.appInfo.value(), jsInvoker));
|
|
247
253
|
}
|
|
254
|
+
if (value.capabilityAccessToken) {
|
|
255
|
+
result.setProperty(rt, "capabilityAccessToken", bridging::toJs(rt, value.capabilityAccessToken.value(), jsInvoker));
|
|
256
|
+
}
|
|
248
257
|
return result;
|
|
249
258
|
}
|
|
250
259
|
};
|
|
@@ -253,12 +262,13 @@ struct NativeInappRnSdkOverridesBridging {
|
|
|
253
262
|
|
|
254
263
|
#pragma mark - NativeInappRnSdkProviderInformation
|
|
255
264
|
|
|
256
|
-
template <typename P0, typename P1>
|
|
265
|
+
template <typename P0, typename P1, typename P2>
|
|
257
266
|
struct NativeInappRnSdkProviderInformation {
|
|
258
267
|
P0 url;
|
|
259
268
|
P1 jsonString;
|
|
269
|
+
P2 canFetchProviderInformationFromHost;
|
|
260
270
|
bool operator==(const NativeInappRnSdkProviderInformation &other) const {
|
|
261
|
-
return url == other.url && jsonString == other.jsonString;
|
|
271
|
+
return url == other.url && jsonString == other.jsonString && canFetchProviderInformationFromHost == other.canFetchProviderInformationFromHost;
|
|
262
272
|
}
|
|
263
273
|
};
|
|
264
274
|
|
|
@@ -272,7 +282,8 @@ struct NativeInappRnSdkProviderInformationBridging {
|
|
|
272
282
|
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
273
283
|
T result{
|
|
274
284
|
bridging::fromJs<decltype(types.url)>(rt, value.getProperty(rt, "url"), jsInvoker),
|
|
275
|
-
bridging::fromJs<decltype(types.jsonString)>(rt, value.getProperty(rt, "jsonString"), jsInvoker)
|
|
285
|
+
bridging::fromJs<decltype(types.jsonString)>(rt, value.getProperty(rt, "jsonString"), jsInvoker),
|
|
286
|
+
bridging::fromJs<decltype(types.canFetchProviderInformationFromHost)>(rt, value.getProperty(rt, "canFetchProviderInformationFromHost"), jsInvoker)};
|
|
276
287
|
return result;
|
|
277
288
|
}
|
|
278
289
|
|
|
@@ -284,6 +295,10 @@ struct NativeInappRnSdkProviderInformationBridging {
|
|
|
284
295
|
static jsi::String jsonStringToJs(jsi::Runtime &rt, decltype(types.jsonString) value) {
|
|
285
296
|
return bridging::toJs(rt, value);
|
|
286
297
|
}
|
|
298
|
+
|
|
299
|
+
static bool canFetchProviderInformationFromHostToJs(jsi::Runtime &rt, decltype(types.canFetchProviderInformationFromHost) value) {
|
|
300
|
+
return bridging::toJs(rt, value);
|
|
301
|
+
}
|
|
287
302
|
#endif
|
|
288
303
|
|
|
289
304
|
static jsi::Object toJs(
|
|
@@ -297,6 +312,83 @@ struct NativeInappRnSdkProviderInformationBridging {
|
|
|
297
312
|
if (value.jsonString) {
|
|
298
313
|
result.setProperty(rt, "jsonString", bridging::toJs(rt, value.jsonString.value(), jsInvoker));
|
|
299
314
|
}
|
|
315
|
+
result.setProperty(rt, "canFetchProviderInformationFromHost", bridging::toJs(rt, value.canFetchProviderInformationFromHost, jsInvoker));
|
|
316
|
+
return result;
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
#pragma mark - NativeInappRnSdkProviderInformationRequest
|
|
323
|
+
|
|
324
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5>
|
|
325
|
+
struct NativeInappRnSdkProviderInformationRequest {
|
|
326
|
+
P0 appId;
|
|
327
|
+
P1 providerId;
|
|
328
|
+
P2 sessionId;
|
|
329
|
+
P3 signature;
|
|
330
|
+
P4 timestamp;
|
|
331
|
+
P5 replyId;
|
|
332
|
+
bool operator==(const NativeInappRnSdkProviderInformationRequest &other) const {
|
|
333
|
+
return appId == other.appId && providerId == other.providerId && sessionId == other.sessionId && signature == other.signature && timestamp == other.timestamp && replyId == other.replyId;
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
template <typename T>
|
|
338
|
+
struct NativeInappRnSdkProviderInformationRequestBridging {
|
|
339
|
+
static T types;
|
|
340
|
+
|
|
341
|
+
static T fromJs(
|
|
342
|
+
jsi::Runtime &rt,
|
|
343
|
+
const jsi::Object &value,
|
|
344
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
345
|
+
T result{
|
|
346
|
+
bridging::fromJs<decltype(types.appId)>(rt, value.getProperty(rt, "appId"), jsInvoker),
|
|
347
|
+
bridging::fromJs<decltype(types.providerId)>(rt, value.getProperty(rt, "providerId"), jsInvoker),
|
|
348
|
+
bridging::fromJs<decltype(types.sessionId)>(rt, value.getProperty(rt, "sessionId"), jsInvoker),
|
|
349
|
+
bridging::fromJs<decltype(types.signature)>(rt, value.getProperty(rt, "signature"), jsInvoker),
|
|
350
|
+
bridging::fromJs<decltype(types.timestamp)>(rt, value.getProperty(rt, "timestamp"), jsInvoker),
|
|
351
|
+
bridging::fromJs<decltype(types.replyId)>(rt, value.getProperty(rt, "replyId"), jsInvoker)};
|
|
352
|
+
return result;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
#ifdef DEBUG
|
|
356
|
+
static jsi::String appIdToJs(jsi::Runtime &rt, decltype(types.appId) value) {
|
|
357
|
+
return bridging::toJs(rt, value);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
static jsi::String providerIdToJs(jsi::Runtime &rt, decltype(types.providerId) value) {
|
|
361
|
+
return bridging::toJs(rt, value);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
static jsi::String sessionIdToJs(jsi::Runtime &rt, decltype(types.sessionId) value) {
|
|
365
|
+
return bridging::toJs(rt, value);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
static jsi::String signatureToJs(jsi::Runtime &rt, decltype(types.signature) value) {
|
|
369
|
+
return bridging::toJs(rt, value);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
static jsi::String timestampToJs(jsi::Runtime &rt, decltype(types.timestamp) value) {
|
|
373
|
+
return bridging::toJs(rt, value);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
static jsi::String replyIdToJs(jsi::Runtime &rt, decltype(types.replyId) value) {
|
|
377
|
+
return bridging::toJs(rt, value);
|
|
378
|
+
}
|
|
379
|
+
#endif
|
|
380
|
+
|
|
381
|
+
static jsi::Object toJs(
|
|
382
|
+
jsi::Runtime &rt,
|
|
383
|
+
const T &value,
|
|
384
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
385
|
+
auto result = facebook::jsi::Object(rt);
|
|
386
|
+
result.setProperty(rt, "appId", bridging::toJs(rt, value.appId, jsInvoker));
|
|
387
|
+
result.setProperty(rt, "providerId", bridging::toJs(rt, value.providerId, jsInvoker));
|
|
388
|
+
result.setProperty(rt, "sessionId", bridging::toJs(rt, value.sessionId, jsInvoker));
|
|
389
|
+
result.setProperty(rt, "signature", bridging::toJs(rt, value.signature, jsInvoker));
|
|
390
|
+
result.setProperty(rt, "timestamp", bridging::toJs(rt, value.timestamp, jsInvoker));
|
|
391
|
+
result.setProperty(rt, "replyId", bridging::toJs(rt, value.replyId, jsInvoker));
|
|
300
392
|
return result;
|
|
301
393
|
}
|
|
302
394
|
};
|
|
@@ -360,9 +452,64 @@ struct NativeInappRnSdkReclaimAppInfoBridging {
|
|
|
360
452
|
|
|
361
453
|
|
|
362
454
|
|
|
455
|
+
#pragma mark - NativeInappRnSdkReclaimSessionIdentityUpdate
|
|
456
|
+
|
|
457
|
+
template <typename P0, typename P1, typename P2>
|
|
458
|
+
struct NativeInappRnSdkReclaimSessionIdentityUpdate {
|
|
459
|
+
P0 appId;
|
|
460
|
+
P1 providerId;
|
|
461
|
+
P2 sessionId;
|
|
462
|
+
bool operator==(const NativeInappRnSdkReclaimSessionIdentityUpdate &other) const {
|
|
463
|
+
return appId == other.appId && providerId == other.providerId && sessionId == other.sessionId;
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
template <typename T>
|
|
468
|
+
struct NativeInappRnSdkReclaimSessionIdentityUpdateBridging {
|
|
469
|
+
static T types;
|
|
470
|
+
|
|
471
|
+
static T fromJs(
|
|
472
|
+
jsi::Runtime &rt,
|
|
473
|
+
const jsi::Object &value,
|
|
474
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
475
|
+
T result{
|
|
476
|
+
bridging::fromJs<decltype(types.appId)>(rt, value.getProperty(rt, "appId"), jsInvoker),
|
|
477
|
+
bridging::fromJs<decltype(types.providerId)>(rt, value.getProperty(rt, "providerId"), jsInvoker),
|
|
478
|
+
bridging::fromJs<decltype(types.sessionId)>(rt, value.getProperty(rt, "sessionId"), jsInvoker)};
|
|
479
|
+
return result;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
#ifdef DEBUG
|
|
483
|
+
static jsi::String appIdToJs(jsi::Runtime &rt, decltype(types.appId) value) {
|
|
484
|
+
return bridging::toJs(rt, value);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
static jsi::String providerIdToJs(jsi::Runtime &rt, decltype(types.providerId) value) {
|
|
488
|
+
return bridging::toJs(rt, value);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
static jsi::String sessionIdToJs(jsi::Runtime &rt, decltype(types.sessionId) value) {
|
|
492
|
+
return bridging::toJs(rt, value);
|
|
493
|
+
}
|
|
494
|
+
#endif
|
|
495
|
+
|
|
496
|
+
static jsi::Object toJs(
|
|
497
|
+
jsi::Runtime &rt,
|
|
498
|
+
const T &value,
|
|
499
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
500
|
+
auto result = facebook::jsi::Object(rt);
|
|
501
|
+
result.setProperty(rt, "appId", bridging::toJs(rt, value.appId, jsInvoker));
|
|
502
|
+
result.setProperty(rt, "providerId", bridging::toJs(rt, value.providerId, jsInvoker));
|
|
503
|
+
result.setProperty(rt, "sessionId", bridging::toJs(rt, value.sessionId, jsInvoker));
|
|
504
|
+
return result;
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
|
|
363
510
|
#pragma mark - NativeInappRnSdkRequest
|
|
364
511
|
|
|
365
|
-
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8
|
|
512
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
|
|
366
513
|
struct NativeInappRnSdkRequest {
|
|
367
514
|
P0 appId;
|
|
368
515
|
P1 secret;
|
|
@@ -370,12 +517,11 @@ struct NativeInappRnSdkRequest {
|
|
|
370
517
|
P3 session;
|
|
371
518
|
P4 contextString;
|
|
372
519
|
P5 parameters;
|
|
373
|
-
P6
|
|
374
|
-
P7
|
|
375
|
-
P8
|
|
376
|
-
P9 webhookUrl;
|
|
520
|
+
P6 autoSubmit;
|
|
521
|
+
P7 acceptAiProviders;
|
|
522
|
+
P8 webhookUrl;
|
|
377
523
|
bool operator==(const NativeInappRnSdkRequest &other) const {
|
|
378
|
-
return appId == other.appId && secret == other.secret && providerId == other.providerId && session == other.session && contextString == other.contextString && parameters == other.parameters &&
|
|
524
|
+
return appId == other.appId && secret == other.secret && providerId == other.providerId && session == other.session && contextString == other.contextString && parameters == other.parameters && autoSubmit == other.autoSubmit && acceptAiProviders == other.acceptAiProviders && webhookUrl == other.webhookUrl;
|
|
379
525
|
}
|
|
380
526
|
};
|
|
381
527
|
|
|
@@ -394,7 +540,6 @@ struct NativeInappRnSdkRequestBridging {
|
|
|
394
540
|
bridging::fromJs<decltype(types.session)>(rt, value.getProperty(rt, "session"), jsInvoker),
|
|
395
541
|
bridging::fromJs<decltype(types.contextString)>(rt, value.getProperty(rt, "contextString"), jsInvoker),
|
|
396
542
|
bridging::fromJs<decltype(types.parameters)>(rt, value.getProperty(rt, "parameters"), jsInvoker),
|
|
397
|
-
bridging::fromJs<decltype(types.hideLanding)>(rt, value.getProperty(rt, "hideLanding"), jsInvoker),
|
|
398
543
|
bridging::fromJs<decltype(types.autoSubmit)>(rt, value.getProperty(rt, "autoSubmit"), jsInvoker),
|
|
399
544
|
bridging::fromJs<decltype(types.acceptAiProviders)>(rt, value.getProperty(rt, "acceptAiProviders"), jsInvoker),
|
|
400
545
|
bridging::fromJs<decltype(types.webhookUrl)>(rt, value.getProperty(rt, "webhookUrl"), jsInvoker)};
|
|
@@ -426,10 +571,6 @@ struct NativeInappRnSdkRequestBridging {
|
|
|
426
571
|
return bridging::toJs(rt, value);
|
|
427
572
|
}
|
|
428
573
|
|
|
429
|
-
static bool hideLandingToJs(jsi::Runtime &rt, decltype(types.hideLanding) value) {
|
|
430
|
-
return bridging::toJs(rt, value);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
574
|
static bool autoSubmitToJs(jsi::Runtime &rt, decltype(types.autoSubmit) value) {
|
|
434
575
|
return bridging::toJs(rt, value);
|
|
435
576
|
}
|
|
@@ -460,9 +601,6 @@ struct NativeInappRnSdkRequestBridging {
|
|
|
460
601
|
if (value.parameters) {
|
|
461
602
|
result.setProperty(rt, "parameters", bridging::toJs(rt, value.parameters.value(), jsInvoker));
|
|
462
603
|
}
|
|
463
|
-
if (value.hideLanding) {
|
|
464
|
-
result.setProperty(rt, "hideLanding", bridging::toJs(rt, value.hideLanding.value(), jsInvoker));
|
|
465
|
-
}
|
|
466
604
|
if (value.autoSubmit) {
|
|
467
605
|
result.setProperty(rt, "autoSubmit", bridging::toJs(rt, value.autoSubmit.value(), jsInvoker));
|
|
468
606
|
}
|
|
@@ -816,7 +954,9 @@ public:
|
|
|
816
954
|
virtual jsi::Value startVerification(jsi::Runtime &rt, jsi::Object request) = 0;
|
|
817
955
|
virtual jsi::Value startVerificationFromUrl(jsi::Runtime &rt, jsi::String requestUrl) = 0;
|
|
818
956
|
virtual jsi::Value setOverrides(jsi::Runtime &rt, jsi::Object overrides) = 0;
|
|
957
|
+
virtual jsi::Value clearAllOverrides(jsi::Runtime &rt) = 0;
|
|
819
958
|
virtual void reply(jsi::Runtime &rt, jsi::String replyId, bool reply) = 0;
|
|
959
|
+
virtual void replyWithProviderInformation(jsi::Runtime &rt, jsi::String replyId, jsi::String providerInformation) = 0;
|
|
820
960
|
virtual jsi::Value ping(jsi::Runtime &rt) = 0;
|
|
821
961
|
|
|
822
962
|
};
|
|
@@ -867,6 +1007,20 @@ protected:
|
|
|
867
1007
|
});
|
|
868
1008
|
}
|
|
869
1009
|
|
|
1010
|
+
template <typename OnSessionIdentityUpdateType> void emitOnSessionIdentityUpdate(OnSessionIdentityUpdateType value) {
|
|
1011
|
+
static_assert(bridging::supportsFromJs<OnSessionIdentityUpdateType, jsi::Object>, "value cannnot be converted to jsi::Object");
|
|
1012
|
+
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onSessionIdentityUpdate"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
|
|
1013
|
+
return bridging::toJs(rt, eventValue, jsInvoker);
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
template <typename OnProviderInformationRequestType> void emitOnProviderInformationRequest(OnProviderInformationRequestType value) {
|
|
1018
|
+
static_assert(bridging::supportsFromJs<OnProviderInformationRequestType, jsi::Object>, "value cannnot be converted to jsi::Object");
|
|
1019
|
+
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onProviderInformationRequest"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
|
|
1020
|
+
return bridging::toJs(rt, eventValue, jsInvoker);
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
|
|
870
1024
|
private:
|
|
871
1025
|
class Delegate : public NativeInappRnSdkCxxSpecJSI {
|
|
872
1026
|
public:
|
|
@@ -876,6 +1030,8 @@ private:
|
|
|
876
1030
|
eventEmitterMap_["onSessionLogs"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
877
1031
|
eventEmitterMap_["onSessionCreateRequest"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
878
1032
|
eventEmitterMap_["onSessionUpdateRequest"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
1033
|
+
eventEmitterMap_["onSessionIdentityUpdate"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
1034
|
+
eventEmitterMap_["onProviderInformationRequest"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
879
1035
|
}
|
|
880
1036
|
|
|
881
1037
|
jsi::Value startVerification(jsi::Runtime &rt, jsi::Object request) override {
|
|
@@ -902,6 +1058,14 @@ private:
|
|
|
902
1058
|
return bridging::callFromJs<jsi::Value>(
|
|
903
1059
|
rt, &T::setOverrides, jsInvoker_, instance_, std::move(overrides));
|
|
904
1060
|
}
|
|
1061
|
+
jsi::Value clearAllOverrides(jsi::Runtime &rt) override {
|
|
1062
|
+
static_assert(
|
|
1063
|
+
bridging::getParameterCount(&T::clearAllOverrides) == 1,
|
|
1064
|
+
"Expected clearAllOverrides(...) to have 1 parameters");
|
|
1065
|
+
|
|
1066
|
+
return bridging::callFromJs<jsi::Value>(
|
|
1067
|
+
rt, &T::clearAllOverrides, jsInvoker_, instance_);
|
|
1068
|
+
}
|
|
905
1069
|
void reply(jsi::Runtime &rt, jsi::String replyId, bool reply) override {
|
|
906
1070
|
static_assert(
|
|
907
1071
|
bridging::getParameterCount(&T::reply) == 3,
|
|
@@ -910,6 +1074,14 @@ private:
|
|
|
910
1074
|
return bridging::callFromJs<void>(
|
|
911
1075
|
rt, &T::reply, jsInvoker_, instance_, std::move(replyId), std::move(reply));
|
|
912
1076
|
}
|
|
1077
|
+
void replyWithProviderInformation(jsi::Runtime &rt, jsi::String replyId, jsi::String providerInformation) override {
|
|
1078
|
+
static_assert(
|
|
1079
|
+
bridging::getParameterCount(&T::replyWithProviderInformation) == 3,
|
|
1080
|
+
"Expected replyWithProviderInformation(...) to have 3 parameters");
|
|
1081
|
+
|
|
1082
|
+
return bridging::callFromJs<void>(
|
|
1083
|
+
rt, &T::replyWithProviderInformation, jsInvoker_, instance_, std::move(replyId), std::move(providerInformation));
|
|
1084
|
+
}
|
|
913
1085
|
jsi::Value ping(jsi::Runtime &rt) override {
|
|
914
1086
|
static_assert(
|
|
915
1087
|
bridging::getParameterCount(&T::ping) == 1,
|
|
@@ -34,6 +34,35 @@ import ReclaimInAppSdk
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
@MainActor
|
|
38
|
+
static fileprivate var replyWithProviderInformationHandlers: [String: (Result<String, any Error>) -> Void] = [:]
|
|
39
|
+
|
|
40
|
+
static fileprivate func setReplyWithProviderInformationCallback(
|
|
41
|
+
_ callback: @escaping (Result<String, any Error>) -> Void
|
|
42
|
+
) -> String {
|
|
43
|
+
let replyId = UUID().uuidString
|
|
44
|
+
Task { @MainActor in
|
|
45
|
+
Api.replyWithProviderInformationHandlers[replyId] = callback
|
|
46
|
+
}
|
|
47
|
+
return replyId
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@objc public func replyWithProviderInformation(replyId: String?, providerInformation: String?) {
|
|
51
|
+
if let replyId {
|
|
52
|
+
Task { @MainActor in
|
|
53
|
+
let callback = Api.replyWithProviderInformationHandlers[replyId]
|
|
54
|
+
if let callback = callback {
|
|
55
|
+
Api.replyWithProviderInformationHandlers.removeValue(forKey: replyId)
|
|
56
|
+
callback(.success(providerInformation ?? ""))
|
|
57
|
+
} else {
|
|
58
|
+
NSLog("[Api.replyWithProviderInformation] No callback found for replyId \(replyId)")
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
NSLog("[Api.replyWithProviderInformation] Missing arg replyId")
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
37
66
|
@objc public func startVerification(
|
|
38
67
|
appId: String?,
|
|
39
68
|
secret: String?,
|
|
@@ -43,7 +72,6 @@ import ReclaimInAppSdk
|
|
|
43
72
|
sessionSignature: String?,
|
|
44
73
|
context: String?,
|
|
45
74
|
parameters: [String: String]?,
|
|
46
|
-
hideLanding: Bool,
|
|
47
75
|
autoSubmit: Bool,
|
|
48
76
|
acceptAiProviders: Bool,
|
|
49
77
|
webhookUrl: String
|
|
@@ -64,7 +92,6 @@ import ReclaimInAppSdk
|
|
|
64
92
|
session: session,
|
|
65
93
|
context: context ?? "",
|
|
66
94
|
parameters: parameters ?? [String:String](),
|
|
67
|
-
hideLanding: hideLanding,
|
|
68
95
|
autoSubmit: autoSubmit,
|
|
69
96
|
acceptAiProviders: acceptAiProviders,
|
|
70
97
|
webhookUrl: webhookUrl
|
|
@@ -75,7 +102,6 @@ import ReclaimInAppSdk
|
|
|
75
102
|
session: session,
|
|
76
103
|
context: context ?? "",
|
|
77
104
|
parameters: parameters ?? [String:String](),
|
|
78
|
-
hideLanding: hideLanding,
|
|
79
105
|
autoSubmit: autoSubmit,
|
|
80
106
|
acceptAiProviders: acceptAiProviders,
|
|
81
107
|
webhookUrl: webhookUrl
|
|
@@ -95,12 +121,15 @@ import ReclaimInAppSdk
|
|
|
95
121
|
featureOptions: OverridenFeatureOptions?,
|
|
96
122
|
logConsumer: OverridenLogConsumer?,
|
|
97
123
|
sessionManagement: OverridenSessionManagement?,
|
|
98
|
-
appInfo: OverridenReclaimAppInfo
|
|
124
|
+
appInfo: OverridenReclaimAppInfo?,
|
|
125
|
+
capabilityAccessToken: String?
|
|
99
126
|
) async throws {
|
|
100
127
|
let providerOverrides: ReclaimOverrides.ProviderInformation? = if let url = provider?.url {
|
|
101
128
|
.url(url: url)
|
|
102
129
|
} else if let jsonString = provider?.jsonString {
|
|
103
130
|
.jsonString(jsonString: jsonString)
|
|
131
|
+
} else if let callback = provider?.callback {
|
|
132
|
+
.callback(callbackHandler: callback)
|
|
104
133
|
} else {
|
|
105
134
|
nil
|
|
106
135
|
}
|
|
@@ -150,10 +179,15 @@ import ReclaimInAppSdk
|
|
|
150
179
|
featureOptions: featureOptionsOverrides,
|
|
151
180
|
logConsumer: logConsumerOverrides,
|
|
152
181
|
sessionManagement: sessionManagementOverrides,
|
|
153
|
-
appInfo: appInfoOverrides
|
|
182
|
+
appInfo: appInfoOverrides,
|
|
183
|
+
capabilityAccessToken: capabilityAccessToken
|
|
154
184
|
)
|
|
155
185
|
}
|
|
156
|
-
|
|
186
|
+
|
|
187
|
+
@objc public func clearAllOverrides() async throws {
|
|
188
|
+
return try await ReclaimVerification.clearAllOverrides()
|
|
189
|
+
}
|
|
190
|
+
|
|
157
191
|
func startVerificationWithRequest(_ request: ReclaimVerification.Request) async throws -> [String: Any] {
|
|
158
192
|
NSLog("[Api] starting verification");
|
|
159
193
|
return try await withCheckedThrowingContinuation { continuation in
|
|
@@ -215,16 +249,48 @@ import ReclaimInAppSdk
|
|
|
215
249
|
}
|
|
216
250
|
}
|
|
217
251
|
|
|
252
|
+
public typealias OverridenProviderCallback = (
|
|
253
|
+
_ appId: String,
|
|
254
|
+
_ providerId: String,
|
|
255
|
+
_ sessionId: String,
|
|
256
|
+
_ signature: String,
|
|
257
|
+
_ timestamp: String,
|
|
258
|
+
_ replyId: String
|
|
259
|
+
) -> Void
|
|
260
|
+
|
|
261
|
+
@objc(OverridenProviderCallbackHandler) public class OverridenProviderCallbackHandler: NSObject, ReclaimOverrides.ProviderInformation.CallbackHandler {
|
|
262
|
+
@objc let _fetchProviderInformation: OverridenProviderCallback
|
|
263
|
+
|
|
264
|
+
@objc public init(_fetchProviderInformation: @escaping OverridenProviderCallback) {
|
|
265
|
+
self._fetchProviderInformation = _fetchProviderInformation
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
public func fetchProviderInformation(
|
|
269
|
+
appId: String,
|
|
270
|
+
providerId: String,
|
|
271
|
+
sessionId: String,
|
|
272
|
+
signature: String,
|
|
273
|
+
timestamp: String,
|
|
274
|
+
completion: @escaping (Result<String, any Error>) -> Void
|
|
275
|
+
) {
|
|
276
|
+
let replyId = Api.setReplyWithProviderInformationCallback(completion)
|
|
277
|
+
self._fetchProviderInformation(appId, providerId, sessionId, signature, timestamp, replyId)
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
218
281
|
@objc(OverridenProviderInformation) public class OverridenProviderInformation: NSObject {
|
|
219
282
|
@objc public var url: String?
|
|
220
283
|
@objc public var jsonString: String?
|
|
284
|
+
@objc public var callback: OverridenProviderCallbackHandler?
|
|
221
285
|
|
|
222
286
|
@objc public init(
|
|
223
287
|
url: String? = nil,
|
|
224
|
-
jsonString: String? = nil
|
|
288
|
+
jsonString: String? = nil,
|
|
289
|
+
callback: OverridenProviderCallbackHandler? = nil
|
|
225
290
|
) {
|
|
226
291
|
self.url = url
|
|
227
292
|
self.jsonString = jsonString
|
|
293
|
+
self.callback = callback
|
|
228
294
|
}
|
|
229
295
|
}
|
|
230
296
|
|