odaptos_design_system 2.0.113 → 2.0.115

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.
@@ -13637,18 +13637,28 @@ display: flex;
13637
13637
  }
13638
13638
  }
13639
13639
  };
13640
- const openPiP = async () => {
13641
- if (document.pictureInPictureEnabled && !document.pictureInPictureElement) {
13642
- try {
13643
- const pipWindow = await window.documentPictureInPicture.requestWindow({
13644
- width: 400,
13645
- height: 800
13646
- });
13647
- pipWindowRef.current = pipWindow;
13648
- renderTasksInPiP(pipWindow);
13649
- } catch (error) {
13650
- console.error("Erreur lors de l'ouverture du PiP :", error);
13640
+ const openPiP = async url => {
13641
+ try {
13642
+ // Vérifier si PiP est disponible
13643
+ if (!document.pictureInPictureEnabled) {
13644
+ console.warn("Picture-in-Picture n'est pas disponible");
13645
+ // Fallback : ouvrir simplement dans un nouvel onglet
13646
+ window.open(url, '_blank');
13647
+ return;
13651
13648
  }
13649
+ // Ouvrir d'abord la fenêtre PiP puisque nous avons l'interaction utilisateur
13650
+ const pipWindow = await window.documentPictureInPicture.requestWindow({
13651
+ width: 400,
13652
+ height: 800
13653
+ });
13654
+ pipWindowRef.current = pipWindow;
13655
+ renderTasksInPiP(pipWindow);
13656
+ // Ensuite ouvrir l'URL dans un nouvel onglet
13657
+ window.open(url, '_blank');
13658
+ } catch (error) {
13659
+ console.error("Erreur lors de l'ouverture du PiP :", error);
13660
+ // Fallback en cas d'erreur : ouvrir simplement dans un nouvel onglet
13661
+ window.open(url, '_blank');
13652
13662
  }
13653
13663
  };
13654
13664
  React.useEffect(() => {
@@ -13702,15 +13712,7 @@ display: flex;
13702
13712
  disabled: disabled,
13703
13713
  onClick: () => {
13704
13714
  if (url) {
13705
- openPiP().catch(error => {
13706
- console.error("Erreur lors de l'ouverture du PiP :", error);
13707
- });
13708
- // Petit délai pour s'assurer que la nouvelle fenêtre est bien ouverte
13709
- setTimeout(() => {
13710
- // Ouvrir d'abord l'URL dans un nouvel onglet
13711
- const fullUrl = url.includes('https://') ? url : `https://${url}`;
13712
- window.open(fullUrl, '_blank');
13713
- }, 10000);
13715
+ openPiP(url);
13714
13716
  }
13715
13717
  }
13716
13718
  });