@bytexbyte/berifyme-react-sdk 1.0.8 → 1.0.10

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.
@@ -345,7 +345,7 @@ var HomeModal = function (_a) {
345
345
  pageStatus === PageStatus.ClearLogin &&
346
346
  React.createElement(ClearLogin, { token: token, userId: user === null || user === void 0 ? void 0 : user.id, desktopRedirectUrlId: desktopRedirectUrlId }),
347
347
  pageStatus === PageStatus.IncodeLogin &&
348
- React.createElement(IncodeLogin, { token: token, user: user, setUser: setUser, goToAllSet: function () { return setPageStatus(PageStatus.AllSet); } }),
348
+ React.createElement(IncodeLogin, { token: token, setError: setError, user: user, setUser: setUser, goToAllSet: function () { return setPageStatus(PageStatus.AllSet); } }),
349
349
  pageStatus === PageStatus.ClearLoginAllSet &&
350
350
  React.createElement(ClearLoginAllSet, { token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus }),
351
351
  pageStatus === PageStatus.ClearOnboardingAllSet &&
package/dist/api/api.js CHANGED
@@ -214,11 +214,11 @@ function createBiometricFromProof(_a) {
214
214
  function getAccount(_a) {
215
215
  return __awaiter(this, arguments, void 0, function (_b) {
216
216
  var url, res;
217
- var token = _b.token, phone = _b.phone;
217
+ var token = _b.token, phone = _b.phone, sessionToken = _b.sessionToken;
218
218
  return __generator(this, function (_c) {
219
219
  switch (_c.label) {
220
220
  case 0:
221
- url = "".concat(config.backendDomain, "/api/authid/getAccount?phone=").concat(phone);
221
+ url = "".concat(config.backendDomain, "/api/authid/getAccount?phone=").concat(phone).concat(sessionToken ? "&sessionToken=".concat(sessionToken) : '');
222
222
  return [4 /*yield*/, axios.get(url, {
223
223
  headers: {
224
224
  'Content-Type': 'application/json',
@@ -319,11 +319,11 @@ function searchUser(_a) {
319
319
  function getDocumentDetails(_a) {
320
320
  return __awaiter(this, arguments, void 0, function (_b) {
321
321
  var url, res;
322
- var token = _b.token, operationId = _b.operationId, userId = _b.userId;
322
+ var token = _b.token, operationId = _b.operationId, userId = _b.userId, sessionToken = _b.sessionToken;
323
323
  return __generator(this, function (_c) {
324
324
  switch (_c.label) {
325
325
  case 0:
326
- url = "".concat(config.backendDomain, "/api/authid/getDocumentDetails?operationId=").concat(operationId, "&userId=").concat(userId);
326
+ url = "".concat(config.backendDomain, "/api/authid/getDocumentDetails?operationId=").concat(operationId, "&userId=").concat(userId).concat(sessionToken ? "&sessionToken=".concat(sessionToken) : '');
327
327
  return [4 /*yield*/, axios.get(url, {
328
328
  headers: {
329
329
  'Content-Type': 'application/json',
@@ -395,11 +395,11 @@ function getIncodeFinish(_a) {
395
395
  function getIncodeApprove(_a) {
396
396
  return __awaiter(this, arguments, void 0, function (_b) {
397
397
  var url, res;
398
- var id = _b.id, token = _b.token, uniqueId = _b.uniqueId;
398
+ var id = _b.id, token = _b.token, sessionToken = _b.sessionToken;
399
399
  return __generator(this, function (_c) {
400
400
  switch (_c.label) {
401
401
  case 0:
402
- url = "".concat(config.backendDomain, "/api/incode/approve?id=").concat(id, "&token=").concat(token, "&uniqueId=").concat(uniqueId);
402
+ url = "".concat(config.backendDomain, "/api/incode/approve?id=").concat(id, "&token=").concat(token, "&sessionToken=").concat(sessionToken);
403
403
  console.log('UrlString: ', url);
404
404
  return [4 /*yield*/, axios.get(url)];
405
405
  case 1:
@@ -435,97 +435,11 @@ function createVerificationSession(_a) {
435
435
  function getClearApprove(_a) {
436
436
  return __awaiter(this, arguments, void 0, function (_b) {
437
437
  var url, res;
438
- var id = _b.id, sessionId = _b.sessionId;
439
- return __generator(this, function (_c) {
440
- switch (_c.label) {
441
- case 0:
442
- url = "".concat(config.backendDomain, "/api/clear/approve?id=").concat(id, "&sessionId=").concat(sessionId);
443
- console.log('UrlString: ', url);
444
- return [4 /*yield*/, axios.get(url)];
445
- case 1:
446
- res = _c.sent();
447
- console.log('UrlRes data: ', res.data);
448
- return [2 /*return*/, res.data];
449
- }
450
- });
451
- });
452
- }
453
- function createIdmeVerificationUrl(_a) {
454
- return __awaiter(this, arguments, void 0, function (_b) {
455
- var url, payload, res;
456
- var redirectUrl = _b.redirectUrl, token = _b.token;
457
- return __generator(this, function (_c) {
458
- switch (_c.label) {
459
- case 0:
460
- url = "".concat(config.backendDomain, "/api/idme/createVerificationUrl");
461
- console.log('UrlString: ', url);
462
- payload = {
463
- redirectUrl: redirectUrl,
464
- token: token,
465
- };
466
- return [4 /*yield*/, axios.post(url, payload)];
467
- case 1:
468
- res = _c.sent();
469
- console.log('UrlRes data: ', res.data);
470
- return [2 /*return*/, res.data];
471
- }
472
- });
473
- });
474
- }
475
- function sendIdmePhoneNumberVerify(_a) {
476
- return __awaiter(this, arguments, void 0, function (_b) {
477
- var url, payload, res;
478
- var phoneNumber = _b.phoneNumber, idmeId = _b.idmeId, token = _b.token;
479
- return __generator(this, function (_c) {
480
- switch (_c.label) {
481
- case 0:
482
- url = "".concat(config.backendDomain, "/api/idme/sendIdmePhoneNumberVerify");
483
- console.log('UrlString: ', url);
484
- payload = { phoneNumber: phoneNumber, idmeId: idmeId, token: token };
485
- return [4 /*yield*/, axios.post(url, payload, {
486
- headers: {
487
- 'Content-Type': 'application/json'
488
- }
489
- })];
490
- case 1:
491
- res = _c.sent();
492
- console.log('UrlRes data: ', res.data);
493
- return [2 /*return*/, res.data];
494
- }
495
- });
496
- });
497
- }
498
- function updateIdmeId(_a) {
499
- return __awaiter(this, arguments, void 0, function (_b) {
500
- var url, payload, res;
501
- var id = _b.id, idmeId = _b.idmeId, token = _b.token;
502
- return __generator(this, function (_c) {
503
- switch (_c.label) {
504
- case 0:
505
- url = "".concat(config.backendDomain, "/api/idme/updateIdmeId");
506
- console.log('UrlString: ', url);
507
- payload = { id: id, idmeId: idmeId, token: token };
508
- return [4 /*yield*/, axios.post(url, payload, {
509
- headers: {
510
- 'Content-Type': 'application/json'
511
- }
512
- })];
513
- case 1:
514
- res = _c.sent();
515
- console.log('UrlRes data: ', res.data);
516
- return [2 /*return*/, res.data];
517
- }
518
- });
519
- });
520
- }
521
- function getIdmeApprove(_a) {
522
- return __awaiter(this, arguments, void 0, function (_b) {
523
- var url, res;
524
- var id = _b.id, code = _b.code, redirectUrl = _b.redirectUrl;
438
+ var id = _b.id, sessionId = _b.sessionId, token = _b.token;
525
439
  return __generator(this, function (_c) {
526
440
  switch (_c.label) {
527
441
  case 0:
528
- url = "".concat(config.backendDomain, "/api/idme/approve?id=").concat(id, "&code=").concat(code, "&redirecturl=").concat(redirectUrl);
442
+ url = "".concat(config.backendDomain, "/api/clear/approve?id=").concat(id, "&sessionId=").concat(sessionId).concat(token ? "&token=".concat(token) : '');
529
443
  console.log('UrlString: ', url);
530
444
  return [4 /*yield*/, axios.get(url)];
531
445
  case 1:
@@ -581,31 +495,14 @@ function checkDesktopRedirectUrlIdExpired(_a) {
581
495
  });
582
496
  });
583
497
  }
584
- function sendVerifyEmail(email) {
585
- return __awaiter(this, void 0, void 0, function () {
586
- var url, res;
587
- return __generator(this, function (_a) {
588
- switch (_a.label) {
589
- case 0:
590
- url = "".concat(config.backendDomain, "/api/auth/sendEmailVerify?email=").concat(email);
591
- console.log('UrlString: ', url);
592
- return [4 /*yield*/, axios.get(url)];
593
- case 1:
594
- res = _a.sent();
595
- console.log('UrlRes data: ', res.data);
596
- return [2 /*return*/, res.data];
597
- }
598
- });
599
- });
600
- }
601
- function sendPhoneNumberVerify(_a) {
498
+ function sendPhoneNumberCode(_a) {
602
499
  return __awaiter(this, arguments, void 0, function (_b) {
603
500
  var url, res;
604
- var phoneNumber = _b.phoneNumber, token = _b.token, domain = _b.domain;
501
+ var phoneNumber = _b.phoneNumber, token = _b.token;
605
502
  return __generator(this, function (_c) {
606
503
  switch (_c.label) {
607
504
  case 0:
608
- url = "".concat(config.backendDomain, "/api/auth/sendPhoneNumberVerify?phoneNumber=").concat(phoneNumber).concat(token ? "&token=".concat(token) : '').concat(domain ? "&domain=".concat(domain) : '');
505
+ url = "".concat(config.backendDomain, "/api/auth/sendPhoneNumberCode?phoneNumber=").concat(phoneNumber).concat(token ? "&token=".concat(token) : '');
609
506
  console.log('UrlString: ', url);
610
507
  return [4 /*yield*/, axios.get(url)];
611
508
  case 1:
@@ -616,14 +513,14 @@ function sendPhoneNumberVerify(_a) {
616
513
  });
617
514
  });
618
515
  }
619
- function sendPhoneNumberCode(_a) {
516
+ function getUserBySessionId(_a) {
620
517
  return __awaiter(this, arguments, void 0, function (_b) {
621
518
  var url, res;
622
- var phoneNumber = _b.phoneNumber, token = _b.token;
519
+ var sessionId = _b.sessionId, token = _b.token;
623
520
  return __generator(this, function (_c) {
624
521
  switch (_c.label) {
625
522
  case 0:
626
- url = "".concat(config.backendDomain, "/api/auth/sendPhoneNumberCode?phoneNumber=").concat(phoneNumber).concat(token ? "&token=".concat(token) : '');
523
+ url = "".concat(config.backendDomain, "/api/user/getUserByClearSessionId?id=").concat(sessionId).concat(token ? "&token=".concat(token) : '');
627
524
  console.log('UrlString: ', url);
628
525
  return [4 /*yield*/, axios.get(url)];
629
526
  case 1:
@@ -634,85 +531,18 @@ function sendPhoneNumberCode(_a) {
634
531
  });
635
532
  });
636
533
  }
637
- function verify(id) {
638
- return __awaiter(this, void 0, void 0, function () {
639
- var url, res;
640
- return __generator(this, function (_a) {
641
- switch (_a.label) {
642
- case 0:
643
- url = "".concat(config.backendDomain, "/api/auth/verify?id=").concat(id);
644
- console.log('UrlString: ', url);
645
- return [4 /*yield*/, axios.get(url)];
646
- case 1:
647
- res = _a.sent();
648
- console.log('UrlRes data: ', res.data);
649
- return [2 /*return*/, res.data];
650
- }
651
- });
652
- });
653
- }
654
- function getUserBySessionId(sessionId) {
655
- return __awaiter(this, void 0, void 0, function () {
656
- var url, res;
657
- return __generator(this, function (_a) {
658
- switch (_a.label) {
659
- case 0:
660
- url = "".concat(config.backendDomain, "/api/user/getUserByClearSessionId?id=").concat(sessionId);
661
- console.log('UrlString: ', url);
662
- return [4 /*yield*/, axios.get(url)];
663
- case 1:
664
- res = _a.sent();
665
- console.log('UrlRes data: ', res.data);
666
- return [2 /*return*/, res.data];
667
- }
668
- });
669
- });
670
- }
671
- function getUserByCode(code, redirectUrl) {
672
- return __awaiter(this, void 0, void 0, function () {
673
- var url, res;
674
- return __generator(this, function (_a) {
675
- switch (_a.label) {
676
- case 0:
677
- url = "".concat(config.backendDomain, "/api/user/getUserByCode?code=").concat(code, "&redirecturl=").concat(redirectUrl);
678
- console.log('UrlString: ', url);
679
- return [4 /*yield*/, axios.get(url)];
680
- case 1:
681
- res = _a.sent();
682
- console.log('UrlRes data: ', res.data);
683
- return [2 /*return*/, res.data];
684
- }
685
- });
686
- });
687
- }
688
- function getUserByIncodeId(incodeId) {
689
- return __awaiter(this, void 0, void 0, function () {
690
- var url, res;
691
- return __generator(this, function (_a) {
692
- switch (_a.label) {
693
- case 0:
694
- url = "".concat(config.backendDomain, "/api/user/getUserByIncodeId?incodeId=").concat(incodeId);
695
- console.log('UrlString: ', url);
696
- return [4 /*yield*/, axios.get(url)];
697
- case 1:
698
- res = _a.sent();
699
- console.log('UrlRes data: ', res.data);
700
- return [2 /*return*/, res.data];
701
- }
702
- });
703
- });
704
- }
705
- function getUserByClearId(clearId) {
706
- return __awaiter(this, void 0, void 0, function () {
534
+ function getUserByIncodeId(_a) {
535
+ return __awaiter(this, arguments, void 0, function (_b) {
707
536
  var url, res;
708
- return __generator(this, function (_a) {
709
- switch (_a.label) {
537
+ var customerId = _b.customerId, interviewId = _b.interviewId, token = _b.token;
538
+ return __generator(this, function (_c) {
539
+ switch (_c.label) {
710
540
  case 0:
711
- url = "".concat(config.backendDomain, "/api/user/getUserByClearId?clearId=").concat(clearId);
541
+ url = "".concat(config.backendDomain, "/api/user/getUserByIncodeId?customerId=").concat(customerId, "&interviewId=").concat(interviewId).concat(token ? "&token=".concat(token) : '');
712
542
  console.log('UrlString: ', url);
713
543
  return [4 /*yield*/, axios.get(url)];
714
544
  case 1:
715
- res = _a.sent();
545
+ res = _c.sent();
716
546
  console.log('UrlRes data: ', res.data);
717
547
  return [2 /*return*/, res.data];
718
548
  }
@@ -722,11 +552,11 @@ function getUserByClearId(clearId) {
722
552
  function getUserVenderByPhone(_a) {
723
553
  return __awaiter(this, arguments, void 0, function (_b) {
724
554
  var url, res;
725
- var phoneNumber = _b.phoneNumber;
555
+ var phoneNumber = _b.phoneNumber, token = _b.token;
726
556
  return __generator(this, function (_c) {
727
557
  switch (_c.label) {
728
558
  case 0:
729
- url = "".concat(config.backendDomain, "/api/user/getUserVenderByPhone?phoneNumber=").concat(phoneNumber);
559
+ url = "".concat(config.backendDomain, "/api/user/getUserVenderByPhone?phoneNumber=").concat(phoneNumber).concat(token ? "&token=".concat(token) : '');
730
560
  console.log('UrlString: ', url);
731
561
  return [4 /*yield*/, axios.get(url)];
732
562
  case 1:
@@ -758,13 +588,13 @@ function getUserByPhoneNumberAndVerifyCode(_a) {
758
588
  function uploadDeviceId(_a) {
759
589
  return __awaiter(this, arguments, void 0, function (_b) {
760
590
  var url, payload, res;
761
- var id = _b.id, deviceId = _b.deviceId;
591
+ var id = _b.id, deviceId = _b.deviceId, token = _b.token;
762
592
  return __generator(this, function (_c) {
763
593
  switch (_c.label) {
764
594
  case 0:
765
595
  url = "".concat(config.backendDomain, "/api/user/uploadDeviceId");
766
596
  console.log('UrlString: ', url);
767
- payload = { id: id, deviceId: deviceId };
597
+ payload = { id: id, deviceId: deviceId, token: token };
768
598
  return [4 /*yield*/, axios.post(url, payload, {
769
599
  headers: {
770
600
  'Content-Type': 'application/json'
@@ -952,7 +782,7 @@ function createAuthenticationLogs(_a) {
952
782
  function updateAuthenticationLogs(_a) {
953
783
  return __awaiter(this, arguments, void 0, function (_b) {
954
784
  var url, res;
955
- var isPass = _b.isPass, transactionId = _b.transactionId, incodeSessionId = _b.incodeSessionId, clearSessionId = _b.clearSessionId;
785
+ var isPass = _b.isPass, token = _b.token, transactionId = _b.transactionId, incodeSessionId = _b.incodeSessionId, clearSessionId = _b.clearSessionId;
956
786
  return __generator(this, function (_c) {
957
787
  switch (_c.label) {
958
788
  case 0:
@@ -960,6 +790,7 @@ function updateAuthenticationLogs(_a) {
960
790
  console.log('UrlString: ', url);
961
791
  return [4 /*yield*/, axios.post(url, {
962
792
  isPass: isPass,
793
+ token: token,
963
794
  transactionId: transactionId,
964
795
  incodeSessionId: incodeSessionId,
965
796
  clearSessionId: clearSessionId
@@ -1287,23 +1118,12 @@ var berifymeApi = {
1287
1118
  createVerificationSession: createVerificationSession,
1288
1119
  getClearApprove: getClearApprove,
1289
1120
  },
1290
- idme: {
1291
- createIdmeVerificationUrl: createIdmeVerificationUrl,
1292
- sendIdmePhoneNumberVerify: sendIdmePhoneNumberVerify,
1293
- getIdmeApprove: getIdmeApprove,
1294
- updateIdmeId: updateIdmeId,
1295
- },
1296
1121
  auth: {
1297
- sendVerifyEmail: sendVerifyEmail,
1298
1122
  sendPhoneNumberCode: sendPhoneNumberCode,
1299
- sendPhoneNumberVerify: sendPhoneNumberVerify,
1300
- verify: verify,
1301
1123
  },
1302
1124
  user: {
1303
- getUserByCode: getUserByCode,
1304
1125
  getUserBySessionId: getUserBySessionId,
1305
1126
  getUserByIncodeId: getUserByIncodeId,
1306
- getUserByClearId: getUserByClearId,
1307
1127
  getUserBySumsubId: getUserBySumsubId,
1308
1128
  getUserByYotiId: getUserByYotiId,
1309
1129
  getUserVenderByPhone: getUserVenderByPhone,
@@ -47,7 +47,7 @@ import { createDeveloperLog } from "../createDeveloperLog";
47
47
  import { PageStatus } from "../../enum";
48
48
  var createDeviceId = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
49
49
  var newDeviceId;
50
- var userId = _b.userId;
50
+ var userId = _b.userId, token = _b.token;
51
51
  return __generator(this, function (_c) {
52
52
  switch (_c.label) {
53
53
  case 0:
@@ -55,7 +55,7 @@ var createDeviceId = function (_a) { return __awaiter(void 0, [_a], void 0, func
55
55
  if (!newDeviceId)
56
56
  return [2 /*return*/];
57
57
  localStorage.setItem('deviceId', newDeviceId); // 保存到 LocalStorage
58
- return [4 /*yield*/, berifymeApi.user.uploadDeviceId({ id: userId, deviceId: newDeviceId })];
58
+ return [4 /*yield*/, berifymeApi.user.uploadDeviceId({ id: userId, deviceId: newDeviceId, token: token })];
59
59
  case 1:
60
60
  _c.sent();
61
61
  return [2 /*return*/];
@@ -85,13 +85,13 @@ var AllSet = function (_a) {
85
85
  case 1:
86
86
  deviceUser = _a.sent();
87
87
  if (!deviceUser.error) return [3 /*break*/, 3];
88
- return [4 /*yield*/, createDeviceId({ userId: user.id })];
88
+ return [4 /*yield*/, createDeviceId({ userId: user.id, token: token })];
89
89
  case 2:
90
90
  _a.sent();
91
91
  _a.label = 3;
92
92
  case 3: return [3 /*break*/, 6];
93
93
  case 4: //未註冊過, 註冊
94
- return [4 /*yield*/, createDeviceId({ userId: user.id })];
94
+ return [4 /*yield*/, createDeviceId({ userId: user.id, token: token })];
95
95
  case 5:
96
96
  _a.sent();
97
97
  _a.label = 6;
@@ -114,8 +114,9 @@ var AllSet = function (_a) {
114
114
  }, []);
115
115
  var getRedirectUrl = function () { return __awaiter(void 0, void 0, void 0, function () {
116
116
  var res;
117
- return __generator(this, function (_a) {
118
- switch (_a.label) {
117
+ var _a;
118
+ return __generator(this, function (_b) {
119
+ switch (_b.label) {
119
120
  case 0:
120
121
  if (!user)
121
122
  return [2 /*return*/];
@@ -123,7 +124,7 @@ var AllSet = function (_a) {
123
124
  return [2 /*return*/];
124
125
  return [4 /*yield*/, berifymeApi.thirdParty.getRedirectUrl({ userId: user.id, token: token })];
125
126
  case 1:
126
- res = _a.sent();
127
+ res = _b.sent();
127
128
  createDeveloperLog({
128
129
  userId: user === null || user === void 0 ? void 0 : user.id,
129
130
  source: 'FRONTEND',
@@ -132,7 +133,7 @@ var AllSet = function (_a) {
132
133
  });
133
134
  setLoading(false);
134
135
  if (!res.redirectUrl) {
135
- setError('Oops! Something went wrong...');
136
+ setError((_a = res.error) !== null && _a !== void 0 ? _a : 'Oops! Something went wrong...');
136
137
  return [2 /*return*/];
137
138
  }
138
139
  if (desktopRedirectUrlId === undefined) {
@@ -124,18 +124,20 @@ export var createAuthenticationLog = function (_a) { return __awaiter(void 0, [_
124
124
  });
125
125
  }); };
126
126
  export var updateAuthenticationLog = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
127
- var isPass = _b.isPass, transactionId = _b.transactionId, incodeSessionId = _b.incodeSessionId, clearSessionId = _b.clearSessionId;
127
+ var isPass = _b.isPass, token = _b.token, transactionId = _b.transactionId, incodeSessionId = _b.incodeSessionId, clearSessionId = _b.clearSessionId;
128
128
  return __generator(this, function (_c) {
129
129
  switch (_c.label) {
130
130
  case 0:
131
131
  console.log({
132
132
  isPass: isPass,
133
+ token: token,
133
134
  transactionId: transactionId,
134
135
  incodeSessionId: incodeSessionId,
135
136
  clearSessionId: clearSessionId,
136
137
  });
137
138
  return [4 /*yield*/, berifymeApi.AuthenticationLogs.updateAuthenticationLogs({
138
139
  isPass: isPass,
140
+ token: token,
139
141
  transactionId: transactionId,
140
142
  incodeSessionId: incodeSessionId,
141
143
  clearSessionId: clearSessionId
@@ -104,7 +104,7 @@ var AuthID = function (_a) {
104
104
  });
105
105
  if (!!result.error) return [3 /*break*/, 3];
106
106
  setUrl('');
107
- return [4 /*yield*/, berifymeApi.authID.getAccount({ token: localStorage.getItem('authID_token') || '', phone: phone })];
107
+ return [4 /*yield*/, berifymeApi.authID.getAccount({ token: localStorage.getItem('authID_token') || '', phone: phone, sessionToken: token })];
108
108
  case 2:
109
109
  account = _a.sent();
110
110
  createDeveloperLog({
@@ -46,13 +46,14 @@ var ClearLoginAllSet = function (_a) {
46
46
  var token = _a.token, desktopRedirectUrlId = _a.desktopRedirectUrlId, setPageStatus = _a.setPageStatus;
47
47
  var _b = useState(), user = _b[0], setUser = _b[1]; // berifyme user
48
48
  var _c = useState(), error = _c[0], setError = _c[1];
49
- var getUserBySessionId = function (sessionId) { return __awaiter(void 0, void 0, void 0, function () {
49
+ var getUserBySessionId = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
50
50
  var res;
51
- return __generator(this, function (_a) {
52
- switch (_a.label) {
53
- case 0: return [4 /*yield*/, berifymeApi.user.getUserBySessionId(sessionId)];
51
+ var sessionId = _b.sessionId, token = _b.token;
52
+ return __generator(this, function (_c) {
53
+ switch (_c.label) {
54
+ case 0: return [4 /*yield*/, berifymeApi.user.getUserBySessionId({ sessionId: sessionId, token: token })];
54
55
  case 1:
55
- res = _a.sent();
56
+ res = _c.sent();
56
57
  createDeveloperLog({
57
58
  source: 'FRONTEND',
58
59
  action: 'clear login getUserBySessionId',
@@ -66,6 +67,7 @@ var ClearLoginAllSet = function (_a) {
66
67
  setUser(res.user);
67
68
  updateAuthenticationLog({
68
69
  isPass: true,
70
+ token: token,
69
71
  clearSessionId: sessionId,
70
72
  });
71
73
  }
@@ -76,11 +78,13 @@ var ClearLoginAllSet = function (_a) {
76
78
  });
77
79
  }); };
78
80
  useEffect(function () {
81
+ if (!token)
82
+ return;
79
83
  var sessionId = localStorage.getItem('clear_session_id');
80
84
  if (!sessionId)
81
85
  return;
82
- getUserBySessionId(sessionId);
83
- }, []);
86
+ getUserBySessionId({ sessionId: sessionId, token: token });
87
+ }, [token]);
84
88
  if (error)
85
89
  return (React.createElement(TryAgain, { message: error }));
86
90
  return (React.createElement(React.Fragment, null, user ? React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus }) :
@@ -44,16 +44,16 @@ import { createAuthenticationLog } from "../../AuthenticationLogs";
44
44
  import { createDeveloperLog } from "../../createDeveloperLog";
45
45
  function LoginComponent(_a) {
46
46
  var _this = this;
47
- var onSuccess = _a.onSuccess, onError = _a.onError, user = _a.user, setUser = _a.setUser, token = _a.token;
47
+ var onSuccess = _a.onSuccess, setError = _a.setError, user = _a.user, setUser = _a.setUser, token = _a.token;
48
48
  var containerRef = useRef(null);
49
49
  var _b = useSpeedTest(), stopSpeedTest = _b.stopSpeedTest, startSpeedTest = _b.startSpeedTest;
50
50
  useEffect(function () { stopSpeedTest(); }, []);
51
- var getBerifymeUser = function (customerId, transactionId) { return __awaiter(_this, void 0, void 0, function () {
51
+ var getBerifymeUser = function (customerId, interviewId, transactionId, token) { return __awaiter(_this, void 0, void 0, function () {
52
52
  var res;
53
53
  var _a;
54
54
  return __generator(this, function (_b) {
55
55
  switch (_b.label) {
56
- case 0: return [4 /*yield*/, berifymeApi.user.getUserByIncodeId(customerId)];
56
+ case 0: return [4 /*yield*/, berifymeApi.user.getUserByIncodeId({ customerId: customerId, interviewId: interviewId, token: token })];
57
57
  case 1:
58
58
  res = _b.sent();
59
59
  createDeveloperLog({
@@ -77,10 +77,10 @@ function LoginComponent(_a) {
77
77
  onSuccess();
78
78
  }
79
79
  else if (res.error) {
80
- onError({ type: res.error });
80
+ setError(res.error);
81
81
  }
82
82
  else {
83
- onError({ type: 'Oops! Something went wrong...' });
83
+ setError('Oops! Something went wrong...');
84
84
  }
85
85
  return [2 /*return*/];
86
86
  }
@@ -94,17 +94,19 @@ function LoginComponent(_a) {
94
94
  switch (_a.label) {
95
95
  case 0:
96
96
  startSpeedTest();
97
- return [4 /*yield*/, getBerifymeUser(response.customerId, response.transactionId)];
97
+ if (!token) return [3 /*break*/, 2];
98
+ return [4 /*yield*/, getBerifymeUser(response.customerId, response.interviewId, response.transactionId, token)];
98
99
  case 1:
99
100
  _a.sent();
100
- return [2 /*return*/];
101
+ _a.label = 2;
102
+ case 2: return [2 /*return*/];
101
103
  }
102
104
  });
103
105
  }); },
104
106
  onError: function (r) {
105
107
  startSpeedTest();
106
108
  console.log('onError: ', r);
107
- onError({ type: 'Oops! Something went wrong...' });
109
+ setError('Oops! Something went wrong...');
108
110
  },
109
111
  stopAtError: true,
110
112
  isOneToOne: true,
@@ -114,9 +116,9 @@ function LoginComponent(_a) {
114
116
  });
115
117
  }
116
118
  else {
117
- onError({ type: 'Oops! Something went wrong...' });
119
+ setError('Oops! Something went wrong...');
118
120
  }
119
- }, [onSuccess, onError]);
121
+ }, [onSuccess, setError]);
120
122
  return React.createElement("div", { ref: containerRef },
121
123
  React.createElement(Box, { sx: {
122
124
  display: 'flex',
@@ -1,16 +1,8 @@
1
1
  import React from "react";
2
- import { useState } from "react";
3
- import TryAgain from "../../TryAgain";
4
2
  import { LoginComponent } from "./Login";
5
3
  var IncodeLogin = function (_a) {
6
- var goToAllSet = _a.goToAllSet, user = _a.user, setUser = _a.setUser, token = _a.token;
7
- var _b = useState(), error = _b[0], setError = _b[1];
8
- function handleError(e) {
9
- setError(e.type);
10
- }
11
- if (error || !token)
12
- return (React.createElement(TryAgain, { message: error }));
4
+ var goToAllSet = _a.goToAllSet, user = _a.user, setUser = _a.setUser, token = _a.token, setError = _a.setError;
13
5
  return (React.createElement(React.Fragment, null,
14
- React.createElement(LoginComponent, { token: token, onError: handleError, onSuccess: goToAllSet, user: user, setUser: setUser })));
6
+ React.createElement(LoginComponent, { token: token, setError: setError, onSuccess: goToAllSet, user: user, setUser: setUser })));
15
7
  };
16
8
  export { IncodeLogin };
@@ -213,7 +213,7 @@ var AuthID = function (_a) {
213
213
  var _a, _b, _c, _d, _e, _f, _g;
214
214
  return __generator(this, function (_h) {
215
215
  switch (_h.label) {
216
- case 0: return [4 /*yield*/, berifymeApi.authID.getDocumentDetails({ token: localStorage.getItem('authID_token') || '', operationId: operationId, userId: userId })];
216
+ case 0: return [4 /*yield*/, berifymeApi.authID.getDocumentDetails({ token: localStorage.getItem('authID_token') || '', operationId: operationId, userId: userId, sessionToken: token })];
217
217
  case 1:
218
218
  document = _h.sent();
219
219
  createDeveloperLog({
@@ -259,7 +259,7 @@ var AuthID = function (_a) {
259
259
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
260
260
  return (__assign(__assign({}, prev), { id: userId, fullName: (_a = document.details.find(function (item) { return item.Key === 'NameOfHolder'; })) === null || _a === void 0 ? void 0 : _a.Value, phoneNumber: document.phone, isActive: (_b = prev === null || prev === void 0 ? void 0 : prev.isActive) !== null && _b !== void 0 ? _b : null, email: (_c = prev === null || prev === void 0 ? void 0 : prev.email) !== null && _c !== void 0 ? _c : null, authIDAccountNumber: (_d = prev === null || prev === void 0 ? void 0 : prev.authIDAccountNumber) !== null && _d !== void 0 ? _d : null, incodeId: (_e = prev === null || prev === void 0 ? void 0 : prev.incodeId) !== null && _e !== void 0 ? _e : null, clearId: (_f = prev === null || prev === void 0 ? void 0 : prev.clearId) !== null && _f !== void 0 ? _f : null, idmeId: (_g = prev === null || prev === void 0 ? void 0 : prev.idmeId) !== null && _g !== void 0 ? _g : null, sumsubId: (_h = prev === null || prev === void 0 ? void 0 : prev.sumsubId) !== null && _h !== void 0 ? _h : null, veriffId: (_j = prev === null || prev === void 0 ? void 0 : prev.veriffId) !== null && _j !== void 0 ? _j : null, yotiId: (_k = prev === null || prev === void 0 ? void 0 : prev.yotiId) !== null && _k !== void 0 ? _k : null, age: (_l = prev === null || prev === void 0 ? void 0 : prev.age) !== null && _l !== void 0 ? _l : null, birthDate: (_m = prev === null || prev === void 0 ? void 0 : prev.birthDate) !== null && _m !== void 0 ? _m : null }));
261
261
  });
262
- updateAuthenticationLog({ isPass: true, transactionId: operationId });
262
+ updateAuthenticationLog({ isPass: true, transactionId: operationId, token: token });
263
263
  goToAllSet();
264
264
  }
265
265
  window.ReactNativeWebView.postMessage(JSON.stringify({