sunuid-sdk 1.0.34 → 1.0.35
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 +48 -2
- package/dist/sunuid-sdk.esm.js.map +1 -1
- package/dist/sunuid-sdk.js +48 -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,19 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
590
594
|
console.log('⏰ QR expiré reçu:', data);
|
|
591
595
|
_this.handleQRExpired(data);
|
|
592
596
|
});
|
|
597
|
+
|
|
598
|
+
// Écouter tous les événements socket pour les logger
|
|
599
|
+
this.socket.onAny(function (eventName) {
|
|
600
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
601
|
+
args[_key - 1] = arguments[_key];
|
|
602
|
+
}
|
|
603
|
+
console.log("\uD83C\uDF10 Socket Event [".concat(eventName, "]:"), args);
|
|
604
|
+
|
|
605
|
+
// Si c'est un événement qr_scan_initiated, afficher le loader
|
|
606
|
+
if (eventName === 'qr_scan_initiated') {
|
|
607
|
+
_this.showQRLoader();
|
|
608
|
+
}
|
|
609
|
+
});
|
|
593
610
|
} else {
|
|
594
611
|
console.log('🌐 WebSocket déjà connecté');
|
|
595
612
|
}
|
|
@@ -743,6 +760,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
743
760
|
}, {
|
|
744
761
|
key: "handleQRStatusUpdate",
|
|
745
762
|
value: function handleQRStatusUpdate(data) {
|
|
763
|
+
console.log('📱 QR Status Update:', data);
|
|
746
764
|
if (this.config.onStatusUpdate) {
|
|
747
765
|
this.config.onStatusUpdate(data);
|
|
748
766
|
}
|
|
@@ -754,6 +772,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
754
772
|
}, {
|
|
755
773
|
key: "handleQRScanSuccess",
|
|
756
774
|
value: function handleQRScanSuccess(data) {
|
|
775
|
+
console.log('✅ QR Scan Success:', data);
|
|
757
776
|
if (this.config.onSuccess) {
|
|
758
777
|
this.config.onSuccess(data);
|
|
759
778
|
}
|
|
@@ -765,6 +784,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
765
784
|
}, {
|
|
766
785
|
key: "handleQRExpired",
|
|
767
786
|
value: function handleQRExpired(data) {
|
|
787
|
+
console.log('⏰ QR Expired:', data);
|
|
768
788
|
if (this.config.onExpired) {
|
|
769
789
|
this.config.onExpired(data);
|
|
770
790
|
}
|
|
@@ -2404,6 +2424,32 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
2404
2424
|
window.SunuIDSecurityLogs = [];
|
|
2405
2425
|
this.logSecurityEvent('SECURITY_LOGS_CLEARED');
|
|
2406
2426
|
}
|
|
2427
|
+
|
|
2428
|
+
/**
|
|
2429
|
+
* Afficher un loader pendant le scan du QR code
|
|
2430
|
+
*/
|
|
2431
|
+
}, {
|
|
2432
|
+
key: "showQRLoader",
|
|
2433
|
+
value: function showQRLoader() {
|
|
2434
|
+
console.log('🔄 Affichage du loader - Scan QR initié');
|
|
2435
|
+
|
|
2436
|
+
// Chercher le conteneur QR dans différents IDs possibles
|
|
2437
|
+
var containerIds = ['qr-area', 'qr-container', 'sunuid-qr-container'];
|
|
2438
|
+
var container = null;
|
|
2439
|
+
for (var _i2 = 0, _containerIds = containerIds; _i2 < _containerIds.length; _i2++) {
|
|
2440
|
+
var id = _containerIds[_i2];
|
|
2441
|
+
container = document.getElementById(id);
|
|
2442
|
+
if (container) break;
|
|
2443
|
+
}
|
|
2444
|
+
if (!container) {
|
|
2445
|
+
console.warn('⚠️ Conteneur QR non trouvé pour afficher le loader');
|
|
2446
|
+
return;
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
// Remplacer le contenu par un loader animé
|
|
2450
|
+
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 ";
|
|
2451
|
+
console.log('✅ Loader affiché avec succès');
|
|
2452
|
+
}
|
|
2407
2453
|
}]);
|
|
2408
2454
|
}(); // Exposer la classe globalement
|
|
2409
2455
|
window.SunuID = SunuID;
|