gbc-kyc-kit 1.6.36 → 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,7 +18799,21 @@ function useGeolocation() {
18799
18799
  }, []);
18800
18800
  return geolocation;
18801
18801
  }
18802
- const BlackListController = (clientId, authorize, inProduction, countryCodeAllowed) => {
18802
+ const saveDataToDB = async ({ data: data2, component, eventId, inProduction, source: source2, clientId }) => {
18803
+ const parseReq = {
18804
+ method: "POST",
18805
+ inProduction,
18806
+ path: `api/v1/kyc-kit/events/register/${component}/${source2}/${clientId}/${eventId}`,
18807
+ bodyParams: data2
18808
+ };
18809
+ try {
18810
+ const res = await request2(parseReq);
18811
+ return res.data;
18812
+ } catch (error) {
18813
+ return error;
18814
+ }
18815
+ };
18816
+ const BlackListController = (clientId, authorize, eventId, inProduction, countryCodeAllowed, source2) => {
18803
18817
  const [isLoading, setIsLoading] = useState(false);
18804
18818
  const [status, setStatus] = useState(clientId === void 0 ? "CLIENTID" : authorize === void 0 ? "TOKEN" : "");
18805
18819
  const [message, setMessage] = useState("");
@@ -18885,6 +18899,14 @@ const BlackListController = (clientId, authorize, inProduction, countryCodeAllow
18885
18899
  message: message2,
18886
18900
  status: status2
18887
18901
  } = res2.data.data;
18902
+ saveDataToDB({
18903
+ data: match2,
18904
+ component: "blacklist",
18905
+ eventId,
18906
+ source: source2,
18907
+ inProduction,
18908
+ clientId
18909
+ });
18888
18910
  if (!lib$1(match2)) {
18889
18911
  setListMatch(match2[0]);
18890
18912
  }
@@ -23708,6 +23730,8 @@ function BlackList({
23708
23730
  clientId,
23709
23731
  authorize,
23710
23732
  inProduction,
23733
+ source: source2,
23734
+ eventId,
23711
23735
  countryCodeAllowed
23712
23736
  }) {
23713
23737
  const {
@@ -23725,7 +23749,7 @@ function BlackList({
23725
23749
  complementarySearch,
23726
23750
  dataReq,
23727
23751
  countryCode
23728
- } = BlackListController(clientId, authorize, inProduction, countryCodeAllowed);
23752
+ } = BlackListController(clientId, authorize, eventId, inProduction, countryCodeAllowed, source2);
23729
23753
  return /* @__PURE__ */ jsxs("div", {
23730
23754
  className: `kit-gbc ${mode}`,
23731
23755
  children: [/* @__PURE__ */ jsx(k$1, {
@@ -23818,7 +23842,9 @@ BlackList.defaultProps = {
23818
23842
  mode: "light",
23819
23843
  loader: false,
23820
23844
  inProduction: "prd",
23821
- countryCodeAllowed: null
23845
+ countryCodeAllowed: null,
23846
+ source: "component",
23847
+ eventId: null
23822
23848
  };
23823
23849
  BlackList.propTypes = {
23824
23850
  mode: propTypes.exports.PropTypes.string,
@@ -23827,9 +23853,11 @@ BlackList.propTypes = {
23827
23853
  clientId: propTypes.exports.PropTypes.string.isRequired,
23828
23854
  authorize: propTypes.exports.PropTypes.func.isRequired,
23829
23855
  inProduction: propTypes.exports.PropTypes.string,
23830
- countryCodeAllowed: propTypes.exports.PropTypes.array
23856
+ countryCodeAllowed: propTypes.exports.PropTypes.array,
23857
+ source: propTypes.exports.PropTypes.string,
23858
+ eventId: propTypes.exports.PropTypes.string
23831
23859
  };
23832
- const DocumentReaderController = (dataDocument, clientId, authorize, inProduction, countryCodeAllowed) => {
23860
+ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, source2, inProduction, countryCodeAllowed) => {
23833
23861
  const [docImage, setDocImage] = useState({});
23834
23862
  const [base64, setBase64] = useState({});
23835
23863
  const [message, setMessage] = useState("");
@@ -23900,6 +23928,14 @@ const DocumentReaderController = (dataDocument, clientId, authorize, inProductio
23900
23928
  try {
23901
23929
  const res2 = await request2(parseReq);
23902
23930
  const fullData = res2.data.data;
23931
+ saveDataToDB({
23932
+ data: fullData,
23933
+ component: "ocr",
23934
+ eventId,
23935
+ source: source2,
23936
+ inProduction,
23937
+ clientId
23938
+ });
23903
23939
  fullData && await dataDocument(fullData);
23904
23940
  const {
23905
23941
  message: message2
@@ -23990,6 +24026,8 @@ function DocumentReader({
23990
24026
  dataDocument,
23991
24027
  clientId,
23992
24028
  authorize,
24029
+ eventId,
24030
+ source: source2,
23993
24031
  inProduction,
23994
24032
  countryCodeAllowed
23995
24033
  }) {
@@ -24006,7 +24044,7 @@ function DocumentReader({
24006
24044
  countryCode,
24007
24045
  setDualMode,
24008
24046
  dualMode
24009
- } = DocumentReaderController(dataDocument, clientId, authorize, inProduction, countryCodeAllowed);
24047
+ } = DocumentReaderController(dataDocument, clientId, authorize, eventId, source2, inProduction, countryCodeAllowed);
24010
24048
  return /* @__PURE__ */ jsxs("div", {
24011
24049
  className: `kit-gbc ${mode}`,
24012
24050
  children: [/* @__PURE__ */ jsx(k$1, {
@@ -24116,7 +24154,9 @@ DocumentReader.defaultProps = {
24116
24154
  mode: "light",
24117
24155
  loader: false,
24118
24156
  inProduction: "prd",
24119
- countryCodeAllowed: null
24157
+ countryCodeAllowed: null,
24158
+ source: "component",
24159
+ eventId: null
24120
24160
  };
24121
24161
  DocumentReader.propTypes = {
24122
24162
  mode: propTypes.exports.PropTypes.string,
@@ -24126,9 +24166,11 @@ DocumentReader.propTypes = {
24126
24166
  authorize: propTypes.exports.PropTypes.func.isRequired,
24127
24167
  dataDocument: propTypes.exports.PropTypes.func.isRequired,
24128
24168
  inProduction: propTypes.exports.PropTypes.string,
24129
- countryCodeAllowed: propTypes.exports.PropTypes.array
24169
+ countryCodeAllowed: propTypes.exports.PropTypes.array,
24170
+ source: propTypes.exports.PropTypes.string,
24171
+ eventId: propTypes.exports.PropTypes.string
24130
24172
  };
24131
- const FaceMatchController = (dataFaceMatch, clientId, authorize, inProduction, picBase64, setTakePic, countryCodeAllowed) => {
24173
+ const FaceMatchController = (dataFaceMatch, clientId, eventId, source2, authorize, inProduction, picBase64, setTakePic, countryCodeAllowed) => {
24132
24174
  const [docImage, setDocImage] = useState({});
24133
24175
  const [image, setImage] = useState("");
24134
24176
  const [message, setMessage] = useState("");
@@ -24190,6 +24232,14 @@ const FaceMatchController = (dataFaceMatch, clientId, authorize, inProduction, p
24190
24232
  try {
24191
24233
  const res2 = await request2(parseReq);
24192
24234
  res2.data && await dataFaceMatch(res2.data);
24235
+ saveDataToDB({
24236
+ data: res2.data,
24237
+ component: "facematch",
24238
+ eventId,
24239
+ source: source2,
24240
+ inProduction,
24241
+ clientId
24242
+ });
24193
24243
  const {
24194
24244
  message: message2
24195
24245
  } = res2.data;
@@ -24641,6 +24691,8 @@ function FaceMatch({
24641
24691
  authorize,
24642
24692
  inProduction,
24643
24693
  picBase64,
24694
+ eventId,
24695
+ source: source2,
24644
24696
  countryCodeAllowed
24645
24697
  }) {
24646
24698
  const [takePic, setTakePic] = useState(false);
@@ -24657,7 +24709,7 @@ function FaceMatch({
24657
24709
  url,
24658
24710
  setUrl,
24659
24711
  countryCode
24660
- } = FaceMatchController(dataFaceMatch, clientId, authorize, inProduction, picBase64, setTakePic, countryCodeAllowed);
24712
+ } = FaceMatchController(dataFaceMatch, clientId, eventId, source2, authorize, inProduction, picBase64, setTakePic, countryCodeAllowed);
24661
24713
  const onUserMedia = (e2) => {
24662
24714
  console.log(e2, "userMedia");
24663
24715
  };
@@ -24780,7 +24832,9 @@ FaceMatch.defaultProps = {
24780
24832
  loader: false,
24781
24833
  inProduction: "prd",
24782
24834
  picBase64: "",
24783
- countryCodeAllowed: null
24835
+ countryCodeAllowed: null,
24836
+ eventId: null,
24837
+ source: "component"
24784
24838
  };
24785
24839
  FaceMatch.propTypes = {
24786
24840
  mode: propTypes.exports.PropTypes.string,
@@ -24791,21 +24845,25 @@ FaceMatch.propTypes = {
24791
24845
  dataFaceMatch: propTypes.exports.PropTypes.func.isRequired,
24792
24846
  inProduction: propTypes.exports.PropTypes.string,
24793
24847
  picBase64: propTypes.exports.PropTypes.string.isRequired,
24794
- countryCodeAllowed: propTypes.exports.PropTypes.array
24848
+ countryCodeAllowed: propTypes.exports.PropTypes.array,
24849
+ eventId: propTypes.exports.PropTypes.string,
24850
+ source: propTypes.exports.PropTypes.string
24795
24851
  };
24796
- const LivenessCheckController = (clientId, authorize, inProduction, countryCodeAllowed) => {
24852
+ const LivenessController = (clientId, eventId, source2, inProduction, countryCodeAllowed) => {
24797
24853
  const [isLoading, setIsLoading] = useState(false);
24798
- 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" : "");
24799
24856
  const [message, setMessage] = useState("");
24800
24857
  const [countryCode, setCountryCode] = useState(null);
24801
24858
  const geolocation = useGeolocation();
24859
+ const [data2, setData] = useState({});
24802
24860
  const listener = (event) => {
24803
24861
  if (event.detail) {
24804
24862
  if (event.detail.action === "PROCESS_FINISHED") {
24805
24863
  const {
24806
- data: data2
24864
+ data: data22
24807
24865
  } = event.detail;
24808
- if (data2.reason) {
24866
+ if (data22.reason) {
24809
24867
  setStatus("NOT_VERIFY");
24810
24868
  setMessage("Error de conexi\xF3n, contactar con soporte!");
24811
24869
  } else {
@@ -24819,11 +24877,16 @@ const LivenessCheckController = (clientId, authorize, inProduction, countryCodeA
24819
24877
  setStatus("NOT_VERIFY");
24820
24878
  setMessage("Error interno de aplicaci\xF3n, contactar con soporte!");
24821
24879
  }
24822
- onSendSubmitLiveness();
24880
+ setData(response);
24823
24881
  }
24824
24882
  }
24825
24883
  }
24826
24884
  };
24885
+ useEffect(() => {
24886
+ if (!lib$1(data2)) {
24887
+ onSendSubmitLiveness(data2);
24888
+ }
24889
+ }, [data2]);
24827
24890
  useEffect(() => {
24828
24891
  if (countryCodeAllowed && geolocation) {
24829
24892
  if (countryCodeAllowed.length !== 0 && !countryCodeAllowed.some((item) => item === (geolocation == null ? void 0 : geolocation.country_code))) {
@@ -24841,10 +24904,9 @@ const LivenessCheckController = (clientId, authorize, inProduction, countryCodeA
24841
24904
  const onSendSubmitLiveness = async (response) => {
24842
24905
  setIsLoading(true);
24843
24906
  try {
24844
- const res = await authorize();
24845
24907
  const customHeaders = {
24846
24908
  client_id: clientId,
24847
- access_token: res
24909
+ access_token: token2
24848
24910
  };
24849
24911
  const parseReq = {
24850
24912
  method: "POST",
@@ -24853,7 +24915,17 @@ const LivenessCheckController = (clientId, authorize, inProduction, countryCodeA
24853
24915
  customHeaders
24854
24916
  };
24855
24917
  try {
24856
- 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
+ });
24857
24929
  } catch (error) {
24858
24930
  let message2 = "";
24859
24931
  const {
@@ -24880,7 +24952,8 @@ const LivenessCheckController = (clientId, authorize, inProduction, countryCodeA
24880
24952
  onSendSubmitLiveness,
24881
24953
  clearState,
24882
24954
  message,
24883
- countryCode
24955
+ countryCode,
24956
+ setToken
24884
24957
  };
24885
24958
  };
24886
24959
  var lib = {};
@@ -26025,6 +26098,8 @@ lib.withOrientationChange = withOrientationChange;
26025
26098
  function LivenessCheck({
26026
26099
  mode,
26027
26100
  clientId,
26101
+ eventId,
26102
+ source: source2,
26028
26103
  authorize,
26029
26104
  inProduction,
26030
26105
  countryCodeAllowed
@@ -26034,10 +26109,10 @@ function LivenessCheck({
26034
26109
  isLoading,
26035
26110
  listener,
26036
26111
  clearState,
26037
- onSendSubmitLiveness,
26038
26112
  message,
26039
- countryCode
26040
- } = LivenessCheckController(clientId, authorize, inProduction, countryCodeAllowed);
26113
+ countryCode,
26114
+ setToken
26115
+ } = LivenessController(clientId, eventId, source2, inProduction, countryCodeAllowed);
26041
26116
  useEffect(() => {
26042
26117
  const component = document.getElementsByTagName("face-liveness")[0];
26043
26118
  if (component) {
@@ -26045,6 +26120,7 @@ function LivenessCheck({
26045
26120
  component.shadowRoot.lastChild.style.height = "460px";
26046
26121
  }
26047
26122
  component.addEventListener("face-liveness", listener);
26123
+ authorize().then((res) => setToken(res));
26048
26124
  }
26049
26125
  }, []);
26050
26126
  return /* @__PURE__ */ jsx("div", {
@@ -26081,14 +26157,18 @@ function LivenessCheck({
26081
26157
  LivenessCheck.defaultProps = {
26082
26158
  mode: "light",
26083
26159
  inProduction: "prd",
26084
- countryCodeAllowed: null
26160
+ countryCodeAllowed: null,
26161
+ eventId: null,
26162
+ source: "component"
26085
26163
  };
26086
26164
  LivenessCheck.propTypes = {
26087
26165
  mode: propTypes.exports.PropTypes.string,
26088
26166
  clientId: propTypes.exports.PropTypes.string.isRequired,
26089
26167
  authorize: propTypes.exports.PropTypes.func.isRequired,
26090
26168
  inProduction: propTypes.exports.PropTypes.string,
26091
- countryCodeAllowed: propTypes.exports.PropTypes.array
26169
+ countryCodeAllowed: propTypes.exports.PropTypes.array,
26170
+ eventId: propTypes.exports.PropTypes.string,
26171
+ source: propTypes.exports.PropTypes.string
26092
26172
  };
26093
26173
  var bootstrap_min = "";
26094
26174
  var bootstrap_bundle_min = { exports: {} };