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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.113",
2
+ "version": "2.0.115",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -710,18 +710,30 @@ display: flex;
710
710
  }
711
711
  };
712
712
 
713
- const openPiP = async (): Promise<void> => {
714
- if (document.pictureInPictureEnabled && !document.pictureInPictureElement) {
715
- try {
716
- const pipWindow = await window.documentPictureInPicture.requestWindow({
717
- width: 400,
718
- height: 800,
719
- });
720
- pipWindowRef.current = pipWindow;
721
- renderTasksInPiP(pipWindow);
722
- } catch (error) {
723
- console.error("Erreur lors de l'ouverture du PiP :", error);
713
+ const openPiP = async (url: string): Promise<void> => {
714
+ try {
715
+ // Vérifier si PiP est disponible
716
+ if (!document.pictureInPictureEnabled) {
717
+ console.warn("Picture-in-Picture n'est pas disponible");
718
+ // Fallback : ouvrir simplement dans un nouvel onglet
719
+ window.open(url, '_blank');
720
+ return;
724
721
  }
722
+
723
+ // Ouvrir d'abord la fenêtre PiP puisque nous avons l'interaction utilisateur
724
+ const pipWindow = await window.documentPictureInPicture.requestWindow({
725
+ width: 400,
726
+ height: 800,
727
+ });
728
+ pipWindowRef.current = pipWindow;
729
+ renderTasksInPiP(pipWindow);
730
+
731
+ // Ensuite ouvrir l'URL dans un nouvel onglet
732
+ window.open(url, '_blank');
733
+ } catch (error) {
734
+ console.error("Erreur lors de l'ouverture du PiP :", error);
735
+ // Fallback en cas d'erreur : ouvrir simplement dans un nouvel onglet
736
+ window.open(url, '_blank');
725
737
  }
726
738
  };
727
739
 
@@ -792,16 +804,7 @@ display: flex;
792
804
  disabled={disabled}
793
805
  onClick={() => {
794
806
  if (url) {
795
- openPiP().catch((error) => {
796
- console.error("Erreur lors de l'ouverture du PiP :", error);
797
- });
798
-
799
- // Petit délai pour s'assurer que la nouvelle fenêtre est bien ouverte
800
- setTimeout(() => {
801
- // Ouvrir d'abord l'URL dans un nouvel onglet
802
- const fullUrl = url.includes('https://') ? url : `https://${url}`;
803
- window.open(fullUrl, '_blank');
804
- }, 10000);
807
+ openPiP(url);
805
808
  }
806
809
  }}
807
810
  />