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.esm.js
CHANGED
|
@@ -856,15 +856,18 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
856
856
|
value: function handleQRScanSuccess(data) {
|
|
857
857
|
console.log('✅ QR Scan Success reçu:', data);
|
|
858
858
|
try {
|
|
859
|
+
// Extraire les données d'authentification du format WebSocket
|
|
860
|
+
var authData = this.extractAuthDataFromWebSocket(data);
|
|
861
|
+
|
|
859
862
|
// Traiter l'authentification comme un callback
|
|
860
|
-
this.processAuthentication(
|
|
863
|
+
this.processAuthentication(authData);
|
|
861
864
|
|
|
862
865
|
// Afficher un message de succès
|
|
863
|
-
this.showSuccessMessage(
|
|
866
|
+
this.showSuccessMessage(authData);
|
|
864
867
|
|
|
865
868
|
// Appeler le callback de succès (pour compatibilité)
|
|
866
869
|
if (this.config.onSuccess) {
|
|
867
|
-
this.config.onSuccess(
|
|
870
|
+
this.config.onSuccess(authData);
|
|
868
871
|
}
|
|
869
872
|
console.log('✅ Authentification WebSocket traitée avec succès');
|
|
870
873
|
} catch (error) {
|
|
@@ -2593,6 +2596,55 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
2593
2596
|
console.log('✅ Loader affiché avec succès');
|
|
2594
2597
|
}
|
|
2595
2598
|
|
|
2599
|
+
/**
|
|
2600
|
+
* Extraire les données d'authentification du format WebSocket
|
|
2601
|
+
*/
|
|
2602
|
+
}, {
|
|
2603
|
+
key: "extractAuthDataFromWebSocket",
|
|
2604
|
+
value: function extractAuthDataFromWebSocket(websocketData) {
|
|
2605
|
+
console.log('🔍 Extraction des données d\'authentification du WebSocket:', websocketData);
|
|
2606
|
+
|
|
2607
|
+
// Si les données sont déjà dans le bon format (callback), les retourner directement
|
|
2608
|
+
if (websocketData.token && websocketData.session_id) {
|
|
2609
|
+
console.log('✅ Données déjà au bon format (callback)');
|
|
2610
|
+
return websocketData;
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
// Si c'est un format WebSocket, extraire les données de responseData
|
|
2614
|
+
if (websocketData.responseData) {
|
|
2615
|
+
console.log('✅ Format WebSocket détecté, extraction de responseData');
|
|
2616
|
+
console.log('🔍 Contenu complet de responseData:', websocketData.responseData);
|
|
2617
|
+
console.log('🔍 Clés disponibles dans responseData:', Object.keys(websocketData.responseData));
|
|
2618
|
+
var authData = {
|
|
2619
|
+
token: websocketData.responseData.token || websocketData.responseData.auth_token,
|
|
2620
|
+
session_id: websocketData.responseData.session_id || websocketData.responseData.sessionId,
|
|
2621
|
+
user_id: websocketData.responseData.user_id || websocketData.responseData.userId,
|
|
2622
|
+
partner_id: websocketData.responseData.partner_id || websocketData.responseData.partnerId,
|
|
2623
|
+
type: websocketData.responseData.type,
|
|
2624
|
+
timestamp: websocketData.responseData.timestamp || websocketData.timestamp,
|
|
2625
|
+
signature: websocketData.responseData.signature,
|
|
2626
|
+
user_info: websocketData.responseData.user_info || websocketData.responseData.userInfo,
|
|
2627
|
+
redirect_url: websocketData.responseData.redirect_url || websocketData.responseData.redirectUrl
|
|
2628
|
+
};
|
|
2629
|
+
console.log('📋 Données d\'authentification extraites:', authData);
|
|
2630
|
+
return authData;
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
// Fallback : essayer d'extraire directement des champs principaux
|
|
2634
|
+
console.log('⚠️ Format non reconnu, tentative d\'extraction directe');
|
|
2635
|
+
return {
|
|
2636
|
+
token: websocketData.token || websocketData.auth_token,
|
|
2637
|
+
session_id: websocketData.session_id || websocketData.sessionId,
|
|
2638
|
+
user_id: websocketData.user_id || websocketData.userId,
|
|
2639
|
+
partner_id: websocketData.partner_id || websocketData.partnerId,
|
|
2640
|
+
type: websocketData.type,
|
|
2641
|
+
timestamp: websocketData.timestamp,
|
|
2642
|
+
signature: websocketData.signature,
|
|
2643
|
+
user_info: websocketData.user_info || websocketData.userInfo,
|
|
2644
|
+
redirect_url: websocketData.redirect_url || websocketData.redirectUrl
|
|
2645
|
+
};
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2596
2648
|
/**
|
|
2597
2649
|
* Afficher un message de succès après authentification
|
|
2598
2650
|
*/
|