@bytexbyte/berifyme-react-sdk 1.0.15 → 1.0.16

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/dist/api/api.js CHANGED
@@ -357,17 +357,18 @@ function updateAccount(token, data) {
357
357
  });
358
358
  });
359
359
  }
360
- function getIncodeStart(uniqueId) {
361
- return __awaiter(this, void 0, void 0, function () {
360
+ function getIncodeStart(_a) {
361
+ return __awaiter(this, arguments, void 0, function (_b) {
362
362
  var url, res;
363
- return __generator(this, function (_a) {
364
- switch (_a.label) {
363
+ var uniqueId = _b.uniqueId, sessionToken = _b.sessionToken;
364
+ return __generator(this, function (_c) {
365
+ switch (_c.label) {
365
366
  case 0:
366
- url = "".concat(config.backendDomain, "/api/incode/start?").concat(uniqueId ? "uniqueId=".concat(uniqueId) : '');
367
+ url = "".concat(config.backendDomain, "/api/incode/start?sessionToken=").concat(sessionToken).concat(uniqueId ? "&uniqueId=".concat(uniqueId) : '');
367
368
  console.log('UrlString: ', url);
368
369
  return [4 /*yield*/, axios.get(url)];
369
370
  case 1:
370
- res = _a.sent();
371
+ res = _c.sent();
371
372
  console.log('UrlRes data: ', res.data);
372
373
  return [2 /*return*/, res.data];
373
374
  }
@@ -410,6 +411,29 @@ function getIncodeApprove(_a) {
410
411
  });
411
412
  });
412
413
  }
414
+ function incodeWatchListResult(_a) {
415
+ return __awaiter(this, arguments, void 0, function (_b) {
416
+ var url, payload, res;
417
+ var incodeSessionToken = _b.incodeSessionToken, berifymeSessionToken = _b.berifymeSessionToken, incodeSessionId = _b.incodeSessionId;
418
+ return __generator(this, function (_c) {
419
+ switch (_c.label) {
420
+ case 0:
421
+ url = "".concat(config.backendDomain, "/api/incode/watchListResult");
422
+ console.log('UrlString: ', url);
423
+ payload = {
424
+ incodeSessionToken: incodeSessionToken,
425
+ incodeSessionId: incodeSessionId,
426
+ berifymeSessionToken: berifymeSessionToken,
427
+ };
428
+ return [4 /*yield*/, axios.post(url, payload)];
429
+ case 1:
430
+ res = _c.sent();
431
+ console.log('UrlRes data: ', res.data);
432
+ return [2 /*return*/, res.data];
433
+ }
434
+ });
435
+ });
436
+ }
413
437
  function createVerificationSession(_a) {
414
438
  return __awaiter(this, arguments, void 0, function (_b) {
415
439
  var url, payload, res;
@@ -1133,6 +1157,7 @@ var berifymeApi = {
1133
1157
  getIncodeStart: getIncodeStart,
1134
1158
  getIncodeFinish: getIncodeFinish,
1135
1159
  getIncodeApprove: getIncodeApprove,
1160
+ incodeWatchListResult: incodeWatchListResult,
1136
1161
  },
1137
1162
  clear: {
1138
1163
  createVerificationSession: createVerificationSession,
@@ -51,14 +51,16 @@ import TryAgain from "../../TryAgain";
51
51
  import berifymeApi, { ActionType } from "../../../api/api";
52
52
  import { createAuthenticationLog, updateAuthenticationLog } from "../../AuthenticationLogs";
53
53
  import { createDeveloperLog } from "../../createDeveloperLog";
54
- function startOnboardingSession(uniqueId) {
55
- return __awaiter(this, void 0, void 0, function () {
54
+ import { ProcessGlobalWatchlist } from "./processGlobalWatchlist";
55
+ function startOnboardingSession(_a) {
56
+ return __awaiter(this, arguments, void 0, function (_b) {
56
57
  var res;
57
- return __generator(this, function (_a) {
58
- switch (_a.label) {
59
- case 0: return [4 /*yield*/, berifymeApi.incode.getIncodeStart(uniqueId)];
58
+ var uniqueId = _b.uniqueId, sessionToken = _b.sessionToken;
59
+ return __generator(this, function (_c) {
60
+ switch (_c.label) {
61
+ case 0: return [4 /*yield*/, berifymeApi.incode.getIncodeStart({ uniqueId: uniqueId, sessionToken: sessionToken })];
60
62
  case 1:
61
- res = _a.sent();
63
+ res = _c.sent();
62
64
  return [2 /*return*/, res];
63
65
  }
64
66
  });
@@ -117,7 +119,7 @@ var IncodeOnBoarding = function (_a) {
117
119
  if (isLoaded.current)
118
120
  return;
119
121
  var res = getUrlParams();
120
- startOnboardingSession(res.uniqueId)
122
+ startOnboardingSession({ uniqueId: res.uniqueId, sessionToken: token })
121
123
  .then(function (session) { return __awaiter(void 0, void 0, void 0, function () {
122
124
  return __generator(this, function (_a) {
123
125
  setSession(session);
@@ -198,7 +200,7 @@ var IncodeOnBoarding = function (_a) {
198
200
  setError(e.type);
199
201
  }
200
202
  if (error)
201
- return (React.createElement(TryAgain, null));
203
+ return (React.createElement(TryAgain, { message: "Authentication Failed, Please Try Again." }));
202
204
  if (!session)
203
205
  return (React.createElement(Box, { sx: {
204
206
  display: 'flex',
@@ -217,6 +219,7 @@ var IncodeOnBoarding = function (_a) {
217
219
  React.createElement(ProcessId, { session: session, onError: handleError, onSuccess: goNext }),
218
220
  React.createElement(Selfie, { session: session, onError: handleError, onSuccess: goNext }),
219
221
  React.createElement(ProcessFace, { session: session, onError: handleError, onSuccess: goNext }),
222
+ React.createElement(ProcessGlobalWatchlist, { session: session, onError: handleError, onSuccess: goNext, token: token }),
220
223
  React.createElement(FinishOnboarding, { session: session, onError: handleError, onSuccess: finishOnboarding }))));
221
224
  };
222
225
  export { IncodeOnBoarding };
@@ -0,0 +1,79 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { useEffect } from "react";
38
+ import { incode } from "../../../vender/incode/incode";
39
+ import { Box, CircularProgress } from "@mui/material";
40
+ import React from "react";
41
+ import berifymeApi from "../../../api/api";
42
+ function ProcessGlobalWatchlist(_a) {
43
+ var _this = this;
44
+ var session = _a.session, onSuccess = _a.onSuccess, onError = _a.onError, token = _a.token;
45
+ useEffect(function () {
46
+ if (session.watchList === false) {
47
+ onSuccess();
48
+ return;
49
+ }
50
+ void incode.processGlobalWatchlist({ token: session.token }).then(function (info) {
51
+ console.log('processGlobalWatchlist success e: ', info);
52
+ onSuccess();
53
+ }).catch(function (error) {
54
+ console.log('processGlobalWatchlist error e: ', error);
55
+ onError({ type: error });
56
+ }).finally(function () { return __awaiter(_this, void 0, void 0, function () {
57
+ return __generator(this, function (_a) {
58
+ switch (_a.label) {
59
+ case 0:
60
+ if (!token)
61
+ return [2 /*return*/];
62
+ return [4 /*yield*/, berifymeApi.incode.incodeWatchListResult({ incodeSessionToken: session.token, berifymeSessionToken: token, incodeSessionId: session.interviewId })];
63
+ case 1:
64
+ _a.sent();
65
+ return [2 /*return*/];
66
+ }
67
+ });
68
+ }); });
69
+ }, [session, onSuccess, onError]);
70
+ return React.createElement(Box, { sx: {
71
+ display: 'flex',
72
+ justifyContent: 'center',
73
+ alignItems: 'center',
74
+ height: '100vh',
75
+ background: '#FFFFFF'
76
+ } },
77
+ React.createElement(CircularProgress, null));
78
+ }
79
+ export { ProcessGlobalWatchlist };
@@ -208,7 +208,10 @@ declare function updateAccount(token: string, data: {
208
208
  }): Promise<{
209
209
  success: "ok";
210
210
  }>;
211
- declare function getIncodeStart(uniqueId?: string): Promise<{
211
+ declare function getIncodeStart({ uniqueId, sessionToken }: {
212
+ uniqueId?: string;
213
+ sessionToken?: string;
214
+ }): Promise<{
212
215
  token: string;
213
216
  uniqueId: string;
214
217
  }>;
@@ -226,6 +229,14 @@ declare function getIncodeApprove({ id, token, sessionToken, }: {
226
229
  user?: UserWithAgeAndFullName;
227
230
  error?: string;
228
231
  }>;
232
+ declare function incodeWatchListResult({ incodeSessionToken, berifymeSessionToken, incodeSessionId }: {
233
+ incodeSessionToken: string;
234
+ berifymeSessionToken: string;
235
+ incodeSessionId?: string;
236
+ }): Promise<{
237
+ message?: string;
238
+ error?: string;
239
+ }>;
229
240
  declare function createVerificationSession({ redirectUrl, token }: {
230
241
  redirectUrl: string;
231
242
  token?: string;
@@ -502,6 +513,7 @@ declare const berifymeApi: {
502
513
  getIncodeStart: typeof getIncodeStart;
503
514
  getIncodeFinish: typeof getIncodeFinish;
504
515
  getIncodeApprove: typeof getIncodeApprove;
516
+ incodeWatchListResult: typeof incodeWatchListResult;
505
517
  };
506
518
  clear: {
507
519
  createVerificationSession: typeof createVerificationSession;
@@ -0,0 +1,12 @@
1
+ import { SessionType } from "../../../vender/incode/incode";
2
+ import React from "react";
3
+ declare function ProcessGlobalWatchlist({ session, onSuccess, onError, token, }: ProccessIdPropTypes): React.JSX.Element;
4
+ type ProccessIdPropTypes = {
5
+ session: SessionType;
6
+ onSuccess: () => void;
7
+ onError: (e: {
8
+ type: string;
9
+ }) => void;
10
+ token?: string;
11
+ };
12
+ export { ProcessGlobalWatchlist };
@@ -2,6 +2,7 @@ type SessionType = {
2
2
  token: string;
3
3
  uniqueId?: string;
4
4
  interviewId?: string;
5
+ watchList?: boolean;
5
6
  };
6
7
  declare const incode: any;
7
8
  declare const incodeLogin: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/berifyme-react-sdk",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/index.d.ts",