@bytexbyte/berifyme-react-sdk 1.0.19 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api/api.js
CHANGED
|
@@ -569,11 +569,9 @@ function getUserByIncodeId(_a) {
|
|
|
569
569
|
switch (_c.label) {
|
|
570
570
|
case 0:
|
|
571
571
|
url = "".concat(config.backendDomain, "/api/user/getUserByIncodeId?customerId=").concat(customerId, "&interviewId=").concat(interviewId).concat(token ? "&token=".concat(token) : '');
|
|
572
|
-
console.log('UrlString: ', url);
|
|
573
572
|
return [4 /*yield*/, axios.get(url)];
|
|
574
573
|
case 1:
|
|
575
574
|
res = _c.sent();
|
|
576
|
-
console.log('UrlRes data: ', res.data);
|
|
577
575
|
return [2 /*return*/, res.data];
|
|
578
576
|
}
|
|
579
577
|
});
|
|
@@ -49,6 +49,16 @@ import { getSnapMatchResultTranslations } from "./translations";
|
|
|
49
49
|
var DEFAULT_ERROR_MESSAGE = "Something went wrong, but we're working on it. Please try again later or contact support for assistance.";
|
|
50
50
|
var DEFAULT_AUTO_REDIRECT_SECONDS = 5;
|
|
51
51
|
var RETURN_TO_SCAN_DELAY_MS = 400;
|
|
52
|
+
function toSnapMatchUser(user) {
|
|
53
|
+
return {
|
|
54
|
+
id: user.id,
|
|
55
|
+
fullName: user.fullName,
|
|
56
|
+
phoneNumber: user.phoneNumber,
|
|
57
|
+
email: user.email,
|
|
58
|
+
age: user.age,
|
|
59
|
+
birthDate: user.birthDate,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
52
62
|
var SnapMatch = function (_a) {
|
|
53
63
|
var apiKeyId = _a.apiKeyId, secretKey = _a.secretKey, environment = _a.environment, onSuccess = _a.onSuccess, onError = _a.onError, tokenProp = _a.token, _b = _a.lang, langProp = _b === void 0 ? "en" : _b, _c = _a.autoRedirectSeconds, autoRedirectSeconds = _c === void 0 ? DEFAULT_AUTO_REDIRECT_SECONDS : _c;
|
|
54
64
|
var defaultLang = LANG_OPTIONS.some(function (o) { return o.value === langProp; }) ? langProp : "en";
|
|
@@ -206,7 +216,7 @@ var SnapMatch = function (_a) {
|
|
|
206
216
|
case 2:
|
|
207
217
|
res = _d.sent();
|
|
208
218
|
if (res.user) {
|
|
209
|
-
onSuccessRef.current(res.user);
|
|
219
|
+
onSuccessRef.current(toSnapMatchUser(res.user));
|
|
210
220
|
if (res.user.fullName)
|
|
211
221
|
setFullName(res.user.fullName);
|
|
212
222
|
setStep("success");
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { UserWithAgeAndFullName } from "../../api/api";
|
|
3
3
|
import { Environment } from "../../enum";
|
|
4
|
+
/** onSuccess 回傳的 user 僅包含常用欄位,避免後端回傳過多資料 */
|
|
5
|
+
export type SnapMatchUser = Pick<UserWithAgeAndFullName, "id" | "fullName" | "phoneNumber" | "email" | "age" | "birthDate">;
|
|
4
6
|
export type SnapMatchProps = {
|
|
5
7
|
apiKeyId: string;
|
|
6
8
|
secretKey: string;
|
|
7
9
|
environment: Environment;
|
|
8
|
-
|
|
10
|
+
/** 驗證成功時呼叫,傳入精簡的 user(id, fullName, phoneNumber, email, age, birthDate) */
|
|
11
|
+
onSuccess: (user: SnapMatchUser) => void;
|
|
9
12
|
onError: (message: string) => void;
|
|
10
13
|
token?: string;
|
|
11
14
|
/** 預設語系(掃描與結果頁),'en' | 'zh-TW',預設 'en';可於掃描時用按鈕切換中/英 */
|
package/dist/types/index.d.ts
CHANGED