@bytexbyte/berifyme-react-sdk 1.0.2 → 1.0.4

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.
@@ -34,38 +34,35 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
34
34
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
35
  }
36
36
  };
37
- import { environmentDomains } from '../lib/environmentDomains';
38
- import { PageStatus } from '../enum';
39
37
  import { Box, CircularProgress, CssBaseline, ThemeProvider } from '@mui/material';
40
38
  import React, { useEffect, useState } from 'react';
41
- import theme from '../components/theme';
39
+ import '../../index.css';
42
40
  import berifymeApi, { initializeBerifymeApi } from '../api/api';
43
- import { incode } from '../vender/incode/incode';
44
41
  import AllSet from '../components/AllSet';
45
- import Modal from './MainModal';
46
- import RedirectToMobile from '../components/RedirectToMobile';
47
- import ScreenRotation from '../components/ScreenRotation';
48
- import TryAgainInModal from '../components/TryAgainInModal';
49
42
  import { createDeveloperLog } from '../components/createDeveloperLog';
50
43
  import { AuthidLogin } from '../components/Login/authid';
51
44
  import { ClearLogin } from '../components/Login/clear';
52
45
  import { ClearLoginAllSet } from '../components/Login/clearAllSet';
53
46
  import { IncodeLogin } from '../components/Login/incode';
54
- //[Wings] import SumsubLogin from './login/sumsub';
55
- //[Wings] import VeriffLogin from './login/veriff';
56
47
  import AuthID from '../components/OnBoarding/authId';
57
48
  import IdOrPassport from '../components/OnBoarding/authId/idOrPassport';
58
49
  import { ClearOnboarding } from '../components/OnBoarding/clear';
59
50
  import { ClearOnboardingAllSet } from '../components/OnBoarding/clear/clearAllSet';
60
51
  import { IncodeOnBoarding } from '../components/OnBoarding/incode';
61
- //[Wings] import SumsubOnBoarding from './onBoarding/sumsub';
62
52
  import Vender from '../components/OnBoarding/vender';
63
- //[Wings] import VeriffOnBoarding from './onBoarding/veriff';
64
- //[Wings] import YotiOnBoarding from './onBoarding/yoti';
53
+ import RedirectToMobile from '../components/RedirectToMobile';
54
+ import ScreenRotation from '../components/ScreenRotation';
65
55
  import SendSns from '../components/SendSns';
56
+ import theme from '../components/theme';
57
+ import TryAgainInModal from '../components/TryAgainInModal';
66
58
  import VerifyNewUser from '../components/VerifyWithPhoneNumber/NewUser';
67
59
  import VerifyUser from '../components/VerifyWithPhoneNumber/User';
68
- import '../../index.css';
60
+ import { PageStatus } from '../enum';
61
+ import { environmentDomains } from '../lib/environmentDomains';
62
+ import { incode } from '../vender/incode/incode';
63
+ import Modal from './MainModal';
64
+ import QrcodeExpired from '../components/QrcodeExpired';
65
+ import SessionInterrupted from '../components/SessionInterrupted';
69
66
  var HomeModal = function (_a) {
70
67
  var apiKeyId = _a.apiKeyId, secretKey = _a.secretKey, redirectUrl = _a.redirectUrl, _b = _a.initialPhoneNumber, initialPhoneNumber = _b === void 0 ? '' : _b, environment = _a.environment, forceQrcode = _a.forceQrcode;
71
68
  var _c = useState(window.innerWidth > window.innerHeight), isLandscape = _c[0], setIsLandscape = _c[1];
@@ -156,6 +153,25 @@ var HomeModal = function (_a) {
156
153
  });
157
154
  });
158
155
  }
156
+ function checkDesktopRedirectUrlIdExpired(_a) {
157
+ return __awaiter(this, arguments, void 0, function (_b) {
158
+ var res;
159
+ var token = _b.token, desktopRedirectUrlId = _b.desktopRedirectUrlId;
160
+ return __generator(this, function (_c) {
161
+ switch (_c.label) {
162
+ case 0: return [4 /*yield*/, berifymeApi.thirdParty.checkDesktopRedirectUrlIdExpired({ token: token, desktopRedirectUrlId: desktopRedirectUrlId })];
163
+ case 1:
164
+ res = _c.sent();
165
+ console.log('checkDesktopRedirectUrlIdExpired', res.error);
166
+ if (res.error)
167
+ setPageStatus(PageStatus.QRCodeExpired);
168
+ else
169
+ setPageStatus(PageStatus.SendSns);
170
+ return [2 /*return*/];
171
+ }
172
+ });
173
+ });
174
+ }
159
175
  useEffect(function () {
160
176
  if (incode.isDesktop() || forceQrcode) {
161
177
  setUseQrcode(true);
@@ -173,18 +189,32 @@ var HomeModal = function (_a) {
173
189
  else if (apiKeyId && secretKey && redirectUrl) {
174
190
  createToken({ apiKeyId: apiKeyId, secretKey: secretKey, redirectUrl: redirectUrl });
175
191
  }
176
- //處理desktop
177
- if (res.desktopRedirectUrlId)
192
+ else {
193
+ setError('Token is required to access this page. Please include a valid token in the URL.');
194
+ }
195
+ //[Web] if (res.token) {
196
+ // checkToken(res.token);
197
+ // } else {
198
+ // setError('Token is required to access this page. Please include a valid token in the URL.');
199
+ // }
200
+ // 若params有desktopRedirectUrlId, 就設定useState
201
+ if (res.desktopRedirectUrlId) {
178
202
  setDesktopRedirectUrlId(res.desktopRedirectUrlId);
203
+ }
179
204
  // 確定是否為clear callback onboarding or login,是就轉導致對應頁面
205
+ // 然後如果有desktopRedirectUrlId, 檢查有沒有過期, 有就去QrCodeExpired頁面, 沒有就去SendSns
206
+ // 如果沒有desktopRedirectUrlId就照流程去SendSns
180
207
  if (res.callback === 'clear_login') {
181
208
  setPageStatus(6);
182
209
  }
183
210
  else if (res.callback === 'clear_onboarding') {
184
211
  setPageStatus(7);
185
212
  }
213
+ else if (res.desktopRedirectUrlId) {
214
+ checkDesktopRedirectUrlIdExpired({ token: res.token, desktopRedirectUrlId: res.desktopRedirectUrlId });
215
+ }
186
216
  else {
187
- setPageStatus(0);
217
+ setPageStatus(PageStatus.SendSns);
188
218
  }
189
219
  }, []);
190
220
  useEffect(function () {
@@ -213,60 +243,51 @@ var HomeModal = function (_a) {
213
243
  else if (isLandscape) {
214
244
  setModalHeight('100vh');
215
245
  }
216
- else if (pageStatus === 0) {
246
+ else if (pageStatus === PageStatus.SendSns) {
217
247
  setModalHeight('58vh');
218
248
  }
219
- else if (pageStatus === 1) {
249
+ else if (pageStatus === PageStatus.QRCodeExpired) {
250
+ setModalHeight('46vh');
251
+ }
252
+ else if (pageStatus === PageStatus.VerifyNewUser) {
220
253
  setModalHeight('64vh');
221
254
  }
222
- else if (pageStatus === 2) {
255
+ else if (pageStatus === PageStatus.AuthIdOnboarding) {
223
256
  setModalHeight('90vh');
224
257
  }
225
- else if (pageStatus === 4) {
258
+ else if (pageStatus === PageStatus.ClearLogin) {
226
259
  setModalHeight('100vh');
227
260
  }
228
- else if (pageStatus === 5) {
261
+ else if (pageStatus === PageStatus.IncodeLogin) {
229
262
  setModalHeight('100vh');
230
263
  }
231
- else if (pageStatus === 6) {
264
+ else if (pageStatus === PageStatus.ClearLoginAllSet) {
232
265
  setModalHeight('58vh');
233
266
  }
234
- else if (pageStatus === 7) {
267
+ else if (pageStatus === PageStatus.ClearOnboardingAllSet) {
235
268
  setModalHeight('58vh');
236
269
  }
237
- else if (pageStatus === 8) {
270
+ else if (pageStatus === PageStatus.Vender) {
238
271
  setModalHeight('80vh');
239
272
  }
240
- else if (pageStatus === 9) {
241
- setModalHeight('100vh');
242
- }
243
- else if (pageStatus === 1.1) {
244
- setModalHeight('80vh');
245
- }
246
- else if (pageStatus === 1.2) {
273
+ else if (pageStatus === PageStatus.IdOrPassport) {
247
274
  setModalHeight('55vh');
248
275
  }
249
- else if (pageStatus === 1.5) {
276
+ else if (pageStatus === PageStatus.VerifyUser) {
250
277
  setModalHeight('46vh');
251
278
  }
252
- else if (pageStatus === 2.1) {
279
+ else if (pageStatus === PageStatus.ClearOnboarding) {
253
280
  setModalHeight('100vh');
254
281
  }
255
- else if (pageStatus === 2.2) {
282
+ else if (pageStatus === PageStatus.IncodeOnBoarding) {
256
283
  setModalHeight('100vh');
257
284
  }
258
- else if (pageStatus === 2.3) {
259
- setModalHeight('80vh');
260
- }
261
- else if (pageStatus === 2.4) {
262
- setModalHeight('100vh');
263
- }
264
- else if (pageStatus === 2.5) {
265
- setModalHeight('80vh');
266
- }
267
- else if (pageStatus === 10) {
285
+ else if (pageStatus === PageStatus.AllSet) {
268
286
  setModalHeight('58vh');
269
287
  }
288
+ else if (pageStatus === PageStatus.SessionInterrupted) {
289
+ setModalHeight('46vh');
290
+ }
270
291
  else {
271
292
  setModalHeight('80vh');
272
293
  }
@@ -299,6 +320,10 @@ var HomeModal = function (_a) {
299
320
  background: '#FFFFFF'
300
321
  } },
301
322
  React.createElement(CircularProgress, null)),
323
+ pageStatus === PageStatus.SessionInterrupted &&
324
+ React.createElement(SessionInterrupted, null),
325
+ pageStatus === PageStatus.QRCodeExpired &&
326
+ React.createElement(QrcodeExpired, null),
302
327
  pageStatus === PageStatus.SendSns &&
303
328
  React.createElement(SendSns, { token: token, inputValue: inputValue, setInputValue: setInputValue, setError: setError, setPageStatus: setPageStatus, setProcessedPhoneNumber: setProcessedPhoneNumber, setModalHeight: setModalHeight, setUser: setUser, environment: environment }),
304
329
  pageStatus === PageStatus.VerifyNewUser &&
@@ -310,22 +335,22 @@ var HomeModal = function (_a) {
310
335
  pageStatus === PageStatus.VerifyUser &&
311
336
  React.createElement(VerifyUser, { token: token, inputValue: inputValue, setError: setError, setPageStatus: setPageStatus, setModalHeight: setModalHeight, setUser: setUser, environment: environment }),
312
337
  pageStatus === PageStatus.AuthIdOnboarding && user &&
313
- React.createElement(AuthID, { token: token, goToAllSet: function () { return setPageStatus(10); }, setError: setError, userId: user.id, setUser: setUser, selectedIdType: authIdSelectedIdType }),
338
+ React.createElement(AuthID, { token: token, goToAllSet: function () { return setPageStatus(PageStatus.AllSet); }, setError: setError, userId: user.id, setUser: setUser, selectedIdType: authIdSelectedIdType }),
314
339
  pageStatus === PageStatus.ClearOnboarding && user &&
315
340
  React.createElement(ClearOnboarding, { token: token, user: user, desktopRedirectUrlId: desktopRedirectUrlId }),
316
341
  pageStatus === PageStatus.IncodeOnBoarding && user &&
317
- React.createElement(IncodeOnBoarding, { user: user, setUser: setUser, token: token, goToAllSet: function () { return setPageStatus(10); } }),
342
+ React.createElement(IncodeOnBoarding, { user: user, setUser: setUser, token: token, goToAllSet: function () { return setPageStatus(PageStatus.AllSet); } }),
318
343
  pageStatus === PageStatus.AuthidLogin && processedPhoneNumber &&
319
- React.createElement(AuthidLogin, { token: token, goToAllSet: function () { return setPageStatus(10); }, phoneNumber: processedPhoneNumber, setUser: setUser }),
344
+ React.createElement(AuthidLogin, { token: token, goToAllSet: function () { return setPageStatus(PageStatus.AllSet); }, phoneNumber: processedPhoneNumber, setUser: setUser }),
320
345
  pageStatus === PageStatus.ClearLogin &&
321
346
  React.createElement(ClearLogin, { token: token, userId: user === null || user === void 0 ? void 0 : user.id, desktopRedirectUrlId: desktopRedirectUrlId }),
322
347
  pageStatus === PageStatus.IncodeLogin &&
323
- React.createElement(IncodeLogin, { token: token, user: user, setUser: setUser, goToAllSet: function () { return setPageStatus(10); } }),
348
+ React.createElement(IncodeLogin, { token: token, user: user, setUser: setUser, goToAllSet: function () { return setPageStatus(PageStatus.AllSet); } }),
324
349
  pageStatus === PageStatus.ClearLoginAllSet &&
325
- React.createElement(ClearLoginAllSet, { token: token, desktopRedirectUrlId: desktopRedirectUrlId }),
350
+ React.createElement(ClearLoginAllSet, { token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus }),
326
351
  pageStatus === PageStatus.ClearOnboardingAllSet &&
327
- React.createElement(ClearOnboardingAllSet, { token: token, desktopRedirectUrlId: desktopRedirectUrlId }),
352
+ React.createElement(ClearOnboardingAllSet, { token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus }),
328
353
  pageStatus === PageStatus.AllSet &&
329
- React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId })))))))));
354
+ React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus })))))))));
330
355
  };
331
356
  export default HomeModal;
package/dist/api/api.js CHANGED
@@ -558,6 +558,29 @@ function checkThirdPartyVerificationToken(token) {
558
558
  });
559
559
  });
560
560
  }
561
+ function checkDesktopRedirectUrlIdExpired(_a) {
562
+ return __awaiter(this, arguments, void 0, function (_b) {
563
+ var url, res;
564
+ var token = _b.token, desktopRedirectUrlId = _b.desktopRedirectUrlId;
565
+ return __generator(this, function (_c) {
566
+ switch (_c.label) {
567
+ case 0:
568
+ url = "".concat(config.backendDomain, "/api/thirdParty/checkDesktopRedirectUrlIdExpired?desktopRedirectUrlId=").concat(desktopRedirectUrlId);
569
+ console.log('UrlString: ', url);
570
+ return [4 /*yield*/, axios.get(url, {
571
+ headers: {
572
+ 'Content-Type': 'application/json',
573
+ 'token': token,
574
+ }
575
+ })];
576
+ case 1:
577
+ res = _c.sent();
578
+ console.log('UrlRes data: ', res.data);
579
+ return [2 /*return*/, res.data];
580
+ }
581
+ });
582
+ });
583
+ }
561
584
  function sendVerifyEmail(email) {
562
585
  return __awaiter(this, void 0, void 0, function () {
563
586
  var url, res;
@@ -1292,6 +1315,7 @@ var berifymeApi = {
1292
1315
  thirdParty: {
1293
1316
  getRedirectUrl: getRedirectUrl,
1294
1317
  checkThirdPartyVerificationToken: checkThirdPartyVerificationToken,
1318
+ checkDesktopRedirectUrlIdExpired: checkDesktopRedirectUrlIdExpired,
1295
1319
  },
1296
1320
  scheduld: {
1297
1321
  initUpdateAdminTokenSchedule: initUpdateAdminTokenSchedule,
@@ -44,6 +44,7 @@ import { useEffect, useState } from "react";
44
44
  import TryAgain from "../TryAgain";
45
45
  import { v4 as uuidv4 } from 'uuid';
46
46
  import { createDeveloperLog } from "../createDeveloperLog";
47
+ import { PageStatus } from "../../enum";
47
48
  var createDeviceId = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
48
49
  var newDeviceId;
49
50
  var userId = _b.userId;
@@ -62,7 +63,7 @@ var createDeviceId = function (_a) { return __awaiter(void 0, [_a], void 0, func
62
63
  });
63
64
  }); };
64
65
  var AllSet = function (_a) {
65
- var user = _a.user, token = _a.token, desktopRedirectUrlId = _a.desktopRedirectUrlId;
66
+ var user = _a.user, token = _a.token, desktopRedirectUrlId = _a.desktopRedirectUrlId, setPageStatus = _a.setPageStatus;
66
67
  var _b = useState(''), error = _b[0], setError = _b[1];
67
68
  var _c = useState(), desktopStatusMessage = _c[0], setDesktopStatusMessage = _c[1];
68
69
  var _d = useState(true), loading = _d[0], setLoading = _d[1];
@@ -137,11 +138,11 @@ var AllSet = function (_a) {
137
138
  if (desktopRedirectUrlId === undefined) {
138
139
  setRedirectUrl(res.redirectUrl);
139
140
  }
141
+ else if (res.heartbeatStopped) {
142
+ setPageStatus(PageStatus.SessionInterrupted);
143
+ }
140
144
  else {
141
- if (res.heartbeatStopped)
142
- setDesktopStatusMessage('Session interrupted. Please retry.');
143
- else
144
- setDesktopStatusMessage('ID verification successful. Continue on your PC.');
145
+ setDesktopStatusMessage('Return to the original window to be redirected to the next page');
145
146
  }
146
147
  return [2 /*return*/];
147
148
  }
@@ -161,24 +162,21 @@ var AllSet = function (_a) {
161
162
  background: '#FFFFFF'
162
163
  } },
163
164
  React.createElement(CircularProgress, null)) :
164
- React.createElement(React.Fragment, null, desktopStatusMessage ?
165
- React.createElement(Stack, { height: 1, justifyContent: "center", alignItems: "center" },
166
- React.createElement(Stack, { alignItems: "center", spacing: 2 },
167
- React.createElement("img", { width: 40, height: 40, src: "https://staging.berify.me/berify.svg", alt: "berify" }),
168
- React.createElement(Typography, { variant: "body1", color: theme.palette.text.secondary }, desktopStatusMessage)))
169
- :
170
- React.createElement(Stack, { height: 1, spacing: 4, justifyContent: 'space-between', py: 4, overflow: 'auto' },
171
- React.createElement(Stack, { spacing: 2, textAlign: 'center', alignItems: 'center' },
172
- React.createElement("img", { width: 40, height: 40, src: "https://staging.berify.me/berify.svg", alt: "berify" }),
173
- React.createElement(Typography, { variant: "h2", fontWeight: 700 },
174
- "You\u2019re Berified,",
175
- React.createElement("br", null), user === null || user === void 0 ? void 0 :
176
- user.fullName),
177
- React.createElement(Typography, { variant: "body1", color: theme.palette.text.secondary }, "Thank you for securely verifying your identity through Berify.me \uD83C\uDF89")),
178
- React.createElement(Stack, { spacing: 2, alignItems: 'center' },
179
- React.createElement(Button, { variant: "contained", onClick: function () { window.location.href = redirectUrl; }, sx: { minWidth: 160 } }, "Continue")),
180
- React.createElement(Stack, { direction: 'row', spacing: 2, textAlign: 'center', justifyContent: 'center', color: theme.palette.text.secondary },
181
- React.createElement(GppGoodOutlinedIcon, null),
182
- React.createElement(Typography, { variant: "body1" }, "Securely powered by Berify.me")))))));
165
+ React.createElement(Stack, { height: 1, spacing: 4, justifyContent: 'space-between', py: 4, overflow: 'auto' },
166
+ React.createElement(Stack, { spacing: 2, textAlign: 'center', alignItems: 'center' },
167
+ React.createElement("img", { width: 40, height: 40, src: "https://staging.berify.me/berify.svg", alt: "berify" }),
168
+ React.createElement(Typography, { variant: "h2", fontWeight: 700 },
169
+ "You\u2019re Berified,",
170
+ React.createElement("br", null), user === null || user === void 0 ? void 0 :
171
+ user.fullName),
172
+ React.createElement(Typography, { variant: "body1", color: theme.palette.text.secondary }, "Thank you for securely verifying your identity through Berify.me \uD83C\uDF89")),
173
+ desktopStatusMessage ?
174
+ React.createElement(Stack, { py: 4, textAlign: 'center', alignItems: 'center' },
175
+ React.createElement(Typography, { variant: "body1", color: theme.palette.text.secondary }, desktopStatusMessage)) :
176
+ React.createElement(Stack, { spacing: 2, alignItems: 'center' },
177
+ React.createElement(Button, { variant: "contained", onClick: function () { window.location.href = redirectUrl; }, sx: { minWidth: 160 } }, "Continue")),
178
+ React.createElement(Stack, { direction: 'row', spacing: 2, textAlign: 'center', justifyContent: 'center', color: theme.palette.text.secondary },
179
+ React.createElement(GppGoodOutlinedIcon, null),
180
+ React.createElement(Typography, { variant: "body1" }, "Securely powered by Berify.me"))))));
183
181
  };
184
182
  export default AllSet;
@@ -43,7 +43,7 @@ import TryAgain from "../TryAgain";
43
43
  import { updateAuthenticationLog } from "../AuthenticationLogs";
44
44
  import { createDeveloperLog } from "../createDeveloperLog";
45
45
  var ClearLoginAllSet = function (_a) {
46
- var token = _a.token, desktopRedirectUrlId = _a.desktopRedirectUrlId;
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
49
  var getUserBySessionId = function (sessionId) { return __awaiter(void 0, void 0, void 0, function () {
@@ -83,7 +83,7 @@ var ClearLoginAllSet = function (_a) {
83
83
  }, []);
84
84
  if (error)
85
85
  return (React.createElement(TryAgain, { message: error }));
86
- return (React.createElement(React.Fragment, null, user ? React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId }) :
86
+ return (React.createElement(React.Fragment, null, user ? React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus }) :
87
87
  React.createElement(Box, { sx: {
88
88
  display: 'flex',
89
89
  justifyContent: 'center',
@@ -43,7 +43,7 @@ import TryAgain from "../../TryAgain";
43
43
  import { updateAuthenticationLog } from "../../AuthenticationLogs";
44
44
  import { createDeveloperLog } from "../../createDeveloperLog";
45
45
  var ClearOnboardingAllSet = function (_a) {
46
- var token = _a.token, desktopRedirectUrlId = _a.desktopRedirectUrlId;
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
49
  var approve = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
@@ -105,7 +105,7 @@ var ClearOnboardingAllSet = function (_a) {
105
105
  }, []);
106
106
  if (error)
107
107
  return (React.createElement(TryAgain, { message: error }));
108
- return (React.createElement(React.Fragment, null, user ? React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId }) :
108
+ return (React.createElement(React.Fragment, null, user ? React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus }) :
109
109
  React.createElement(Box, { sx: {
110
110
  display: 'flex',
111
111
  justifyContent: 'center',
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { Stack, Typography } from "@mui/material";
3
+ import theme from "../theme";
4
+ import GppGoodOutlinedIcon from '@mui/icons-material/GppGoodOutlined';
5
+ var QrcodeExpired = function () {
6
+ return (React.createElement(React.Fragment, null,
7
+ React.createElement(Stack, { height: 1, spacing: 4, justifyContent: 'space-between', py: 4, overflow: 'auto' },
8
+ React.createElement(Stack, { spacing: 2, textAlign: 'center', alignItems: 'center' },
9
+ React.createElement("img", { width: 60, height: 60, src: "https://staging.berify.me/errorIcon.png", alt: "berify" }),
10
+ React.createElement(Typography, { variant: "h2", fontWeight: 700 }, "QR Code Expired"),
11
+ React.createElement(Typography, { variant: "body1", color: theme.palette.text.secondary }, "The QR code is only active for 5 minutes."),
12
+ React.createElement(Typography, { variant: "body1", color: theme.palette.text.secondary }, "Return to the original sign up window to request for a new QR code.")),
13
+ React.createElement(Stack, { direction: 'row', spacing: 2, textAlign: 'center', justifyContent: 'center', color: theme.palette.text.secondary },
14
+ React.createElement(GppGoodOutlinedIcon, null),
15
+ React.createElement(Typography, { variant: "body1" }, "Securely powered by Berify.me")))));
16
+ };
17
+ export default QrcodeExpired;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { Stack, Typography } from "@mui/material";
3
+ import theme from "../theme";
4
+ import GppGoodOutlinedIcon from '@mui/icons-material/GppGoodOutlined';
5
+ var SessionInterrupted = function () {
6
+ return (React.createElement(React.Fragment, null,
7
+ React.createElement(Stack, { height: 1, spacing: 4, justifyContent: 'space-between', py: 4, overflow: 'auto' },
8
+ React.createElement(Stack, { spacing: 2, textAlign: 'center', alignItems: 'center' },
9
+ React.createElement("img", { width: 60, height: 60, src: "https://staging.berify.me/warningIcon.png", alt: "berify" }),
10
+ React.createElement(Typography, { variant: "h2", fontWeight: 700 }, "Session Interrupted"),
11
+ React.createElement(Typography, { variant: "body1", color: theme.palette.text.secondary }, "The sign-up window on your desktop browser was closed."),
12
+ React.createElement(Typography, { variant: "body1", color: theme.palette.text.secondary }, "Please restart the process on your desktop browser to try again.")),
13
+ React.createElement(Stack, { direction: 'row', spacing: 2, textAlign: 'center', justifyContent: 'center', color: theme.palette.text.secondary },
14
+ React.createElement(GppGoodOutlinedIcon, null),
15
+ React.createElement(Typography, { variant: "body1" }, "Securely powered by Berify.me")))));
16
+ };
17
+ export default SessionInterrupted;
@@ -6,6 +6,8 @@ export var Environment;
6
6
  })(Environment || (Environment = {}));
7
7
  export var PageStatus;
8
8
  (function (PageStatus) {
9
+ PageStatus[PageStatus["SessionInterrupted"] = -3] = "SessionInterrupted";
10
+ PageStatus[PageStatus["QRCodeExpired"] = -2] = "QRCodeExpired";
9
11
  PageStatus[PageStatus["Loading"] = -1] = "Loading";
10
12
  PageStatus[PageStatus["SendSns"] = 0] = "SendSns";
11
13
  PageStatus[PageStatus["VerifyNewUser"] = 1] = "VerifyNewUser";
@@ -1,6 +1,6 @@
1
- import { Environment } from '../enum';
2
1
  import React from 'react';
3
2
  import '../../index.css';
3
+ import { Environment } from '../enum';
4
4
  declare const HomeModal: React.FC<{
5
5
  apiKeyId: string;
6
6
  secretKey: string;
@@ -275,6 +275,12 @@ declare function checkThirdPartyVerificationToken(token: string): Promise<{
275
275
  companyName?: string | null;
276
276
  error?: string;
277
277
  }>;
278
+ declare function checkDesktopRedirectUrlIdExpired({ token, desktopRedirectUrlId }: {
279
+ token: string;
280
+ desktopRedirectUrlId: string;
281
+ }): Promise<{
282
+ error?: string;
283
+ }>;
278
284
  declare function sendVerifyEmail(email: string): Promise<{
279
285
  success: boolean;
280
286
  error?: string;
@@ -561,6 +567,7 @@ declare const berifymeApi: {
561
567
  thirdParty: {
562
568
  getRedirectUrl: typeof getRedirectUrl;
563
569
  checkThirdPartyVerificationToken: typeof checkThirdPartyVerificationToken;
570
+ checkDesktopRedirectUrlIdExpired: typeof checkDesktopRedirectUrlIdExpired;
564
571
  };
565
572
  scheduld: {
566
573
  initUpdateAdminTokenSchedule: typeof initUpdateAdminTokenSchedule;
@@ -1,8 +1,9 @@
1
1
  import React from "react";
2
2
  import { User } from "../../api/api";
3
- declare const AllSet: ({ user, token, desktopRedirectUrlId }: {
3
+ declare const AllSet: ({ user, token, desktopRedirectUrlId, setPageStatus }: {
4
4
  user: User | undefined;
5
5
  token: string | undefined;
6
6
  desktopRedirectUrlId?: string;
7
+ setPageStatus: React.Dispatch<React.SetStateAction<number>>;
7
8
  }) => React.JSX.Element;
8
9
  export default AllSet;
@@ -2,5 +2,6 @@ import React from "react";
2
2
  declare const ClearLoginAllSet: React.FC<{
3
3
  token?: string;
4
4
  desktopRedirectUrlId?: string;
5
+ setPageStatus: React.Dispatch<React.SetStateAction<number>>;
5
6
  }>;
6
7
  export { ClearLoginAllSet };
@@ -2,5 +2,6 @@ import React from "react";
2
2
  declare const ClearOnboardingAllSet: React.FC<{
3
3
  token?: string;
4
4
  desktopRedirectUrlId?: string;
5
+ setPageStatus: React.Dispatch<React.SetStateAction<number>>;
5
6
  }>;
6
7
  export { ClearOnboardingAllSet };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const QrcodeExpired: () => React.JSX.Element;
3
+ export default QrcodeExpired;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const SessionInterrupted: () => React.JSX.Element;
3
+ export default SessionInterrupted;
@@ -4,6 +4,8 @@ export declare enum Environment {
4
4
  Idv = "idv"
5
5
  }
6
6
  export declare enum PageStatus {
7
+ SessionInterrupted = -3,
8
+ QRCodeExpired = -2,
7
9
  Loading = -1,
8
10
  SendSns = 0,
9
11
  VerifyNewUser = 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/berifyme-react-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/index.d.ts",