gbc-kyc-kit 2.3.18 → 2.4.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.
@@ -18183,7 +18183,6 @@ const BlackListController = (clientId, authorize, inProduction, source2, eventId
18183
18183
  const [csvFile, setCsvFile] = useState(null);
18184
18184
  const fileInputRef = useRef(null);
18185
18185
  const [batchData, setBatchData] = useState({});
18186
- console.log(countryCodeAllowed);
18187
18186
  useEffect(() => {
18188
18187
  if (countryCodeAllowed && (geolocation == null ? void 0 : geolocation.data_connection.isocode)) {
18189
18188
  if (countryCodeAllowed.length !== 0 && !countryCodeAllowed.some((item) => item.value === (geolocation == null ? void 0 : geolocation.data_connection.isocode))) {
@@ -18487,10 +18486,11 @@ function CustomButton({
18487
18486
  id,
18488
18487
  onClick,
18489
18488
  children,
18490
- href
18489
+ href,
18490
+ className
18491
18491
  }) {
18492
18492
  return /* @__PURE__ */ jsx$1("div", {
18493
- className: `button-container m-0 mt-2 testing`,
18493
+ className: `button-container m-0 ${className}`,
18494
18494
  children: /* @__PURE__ */ jsx$1("button", {
18495
18495
  type,
18496
18496
  name,
@@ -18504,14 +18504,16 @@ function CustomButton({
18504
18504
  CustomButton.defautProps = {
18505
18505
  type: "button",
18506
18506
  name: "",
18507
- id: ""
18507
+ id: "",
18508
+ className: ""
18508
18509
  };
18509
18510
  CustomButton.propTypes = {
18510
18511
  type: propTypes.exports.PropTypes.string,
18511
18512
  name: propTypes.exports.PropTypes.string,
18512
18513
  id: propTypes.exports.PropTypes.string,
18513
18514
  href: propTypes.exports.PropTypes.string,
18514
- children: propTypes.exports.PropTypes.node.isRequired
18515
+ children: propTypes.exports.PropTypes.node.isRequired,
18516
+ className: propTypes.exports.PropTypes.string
18515
18517
  };
18516
18518
  var __assign = function() {
18517
18519
  __assign = Object.assign || function __assign2(t2) {
@@ -39016,6 +39018,11 @@ const showBackButton = (status) => {
39016
39018
  var ArrowBack = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
39017
39019
  d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"
39018
39020
  }), "ArrowBack");
39021
+ var Cameraswitch = createSvgIcon([/* @__PURE__ */ jsx$1("path", {
39022
+ d: "M16 7h-1l-1-1h-4L9 7H8c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2m-4 7c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"
39023
+ }, "0"), /* @__PURE__ */ jsx$1("path", {
39024
+ d: "m8.57.51 4.48 4.48V2.04c4.72.47 8.48 4.23 8.95 8.95h2C23.34 3.02 15.49-1.59 8.57.51m2.38 21.45c-4.72-.47-8.48-4.23-8.95-8.95H0c.66 7.97 8.51 12.58 15.43 10.48l-4.48-4.48z"
39025
+ }, "1")], "Cameraswitch");
39019
39026
  var CloudUploadIcon = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
39020
39027
  d: "M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l5-5 5 5z"
39021
39028
  }), "CloudUpload");
@@ -39028,6 +39035,9 @@ var CompareArrowsIcon = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
39028
39035
  var ContentCopy = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
39029
39036
  d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"
39030
39037
  }), "ContentCopy");
39038
+ var Delete = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
39039
+ d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"
39040
+ }), "Delete");
39031
39041
  var ImageNotSupportedIcon = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
39032
39042
  d: "m21.9 21.9-8.49-8.49-9.82-9.82L2.1 2.1.69 3.51 3 5.83V19c0 1.1.9 2 2 2h13.17l2.31 2.31zM5 18l3.5-4.5 2.5 3.01L12.17 15l3 3zm16 .17L5.83 3H19c1.1 0 2 .9 2 2z"
39033
39043
  }), "ImageNotSupported");
@@ -39037,9 +39047,6 @@ var LightMode = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
39037
39047
  var SettingsBrightness = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
39038
39048
  d: "M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16.01H3V4.99h18zM8 16h2.5l1.5 1.5 1.5-1.5H16v-2.5l1.5-1.5-1.5-1.5V8h-2.5L12 6.5 10.5 8H8v2.5L6.5 12 8 13.5zm4-7c1.66 0 3 1.34 3 3s-1.34 3-3 3z"
39039
39049
  }), "SettingsBrightness");
39040
- var Spellcheck = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
39041
- d: "M12.45 16h2.09L9.43 3H7.57L2.46 16h2.09l1.12-3h5.64zm-6.02-5L8.5 5.48 10.57 11zm15.16.59-8.09 8.09L9.83 16l-1.41 1.41 5.09 5.09L23 13z"
39042
- }), "Spellcheck");
39043
39050
  var ZoomInTwoTone = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
39044
39051
  d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14m.5-7H9v2H7v1h2v2h1v-2h2V9h-2z"
39045
39052
  }), "ZoomInTwoTone");
@@ -39304,7 +39311,7 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
39304
39311
  ...error,
39305
39312
  countAttempts: data2.count_try
39306
39313
  });
39307
- if (error.response.data.code === "020")
39314
+ if (error.response.data.code === "020" && data2.count_try > 3)
39308
39315
  setUploadDocumentByPhone(true);
39309
39316
  if ((_a = error.response.data) == null ? void 0 : _a.message) {
39310
39317
  message2 = error.response.data.message;
@@ -39324,13 +39331,11 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
39324
39331
  setIsLoading(false);
39325
39332
  }
39326
39333
  };
39327
- console.log(uploadDocumentByPhone);
39328
39334
  const onUploadImage = async (side) => {
39329
39335
  const getImage = webcamRef.current.getScreenshot();
39330
39336
  const newImage = Object.assign(base64, {
39331
39337
  [side]: getImage
39332
39338
  });
39333
- console.log(newImage);
39334
39339
  setBase64(newImage);
39335
39340
  setActivateCamera(false);
39336
39341
  };
@@ -39338,7 +39343,6 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
39338
39343
  const newImage = Object.assign(base64, {
39339
39344
  [side]: image
39340
39345
  });
39341
- console.log(newImage);
39342
39346
  setBase64(newImage);
39343
39347
  setActivateCamera(false);
39344
39348
  };
@@ -39440,9 +39444,9 @@ const InstructionsComponent = ({
39440
39444
  })]
39441
39445
  }), /* @__PURE__ */ jsxs(ListItem$1, {
39442
39446
  children: [/* @__PURE__ */ jsx$1(ListItemIcon$1, {
39443
- children: /* @__PURE__ */ jsx$1(Spellcheck, {})
39447
+ children: /* @__PURE__ */ jsx$1(Cameraswitch, {})
39444
39448
  }), /* @__PURE__ */ jsx$1(ListItemText$1, {
39445
- primary: "Procura que el texto en el documento sea legible"
39449
+ primary: "Procura que el texto en el documento sea legible, sino prueba cambiando a otra c\xE1mara de tu dispositivo"
39446
39450
  })]
39447
39451
  })]
39448
39452
  })]
@@ -39456,29 +39460,42 @@ function UploadDocument2({
39456
39460
  streamRef,
39457
39461
  onTapToFocus,
39458
39462
  title,
39459
- subtitle
39463
+ subtitle,
39464
+ cameras,
39465
+ setCameras,
39466
+ currentCameraIndex
39460
39467
  }) {
39461
39468
  var _a;
39462
39469
  const nav = navigator;
39463
- const [cameras, setCameras] = useState([]);
39464
- const [currentCameraIndex, setCurrentCameraIndex] = useState(0);
39465
39470
  useEffect(() => {
39466
39471
  navigator.mediaDevices.enumerateDevices().then((devices) => {
39472
+ const keywordsBackCamera = ["back", "rear", "environment", "tr\xE1s", "trasera", "external", "secondary"];
39467
39473
  const videoDevices = devices.filter((device2) => device2.kind === "videoinput");
39468
- setCameras(videoDevices);
39474
+ const backCameras = videoDevices.filter((device2) => keywordsBackCamera.some((keyword) => device2.label.toLowerCase().includes(keyword)));
39475
+ if (backCameras.length > 0) {
39476
+ setCameras(backCameras);
39477
+ } else {
39478
+ setCameras(videoDevices);
39479
+ }
39469
39480
  }).catch((err) => console.error("Error obteniendo c\xE1maras:", err));
39470
39481
  }, []);
39471
39482
  useEffect(() => {
39472
39483
  if (activateCamera && videoRef.current && cameras.length > 0) {
39473
- cameras[currentCameraIndex];
39474
- const constraints = {
39484
+ const selectedCamera = cameras[currentCameraIndex];
39485
+ const constraints = selectedCamera ? {
39486
+ video: {
39487
+ deviceId: {
39488
+ exact: selectedCamera.deviceId
39489
+ },
39490
+ facingMode: "environment"
39491
+ },
39492
+ audio: false
39493
+ } : {
39475
39494
  video: {
39476
- facingMode: "environment",
39477
- focusMode: "continuous"
39495
+ facingMode: "environment"
39478
39496
  },
39479
39497
  audio: false
39480
39498
  };
39481
- console.log("Intentando usar constraints:", constraints);
39482
39499
  navigator.mediaDevices.getUserMedia(constraints).then((stream) => {
39483
39500
  videoRef.current.srcObject = stream;
39484
39501
  videoRef.current.play();
@@ -39497,9 +39514,6 @@ function UploadDocument2({
39497
39514
  }
39498
39515
  };
39499
39516
  }, [activateCamera, currentCameraIndex, cameras, videoConstraints]);
39500
- const handleSwitchCamera = () => {
39501
- setCurrentCameraIndex((prevIndex) => (prevIndex + 1) % cameras.length);
39502
- };
39503
39517
  (_a = nav.userAgentData) == null ? void 0 : _a.getHighEntropyValues(["model", "platform", "platformVersion", "architecture", "bitness", "fullVersionList"]).then((ua2) => console.log(ua2));
39504
39518
  return /* @__PURE__ */ jsx$1("div", {
39505
39519
  className: "drag-zone",
@@ -39515,8 +39529,8 @@ function UploadDocument2({
39515
39529
  display: "flex",
39516
39530
  justifyContent: "center",
39517
39531
  alignItems: "center",
39518
- children: activateCamera ? /* @__PURE__ */ jsxs(Box$1, {
39519
- children: [/* @__PURE__ */ jsx$1("video", {
39532
+ children: activateCamera ? /* @__PURE__ */ jsx$1(Box$1, {
39533
+ children: /* @__PURE__ */ jsx$1("video", {
39520
39534
  ref: videoRef,
39521
39535
  style: {
39522
39536
  width: "100%",
@@ -39532,18 +39546,7 @@ function UploadDocument2({
39532
39546
  playsInline: true,
39533
39547
  muted: true,
39534
39548
  autoPlay: true
39535
- }), cameras.length > 1 && /* @__PURE__ */ jsx$1(MUIButton, {
39536
- onClick: handleSwitchCamera,
39537
- variant: "contained",
39538
- size: "small",
39539
- style: {
39540
- position: "absolute",
39541
- top: 10,
39542
- right: 10,
39543
- zIndex: 2
39544
- },
39545
- children: "Cambiar c\xE1mara"
39546
- })]
39549
+ })
39547
39550
  }) : /* @__PURE__ */ jsx$1(InstructionsComponent, {
39548
39551
  title,
39549
39552
  subtitle
@@ -39702,6 +39705,8 @@ function SideDocsSelector({
39702
39705
  const [value, setValue] = React$2.useState(0);
39703
39706
  const [showZoom, setShowZoom] = React$2.useState(false);
39704
39707
  const [hideCaptureButton, setHideCaptureButton] = useState(false);
39708
+ const [cameras, setCameras] = useState([]);
39709
+ const [currentCameraIndex, setCurrentCameraIndex] = useState(0);
39705
39710
  const handleChange = (event, newValue) => {
39706
39711
  setValue(newValue);
39707
39712
  };
@@ -39795,6 +39800,9 @@ function SideDocsSelector({
39795
39800
  setHideCaptureButton(false);
39796
39801
  setActivateCamera(true);
39797
39802
  };
39803
+ const handleSwitchCamera = () => {
39804
+ setCurrentCameraIndex((prevIndex) => (prevIndex + 1) % cameras.length);
39805
+ };
39798
39806
  return /* @__PURE__ */ jsxs(Box$1, {
39799
39807
  sx: {
39800
39808
  width: "100%",
@@ -39864,7 +39872,10 @@ function SideDocsSelector({
39864
39872
  videoConstraints,
39865
39873
  onTapToFocus: handleTapToFocus,
39866
39874
  title: "Cargar documento",
39867
- subtitle: "Subir frontal del documento"
39875
+ subtitle: "Subir frontal del documento",
39876
+ currentCameraIndex,
39877
+ cameras,
39878
+ setCameras
39868
39879
  }), /* @__PURE__ */ jsxs(Box$1, {
39869
39880
  width: "100%",
39870
39881
  children: [base64.firstImage && /* @__PURE__ */ jsxs(Box$1, {
@@ -39876,11 +39887,7 @@ function SideDocsSelector({
39876
39887
  title: "Ampliar",
39877
39888
  placement: "right",
39878
39889
  arrow: true,
39879
- children: /* @__PURE__ */ jsx$1(ZoomInTwoTone, {
39880
- sx: {
39881
- width: "18px"
39882
- }
39883
- })
39890
+ children: /* @__PURE__ */ jsx$1(ZoomInTwoTone, {})
39884
39891
  })
39885
39892
  }), /* @__PURE__ */ jsx$1(Box$1, {
39886
39893
  className: "delete-button",
@@ -39889,9 +39896,10 @@ function SideDocsSelector({
39889
39896
  title: "Vaciar",
39890
39897
  placement: "right",
39891
39898
  arrow: true,
39892
- children: /* @__PURE__ */ jsx$1(Typography$1, {
39893
- variant: "body2",
39894
- children: "x"
39899
+ children: /* @__PURE__ */ jsx$1(Delete, {
39900
+ sx: {
39901
+ color: "white"
39902
+ }
39895
39903
  })
39896
39904
  })
39897
39905
  })]
@@ -39903,10 +39911,20 @@ function SideDocsSelector({
39903
39911
  type: "button",
39904
39912
  onClick: (e2) => handleChange(e2, 1),
39905
39913
  children: "Cargar reverso del documento"
39906
- }), activateCamera && !hideCaptureButton && !uploadDocumentByPhone && /* @__PURE__ */ jsx$1(CustomButton, {
39907
- type: "button",
39908
- onClick: () => takeScreenshot("firstImage"),
39909
- children: "Capturar"
39914
+ }), activateCamera && !hideCaptureButton && !uploadDocumentByPhone && /* @__PURE__ */ jsxs(Box$1, {
39915
+ display: "flex",
39916
+ flexDirection: "column",
39917
+ alignItems: "end",
39918
+ children: [cameras.length > 1 && /* @__PURE__ */ jsx$1(Box$1, {
39919
+ onClick: handleSwitchCamera,
39920
+ className: "change-camera-button",
39921
+ children: /* @__PURE__ */ jsx$1(Cameraswitch, {})
39922
+ }), /* @__PURE__ */ jsx$1(CustomButton, {
39923
+ type: "button",
39924
+ onClick: () => takeScreenshot("firstImage"),
39925
+ className: "m-0",
39926
+ children: "Capturar"
39927
+ })]
39910
39928
  }), !status && Object.keys(base64).length > 0 && !activateCamera && lib$1(status) && (!dualModeRequired && base64.firstImage || dualModeRequired && base64.firstImage && base64.secondImage) && /* @__PURE__ */ jsxs(Box$1, {
39911
39929
  children: [/* @__PURE__ */ jsx$1(Divider$1, {
39912
39930
  children: "O"
@@ -39966,7 +39984,10 @@ function SideDocsSelector({
39966
39984
  videoConstraints,
39967
39985
  title: "Bien ahora carguemos el reverso",
39968
39986
  subtitle: "Asegurate de que sea legible",
39969
- onTapToFocus: handleTapToFocus
39987
+ onTapToFocus: handleTapToFocus,
39988
+ currentCameraIndex,
39989
+ cameras,
39990
+ setCameras
39970
39991
  }), /* @__PURE__ */ jsxs(Box$1, {
39971
39992
  width: "100%",
39972
39993
  children: [base64.secondImage && /* @__PURE__ */ jsxs(Box$1, {
@@ -39978,11 +39999,7 @@ function SideDocsSelector({
39978
39999
  title: "Ampliar",
39979
40000
  placement: "right",
39980
40001
  arrow: true,
39981
- children: /* @__PURE__ */ jsx$1(ZoomInTwoTone, {
39982
- sx: {
39983
- width: "18px"
39984
- }
39985
- })
40002
+ children: /* @__PURE__ */ jsx$1(ZoomInTwoTone, {})
39986
40003
  })
39987
40004
  }), /* @__PURE__ */ jsx$1(Box$1, {
39988
40005
  className: "delete-button",
@@ -39991,9 +40008,10 @@ function SideDocsSelector({
39991
40008
  title: "Vaciar",
39992
40009
  placement: "right",
39993
40010
  arrow: true,
39994
- children: /* @__PURE__ */ jsx$1(Typography$1, {
39995
- variant: "body2",
39996
- children: "x"
40011
+ children: /* @__PURE__ */ jsx$1(Delete, {
40012
+ sx: {
40013
+ color: "white"
40014
+ }
39997
40015
  })
39998
40016
  })
39999
40017
  })]
@@ -40001,10 +40019,19 @@ function SideDocsSelector({
40001
40019
  type: "button",
40002
40020
  onClick: onClickToContinue,
40003
40021
  children: "Continuar"
40004
- }), activateCamera && !hideCaptureButton && !uploadDocumentByPhone && /* @__PURE__ */ jsx$1(CustomButton, {
40005
- type: "button",
40006
- onClick: () => takeScreenshot("secondImage"),
40007
- children: "Capturar"
40022
+ }), activateCamera && !hideCaptureButton && !uploadDocumentByPhone && /* @__PURE__ */ jsxs(Box$1, {
40023
+ display: "flex",
40024
+ flexDirection: "column",
40025
+ alignItems: "end",
40026
+ children: [cameras.length > 1 && /* @__PURE__ */ jsx$1(Box$1, {
40027
+ onClick: handleSwitchCamera,
40028
+ className: "change-camera-button",
40029
+ children: /* @__PURE__ */ jsx$1(Cameraswitch, {})
40030
+ }), /* @__PURE__ */ jsx$1(CustomButton, {
40031
+ type: "button",
40032
+ onClick: () => takeScreenshot("secondImage"),
40033
+ children: "Capturar"
40034
+ })]
40008
40035
  }), !status && Object.keys(base64).length > 0 && !activateCamera && lib$1(status) && (!dualModeRequired && base64.secondImage && base64.firstImage || dualModeRequired && base64.firstImage && base64.secondImage) && /* @__PURE__ */ jsx$1(CustomButton, {
40009
40036
  type: "submit",
40010
40037
  children: "Procesar"