gbc-kyc-kit 2.3.17 → 2.4.0

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.
@@ -39304,7 +39304,7 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
39304
39304
  ...error,
39305
39305
  countAttempts: data2.count_try
39306
39306
  });
39307
- if (error.response.data.code === "020")
39307
+ if (error.response.data.code === "020" && data2.count_try > 3)
39308
39308
  setUploadDocumentByPhone(true);
39309
39309
  if ((_a = error.response.data) == null ? void 0 : _a.message) {
39310
39310
  message2 = error.response.data.message;
@@ -39369,12 +39369,6 @@ const DocumentReaderController = (dataDocument, clientId, authorize, eventId, so
39369
39369
  frameRate: {
39370
39370
  ideal: 30
39371
39371
  },
39372
- iso: {
39373
- ideal: 12
39374
- },
39375
- advanced: [{
39376
- zoom: 1
39377
- }],
39378
39372
  focusMode: "continuous",
39379
39373
  facingMode: "environment"
39380
39374
  }), [isPortrait]);
@@ -39469,33 +39463,26 @@ function UploadDocument2({
39469
39463
  const [cameras, setCameras] = useState([]);
39470
39464
  const [currentCameraIndex, setCurrentCameraIndex] = useState(0);
39471
39465
  useEffect(() => {
39472
- navigator.mediaDevices.getUserMedia({
39473
- video: true
39474
- }).then(() => {
39475
- return navigator.mediaDevices.enumerateDevices();
39476
- }).then((devices) => {
39466
+ navigator.mediaDevices.enumerateDevices().then((devices) => {
39477
39467
  const videoDevices = devices.filter((device2) => device2.kind === "videoinput");
39478
39468
  setCameras(videoDevices);
39479
39469
  }).catch((err) => console.error("Error obteniendo c\xE1maras:", err));
39480
39470
  }, []);
39481
39471
  useEffect(() => {
39482
- if (activateCamera && videoRef.current) {
39472
+ if (activateCamera && videoRef.current && cameras.length > 0) {
39483
39473
  cameras[currentCameraIndex];
39484
- const constraints = videoConstraints;
39485
- navigator.mediaDevices.getUserMedia({
39486
- video: constraints,
39474
+ const constraints = {
39475
+ video: {
39476
+ facingMode: "environment",
39477
+ focusMode: "continuous"
39478
+ },
39487
39479
  audio: false
39488
- }).then((stream) => {
39489
- if (videoRef.current) {
39490
- videoRef.current.srcObject = stream;
39491
- videoRef.current.play();
39492
- streamRef.current = stream;
39493
- const track = stream.getVideoTracks()[0];
39494
- const capabilities = track.getCapabilities();
39495
- const settings = track.getSettings();
39496
- console.log("Settings: ", settings);
39497
- console.log("Capabilities: ", capabilities);
39498
- }
39480
+ };
39481
+ console.log("Intentando usar constraints:", constraints);
39482
+ navigator.mediaDevices.getUserMedia(constraints).then((stream) => {
39483
+ videoRef.current.srcObject = stream;
39484
+ videoRef.current.play();
39485
+ streamRef.current = stream;
39499
39486
  }).catch((err) => {
39500
39487
  console.error("Error al acceder a la c\xE1mara:", err);
39501
39488
  });
@@ -39505,8 +39492,11 @@ function UploadDocument2({
39505
39492
  streamRef.current.getTracks().forEach((track) => track.stop());
39506
39493
  streamRef.current = null;
39507
39494
  }
39495
+ if (videoRef.current) {
39496
+ videoRef.current.srcObject = null;
39497
+ }
39508
39498
  };
39509
- }, [activateCamera, currentCameraIndex, videoConstraints, cameras]);
39499
+ }, [activateCamera, currentCameraIndex, cameras, videoConstraints]);
39510
39500
  const handleSwitchCamera = () => {
39511
39501
  setCurrentCameraIndex((prevIndex) => (prevIndex + 1) % cameras.length);
39512
39502
  };
@@ -39651,12 +39641,6 @@ const createCanvasFromSource = (source2) => {
39651
39641
  ctx == null ? void 0 : ctx.drawImage(source2, 0, 0, width2, height2);
39652
39642
  return { canvas, ctx };
39653
39643
  };
39654
- const isLowEndDevice = () => {
39655
- const cores = navigator.hardwareConcurrency || 2;
39656
- const memory = navigator.deviceMemory || 2;
39657
- const isHardwareLow = cores <= 4 || memory <= 3;
39658
- return isHardwareLow;
39659
- };
39660
39644
  function CustomTabPanel(props) {
39661
39645
  const {
39662
39646
  children,
@@ -39864,7 +39848,7 @@ function SideDocsSelector({
39864
39848
  objectFit: "cover"
39865
39849
  }
39866
39850
  })
39867
- }) : uploadDocumentByPhone || isLowEndDevice() ? /* @__PURE__ */ jsx$1(UploadByGallery, {
39851
+ }) : uploadDocumentByPhone ? /* @__PURE__ */ jsx$1(UploadByGallery, {
39868
39852
  handleFileChange,
39869
39853
  side: "firstImage",
39870
39854
  fileInputRef,
@@ -39966,7 +39950,7 @@ function SideDocsSelector({
39966
39950
  objectFit: "cover"
39967
39951
  }
39968
39952
  })
39969
- }) : uploadDocumentByPhone || isLowEndDevice() ? /* @__PURE__ */ jsx$1(UploadByGallery, {
39953
+ }) : uploadDocumentByPhone ? /* @__PURE__ */ jsx$1(UploadByGallery, {
39970
39954
  handleFileChange,
39971
39955
  side: "secondImage",
39972
39956
  fileInputRef,