@bytexbyte/berifyme-react-sdk 1.0.16 → 1.0.19
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/BerifymeModal/index.js +20 -12
- package/dist/api/api.js +39 -4
- package/dist/components/AllSet/index.js +36 -40
- package/dist/components/Login/authid/authid.js +26 -17
- package/dist/components/Login/authid/index.js +1 -6
- package/dist/components/Login/clearAllSet.js +2 -6
- package/dist/components/Login/incode/Login.js +3 -3
- package/dist/components/OnBoarding/authId/index.js +29 -15
- package/dist/components/OnBoarding/clear/clearAllSet.js +2 -6
- package/dist/components/OnBoarding/incode/SelectType.js +7 -3
- package/dist/components/OnBoarding/incode/index.js +37 -32
- package/dist/components/OnBoarding/vender/grid/authIdGrid.js +1 -1
- package/dist/components/OnBoarding/vender/grid/clearGrid.js +1 -1
- package/dist/components/OnBoarding/vender/grid/incodeGrid.js +1 -1
- package/dist/components/OnBoarding/vender/grid/sumsubGrid.js +1 -1
- package/dist/components/OnBoarding/vender/grid/veriffGrid.js +1 -1
- package/dist/components/OnBoarding/vender/grid/yotiGrid.js +1 -1
- package/dist/components/QrcodeExpired.js +1 -1
- package/dist/components/SendSns/index.js +40 -34
- package/dist/components/SessionInterrupted.js +1 -1
- package/dist/components/SnapMatch/ExceptionView.js +22 -0
- package/dist/components/SnapMatch/LangSelector.js +26 -0
- package/dist/components/SnapMatch/SnapMatchStep.js +122 -0
- package/dist/components/SnapMatch/SuccessView.js +22 -0
- package/dist/components/SnapMatch/TryAgainView.js +19 -0
- package/dist/components/SnapMatch/index.js +271 -0
- package/dist/components/SnapMatch/translations.js +32 -0
- package/dist/components/SomethingWrong.js +41 -0
- package/dist/components/VerifyWithPhoneNumber/NewUser/index.js +4 -4
- package/dist/components/VerifyWithPhoneNumber/User/index.js +13 -10
- package/dist/index.js +6 -1
- package/dist/types/api/api.d.ts +7 -1
- package/dist/types/components/AllSet/index.d.ts +2 -1
- package/dist/types/components/Login/authid/authid.d.ts +1 -1
- package/dist/types/components/Login/authid/index.d.ts +1 -0
- package/dist/types/components/Login/clearAllSet.d.ts +1 -0
- package/dist/types/components/OnBoarding/clear/clearAllSet.d.ts +1 -0
- package/dist/types/components/OnBoarding/incode/SelectType.d.ts +2 -1
- package/dist/types/components/OnBoarding/incode/index.d.ts +2 -0
- package/dist/types/components/SnapMatch/ExceptionView.d.ts +11 -0
- package/dist/types/components/SnapMatch/LangSelector.d.ts +11 -0
- package/dist/types/components/SnapMatch/SnapMatchStep.d.ts +23 -0
- package/dist/types/components/SnapMatch/SuccessView.d.ts +11 -0
- package/dist/types/components/SnapMatch/TryAgainView.d.ts +11 -0
- package/dist/types/components/SnapMatch/index.d.ts +17 -0
- package/dist/types/components/SnapMatch/translations.d.ts +54 -0
- package/dist/types/components/SomethingWrong.d.ts +7 -0
- package/dist/types/index.d.ts +6 -1
- package/dist/types/vender/incode/incode.d.ts +6 -2
- package/dist/types/vender/incode/translations/en.d.ts +2638 -0
- package/dist/types/vender/incode/translations/zh-TW.d.ts +2634 -0
- package/dist/vender/incode/incode.js +81 -5
- package/dist/vender/incode/translations/en.js +2638 -0
- package/dist/vender/incode/translations/zh-TW.js +2634 -0
- package/package.json +5 -2
- package/dist/components/Login/sumsub/index.js +0 -212
- package/dist/components/Login/veriff/Login.js +0 -168
- package/dist/components/Login/veriff/index.js +0 -14
- package/dist/components/Login/yoti/Login.js +0 -245
- package/dist/components/Login/yoti/index.js +0 -14
- package/dist/components/OnBoarding/sumsub/index.js +0 -183
- package/dist/components/OnBoarding/veriff/index.js +0 -152
- package/dist/components/OnBoarding/yoti/OnBoarding.js +0 -238
- package/dist/components/OnBoarding/yoti/index.js +0 -14
- package/dist/components/TryAgain.js +0 -16
- package/dist/components/TryAgainInModal.js +0 -15
- package/dist/event.js +0 -18
- package/dist/types/components/Login/sumsub/index.d.ts +0 -10
- package/dist/types/components/Login/veriff/Login.d.ts +0 -12
- package/dist/types/components/Login/veriff/index.d.ts +0 -11
- package/dist/types/components/Login/yoti/Login.d.ts +0 -11
- package/dist/types/components/Login/yoti/index.d.ts +0 -10
- package/dist/types/components/OnBoarding/sumsub/index.d.ts +0 -10
- package/dist/types/components/OnBoarding/veriff/index.d.ts +0 -11
- package/dist/types/components/OnBoarding/yoti/OnBoarding.d.ts +0 -12
- package/dist/types/components/OnBoarding/yoti/index.d.ts +0 -11
- package/dist/types/components/TryAgain.d.ts +0 -6
- package/dist/types/components/TryAgainInModal.d.ts +0 -6
- package/dist/types/event.d.ts +0 -9
|
@@ -50,19 +50,19 @@ import { ClearOnboarding } from '../components/OnBoarding/clear';
|
|
|
50
50
|
import { ClearOnboardingAllSet } from '../components/OnBoarding/clear/clearAllSet';
|
|
51
51
|
import { IncodeOnBoarding } from '../components/OnBoarding/incode';
|
|
52
52
|
import Vender from '../components/OnBoarding/vender';
|
|
53
|
+
import QrcodeExpired from '../components/QrcodeExpired';
|
|
53
54
|
import RedirectToMobile from '../components/RedirectToMobile';
|
|
54
55
|
import ScreenRotation from '../components/ScreenRotation';
|
|
55
56
|
import SendSns from '../components/SendSns';
|
|
57
|
+
import SessionInterrupted from '../components/SessionInterrupted';
|
|
58
|
+
import SomethingWrong from '../components/SomethingWrong';
|
|
56
59
|
import theme from '../components/theme';
|
|
57
|
-
import TryAgainInModal from '../components/TryAgainInModal';
|
|
58
60
|
import VerifyNewUser from '../components/VerifyWithPhoneNumber/NewUser';
|
|
59
61
|
import VerifyUser from '../components/VerifyWithPhoneNumber/User';
|
|
60
62
|
import { getPageStatusString, PageStatus } from '../enum';
|
|
61
63
|
import { environmentDomains } from '../lib/environmentDomains';
|
|
62
64
|
import { incode } from '../vender/incode/incode';
|
|
63
65
|
import Modal from './MainModal';
|
|
64
|
-
import QrcodeExpired from '../components/QrcodeExpired';
|
|
65
|
-
import SessionInterrupted from '../components/SessionInterrupted';
|
|
66
66
|
var HomeModal = function (_a) {
|
|
67
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, onUpdate = _a.onUpdate;
|
|
68
68
|
var _c = useState(window.innerWidth > window.innerHeight), isLandscape = _c[0], setIsLandscape = _c[1];
|
|
@@ -138,7 +138,7 @@ var HomeModal = function (_a) {
|
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
else {
|
|
141
|
-
setError((_a = res.error) !== null && _a !== void 0 ? _a : '
|
|
141
|
+
setError((_a = res.error) !== null && _a !== void 0 ? _a : 'Something went wrong, but we’re working on it. Please try again later or contact support for assistance.');
|
|
142
142
|
createDeveloperLog({
|
|
143
143
|
userId: user === null || user === void 0 ? void 0 : user.id,
|
|
144
144
|
userDataJson: user,
|
|
@@ -233,7 +233,10 @@ var HomeModal = function (_a) {
|
|
|
233
233
|
setAuthIdSelectedIdType('');
|
|
234
234
|
}, [error]);
|
|
235
235
|
useEffect(function () {
|
|
236
|
-
if (
|
|
236
|
+
if (error) {
|
|
237
|
+
setModalHeight('58vh');
|
|
238
|
+
}
|
|
239
|
+
else if (useQrcode) {
|
|
237
240
|
setModalHeight('80vh');
|
|
238
241
|
}
|
|
239
242
|
else if (isLandscape) {
|
|
@@ -297,7 +300,7 @@ var HomeModal = function (_a) {
|
|
|
297
300
|
// 使用callback
|
|
298
301
|
if (onUpdate)
|
|
299
302
|
onUpdate({ detail: detail });
|
|
300
|
-
}, [pageStatus, useQrcode, isLandscape]);
|
|
303
|
+
}, [pageStatus, useQrcode, isLandscape, error]);
|
|
301
304
|
useEffect(function () {
|
|
302
305
|
var checkOrientation = function () {
|
|
303
306
|
setIsLandscape(window.innerWidth > window.innerHeight);
|
|
@@ -309,11 +312,16 @@ var HomeModal = function (_a) {
|
|
|
309
312
|
window.removeEventListener('resize', checkOrientation);
|
|
310
313
|
};
|
|
311
314
|
}, []);
|
|
315
|
+
var venderErrorHandleBack = function () {
|
|
316
|
+
setAuthIdSelectedIdType('');
|
|
317
|
+
setPageStatus(PageStatus.IdOrPassport);
|
|
318
|
+
setError(undefined);
|
|
319
|
+
};
|
|
312
320
|
return (React.createElement(React.Fragment, null,
|
|
313
321
|
React.createElement("div", { className: 'default' },
|
|
314
322
|
React.createElement(CssBaseline, null),
|
|
315
323
|
React.createElement(ThemeProvider, { theme: theme },
|
|
316
|
-
React.createElement(Modal, { height: modalHeight, border: !useQrcode }, error ? React.createElement(
|
|
324
|
+
React.createElement(Modal, { height: modalHeight, border: !useQrcode }, error !== undefined ? React.createElement(SomethingWrong, { message: error, venderErrorHandleBack: venderErrorHandleBack }) :
|
|
317
325
|
React.createElement(React.Fragment, null, useQrcode ? React.createElement(RedirectToMobile, { token: token, environment: environment }) :
|
|
318
326
|
React.createElement(React.Fragment, null, isLandscape ? React.createElement(ScreenRotation, null) :
|
|
319
327
|
React.createElement(React.Fragment, null,
|
|
@@ -345,18 +353,18 @@ var HomeModal = function (_a) {
|
|
|
345
353
|
pageStatus === PageStatus.ClearOnboarding && user &&
|
|
346
354
|
React.createElement(ClearOnboarding, { token: token, user: user, desktopRedirectUrlId: desktopRedirectUrlId }),
|
|
347
355
|
pageStatus === PageStatus.IncodeOnBoarding && user &&
|
|
348
|
-
React.createElement(IncodeOnBoarding, { user: user, setUser: setUser, token: token, goToAllSet: function () { return setPageStatus(PageStatus.AllSet); } }),
|
|
356
|
+
React.createElement(IncodeOnBoarding, { user: user, setUser: setUser, token: token, goToAllSet: function () { return setPageStatus(PageStatus.AllSet); }, setError: setError, onGoBack: function () { return setPageStatus(PageStatus.Vender); } }),
|
|
349
357
|
pageStatus === PageStatus.AuthidLogin && processedPhoneNumber &&
|
|
350
|
-
React.createElement(AuthidLogin, { token: token, goToAllSet: function () { return setPageStatus(PageStatus.AllSet); }, phoneNumber: processedPhoneNumber, setUser: setUser }),
|
|
358
|
+
React.createElement(AuthidLogin, { token: token, goToAllSet: function () { return setPageStatus(PageStatus.AllSet); }, phoneNumber: processedPhoneNumber, setUser: setUser, setError: setError }),
|
|
351
359
|
pageStatus === PageStatus.ClearLogin &&
|
|
352
360
|
React.createElement(ClearLogin, { token: token, userId: user === null || user === void 0 ? void 0 : user.id, desktopRedirectUrlId: desktopRedirectUrlId }),
|
|
353
361
|
pageStatus === PageStatus.IncodeLogin &&
|
|
354
362
|
React.createElement(IncodeLogin, { token: token, setError: setError, user: user, setUser: setUser, goToAllSet: function () { return setPageStatus(PageStatus.AllSet); } }),
|
|
355
363
|
pageStatus === PageStatus.ClearLoginAllSet &&
|
|
356
|
-
React.createElement(ClearLoginAllSet, { token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus }),
|
|
364
|
+
React.createElement(ClearLoginAllSet, { token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus, setError: setError }),
|
|
357
365
|
pageStatus === PageStatus.ClearOnboardingAllSet &&
|
|
358
|
-
React.createElement(ClearOnboardingAllSet, { token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus }),
|
|
366
|
+
React.createElement(ClearOnboardingAllSet, { token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus, setError: setError }),
|
|
359
367
|
pageStatus === PageStatus.AllSet &&
|
|
360
|
-
React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus })))))))));
|
|
368
|
+
React.createElement(AllSet, { user: user, token: token, setError: setError, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus })))))))));
|
|
361
369
|
};
|
|
362
370
|
export default HomeModal;
|
package/dist/api/api.js
CHANGED
|
@@ -794,6 +794,40 @@ function createSessionToken(_a) {
|
|
|
794
794
|
});
|
|
795
795
|
});
|
|
796
796
|
}
|
|
797
|
+
/** SnapMatch(1:N)用:建立 session token(無 redirectUrl),回傳 sessionToken(session_ 前綴) */
|
|
798
|
+
function createSessionTokenWithoutRedirectUrl(_a) {
|
|
799
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
800
|
+
var url, res, error_2;
|
|
801
|
+
var _c;
|
|
802
|
+
var apiKeyId = _b.apiKeyId, secretKey = _b.secretKey;
|
|
803
|
+
return __generator(this, function (_d) {
|
|
804
|
+
switch (_d.label) {
|
|
805
|
+
case 0:
|
|
806
|
+
url = "".concat(config.backendDomain, "/api/thirdParty/createTokenWithoutRedirectUrl");
|
|
807
|
+
_d.label = 1;
|
|
808
|
+
case 1:
|
|
809
|
+
_d.trys.push([1, 3, , 4]);
|
|
810
|
+
return [4 /*yield*/, axios.post(url, {
|
|
811
|
+
apiKeyId: apiKeyId,
|
|
812
|
+
secretKey: secretKey,
|
|
813
|
+
})];
|
|
814
|
+
case 2:
|
|
815
|
+
res = _d.sent();
|
|
816
|
+
return [2 /*return*/, res.data];
|
|
817
|
+
case 3:
|
|
818
|
+
error_2 = _d.sent();
|
|
819
|
+
if (error_2.response) {
|
|
820
|
+
return [2 /*return*/, { error: ((_c = error_2.response.data) === null || _c === void 0 ? void 0 : _c.error) || 'An error occurred. Please try again.' }];
|
|
821
|
+
}
|
|
822
|
+
else if (error_2.request) {
|
|
823
|
+
return [2 /*return*/, { error: 'No response from server. Please check your network and try again.' }];
|
|
824
|
+
}
|
|
825
|
+
return [2 /*return*/, { error: 'Unexpected error. Please try again later.' }];
|
|
826
|
+
case 4: return [2 /*return*/];
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
});
|
|
830
|
+
}
|
|
797
831
|
function createAuthenticationLogs(_a) {
|
|
798
832
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
799
833
|
var url, res;
|
|
@@ -848,7 +882,7 @@ function updateAuthenticationLogs(_a) {
|
|
|
848
882
|
}
|
|
849
883
|
function createDeveloperLog(_a) {
|
|
850
884
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
851
|
-
var url, res,
|
|
885
|
+
var url, res, error_3;
|
|
852
886
|
var userId = _b.userId, sessionToken = _b.sessionToken, action = _b.action, firstDetail = _b.firstDetail, secondDetail = _b.secondDetail, userDataJson = _b.userDataJson, source = _b.source, browser = _b.browser;
|
|
853
887
|
return __generator(this, function (_c) {
|
|
854
888
|
switch (_c.label) {
|
|
@@ -876,9 +910,9 @@ function createDeveloperLog(_a) {
|
|
|
876
910
|
res = _c.sent();
|
|
877
911
|
return [2 /*return*/, res.data];
|
|
878
912
|
case 3:
|
|
879
|
-
|
|
880
|
-
console.error('Error creating developer log:',
|
|
881
|
-
throw
|
|
913
|
+
error_3 = _c.sent();
|
|
914
|
+
console.error('Error creating developer log:', error_3);
|
|
915
|
+
throw error_3;
|
|
882
916
|
case 4: return [2 /*return*/];
|
|
883
917
|
}
|
|
884
918
|
});
|
|
@@ -1181,6 +1215,7 @@ var berifymeApi = {
|
|
|
1181
1215
|
getRedirectUrl: getRedirectUrl,
|
|
1182
1216
|
checkThirdPartyVerificationToken: checkThirdPartyVerificationToken,
|
|
1183
1217
|
checkDesktopRedirectUrlIdExpired: checkDesktopRedirectUrlIdExpired,
|
|
1218
|
+
createSessionTokenWithoutRedirectUrl: createSessionTokenWithoutRedirectUrl,
|
|
1184
1219
|
},
|
|
1185
1220
|
scheduld: {
|
|
1186
1221
|
initUpdateAdminTokenSchedule: initUpdateAdminTokenSchedule,
|
|
@@ -41,7 +41,6 @@ import GppGoodOutlinedIcon from '@mui/icons-material/GppGoodOutlined';
|
|
|
41
41
|
import { useSpeedTest } from "../speedTest/SpeedProvider";
|
|
42
42
|
import berifymeApi from "../../api/api";
|
|
43
43
|
import { useEffect, useState } from "react";
|
|
44
|
-
import TryAgain from "../TryAgain";
|
|
45
44
|
import { v4 as uuidv4 } from 'uuid';
|
|
46
45
|
import { createDeveloperLog } from "../createDeveloperLog";
|
|
47
46
|
import { PageStatus } from "../../enum";
|
|
@@ -63,11 +62,10 @@ var createDeviceId = function (_a) { return __awaiter(void 0, [_a], void 0, func
|
|
|
63
62
|
});
|
|
64
63
|
}); };
|
|
65
64
|
var AllSet = function (_a) {
|
|
66
|
-
var user = _a.user, token = _a.token, desktopRedirectUrlId = _a.desktopRedirectUrlId, setPageStatus = _a.setPageStatus;
|
|
67
|
-
var _b = useState(
|
|
68
|
-
var _c = useState(),
|
|
69
|
-
var _d = useState(
|
|
70
|
-
var _e = useState(''), redirectUrl = _e[0], setRedirectUrl = _e[1];
|
|
65
|
+
var user = _a.user, token = _a.token, desktopRedirectUrlId = _a.desktopRedirectUrlId, setPageStatus = _a.setPageStatus, setError = _a.setError;
|
|
66
|
+
var _b = useState(), desktopStatusMessage = _b[0], setDesktopStatusMessage = _b[1];
|
|
67
|
+
var _c = useState(true), loading = _c[0], setLoading = _c[1];
|
|
68
|
+
var _d = useState(''), redirectUrl = _d[0], setRedirectUrl = _d[1];
|
|
71
69
|
var checkOldDeviceId = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
72
70
|
var deviceId, deviceUser;
|
|
73
71
|
return __generator(this, function (_a) {
|
|
@@ -103,9 +101,9 @@ var AllSet = function (_a) {
|
|
|
103
101
|
checkOldDeviceId();
|
|
104
102
|
}, [user === null || user === void 0 ? void 0 : user.phoneNumber]);
|
|
105
103
|
var checkAndIssueToken = function () {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
if (user) {
|
|
105
|
+
berifymeApi.blockchain.checkAndIssueToken({ userId: user.id });
|
|
106
|
+
}
|
|
109
107
|
};
|
|
110
108
|
var startSpeedTest = useSpeedTest().startSpeedTest;
|
|
111
109
|
useEffect(function () {
|
|
@@ -118,10 +116,10 @@ var AllSet = function (_a) {
|
|
|
118
116
|
return __generator(this, function (_b) {
|
|
119
117
|
switch (_b.label) {
|
|
120
118
|
case 0:
|
|
121
|
-
if (!user)
|
|
122
|
-
|
|
123
|
-
if (!token)
|
|
119
|
+
if (!user || !token) {
|
|
120
|
+
setError('');
|
|
124
121
|
return [2 /*return*/];
|
|
122
|
+
}
|
|
125
123
|
return [4 /*yield*/, berifymeApi.thirdParty.getRedirectUrl({ userId: user.id, token: token })];
|
|
126
124
|
case 1:
|
|
127
125
|
res = _b.sent();
|
|
@@ -133,7 +131,7 @@ var AllSet = function (_a) {
|
|
|
133
131
|
});
|
|
134
132
|
setLoading(false);
|
|
135
133
|
if (!res.redirectUrl) {
|
|
136
|
-
setError((_a = res.error) !== null && _a !== void 0 ? _a : '
|
|
134
|
+
setError((_a = res.error) !== null && _a !== void 0 ? _a : 'Something went wrong, but we’re working on it. Please try again later or contact support for assistance.');
|
|
137
135
|
return [2 /*return*/];
|
|
138
136
|
}
|
|
139
137
|
if (desktopRedirectUrlId === undefined) {
|
|
@@ -152,32 +150,30 @@ var AllSet = function (_a) {
|
|
|
152
150
|
useEffect(function () {
|
|
153
151
|
getRedirectUrl();
|
|
154
152
|
}, []);
|
|
155
|
-
return (React.createElement(React.Fragment, null,
|
|
156
|
-
React.createElement(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
React.createElement(
|
|
168
|
-
|
|
169
|
-
React.createElement(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
React.createElement(
|
|
180
|
-
React.createElement(GppGoodOutlinedIcon, null),
|
|
181
|
-
React.createElement(Typography, { variant: "body1" }, "Securely powered by Berify.me"))))));
|
|
153
|
+
return (React.createElement(React.Fragment, null, loading ?
|
|
154
|
+
React.createElement(Box, { sx: {
|
|
155
|
+
display: 'flex',
|
|
156
|
+
justifyContent: 'center',
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
height: 1,
|
|
159
|
+
background: '#FFFFFF'
|
|
160
|
+
} },
|
|
161
|
+
React.createElement(CircularProgress, null)) :
|
|
162
|
+
React.createElement(Stack, { height: 1, spacing: 4, justifyContent: 'space-between', py: 4, overflow: 'auto' },
|
|
163
|
+
React.createElement(Stack, { spacing: 2, textAlign: 'center', alignItems: 'center' },
|
|
164
|
+
React.createElement("img", { width: 40, height: 40, src: "https://idv.berify.me/berify.svg", alt: "berify" }),
|
|
165
|
+
React.createElement(Typography, { variant: "h2", fontWeight: 700 },
|
|
166
|
+
"You\u2019re Berified,",
|
|
167
|
+
React.createElement("br", null), user === null || user === void 0 ? void 0 :
|
|
168
|
+
user.fullName),
|
|
169
|
+
React.createElement(Typography, { variant: "body1", color: theme.palette.text.secondary }, "Thank you for securely verifying your identity through Berify.me \uD83C\uDF89")),
|
|
170
|
+
desktopStatusMessage ?
|
|
171
|
+
React.createElement(Stack, { py: 4, textAlign: 'center', alignItems: 'center' },
|
|
172
|
+
React.createElement(Typography, { variant: "body1", color: theme.palette.text.secondary }, desktopStatusMessage)) :
|
|
173
|
+
React.createElement(Stack, { spacing: 2, alignItems: 'center' },
|
|
174
|
+
React.createElement(Button, { variant: "contained", onClick: function () { window.location.href = redirectUrl; }, sx: { minWidth: 160 } }, "Continue")),
|
|
175
|
+
React.createElement(Stack, { direction: 'row', spacing: 2, textAlign: 'center', justifyContent: 'center', color: theme.palette.text.secondary },
|
|
176
|
+
React.createElement(GppGoodOutlinedIcon, null),
|
|
177
|
+
React.createElement(Typography, { variant: "body1" }, "Securely powered by Berify.me")))));
|
|
182
178
|
};
|
|
183
179
|
export default AllSet;
|
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
import React from "react";
|
|
48
|
+
import React, { useRef } from "react";
|
|
49
49
|
import AuthIDComponent from "@authid/react-component";
|
|
50
50
|
import { Box, CircularProgress } from "@mui/material";
|
|
51
51
|
import { useEffect, useState } from "react";
|
|
@@ -57,17 +57,15 @@ var AuthID = function (_a) {
|
|
|
57
57
|
var phone = _a.phone, setError = _a.setError, goRedirect = _a.goRedirect, goToTryAgain = _a.goToTryAgain, setUser = _a.setUser, token = _a.token;
|
|
58
58
|
var _b = useState(''), url = _b[0], setUrl = _b[1];
|
|
59
59
|
var _c = useState(''), transactionId = _c[0], setTransactionId = _c[1];
|
|
60
|
-
var
|
|
61
|
-
var
|
|
60
|
+
var authIdInit = useRef(false);
|
|
61
|
+
var _d = useSpeedTest(), stopSpeedTest = _d.stopSpeedTest, startSpeedTest = _d.startSpeedTest;
|
|
62
62
|
useEffect(function () { stopSpeedTest(); }, []);
|
|
63
63
|
//第零部 準備URL
|
|
64
64
|
var createLoginTransaction = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
65
|
var tokenResult, result;
|
|
66
66
|
return __generator(this, function (_a) {
|
|
67
67
|
switch (_a.label) {
|
|
68
|
-
case 0:
|
|
69
|
-
setIsLoading(true);
|
|
70
|
-
return [4 /*yield*/, berifymeApi.authID.getAuthIDToken()];
|
|
68
|
+
case 0: return [4 /*yield*/, berifymeApi.authID.getAuthIDToken()];
|
|
71
69
|
case 1:
|
|
72
70
|
tokenResult = _a.sent();
|
|
73
71
|
localStorage.setItem('authID_token', tokenResult.token);
|
|
@@ -76,13 +74,10 @@ var AuthID = function (_a) {
|
|
|
76
74
|
result = _a.sent();
|
|
77
75
|
if (result.error) {
|
|
78
76
|
setError(result.error);
|
|
79
|
-
setIsLoading(false);
|
|
80
77
|
return [2 /*return*/];
|
|
81
78
|
}
|
|
82
79
|
setTransactionId(result.TransactionId);
|
|
83
80
|
setUrl(result.url);
|
|
84
|
-
// setUrl(`https://id.authid.ai/?t=${result.TransactionId}&s=${result.OneTimeSecret}`);
|
|
85
|
-
setIsLoading(false);
|
|
86
81
|
return [2 /*return*/];
|
|
87
82
|
}
|
|
88
83
|
});
|
|
@@ -128,7 +123,7 @@ var AuthID = function (_a) {
|
|
|
128
123
|
actionType: ActionType.LOGIN,
|
|
129
124
|
userId: result.userId,
|
|
130
125
|
vender: 'Berify.me',
|
|
131
|
-
token: token,
|
|
126
|
+
token: token !== null && token !== void 0 ? token : 'missing token',
|
|
132
127
|
transactionId: transactionId,
|
|
133
128
|
isPass: true,
|
|
134
129
|
});
|
|
@@ -162,7 +157,17 @@ var AuthID = function (_a) {
|
|
|
162
157
|
useEffect(function () { createLoginTransaction(); }, []);
|
|
163
158
|
useEffect(function () {
|
|
164
159
|
if (url) {
|
|
160
|
+
// 設定一個計時器,假設 10 秒內未收到 init 事件就算失敗
|
|
161
|
+
setTimeout(function () {
|
|
162
|
+
if (!authIdInit.current) {
|
|
163
|
+
setError('Try again later or choose a different verification provider to proceed.');
|
|
164
|
+
}
|
|
165
|
+
}, 6000); // 6 秒超時,可以根據需求調整
|
|
165
166
|
window.addEventListener('message', function (e) {
|
|
167
|
+
console.log('Listener message: ', e.data);
|
|
168
|
+
if (e.data.type === 'authid:init') {
|
|
169
|
+
authIdInit.current = true; // 初始化成功
|
|
170
|
+
}
|
|
166
171
|
if (e.data.type === 'authid:page') {
|
|
167
172
|
if (e.data.pageName === 'verifiedPage') {
|
|
168
173
|
if (transactionId && phone)
|
|
@@ -181,16 +186,20 @@ var AuthID = function (_a) {
|
|
|
181
186
|
console.log('remove message', e.data);
|
|
182
187
|
});
|
|
183
188
|
};
|
|
184
|
-
}, [url]);
|
|
185
|
-
return (React.createElement(React.Fragment, null,
|
|
186
|
-
|
|
187
|
-
: React.createElement(Box, { sx: {
|
|
189
|
+
}, [url, authIdInit.current]);
|
|
190
|
+
return (React.createElement(React.Fragment, null,
|
|
191
|
+
React.createElement(Box, { sx: {
|
|
188
192
|
display: 'flex',
|
|
189
193
|
justifyContent: 'center',
|
|
190
194
|
alignItems: 'center',
|
|
191
|
-
|
|
192
|
-
|
|
195
|
+
position: 'absolute',
|
|
196
|
+
top: 0,
|
|
197
|
+
left: 0,
|
|
198
|
+
width: '100%',
|
|
199
|
+
height: '100%',
|
|
200
|
+
background: 'rgba(255, 255, 255, 0.8)' // 半透明背景
|
|
193
201
|
} },
|
|
194
|
-
React.createElement(CircularProgress, null))
|
|
202
|
+
React.createElement(CircularProgress, null)),
|
|
203
|
+
url && React.createElement(AuthIDComponent, { url: url, webauth: true })));
|
|
195
204
|
};
|
|
196
205
|
export default AuthID;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import TryAgain from "../../TryAgain";
|
|
4
2
|
import AuthID from "./authid";
|
|
5
3
|
var AuthidLogin = function (_a) {
|
|
6
|
-
var goToAllSet = _a.goToAllSet, phoneNumber = _a.phoneNumber, setUser = _a.setUser, token = _a.token;
|
|
7
|
-
var _b = useState(), error = _b[0], setError = _b[1];
|
|
8
|
-
if (error || !token)
|
|
9
|
-
return (React.createElement(TryAgain, { message: error }));
|
|
4
|
+
var goToAllSet = _a.goToAllSet, phoneNumber = _a.phoneNumber, setUser = _a.setUser, token = _a.token, setError = _a.setError;
|
|
10
5
|
return (React.createElement(React.Fragment, null,
|
|
11
6
|
React.createElement(AuthID, { token: token, phone: phoneNumber, setError: setError, goRedirect: function () { goToAllSet(); }, goToTryAgain: function () { return setError('Authentication Failed, Please Try Again.'); }, setUser: setUser })));
|
|
12
7
|
};
|
|
@@ -39,13 +39,11 @@ import { useEffect, useState } from "react";
|
|
|
39
39
|
import berifymeApi, { VerificationStatus } from "../../api/api";
|
|
40
40
|
import { Box, CircularProgress } from "@mui/material";
|
|
41
41
|
import AllSet from "../../components/AllSet";
|
|
42
|
-
import TryAgain from "../TryAgain";
|
|
43
42
|
import { updateAuthenticationLog } from "../AuthenticationLogs";
|
|
44
43
|
import { createDeveloperLog } from "../createDeveloperLog";
|
|
45
44
|
var ClearLoginAllSet = function (_a) {
|
|
46
|
-
var token = _a.token, desktopRedirectUrlId = _a.desktopRedirectUrlId, setPageStatus = _a.setPageStatus;
|
|
45
|
+
var token = _a.token, desktopRedirectUrlId = _a.desktopRedirectUrlId, setPageStatus = _a.setPageStatus, setError = _a.setError;
|
|
47
46
|
var _b = useState(), user = _b[0], setUser = _b[1]; // berifyme user
|
|
48
|
-
var _c = useState(), error = _c[0], setError = _c[1];
|
|
49
47
|
var getUserBySessionId = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
50
48
|
var res;
|
|
51
49
|
var sessionId = _b.sessionId, token = _b.token;
|
|
@@ -85,9 +83,7 @@ var ClearLoginAllSet = function (_a) {
|
|
|
85
83
|
return;
|
|
86
84
|
getUserBySessionId({ sessionId: sessionId, token: token });
|
|
87
85
|
}, [token]);
|
|
88
|
-
|
|
89
|
-
return (React.createElement(TryAgain, { message: error }));
|
|
90
|
-
return (React.createElement(React.Fragment, null, user ? React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus }) :
|
|
86
|
+
return (React.createElement(React.Fragment, null, user ? React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus, setError: setError }) :
|
|
91
87
|
React.createElement(Box, { sx: {
|
|
92
88
|
display: 'flex',
|
|
93
89
|
justifyContent: 'center',
|
|
@@ -80,7 +80,7 @@ function LoginComponent(_a) {
|
|
|
80
80
|
setError(res.error);
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
|
-
setError('
|
|
83
|
+
setError('Something went wrong, but we’re working on it. Please try again later or contact support for assistance.');
|
|
84
84
|
}
|
|
85
85
|
return [2 /*return*/];
|
|
86
86
|
}
|
|
@@ -106,7 +106,7 @@ function LoginComponent(_a) {
|
|
|
106
106
|
onError: function (r) {
|
|
107
107
|
startSpeedTest();
|
|
108
108
|
console.log('onError: ', r);
|
|
109
|
-
setError('
|
|
109
|
+
setError('Something went wrong, but we’re working on it. Please try again later or contact support for assistance.');
|
|
110
110
|
},
|
|
111
111
|
stopAtError: true,
|
|
112
112
|
isOneToOne: true,
|
|
@@ -116,7 +116,7 @@ function LoginComponent(_a) {
|
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
else {
|
|
119
|
-
setError('
|
|
119
|
+
setError('Something went wrong, but we’re working on it. Please try again later or contact support for assistance.');
|
|
120
120
|
}
|
|
121
121
|
}, [onSuccess, setError]);
|
|
122
122
|
return React.createElement("div", { ref: containerRef },
|
|
@@ -62,6 +62,7 @@ var AuthID = function (_a) {
|
|
|
62
62
|
var _c = useState(''), url = _c[0], setUrl = _c[1];
|
|
63
63
|
var _d = useState(false), showIdOrPassport = _d[0], setShowIdOrPassport = _d[1];
|
|
64
64
|
var docErrorCount = useRef(0);
|
|
65
|
+
var authIdInit = useRef(false);
|
|
65
66
|
var stopSpeedTest = useSpeedTest().stopSpeedTest;
|
|
66
67
|
useEffect(function () { stopSpeedTest(); }, []);
|
|
67
68
|
//第零部 準備URL
|
|
@@ -277,9 +278,23 @@ var AuthID = function (_a) {
|
|
|
277
278
|
if (selectedIdType !== '')
|
|
278
279
|
proofUser();
|
|
279
280
|
}, [selectedIdType]);
|
|
281
|
+
var handleClose = function () {
|
|
282
|
+
docErrorCount.current = 0;
|
|
283
|
+
setShowIdOrPassport(false);
|
|
284
|
+
};
|
|
280
285
|
useEffect(function () {
|
|
281
286
|
if (url) {
|
|
287
|
+
// 設定一個計時器,假設 10 秒內未收到 init 事件就算失敗
|
|
288
|
+
setTimeout(function () {
|
|
289
|
+
if (!authIdInit.current) {
|
|
290
|
+
setError('Try again later or choose a different verification provider to proceed.');
|
|
291
|
+
}
|
|
292
|
+
}, 6000); // 6 秒超時,可以根據需求調整
|
|
282
293
|
window.addEventListener('message', function (e) {
|
|
294
|
+
console.log('Listener message: ', e.data);
|
|
295
|
+
if (e.data.type === 'authid:init') {
|
|
296
|
+
authIdInit.current = true; // 初始化成功
|
|
297
|
+
}
|
|
283
298
|
if (e.data.type === 'authid:page') {
|
|
284
299
|
console.log(e.data);
|
|
285
300
|
if (e.data.pageName === 'verifiedPage') {
|
|
@@ -307,25 +322,24 @@ var AuthID = function (_a) {
|
|
|
307
322
|
console.log('remove message', e.data);
|
|
308
323
|
});
|
|
309
324
|
};
|
|
310
|
-
}, [url]);
|
|
325
|
+
}, [url, authIdInit.current]);
|
|
311
326
|
useEffect(function () {
|
|
312
327
|
console.log('error count: ', docErrorCount.current);
|
|
313
328
|
}, [docErrorCount.current]);
|
|
314
|
-
var handleClose = function () {
|
|
315
|
-
docErrorCount.current = 0;
|
|
316
|
-
setShowIdOrPassport(false);
|
|
317
|
-
};
|
|
318
329
|
return (React.createElement(React.Fragment, null,
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
330
|
+
React.createElement(Box, { sx: {
|
|
331
|
+
display: 'flex',
|
|
332
|
+
justifyContent: 'center',
|
|
333
|
+
alignItems: 'center',
|
|
334
|
+
position: 'absolute',
|
|
335
|
+
top: 0,
|
|
336
|
+
left: 0,
|
|
337
|
+
width: '100%',
|
|
338
|
+
height: '100%',
|
|
339
|
+
background: 'rgba(255, 255, 255, 0.8)' // 半透明背景
|
|
340
|
+
} },
|
|
341
|
+
React.createElement(CircularProgress, null)),
|
|
342
|
+
url && React.createElement(AuthIDComponent, { url: url, webauth: true }),
|
|
329
343
|
showIdOrPassport &&
|
|
330
344
|
React.createElement(Box, { sx: {
|
|
331
345
|
position: 'fixed',
|
|
@@ -39,13 +39,11 @@ import { useEffect, useState } from "react";
|
|
|
39
39
|
import berifymeApi, { VerificationStatus } from "../../../api/api";
|
|
40
40
|
import { Box, CircularProgress } from "@mui/material";
|
|
41
41
|
import AllSet from "../../AllSet";
|
|
42
|
-
import TryAgain from "../../TryAgain";
|
|
43
42
|
import { updateAuthenticationLog } from "../../AuthenticationLogs";
|
|
44
43
|
import { createDeveloperLog } from "../../createDeveloperLog";
|
|
45
44
|
var ClearOnboardingAllSet = function (_a) {
|
|
46
|
-
var token = _a.token, desktopRedirectUrlId = _a.desktopRedirectUrlId, setPageStatus = _a.setPageStatus;
|
|
45
|
+
var token = _a.token, desktopRedirectUrlId = _a.desktopRedirectUrlId, setPageStatus = _a.setPageStatus, setError = _a.setError;
|
|
47
46
|
var _b = useState(), user = _b[0], setUser = _b[1]; // berifyme user
|
|
48
|
-
var _c = useState(), error = _c[0], setError = _c[1];
|
|
49
47
|
var approve = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
50
48
|
var approveRes, res;
|
|
51
49
|
var id = _b.id, sessionId = _b.sessionId, token = _b.token;
|
|
@@ -106,9 +104,7 @@ var ClearOnboardingAllSet = function (_a) {
|
|
|
106
104
|
return;
|
|
107
105
|
approve({ id: res.clearOnboardingCallbackUserId, sessionId: sessionId, token: token });
|
|
108
106
|
}, [token]);
|
|
109
|
-
|
|
110
|
-
return (React.createElement(TryAgain, { message: error }));
|
|
111
|
-
return (React.createElement(React.Fragment, null, user ? React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus }) :
|
|
107
|
+
return (React.createElement(React.Fragment, null, user ? React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId, setPageStatus: setPageStatus, setError: setError }) :
|
|
112
108
|
React.createElement(Box, { sx: {
|
|
113
109
|
display: 'flex',
|
|
114
110
|
justifyContent: 'center',
|
|
@@ -34,15 +34,19 @@ 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
|
|
38
|
-
import
|
|
37
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
38
|
+
import { Button, IconButton, Stack, Typography } from "@mui/material";
|
|
39
39
|
import React from "react";
|
|
40
|
+
import Layout from "../../Layout";
|
|
40
41
|
var SelectType = function (_a) {
|
|
41
|
-
var goToID = _a.goToID, goToPassport = _a.goToPassport;
|
|
42
|
+
var goToID = _a.goToID, goToPassport = _a.goToPassport, onCloseButtonClick = _a.onCloseButtonClick;
|
|
42
43
|
return (React.createElement(React.Fragment, null,
|
|
43
44
|
React.createElement(Layout, null,
|
|
44
45
|
React.createElement(Stack, { minHeight: 1, width: 1, spacing: 4, maxHeight: 900, py: 20, justifyContent: 'space-between' },
|
|
45
46
|
React.createElement(Stack, { spacing: 2 },
|
|
47
|
+
React.createElement(Stack, { direction: 'row', justifyContent: 'flex-end' },
|
|
48
|
+
React.createElement(IconButton, { onClick: onCloseButtonClick },
|
|
49
|
+
React.createElement(CloseIcon, null))),
|
|
46
50
|
React.createElement(Stack, { spacing: 1, textAlign: 'center' },
|
|
47
51
|
React.createElement(Typography, { variant: "h3", fontWeight: 700 }, "Select what document you want to scan"))),
|
|
48
52
|
React.createElement(Stack, { spacing: 2, alignItems: 'center' },
|