@bytexbyte/berifyme-react-sdk 1.0.0
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/README.md +20 -0
- package/dist/BerifymeModal/MainModal.js +29 -0
- package/dist/BerifymeModal/index.js +331 -0
- package/dist/api/api.js +1337 -0
- package/dist/api/client.js +21 -0
- package/dist/api/index.js +96 -0
- package/dist/common.js +216 -0
- package/dist/components/AllSet/index.js +169 -0
- package/dist/components/AuthenticationLogs.js +148 -0
- package/dist/components/Clear.js +107 -0
- package/dist/components/Footer/index.js +11 -0
- package/dist/components/Layout.js +9 -0
- package/dist/components/Login/authid/authid.js +196 -0
- package/dist/components/Login/authid/index.js +13 -0
- package/dist/components/Login/clear.js +35 -0
- package/dist/components/Login/clearAllSet.js +96 -0
- package/dist/components/Login/incode/Login.js +129 -0
- package/dist/components/Login/incode/index.js +16 -0
- package/dist/components/OnBoarding/authId/authIdSelectType.js +82 -0
- package/dist/components/OnBoarding/authId/idOrPassport.js +30 -0
- package/dist/components/OnBoarding/authId/index.js +323 -0
- package/dist/components/OnBoarding/clear/clearAllSet.js +118 -0
- package/dist/components/OnBoarding/clear/index.js +36 -0
- package/dist/components/OnBoarding/incode/BackId.js +25 -0
- package/dist/components/OnBoarding/incode/FinishOnboarding.js +26 -0
- package/dist/components/OnBoarding/incode/FrontId.js +27 -0
- package/dist/components/OnBoarding/incode/Passport.js +27 -0
- package/dist/components/OnBoarding/incode/ProcessFace.js +22 -0
- package/dist/components/OnBoarding/incode/ProcessId.js +22 -0
- package/dist/components/OnBoarding/incode/SelectType.js +68 -0
- package/dist/components/OnBoarding/incode/Selfie.js +25 -0
- package/dist/components/OnBoarding/incode/Steps.js +7 -0
- package/dist/components/OnBoarding/incode/UserConsent.js +30 -0
- package/dist/components/OnBoarding/incode/index.js +234 -0
- package/dist/components/OnBoarding/vender/grid/authIdGrid.js +94 -0
- package/dist/components/OnBoarding/vender/grid/clearGrid.js +14 -0
- package/dist/components/OnBoarding/vender/grid/incodeGrid.js +14 -0
- package/dist/components/OnBoarding/vender/grid/index.js +118 -0
- package/dist/components/OnBoarding/vender/grid/sumsubGrid.js +14 -0
- package/dist/components/OnBoarding/vender/grid/veriffGrid.js +14 -0
- package/dist/components/OnBoarding/vender/grid/yotiGrid.js +14 -0
- package/dist/components/OnBoarding/vender/index.js +123 -0
- package/dist/components/RedirectToMobile/index.js +139 -0
- package/dist/components/ScreenRotation.js +11 -0
- package/dist/components/SendSns/index.js +341 -0
- package/dist/components/SendSns/style.css +1 -0
- package/dist/components/TryAgain.js +16 -0
- package/dist/components/TryAgainInModal.js +15 -0
- package/dist/components/VerifyWithPhoneNumber/NewUser/index.js +189 -0
- package/dist/components/VerifyWithPhoneNumber/User/index.js +322 -0
- package/dist/components/createDeveloperLog.js +60 -0
- package/dist/components/phoneNumberProcesser.js +32 -0
- package/dist/components/speedTest/SpeedProvider.js +57 -0
- package/dist/components/theme.js +120 -0
- package/dist/enum/index.js +24 -0
- package/dist/index.js +7 -0
- package/dist/lib/environmentDomains.js +12 -0
- package/dist/lib/webauthb.js +158 -0
- package/dist/state.js +23 -0
- package/dist/theme.js +120 -0
- package/dist/types/BerifymeModal/MainModal.d.ts +7 -0
- package/dist/types/BerifymeModal/index.d.ts +12 -0
- package/dist/types/api/api.d.ts +606 -0
- package/dist/types/api/client.d.ts +2 -0
- package/dist/types/api/index.d.ts +16 -0
- package/dist/types/common.d.ts +3 -0
- package/dist/types/components/AllSet/index.d.ts +8 -0
- package/dist/types/components/AuthenticationLogs.d.ts +19 -0
- package/dist/types/components/Clear.d.ts +9 -0
- package/dist/types/components/Footer/index.d.ts +3 -0
- package/dist/types/components/Layout.d.ts +5 -0
- package/dist/types/components/Login/authid/authid.d.ts +11 -0
- package/dist/types/components/Login/authid/index.d.ts +9 -0
- package/dist/types/components/Login/clear.d.ts +7 -0
- package/dist/types/components/Login/clearAllSet.d.ts +6 -0
- package/dist/types/components/Login/incode/Login.d.ts +13 -0
- package/dist/types/components/Login/incode/index.d.ts +9 -0
- package/dist/types/components/OnBoarding/authId/authIdSelectType.d.ts +6 -0
- package/dist/types/components/OnBoarding/authId/idOrPassport.d.ts +7 -0
- package/dist/types/components/OnBoarding/authId/index.d.ts +11 -0
- package/dist/types/components/OnBoarding/clear/clearAllSet.d.ts +6 -0
- package/dist/types/components/OnBoarding/clear/index.d.ts +8 -0
- package/dist/types/components/OnBoarding/incode/BackId.d.ts +11 -0
- package/dist/types/components/OnBoarding/incode/FinishOnboarding.d.ts +11 -0
- package/dist/types/components/OnBoarding/incode/FrontId.d.ts +10 -0
- package/dist/types/components/OnBoarding/incode/Passport.d.ts +10 -0
- package/dist/types/components/OnBoarding/incode/ProcessFace.d.ts +11 -0
- package/dist/types/components/OnBoarding/incode/ProcessId.d.ts +11 -0
- package/dist/types/components/OnBoarding/incode/SelectType.d.ts +6 -0
- package/dist/types/components/OnBoarding/incode/Selfie.d.ts +11 -0
- package/dist/types/components/OnBoarding/incode/Steps.d.ts +7 -0
- package/dist/types/components/OnBoarding/incode/UserConsent.d.ts +8 -0
- package/dist/types/components/OnBoarding/incode/index.d.ts +9 -0
- package/dist/types/components/OnBoarding/vender/grid/authIdGrid.d.ts +8 -0
- package/dist/types/components/OnBoarding/vender/grid/clearGrid.d.ts +5 -0
- package/dist/types/components/OnBoarding/vender/grid/incodeGrid.d.ts +5 -0
- package/dist/types/components/OnBoarding/vender/grid/index.d.ts +10 -0
- package/dist/types/components/OnBoarding/vender/grid/sumsubGrid.d.ts +5 -0
- package/dist/types/components/OnBoarding/vender/grid/veriffGrid.d.ts +5 -0
- package/dist/types/components/OnBoarding/vender/grid/yotiGrid.d.ts +5 -0
- package/dist/types/components/OnBoarding/vender/index.d.ts +9 -0
- package/dist/types/components/RedirectToMobile/index.d.ts +7 -0
- package/dist/types/components/ScreenRotation.d.ts +3 -0
- package/dist/types/components/SendSns/index.d.ts +16 -0
- package/dist/types/components/TryAgain.d.ts +6 -0
- package/dist/types/components/TryAgainInModal.d.ts +6 -0
- package/dist/types/components/VerifyWithPhoneNumber/NewUser/index.d.ts +11 -0
- package/dist/types/components/VerifyWithPhoneNumber/User/index.d.ts +13 -0
- package/dist/types/components/createDeveloperLog.d.ts +11 -0
- package/dist/types/components/phoneNumberProcesser.d.ts +6 -0
- package/dist/types/components/speedTest/SpeedProvider.d.ts +9 -0
- package/dist/types/components/theme.d.ts +9 -0
- package/dist/types/enum/index.d.ts +22 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/lib/environmentDomains.d.ts +7 -0
- package/dist/types/lib/webauthb.d.ts +18 -0
- package/dist/types/state.d.ts +11 -0
- package/dist/types/theme.d.ts +9 -0
- package/dist/types/vender/incode/incode.d.ts +8 -0
- package/dist/vender/incode/incode.js +13 -0
- package/index.css +52 -0
- package/package.json +49 -0
- package/public/US-UK_Add_to_Apple_Wallet_RGB_101421.svg +259 -0
- package/public/berify-title.webp +0 -0
- package/public/clearme.svg +39 -0
- package/public/idme.svg +13 -0
- package/public/incode.svg +9 -0
- package/public/scan.svg +8 -0
- package/public/trackablehealth-one-logo-1024x229.jpg +0 -0
|
@@ -0,0 +1,107 @@
|
|
|
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 React from "react";
|
|
38
|
+
import { useEffect } from "react";
|
|
39
|
+
import berifymeApi from "../api/api";
|
|
40
|
+
import { createAuthenticationLog } from "./AuthenticationLogs";
|
|
41
|
+
import { createDeveloperLog } from "./createDeveloperLog";
|
|
42
|
+
var Clear = function (_a) {
|
|
43
|
+
var token = _a.token, redirectUrl = _a.redirectUrl, userId = _a.userId, actionType = _a.actionType;
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
var script = document.createElement('script');
|
|
46
|
+
script.src = "https://verified.clearme.com/clearme.js";
|
|
47
|
+
script.onload = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
|
+
var res, CLEAR, clearUI, observer, handleResize;
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
switch (_a.label) {
|
|
51
|
+
case 0: return [4 /*yield*/, berifymeApi.clear.createVerificationSession({ redirectUrl: redirectUrl, token: token })];
|
|
52
|
+
case 1:
|
|
53
|
+
res = _a.sent();
|
|
54
|
+
localStorage.setItem('clear_session_id', res.sessionId);
|
|
55
|
+
createDeveloperLog({
|
|
56
|
+
source: 'FRONTEND',
|
|
57
|
+
action: 'clear createVerificationSession',
|
|
58
|
+
sessionToken: token,
|
|
59
|
+
firstDetail: redirectUrl,
|
|
60
|
+
secondDetail: res.sessionId,
|
|
61
|
+
});
|
|
62
|
+
if (userId && token) {
|
|
63
|
+
createAuthenticationLog({
|
|
64
|
+
actionType: actionType,
|
|
65
|
+
userId: userId,
|
|
66
|
+
vender: 'Clear',
|
|
67
|
+
token: token,
|
|
68
|
+
clearSessionId: res.sessionId,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
CLEAR = window.CLEAR;
|
|
72
|
+
clearUI = CLEAR.createUI(res.token, {
|
|
73
|
+
onSuccess: function (data) {
|
|
74
|
+
console.log('onSuccess data', data);
|
|
75
|
+
},
|
|
76
|
+
onExit: function () {
|
|
77
|
+
window.location.reload();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
clearUI.launch();
|
|
81
|
+
observer = new MutationObserver(function () {
|
|
82
|
+
var iframe = document.querySelector('iframe');
|
|
83
|
+
if (iframe) {
|
|
84
|
+
var originalHeight = iframe.offsetHeight;
|
|
85
|
+
if (window.innerHeight > 600)
|
|
86
|
+
iframe.style.height = "".concat(originalHeight + 30, "px");
|
|
87
|
+
else
|
|
88
|
+
iframe.style.height = "".concat(originalHeight, "px");
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
92
|
+
handleResize = function () { window.location.reload(); };
|
|
93
|
+
window.addEventListener('resize', handleResize);
|
|
94
|
+
return [2 /*return*/, function () {
|
|
95
|
+
window.removeEventListener('resize', handleResize);
|
|
96
|
+
var CLEAR = window.CLEAR;
|
|
97
|
+
CLEAR.abort();
|
|
98
|
+
document.body.removeChild(script);
|
|
99
|
+
}];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}); };
|
|
103
|
+
document.body.appendChild(script);
|
|
104
|
+
}, []);
|
|
105
|
+
return (React.createElement(React.Fragment, null));
|
|
106
|
+
};
|
|
107
|
+
export default Clear;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Stack, Typography } from "@mui/material";
|
|
2
|
+
import GppGoodOutlinedIcon from '@mui/icons-material/GppGoodOutlined';
|
|
3
|
+
import theme from "../theme";
|
|
4
|
+
import React from "react";
|
|
5
|
+
var Footer = function () {
|
|
6
|
+
return (React.createElement(React.Fragment, null,
|
|
7
|
+
React.createElement(Stack, { direction: 'row', spacing: 1, textAlign: 'center', mt: 2, justifyContent: 'center', color: theme.palette.text.secondary },
|
|
8
|
+
React.createElement(GppGoodOutlinedIcon, { fontSize: "small" }),
|
|
9
|
+
React.createElement(Typography, { variant: "body2" }, "Securely powered by Berify.me"))));
|
|
10
|
+
};
|
|
11
|
+
export default Footer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Container } from "@mui/material";
|
|
3
|
+
var Layout = function (_a) {
|
|
4
|
+
var children = _a.children;
|
|
5
|
+
return (React.createElement(React.Fragment, null,
|
|
6
|
+
React.createElement(Box, { height: '100svh', overflow: 'auto' },
|
|
7
|
+
React.createElement(Container, { maxWidth: 'sm', sx: { height: 1, px: 4 } }, children))));
|
|
8
|
+
};
|
|
9
|
+
export default Layout;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
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;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import React from "react";
|
|
49
|
+
import AuthIDComponent from "@authid/react-component";
|
|
50
|
+
import { Box, CircularProgress } from "@mui/material";
|
|
51
|
+
import { useEffect, useState } from "react";
|
|
52
|
+
import berifymeApi, { ActionType } from "../../../api/api";
|
|
53
|
+
import { useSpeedTest } from "../../speedTest/SpeedProvider";
|
|
54
|
+
import { createAuthenticationLog } from "../../AuthenticationLogs";
|
|
55
|
+
import { createDeveloperLog } from "../../createDeveloperLog";
|
|
56
|
+
var AuthID = function (_a) {
|
|
57
|
+
var phone = _a.phone, setError = _a.setError, goRedirect = _a.goRedirect, goToTryAgain = _a.goToTryAgain, setUser = _a.setUser, token = _a.token;
|
|
58
|
+
var _b = useState(''), url = _b[0], setUrl = _b[1];
|
|
59
|
+
var _c = useState(''), transactionId = _c[0], setTransactionId = _c[1];
|
|
60
|
+
var _d = useState(false), loading = _d[0], setIsLoading = _d[1];
|
|
61
|
+
var _e = useSpeedTest(), stopSpeedTest = _e.stopSpeedTest, startSpeedTest = _e.startSpeedTest;
|
|
62
|
+
useEffect(function () { stopSpeedTest(); }, []);
|
|
63
|
+
//第零部 準備URL
|
|
64
|
+
var createLoginTransaction = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
|
+
var tokenResult, result;
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0:
|
|
69
|
+
setIsLoading(true);
|
|
70
|
+
return [4 /*yield*/, berifymeApi.authID.getAuthIDToken()];
|
|
71
|
+
case 1:
|
|
72
|
+
tokenResult = _a.sent();
|
|
73
|
+
localStorage.setItem('authID_token', tokenResult.token);
|
|
74
|
+
return [4 /*yield*/, berifymeApi.authID.createLoginTransaction({ token: tokenResult.token, phone: phone })];
|
|
75
|
+
case 2:
|
|
76
|
+
result = _a.sent();
|
|
77
|
+
if (result.error) {
|
|
78
|
+
setError(result.error);
|
|
79
|
+
setIsLoading(false);
|
|
80
|
+
return [2 /*return*/];
|
|
81
|
+
}
|
|
82
|
+
setTransactionId(result.TransactionId);
|
|
83
|
+
setUrl(result.url);
|
|
84
|
+
// setUrl(`https://id.authid.ai/?t=${result.TransactionId}&s=${result.OneTimeSecret}`);
|
|
85
|
+
setIsLoading(false);
|
|
86
|
+
return [2 /*return*/];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}); };
|
|
90
|
+
//第一步 獲取status與寫入資料
|
|
91
|
+
var getTransactionStatus = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
|
+
var result, account, fullName_1, birthDateFromAuthId_1;
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0: return [4 /*yield*/, berifymeApi.authID.getTransactionStatus({ token: localStorage.getItem('authID_token') || '', phone: phone, transactionId: transactionId })];
|
|
96
|
+
case 1:
|
|
97
|
+
result = _a.sent();
|
|
98
|
+
createDeveloperLog({
|
|
99
|
+
source: 'FRONTEND',
|
|
100
|
+
action: 'authId login getTransactionStatus',
|
|
101
|
+
sessionToken: token,
|
|
102
|
+
firstDetail: "transactionId: ".concat(transactionId),
|
|
103
|
+
secondDetail: "operationId: ".concat(result.operationId, ", error: ").concat(result.error)
|
|
104
|
+
});
|
|
105
|
+
if (!!result.error) return [3 /*break*/, 3];
|
|
106
|
+
setUrl('');
|
|
107
|
+
return [4 /*yield*/, berifymeApi.authID.getAccount({ token: localStorage.getItem('authID_token') || '', phone: phone })];
|
|
108
|
+
case 2:
|
|
109
|
+
account = _a.sent();
|
|
110
|
+
createDeveloperLog({
|
|
111
|
+
source: 'FRONTEND',
|
|
112
|
+
action: 'authId login getAccount',
|
|
113
|
+
sessionToken: token,
|
|
114
|
+
firstDetail: phone,
|
|
115
|
+
secondDetail: JSON.stringify(account),
|
|
116
|
+
});
|
|
117
|
+
startSpeedTest();
|
|
118
|
+
if (account.error)
|
|
119
|
+
return [2 /*return*/, goToTryAgain()];
|
|
120
|
+
fullName_1 = account.fullName;
|
|
121
|
+
birthDateFromAuthId_1 = account.dateOfBirth;
|
|
122
|
+
if (setUser) {
|
|
123
|
+
setUser(function (prev) {
|
|
124
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
125
|
+
return (__assign(__assign({}, prev), { id: result.userId, isActive: (_a = prev === null || prev === void 0 ? void 0 : prev.isActive) !== null && _a !== void 0 ? _a : null, email: (_b = prev === null || prev === void 0 ? void 0 : prev.email) !== null && _b !== void 0 ? _b : null, phoneNumber: phone, authIDAccountNumber: (_c = prev === null || prev === void 0 ? void 0 : prev.authIDAccountNumber) !== null && _c !== void 0 ? _c : null, incodeId: (_d = prev === null || prev === void 0 ? void 0 : prev.incodeId) !== null && _d !== void 0 ? _d : null, clearId: (_e = prev === null || prev === void 0 ? void 0 : prev.clearId) !== null && _e !== void 0 ? _e : null, idmeId: (_f = prev === null || prev === void 0 ? void 0 : prev.idmeId) !== null && _f !== void 0 ? _f : null, sumsubId: (_g = prev === null || prev === void 0 ? void 0 : prev.sumsubId) !== null && _g !== void 0 ? _g : null, veriffId: (_h = prev === null || prev === void 0 ? void 0 : prev.veriffId) !== null && _h !== void 0 ? _h : null, yotiId: (_j = prev === null || prev === void 0 ? void 0 : prev.yotiId) !== null && _j !== void 0 ? _j : null, fullName: fullName_1, age: (_k = prev === null || prev === void 0 ? void 0 : prev.age) !== null && _k !== void 0 ? _k : null, birthDate: birthDateFromAuthId_1 === null || birthDateFromAuthId_1 === void 0 ? void 0 : birthDateFromAuthId_1.replaceAll('-', '/') }));
|
|
126
|
+
});
|
|
127
|
+
createAuthenticationLog({
|
|
128
|
+
actionType: ActionType.LOGIN,
|
|
129
|
+
userId: result.userId,
|
|
130
|
+
vender: 'Berify.me',
|
|
131
|
+
token: token,
|
|
132
|
+
transactionId: transactionId,
|
|
133
|
+
isPass: true,
|
|
134
|
+
});
|
|
135
|
+
goRedirect();
|
|
136
|
+
}
|
|
137
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
138
|
+
event: 'onSuccess', user: {
|
|
139
|
+
id: result.userId,
|
|
140
|
+
isActive: null,
|
|
141
|
+
email: null,
|
|
142
|
+
phoneNumber: phone,
|
|
143
|
+
authIDAccountNumber: null,
|
|
144
|
+
incodeId: null,
|
|
145
|
+
clearId: null,
|
|
146
|
+
idmeId: null,
|
|
147
|
+
fullName: fullName_1,
|
|
148
|
+
age: null,
|
|
149
|
+
birthDate: birthDateFromAuthId_1 === null || birthDateFromAuthId_1 === void 0 ? void 0 : birthDateFromAuthId_1.replaceAll('-', '/'),
|
|
150
|
+
transactionId: transactionId,
|
|
151
|
+
}
|
|
152
|
+
}));
|
|
153
|
+
return [2 /*return*/];
|
|
154
|
+
case 3:
|
|
155
|
+
setError(result.error);
|
|
156
|
+
_a.label = 4;
|
|
157
|
+
case 4: return [2 /*return*/];
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}); };
|
|
161
|
+
//初始與監聽
|
|
162
|
+
useEffect(function () { createLoginTransaction(); }, []);
|
|
163
|
+
useEffect(function () {
|
|
164
|
+
if (url) {
|
|
165
|
+
window.addEventListener('message', function (e) {
|
|
166
|
+
if (e.data.type === 'authid:page') {
|
|
167
|
+
if (e.data.pageName === 'verifiedPage') {
|
|
168
|
+
if (transactionId && phone)
|
|
169
|
+
setTimeout(function () {
|
|
170
|
+
getTransactionStatus();
|
|
171
|
+
}, 1000);
|
|
172
|
+
}
|
|
173
|
+
if (e.data.pageName === 'verifiedMatchFailPage') {
|
|
174
|
+
goToTryAgain();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return function () {
|
|
180
|
+
window.removeEventListener('message', function (e) {
|
|
181
|
+
console.log('remove message', e.data);
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
}, [url]);
|
|
185
|
+
return (React.createElement(React.Fragment, null, (url && !loading)
|
|
186
|
+
? React.createElement(AuthIDComponent, { url: url, webauth: true })
|
|
187
|
+
: React.createElement(Box, { sx: {
|
|
188
|
+
display: 'flex',
|
|
189
|
+
justifyContent: 'center',
|
|
190
|
+
alignItems: 'center',
|
|
191
|
+
height: '100vh',
|
|
192
|
+
background: '#FFFFFF'
|
|
193
|
+
} },
|
|
194
|
+
React.createElement(CircularProgress, null))));
|
|
195
|
+
};
|
|
196
|
+
export default AuthID;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import TryAgain from "../../TryAgain";
|
|
4
|
+
import AuthID from "./authid";
|
|
5
|
+
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 }));
|
|
10
|
+
return (React.createElement(React.Fragment, null,
|
|
11
|
+
React.createElement(AuthID, { token: token, phone: phoneNumber, setError: setError, goRedirect: function () { goToAllSet(); }, goToTryAgain: function () { return setError('Authentication Failed, Please Try Again.'); }, setUser: setUser })));
|
|
12
|
+
};
|
|
13
|
+
export { AuthidLogin };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import Clear from "../Clear";
|
|
4
|
+
import { ActionType } from '../../api/api';
|
|
5
|
+
import React, { useEffect, useState } from 'react';
|
|
6
|
+
//[web] const domain = import.meta.env.VITE_DOMAIN as string;
|
|
7
|
+
var ClearLogin = function (_a) {
|
|
8
|
+
var token = _a.token, userId = _a.userId, desktopRedirectUrlId = _a.desktopRedirectUrlId;
|
|
9
|
+
var _b = useState(null), redirectUrl = _b[0], setRedirectUrl = _b[1];
|
|
10
|
+
useEffect(function () {
|
|
11
|
+
// 使用 URL 物件來處理 URL 和查詢參數
|
|
12
|
+
var domain = window.location.href;
|
|
13
|
+
var url = new URL(domain);
|
|
14
|
+
url.searchParams.append('callback', 'clear_login');
|
|
15
|
+
if (token) {
|
|
16
|
+
url.searchParams.append('token', token);
|
|
17
|
+
}
|
|
18
|
+
if (desktopRedirectUrlId) {
|
|
19
|
+
url.searchParams.append('desktopRedirectUrlId', desktopRedirectUrlId);
|
|
20
|
+
}
|
|
21
|
+
setRedirectUrl(url.toString());
|
|
22
|
+
}, [token]); // 依賴 token 變化時重新運行 useEffect
|
|
23
|
+
return (React.createElement(React.Fragment, null,
|
|
24
|
+
token && redirectUrl && userId &&
|
|
25
|
+
React.createElement(Clear, { actionType: ActionType.LOGIN, token: token, userId: userId, redirectUrl: redirectUrl }),
|
|
26
|
+
React.createElement(Box, { sx: {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
height: '100vh',
|
|
31
|
+
background: '#FFFFFF'
|
|
32
|
+
} },
|
|
33
|
+
React.createElement(CircularProgress, null))));
|
|
34
|
+
};
|
|
35
|
+
export { ClearLogin };
|
|
@@ -0,0 +1,96 @@
|
|
|
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 React from "react";
|
|
38
|
+
import { useEffect, useState } from "react";
|
|
39
|
+
import berifymeApi from "../../api/api";
|
|
40
|
+
import { Box, CircularProgress } from "@mui/material";
|
|
41
|
+
import AllSet from "../../components/AllSet";
|
|
42
|
+
import TryAgain from "../TryAgain";
|
|
43
|
+
import { updateAuthenticationLog } from "../AuthenticationLogs";
|
|
44
|
+
import { createDeveloperLog } from "../createDeveloperLog";
|
|
45
|
+
var ClearLoginAllSet = function (_a) {
|
|
46
|
+
var token = _a.token, desktopRedirectUrlId = _a.desktopRedirectUrlId;
|
|
47
|
+
var _b = useState(), user = _b[0], setUser = _b[1]; // berifyme user
|
|
48
|
+
var _c = useState(), error = _c[0], setError = _c[1];
|
|
49
|
+
var getUserBySessionId = function (sessionId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
+
var res;
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0: return [4 /*yield*/, berifymeApi.user.getUserBySessionId(sessionId)];
|
|
54
|
+
case 1:
|
|
55
|
+
res = _a.sent();
|
|
56
|
+
createDeveloperLog({
|
|
57
|
+
source: 'FRONTEND',
|
|
58
|
+
action: 'clear login getUserBySessionId',
|
|
59
|
+
sessionToken: token,
|
|
60
|
+
firstDetail: sessionId,
|
|
61
|
+
secondDetail: "user: ".concat(res.user, ", error: ").concat(res.error),
|
|
62
|
+
});
|
|
63
|
+
if (!res)
|
|
64
|
+
setError('Please try again.');
|
|
65
|
+
if (res.user) {
|
|
66
|
+
setUser(res.user);
|
|
67
|
+
updateAuthenticationLog({
|
|
68
|
+
isPass: true,
|
|
69
|
+
clearSessionId: sessionId,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
else
|
|
73
|
+
setError(res.error);
|
|
74
|
+
return [2 /*return*/];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}); };
|
|
78
|
+
useEffect(function () {
|
|
79
|
+
var sessionId = localStorage.getItem('clear_session_id');
|
|
80
|
+
if (!sessionId)
|
|
81
|
+
return;
|
|
82
|
+
getUserBySessionId(sessionId);
|
|
83
|
+
}, []);
|
|
84
|
+
if (error)
|
|
85
|
+
return (React.createElement(TryAgain, { message: error }));
|
|
86
|
+
return (React.createElement(React.Fragment, null, user ? React.createElement(AllSet, { user: user, token: token, desktopRedirectUrlId: desktopRedirectUrlId }) :
|
|
87
|
+
React.createElement(Box, { sx: {
|
|
88
|
+
display: 'flex',
|
|
89
|
+
justifyContent: 'center',
|
|
90
|
+
alignItems: 'center',
|
|
91
|
+
height: '100vh',
|
|
92
|
+
background: '#FFFFFF'
|
|
93
|
+
} },
|
|
94
|
+
React.createElement(CircularProgress, null))));
|
|
95
|
+
};
|
|
96
|
+
export { ClearLoginAllSet };
|
|
@@ -0,0 +1,129 @@
|
|
|
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 React from "react";
|
|
38
|
+
import { useEffect, useRef } from "react";
|
|
39
|
+
import { incodeLogin } from "../../../vender/incode/incode";
|
|
40
|
+
import berifymeApi, { ActionType } from "../../../api/api";
|
|
41
|
+
import { Box, CircularProgress } from "@mui/material";
|
|
42
|
+
import { useSpeedTest } from "../../speedTest/SpeedProvider";
|
|
43
|
+
import { createAuthenticationLog } from "../../AuthenticationLogs";
|
|
44
|
+
import { createDeveloperLog } from "../../createDeveloperLog";
|
|
45
|
+
function LoginComponent(_a) {
|
|
46
|
+
var _this = this;
|
|
47
|
+
var onSuccess = _a.onSuccess, onError = _a.onError, user = _a.user, setUser = _a.setUser, token = _a.token;
|
|
48
|
+
var containerRef = useRef(null);
|
|
49
|
+
var _b = useSpeedTest(), stopSpeedTest = _b.stopSpeedTest, startSpeedTest = _b.startSpeedTest;
|
|
50
|
+
useEffect(function () { stopSpeedTest(); }, []);
|
|
51
|
+
var getBerifymeUser = function (customerId, transactionId) { return __awaiter(_this, void 0, void 0, function () {
|
|
52
|
+
var res;
|
|
53
|
+
var _a;
|
|
54
|
+
return __generator(this, function (_b) {
|
|
55
|
+
switch (_b.label) {
|
|
56
|
+
case 0: return [4 /*yield*/, berifymeApi.user.getUserByIncodeId(customerId)];
|
|
57
|
+
case 1:
|
|
58
|
+
res = _b.sent();
|
|
59
|
+
createDeveloperLog({
|
|
60
|
+
userId: (_a = res.user) === null || _a === void 0 ? void 0 : _a.id,
|
|
61
|
+
userDataJson: res.user,
|
|
62
|
+
source: 'FRONTEND',
|
|
63
|
+
action: 'incode login success getUserByIncodeId',
|
|
64
|
+
sessionToken: token,
|
|
65
|
+
firstDetail: "error: ".concat(res.error)
|
|
66
|
+
});
|
|
67
|
+
if (res.user) {
|
|
68
|
+
setUser(res.user);
|
|
69
|
+
createAuthenticationLog({
|
|
70
|
+
actionType: ActionType.LOGIN,
|
|
71
|
+
userId: res.user.id,
|
|
72
|
+
vender: 'incode',
|
|
73
|
+
token: token,
|
|
74
|
+
incodeSessionId: transactionId,
|
|
75
|
+
isPass: true,
|
|
76
|
+
});
|
|
77
|
+
onSuccess();
|
|
78
|
+
}
|
|
79
|
+
else if (res.error) {
|
|
80
|
+
onError({ type: res.error });
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
onError({ type: 'Oops! Something went wrong...' });
|
|
84
|
+
}
|
|
85
|
+
return [2 /*return*/];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}); };
|
|
89
|
+
useEffect(function () {
|
|
90
|
+
if (containerRef.current && (user === null || user === void 0 ? void 0 : user.incodeId)) {
|
|
91
|
+
void incodeLogin.renderLogin(containerRef.current, {
|
|
92
|
+
onSuccess: function (response) { return __awaiter(_this, void 0, void 0, function () {
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
startSpeedTest();
|
|
97
|
+
return [4 /*yield*/, getBerifymeUser(response.customerId, response.transactionId)];
|
|
98
|
+
case 1:
|
|
99
|
+
_a.sent();
|
|
100
|
+
return [2 /*return*/];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}); },
|
|
104
|
+
onError: function (r) {
|
|
105
|
+
startSpeedTest();
|
|
106
|
+
console.log('onError: ', r);
|
|
107
|
+
onError({ type: 'Oops! Something went wrong...' });
|
|
108
|
+
},
|
|
109
|
+
stopAtError: true,
|
|
110
|
+
isOneToOne: true,
|
|
111
|
+
oneToOneProps: {
|
|
112
|
+
identityId: user.incodeId,
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
onError({ type: 'Oops! Something went wrong...' });
|
|
118
|
+
}
|
|
119
|
+
}, [onSuccess, onError]);
|
|
120
|
+
return React.createElement("div", { ref: containerRef },
|
|
121
|
+
React.createElement(Box, { sx: {
|
|
122
|
+
display: 'flex',
|
|
123
|
+
justifyContent: 'center',
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
height: '100vh'
|
|
126
|
+
} },
|
|
127
|
+
React.createElement(CircularProgress, null)));
|
|
128
|
+
}
|
|
129
|
+
export { LoginComponent };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import TryAgain from "../../TryAgain";
|
|
4
|
+
import { LoginComponent } from "./Login";
|
|
5
|
+
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 }));
|
|
13
|
+
return (React.createElement(React.Fragment, null,
|
|
14
|
+
React.createElement(LoginComponent, { token: token, onError: handleError, onSuccess: goToAllSet, user: user, setUser: setUser })));
|
|
15
|
+
};
|
|
16
|
+
export { IncodeLogin };
|