gbc-kyc-kit 1.7.2 → 1.7.3

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.
@@ -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 = async () => {
24915
+ try {
24916
+ await 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
+ });
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,