gbc-kyc-kit 1.7.0 → 1.7.1

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.
@@ -18799,11 +18799,11 @@ function useGeolocation() {
18799
18799
  }, []);
18800
18800
  return geolocation;
18801
18801
  }
18802
- const saveDataToDB = async ({ data: data2, component, eventId, inProduction, source: source2 }) => {
18802
+ const saveDataToDB = async ({ data: data2, component, eventId, inProduction, source: source2, clientId }) => {
18803
18803
  const parseReq = {
18804
18804
  method: "POST",
18805
18805
  inProduction,
18806
- path: `api/v1/kyc-kit/events/register/${component}/${source2}/${eventId}`,
18806
+ path: `api/v1/kyc-kit/events/register/${component}/${source2}/${clientId}/${eventId}`,
18807
18807
  bodyParams: data2
18808
18808
  };
18809
18809
  try {
@@ -18813,7 +18813,7 @@ const saveDataToDB = async ({ data: data2, component, eventId, inProduction, sou
18813
18813
  return error;
18814
18814
  }
18815
18815
  };
18816
- const BlackListController = (clientId, authorize, eventId, source2, inProduction, countryCodeAllowed) => {
18816
+ const BlackListController = (clientId, authorize, eventId, inProduction, countryCodeAllowed, source2) => {
18817
18817
  const [isLoading, setIsLoading] = useState(false);
18818
18818
  const [status, setStatus] = useState(clientId === void 0 ? "CLIENTID" : authorize === void 0 ? "TOKEN" : "");
18819
18819
  const [message, setMessage] = useState("");
@@ -18904,7 +18904,8 @@ const BlackListController = (clientId, authorize, eventId, source2, inProduction
18904
18904
  component: "blacklist",
18905
18905
  eventId,
18906
18906
  source: source2,
18907
- inProduction
18907
+ inProduction,
18908
+ clientId
18908
18909
  });
18909
18910
  if (!lib$1(match2)) {
18910
18911
  setListMatch(match2[0]);
@@ -18927,7 +18928,6 @@ const BlackListController = (clientId, authorize, eventId, source2, inProduction
18927
18928
  ErrorHandler(error);
18928
18929
  }
18929
18930
  } catch (error) {
18930
- console.log(error);
18931
18931
  Q.error("Error - Verificar host con el proveedor");
18932
18932
  } finally {
18933
18933
  setIsLoading(false);
@@ -20556,7 +20556,7 @@ function hash(value, length2) {
20556
20556
  function trim(value) {
20557
20557
  return value.trim();
20558
20558
  }
20559
- function match$1(value, pattern) {
20559
+ function match(value, pattern) {
20560
20560
  return (value = pattern.exec(value)) ? value[0] : value;
20561
20561
  }
20562
20562
  function replace(value, pattern, replacement) {
@@ -21089,7 +21089,7 @@ var prefixer = function prefixer2(element, index, children, callback) {
21089
21089
  case RULESET:
21090
21090
  if (element.length)
21091
21091
  return combine(element.props, function(value) {
21092
- switch (match$1(value, /(::plac\w+|:read-\w+)/)) {
21092
+ switch (match(value, /(::plac\w+|:read-\w+)/)) {
21093
21093
  case ":read-only":
21094
21094
  case ":read-write":
21095
21095
  return serialize([copy(element, {
@@ -23749,7 +23749,7 @@ function BlackList({
23749
23749
  complementarySearch,
23750
23750
  dataReq,
23751
23751
  countryCode
23752
- } = BlackListController(clientId, authorize, source2, eventId, inProduction, countryCodeAllowed);
23752
+ } = BlackListController(clientId, authorize, eventId, inProduction, countryCodeAllowed, source2);
23753
23753
  return /* @__PURE__ */ jsxs("div", {
23754
23754
  className: `kit-gbc ${mode}`,
23755
23755
  children: [/* @__PURE__ */ jsx(k$1, {
@@ -23933,7 +23933,8 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
23933
23933
  component: "ocr",
23934
23934
  eventId,
23935
23935
  source: source2,
23936
- inProduction
23936
+ inProduction,
23937
+ clientId
23937
23938
  });
23938
23939
  fullData && await dataDocument(fullData);
23939
23940
  const {
@@ -24169,7 +24170,7 @@ DocumentReader.propTypes = {
24169
24170
  source: propTypes.exports.PropTypes.string,
24170
24171
  eventId: propTypes.exports.PropTypes.string
24171
24172
  };
24172
- const FaceMatchController = (dataFaceMatch, clientId, authorize, inProduction, picBase64, setTakePic, eventId, source2, countryCodeAllowed) => {
24173
+ const FaceMatchController = (dataFaceMatch, clientId, eventId, source2, authorize, inProduction, picBase64, setTakePic, countryCodeAllowed) => {
24173
24174
  const [docImage, setDocImage] = useState({});
24174
24175
  const [image, setImage] = useState("");
24175
24176
  const [message, setMessage] = useState("");
@@ -24232,11 +24233,12 @@ const FaceMatchController = (dataFaceMatch, clientId, authorize, inProduction, p
24232
24233
  const res2 = await request2(parseReq);
24233
24234
  res2.data && await dataFaceMatch(res2.data);
24234
24235
  saveDataToDB({
24235
- data: match,
24236
+ data: res2.data,
24236
24237
  component: "facematch",
24237
24238
  eventId,
24238
24239
  source: source2,
24239
- inProduction
24240
+ inProduction,
24241
+ clientId
24240
24242
  });
24241
24243
  const {
24242
24244
  message: message2
@@ -24847,19 +24849,21 @@ FaceMatch.propTypes = {
24847
24849
  eventId: propTypes.exports.PropTypes.string,
24848
24850
  source: propTypes.exports.PropTypes.string
24849
24851
  };
24850
- const LivenessCheckController = (clientId, authorize, eventId, source2, inProduction, countryCodeAllowed) => {
24852
+ const LivenessController = (clientId, eventId, source2, inProduction, countryCodeAllowed) => {
24851
24853
  const [isLoading, setIsLoading] = useState(false);
24852
- const [status, setStatus] = useState(clientId === void 0 ? "CLIENTID" : authorize === void 0 ? "TOKEN" : "");
24854
+ const [token2, setToken] = useState("");
24855
+ const [status, setStatus] = useState(clientId === void 0 ? "CLIENTID" : token2 === void 0 ? "TOKEN" : "");
24853
24856
  const [message, setMessage] = useState("");
24854
24857
  const [countryCode, setCountryCode] = useState(null);
24855
24858
  const geolocation = useGeolocation();
24859
+ const [data2, setData] = useState({});
24856
24860
  const listener = (event) => {
24857
24861
  if (event.detail) {
24858
24862
  if (event.detail.action === "PROCESS_FINISHED") {
24859
24863
  const {
24860
- data: data2
24864
+ data: data22
24861
24865
  } = event.detail;
24862
- if (data2.reason) {
24866
+ if (data22.reason) {
24863
24867
  setStatus("NOT_VERIFY");
24864
24868
  setMessage("Error de conexi\xF3n, contactar con soporte!");
24865
24869
  } else {
@@ -24873,18 +24877,16 @@ const LivenessCheckController = (clientId, authorize, eventId, source2, inProduc
24873
24877
  setStatus("NOT_VERIFY");
24874
24878
  setMessage("Error interno de aplicaci\xF3n, contactar con soporte!");
24875
24879
  }
24876
- onSendSubmitLiveness();
24877
- saveDataToDB({
24878
- data: response,
24879
- component: "liveness",
24880
- eventId,
24881
- source: source2,
24882
- inProduction
24883
- });
24880
+ setData(response);
24884
24881
  }
24885
24882
  }
24886
24883
  }
24887
24884
  };
24885
+ useEffect(() => {
24886
+ if (!lib$1(data2)) {
24887
+ onSendSubmitLiveness(data2);
24888
+ }
24889
+ }, [data2]);
24888
24890
  useEffect(() => {
24889
24891
  if (countryCodeAllowed && geolocation) {
24890
24892
  if (countryCodeAllowed.length !== 0 && !countryCodeAllowed.some((item) => item === (geolocation == null ? void 0 : geolocation.country_code))) {
@@ -24902,10 +24904,9 @@ const LivenessCheckController = (clientId, authorize, eventId, source2, inProduc
24902
24904
  const onSendSubmitLiveness = async (response) => {
24903
24905
  setIsLoading(true);
24904
24906
  try {
24905
- const res = await authorize();
24906
24907
  const customHeaders = {
24907
24908
  client_id: clientId,
24908
- access_token: res
24909
+ access_token: token2
24909
24910
  };
24910
24911
  const parseReq = {
24911
24912
  method: "POST",
@@ -24914,7 +24915,17 @@ const LivenessCheckController = (clientId, authorize, eventId, source2, inProduc
24914
24915
  customHeaders
24915
24916
  };
24916
24917
  try {
24917
- const res2 = await request2(parseReq);
24918
+ const res = await request2(parseReq);
24919
+ saveDataToDB({
24920
+ data: {
24921
+ selfie: `data:image/jpeg;base64,${response.images[0]}`
24922
+ },
24923
+ component: "liveness",
24924
+ eventId,
24925
+ source: source2,
24926
+ inProduction,
24927
+ clientId
24928
+ });
24918
24929
  } catch (error) {
24919
24930
  let message2 = "";
24920
24931
  const {
@@ -24941,7 +24952,8 @@ const LivenessCheckController = (clientId, authorize, eventId, source2, inProduc
24941
24952
  onSendSubmitLiveness,
24942
24953
  clearState,
24943
24954
  message,
24944
- countryCode
24955
+ countryCode,
24956
+ setToken
24945
24957
  };
24946
24958
  };
24947
24959
  var lib = {};
@@ -26097,10 +26109,10 @@ function LivenessCheck({
26097
26109
  isLoading,
26098
26110
  listener,
26099
26111
  clearState,
26100
- onSendSubmitLiveness,
26101
26112
  message,
26102
- countryCode
26103
- } = LivenessCheckController(clientId, eventId, source2, authorize, inProduction, countryCodeAllowed);
26113
+ countryCode,
26114
+ setToken
26115
+ } = LivenessController(clientId, eventId, source2, inProduction, countryCodeAllowed);
26104
26116
  useEffect(() => {
26105
26117
  const component = document.getElementsByTagName("face-liveness")[0];
26106
26118
  if (component) {
@@ -26108,6 +26120,7 @@ function LivenessCheck({
26108
26120
  component.shadowRoot.lastChild.style.height = "460px";
26109
26121
  }
26110
26122
  component.addEventListener("face-liveness", listener);
26123
+ authorize().then((res) => setToken(res));
26111
26124
  }
26112
26125
  }, []);
26113
26126
  return /* @__PURE__ */ jsx("div", {