gbc-kyc-kit 2.4.5 → 2.4.7

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.
@@ -39470,22 +39470,25 @@ function UploadDocument2({
39470
39470
  currentCameraIndex
39471
39471
  }) {
39472
39472
  useEffect(() => {
39473
- navigator.mediaDevices.getUserMedia({
39474
- video: true
39475
- }).then(() => {
39476
- navigator.mediaDevices.enumerateDevices().then(async (devices) => {
39477
- var _a, _b, _c, _d;
39473
+ const initializeCameras = async () => {
39474
+ var _a, _b, _c, _d;
39475
+ try {
39476
+ const stream = await navigator.mediaDevices.getUserMedia({
39477
+ video: true
39478
+ });
39479
+ stream.getTracks().forEach((track) => track.stop());
39480
+ const devices = await navigator.mediaDevices.enumerateDevices();
39478
39481
  const videoDevices = devices.filter((device2) => device2.kind === "videoinput");
39479
39482
  let bestScore = -1;
39480
39483
  let bestDeviceId = null;
39481
39484
  for (const device2 of videoDevices) {
39482
39485
  try {
39483
- const stream = await navigator.mediaDevices.getUserMedia({
39486
+ const stream2 = await navigator.mediaDevices.getUserMedia({
39484
39487
  video: {
39485
39488
  deviceId: device2.deviceId
39486
39489
  }
39487
39490
  });
39488
- const track = stream.getVideoTracks()[0];
39491
+ const track = stream2.getVideoTracks()[0];
39489
39492
  const capabilities = track.getCapabilities();
39490
39493
  const width2 = ((_a = capabilities.width) == null ? void 0 : _a.max) || 0;
39491
39494
  const height2 = ((_b = capabilities.height) == null ? void 0 : _b.max) || 0;
@@ -39496,7 +39499,7 @@ function UploadDocument2({
39496
39499
  bestScore = score;
39497
39500
  bestDeviceId = device2.deviceId;
39498
39501
  }
39499
- stream.getTracks().forEach((track2) => track2.stop());
39502
+ stream2.getTracks().forEach((track2) => track2.stop());
39500
39503
  } catch (err) {
39501
39504
  console.error("Error al obtener capacidades de la c\xE1mara:", err);
39502
39505
  }
@@ -39507,8 +39510,11 @@ function UploadDocument2({
39507
39510
  } else {
39508
39511
  setCameras(videoDevices);
39509
39512
  }
39510
- }).catch((err) => console.error("Error obteniendo c\xE1maras:", err));
39511
- });
39513
+ } catch (err) {
39514
+ console.error("Error al inicializar c\xE1maras:", err);
39515
+ }
39516
+ };
39517
+ initializeCameras();
39512
39518
  }, []);
39513
39519
  useEffect(() => {
39514
39520
  if (activateCamera && videoRef.current && cameras.length > 0) {
@@ -39743,7 +39749,6 @@ function SideDocsSelector({
39743
39749
  const [currentCameraIndex, setCurrentCameraIndex] = useState(0);
39744
39750
  const handleChange = (event, newValue) => {
39745
39751
  setValue(newValue);
39746
- setCameras([]);
39747
39752
  setActivateCamera(false);
39748
39753
  };
39749
39754
  const deleteImage = (image) => {
@@ -39839,6 +39844,7 @@ function SideDocsSelector({
39839
39844
  const handleSwitchCamera = () => {
39840
39845
  setCurrentCameraIndex((prevIndex) => (prevIndex + 1) % cameras.length);
39841
39846
  };
39847
+ console.log("Activate Camera: ", activateCamera, "Distinto de HideCapture Button: ", !hideCaptureButton, "Distinto de Upload document By Phone: ", !uploadDocumentByPhone, "Cantidad de cameras: ", cameras.length);
39842
39848
  return /* @__PURE__ */ jsxs(Box$1, {
39843
39849
  sx: {
39844
39850
  width: "100%",