gbc-kyc-kit 1.7.2 → 1.7.5
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 +8 -0
- package/dist/gbc-kyc-kit.es.js +28 -26
- package/dist/gbc-kyc-kit.umd.js +38 -38
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -146,6 +146,13 @@ Props Available:
|
|
|
146
146
|
- countryCodeAllowed: array of string
|
|
147
147
|
|
|
148
148
|
```js
|
|
149
|
+
|
|
150
|
+
const getDataLiveness = async (info) => {
|
|
151
|
+
if (info) {
|
|
152
|
+
console.log(info.data);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
// This component return data and you can get it with getDataLiveness function.
|
|
149
156
|
const listener = (event) => {
|
|
150
157
|
console.log(event)
|
|
151
158
|
if (event.detail) {
|
|
@@ -166,6 +173,7 @@ useEffect(() => {
|
|
|
166
173
|
<LivenessCheck
|
|
167
174
|
clientId={clientId}
|
|
168
175
|
authorize={getAccessToken}
|
|
176
|
+
dataLiveness={getDataLiveness}
|
|
169
177
|
inProduction="prd"
|
|
170
178
|
/>
|
|
171
179
|
```
|
package/dist/gbc-kyc-kit.es.js
CHANGED
|
@@ -24858,7 +24858,7 @@ FaceMatch.propTypes = {
|
|
|
24858
24858
|
eventId: propTypes.exports.PropTypes.string,
|
|
24859
24859
|
source: propTypes.exports.PropTypes.string
|
|
24860
24860
|
};
|
|
24861
|
-
const LivenessController = (clientId, eventId, source2, inProduction, countryCodeAllowed, faceMatch) => {
|
|
24861
|
+
const LivenessController = (clientId, eventId, source2, inProduction, countryCodeAllowed, faceMatch, dataLiveness) => {
|
|
24862
24862
|
const [isLoading, setIsLoading] = useState(false);
|
|
24863
24863
|
const [token2, setToken] = useState("");
|
|
24864
24864
|
const [status, setStatus] = useState(clientId === void 0 ? "CLIENTID" : token2 === void 0 ? "TOKEN" : "");
|
|
@@ -24897,9 +24897,6 @@ const LivenessController = (clientId, eventId, source2, inProduction, countryCod
|
|
|
24897
24897
|
onSendSubmitLiveness();
|
|
24898
24898
|
}
|
|
24899
24899
|
}, [data2]);
|
|
24900
|
-
useEffect(() => {
|
|
24901
|
-
data2 && similarity && wrapAndSaveData();
|
|
24902
|
-
}, [similarity]);
|
|
24903
24900
|
useEffect(() => {
|
|
24904
24901
|
if (countryCodeAllowed && geolocation) {
|
|
24905
24902
|
if (countryCodeAllowed.length !== 0 && !countryCodeAllowed.some((item) => item === (geolocation == null ? void 0 : geolocation.country_code))) {
|
|
@@ -24914,6 +24911,27 @@ const LivenessController = (clientId, eventId, source2, inProduction, countryCod
|
|
|
24914
24911
|
setMessage("");
|
|
24915
24912
|
setIsLoading(false);
|
|
24916
24913
|
};
|
|
24914
|
+
const wrapAndSaveData = () => {
|
|
24915
|
+
try {
|
|
24916
|
+
saveDataToDB({
|
|
24917
|
+
data: {
|
|
24918
|
+
selfie: `data:image/jpeg;base64,${data2.images[0]}`,
|
|
24919
|
+
similarity: faceMatch ? similarity : null
|
|
24920
|
+
},
|
|
24921
|
+
component: "liveness",
|
|
24922
|
+
eventId,
|
|
24923
|
+
source: source2,
|
|
24924
|
+
inProduction,
|
|
24925
|
+
clientId
|
|
24926
|
+
}).then((res) => dataLiveness(res));
|
|
24927
|
+
} catch (errorSavingData) {
|
|
24928
|
+
console.log(errorSavingData);
|
|
24929
|
+
return errorSavingData;
|
|
24930
|
+
}
|
|
24931
|
+
};
|
|
24932
|
+
useEffect(() => {
|
|
24933
|
+
similarity !== 0 && wrapAndSaveData();
|
|
24934
|
+
}, [similarity]);
|
|
24917
24935
|
const onSendSubmitLiveness = async (response) => {
|
|
24918
24936
|
setIsLoading(true);
|
|
24919
24937
|
try {
|
|
@@ -24929,7 +24947,7 @@ const LivenessController = (clientId, eventId, source2, inProduction, countryCod
|
|
|
24929
24947
|
};
|
|
24930
24948
|
try {
|
|
24931
24949
|
await request2(parseReq);
|
|
24932
|
-
await fetchFaceMatch(faceMatch, `data:image/jpeg;base64,${data2.images[0]}`, inProduction, customHeaders).then((res) => setSimilarity(res.data.similarity));
|
|
24950
|
+
faceMatch ? await fetchFaceMatch(faceMatch, `data:image/jpeg;base64,${data2.images[0]}`, inProduction, customHeaders).then((res) => setSimilarity(res.data.similarity)) : wrapAndSaveData();
|
|
24933
24951
|
} catch (error) {
|
|
24934
24952
|
let message2 = "";
|
|
24935
24953
|
const {
|
|
@@ -24949,24 +24967,6 @@ const LivenessController = (clientId, eventId, source2, inProduction, countryCod
|
|
|
24949
24967
|
setIsLoading(false);
|
|
24950
24968
|
}
|
|
24951
24969
|
};
|
|
24952
|
-
const wrapAndSaveData = async () => {
|
|
24953
|
-
try {
|
|
24954
|
-
await saveDataToDB({
|
|
24955
|
-
data: {
|
|
24956
|
-
selfie: `data:image/jpeg;base64,${data2.images[0]}`,
|
|
24957
|
-
similarity
|
|
24958
|
-
},
|
|
24959
|
-
component: "liveness",
|
|
24960
|
-
eventId,
|
|
24961
|
-
source: source2,
|
|
24962
|
-
inProduction,
|
|
24963
|
-
clientId
|
|
24964
|
-
});
|
|
24965
|
-
} catch (errorSavingData) {
|
|
24966
|
-
console.log(errorSavingData);
|
|
24967
|
-
return errorSavingData;
|
|
24968
|
-
}
|
|
24969
|
-
};
|
|
24970
24970
|
return {
|
|
24971
24971
|
status,
|
|
24972
24972
|
isLoading,
|
|
@@ -26125,7 +26125,8 @@ function LivenessCheck({
|
|
|
26125
26125
|
authorize,
|
|
26126
26126
|
inProduction,
|
|
26127
26127
|
countryCodeAllowed,
|
|
26128
|
-
faceMatch
|
|
26128
|
+
faceMatch,
|
|
26129
|
+
dataLiveness
|
|
26129
26130
|
}) {
|
|
26130
26131
|
const {
|
|
26131
26132
|
status,
|
|
@@ -26135,7 +26136,7 @@ function LivenessCheck({
|
|
|
26135
26136
|
message,
|
|
26136
26137
|
countryCode,
|
|
26137
26138
|
setToken
|
|
26138
|
-
} = LivenessController(clientId, eventId, source2, inProduction, countryCodeAllowed, faceMatch);
|
|
26139
|
+
} = LivenessController(clientId, eventId, source2, inProduction, countryCodeAllowed, faceMatch, dataLiveness);
|
|
26139
26140
|
useEffect(() => {
|
|
26140
26141
|
const component = document.getElementsByTagName("face-liveness")[0];
|
|
26141
26142
|
if (component) {
|
|
@@ -26193,7 +26194,8 @@ LivenessCheck.propTypes = {
|
|
|
26193
26194
|
countryCodeAllowed: propTypes.exports.PropTypes.array,
|
|
26194
26195
|
eventId: propTypes.exports.PropTypes.string,
|
|
26195
26196
|
source: propTypes.exports.PropTypes.string,
|
|
26196
|
-
faceMatch: propTypes.exports.PropTypes.string
|
|
26197
|
+
faceMatch: propTypes.exports.PropTypes.string,
|
|
26198
|
+
dataLiveness: propTypes.exports.PropTypes.func.isRequired
|
|
26197
26199
|
};
|
|
26198
26200
|
var bootstrap_min = "";
|
|
26199
26201
|
var bootstrap_bundle_min = { exports: {} };
|