sunuid-sdk 1.0.34 → 1.0.36
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/README.md +499 -171
- package/dist/sunuid-sdk.esm.js +64 -2
- package/dist/sunuid-sdk.esm.js.map +1 -1
- package/dist/sunuid-sdk.js +64 -2
- 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.esm.js
CHANGED
|
@@ -288,6 +288,8 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
288
288
|
// Désactivé par défaut pour éviter les appels répétitifs
|
|
289
289
|
refreshInterval: 30000,
|
|
290
290
|
// 30 secondes
|
|
291
|
+
autoInit: true,
|
|
292
|
+
// Initialisation automatique par défaut
|
|
291
293
|
onSuccess: null,
|
|
292
294
|
onError: null,
|
|
293
295
|
onStatusUpdate: null,
|
|
@@ -325,8 +327,10 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
325
327
|
this.isInitialized = false;
|
|
326
328
|
this.socket = null;
|
|
327
329
|
|
|
328
|
-
// Initialisation asynchrone
|
|
329
|
-
this.
|
|
330
|
+
// Initialisation asynchrone seulement si autoInit est activé
|
|
331
|
+
if (this.config.autoInit !== false) {
|
|
332
|
+
this.initPromise = this.init();
|
|
333
|
+
}
|
|
330
334
|
}
|
|
331
335
|
|
|
332
336
|
/**
|
|
@@ -590,6 +594,35 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
590
594
|
console.log('⏰ QR expiré reçu:', data);
|
|
591
595
|
_this.handleQRExpired(data);
|
|
592
596
|
});
|
|
597
|
+
|
|
598
|
+
// Écouter l'événement qr_scan_initiated spécifiquement
|
|
599
|
+
this.socket.on('qr_scan_initiated', function (data) {
|
|
600
|
+
console.log('🔍 QR Scan Initiated reçu:', data);
|
|
601
|
+
_this.showQRLoader();
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
// Écouter l'événement message générique (fallback)
|
|
605
|
+
this.socket.on('message', function (data) {
|
|
606
|
+
console.log('📨 Message socket reçu:', data);
|
|
607
|
+
if (data && data.type === 'qr_scan_initiated') {
|
|
608
|
+
console.log('🔍 QR Scan Initiated détecté dans message:', data);
|
|
609
|
+
_this.showQRLoader();
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
// Écouter tous les événements socket pour le debugging
|
|
614
|
+
this.socket.onAny = this.socket.onAny || function (eventName, callback) {
|
|
615
|
+
// Fallback pour les versions de Socket.IO qui n'ont pas onAny
|
|
616
|
+
console.log("\uD83C\uDF10 Socket Event [".concat(eventName, "]:"), callback);
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
// Logger tous les événements reçus
|
|
620
|
+
this.socket.onAny(function (eventName) {
|
|
621
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
622
|
+
args[_key - 1] = arguments[_key];
|
|
623
|
+
}
|
|
624
|
+
console.log("\uD83C\uDF10 Socket Event [".concat(eventName, "]:"), args);
|
|
625
|
+
});
|
|
593
626
|
} else {
|
|
594
627
|
console.log('🌐 WebSocket déjà connecté');
|
|
595
628
|
}
|
|
@@ -743,6 +776,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
743
776
|
}, {
|
|
744
777
|
key: "handleQRStatusUpdate",
|
|
745
778
|
value: function handleQRStatusUpdate(data) {
|
|
779
|
+
console.log('📱 QR Status Update:', data);
|
|
746
780
|
if (this.config.onStatusUpdate) {
|
|
747
781
|
this.config.onStatusUpdate(data);
|
|
748
782
|
}
|
|
@@ -754,6 +788,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
754
788
|
}, {
|
|
755
789
|
key: "handleQRScanSuccess",
|
|
756
790
|
value: function handleQRScanSuccess(data) {
|
|
791
|
+
console.log('✅ QR Scan Success:', data);
|
|
757
792
|
if (this.config.onSuccess) {
|
|
758
793
|
this.config.onSuccess(data);
|
|
759
794
|
}
|
|
@@ -765,6 +800,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
765
800
|
}, {
|
|
766
801
|
key: "handleQRExpired",
|
|
767
802
|
value: function handleQRExpired(data) {
|
|
803
|
+
console.log('⏰ QR Expired:', data);
|
|
768
804
|
if (this.config.onExpired) {
|
|
769
805
|
this.config.onExpired(data);
|
|
770
806
|
}
|
|
@@ -2404,6 +2440,32 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
2404
2440
|
window.SunuIDSecurityLogs = [];
|
|
2405
2441
|
this.logSecurityEvent('SECURITY_LOGS_CLEARED');
|
|
2406
2442
|
}
|
|
2443
|
+
|
|
2444
|
+
/**
|
|
2445
|
+
* Afficher un loader pendant le scan du QR code
|
|
2446
|
+
*/
|
|
2447
|
+
}, {
|
|
2448
|
+
key: "showQRLoader",
|
|
2449
|
+
value: function showQRLoader() {
|
|
2450
|
+
console.log('🔄 Affichage du loader - Scan QR initié');
|
|
2451
|
+
|
|
2452
|
+
// Chercher le conteneur QR dans différents IDs possibles
|
|
2453
|
+
var containerIds = ['qr-area', 'qr-container', 'sunuid-qr-container'];
|
|
2454
|
+
var container = null;
|
|
2455
|
+
for (var _i2 = 0, _containerIds = containerIds; _i2 < _containerIds.length; _i2++) {
|
|
2456
|
+
var id = _containerIds[_i2];
|
|
2457
|
+
container = document.getElementById(id);
|
|
2458
|
+
if (container) break;
|
|
2459
|
+
}
|
|
2460
|
+
if (!container) {
|
|
2461
|
+
console.warn('⚠️ Conteneur QR non trouvé pour afficher le loader');
|
|
2462
|
+
return;
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
// Remplacer le contenu par un loader animé
|
|
2466
|
+
container.innerHTML = "\n <div style=\"\n text-align: center;\n padding: 40px 20px;\n background: #f8f9fa;\n border: 2px solid #007bff;\n border-radius: 10px;\n color: #007bff;\n font-family: Arial, sans-serif;\n \">\n <div style=\"\n width: 60px;\n height: 60px;\n border: 4px solid #e3f2fd;\n border-top: 4px solid #007bff;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n margin: 0 auto 20px auto;\n \"></div>\n <h3 style=\"margin: 0 0 10px 0; color: #007bff;\">\uD83D\uDD0D Scan en cours...</h3>\n <p style=\"margin: 0; font-size: 14px;\">\n Veuillez patienter pendant la v\xE9rification de votre identit\xE9.\n </p>\n <div style=\"margin-top: 15px; font-size: 12px; color: #6c757d;\">\n \u23F1\uFE0F Traitement en cours...\n </div>\n </div>\n <style>\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n </style>\n ";
|
|
2467
|
+
console.log('✅ Loader affiché avec succès');
|
|
2468
|
+
}
|
|
2407
2469
|
}]);
|
|
2408
2470
|
}(); // Exposer la classe globalement
|
|
2409
2471
|
window.SunuID = SunuID;
|