sunuid-sdk 1.0.41 → 1.0.42

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.
@@ -288,8 +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
+ autoInit: false,
292
+ // Désactivé par défaut pour éviter les boucles
293
293
  onSuccess: null,
294
294
  onError: null,
295
295
  onStatusUpdate: null,
@@ -327,6 +327,7 @@ function _unsupportedIterableToArray(r, a) {
327
327
  */
328
328
  var SunuID = /*#__PURE__*/function () {
329
329
  function SunuID() {
330
+ var _this = this;
330
331
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
331
332
  _classCallCheck(this, SunuID);
332
333
  this.config = _objectSpread2(_objectSpread2({}, DEFAULT_CONFIG), config);
@@ -334,10 +335,14 @@ function _unsupportedIterableToArray(r, a) {
334
335
  this.refreshTimer = null;
335
336
  this.isInitialized = false;
336
337
  this.socket = null;
338
+ this.initPromise = null;
337
339
 
338
- // Initialisation asynchrone seulement si autoInit est activé
339
- if (this.config.autoInit !== false) {
340
- this.initPromise = this.init();
340
+ // Initialisation asynchrone seulement si autoInit est explicitement activé
341
+ if (this.config.autoInit === true) {
342
+ // Délai pour éviter les conflits avec d'autres scripts
343
+ setTimeout(function () {
344
+ _this.init();
345
+ }, 100);
341
346
  }
342
347
  }
343
348
 
@@ -348,26 +353,61 @@ function _unsupportedIterableToArray(r, a) {
348
353
  key: "init",
349
354
  value: (function () {
350
355
  var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
351
- var _t;
352
356
  return _regenerator().w(function (_context) {
353
- while (1) switch (_context.p = _context.n) {
357
+ while (1) switch (_context.n) {
354
358
  case 0:
355
- _context.p = 0;
356
- if (!this.handleCallback()) {
359
+ if (!this.isInitialized) {
357
360
  _context.n = 1;
358
361
  break;
359
362
  }
360
- console.log(' Callback traité, initialisation terminée');
363
+ console.log('⚠️ SDK déjà initialisé, ignoré');
361
364
  return _context.a(2);
365
+ case 1:
366
+ if (!this.initPromise) {
367
+ _context.n = 2;
368
+ break;
369
+ }
370
+ console.log('⚠️ Initialisation déjà en cours, attente...');
371
+ return _context.a(2, this.initPromise);
372
+ case 2:
373
+ this.initPromise = this._doInit();
374
+ return _context.a(2, this.initPromise);
375
+ }
376
+ }, _callee, this);
377
+ }));
378
+ function init() {
379
+ return _init.apply(this, arguments);
380
+ }
381
+ return init;
382
+ }()
383
+ /**
384
+ * Initialisation interne du SDK
385
+ */
386
+ )
387
+ }, {
388
+ key: "_doInit",
389
+ value: (function () {
390
+ var _doInit2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
391
+ var _t;
392
+ return _regenerator().w(function (_context2) {
393
+ while (1) switch (_context2.p = _context2.n) {
394
+ case 0:
395
+ _context2.p = 0;
396
+ if (!this.handleCallback()) {
397
+ _context2.n = 1;
398
+ break;
399
+ }
400
+ console.log('✅ Callback traité, initialisation terminée');
401
+ return _context2.a(2);
362
402
  case 1:
363
403
  if (!this.config.secureInit) {
364
- _context.n = 3;
404
+ _context2.n = 3;
365
405
  break;
366
406
  }
367
- _context.n = 2;
407
+ _context2.n = 2;
368
408
  return this.secureInit();
369
409
  case 2:
370
- _context.n = 4;
410
+ _context2.n = 4;
371
411
  break;
372
412
  case 3:
373
413
  // Validation sécurisée des paramètres
@@ -383,7 +423,7 @@ function _unsupportedIterableToArray(r, a) {
383
423
  });
384
424
 
385
425
  // Récupérer les informations du partenaire depuis l'API
386
- _context.n = 5;
426
+ _context2.n = 5;
387
427
  return this.fetchPartnerInfo();
388
428
  case 5:
389
429
  // Obscurcir les credentials dans les logs
@@ -403,24 +443,24 @@ function _unsupportedIterableToArray(r, a) {
403
443
 
404
444
  // Initialiser la connexion WebSocket
405
445
  this.initWebSocket();
406
- _context.n = 7;
446
+ _context2.n = 7;
407
447
  break;
408
448
  case 6:
409
- _context.p = 6;
410
- _t = _context.v;
449
+ _context2.p = 6;
450
+ _t = _context2.v;
411
451
  this.logSecurityEvent('SDK_INIT_ERROR', {
412
452
  error: _t.message
413
453
  });
414
454
  throw _t;
415
455
  case 7:
416
- return _context.a(2);
456
+ return _context2.a(2);
417
457
  }
418
- }, _callee, this, [[0, 6]]);
458
+ }, _callee2, this, [[0, 6]]);
419
459
  }));
420
- function init() {
421
- return _init.apply(this, arguments);
460
+ function _doInit() {
461
+ return _doInit2.apply(this, arguments);
422
462
  }
423
- return init;
463
+ return _doInit;
424
464
  }()
425
465
  /**
426
466
  * Initialisation sécurisée via PHP
@@ -429,19 +469,19 @@ function _unsupportedIterableToArray(r, a) {
429
469
  }, {
430
470
  key: "secureInit",
431
471
  value: (function () {
432
- var _secureInit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
472
+ var _secureInit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
433
473
  var initData, response, result, decodedToken, _t2;
434
- return _regenerator().w(function (_context2) {
435
- while (1) switch (_context2.p = _context2.n) {
474
+ return _regenerator().w(function (_context3) {
475
+ while (1) switch (_context3.p = _context3.n) {
436
476
  case 0:
437
- _context2.p = 0;
477
+ _context3.p = 0;
438
478
  this.logSecurityEvent('SECURE_INIT_START');
439
479
  initData = {
440
480
  type: this.config.type,
441
481
  partnerName: this.config.partnerName,
442
482
  theme: this.config.theme
443
483
  };
444
- _context2.n = 1;
484
+ _context3.n = 1;
445
485
  return fetch(this.config.secureInitUrl, {
446
486
  method: 'POST',
447
487
  headers: {
@@ -451,20 +491,20 @@ function _unsupportedIterableToArray(r, a) {
451
491
  body: JSON.stringify(initData)
452
492
  });
453
493
  case 1:
454
- response = _context2.v;
494
+ response = _context3.v;
455
495
  if (response.ok) {
456
- _context2.n = 2;
496
+ _context3.n = 2;
457
497
  break;
458
498
  }
459
499
  throw new Error("Erreur HTTP: ".concat(response.status));
460
500
  case 2:
461
- _context2.n = 3;
501
+ _context3.n = 3;
462
502
  return response.json();
463
503
  case 3:
464
- result = _context2.v;
504
+ result = _context3.v;
465
505
  console.log('📋 Réponse initialisation sécurisée:', result);
466
506
  if (result.success) {
467
- _context2.n = 4;
507
+ _context3.n = 4;
468
508
  break;
469
509
  }
470
510
  throw new Error(result.error || 'Erreur lors de l\'initialisation sécurisée');
@@ -476,12 +516,12 @@ function _unsupportedIterableToArray(r, a) {
476
516
  // Décoder le token pour récupérer les credentials
477
517
  decodedToken = this.decodeSecureToken(result.data.token);
478
518
  if (!decodedToken) {
479
- _context2.n = 5;
519
+ _context3.n = 5;
480
520
  break;
481
521
  }
482
522
  this.config.clientId = decodedToken.client_id;
483
523
  this.config.secretId = decodedToken.secret_id;
484
- _context2.n = 6;
524
+ _context3.n = 6;
485
525
  break;
486
526
  case 5:
487
527
  throw new Error('Impossible de décoder le token sécurisé');
@@ -494,19 +534,19 @@ function _unsupportedIterableToArray(r, a) {
494
534
  maxRequests: result.data.max_requests
495
535
  });
496
536
  console.log('✅ Initialisation sécurisée réussie');
497
- _context2.n = 8;
537
+ _context3.n = 8;
498
538
  break;
499
539
  case 7:
500
- _context2.p = 7;
501
- _t2 = _context2.v;
540
+ _context3.p = 7;
541
+ _t2 = _context3.v;
502
542
  this.logSecurityEvent('SECURE_INIT_ERROR', {
503
543
  error: _t2.message
504
544
  });
505
545
  throw new Error("\xC9chec de l'initialisation s\xE9curis\xE9e: ".concat(_t2.message));
506
546
  case 8:
507
- return _context2.a(2);
547
+ return _context3.a(2);
508
548
  }
509
- }, _callee2, this, [[0, 7]]);
549
+ }, _callee3, this, [[0, 7]]);
510
550
  }));
511
551
  function secureInit() {
512
552
  return _secureInit.apply(this, arguments);
@@ -553,14 +593,14 @@ function _unsupportedIterableToArray(r, a) {
553
593
  }, {
554
594
  key: "initWebSocket",
555
595
  value: function initWebSocket() {
556
- var _this = this;
596
+ var _this2 = this;
557
597
  try {
558
598
  // Vérifier si Socket.IO est disponible
559
599
  if (typeof io === 'undefined') {
560
600
  console.warn('⚠️ Socket.IO non disponible, WebSocket sera initialisé plus tard');
561
601
  // Réessayer après un délai
562
602
  setTimeout(function () {
563
- return _this.initWebSocket();
603
+ return _this2.initWebSocket();
564
604
  }, 1000);
565
605
  return;
566
606
  }
@@ -584,36 +624,36 @@ function _unsupportedIterableToArray(r, a) {
584
624
  // Gestion des événements WebSocket
585
625
  this.socket.on('connect', function () {
586
626
  console.log('🌐 WebSocket connecté avec succès');
587
- console.log('📊 Socket ID:', _this.socket.id);
588
- _this.socket.connected = true;
627
+ console.log('📊 Socket ID:', _this2.socket.id);
628
+ _this2.socket.connected = true;
589
629
  });
590
630
  this.socket.on('disconnect', function (reason) {
591
631
  console.log('❌ WebSocket déconnecté:', reason);
592
- _this.socket.connected = false;
632
+ _this2.socket.connected = false;
593
633
  });
594
634
  this.socket.on('connect_error', function (error) {
595
635
  console.error('❌ Erreur connexion WebSocket:', error);
596
- _this.socket.connected = false;
636
+ _this2.socket.connected = false;
597
637
  });
598
638
 
599
639
  // Écouter les événements spécifiques
600
640
  this.socket.on('qr_status_update', function (data) {
601
641
  console.log('📱 Mise à jour statut QR reçue:', data);
602
- _this.handleQRStatusUpdate(data);
642
+ _this2.handleQRStatusUpdate(data);
603
643
  });
604
644
  this.socket.on('qr_scan_success', function (data) {
605
645
  console.log('✅ Scan QR réussi reçu:', data);
606
- _this.handleQRScanSuccess(data);
646
+ _this2.handleQRScanSuccess(data);
607
647
  });
608
648
  this.socket.on('qr_expired', function (data) {
609
649
  console.log('⏰ QR expiré reçu:', data);
610
- _this.handleQRExpired(data);
650
+ _this2.handleQRExpired(data);
611
651
  });
612
652
 
613
653
  // Écouter l'événement qr_scan_initiated spécifiquement
614
654
  this.socket.on('qr_scan_initiated', function (data) {
615
655
  console.log('🔍 QR Scan Initiated reçu:', data);
616
- _this.showQRLoader();
656
+ _this2.showQRLoader();
617
657
  });
618
658
 
619
659
  // Écouter l'événement message générique (fallback)
@@ -621,7 +661,7 @@ function _unsupportedIterableToArray(r, a) {
621
661
  console.log('📨 Message socket reçu:', data);
622
662
  if (data && data.type === 'qr_scan_initiated') {
623
663
  console.log('🔍 QR Scan Initiated détecté dans message:', data);
624
- _this.showQRLoader();
664
+ _this2.showQRLoader();
625
665
  }
626
666
  });
627
667
 
@@ -865,7 +905,7 @@ function _unsupportedIterableToArray(r, a) {
865
905
  }, {
866
906
  key: "generateQR",
867
907
  value: (function () {
868
- var _generateQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
908
+ var _generateQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
869
909
  var containerId,
870
910
  options,
871
911
  connectionStatus,
@@ -875,25 +915,25 @@ function _unsupportedIterableToArray(r, a) {
875
915
  response,
876
916
  qrImageUrl,
877
917
  isLocal,
878
- _args3 = arguments,
918
+ _args4 = arguments,
879
919
  _t3,
880
920
  _t4;
881
- return _regenerator().w(function (_context3) {
882
- while (1) switch (_context3.p = _context3.n) {
921
+ return _regenerator().w(function (_context4) {
922
+ while (1) switch (_context4.p = _context4.n) {
883
923
  case 0:
884
- containerId = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : 'sunuid-qr-container';
885
- options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
924
+ containerId = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : 'sunuid-qr-container';
925
+ options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
886
926
  if (!this.initPromise) {
887
- _context3.n = 2;
927
+ _context4.n = 2;
888
928
  break;
889
929
  }
890
- _context3.n = 1;
930
+ _context4.n = 1;
891
931
  return this.initPromise;
892
932
  case 1:
893
933
  this.initPromise = null;
894
934
  case 2:
895
935
  if (this.isInitialized) {
896
- _context3.n = 3;
936
+ _context4.n = 3;
897
937
  break;
898
938
  }
899
939
  throw new Error('SunuID: SDK non initialisé');
@@ -902,22 +942,22 @@ function _unsupportedIterableToArray(r, a) {
902
942
 
903
943
  // Attendre que les connexions soient prêtes
904
944
  console.log('🔍 Attente connexions API et WebSocket...');
905
- _context3.p = 4;
906
- _context3.n = 5;
945
+ _context4.p = 4;
946
+ _context4.n = 5;
907
947
  return this.waitForConnections(5000);
908
948
  case 5:
909
- connectionStatus = _context3.v;
949
+ connectionStatus = _context4.v;
910
950
  // 5 secondes max
911
951
  console.log('✅ Connexions prêtes:', connectionStatus);
912
- _context3.n = 7;
952
+ _context4.n = 7;
913
953
  break;
914
954
  case 6:
915
- _context3.p = 6;
916
- _t3 = _context3.v;
955
+ _context4.p = 6;
956
+ _t3 = _context4.v;
917
957
  console.error('❌ Erreur connexions:', _t3.message);
918
958
  throw new Error('Connexions non disponibles - Impossible de générer le QR code');
919
959
  case 7:
920
- _context3.p = 7;
960
+ _context4.p = 7;
921
961
  // Utiliser uniquement le socketID comme contenu du QR
922
962
  socketId = this.socket ? this.socket.id : 'timeout-socket-id';
923
963
  qrContent = socketId;
@@ -926,7 +966,7 @@ function _unsupportedIterableToArray(r, a) {
926
966
 
927
967
  // Générer le QR avec le contenu complet
928
968
  partnerName = this.config.partnerName || 'Partner_unknown';
929
- _context3.n = 8;
969
+ _context4.n = 8;
930
970
  return this.makeRequest('/qr-generate', _objectSpread2({
931
971
  type: this.config.type,
932
972
  data: qrContent,
@@ -934,9 +974,9 @@ function _unsupportedIterableToArray(r, a) {
934
974
  label: "".concat(this.getTypeName(this.config.type), " ").concat(partnerName)
935
975
  }, options));
936
976
  case 8:
937
- response = _context3.v;
977
+ response = _context4.v;
938
978
  if (!response.success) {
939
- _context3.n = 11;
979
+ _context4.n = 11;
940
980
  break;
941
981
  }
942
982
  // Debug: Afficher la structure complète de la réponse
@@ -951,7 +991,7 @@ function _unsupportedIterableToArray(r, a) {
951
991
 
952
992
  // Vérifier si l'URL du QR code existe
953
993
  if (qrImageUrl) {
954
- _context3.n = 10;
994
+ _context4.n = 10;
955
995
  break;
956
996
  }
957
997
  console.warn('⚠️ qrCodeUrl non trouvé dans la réponse, recherche d\'alternatives...');
@@ -959,11 +999,11 @@ function _unsupportedIterableToArray(r, a) {
959
999
  // Essayer d'autres champs possibles
960
1000
  qrImageUrl = response.data.qr_url || response.data.qrUrl || response.data.url || response.data.image_url || response.data.imageUrl;
961
1001
  if (!qrImageUrl) {
962
- _context3.n = 9;
1002
+ _context4.n = 9;
963
1003
  break;
964
1004
  }
965
1005
  console.log('✅ URL QR trouvée dans un champ alternatif:', qrImageUrl);
966
- _context3.n = 10;
1006
+ _context4.n = 10;
967
1007
  break;
968
1008
  case 9:
969
1009
  console.error('❌ Aucune URL QR trouvée dans la réponse');
@@ -989,7 +1029,7 @@ function _unsupportedIterableToArray(r, a) {
989
1029
  sessionId: response.data.sessionId,
990
1030
  timestamp: Date.now()
991
1031
  });
992
- return _context3.a(2, _objectSpread2(_objectSpread2({}, response.data), {}, {
1032
+ return _context4.a(2, _objectSpread2(_objectSpread2({}, response.data), {}, {
993
1033
  qrCodeUrl: qrImageUrl,
994
1034
  qrContent: qrContent,
995
1035
  label: response.data.label,
@@ -998,11 +1038,11 @@ function _unsupportedIterableToArray(r, a) {
998
1038
  case 11:
999
1039
  throw new Error(response.message || 'Erreur lors de la génération du QR code');
1000
1040
  case 12:
1001
- _context3.n = 14;
1041
+ _context4.n = 14;
1002
1042
  break;
1003
1043
  case 13:
1004
- _context3.p = 13;
1005
- _t4 = _context3.v;
1044
+ _context4.p = 13;
1045
+ _t4 = _context4.v;
1006
1046
  console.error('Erreur API détectée:', _t4.message);
1007
1047
  console.error('Stack trace complet:', _t4.stack);
1008
1048
  console.error('Configuration SDK:', {
@@ -1034,9 +1074,9 @@ function _unsupportedIterableToArray(r, a) {
1034
1074
  this.displayServiceUnavailable(containerId, this.config.type);
1035
1075
  throw new Error('Service non disponible');
1036
1076
  case 14:
1037
- return _context3.a(2);
1077
+ return _context4.a(2);
1038
1078
  }
1039
- }, _callee3, this, [[7, 13], [4, 6]]);
1079
+ }, _callee4, this, [[7, 13], [4, 6]]);
1040
1080
  }));
1041
1081
  function generateQR() {
1042
1082
  return _generateQR.apply(this, arguments);
@@ -1050,41 +1090,41 @@ function _unsupportedIterableToArray(r, a) {
1050
1090
  }, {
1051
1091
  key: "generateCustomQR",
1052
1092
  value: (function () {
1053
- var _generateCustomQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(containerId, type) {
1093
+ var _generateCustomQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(containerId, type) {
1054
1094
  var options,
1055
1095
  response,
1056
1096
  imageBaseUrl,
1057
1097
  qrImageUrl,
1058
- _args4 = arguments,
1098
+ _args5 = arguments,
1059
1099
  _t5;
1060
- return _regenerator().w(function (_context4) {
1061
- while (1) switch (_context4.p = _context4.n) {
1100
+ return _regenerator().w(function (_context5) {
1101
+ while (1) switch (_context5.p = _context5.n) {
1062
1102
  case 0:
1063
- options = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
1103
+ options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
1064
1104
  if (!this.initPromise) {
1065
- _context4.n = 2;
1105
+ _context5.n = 2;
1066
1106
  break;
1067
1107
  }
1068
- _context4.n = 1;
1108
+ _context5.n = 1;
1069
1109
  return this.initPromise;
1070
1110
  case 1:
1071
1111
  this.initPromise = null;
1072
1112
  case 2:
1073
1113
  if (this.isInitialized) {
1074
- _context4.n = 3;
1114
+ _context5.n = 3;
1075
1115
  break;
1076
1116
  }
1077
1117
  throw new Error('SunuID: SDK non initialisé');
1078
1118
  case 3:
1079
- _context4.p = 3;
1080
- _context4.n = 4;
1119
+ _context5.p = 3;
1120
+ _context5.n = 4;
1081
1121
  return this.makeRequest('/qr-generate', _objectSpread2({
1082
1122
  type: type
1083
1123
  }, options));
1084
1124
  case 4:
1085
- response = _context4.v;
1125
+ response = _context5.v;
1086
1126
  if (!response.success) {
1087
- _context4.n = 5;
1127
+ _context5.n = 5;
1088
1128
  break;
1089
1129
  }
1090
1130
  // Construire l'URL complète de l'image QR avec la base URL pour les images
@@ -1097,18 +1137,18 @@ function _unsupportedIterableToArray(r, a) {
1097
1137
  console.log('📄 Code de session:', response.data.code);
1098
1138
  console.log('🆔 Service ID:', response.data.service_id);
1099
1139
  this.startAutoRefresh(containerId, type, options);
1100
- return _context4.a(2, _objectSpread2(_objectSpread2({}, response.data), {}, {
1140
+ return _context5.a(2, _objectSpread2(_objectSpread2({}, response.data), {}, {
1101
1141
  qrCodeUrl: qrImageUrl,
1102
1142
  sessionId: response.data.service_id
1103
1143
  }));
1104
1144
  case 5:
1105
1145
  throw new Error(response.message || 'Erreur lors de la génération du QR code');
1106
1146
  case 6:
1107
- _context4.n = 8;
1147
+ _context5.n = 8;
1108
1148
  break;
1109
1149
  case 7:
1110
- _context4.p = 7;
1111
- _t5 = _context4.v;
1150
+ _context5.p = 7;
1151
+ _t5 = _context5.v;
1112
1152
  console.error('Erreur API détectée:', _t5.message);
1113
1153
  console.error('Stack trace complet:', _t5.stack);
1114
1154
  console.error('Configuration SDK (Custom):', {
@@ -1122,9 +1162,9 @@ function _unsupportedIterableToArray(r, a) {
1122
1162
  this.displayServiceUnavailable(containerId, type);
1123
1163
  throw new Error('Service non disponible');
1124
1164
  case 8:
1125
- return _context4.a(2);
1165
+ return _context5.a(2);
1126
1166
  }
1127
- }, _callee4, this, [[3, 7]]);
1167
+ }, _callee5, this, [[3, 7]]);
1128
1168
  }));
1129
1169
  function generateCustomQR(_x, _x2) {
1130
1170
  return _generateCustomQR.apply(this, arguments);
@@ -1135,16 +1175,16 @@ function _unsupportedIterableToArray(r, a) {
1135
1175
  }, {
1136
1176
  key: "generateAuthQR",
1137
1177
  value: function () {
1138
- var _generateAuthQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(containerId) {
1178
+ var _generateAuthQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(containerId) {
1139
1179
  var options,
1140
- _args5 = arguments;
1141
- return _regenerator().w(function (_context5) {
1142
- while (1) switch (_context5.n) {
1180
+ _args6 = arguments;
1181
+ return _regenerator().w(function (_context6) {
1182
+ while (1) switch (_context6.n) {
1143
1183
  case 0:
1144
- options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
1145
- return _context5.a(2, this.generateQR(containerId, options));
1184
+ options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
1185
+ return _context6.a(2, this.generateQR(containerId, options));
1146
1186
  }
1147
- }, _callee5, this);
1187
+ }, _callee6, this);
1148
1188
  }));
1149
1189
  function generateAuthQR(_x3) {
1150
1190
  return _generateAuthQR.apply(this, arguments);
@@ -1154,31 +1194,31 @@ function _unsupportedIterableToArray(r, a) {
1154
1194
  }, {
1155
1195
  key: "generateKYCQR",
1156
1196
  value: function () {
1157
- var _generateKYCQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(containerId) {
1197
+ var _generateKYCQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(containerId) {
1158
1198
  var options,
1159
1199
  originalType,
1160
- _args6 = arguments;
1161
- return _regenerator().w(function (_context6) {
1162
- while (1) switch (_context6.p = _context6.n) {
1200
+ _args7 = arguments;
1201
+ return _regenerator().w(function (_context7) {
1202
+ while (1) switch (_context7.p = _context7.n) {
1163
1203
  case 0:
1164
- options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
1204
+ options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
1165
1205
  // Sauvegarder le type actuel
1166
1206
  originalType = this.config.type; // Changer temporairement le type pour KYC
1167
1207
  this.config.type = 1;
1168
- _context6.p = 1;
1169
- _context6.n = 2;
1208
+ _context7.p = 1;
1209
+ _context7.n = 2;
1170
1210
  return this.generateQR(containerId, options);
1171
1211
  case 2:
1172
- return _context6.a(2, _context6.v);
1212
+ return _context7.a(2, _context7.v);
1173
1213
  case 3:
1174
- _context6.p = 3;
1214
+ _context7.p = 3;
1175
1215
  // Restaurer le type original
1176
1216
  this.config.type = originalType;
1177
- return _context6.f(3);
1217
+ return _context7.f(3);
1178
1218
  case 4:
1179
- return _context6.a(2);
1219
+ return _context7.a(2);
1180
1220
  }
1181
- }, _callee6, this, [[1,, 3, 4]]);
1221
+ }, _callee7, this, [[1,, 3, 4]]);
1182
1222
  }));
1183
1223
  function generateKYCQR(_x4) {
1184
1224
  return _generateKYCQR.apply(this, arguments);
@@ -1188,31 +1228,31 @@ function _unsupportedIterableToArray(r, a) {
1188
1228
  }, {
1189
1229
  key: "generateSignatureQR",
1190
1230
  value: function () {
1191
- var _generateSignatureQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(containerId) {
1231
+ var _generateSignatureQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(containerId) {
1192
1232
  var options,
1193
1233
  originalType,
1194
- _args7 = arguments;
1195
- return _regenerator().w(function (_context7) {
1196
- while (1) switch (_context7.p = _context7.n) {
1234
+ _args8 = arguments;
1235
+ return _regenerator().w(function (_context8) {
1236
+ while (1) switch (_context8.p = _context8.n) {
1197
1237
  case 0:
1198
- options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
1238
+ options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
1199
1239
  // Sauvegarder le type actuel
1200
1240
  originalType = this.config.type; // Changer temporairement le type pour Signature
1201
1241
  this.config.type = 3;
1202
- _context7.p = 1;
1203
- _context7.n = 2;
1242
+ _context8.p = 1;
1243
+ _context8.n = 2;
1204
1244
  return this.generateQR(containerId, options);
1205
1245
  case 2:
1206
- return _context7.a(2, _context7.v);
1246
+ return _context8.a(2, _context8.v);
1207
1247
  case 3:
1208
- _context7.p = 3;
1248
+ _context8.p = 3;
1209
1249
  // Restaurer le type original
1210
1250
  this.config.type = originalType;
1211
- return _context7.f(3);
1251
+ return _context8.f(3);
1212
1252
  case 4:
1213
- return _context7.a(2);
1253
+ return _context8.a(2);
1214
1254
  }
1215
- }, _callee7, this, [[1,, 3, 4]]);
1255
+ }, _callee8, this, [[1,, 3, 4]]);
1216
1256
  }));
1217
1257
  function generateSignatureQR(_x5) {
1218
1258
  return _generateSignatureQR.apply(this, arguments);
@@ -1225,43 +1265,43 @@ function _unsupportedIterableToArray(r, a) {
1225
1265
  }, {
1226
1266
  key: "checkQRStatus",
1227
1267
  value: (function () {
1228
- var _checkQRStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(sessionId) {
1268
+ var _checkQRStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(sessionId) {
1229
1269
  var response, _t6;
1230
- return _regenerator().w(function (_context8) {
1231
- while (1) switch (_context8.p = _context8.n) {
1270
+ return _regenerator().w(function (_context9) {
1271
+ while (1) switch (_context9.p = _context9.n) {
1232
1272
  case 0:
1233
1273
  if (this.isInitialized) {
1234
- _context8.n = 1;
1274
+ _context9.n = 1;
1235
1275
  break;
1236
1276
  }
1237
1277
  throw new Error('SunuID: SDK non initialisé');
1238
1278
  case 1:
1239
- _context8.p = 1;
1240
- _context8.n = 2;
1279
+ _context9.p = 1;
1280
+ _context9.n = 2;
1241
1281
  return this.makeRequest('/qr-status', {
1242
1282
  serviceId: sessionId
1243
1283
  });
1244
1284
  case 2:
1245
- response = _context8.v;
1285
+ response = _context9.v;
1246
1286
  if (!response.success) {
1247
- _context8.n = 3;
1287
+ _context9.n = 3;
1248
1288
  break;
1249
1289
  }
1250
- return _context8.a(2, response.data);
1290
+ return _context9.a(2, response.data);
1251
1291
  case 3:
1252
1292
  throw new Error(response.message || 'Erreur lors de la vérification du statut');
1253
1293
  case 4:
1254
- _context8.n = 6;
1294
+ _context9.n = 6;
1255
1295
  break;
1256
1296
  case 5:
1257
- _context8.p = 5;
1258
- _t6 = _context8.v;
1297
+ _context9.p = 5;
1298
+ _t6 = _context9.v;
1259
1299
  this.handleError(_t6);
1260
1300
  throw _t6;
1261
1301
  case 6:
1262
- return _context8.a(2);
1302
+ return _context9.a(2);
1263
1303
  }
1264
- }, _callee8, this, [[1, 5]]);
1304
+ }, _callee9, this, [[1, 5]]);
1265
1305
  }));
1266
1306
  function checkQRStatus(_x6) {
1267
1307
  return _checkQRStatus.apply(this, arguments);
@@ -1275,47 +1315,47 @@ function _unsupportedIterableToArray(r, a) {
1275
1315
  }, {
1276
1316
  key: "generateQRWithContent",
1277
1317
  value: (function () {
1278
- var _generateQRWithContent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(content, containerId, type) {
1318
+ var _generateQRWithContent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(content, containerId, type) {
1279
1319
  var options,
1280
1320
  localQRUrl,
1281
- _args9 = arguments,
1321
+ _args0 = arguments,
1282
1322
  _t7;
1283
- return _regenerator().w(function (_context9) {
1284
- while (1) switch (_context9.p = _context9.n) {
1323
+ return _regenerator().w(function (_context0) {
1324
+ while (1) switch (_context0.p = _context0.n) {
1285
1325
  case 0:
1286
- options = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : {};
1326
+ options = _args0.length > 3 && _args0[3] !== undefined ? _args0[3] : {};
1287
1327
  console.log('🎨 Génération QR avec contenu:', content);
1288
- _context9.p = 1;
1328
+ _context0.p = 1;
1289
1329
  if (!(window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1' || window.location.protocol === 'file:')) {
1290
- _context9.n = 3;
1330
+ _context0.n = 3;
1291
1331
  break;
1292
1332
  }
1293
1333
  console.log('🏠 Utilisation service QR local...');
1294
- _context9.n = 2;
1334
+ _context0.n = 2;
1295
1335
  return this.generateQRLocal(content, containerId, type, options);
1296
1336
  case 2:
1297
- localQRUrl = _context9.v;
1337
+ localQRUrl = _context0.v;
1298
1338
  if (!localQRUrl) {
1299
- _context9.n = 3;
1339
+ _context0.n = 3;
1300
1340
  break;
1301
1341
  }
1302
- return _context9.a(2, localQRUrl);
1342
+ return _context0.a(2, localQRUrl);
1303
1343
  case 3:
1304
1344
  // Fallback vers le service QR distant
1305
1345
  console.log('🌐 Utilisation service QR distant...');
1306
- _context9.n = 4;
1346
+ _context0.n = 4;
1307
1347
  return this.generateQRRemote(content, containerId, type, options);
1308
1348
  case 4:
1309
- return _context9.a(2, _context9.v);
1349
+ return _context0.a(2, _context0.v);
1310
1350
  case 5:
1311
- _context9.p = 5;
1312
- _t7 = _context9.v;
1351
+ _context0.p = 5;
1352
+ _t7 = _context0.v;
1313
1353
  console.error('❌ Erreur génération QR:', _t7);
1314
1354
  // Fallback vers affichage simple du contenu
1315
1355
  this.displayQRContent(containerId, content, type, options);
1316
- return _context9.a(2, null);
1356
+ return _context0.a(2, null);
1317
1357
  }
1318
- }, _callee9, this, [[1, 5]]);
1358
+ }, _callee0, this, [[1, 5]]);
1319
1359
  }));
1320
1360
  function generateQRWithContent(_x7, _x8, _x9) {
1321
1361
  return _generateQRWithContent.apply(this, arguments);
@@ -1329,19 +1369,19 @@ function _unsupportedIterableToArray(r, a) {
1329
1369
  }, {
1330
1370
  key: "generateQRLocal",
1331
1371
  value: (function () {
1332
- var _generateQRLocal = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(content, containerId, type) {
1372
+ var _generateQRLocal = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(content, containerId, type) {
1333
1373
  var options,
1334
1374
  response,
1335
1375
  data,
1336
1376
  qrUrl,
1337
- _args0 = arguments,
1377
+ _args1 = arguments,
1338
1378
  _t8;
1339
- return _regenerator().w(function (_context0) {
1340
- while (1) switch (_context0.p = _context0.n) {
1379
+ return _regenerator().w(function (_context1) {
1380
+ while (1) switch (_context1.p = _context1.n) {
1341
1381
  case 0:
1342
- options = _args0.length > 3 && _args0[3] !== undefined ? _args0[3] : {};
1343
- _context0.p = 1;
1344
- _context0.n = 2;
1382
+ options = _args1.length > 3 && _args1[3] !== undefined ? _args1[3] : {};
1383
+ _context1.p = 1;
1384
+ _context1.n = 2;
1345
1385
  return fetch('http://localhost:8000/api/generate/text', {
1346
1386
  method: 'POST',
1347
1387
  headers: {
@@ -1350,29 +1390,29 @@ function _unsupportedIterableToArray(r, a) {
1350
1390
  body: "text=".concat(encodeURIComponent(content), "&size=300")
1351
1391
  });
1352
1392
  case 2:
1353
- response = _context0.v;
1393
+ response = _context1.v;
1354
1394
  if (!response.ok) {
1355
- _context0.n = 4;
1395
+ _context1.n = 4;
1356
1396
  break;
1357
1397
  }
1358
- _context0.n = 3;
1398
+ _context1.n = 3;
1359
1399
  return response.json();
1360
1400
  case 3:
1361
- data = _context0.v;
1401
+ data = _context1.v;
1362
1402
  qrUrl = "data:image/png;base64,".concat(data.qrcode);
1363
1403
  this.displayQRCode(containerId, qrUrl, type, options);
1364
- return _context0.a(2, qrUrl);
1404
+ return _context1.a(2, qrUrl);
1365
1405
  case 4:
1366
- _context0.n = 6;
1406
+ _context1.n = 6;
1367
1407
  break;
1368
1408
  case 5:
1369
- _context0.p = 5;
1370
- _t8 = _context0.v;
1409
+ _context1.p = 5;
1410
+ _t8 = _context1.v;
1371
1411
  console.log('❌ Service QR local non disponible:', _t8.message);
1372
1412
  case 6:
1373
- return _context0.a(2, null);
1413
+ return _context1.a(2, null);
1374
1414
  }
1375
- }, _callee0, this, [[1, 5]]);
1415
+ }, _callee1, this, [[1, 5]]);
1376
1416
  }));
1377
1417
  function generateQRLocal(_x0, _x1, _x10) {
1378
1418
  return _generateQRLocal.apply(this, arguments);
@@ -1386,19 +1426,19 @@ function _unsupportedIterableToArray(r, a) {
1386
1426
  }, {
1387
1427
  key: "generateQRRemote",
1388
1428
  value: (function () {
1389
- var _generateQRRemote = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(content, containerId, type) {
1429
+ var _generateQRRemote = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(content, containerId, type) {
1390
1430
  var options,
1391
1431
  response,
1392
1432
  data,
1393
1433
  qrUrl,
1394
- _args1 = arguments,
1434
+ _args10 = arguments,
1395
1435
  _t9;
1396
- return _regenerator().w(function (_context1) {
1397
- while (1) switch (_context1.p = _context1.n) {
1436
+ return _regenerator().w(function (_context10) {
1437
+ while (1) switch (_context10.p = _context10.n) {
1398
1438
  case 0:
1399
- options = _args1.length > 3 && _args1[3] !== undefined ? _args1[3] : {};
1400
- _context1.p = 1;
1401
- _context1.n = 2;
1439
+ options = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : {};
1440
+ _context10.p = 1;
1441
+ _context10.n = 2;
1402
1442
  return fetch('https://api.sunuid.fayma.sn/qr-generate', {
1403
1443
  method: 'POST',
1404
1444
  headers: {
@@ -1411,31 +1451,31 @@ function _unsupportedIterableToArray(r, a) {
1411
1451
  })
1412
1452
  });
1413
1453
  case 2:
1414
- response = _context1.v;
1454
+ response = _context10.v;
1415
1455
  if (!response.ok) {
1416
- _context1.n = 4;
1456
+ _context10.n = 4;
1417
1457
  break;
1418
1458
  }
1419
- _context1.n = 3;
1459
+ _context10.n = 3;
1420
1460
  return response.json();
1421
1461
  case 3:
1422
- data = _context1.v;
1462
+ data = _context10.v;
1423
1463
  qrUrl = "data:image/png;base64,".concat(data.qrcode);
1424
1464
  this.displayQRCode(containerId, qrUrl, type, options);
1425
- return _context1.a(2, qrUrl);
1465
+ return _context10.a(2, qrUrl);
1426
1466
  case 4:
1427
- _context1.n = 6;
1467
+ _context10.n = 6;
1428
1468
  break;
1429
1469
  case 5:
1430
- _context1.p = 5;
1431
- _t9 = _context1.v;
1470
+ _context10.p = 5;
1471
+ _t9 = _context10.v;
1432
1472
  console.error('❌ Erreur service QR distant:', _t9);
1433
1473
  case 6:
1434
1474
  // Fallback vers affichage du contenu
1435
1475
  this.displayQRContent(containerId, content, type, options);
1436
- return _context1.a(2, null);
1476
+ return _context10.a(2, null);
1437
1477
  }
1438
- }, _callee1, this, [[1, 5]]);
1478
+ }, _callee10, this, [[1, 5]]);
1439
1479
  }));
1440
1480
  function generateQRRemote(_x11, _x12, _x13) {
1441
1481
  return _generateQRRemote.apply(this, arguments);
@@ -1493,11 +1533,11 @@ function _unsupportedIterableToArray(r, a) {
1493
1533
  }, {
1494
1534
  key: "generateCustomQRCode",
1495
1535
  value: (function () {
1496
- var _generateCustomQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(content, label) {
1536
+ var _generateCustomQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(content, label) {
1497
1537
  var qrContainer,
1498
1538
  _t0;
1499
- return _regenerator().w(function (_context10) {
1500
- while (1) switch (_context10.p = _context10.n) {
1539
+ return _regenerator().w(function (_context11) {
1540
+ while (1) switch (_context11.p = _context11.n) {
1501
1541
  case 0:
1502
1542
  console.log('🎨 Début génération QR personnalisé...');
1503
1543
  console.log('📄 Contenu:', content);
@@ -1509,37 +1549,37 @@ function _unsupportedIterableToArray(r, a) {
1509
1549
  qrContainer = document.getElementById('qr-container');
1510
1550
  }
1511
1551
  if (qrContainer) {
1512
- _context10.n = 1;
1552
+ _context11.n = 1;
1513
1553
  break;
1514
1554
  }
1515
1555
  console.error('❌ QR container not found');
1516
- return _context10.a(2);
1556
+ return _context11.a(2);
1517
1557
  case 1:
1518
1558
  console.log('✅ QR container trouvé');
1519
1559
 
1520
1560
  // Nettoyer le conteneur
1521
1561
  qrContainer.innerHTML = '<div style="text-align: center; padding: 20px;"><p>Génération QR code...</p></div>';
1522
- _context10.p = 2;
1562
+ _context11.p = 2;
1523
1563
  // Utiliser directement l'API principale (plus fiable)
1524
1564
  console.log('🎨 Tentative génération via API principale...');
1525
- _context10.n = 3;
1565
+ _context11.n = 3;
1526
1566
  return this.generateQRPHP(content, label, qrContainer);
1527
1567
  case 3:
1528
1568
  console.log('✅ QR code généré avec succès');
1529
- _context10.n = 5;
1569
+ _context11.n = 5;
1530
1570
  break;
1531
1571
  case 4:
1532
- _context10.p = 4;
1533
- _t0 = _context10.v;
1572
+ _context11.p = 4;
1573
+ _t0 = _context11.v;
1534
1574
  console.error('❌ Erreur génération API:', _t0);
1535
1575
 
1536
1576
  // Fallback final : image par défaut
1537
1577
  console.log('⚠️ Affichage image par défaut');
1538
1578
  this.displayDefaultQR(qrContainer, content, label);
1539
1579
  case 5:
1540
- return _context10.a(2);
1580
+ return _context11.a(2);
1541
1581
  }
1542
- }, _callee10, this, [[2, 4]]);
1582
+ }, _callee11, this, [[2, 4]]);
1543
1583
  }));
1544
1584
  function generateCustomQRCode(_x14, _x15) {
1545
1585
  return _generateCustomQRCode.apply(this, arguments);
@@ -1553,17 +1593,17 @@ function _unsupportedIterableToArray(r, a) {
1553
1593
  }, {
1554
1594
  key: "generateQRClientSide",
1555
1595
  value: (function () {
1556
- var _generateQRClientSide = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(content, label, qrContainer) {
1557
- var _this2 = this;
1596
+ var _generateQRClientSide = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(content, label, qrContainer) {
1597
+ var _this3 = this;
1558
1598
  var canvas, ctx;
1559
- return _regenerator().w(function (_context11) {
1560
- while (1) switch (_context11.n) {
1599
+ return _regenerator().w(function (_context12) {
1600
+ while (1) switch (_context12.n) {
1561
1601
  case 0:
1562
- _context11.n = 1;
1602
+ _context12.n = 1;
1563
1603
  return this.ensureQRCodeLibrary();
1564
1604
  case 1:
1565
1605
  if (!(typeof QRCode === 'undefined')) {
1566
- _context11.n = 2;
1606
+ _context12.n = 2;
1567
1607
  break;
1568
1608
  }
1569
1609
  throw new Error('QRCode library non disponible');
@@ -1577,7 +1617,7 @@ function _unsupportedIterableToArray(r, a) {
1577
1617
  ctx.fillRect(0, 0, 300, 320);
1578
1618
 
1579
1619
  // Générer le QR code
1580
- return _context11.a(2, new Promise(function (resolve, reject) {
1620
+ return _context12.a(2, new Promise(function (resolve, reject) {
1581
1621
  QRCode.toCanvas(canvas, content, {
1582
1622
  width: 280,
1583
1623
  margin: 10,
@@ -1601,18 +1641,18 @@ function _unsupportedIterableToArray(r, a) {
1601
1641
  var dataUrl = canvas.toDataURL('image/png');
1602
1642
 
1603
1643
  // Stocker l'URL
1604
- _this2.currentQRUrl = dataUrl;
1644
+ _this3.currentQRUrl = dataUrl;
1605
1645
 
1606
1646
  // Afficher le QR code
1607
1647
  qrContainer.innerHTML = "\n <div style=\"text-align: center; padding: 20px;\">\n <img src=\"".concat(dataUrl, "\" alt=\"QR Code\" style=\"max-width: 300px; border: 2px solid #ddd; border-radius: 10px;\">\n </div>\n ");
1608
1648
 
1609
1649
  // Afficher les instructions
1610
- _this2.showQRInstructions(qrContainer);
1650
+ _this3.showQRInstructions(qrContainer);
1611
1651
  resolve();
1612
1652
  });
1613
1653
  }));
1614
1654
  }
1615
- }, _callee11, this);
1655
+ }, _callee12, this);
1616
1656
  }));
1617
1657
  function generateQRClientSide(_x16, _x17, _x18) {
1618
1658
  return _generateQRClientSide.apply(this, arguments);
@@ -1626,10 +1666,10 @@ function _unsupportedIterableToArray(r, a) {
1626
1666
  }, {
1627
1667
  key: "generateQRPHP",
1628
1668
  value: (function () {
1629
- var _generateQRPHP = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(content, label, qrContainer) {
1669
+ var _generateQRPHP = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(content, label, qrContainer) {
1630
1670
  var qrGeneratorUrl, requestBody, contentType, response, responseData, qrImageUrl, imageBaseUrl;
1631
- return _regenerator().w(function (_context12) {
1632
- while (1) switch (_context12.n) {
1671
+ return _regenerator().w(function (_context13) {
1672
+ while (1) switch (_context13.n) {
1633
1673
  case 0:
1634
1674
  // Construire l'URL - Utiliser l'API principale qui fonctionne
1635
1675
 
@@ -1667,7 +1707,7 @@ function _unsupportedIterableToArray(r, a) {
1667
1707
  label: label
1668
1708
  });
1669
1709
  }
1670
- _context12.n = 1;
1710
+ _context13.n = 1;
1671
1711
  return fetch(qrGeneratorUrl, {
1672
1712
  method: 'POST',
1673
1713
  headers: {
@@ -1677,19 +1717,19 @@ function _unsupportedIterableToArray(r, a) {
1677
1717
  body: requestBody
1678
1718
  });
1679
1719
  case 1:
1680
- response = _context12.v;
1720
+ response = _context13.v;
1681
1721
  if (response.ok) {
1682
- _context12.n = 2;
1722
+ _context13.n = 2;
1683
1723
  break;
1684
1724
  }
1685
1725
  throw new Error("Erreur HTTP: ".concat(response.status));
1686
1726
  case 2:
1687
- _context12.n = 3;
1727
+ _context13.n = 3;
1688
1728
  return response.json();
1689
1729
  case 3:
1690
- responseData = _context12.v;
1730
+ responseData = _context13.v;
1691
1731
  if (responseData.success) {
1692
- _context12.n = 4;
1732
+ _context13.n = 4;
1693
1733
  break;
1694
1734
  }
1695
1735
  throw new Error("Erreur QR: ".concat(responseData.error));
@@ -1712,9 +1752,9 @@ function _unsupportedIterableToArray(r, a) {
1712
1752
  // Afficher les instructions
1713
1753
  this.showQRInstructions(qrContainer);
1714
1754
  case 5:
1715
- return _context12.a(2);
1755
+ return _context13.a(2);
1716
1756
  }
1717
- }, _callee12, this);
1757
+ }, _callee13, this);
1718
1758
  }));
1719
1759
  function generateQRPHP(_x19, _x20, _x21) {
1720
1760
  return _generateQRPHP.apply(this, arguments);
@@ -1737,19 +1777,19 @@ function _unsupportedIterableToArray(r, a) {
1737
1777
  }, {
1738
1778
  key: "ensureQRCodeLibrary",
1739
1779
  value: (function () {
1740
- var _ensureQRCodeLibrary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
1741
- return _regenerator().w(function (_context13) {
1742
- while (1) switch (_context13.n) {
1780
+ var _ensureQRCodeLibrary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
1781
+ return _regenerator().w(function (_context14) {
1782
+ while (1) switch (_context14.n) {
1743
1783
  case 0:
1744
1784
  if (!(typeof QRCode !== 'undefined')) {
1745
- _context13.n = 1;
1785
+ _context14.n = 1;
1746
1786
  break;
1747
1787
  }
1748
1788
  console.log('✅ QRCode library déjà disponible');
1749
- return _context13.a(2, true);
1789
+ return _context14.a(2, true);
1750
1790
  case 1:
1751
1791
  console.log('📦 Chargement QRCode library...');
1752
- return _context13.a(2, new Promise(function (resolve, reject) {
1792
+ return _context14.a(2, new Promise(function (resolve, reject) {
1753
1793
  var script = document.createElement('script');
1754
1794
  script.src = 'https://cdn.jsdelivr.net/npm/qrcode@1.5.3/lib/browser.min.js';
1755
1795
  script.onload = function () {
@@ -1770,7 +1810,7 @@ function _unsupportedIterableToArray(r, a) {
1770
1810
  document.head.appendChild(script);
1771
1811
  }));
1772
1812
  }
1773
- }, _callee13);
1813
+ }, _callee14);
1774
1814
  }));
1775
1815
  function ensureQRCodeLibrary() {
1776
1816
  return _ensureQRCodeLibrary.apply(this, arguments);
@@ -1857,19 +1897,19 @@ function _unsupportedIterableToArray(r, a) {
1857
1897
  }, {
1858
1898
  key: "refreshQR",
1859
1899
  value: (function () {
1860
- var _refreshQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(containerId) {
1900
+ var _refreshQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(containerId) {
1861
1901
  var options,
1862
1902
  result,
1863
1903
  _result,
1864
- _args14 = arguments,
1904
+ _args15 = arguments,
1865
1905
  _t1;
1866
- return _regenerator().w(function (_context14) {
1867
- while (1) switch (_context14.p = _context14.n) {
1906
+ return _regenerator().w(function (_context15) {
1907
+ while (1) switch (_context15.p = _context15.n) {
1868
1908
  case 0:
1869
- options = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {};
1870
- _context14.p = 1;
1909
+ options = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : {};
1910
+ _context15.p = 1;
1871
1911
  if (!this.currentQRUrl) {
1872
- _context14.n = 3;
1912
+ _context15.n = 3;
1873
1913
  break;
1874
1914
  }
1875
1915
  console.log('🔄 Vérification du statut du QR code existant...');
@@ -1879,31 +1919,31 @@ function _unsupportedIterableToArray(r, a) {
1879
1919
 
1880
1920
  // Option 2: Régénérer le QR code seulement si nécessaire
1881
1921
  // Pour l'instant, on régénère pour s'assurer qu'il est à jour
1882
- _context14.n = 2;
1922
+ _context15.n = 2;
1883
1923
  return this.generateQR(containerId, options);
1884
1924
  case 2:
1885
- result = _context14.v;
1886
- return _context14.a(2, result);
1925
+ result = _context15.v;
1926
+ return _context15.a(2, result);
1887
1927
  case 3:
1888
1928
  console.log('🔄 Pas de QR code existant, génération d\'un nouveau...');
1889
- _context14.n = 4;
1929
+ _context15.n = 4;
1890
1930
  return this.generateQR(containerId, options);
1891
1931
  case 4:
1892
- _result = _context14.v;
1893
- return _context14.a(2, _result);
1932
+ _result = _context15.v;
1933
+ return _context15.a(2, _result);
1894
1934
  case 5:
1895
- _context14.n = 7;
1935
+ _context15.n = 7;
1896
1936
  break;
1897
1937
  case 6:
1898
- _context14.p = 6;
1899
- _t1 = _context14.v;
1938
+ _context15.p = 6;
1939
+ _t1 = _context15.v;
1900
1940
  console.error('Erreur lors du rafraîchissement:', _t1.message);
1901
1941
  this.displayServiceUnavailable(containerId, this.config.type);
1902
1942
  throw _t1;
1903
1943
  case 7:
1904
- return _context14.a(2);
1944
+ return _context15.a(2);
1905
1945
  }
1906
- }, _callee14, this, [[1, 6]]);
1946
+ }, _callee15, this, [[1, 6]]);
1907
1947
  }));
1908
1948
  function refreshQR(_x22) {
1909
1949
  return _refreshQR.apply(this, arguments);
@@ -1917,7 +1957,7 @@ function _unsupportedIterableToArray(r, a) {
1917
1957
  }, {
1918
1958
  key: "startAutoRefresh",
1919
1959
  value: function startAutoRefresh(containerId, type, options) {
1920
- var _this3 = this;
1960
+ var _this4 = this;
1921
1961
  if (!this.config.autoRefresh) return;
1922
1962
 
1923
1963
  // Arrêter le timer existant s'il y en a un
@@ -1925,26 +1965,26 @@ function _unsupportedIterableToArray(r, a) {
1925
1965
  clearInterval(this.refreshTimer);
1926
1966
  console.log('🔄 Timer de rafraîchissement précédent arrêté');
1927
1967
  }
1928
- this.refreshTimer = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
1968
+ this.refreshTimer = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
1929
1969
  var _t10;
1930
- return _regenerator().w(function (_context15) {
1931
- while (1) switch (_context15.p = _context15.n) {
1970
+ return _regenerator().w(function (_context16) {
1971
+ while (1) switch (_context16.p = _context16.n) {
1932
1972
  case 0:
1933
- _context15.p = 0;
1973
+ _context16.p = 0;
1934
1974
  console.log('🔄 Rafraîchissement automatique du QR code...');
1935
- _context15.n = 1;
1936
- return _this3.refreshQR(containerId, type, options);
1975
+ _context16.n = 1;
1976
+ return _this4.refreshQR(containerId, type, options);
1937
1977
  case 1:
1938
- _context15.n = 3;
1978
+ _context16.n = 3;
1939
1979
  break;
1940
1980
  case 2:
1941
- _context15.p = 2;
1942
- _t10 = _context15.v;
1981
+ _context16.p = 2;
1982
+ _t10 = _context16.v;
1943
1983
  console.warn('Erreur lors du rafraîchissement automatique:', _t10);
1944
1984
  case 3:
1945
- return _context15.a(2);
1985
+ return _context16.a(2);
1946
1986
  }
1947
- }, _callee15, null, [[0, 2]]);
1987
+ }, _callee16, null, [[0, 2]]);
1948
1988
  })), this.config.refreshInterval);
1949
1989
  console.log("\uD83D\uDD04 Timer de rafra\xEEchissement d\xE9marr\xE9 (".concat(this.config.refreshInterval, "ms)"));
1950
1990
  }
@@ -1959,16 +1999,16 @@ function _unsupportedIterableToArray(r, a) {
1959
1999
  }, {
1960
2000
  key: "makeRequest",
1961
2001
  value: (function () {
1962
- var _makeRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(endpoint, data) {
2002
+ var _makeRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(endpoint, data) {
1963
2003
  var _window$SunuIDConfig4,
1964
2004
  _window$SunuIDConfig5,
1965
- _this4 = this;
2005
+ _this5 = this;
1966
2006
  var sanitizedData, endpointPath, url, retryCount, maxRetries, _loop, _ret;
1967
- return _regenerator().w(function (_context17) {
1968
- while (1) switch (_context17.n) {
2007
+ return _regenerator().w(function (_context18) {
2008
+ while (1) switch (_context18.n) {
1969
2009
  case 0:
1970
2010
  if (this.isInitialized) {
1971
- _context17.n = 1;
2011
+ _context18.n = 1;
1972
2012
  break;
1973
2013
  }
1974
2014
  this.logSecurityEvent('REQUEST_BEFORE_INIT', {
@@ -1977,12 +2017,12 @@ function _unsupportedIterableToArray(r, a) {
1977
2017
  throw new Error('SDK non initialisé');
1978
2018
  case 1:
1979
2019
  if (!this.config.secureInit) {
1980
- _context17.n = 2;
2020
+ _context18.n = 2;
1981
2021
  break;
1982
2022
  }
1983
2023
  this.config.requestCount++;
1984
2024
  if (!(this.config.requestCount > this.config.maxRequests)) {
1985
- _context17.n = 2;
2025
+ _context18.n = 2;
1986
2026
  break;
1987
2027
  }
1988
2028
  this.logSecurityEvent('API_REQUEST_LIMIT_EXCEEDED', {
@@ -2018,14 +2058,14 @@ function _unsupportedIterableToArray(r, a) {
2018
2058
  maxRetries = this.config.maxRetries;
2019
2059
  _loop = /*#__PURE__*/_regenerator().m(function _loop() {
2020
2060
  var controller, timeoutId, headers, response, errorText, errorData, result, _t11;
2021
- return _regenerator().w(function (_context16) {
2022
- while (1) switch (_context16.p = _context16.n) {
2061
+ return _regenerator().w(function (_context17) {
2062
+ while (1) switch (_context17.p = _context17.n) {
2023
2063
  case 0:
2024
- _context16.p = 0;
2064
+ _context17.p = 0;
2025
2065
  controller = new AbortController();
2026
2066
  timeoutId = setTimeout(function () {
2027
2067
  return controller.abort();
2028
- }, _this4.config.requestTimeout); // Headers minimaux (API SunuID n'accepte que les headers essentiels)
2068
+ }, _this5.config.requestTimeout); // Headers minimaux (API SunuID n'accepte que les headers essentiels)
2029
2069
  headers = {
2030
2070
  'Content-Type': 'application/json'
2031
2071
  }; // Note: En mode sécurisé, les credentials sont dans le body
@@ -2033,7 +2073,7 @@ function _unsupportedIterableToArray(r, a) {
2033
2073
  // if (this.config.secureInit && this.config.token) {
2034
2074
  // headers['X-Secure-Token'] = this.config.token;
2035
2075
  // }
2036
- _context16.n = 1;
2076
+ _context17.n = 1;
2037
2077
  return fetch(url, {
2038
2078
  method: 'POST',
2039
2079
  headers: headers,
@@ -2041,16 +2081,16 @@ function _unsupportedIterableToArray(r, a) {
2041
2081
  signal: controller.signal
2042
2082
  });
2043
2083
  case 1:
2044
- response = _context16.v;
2084
+ response = _context17.v;
2045
2085
  clearTimeout(timeoutId);
2046
2086
  if (response.ok) {
2047
- _context16.n = 3;
2087
+ _context17.n = 3;
2048
2088
  break;
2049
2089
  }
2050
- _context16.n = 2;
2090
+ _context17.n = 2;
2051
2091
  return response.text();
2052
2092
  case 2:
2053
- errorText = _context16.v;
2093
+ errorText = _context17.v;
2054
2094
  try {
2055
2095
  errorData = JSON.parse(errorText);
2056
2096
  } catch (e) {
@@ -2058,88 +2098,88 @@ function _unsupportedIterableToArray(r, a) {
2058
2098
  message: errorText
2059
2099
  };
2060
2100
  }
2061
- _this4.logSecurityEvent('API_REQUEST_ERROR', {
2101
+ _this5.logSecurityEvent('API_REQUEST_ERROR', {
2062
2102
  status: response.status,
2063
2103
  statusText: response.statusText,
2064
2104
  error: errorData.message
2065
2105
  });
2066
2106
  throw new Error(errorData.message || "Erreur HTTP: ".concat(response.status));
2067
2107
  case 3:
2068
- _context16.n = 4;
2108
+ _context17.n = 4;
2069
2109
  return response.json();
2070
2110
  case 4:
2071
- result = _context16.v;
2072
- _this4.logSecurityEvent('API_REQUEST_SUCCESS', {
2111
+ result = _context17.v;
2112
+ _this5.logSecurityEvent('API_REQUEST_SUCCESS', {
2073
2113
  endpoint: endpointPath,
2074
2114
  responseKeys: Object.keys(result)
2075
2115
  });
2076
- return _context16.a(2, {
2116
+ return _context17.a(2, {
2077
2117
  v: result
2078
2118
  });
2079
2119
  case 5:
2080
- _context16.p = 5;
2081
- _t11 = _context16.v;
2120
+ _context17.p = 5;
2121
+ _t11 = _context17.v;
2082
2122
  retryCount++;
2083
2123
  if (!(_t11.name === 'AbortError')) {
2084
- _context16.n = 7;
2124
+ _context17.n = 7;
2085
2125
  break;
2086
2126
  }
2087
- _this4.logSecurityEvent('API_REQUEST_TIMEOUT', {
2127
+ _this5.logSecurityEvent('API_REQUEST_TIMEOUT', {
2088
2128
  retryCount: retryCount
2089
2129
  });
2090
2130
  if (!(retryCount > maxRetries)) {
2091
- _context16.n = 6;
2131
+ _context17.n = 6;
2092
2132
  break;
2093
2133
  }
2094
2134
  throw new Error('Timeout de la requête API');
2095
2135
  case 6:
2096
- return _context16.a(2, 0);
2136
+ return _context17.a(2, 0);
2097
2137
  case 7:
2098
2138
  if (!(retryCount > maxRetries)) {
2099
- _context16.n = 8;
2139
+ _context17.n = 8;
2100
2140
  break;
2101
2141
  }
2102
- _this4.logSecurityEvent('API_REQUEST_MAX_RETRIES', {
2142
+ _this5.logSecurityEvent('API_REQUEST_MAX_RETRIES', {
2103
2143
  retryCount: retryCount,
2104
2144
  error: _t11.message
2105
2145
  });
2106
2146
  throw _t11;
2107
2147
  case 8:
2108
- _context16.n = 9;
2148
+ _context17.n = 9;
2109
2149
  return new Promise(function (resolve) {
2110
2150
  return setTimeout(resolve, 1000 * retryCount);
2111
2151
  });
2112
2152
  case 9:
2113
- return _context16.a(2);
2153
+ return _context17.a(2);
2114
2154
  }
2115
2155
  }, _loop, null, [[0, 5]]);
2116
2156
  });
2117
2157
  case 3:
2118
2158
  if (!(retryCount <= maxRetries)) {
2119
- _context17.n = 7;
2159
+ _context18.n = 7;
2120
2160
  break;
2121
2161
  }
2122
- return _context17.d(_regeneratorValues(_loop()), 4);
2162
+ return _context18.d(_regeneratorValues(_loop()), 4);
2123
2163
  case 4:
2124
- _ret = _context17.v;
2164
+ _ret = _context18.v;
2125
2165
  if (!(_ret === 0)) {
2126
- _context17.n = 5;
2166
+ _context18.n = 5;
2127
2167
  break;
2128
2168
  }
2129
- return _context17.a(3, 3);
2169
+ return _context18.a(3, 3);
2130
2170
  case 5:
2131
2171
  if (!_ret) {
2132
- _context17.n = 6;
2172
+ _context18.n = 6;
2133
2173
  break;
2134
2174
  }
2135
- return _context17.a(2, _ret.v);
2175
+ return _context18.a(2, _ret.v);
2136
2176
  case 6:
2137
- _context17.n = 3;
2177
+ _context18.n = 3;
2138
2178
  break;
2139
2179
  case 7:
2140
- return _context17.a(2);
2180
+ return _context18.a(2);
2141
2181
  }
2142
- }, _callee16, this);
2182
+ }, _callee17, this);
2143
2183
  }));
2144
2184
  function makeRequest(_x23, _x24) {
2145
2185
  return _makeRequest.apply(this, arguments);
@@ -2210,20 +2250,20 @@ function _unsupportedIterableToArray(r, a) {
2210
2250
  }, {
2211
2251
  key: "fetchPartnerInfo",
2212
2252
  value: (function () {
2213
- var _fetchPartnerInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
2253
+ var _fetchPartnerInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
2214
2254
  var response, data, partnerId, _t12;
2215
- return _regenerator().w(function (_context18) {
2216
- while (1) switch (_context18.p = _context18.n) {
2255
+ return _regenerator().w(function (_context19) {
2256
+ while (1) switch (_context19.p = _context19.n) {
2217
2257
  case 0:
2218
- _context18.p = 0;
2219
- _context18.n = 1;
2258
+ _context19.p = 0;
2259
+ _context19.n = 1;
2220
2260
  return this.makeRequest('/debug', {
2221
2261
  type: this.config.type,
2222
2262
  client_id: this.config.clientId,
2223
2263
  secret_id: this.config.secretId
2224
2264
  });
2225
2265
  case 1:
2226
- response = _context18.v;
2266
+ response = _context19.v;
2227
2267
  console.log('📋 Réponse debug API:', response);
2228
2268
 
2229
2269
  // Vérifier la structure de la réponse
@@ -2267,17 +2307,17 @@ function _unsupportedIterableToArray(r, a) {
2267
2307
  console.warn('⚠️ Structure de réponse invalide, utilisation du partner_id par défaut');
2268
2308
  this.config.partnerName = "Partner_".concat(this.config.partnerId || 'unknown');
2269
2309
  }
2270
- _context18.n = 3;
2310
+ _context19.n = 3;
2271
2311
  break;
2272
2312
  case 2:
2273
- _context18.p = 2;
2274
- _t12 = _context18.v;
2313
+ _context19.p = 2;
2314
+ _t12 = _context19.v;
2275
2315
  console.warn('⚠️ Erreur lors de la récupération des informations du partenaire:', _t12.message);
2276
2316
  this.config.partnerName = 'Partner_unknown';
2277
2317
  case 3:
2278
- return _context18.a(2);
2318
+ return _context19.a(2);
2279
2319
  }
2280
- }, _callee17, this, [[0, 2]]);
2320
+ }, _callee18, this, [[0, 2]]);
2281
2321
  }));
2282
2322
  function fetchPartnerInfo() {
2283
2323
  return _fetchPartnerInfo.apply(this, arguments);
@@ -2315,18 +2355,18 @@ function _unsupportedIterableToArray(r, a) {
2315
2355
  }, {
2316
2356
  key: "checkConnections",
2317
2357
  value: (function () {
2318
- var _checkConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
2358
+ var _checkConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
2319
2359
  var status, testResponse, debugData, _t13;
2320
- return _regenerator().w(function (_context19) {
2321
- while (1) switch (_context19.p = _context19.n) {
2360
+ return _regenerator().w(function (_context20) {
2361
+ while (1) switch (_context20.p = _context20.n) {
2322
2362
  case 0:
2323
2363
  status = {
2324
2364
  api: false,
2325
2365
  websocket: false,
2326
2366
  ready: false
2327
2367
  }; // Vérifier l'API en utilisant l'endpoint debug avec les credentials
2328
- _context19.p = 1;
2329
- _context19.n = 2;
2368
+ _context20.p = 1;
2369
+ _context20.n = 2;
2330
2370
  return fetch(this.config.apiUrl + '/debug', {
2331
2371
  method: 'POST',
2332
2372
  headers: {
@@ -2339,29 +2379,29 @@ function _unsupportedIterableToArray(r, a) {
2339
2379
  })
2340
2380
  });
2341
2381
  case 2:
2342
- testResponse = _context19.v;
2382
+ testResponse = _context20.v;
2343
2383
  if (!testResponse.ok) {
2344
- _context19.n = 4;
2384
+ _context20.n = 4;
2345
2385
  break;
2346
2386
  }
2347
- _context19.n = 3;
2387
+ _context20.n = 3;
2348
2388
  return testResponse.json();
2349
2389
  case 3:
2350
- debugData = _context19.v;
2390
+ debugData = _context20.v;
2351
2391
  // L'API est accessible si on reçoit une réponse avec success: true
2352
2392
  status.api = debugData.success === true;
2353
2393
  console.log('🔍 API Status:', status.api ? 'accessible' : 'inaccessible');
2354
- _context19.n = 5;
2394
+ _context20.n = 5;
2355
2395
  break;
2356
2396
  case 4:
2357
2397
  status.api = false;
2358
2398
  console.log('🔍 API Status: HTTP', testResponse.status);
2359
2399
  case 5:
2360
- _context19.n = 7;
2400
+ _context20.n = 7;
2361
2401
  break;
2362
2402
  case 6:
2363
- _context19.p = 6;
2364
- _t13 = _context19.v;
2403
+ _context20.p = 6;
2404
+ _t13 = _context20.v;
2365
2405
  console.log('🔍 Test API échoué:', _t13.message);
2366
2406
  status.api = false;
2367
2407
  case 7:
@@ -2370,9 +2410,9 @@ function _unsupportedIterableToArray(r, a) {
2370
2410
 
2371
2411
  // Connexions prêtes si API est accessible
2372
2412
  status.ready = status.api;
2373
- return _context19.a(2, status);
2413
+ return _context20.a(2, status);
2374
2414
  }
2375
- }, _callee18, this, [[1, 6]]);
2415
+ }, _callee19, this, [[1, 6]]);
2376
2416
  }));
2377
2417
  function checkConnections() {
2378
2418
  return _checkConnections.apply(this, arguments);
@@ -2386,46 +2426,46 @@ function _unsupportedIterableToArray(r, a) {
2386
2426
  }, {
2387
2427
  key: "waitForConnections",
2388
2428
  value: (function () {
2389
- var _waitForConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
2429
+ var _waitForConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
2390
2430
  var timeout,
2391
2431
  startTime,
2392
2432
  status,
2393
- _args20 = arguments;
2394
- return _regenerator().w(function (_context20) {
2395
- while (1) switch (_context20.n) {
2433
+ _args21 = arguments;
2434
+ return _regenerator().w(function (_context21) {
2435
+ while (1) switch (_context21.n) {
2396
2436
  case 0:
2397
- timeout = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : 5000;
2437
+ timeout = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : 5000;
2398
2438
  startTime = Date.now();
2399
2439
  case 1:
2400
2440
  if (!(Date.now() - startTime < timeout)) {
2401
- _context20.n = 5;
2441
+ _context21.n = 5;
2402
2442
  break;
2403
2443
  }
2404
- _context20.n = 2;
2444
+ _context21.n = 2;
2405
2445
  return this.checkConnections();
2406
2446
  case 2:
2407
- status = _context20.v;
2447
+ status = _context21.v;
2408
2448
  if (!status.ready) {
2409
- _context20.n = 3;
2449
+ _context21.n = 3;
2410
2450
  break;
2411
2451
  }
2412
2452
  console.log('✅ Connexions prêtes');
2413
- return _context20.a(2, status);
2453
+ return _context21.a(2, status);
2414
2454
  case 3:
2415
2455
  console.log('⏳ Attente connexions...', status);
2416
- _context20.n = 4;
2456
+ _context21.n = 4;
2417
2457
  return new Promise(function (resolve) {
2418
2458
  return setTimeout(resolve, 1000);
2419
2459
  });
2420
2460
  case 4:
2421
- _context20.n = 1;
2461
+ _context21.n = 1;
2422
2462
  break;
2423
2463
  case 5:
2424
2464
  throw new Error('Timeout connexions - Impossible de générer le QR code');
2425
2465
  case 6:
2426
- return _context20.a(2);
2466
+ return _context21.a(2);
2427
2467
  }
2428
- }, _callee19, this);
2468
+ }, _callee20, this);
2429
2469
  }));
2430
2470
  function waitForConnections() {
2431
2471
  return _waitForConnections.apply(this, arguments);