gbc-kyc-kit 3.4.5 → 3.4.6

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.
@@ -18276,7 +18276,7 @@ const BlackListController = (clientId, authorize, inProduction, source2, eventId
18276
18276
  }
18277
18277
  countryCodeAllowed && geolocation && setCountryCode(geolocation == null ? void 0 : geolocation.data_connection.isocode);
18278
18278
  }, [geolocation, countryCodeAllowed, validateVpn]);
18279
- const clearState2 = () => {
18279
+ const clearState = () => {
18280
18280
  reset();
18281
18281
  setStatus("");
18282
18282
  setMessage("");
@@ -18525,7 +18525,7 @@ const BlackListController = (clientId, authorize, inProduction, source2, eventId
18525
18525
  listMatch,
18526
18526
  select,
18527
18527
  setSelect,
18528
- clearState: clearState2,
18528
+ clearState,
18529
18529
  dataReq,
18530
18530
  countryCode,
18531
18531
  handleFileUpload,
@@ -18536,71 +18536,75 @@ const BlackListController = (clientId, authorize, inProduction, source2, eventId
18536
18536
  copyFunction
18537
18537
  };
18538
18538
  };
18539
- const ocr = "_ocr_v0oef_55";
18540
- const tabpanel = "_tabpanel_v0oef_58";
18541
- const button = "_button_v0oef_119";
18542
- const outlined = "_outlined_v0oef_151";
18543
- const contained = "_contained_v0oef_160";
18544
- const small = "_small_v0oef_168";
18545
- const large = "_large_v0oef_177";
18546
- const sub = "_sub_v0oef_183";
18547
- const ready = "_ready_v0oef_205";
18548
- const front = "_front_v0oef_205";
18549
- const back = "_back_v0oef_98";
18550
- const icon$1 = "_icon_v0oef_334";
18551
- const accordion = "_accordion_v0oef_401";
18552
- const description$1 = "_description_v0oef_405";
18553
- const birth_place_section = "_birth_place_section_v0oef_419";
18554
- const authority = "_authority_v0oef_420";
18555
- const others = "_others_v0oef_421";
18556
- const dark$1 = "_dark_v0oef_434";
18539
+ const ocr = "_ocr_qlen3_55";
18540
+ const tabpanel = "_tabpanel_qlen3_58";
18541
+ const button = "_button_qlen3_119";
18542
+ const outlined = "_outlined_qlen3_151";
18543
+ const contained = "_contained_qlen3_160";
18544
+ const small = "_small_qlen3_168";
18545
+ const large = "_large_qlen3_177";
18546
+ const sub = "_sub_qlen3_183";
18547
+ const ready = "_ready_qlen3_205";
18548
+ const front = "_front_qlen3_205";
18549
+ const back = "_back_qlen3_98";
18550
+ const icon$1 = "_icon_qlen3_334";
18551
+ const accordion = "_accordion_qlen3_401";
18552
+ const description$1 = "_description_qlen3_405";
18553
+ const birth_place_section = "_birth_place_section_qlen3_419";
18554
+ const authority = "_authority_qlen3_420";
18555
+ const others = "_others_qlen3_421";
18556
+ const dark$1 = "_dark_qlen3_434";
18557
+ const spin$1 = "_spin_qlen3_1";
18557
18558
  var styles$a = {
18558
- "kit-gbc": "_kit-gbc_v0oef_2",
18559
- "px-2": "_px-2_v0oef_32",
18560
- "m-0": "_m-0_v0oef_36",
18561
- "my-1": "_my-1_v0oef_39",
18562
- "col-12": "_col-12_v0oef_43",
18563
- "col-6": "_col-6_v0oef_46",
18564
- "without-shadow": "_without-shadow_v0oef_49",
18559
+ "kit-gbc": "_kit-gbc_qlen3_2",
18560
+ "px-2": "_px-2_qlen3_32",
18561
+ "m-0": "_m-0_qlen3_36",
18562
+ "my-1": "_my-1_qlen3_39",
18563
+ "col-12": "_col-12_qlen3_43",
18564
+ "col-6": "_col-6_qlen3_46",
18565
+ "without-shadow": "_without-shadow_qlen3_49",
18565
18566
  ocr,
18566
18567
  tabpanel,
18567
- "first-animation": "_first-animation_v0oef_94",
18568
- "back-button-container": "_back-button-container_v0oef_98",
18569
- "back-button": "_back-button_v0oef_98",
18570
- "button-container": "_button-container_v0oef_119",
18568
+ "first-animation": "_first-animation_qlen3_94",
18569
+ "back-button-container": "_back-button-container_qlen3_98",
18570
+ "back-button": "_back-button_qlen3_98",
18571
+ "button-container": "_button-container_qlen3_119",
18571
18572
  button,
18572
18573
  outlined,
18573
18574
  contained,
18574
18575
  small,
18575
18576
  large,
18576
18577
  sub,
18577
- "header-component": "_header-component_v0oef_192",
18578
- "body-id-doc": "_body-id-doc_v0oef_199",
18578
+ "header-component": "_header-component_qlen3_192",
18579
+ "body-id-doc": "_body-id-doc_qlen3_199",
18579
18580
  ready,
18580
18581
  front,
18581
18582
  back,
18582
- "upload-document": "_upload-document_v0oef_213",
18583
- "pics-container": "_pics-container_v0oef_253",
18584
- "box-image": "_box-image_v0oef_259",
18585
- "without-image": "_without-image_v0oef_319",
18586
- "bg-img-container": "_bg-img-container_v0oef_319",
18583
+ "upload-document": "_upload-document_qlen3_213",
18584
+ "pics-container": "_pics-container_qlen3_253",
18585
+ "box-image": "_box-image_qlen3_259",
18586
+ "without-image": "_without-image_qlen3_319",
18587
+ "bg-img-container": "_bg-img-container_qlen3_319",
18587
18588
  icon: icon$1,
18588
- "detail-component": "_detail-component_v0oef_339",
18589
- "country-select": "_country-select_v0oef_362",
18589
+ "detail-component": "_detail-component_qlen3_339",
18590
+ "country-select": "_country-select_qlen3_362",
18590
18591
  accordion,
18591
18592
  description: description$1,
18592
- "accordion-body": "_accordion-body_v0oef_413",
18593
- "name-section": "_name-section_v0oef_418",
18593
+ "accordion-body": "_accordion-body_qlen3_413",
18594
+ "name-section": "_name-section_qlen3_418",
18594
18595
  birth_place_section,
18595
18596
  authority,
18596
18597
  others,
18597
18598
  dark: dark$1,
18598
- "input-container": "_input-container_v0oef_444",
18599
- "custom-input-container": "_custom-input-container_v0oef_456",
18600
- "liveness-container": "_liveness-container_v0oef_459",
18601
- "MuiTab-root": "_MuiTab-root_v0oef_462",
18602
- "Mui-selected": "_Mui-selected_v0oef_466",
18603
- "MuiTabs-indicator": "_MuiTabs-indicator_v0oef_474"
18599
+ "input-container": "_input-container_qlen3_444",
18600
+ "custom-input-container": "_custom-input-container_qlen3_456",
18601
+ "liveness-container": "_liveness-container_qlen3_459",
18602
+ "processing-container": "_processing-container_qlen3_462",
18603
+ "processing-spinner": "_processing-spinner_qlen3_474",
18604
+ spin: spin$1,
18605
+ "MuiTab-root": "_MuiTab-root_qlen3_489",
18606
+ "Mui-selected": "_Mui-selected_qlen3_493",
18607
+ "MuiTabs-indicator": "_MuiTabs-indicator_qlen3_501"
18604
18608
  };
18605
18609
  var jsxRuntime = { exports: {} };
18606
18610
  var reactJsxRuntime_production_min = {};
@@ -38551,7 +38555,7 @@ function BlackList({
38551
38555
  listMatch,
38552
38556
  select,
38553
38557
  setSelect,
38554
- clearState: clearState2,
38558
+ clearState,
38555
38559
  countryCode
38556
38560
  } = BlackListController(clientId, authorize, inProduction, source2, eventId, countryCodeAllowed, validateVpn, successMessage, alertMessage, dataBlackList);
38557
38561
  return /* @__PURE__ */ jsxs("div", {
@@ -38576,7 +38580,7 @@ function BlackList({
38576
38580
  children: /* @__PURE__ */ jsxs("div", {
38577
38581
  className: styles$a.sub,
38578
38582
  children: [showBackButton(status) && /* @__PURE__ */ jsx$1(BackButton, {
38579
- action: clearState2
38583
+ action: clearState
38580
38584
  }), /* @__PURE__ */ jsxs("div", {
38581
38585
  className: styles$a["header-component"],
38582
38586
  children: [/* @__PURE__ */ jsx$1("h4", {
@@ -38647,9 +38651,9 @@ function BlackList({
38647
38651
  }), status !== status_country_not_allowed && status !== status_token && status !== status_client_id && status !== status_vpn && showFilterByButton ? /* @__PURE__ */ jsx$1(Box$1, {
38648
38652
  width: "100%",
38649
38653
  mt: 2,
38650
- children: clearState2 && Object.keys(listMatch).length > 0 && /* @__PURE__ */ jsx$1(CustomButton, {
38654
+ children: clearState && Object.keys(listMatch).length > 0 && /* @__PURE__ */ jsx$1(CustomButton, {
38651
38655
  className: "my-1 col-12",
38652
- onClick: clearState2,
38656
+ onClick: clearState,
38653
38657
  children: "Filtrar por"
38654
38658
  })
38655
38659
  }) : null]
@@ -38693,7 +38697,7 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
38693
38697
  }
38694
38698
  countryCodeAllowed && geolocation && setCountryCode(geolocation == null ? void 0 : geolocation.data_connection.isocode);
38695
38699
  }, [geolocation, countryCodeAllowed]);
38696
- const clearState2 = () => {
38700
+ const clearState = () => {
38697
38701
  setDualMode(dualModeRequired);
38698
38702
  setBase64({});
38699
38703
  setStatus("");
@@ -38809,7 +38813,7 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
38809
38813
  message,
38810
38814
  base64,
38811
38815
  setBase64,
38812
- clearState: clearState2,
38816
+ clearState,
38813
38817
  countryCode,
38814
38818
  dualMode,
38815
38819
  setDualMode,
@@ -42657,7 +42661,7 @@ const V2OcrComponent = ({
42657
42661
  });
42658
42662
  };
42659
42663
  const name = "gbc-kyc-kit";
42660
- const version = "3.4.5";
42664
+ const version = "3.4.6";
42661
42665
  const description = "Componentes para el desarrollo de un Onboarding";
42662
42666
  const license = "MIT";
42663
42667
  const author = "Global Bridge Connections";
@@ -42803,7 +42807,7 @@ function DocumentReader({
42803
42807
  isLoading,
42804
42808
  status,
42805
42809
  message,
42806
- clearState: clearState2,
42810
+ clearState,
42807
42811
  countryCode,
42808
42812
  setBase64
42809
42813
  } = DocumentReaderController(dataDocument, clientId, authorize, eventId, source2, inProduction, countryCodeAllowed, validateVpn, successMessage, dualModeRequired);
@@ -42848,7 +42852,7 @@ function DocumentReader({
42848
42852
  dualModeRequired
42849
42853
  }), (source2 !== "secure_link" || validateErrorMessageOCR(message)) && showBackButton(status) && showBackButtonWhenError && /* @__PURE__ */ jsx$1(CustomButton, {
42850
42854
  type: "button",
42851
- onClick: clearState2,
42855
+ onClick: clearState,
42852
42856
  className: styles$a["px-2"],
42853
42857
  children: "Volver a intentar"
42854
42858
  })]
@@ -42887,7 +42891,7 @@ const fetchFaceMatch = async (faceMatch, selfie, inProduction, customHeaders) =>
42887
42891
  };
42888
42892
  try {
42889
42893
  const res = await request2(parseReq);
42890
- return res.data;
42894
+ return res.data.data;
42891
42895
  } catch (error2) {
42892
42896
  console.log(error2);
42893
42897
  throw error2;
@@ -42924,7 +42928,7 @@ const FaceMatchController = (dataFaceMatch, clientId, eventId, source2, authoriz
42924
42928
  }
42925
42929
  countryCodeAllowed && geolocation && setCountryCode(geolocation == null ? void 0 : geolocation.data_connection.isocode);
42926
42930
  }, [geolocation, countryCodeAllowed]);
42927
- const clearState2 = () => {
42931
+ const clearState = () => {
42928
42932
  setDocImage({});
42929
42933
  setStatus("");
42930
42934
  setMessage("");
@@ -43013,7 +43017,7 @@ const FaceMatchController = (dataFaceMatch, clientId, eventId, source2, authoriz
43013
43017
  docImage,
43014
43018
  status,
43015
43019
  message,
43016
- clearState: clearState2,
43020
+ clearState,
43017
43021
  webcamRef,
43018
43022
  url,
43019
43023
  setUrl,
@@ -43438,7 +43442,7 @@ function FaceMatch({
43438
43442
  docImage,
43439
43443
  status,
43440
43444
  message,
43441
- clearState: clearState2,
43445
+ clearState,
43442
43446
  capturePhoto,
43443
43447
  webcamRef,
43444
43448
  url,
@@ -43475,7 +43479,7 @@ function FaceMatch({
43475
43479
  children: /* @__PURE__ */ jsxs("div", {
43476
43480
  className: styles$a.sub,
43477
43481
  children: [showBackButton(status) && /* @__PURE__ */ jsx$1(BackButton, {
43478
- action: clearState2
43482
+ action: clearState
43479
43483
  }), /* @__PURE__ */ jsxs("div", {
43480
43484
  className: styles$a["header-component"],
43481
43485
  children: [/* @__PURE__ */ jsx$1("h4", {
@@ -43578,176 +43582,6 @@ FaceMatch.propTypes = {
43578
43582
  validateVpn: propTypes.exports.PropTypes.bool,
43579
43583
  successMessage: propTypes.exports.PropTypes.string
43580
43584
  };
43581
- const LivenessController = (clientId, eventId, source2, inProduction, countryCodeAllowed, faceMatch, dataLiveness, validateVpn, successMessage) => {
43582
- const [isLoading, setIsLoading] = useState(false);
43583
- const [token2, setToken] = useState("");
43584
- const [status, setStatus] = useState(clientId === void 0 ? status_client_id : token2 === void 0 ? status_token : "");
43585
- const [message, setMessage] = useState("");
43586
- const [countryCode, setCountryCode] = useState(null);
43587
- const geolocation = useGeolocation(inProduction);
43588
- const [data2, setData] = useState({});
43589
- const [similarity, setSimilarity] = useState(0);
43590
- const [failLiveness, setFailLiveness] = useState(false);
43591
- const [completed, setCompleted] = useState(false);
43592
- const [dataFailLiveness, setDataFailLiveness] = useState({});
43593
- const listener = (event) => {
43594
- var _a, _b;
43595
- if (event.detail) {
43596
- if (event.detail.action === "PROCESS_FINISHED") {
43597
- if (((_b = (_a = event.detail.data) == null ? void 0 : _a.response) == null ? void 0 : _b.code) == 0) {
43598
- setData(event.detail.data.response);
43599
- } else if (!failLiveness) {
43600
- setFailLiveness(true);
43601
- setDataFailLiveness(event);
43602
- }
43603
- }
43604
- }
43605
- };
43606
- useEffect(() => {
43607
- var _a, _b, _c, _d;
43608
- if (failLiveness) {
43609
- saveDataToDB({
43610
- data: {
43611
- first_image: ((_b = (_a = dataFailLiveness.detail.data) == null ? void 0 : _a.response) == null ? void 0 : _b.images) ? "data:image/jpeg;base64," + dataFailLiveness.detail.data.response.images[0] : null,
43612
- face_result_code: ((_d = (_c = dataFailLiveness.detail.data) == null ? void 0 : _c.response) == null ? void 0 : _d.code) ? dataFailLiveness.detail.data.response.code : 250
43613
- },
43614
- component: "liveness",
43615
- eventId,
43616
- source: source2,
43617
- inProduction,
43618
- clientId,
43619
- geolocation
43620
- }).then((res) => {
43621
- dataLiveness({
43622
- countAttempts: res.count_try,
43623
- error: true
43624
- });
43625
- setFailLiveness(false);
43626
- setDataFailLiveness({});
43627
- });
43628
- }
43629
- }, [failLiveness]);
43630
- useEffect(() => {
43631
- if (countryCodeAllowed && (geolocation == null ? void 0 : geolocation.data_connection.isocode)) {
43632
- if (countryCodeAllowed.length !== 0 && !countryCodeAllowed.some((item) => item === (geolocation == null ? void 0 : geolocation.data_connection.isocode))) {
43633
- setStatus(status_country_not_allowed);
43634
- setMessage(country_not_authorized);
43635
- }
43636
- }
43637
- if (validateVpn && (geolocation == null ? void 0 : geolocation.data_connection.proxy) == response_of_check_ip_use_vpn) {
43638
- setStatus(status_vpn);
43639
- setMessage(vpn_not_authorized);
43640
- }
43641
- countryCodeAllowed && geolocation && setCountryCode(geolocation == null ? void 0 : geolocation.data_connection.isocode);
43642
- }, [geolocation, countryCodeAllowed]);
43643
- const clearState2 = () => {
43644
- setStatus("");
43645
- setMessage("");
43646
- setIsLoading(false);
43647
- setCompleted(false);
43648
- };
43649
- useEffect(() => {
43650
- if (!lib(data2)) {
43651
- onSendSubmitLiveness();
43652
- }
43653
- }, [data2]);
43654
- const onSendSubmitLiveness = async () => {
43655
- var _a;
43656
- try {
43657
- const customHeaders = {
43658
- client_id: clientId,
43659
- access_token: token2
43660
- };
43661
- try {
43662
- faceMatch ? await fetchFaceMatch(faceMatch, `data:image/jpeg;base64,${data2.images[0]}`, inProduction, customHeaders).then((res) => {
43663
- setSimilarity(res.data.similarity);
43664
- setMessage(successMessage ? successMessage : "Verificaci\xF3n de identidad completada");
43665
- saveDataToDB({
43666
- data: {
43667
- similarity: res.data.similarity,
43668
- first_image: `data:image/jpeg;base64,${data2.images[0]}`,
43669
- second_image: faceMatch,
43670
- status_code: 200
43671
- },
43672
- component: "facematch",
43673
- eventId,
43674
- source: source2,
43675
- inProduction,
43676
- clientId,
43677
- geolocation
43678
- });
43679
- }) : wrapAndSaveData();
43680
- } catch (error2) {
43681
- let message2 = "";
43682
- const {
43683
- status: status2
43684
- } = (_a = error2 == null ? void 0 : error2.response) != null ? _a : {
43685
- status: "Error desconocido"
43686
- };
43687
- saveDataToDB({
43688
- data: {
43689
- similarity: 0,
43690
- first_image: `data:image/jpeg;base64,${data2.images[0]}`,
43691
- second_image: faceMatch,
43692
- status_code: status2
43693
- },
43694
- component: "facematch",
43695
- eventId,
43696
- source: source2,
43697
- inProduction,
43698
- clientId,
43699
- geolocation
43700
- });
43701
- if (status2 === 500) {
43702
- message2 = limit_of_request;
43703
- }
43704
- setMessage(message2);
43705
- setStatus(status2);
43706
- ErrorHandler(error2);
43707
- }
43708
- } catch (error2) {
43709
- Q.error("Error - Verificar host con el proveedor");
43710
- }
43711
- };
43712
- useEffect(() => {
43713
- similarity !== 0 && wrapAndSaveData();
43714
- }, [similarity]);
43715
- const wrapAndSaveData = async () => {
43716
- try {
43717
- await saveDataToDB({
43718
- data: {
43719
- selfie: `data:image/jpeg;base64,${data2.images[0]}`,
43720
- similarity: faceMatch ? similarity : null,
43721
- face_result_code: 0
43722
- },
43723
- component: "liveness",
43724
- eventId,
43725
- source: source2,
43726
- inProduction,
43727
- clientId,
43728
- geolocation
43729
- }).then((res) => dataLiveness(res));
43730
- } catch (errorSavingData) {
43731
- return errorSavingData;
43732
- }
43733
- };
43734
- return {
43735
- status,
43736
- isLoading,
43737
- listener,
43738
- onSendSubmitLiveness,
43739
- clearState: clearState2,
43740
- message,
43741
- countryCode,
43742
- setToken,
43743
- data: data2,
43744
- similarity,
43745
- setIsLoading,
43746
- setMessage,
43747
- setCompleted,
43748
- completed
43749
- };
43750
- };
43751
43585
  /**
43752
43586
  * Didit SDK for Web v0.1.8
43753
43587
  * (c) 2026 Didit
@@ -45000,89 +44834,328 @@ class DiditSdk {
45000
44834
  }
45001
44835
  }
45002
44836
  DiditSdk._instance = null;
44837
+ const getLivenessSessionUrlService = async (workflowId, inProduction, clientId, accessToken2) => {
44838
+ const customHeaders = { "access_token": accessToken2, "client_id": clientId };
44839
+ const parseReq = {
44840
+ method: "POST",
44841
+ path: "api/v1/onboarding/liveness/session",
44842
+ inProduction,
44843
+ customHeaders,
44844
+ service: "services",
44845
+ bodyParams: {
44846
+ workflow_id: workflowId
44847
+ }
44848
+ };
44849
+ try {
44850
+ const res = await request2(parseReq);
44851
+ return res.data.data;
44852
+ } catch (error2) {
44853
+ console.log(error2);
44854
+ return error2;
44855
+ }
44856
+ };
44857
+ const getDataLivenessService = async (sessionId, inProduction, clientId, accessToken2) => {
44858
+ const customHeaders = { "access_token": accessToken2, "client_id": clientId };
44859
+ const parseReq = {
44860
+ method: "POST",
44861
+ path: "api/v1/onboarding/liveness/result",
44862
+ inProduction,
44863
+ customHeaders,
44864
+ service: "services",
44865
+ bodyParams: {
44866
+ session_id: sessionId
44867
+ }
44868
+ };
44869
+ try {
44870
+ const res = await request2(parseReq);
44871
+ return res.data.data;
44872
+ } catch (error2) {
44873
+ console.log(error2);
44874
+ return error2;
44875
+ }
44876
+ };
44877
+ const LivenessController = (dataLiveness, clientId, authorize, eventId, source2, inProduction, countryCodeAllowed, faceMatch, validateVpn, successMessage, workflowId) => {
44878
+ const [isLoading, setIsLoading] = useState(false);
44879
+ const [token2, setToken] = useState("");
44880
+ const [status, setStatus] = useState(clientId === void 0 ? status_client_id : token2 === void 0 ? status_token : "");
44881
+ const [message, setMessage] = useState("");
44882
+ const [countryCode, setCountryCode] = useState(null);
44883
+ const geolocation = useGeolocation(inProduction);
44884
+ const [data2, setData] = useState({});
44885
+ const [similarity, setSimilarity] = useState(0);
44886
+ const [failLiveness, setFailLiveness] = useState(false);
44887
+ const [completed, setCompleted] = useState(false);
44888
+ const [dataFailLiveness, setDataFailLiveness] = useState({});
44889
+ useEffect(() => {
44890
+ var _a, _b, _c, _d;
44891
+ if (failLiveness) {
44892
+ saveDataToDB({
44893
+ data: {
44894
+ first_image: ((_b = (_a = dataFailLiveness.detail.data) == null ? void 0 : _a.response) == null ? void 0 : _b.images) ? "data:image/jpeg;base64," + dataFailLiveness.detail.data.response.images[0] : null,
44895
+ face_result_code: ((_d = (_c = dataFailLiveness.detail.data) == null ? void 0 : _c.response) == null ? void 0 : _d.code) ? dataFailLiveness.detail.data.response.code : 250
44896
+ },
44897
+ component: "liveness",
44898
+ eventId,
44899
+ source: source2,
44900
+ inProduction,
44901
+ clientId,
44902
+ geolocation
44903
+ }).then((res) => {
44904
+ dataLiveness({
44905
+ countAttempts: res.count_try,
44906
+ error: true
44907
+ });
44908
+ setFailLiveness(false);
44909
+ setDataFailLiveness({});
44910
+ });
44911
+ }
44912
+ }, [failLiveness]);
44913
+ useEffect(() => {
44914
+ if (countryCodeAllowed && (geolocation == null ? void 0 : geolocation.data_connection.isocode)) {
44915
+ if (countryCodeAllowed.length !== 0 && !countryCodeAllowed.some((item) => item === (geolocation == null ? void 0 : geolocation.data_connection.isocode))) {
44916
+ setStatus(status_country_not_allowed);
44917
+ setMessage(country_not_authorized);
44918
+ }
44919
+ }
44920
+ if (validateVpn && (geolocation == null ? void 0 : geolocation.data_connection.proxy) == response_of_check_ip_use_vpn) {
44921
+ setStatus(status_vpn);
44922
+ setMessage(vpn_not_authorized);
44923
+ }
44924
+ countryCodeAllowed && geolocation && setCountryCode(geolocation == null ? void 0 : geolocation.data_connection.isocode);
44925
+ }, [geolocation, countryCodeAllowed]);
44926
+ const clearState = () => {
44927
+ setStatus("");
44928
+ setMessage("");
44929
+ setIsLoading(false);
44930
+ setCompleted(false);
44931
+ };
44932
+ async function getDiditSessionUrl(workflowId2, inProduction2, accessToken2) {
44933
+ const url = await getLivenessSessionUrlService(workflowId2, inProduction2, clientId, accessToken2);
44934
+ return url;
44935
+ }
44936
+ async function getDataLiveness(sessionId, inProduction2, clientId2, dataLiveness2, facematch) {
44937
+ var _a, _b, _c;
44938
+ const accessToken2 = await authorize();
44939
+ const customHeaders = {
44940
+ client_id: clientId2,
44941
+ access_token: accessToken2
44942
+ };
44943
+ let livenessImage = null;
44944
+ try {
44945
+ const data22 = await getDataLivenessService(sessionId, inProduction2, clientId2, accessToken2);
44946
+ livenessImage = (_c = (_b = (_a = data22.liveness_checks) == null ? void 0 : _a[0]) == null ? void 0 : _b.reference_image) != null ? _c : null;
44947
+ const livenessRes = await saveDataToDB({
44948
+ data: {
44949
+ selfie: livenessImage,
44950
+ similarity: null,
44951
+ face_result_code: livenessImage ? 0 : 500
44952
+ },
44953
+ component: "liveness",
44954
+ eventId,
44955
+ source: source2,
44956
+ inProduction: inProduction2,
44957
+ clientId: clientId2,
44958
+ geolocation
44959
+ });
44960
+ dataLiveness2(livenessRes);
44961
+ } catch (error2) {
44962
+ console.log(error2);
44963
+ const livenessRes = await saveDataToDB({
44964
+ data: {
44965
+ selfie: null,
44966
+ similarity: null,
44967
+ face_result_code: 500
44968
+ },
44969
+ component: "liveness",
44970
+ eventId,
44971
+ source: source2,
44972
+ inProduction: inProduction2,
44973
+ clientId: clientId2,
44974
+ geolocation
44975
+ });
44976
+ dataLiveness2(livenessRes);
44977
+ return;
44978
+ }
44979
+ if (facematch && livenessImage) {
44980
+ try {
44981
+ const dataFaceMatch = await fetchFaceMatch(facematch, livenessImage, inProduction2, customHeaders);
44982
+ await saveDataToDB({
44983
+ data: {
44984
+ first_image: facematch,
44985
+ second_image: livenessImage,
44986
+ similarity: dataFaceMatch.similarity.toFixed(2),
44987
+ status_code: 200
44988
+ },
44989
+ component: "facematch",
44990
+ eventId,
44991
+ source: source2,
44992
+ inProduction: inProduction2,
44993
+ clientId: clientId2,
44994
+ geolocation
44995
+ });
44996
+ } catch (error2) {
44997
+ console.log(error2);
44998
+ await saveDataToDB({
44999
+ data: {
45000
+ first_image: facematch,
45001
+ second_image: livenessImage,
45002
+ similarity: 0,
45003
+ status_code: 500
45004
+ },
45005
+ component: "facematch",
45006
+ eventId,
45007
+ source: source2,
45008
+ inProduction: inProduction2,
45009
+ clientId: clientId2,
45010
+ geolocation
45011
+ });
45012
+ }
45013
+ }
45014
+ }
45015
+ return {
45016
+ status,
45017
+ isLoading,
45018
+ clearState,
45019
+ message,
45020
+ countryCode,
45021
+ setToken,
45022
+ data: data2,
45023
+ similarity,
45024
+ setIsLoading,
45025
+ setMessage,
45026
+ setCompleted,
45027
+ completed,
45028
+ getDiditSessionUrl,
45029
+ getDataLiveness
45030
+ };
45031
+ };
45032
+ const DIDIT_CONTAINER_ID$1 = "didit-liveness-container";
45003
45033
  function LivenessCheck({
45004
45034
  mode = "light",
45035
+ dataLiveness,
45005
45036
  clientId,
45037
+ authorize,
45006
45038
  eventId = null,
45007
45039
  source: source2 = "component",
45008
- authorize,
45009
45040
  inProduction = "prd",
45010
45041
  countryCodeAllowed = null,
45011
45042
  faceMatch = null,
45012
- dataLiveness,
45013
45043
  validateVpn = false,
45014
- successMessage
45044
+ successMessage,
45045
+ workflowId
45015
45046
  }) {
45016
45047
  const containerRef = useRef(null);
45048
+ const [isLoading, setIsLoading] = useState(false);
45049
+ const [isProcessing, setIsProcessing] = useState(false);
45050
+ const [status, setStatus] = useState(clientId === void 0 ? status_client_id : "");
45051
+ const [message, setMessage] = useState("");
45052
+ const [completed, setCompleted] = useState(false);
45053
+ const [countryCode, setCountryCode] = useState(null);
45054
+ const [started, setStarted] = useState(false);
45055
+ const [sessionUrl, setSessionUrl] = useState(null);
45056
+ const geolocation = useGeolocation(inProduction);
45017
45057
  const {
45018
- status,
45019
- isLoading,
45020
- setIsLoading,
45021
- setMessage,
45022
- completed,
45023
- setCompleted,
45024
- message,
45025
- countryCode
45026
- } = LivenessController(clientId, eventId, source2, inProduction, countryCodeAllowed, faceMatch, dataLiveness, validateVpn, successMessage);
45027
- const DIDIT_CONTAINER_ID2 = "didit-liveness-container";
45058
+ getDiditSessionUrl,
45059
+ getDataLiveness
45060
+ } = LivenessController(dataLiveness, clientId, authorize, eventId, source2, inProduction, countryCodeAllowed, faceMatch, validateVpn);
45028
45061
  useEffect(() => {
45029
- if (clientId === void 0)
45062
+ if (countryCodeAllowed && (geolocation == null ? void 0 : geolocation.data_connection.isocode)) {
45063
+ if (countryCodeAllowed.length !== 0 && !countryCodeAllowed.some((item) => item === (geolocation == null ? void 0 : geolocation.data_connection.isocode))) {
45064
+ setStatus(status_country_not_allowed);
45065
+ setMessage(country_not_authorized);
45066
+ }
45067
+ }
45068
+ if (validateVpn && (geolocation == null ? void 0 : geolocation.data_connection.proxy) == response_of_check_ip_use_vpn) {
45069
+ setStatus(status_vpn);
45070
+ setMessage(vpn_not_authorized);
45071
+ }
45072
+ countryCodeAllowed && geolocation && setCountryCode(geolocation == null ? void 0 : geolocation.data_connection.isocode);
45073
+ }, [geolocation, countryCodeAllowed]);
45074
+ useEffect(() => {
45075
+ if (!started || !sessionUrl)
45030
45076
  return;
45031
- setIsLoading(true);
45032
45077
  DiditSdk.shared.onStateChange = (state, error2) => {
45033
45078
  if (state === "error") {
45034
- setIsLoading(false);
45035
- toast.error(error2 || "Error en la verificaci\xF3n");
45079
+ Q.error(error2 || "Error en la verificaci\xF3n");
45036
45080
  }
45037
45081
  };
45038
- DiditSdk.shared.onComplete = (result) => {
45039
- var _a, _b, _c, _d, _e;
45082
+ DiditSdk.shared.onComplete = async (result) => {
45083
+ var _a, _b, _c, _d;
45040
45084
  if (result.type === "completed") {
45041
45085
  const successMsg = successMessage || "Verificaci\xF3n de identidad completada";
45086
+ setIsProcessing(true);
45087
+ await getDataLiveness((_a = result.session) == null ? void 0 : _a.sessionId, inProduction, clientId, dataLiveness, faceMatch);
45088
+ setIsProcessing(false);
45042
45089
  setMessage(successMsg);
45043
45090
  setCompleted(true);
45044
- dataLiveness({
45045
- sessionId: (_a = result.session) == null ? void 0 : _a.sessionId,
45046
- status: (_b = result.session) == null ? void 0 : _b.status,
45047
- error: false
45048
- });
45049
45091
  } else if (result.type === "cancelled") {
45050
45092
  dataLiveness({
45051
- sessionId: (_c = result.session) == null ? void 0 : _c.sessionId,
45093
+ sessionId: (_b = result.session) == null ? void 0 : _b.sessionId,
45052
45094
  cancelled: true,
45053
45095
  error: false
45054
45096
  });
45055
45097
  } else if (result.type === "failed") {
45056
- toast.error(((_d = result.error) == null ? void 0 : _d.message) || "Error en la verificaci\xF3n");
45098
+ Q.error(((_c = result.error) == null ? void 0 : _c.message) || "Error en la verificaci\xF3n");
45057
45099
  dataLiveness({
45058
- errorType: (_e = result.error) == null ? void 0 : _e.type,
45100
+ errorType: (_d = result.error) == null ? void 0 : _d.type,
45059
45101
  error: true
45060
45102
  });
45061
45103
  }
45062
45104
  };
45063
- authorize().then((url) => {
45064
- setIsLoading(false);
45065
- DiditSdk.shared.startVerification({
45066
- url,
45067
- configuration: {
45068
- embedded: true,
45069
- embeddedContainerId: DIDIT_CONTAINER_ID2,
45070
- showCloseButton: false,
45071
- showExitConfirmation: false,
45072
- closeModalOnComplete: true
45073
- }
45074
- });
45075
- }).catch(() => {
45076
- setIsLoading(false);
45077
- toast.error("Error al iniciar la verificaci\xF3n");
45105
+ DiditSdk.shared.startVerification({
45106
+ url: sessionUrl,
45107
+ configuration: {
45108
+ embedded: true,
45109
+ embeddedContainerId: DIDIT_CONTAINER_ID$1,
45110
+ showCloseButton: false,
45111
+ showExitConfirmation: false,
45112
+ closeModalOnComplete: true
45113
+ }
45078
45114
  });
45115
+ }, [started, sessionUrl]);
45116
+ useEffect(() => {
45079
45117
  return () => {
45080
45118
  DiditSdk.shared.destroy();
45081
45119
  };
45082
45120
  }, []);
45121
+ useEffect(() => {
45122
+ if (!lib(status))
45123
+ return;
45124
+ if (countryCodeAllowed !== null && !countryCode)
45125
+ return;
45126
+ if (started || sessionUrl)
45127
+ return;
45128
+ handleStart();
45129
+ }, [countryCode, status]);
45130
+ const handleStart = async () => {
45131
+ setIsLoading(true);
45132
+ try {
45133
+ const token2 = await authorize();
45134
+ console.log("token", token2);
45135
+ const {
45136
+ url
45137
+ } = await getDiditSessionUrl(workflowId, inProduction, token2);
45138
+ setSessionUrl(url);
45139
+ setStarted(true);
45140
+ console.log("url", url);
45141
+ } catch (e2) {
45142
+ console.log(e2);
45143
+ Q.error("Error al iniciar la verificaci\xF3n");
45144
+ } finally {
45145
+ setIsLoading(false);
45146
+ }
45147
+ };
45148
+ const clearState = () => {
45149
+ setStatus("");
45150
+ setMessage("");
45151
+ setCompleted(false);
45152
+ setStarted(false);
45153
+ setSessionUrl(null);
45154
+ DiditSdk.shared.destroy();
45155
+ };
45083
45156
  return /* @__PURE__ */ jsxs("div", {
45084
45157
  ref: containerRef,
45085
- className: `${styles$a["kit-gbc"]} ${styles$a["liveness-container"]} ${styles$a[mode]} ${status === "NOT_VERIFY" && styles$a.error}`,
45158
+ className: `${styles$a["kit-gbc"]} ${styles$a["liveness-container"]} ${styles$a[mode]}`,
45086
45159
  children: [/* @__PURE__ */ jsx$1(k$2, {
45087
45160
  className: "kit-gbc-toastify-container",
45088
45161
  position: "top-center",
@@ -45096,27 +45169,49 @@ function LivenessCheck({
45096
45169
  pauseOnHover: true
45097
45170
  }), isLoading || countryCodeAllowed !== null && !countryCode ? /* @__PURE__ */ jsx$1(BackDropLoader, {}) : null, !lib(status) ? /* @__PURE__ */ jsxs("div", {
45098
45171
  className: styles$a.sub,
45099
- children: [showBackButton(status) && /* @__PURE__ */ jsx$1(BackButton, {
45172
+ children: [/* @__PURE__ */ jsx$1(BackButton, {
45100
45173
  action: clearState
45101
45174
  }), /* @__PURE__ */ jsx$1("h4", {
45102
- children: "Verificaci\xF3n liveness"
45175
+ children: "Verificaci\xF3n liveness."
45103
45176
  }), /* @__PURE__ */ jsx$1(StatusComponent, {
45104
45177
  status,
45105
45178
  message
45106
45179
  })]
45180
+ }) : isProcessing ? /* @__PURE__ */ jsxs("div", {
45181
+ className: styles$a.sub,
45182
+ children: [/* @__PURE__ */ jsx$1("h4", {
45183
+ children: "Verificaci\xF3n liveness"
45184
+ }), /* @__PURE__ */ jsxs("div", {
45185
+ className: styles$a["processing-container"],
45186
+ children: [/* @__PURE__ */ jsx$1("div", {
45187
+ className: styles$a["processing-spinner"]
45188
+ }), /* @__PURE__ */ jsx$1("p", {
45189
+ children: "Procesando verificaci\xF3n..."
45190
+ })]
45191
+ })]
45107
45192
  }) : completed ? /* @__PURE__ */ jsx$1("div", {
45108
45193
  className: styles$a.sub,
45109
45194
  children: /* @__PURE__ */ jsx$1(SuccessAnimation, {
45110
45195
  message
45111
45196
  })
45112
- }) : /* @__PURE__ */ jsx$1("div", {
45113
- id: DIDIT_CONTAINER_ID2,
45114
- className: styles$a.liveness,
45197
+ }) : /* @__PURE__ */ jsxs("div", {
45115
45198
  style: {
45116
- width: "100%",
45117
- height: "100%",
45118
- minHeight: "600px"
45119
- }
45199
+ width: "100%"
45200
+ },
45201
+ children: [!started && /* @__PURE__ */ jsx$1("div", {
45202
+ className: styles$a.sub,
45203
+ children: /* @__PURE__ */ jsx$1("h4", {
45204
+ children: "Verificaci\xF3n liveness"
45205
+ })
45206
+ }), /* @__PURE__ */ jsx$1("div", {
45207
+ id: DIDIT_CONTAINER_ID$1,
45208
+ className: styles$a.liveness,
45209
+ style: {
45210
+ width: "100%",
45211
+ height: "100%",
45212
+ minHeight: started ? "600px" : "0px"
45213
+ }
45214
+ })]
45120
45215
  })]
45121
45216
  });
45122
45217
  }
@@ -45124,14 +45219,15 @@ LivenessCheck.propTypes = {
45124
45219
  mode: propTypes.exports.PropTypes.string,
45125
45220
  clientId: propTypes.exports.PropTypes.string.isRequired,
45126
45221
  authorize: propTypes.exports.PropTypes.func.isRequired,
45222
+ dataLiveness: propTypes.exports.PropTypes.func,
45127
45223
  inProduction: propTypes.exports.PropTypes.string,
45128
45224
  countryCodeAllowed: propTypes.exports.PropTypes.array,
45129
- eventId: propTypes.exports.PropTypes.string,
45130
45225
  source: propTypes.exports.PropTypes.string,
45226
+ eventId: propTypes.exports.PropTypes.string,
45131
45227
  faceMatch: propTypes.exports.PropTypes.string,
45132
- dataLiveness: propTypes.exports.PropTypes.func.isRequired,
45133
45228
  validateVpn: propTypes.exports.PropTypes.bool,
45134
- successMessage: propTypes.exports.PropTypes.string
45229
+ successMessage: propTypes.exports.PropTypes.string,
45230
+ workflowId: propTypes.exports.PropTypes.string.isRequired
45135
45231
  };
45136
45232
  const UploadIcon = () => {
45137
45233
  return /* @__PURE__ */ jsxs("svg", {
@@ -61300,7 +61396,7 @@ function BulkVerification({
61300
61396
  isLoading,
61301
61397
  status,
61302
61398
  message,
61303
- clearState: clearState2,
61399
+ clearState,
61304
61400
  countryCode,
61305
61401
  csvFile,
61306
61402
  handleFileUpload,
@@ -61331,7 +61427,7 @@ function BulkVerification({
61331
61427
  children: /* @__PURE__ */ jsxs("div", {
61332
61428
  className: styles$a.sub,
61333
61429
  children: [showBackButton(status) && /* @__PURE__ */ jsx$1(BackButton, {
61334
- action: clearState2
61430
+ action: clearState
61335
61431
  }), /* @__PURE__ */ jsxs("div", {
61336
61432
  className: styles$a["header-component"],
61337
61433
  children: [/* @__PURE__ */ jsx$1("h4", {
@@ -61496,7 +61592,7 @@ function LivenessCheckDidit({
61496
61592
  DiditSdk.shared.destroy();
61497
61593
  };
61498
61594
  }, []);
61499
- const clearState2 = () => {
61595
+ const clearState = () => {
61500
61596
  setStatus("");
61501
61597
  setMessage("");
61502
61598
  setCompleted(false);
@@ -61520,7 +61616,7 @@ function LivenessCheckDidit({
61520
61616
  }), isLoading && /* @__PURE__ */ jsx$1(BackDropLoader, {}), !lib(status) ? /* @__PURE__ */ jsxs("div", {
61521
61617
  className: styles$a.sub,
61522
61618
  children: [/* @__PURE__ */ jsx$1(BackButton, {
61523
- action: clearState2
61619
+ action: clearState
61524
61620
  }), /* @__PURE__ */ jsx$1("h4", {
61525
61621
  children: "Verificaci\xF3n liveness"
61526
61622
  }), /* @__PURE__ */ jsx$1(StatusComponent, {