sunuid-sdk 1.0.44 → 1.0.46
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.js
CHANGED
|
@@ -859,15 +859,18 @@
|
|
|
859
859
|
value: function handleQRScanSuccess(data) {
|
|
860
860
|
console.log('✅ QR Scan Success reçu:', data);
|
|
861
861
|
try {
|
|
862
|
+
// Extraire les données d'authentification du format WebSocket
|
|
863
|
+
var authData = this.extractAuthDataFromWebSocket(data);
|
|
864
|
+
|
|
862
865
|
// Traiter l'authentification comme un callback
|
|
863
|
-
this.processAuthentication(
|
|
866
|
+
this.processAuthentication(authData);
|
|
864
867
|
|
|
865
868
|
// Afficher un message de succès
|
|
866
|
-
this.showSuccessMessage(
|
|
869
|
+
this.showSuccessMessage(authData);
|
|
867
870
|
|
|
868
871
|
// Appeler le callback de succès (pour compatibilité)
|
|
869
872
|
if (this.config.onSuccess) {
|
|
870
|
-
this.config.onSuccess(
|
|
873
|
+
this.config.onSuccess(authData);
|
|
871
874
|
}
|
|
872
875
|
console.log('✅ Authentification WebSocket traitée avec succès');
|
|
873
876
|
} catch (error) {
|
|
@@ -2596,6 +2599,55 @@
|
|
|
2596
2599
|
console.log('✅ Loader affiché avec succès');
|
|
2597
2600
|
}
|
|
2598
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
|
+
console.log('🔍 Contenu complet de responseData:', websocketData.responseData);
|
|
2620
|
+
console.log('🔍 Clés disponibles dans responseData:', Object.keys(websocketData.responseData));
|
|
2621
|
+
var authData = {
|
|
2622
|
+
token: websocketData.responseData.token || websocketData.responseData.auth_token,
|
|
2623
|
+
session_id: websocketData.responseData.session_id || websocketData.responseData.sessionId,
|
|
2624
|
+
user_id: websocketData.responseData.user_id || websocketData.responseData.userId,
|
|
2625
|
+
partner_id: websocketData.responseData.partner_id || websocketData.responseData.partnerId,
|
|
2626
|
+
type: websocketData.responseData.type,
|
|
2627
|
+
timestamp: websocketData.responseData.timestamp || websocketData.timestamp,
|
|
2628
|
+
signature: websocketData.responseData.signature,
|
|
2629
|
+
user_info: websocketData.responseData.user_info || websocketData.responseData.userInfo,
|
|
2630
|
+
redirect_url: websocketData.responseData.redirect_url || websocketData.responseData.redirectUrl
|
|
2631
|
+
};
|
|
2632
|
+
console.log('📋 Données d\'authentification extraites:', authData);
|
|
2633
|
+
return authData;
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
// Fallback : essayer d'extraire directement des champs principaux
|
|
2637
|
+
console.log('⚠️ Format non reconnu, tentative d\'extraction directe');
|
|
2638
|
+
return {
|
|
2639
|
+
token: websocketData.token || websocketData.auth_token,
|
|
2640
|
+
session_id: websocketData.session_id || websocketData.sessionId,
|
|
2641
|
+
user_id: websocketData.user_id || websocketData.userId,
|
|
2642
|
+
partner_id: websocketData.partner_id || websocketData.partnerId,
|
|
2643
|
+
type: websocketData.type,
|
|
2644
|
+
timestamp: websocketData.timestamp,
|
|
2645
|
+
signature: websocketData.signature,
|
|
2646
|
+
user_info: websocketData.user_info || websocketData.userInfo,
|
|
2647
|
+
redirect_url: websocketData.redirect_url || websocketData.redirectUrl
|
|
2648
|
+
};
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2599
2651
|
/**
|
|
2600
2652
|
* Afficher un message de succès après authentification
|
|
2601
2653
|
*/
|