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