sunuid-sdk 1.0.43 → 1.0.45
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/dist/sunuid-sdk.esm.js +101 -3
- package/dist/sunuid-sdk.esm.js.map +1 -1
- package/dist/sunuid-sdk.js +101 -3
- package/dist/sunuid-sdk.js.map +1 -1
- package/dist/sunuid-sdk.min.js +1 -1
- package/dist/sunuid-sdk.min.js.map +1 -1
- package/package.json +1 -1
package/dist/sunuid-sdk.js
CHANGED
|
@@ -857,9 +857,29 @@
|
|
|
857
857
|
}, {
|
|
858
858
|
key: "handleQRScanSuccess",
|
|
859
859
|
value: function handleQRScanSuccess(data) {
|
|
860
|
-
console.log('✅ QR Scan Success:', data);
|
|
861
|
-
|
|
862
|
-
|
|
860
|
+
console.log('✅ QR Scan Success reçu:', data);
|
|
861
|
+
try {
|
|
862
|
+
// Extraire les données d'authentification du format WebSocket
|
|
863
|
+
var authData = this.extractAuthDataFromWebSocket(data);
|
|
864
|
+
|
|
865
|
+
// Traiter l'authentification comme un callback
|
|
866
|
+
this.processAuthentication(authData);
|
|
867
|
+
|
|
868
|
+
// Afficher un message de succès
|
|
869
|
+
this.showSuccessMessage(authData);
|
|
870
|
+
|
|
871
|
+
// Appeler le callback de succès (pour compatibilité)
|
|
872
|
+
if (this.config.onSuccess) {
|
|
873
|
+
this.config.onSuccess(authData);
|
|
874
|
+
}
|
|
875
|
+
console.log('✅ Authentification WebSocket traitée avec succès');
|
|
876
|
+
} catch (error) {
|
|
877
|
+
console.error('❌ Erreur lors du traitement WebSocket:', error);
|
|
878
|
+
|
|
879
|
+
// Appeler le callback d'erreur
|
|
880
|
+
if (this.config.onAuthenticationError) {
|
|
881
|
+
this.config.onAuthenticationError(error, data);
|
|
882
|
+
}
|
|
863
883
|
}
|
|
864
884
|
}
|
|
865
885
|
|
|
@@ -2579,6 +2599,84 @@
|
|
|
2579
2599
|
console.log('✅ Loader affiché avec succès');
|
|
2580
2600
|
}
|
|
2581
2601
|
|
|
2602
|
+
/**
|
|
2603
|
+
* Extraire les données d'authentification du format WebSocket
|
|
2604
|
+
*/
|
|
2605
|
+
}, {
|
|
2606
|
+
key: "extractAuthDataFromWebSocket",
|
|
2607
|
+
value: function extractAuthDataFromWebSocket(websocketData) {
|
|
2608
|
+
console.log('🔍 Extraction des données d\'authentification du WebSocket:', websocketData);
|
|
2609
|
+
|
|
2610
|
+
// Si les données sont déjà dans le bon format (callback), les retourner directement
|
|
2611
|
+
if (websocketData.token && websocketData.session_id) {
|
|
2612
|
+
console.log('✅ Données déjà au bon format (callback)');
|
|
2613
|
+
return websocketData;
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
// Si c'est un format WebSocket, extraire les données de responseData
|
|
2617
|
+
if (websocketData.responseData) {
|
|
2618
|
+
console.log('✅ Format WebSocket détecté, extraction de responseData');
|
|
2619
|
+
var authData = {
|
|
2620
|
+
token: websocketData.responseData.token || websocketData.responseData.auth_token,
|
|
2621
|
+
session_id: websocketData.responseData.session_id || websocketData.responseData.sessionId,
|
|
2622
|
+
user_id: websocketData.responseData.user_id || websocketData.responseData.userId,
|
|
2623
|
+
partner_id: websocketData.responseData.partner_id || websocketData.responseData.partnerId,
|
|
2624
|
+
type: websocketData.responseData.type,
|
|
2625
|
+
timestamp: websocketData.responseData.timestamp || websocketData.timestamp,
|
|
2626
|
+
signature: websocketData.responseData.signature,
|
|
2627
|
+
user_info: websocketData.responseData.user_info || websocketData.responseData.userInfo,
|
|
2628
|
+
redirect_url: websocketData.responseData.redirect_url || websocketData.responseData.redirectUrl
|
|
2629
|
+
};
|
|
2630
|
+
console.log('📋 Données d\'authentification extraites:', authData);
|
|
2631
|
+
return authData;
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
// Fallback : essayer d'extraire directement des champs principaux
|
|
2635
|
+
console.log('⚠️ Format non reconnu, tentative d\'extraction directe');
|
|
2636
|
+
return {
|
|
2637
|
+
token: websocketData.token || websocketData.auth_token,
|
|
2638
|
+
session_id: websocketData.session_id || websocketData.sessionId,
|
|
2639
|
+
user_id: websocketData.user_id || websocketData.userId,
|
|
2640
|
+
partner_id: websocketData.partner_id || websocketData.partnerId,
|
|
2641
|
+
type: websocketData.type,
|
|
2642
|
+
timestamp: websocketData.timestamp,
|
|
2643
|
+
signature: websocketData.signature,
|
|
2644
|
+
user_info: websocketData.user_info || websocketData.userInfo,
|
|
2645
|
+
redirect_url: websocketData.redirect_url || websocketData.redirectUrl
|
|
2646
|
+
};
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
/**
|
|
2650
|
+
* Afficher un message de succès après authentification
|
|
2651
|
+
*/
|
|
2652
|
+
}, {
|
|
2653
|
+
key: "showSuccessMessage",
|
|
2654
|
+
value: function showSuccessMessage(data) {
|
|
2655
|
+
console.log('✅ Affichage du message de succès');
|
|
2656
|
+
|
|
2657
|
+
// Chercher le conteneur QR dans différents IDs possibles
|
|
2658
|
+
var containerIds = ['qr-area', 'qr-container', 'sunuid-qr-container'];
|
|
2659
|
+
var container = null;
|
|
2660
|
+
for (var _i3 = 0, _containerIds2 = containerIds; _i3 < _containerIds2.length; _i3++) {
|
|
2661
|
+
var id = _containerIds2[_i3];
|
|
2662
|
+
container = document.getElementById(id);
|
|
2663
|
+
if (container) break;
|
|
2664
|
+
}
|
|
2665
|
+
if (!container) {
|
|
2666
|
+
console.warn('⚠️ Conteneur QR non trouvé pour afficher le message de succès');
|
|
2667
|
+
return;
|
|
2668
|
+
}
|
|
2669
|
+
|
|
2670
|
+
// Extraire les informations utilisateur
|
|
2671
|
+
var userInfo = data.user_info || {};
|
|
2672
|
+
var userName = userInfo.name || userInfo.username || 'Utilisateur';
|
|
2673
|
+
var userEmail = userInfo.email || '';
|
|
2674
|
+
|
|
2675
|
+
// Remplacer le contenu par un message de succès
|
|
2676
|
+
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 ");
|
|
2677
|
+
console.log('✅ Message de succès affiché');
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2582
2680
|
/**
|
|
2583
2681
|
* Gérer le callback SunuID
|
|
2584
2682
|
*/
|