@bytexbyte/berifyme-react-sdk 1.0.4 → 1.0.6
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 +2 -2
- package/dist/components/Login/yoti/Login.js +15 -5
- package/dist/components/OnBoarding/authId/authIdSelectType.js +8 -4
- package/dist/components/OnBoarding/authId/index.js +44 -15
- package/dist/components/OnBoarding/yoti/OnBoarding.js +15 -5
- package/dist/components/SendSns/index.js +1 -1
- package/dist/components/VerifyWithPhoneNumber/User/index.js +1 -1
- package/dist/types/components/OnBoarding/authId/authIdSelectType.d.ts +2 -1
- package/dist/types/components/OnBoarding/authId/index.d.ts +3 -1
- package/package.json +3 -2
|
@@ -253,7 +253,7 @@ var HomeModal = function (_a) {
|
|
|
253
253
|
setModalHeight('64vh');
|
|
254
254
|
}
|
|
255
255
|
else if (pageStatus === PageStatus.AuthIdOnboarding) {
|
|
256
|
-
setModalHeight('
|
|
256
|
+
setModalHeight('100vh');
|
|
257
257
|
}
|
|
258
258
|
else if (pageStatus === PageStatus.ClearLogin) {
|
|
259
259
|
setModalHeight('100vh');
|
|
@@ -335,7 +335,7 @@ var HomeModal = function (_a) {
|
|
|
335
335
|
pageStatus === PageStatus.VerifyUser &&
|
|
336
336
|
React.createElement(VerifyUser, { token: token, inputValue: inputValue, setError: setError, setPageStatus: setPageStatus, setModalHeight: setModalHeight, setUser: setUser, environment: environment }),
|
|
337
337
|
pageStatus === PageStatus.AuthIdOnboarding && user &&
|
|
338
|
-
React.createElement(AuthID, { token: token, goToAllSet: function () { return setPageStatus(PageStatus.AllSet); }, 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, setSelectedIdType: setAuthIdSelectedIdType, setPageStatus: setPageStatus }),
|
|
339
339
|
pageStatus === PageStatus.ClearOnboarding && user &&
|
|
340
340
|
React.createElement(ClearOnboarding, { token: token, user: user, desktopRedirectUrlId: desktopRedirectUrlId }),
|
|
341
341
|
pageStatus === PageStatus.IncodeOnBoarding && user &&
|
|
@@ -112,6 +112,20 @@ var Login = function (_a) {
|
|
|
112
112
|
return [4 /*yield*/, berifymeApi.user.getUserByYotiId({ yotiId: user.yotiId })];
|
|
113
113
|
case 9:
|
|
114
114
|
userResponse = _a.sent();
|
|
115
|
+
if ('error' in userResponse) {
|
|
116
|
+
createDeveloperLog({
|
|
117
|
+
userId: user === null || user === void 0 ? void 0 : user.id,
|
|
118
|
+
userDataJson: user,
|
|
119
|
+
source: 'FRONTEND',
|
|
120
|
+
action: 'yoti api',
|
|
121
|
+
sessionToken: token,
|
|
122
|
+
firstDetail: 'getUserByYotiId',
|
|
123
|
+
secondDetail: JSON.stringify(userResponse),
|
|
124
|
+
});
|
|
125
|
+
onError('Oops! Something went wrong. Please try again later.');
|
|
126
|
+
return [2 /*return*/];
|
|
127
|
+
}
|
|
128
|
+
// cuz secondDetail is too long
|
|
115
129
|
createDeveloperLog({
|
|
116
130
|
userId: user === null || user === void 0 ? void 0 : user.id,
|
|
117
131
|
userDataJson: user,
|
|
@@ -119,12 +133,8 @@ var Login = function (_a) {
|
|
|
119
133
|
action: 'yoti api',
|
|
120
134
|
sessionToken: token,
|
|
121
135
|
firstDetail: 'getUserByYotiId',
|
|
122
|
-
secondDetail: JSON.stringify(userResponse),
|
|
136
|
+
secondDetail: JSON.stringify({ yotiId: userResponse.user.yotiId, fullName: userResponse.user.fullName, age: userResponse.user.age, birthDate: userResponse.user.birthDate }),
|
|
123
137
|
});
|
|
124
|
-
if ('error' in userResponse) {
|
|
125
|
-
onError('Oops! Something went wrong. Please try again later.');
|
|
126
|
-
return [2 /*return*/];
|
|
127
|
-
}
|
|
128
138
|
setUser(userResponse.user);
|
|
129
139
|
onSuccess();
|
|
130
140
|
return [3 /*break*/, 12];
|
|
@@ -40,13 +40,15 @@ import { useEffect, useState } from "react";
|
|
|
40
40
|
import berifymeApi from "../../../api/api";
|
|
41
41
|
import theme from "../../theme";
|
|
42
42
|
var AuthIdSelectType = function (_a) {
|
|
43
|
-
var setSelectedIdType = _a.setSelectedIdType, setError = _a.setError;
|
|
43
|
+
var setSelectedIdType = _a.setSelectedIdType, setError = _a.setError, setPageStatus = _a.setPageStatus;
|
|
44
44
|
var _b = useState([]), idTypes = _b[0], setIdTypes = _b[1];
|
|
45
45
|
var initTypeButton = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
46
|
var result, documentTypes, filteredDocuments;
|
|
47
47
|
return __generator(this, function (_a) {
|
|
48
48
|
switch (_a.label) {
|
|
49
|
-
case 0:
|
|
49
|
+
case 0:
|
|
50
|
+
setSelectedIdType('');
|
|
51
|
+
return [4 /*yield*/, berifymeApi.authID.getIdDocumentTypes({ token: localStorage.getItem('authID_token') || '' })];
|
|
50
52
|
case 1:
|
|
51
53
|
result = _a.sent();
|
|
52
54
|
if (result.error) {
|
|
@@ -73,10 +75,12 @@ var AuthIdSelectType = function (_a) {
|
|
|
73
75
|
console.log(idTypes);
|
|
74
76
|
}, [idTypes]);
|
|
75
77
|
return (React.createElement(Stack, { spacing: 2, alignItems: 'center' },
|
|
76
|
-
idTypes[0] && React.createElement(Button, { fullWidth: true, sx: { p: 2, maxWidth: 200, bgcolor: theme.palette.secondary.dark }, variant: "contained", color: 'secondary', onClick: function () {
|
|
78
|
+
idTypes[0] && React.createElement(Button, { fullWidth: true, sx: { p: 2, maxWidth: 200, bgcolor: theme.palette.secondary.dark }, variant: "contained", color: 'secondary', onClick: function () { if (setPageStatus)
|
|
79
|
+
setPageStatus(-1); setSelectedIdType(idTypes[0].Name); } },
|
|
77
80
|
React.createElement(Typography, { variant: "h5", fontWeight: 700 }, "Upload ID")),
|
|
78
81
|
idTypes[1] && React.createElement(Typography, { variant: "h5", fontWeight: 700, color: theme.palette.text.secondary }, "OR"),
|
|
79
|
-
idTypes[1] && React.createElement(Button, { fullWidth: true, sx: { p: 2, maxWidth: 200, bgcolor: theme.palette.secondary.dark }, variant: "contained", color: 'secondary', onClick: function () {
|
|
82
|
+
idTypes[1] && React.createElement(Button, { fullWidth: true, sx: { p: 2, maxWidth: 200, bgcolor: theme.palette.secondary.dark }, variant: "contained", color: 'secondary', onClick: function () { if (setPageStatus)
|
|
83
|
+
setPageStatus(-1); setSelectedIdType(idTypes[1].Name); } },
|
|
80
84
|
React.createElement(Typography, { variant: "h5", fontWeight: 700 }, "Upload Passport"))));
|
|
81
85
|
};
|
|
82
86
|
export default AuthIdSelectType;
|
|
@@ -47,16 +47,20 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
};
|
|
48
48
|
import React from "react";
|
|
49
49
|
import AuthIDComponent from "@authid/react-component";
|
|
50
|
-
import { Box, CircularProgress } from "@mui/material";
|
|
51
|
-
import { useEffect, useState } from "react";
|
|
50
|
+
import { Box, CircularProgress, Stack, Typography } from "@mui/material";
|
|
51
|
+
import { useEffect, useRef, useState } from "react";
|
|
52
52
|
import berifymeApi, { ActionType } from "../../../api/api";
|
|
53
53
|
import { useSpeedTest } from "../../speedTest/SpeedProvider";
|
|
54
54
|
import { createAuthenticationLog, updateAuthenticationLog } from "../../AuthenticationLogs";
|
|
55
55
|
import { createDeveloperLog } from "../../createDeveloperLog";
|
|
56
|
+
import AuthIdSelectType from "./authIdSelectType";
|
|
57
|
+
import theme from "../../../theme";
|
|
56
58
|
var AuthID = function (_a) {
|
|
57
|
-
var goToAllSet = _a.goToAllSet, setError = _a.setError, userId = _a.userId, setUser = _a.setUser, selectedIdType = _a.selectedIdType, token = _a.token;
|
|
59
|
+
var goToAllSet = _a.goToAllSet, setError = _a.setError, userId = _a.userId, setUser = _a.setUser, selectedIdType = _a.selectedIdType, setSelectedIdType = _a.setSelectedIdType, token = _a.token, setPageStatus = _a.setPageStatus;
|
|
58
60
|
var _b = useState(''), operationId = _b[0], setOperationId = _b[1];
|
|
59
61
|
var _c = useState(''), url = _c[0], setUrl = _c[1];
|
|
62
|
+
var _d = useState(false), showIdOrPassport = _d[0], setShowIdOrPassport = _d[1];
|
|
63
|
+
var docErrorCount = useRef(0);
|
|
60
64
|
var stopSpeedTest = useSpeedTest().stopSpeedTest;
|
|
61
65
|
useEffect(function () { stopSpeedTest(); }, []);
|
|
62
66
|
//第零部 準備URL
|
|
@@ -283,8 +287,11 @@ var AuthID = function (_a) {
|
|
|
283
287
|
});
|
|
284
288
|
}); };
|
|
285
289
|
//初始與監聽
|
|
286
|
-
useEffect(function () {
|
|
287
|
-
|
|
290
|
+
useEffect(function () {
|
|
291
|
+
docErrorCount.current = 0;
|
|
292
|
+
if (selectedIdType !== '')
|
|
293
|
+
proofUser();
|
|
294
|
+
}, [selectedIdType]);
|
|
288
295
|
useEffect(function () {
|
|
289
296
|
if (url) {
|
|
290
297
|
window.addEventListener('message', function (e) {
|
|
@@ -295,6 +302,13 @@ var AuthID = function (_a) {
|
|
|
295
302
|
getProofTransactionStatus();
|
|
296
303
|
}, 1000);
|
|
297
304
|
}
|
|
305
|
+
if (e.data.pageName === 'documentFailedPage') {
|
|
306
|
+
docErrorCount.current += 1;
|
|
307
|
+
if (docErrorCount.current >= 3) {
|
|
308
|
+
setShowIdOrPassport(true);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
console.log('e.data.pageName: ', e.data.pageName);
|
|
298
312
|
}
|
|
299
313
|
});
|
|
300
314
|
}
|
|
@@ -309,15 +323,30 @@ var AuthID = function (_a) {
|
|
|
309
323
|
});
|
|
310
324
|
};
|
|
311
325
|
}, [url]);
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
326
|
+
useEffect(function () {
|
|
327
|
+
console.log('error count: ', docErrorCount.current);
|
|
328
|
+
}, [docErrorCount.current]);
|
|
329
|
+
return (React.createElement(React.Fragment, null,
|
|
330
|
+
url ?
|
|
331
|
+
React.createElement(AuthIDComponent, { url: url, webauth: true })
|
|
332
|
+
: React.createElement(Box, { sx: {
|
|
333
|
+
display: 'flex',
|
|
334
|
+
justifyContent: 'center',
|
|
335
|
+
alignItems: 'center',
|
|
336
|
+
height: '100vh',
|
|
337
|
+
background: '#FFFFFF'
|
|
338
|
+
} },
|
|
339
|
+
React.createElement(CircularProgress, null)),
|
|
340
|
+
showIdOrPassport &&
|
|
341
|
+
React.createElement(Box, { sx: {
|
|
342
|
+
position: 'fixed',
|
|
343
|
+
bottom: 0, left: 0,
|
|
344
|
+
width: '100%', height: '36%',
|
|
345
|
+
background: '#fff', textAlign: 'center',
|
|
346
|
+
padding: '16px', zIndex: 1000, // 确保覆盖其他内容
|
|
347
|
+
} },
|
|
348
|
+
React.createElement(Stack, { spacing: 3, height: 1, justifyContent: 'center' },
|
|
349
|
+
React.createElement(Typography, { variant: "body1", sx: { fontWeight: 'bold' }, color: theme.palette.text.secondary }, "Having trouble?"),
|
|
350
|
+
React.createElement(AuthIdSelectType, { setSelectedIdType: setSelectedIdType, setError: setError, setPageStatus: setPageStatus })))));
|
|
322
351
|
};
|
|
323
352
|
export default AuthID;
|
|
@@ -98,6 +98,20 @@ var OnBoarding = function (_a) {
|
|
|
98
98
|
case 8: return [4 /*yield*/, berifymeApi.user.getUserByYotiId({ yotiId: approveResponse.yotiId })];
|
|
99
99
|
case 9:
|
|
100
100
|
userResponse = _a.sent();
|
|
101
|
+
if ('error' in userResponse) {
|
|
102
|
+
createDeveloperLog({
|
|
103
|
+
userId: user === null || user === void 0 ? void 0 : user.id,
|
|
104
|
+
userDataJson: user,
|
|
105
|
+
source: 'FRONTEND',
|
|
106
|
+
action: 'yoti api',
|
|
107
|
+
sessionToken: token,
|
|
108
|
+
firstDetail: 'getUserByYotiId',
|
|
109
|
+
secondDetail: JSON.stringify(userResponse),
|
|
110
|
+
});
|
|
111
|
+
onError('Oops! Something went wrong. Please try again later.');
|
|
112
|
+
return [2 /*return*/];
|
|
113
|
+
}
|
|
114
|
+
// cuz secondDetail is too long
|
|
101
115
|
createDeveloperLog({
|
|
102
116
|
userId: user === null || user === void 0 ? void 0 : user.id,
|
|
103
117
|
userDataJson: user,
|
|
@@ -105,12 +119,8 @@ var OnBoarding = function (_a) {
|
|
|
105
119
|
action: 'yoti api',
|
|
106
120
|
sessionToken: token,
|
|
107
121
|
firstDetail: 'getUserByYotiId',
|
|
108
|
-
secondDetail: JSON.stringify(userResponse),
|
|
122
|
+
secondDetail: JSON.stringify({ yotiId: userResponse.user.yotiId, fullName: userResponse.user.fullName, age: userResponse.user.age, birthDate: userResponse.user.birthDate }),
|
|
109
123
|
});
|
|
110
|
-
if ('error' in userResponse) {
|
|
111
|
-
onError('Oops! Something went wrong. Please try again later.');
|
|
112
|
-
return [2 /*return*/];
|
|
113
|
-
}
|
|
114
124
|
setUser(userResponse.user);
|
|
115
125
|
onSuccess();
|
|
116
126
|
return [3 /*break*/, 12];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
declare const AuthIdSelectType: ({ setSelectedIdType, setError, }: {
|
|
2
|
+
declare const AuthIdSelectType: ({ setSelectedIdType, setError, setPageStatus, }: {
|
|
3
3
|
setSelectedIdType: React.Dispatch<React.SetStateAction<string>>;
|
|
4
4
|
setError: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
5
|
+
setPageStatus?: React.Dispatch<React.SetStateAction<number>>;
|
|
5
6
|
}) => React.JSX.Element;
|
|
6
7
|
export default AuthIdSelectType;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { UserWithAgeAndFullName } from "../../../api/api";
|
|
3
|
-
declare const AuthID: ({ goToAllSet, setError, userId, setUser, selectedIdType, token }: {
|
|
3
|
+
declare const AuthID: ({ goToAllSet, setError, userId, setUser, selectedIdType, setSelectedIdType, token, setPageStatus }: {
|
|
4
4
|
goToAllSet: () => void;
|
|
5
5
|
setError: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
6
6
|
userId: string;
|
|
7
7
|
setUser?: React.Dispatch<React.SetStateAction<UserWithAgeAndFullName | undefined>>;
|
|
8
8
|
selectedIdType: string;
|
|
9
|
+
setSelectedIdType: React.Dispatch<React.SetStateAction<string>>;
|
|
9
10
|
token?: string;
|
|
11
|
+
setPageStatus?: React.Dispatch<React.SetStateAction<number>>;
|
|
10
12
|
}) => React.JSX.Element;
|
|
11
13
|
export default AuthID;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytexbyte/berifyme-react-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"build": "tsc && copyfiles -u 1 'src/**/*.{css,svg}' dist",
|
|
10
10
|
"webpack": "webpack",
|
|
11
|
-
"esbuild": "node esbuild.config.js"
|
|
11
|
+
"esbuild": "node esbuild.config.js",
|
|
12
|
+
"release": "yarn build && npm publish"
|
|
12
13
|
},
|
|
13
14
|
"keywords": [],
|
|
14
15
|
"author": "",
|