sunuid-sdk 1.0.43 → 1.0.44

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.
@@ -857,9 +857,26 @@
857
857
  }, {
858
858
  key: "handleQRScanSuccess",
859
859
  value: function handleQRScanSuccess(data) {
860
- console.log('✅ QR Scan Success:', data);
861
- if (this.config.onSuccess) {
862
- this.config.onSuccess(data);
860
+ console.log('✅ QR Scan Success reçu:', data);
861
+ try {
862
+ // Traiter l'authentification comme un callback
863
+ this.processAuthentication(data);
864
+
865
+ // Afficher un message de succès
866
+ this.showSuccessMessage(data);
867
+
868
+ // Appeler le callback de succès (pour compatibilité)
869
+ if (this.config.onSuccess) {
870
+ this.config.onSuccess(data);
871
+ }
872
+ console.log('✅ Authentification WebSocket traitée avec succès');
873
+ } catch (error) {
874
+ console.error('❌ Erreur lors du traitement WebSocket:', error);
875
+
876
+ // Appeler le callback d'erreur
877
+ if (this.config.onAuthenticationError) {
878
+ this.config.onAuthenticationError(error, data);
879
+ }
863
880
  }
864
881
  }
865
882
 
@@ -2579,6 +2596,37 @@
2579
2596
  console.log('✅ Loader affiché avec succès');
2580
2597
  }
2581
2598
 
2599
+ /**
2600
+ * Afficher un message de succès après authentification
2601
+ */
2602
+ }, {
2603
+ key: "showSuccessMessage",
2604
+ value: function showSuccessMessage(data) {
2605
+ console.log('✅ Affichage du message de succès');
2606
+
2607
+ // Chercher le conteneur QR dans différents IDs possibles
2608
+ var containerIds = ['qr-area', 'qr-container', 'sunuid-qr-container'];
2609
+ var container = null;
2610
+ for (var _i3 = 0, _containerIds2 = containerIds; _i3 < _containerIds2.length; _i3++) {
2611
+ var id = _containerIds2[_i3];
2612
+ container = document.getElementById(id);
2613
+ if (container) break;
2614
+ }
2615
+ if (!container) {
2616
+ console.warn('⚠️ Conteneur QR non trouvé pour afficher le message de succès');
2617
+ return;
2618
+ }
2619
+
2620
+ // Extraire les informations utilisateur
2621
+ var userInfo = data.user_info || {};
2622
+ var userName = userInfo.name || userInfo.username || 'Utilisateur';
2623
+ var userEmail = userInfo.email || '';
2624
+
2625
+ // Remplacer le contenu par un message de succès
2626
+ container.innerHTML = "\n <div style=\"\n text-align: center;\n padding: 40px 20px;\n background: #d4edda;\n border: 2px solid #28a745;\n border-radius: 10px;\n color: #155724;\n font-family: Arial, sans-serif;\n \">\n <div style=\"\n width: 60px;\n height: 60px;\n background: #28a745;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0 auto 20px auto;\n font-size: 30px;\n color: white;\n \">\u2705</div>\n <h3 style=\"margin: 0 0 10px 0; color: #155724;\">\uD83C\uDF89 Authentification r\xE9ussie !</h3>\n <p style=\"margin: 0 0 15px 0; font-size: 16px; font-weight: bold;\">\n Bienvenue, ".concat(userName, " !\n </p>\n ").concat(userEmail ? "<p style=\"margin: 0 0 15px 0; font-size: 14px; color: #6c757d;\">".concat(userEmail, "</p>") : '', "\n <p style=\"margin: 0; font-size: 14px;\">\n Votre identit\xE9 a \xE9t\xE9 v\xE9rifi\xE9e avec succ\xE8s.\n </p>\n <div style=\"margin-top: 20px; font-size: 12px; color: #6c757d;\">\n \uD83D\uDD04 Redirection en cours...\n </div>\n </div>\n ");
2627
+ console.log('✅ Message de succès affiché');
2628
+ }
2629
+
2582
2630
  /**
2583
2631
  * Gérer le callback SunuID
2584
2632
  */