sunuid-sdk 1.0.35 → 1.0.37

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.
@@ -595,17 +595,33 @@ function _unsupportedIterableToArray(r, a) {
595
595
  _this.handleQRExpired(data);
596
596
  });
597
597
 
598
- // Écouter tous les événements socket pour les logger
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
599
620
  this.socket.onAny(function (eventName) {
600
621
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
601
622
  args[_key - 1] = arguments[_key];
602
623
  }
603
624
  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
625
  });
610
626
  } else {
611
627
  console.log('🌐 WebSocket déjà connecté');
@@ -2259,12 +2275,19 @@ function _unsupportedIterableToArray(r, a) {
2259
2275
  api: false,
2260
2276
  websocket: false,
2261
2277
  ready: false
2262
- }; // Vérifier l'API en utilisant l'endpoint debug
2278
+ }; // Vérifier l'API en utilisant l'endpoint debug avec les credentials
2263
2279
  _context19.p = 1;
2264
2280
  _context19.n = 2;
2265
2281
  return fetch(this.config.apiUrl + '/debug', {
2266
- method: 'GET',
2267
- timeout: 3000
2282
+ method: 'POST',
2283
+ headers: {
2284
+ 'Content-Type': 'application/json'
2285
+ },
2286
+ body: JSON.stringify({
2287
+ type: this.config.type,
2288
+ client_id: this.config.clientId,
2289
+ secret_id: this.config.secretId
2290
+ })
2268
2291
  });
2269
2292
  case 2:
2270
2293
  testResponse = _context19.v;
@@ -2276,12 +2299,14 @@ function _unsupportedIterableToArray(r, a) {
2276
2299
  return testResponse.json();
2277
2300
  case 3:
2278
2301
  debugData = _context19.v;
2279
- status.api = debugData.status === 'operational';
2280
- console.log('🔍 API Status:', debugData.status);
2302
+ // L'API est accessible si on reçoit une réponse avec success: true
2303
+ status.api = debugData.success === true;
2304
+ console.log('🔍 API Status:', status.api ? 'accessible' : 'inaccessible');
2281
2305
  _context19.n = 5;
2282
2306
  break;
2283
2307
  case 4:
2284
2308
  status.api = false;
2309
+ console.log('🔍 API Status: HTTP', testResponse.status);
2285
2310
  case 5:
2286
2311
  _context19.n = 7;
2287
2312
  break;