sunuid-sdk 1.0.41 → 1.0.43

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.
@@ -291,8 +291,8 @@
291
291
  // Désactivé par défaut pour éviter les appels répétitifs
292
292
  refreshInterval: 30000,
293
293
  // 30 secondes
294
- autoInit: true,
295
- // Initialisation automatique par défaut
294
+ autoInit: false,
295
+ // Désactivé par défaut pour éviter les boucles
296
296
  onSuccess: null,
297
297
  onError: null,
298
298
  onStatusUpdate: null,
@@ -337,11 +337,11 @@
337
337
  this.refreshTimer = null;
338
338
  this.isInitialized = false;
339
339
  this.socket = null;
340
+ this.initPromise = null;
340
341
 
341
- // Initialisation asynchrone seulement si autoInit est activé
342
- if (this.config.autoInit !== false) {
343
- this.initPromise = this.init();
344
- }
342
+ // DÉSACTIVÉ : Initialisation automatique pour éviter les boucles
343
+ // L'utilisateur doit appeler init() manuellement
344
+ console.log('🔧 SDK SunuID créé - Appelez init() manuellement');
345
345
  }
346
346
 
347
347
  /**
@@ -351,26 +351,77 @@
351
351
  key: "init",
352
352
  value: (function () {
353
353
  var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
354
- var _t;
355
354
  return _regenerator().w(function (_context) {
356
355
  while (1) switch (_context.p = _context.n) {
357
356
  case 0:
358
- _context.p = 0;
359
- if (!this.handleCallback()) {
357
+ if (!this.isInitialized) {
360
358
  _context.n = 1;
361
359
  break;
362
360
  }
363
- console.log(' Callback traité, initialisation terminée');
361
+ console.log('⚠️ SDK déjà initialisé, ignoré');
364
362
  return _context.a(2);
365
363
  case 1:
366
- if (!this.config.secureInit) {
364
+ if (!this.initPromise) {
365
+ _context.n = 2;
366
+ break;
367
+ }
368
+ console.log('⚠️ Initialisation déjà en cours, attente...');
369
+ return _context.a(2, this.initPromise);
370
+ case 2:
371
+ if (!this._initInProgress) {
367
372
  _context.n = 3;
368
373
  break;
369
374
  }
370
- _context.n = 2;
375
+ console.log('⚠️ Initialisation en cours, ignoré');
376
+ return _context.a(2);
377
+ case 3:
378
+ this._initInProgress = true;
379
+ this.initPromise = this._doInit();
380
+ _context.p = 4;
381
+ _context.n = 5;
382
+ return this.initPromise;
383
+ case 5:
384
+ _context.p = 5;
385
+ this._initInProgress = false;
386
+ return _context.f(5);
387
+ case 6:
388
+ return _context.a(2, this.initPromise);
389
+ }
390
+ }, _callee, this, [[4,, 5, 6]]);
391
+ }));
392
+ function init() {
393
+ return _init.apply(this, arguments);
394
+ }
395
+ return init;
396
+ }()
397
+ /**
398
+ * Initialisation interne du SDK
399
+ */
400
+ )
401
+ }, {
402
+ key: "_doInit",
403
+ value: (function () {
404
+ var _doInit2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
405
+ var _t;
406
+ return _regenerator().w(function (_context2) {
407
+ while (1) switch (_context2.p = _context2.n) {
408
+ case 0:
409
+ _context2.p = 0;
410
+ if (!this.handleCallback()) {
411
+ _context2.n = 1;
412
+ break;
413
+ }
414
+ console.log('✅ Callback traité, initialisation terminée');
415
+ return _context2.a(2);
416
+ case 1:
417
+ if (!this.config.secureInit) {
418
+ _context2.n = 3;
419
+ break;
420
+ }
421
+ _context2.n = 2;
371
422
  return this.secureInit();
372
423
  case 2:
373
- _context.n = 4;
424
+ _context2.n = 4;
374
425
  break;
375
426
  case 3:
376
427
  // Validation sécurisée des paramètres
@@ -386,7 +437,7 @@
386
437
  });
387
438
 
388
439
  // Récupérer les informations du partenaire depuis l'API
389
- _context.n = 5;
440
+ _context2.n = 5;
390
441
  return this.fetchPartnerInfo();
391
442
  case 5:
392
443
  // Obscurcir les credentials dans les logs
@@ -406,24 +457,24 @@
406
457
 
407
458
  // Initialiser la connexion WebSocket
408
459
  this.initWebSocket();
409
- _context.n = 7;
460
+ _context2.n = 7;
410
461
  break;
411
462
  case 6:
412
- _context.p = 6;
413
- _t = _context.v;
463
+ _context2.p = 6;
464
+ _t = _context2.v;
414
465
  this.logSecurityEvent('SDK_INIT_ERROR', {
415
466
  error: _t.message
416
467
  });
417
468
  throw _t;
418
469
  case 7:
419
- return _context.a(2);
470
+ return _context2.a(2);
420
471
  }
421
- }, _callee, this, [[0, 6]]);
472
+ }, _callee2, this, [[0, 6]]);
422
473
  }));
423
- function init() {
424
- return _init.apply(this, arguments);
474
+ function _doInit() {
475
+ return _doInit2.apply(this, arguments);
425
476
  }
426
- return init;
477
+ return _doInit;
427
478
  }()
428
479
  /**
429
480
  * Initialisation sécurisée via PHP
@@ -432,19 +483,19 @@
432
483
  }, {
433
484
  key: "secureInit",
434
485
  value: (function () {
435
- var _secureInit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
486
+ var _secureInit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
436
487
  var initData, response, result, decodedToken, _t2;
437
- return _regenerator().w(function (_context2) {
438
- while (1) switch (_context2.p = _context2.n) {
488
+ return _regenerator().w(function (_context3) {
489
+ while (1) switch (_context3.p = _context3.n) {
439
490
  case 0:
440
- _context2.p = 0;
491
+ _context3.p = 0;
441
492
  this.logSecurityEvent('SECURE_INIT_START');
442
493
  initData = {
443
494
  type: this.config.type,
444
495
  partnerName: this.config.partnerName,
445
496
  theme: this.config.theme
446
497
  };
447
- _context2.n = 1;
498
+ _context3.n = 1;
448
499
  return fetch(this.config.secureInitUrl, {
449
500
  method: 'POST',
450
501
  headers: {
@@ -454,20 +505,20 @@
454
505
  body: JSON.stringify(initData)
455
506
  });
456
507
  case 1:
457
- response = _context2.v;
508
+ response = _context3.v;
458
509
  if (response.ok) {
459
- _context2.n = 2;
510
+ _context3.n = 2;
460
511
  break;
461
512
  }
462
513
  throw new Error("Erreur HTTP: ".concat(response.status));
463
514
  case 2:
464
- _context2.n = 3;
515
+ _context3.n = 3;
465
516
  return response.json();
466
517
  case 3:
467
- result = _context2.v;
518
+ result = _context3.v;
468
519
  console.log('📋 Réponse initialisation sécurisée:', result);
469
520
  if (result.success) {
470
- _context2.n = 4;
521
+ _context3.n = 4;
471
522
  break;
472
523
  }
473
524
  throw new Error(result.error || 'Erreur lors de l\'initialisation sécurisée');
@@ -479,12 +530,12 @@
479
530
  // Décoder le token pour récupérer les credentials
480
531
  decodedToken = this.decodeSecureToken(result.data.token);
481
532
  if (!decodedToken) {
482
- _context2.n = 5;
533
+ _context3.n = 5;
483
534
  break;
484
535
  }
485
536
  this.config.clientId = decodedToken.client_id;
486
537
  this.config.secretId = decodedToken.secret_id;
487
- _context2.n = 6;
538
+ _context3.n = 6;
488
539
  break;
489
540
  case 5:
490
541
  throw new Error('Impossible de décoder le token sécurisé');
@@ -497,19 +548,19 @@
497
548
  maxRequests: result.data.max_requests
498
549
  });
499
550
  console.log('✅ Initialisation sécurisée réussie');
500
- _context2.n = 8;
551
+ _context3.n = 8;
501
552
  break;
502
553
  case 7:
503
- _context2.p = 7;
504
- _t2 = _context2.v;
554
+ _context3.p = 7;
555
+ _t2 = _context3.v;
505
556
  this.logSecurityEvent('SECURE_INIT_ERROR', {
506
557
  error: _t2.message
507
558
  });
508
559
  throw new Error("\xC9chec de l'initialisation s\xE9curis\xE9e: ".concat(_t2.message));
509
560
  case 8:
510
- return _context2.a(2);
561
+ return _context3.a(2);
511
562
  }
512
- }, _callee2, this, [[0, 7]]);
563
+ }, _callee3, this, [[0, 7]]);
513
564
  }));
514
565
  function secureInit() {
515
566
  return _secureInit.apply(this, arguments);
@@ -868,7 +919,7 @@
868
919
  }, {
869
920
  key: "generateQR",
870
921
  value: (function () {
871
- var _generateQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
922
+ var _generateQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
872
923
  var containerId,
873
924
  options,
874
925
  connectionStatus,
@@ -878,25 +929,25 @@
878
929
  response,
879
930
  qrImageUrl,
880
931
  isLocal,
881
- _args3 = arguments,
932
+ _args4 = arguments,
882
933
  _t3,
883
934
  _t4;
884
- return _regenerator().w(function (_context3) {
885
- while (1) switch (_context3.p = _context3.n) {
935
+ return _regenerator().w(function (_context4) {
936
+ while (1) switch (_context4.p = _context4.n) {
886
937
  case 0:
887
- containerId = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : 'sunuid-qr-container';
888
- options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
938
+ containerId = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : 'sunuid-qr-container';
939
+ options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
889
940
  if (!this.initPromise) {
890
- _context3.n = 2;
941
+ _context4.n = 2;
891
942
  break;
892
943
  }
893
- _context3.n = 1;
944
+ _context4.n = 1;
894
945
  return this.initPromise;
895
946
  case 1:
896
947
  this.initPromise = null;
897
948
  case 2:
898
949
  if (this.isInitialized) {
899
- _context3.n = 3;
950
+ _context4.n = 3;
900
951
  break;
901
952
  }
902
953
  throw new Error('SunuID: SDK non initialisé');
@@ -905,22 +956,22 @@
905
956
 
906
957
  // Attendre que les connexions soient prêtes
907
958
  console.log('🔍 Attente connexions API et WebSocket...');
908
- _context3.p = 4;
909
- _context3.n = 5;
959
+ _context4.p = 4;
960
+ _context4.n = 5;
910
961
  return this.waitForConnections(5000);
911
962
  case 5:
912
- connectionStatus = _context3.v;
963
+ connectionStatus = _context4.v;
913
964
  // 5 secondes max
914
965
  console.log('✅ Connexions prêtes:', connectionStatus);
915
- _context3.n = 7;
966
+ _context4.n = 7;
916
967
  break;
917
968
  case 6:
918
- _context3.p = 6;
919
- _t3 = _context3.v;
969
+ _context4.p = 6;
970
+ _t3 = _context4.v;
920
971
  console.error('❌ Erreur connexions:', _t3.message);
921
972
  throw new Error('Connexions non disponibles - Impossible de générer le QR code');
922
973
  case 7:
923
- _context3.p = 7;
974
+ _context4.p = 7;
924
975
  // Utiliser uniquement le socketID comme contenu du QR
925
976
  socketId = this.socket ? this.socket.id : 'timeout-socket-id';
926
977
  qrContent = socketId;
@@ -929,7 +980,7 @@
929
980
 
930
981
  // Générer le QR avec le contenu complet
931
982
  partnerName = this.config.partnerName || 'Partner_unknown';
932
- _context3.n = 8;
983
+ _context4.n = 8;
933
984
  return this.makeRequest('/qr-generate', _objectSpread2({
934
985
  type: this.config.type,
935
986
  data: qrContent,
@@ -937,9 +988,9 @@
937
988
  label: "".concat(this.getTypeName(this.config.type), " ").concat(partnerName)
938
989
  }, options));
939
990
  case 8:
940
- response = _context3.v;
991
+ response = _context4.v;
941
992
  if (!response.success) {
942
- _context3.n = 11;
993
+ _context4.n = 11;
943
994
  break;
944
995
  }
945
996
  // Debug: Afficher la structure complète de la réponse
@@ -954,7 +1005,7 @@
954
1005
 
955
1006
  // Vérifier si l'URL du QR code existe
956
1007
  if (qrImageUrl) {
957
- _context3.n = 10;
1008
+ _context4.n = 10;
958
1009
  break;
959
1010
  }
960
1011
  console.warn('⚠️ qrCodeUrl non trouvé dans la réponse, recherche d\'alternatives...');
@@ -962,11 +1013,11 @@
962
1013
  // Essayer d'autres champs possibles
963
1014
  qrImageUrl = response.data.qr_url || response.data.qrUrl || response.data.url || response.data.image_url || response.data.imageUrl;
964
1015
  if (!qrImageUrl) {
965
- _context3.n = 9;
1016
+ _context4.n = 9;
966
1017
  break;
967
1018
  }
968
1019
  console.log('✅ URL QR trouvée dans un champ alternatif:', qrImageUrl);
969
- _context3.n = 10;
1020
+ _context4.n = 10;
970
1021
  break;
971
1022
  case 9:
972
1023
  console.error('❌ Aucune URL QR trouvée dans la réponse');
@@ -992,7 +1043,7 @@
992
1043
  sessionId: response.data.sessionId,
993
1044
  timestamp: Date.now()
994
1045
  });
995
- return _context3.a(2, _objectSpread2(_objectSpread2({}, response.data), {}, {
1046
+ return _context4.a(2, _objectSpread2(_objectSpread2({}, response.data), {}, {
996
1047
  qrCodeUrl: qrImageUrl,
997
1048
  qrContent: qrContent,
998
1049
  label: response.data.label,
@@ -1001,11 +1052,11 @@
1001
1052
  case 11:
1002
1053
  throw new Error(response.message || 'Erreur lors de la génération du QR code');
1003
1054
  case 12:
1004
- _context3.n = 14;
1055
+ _context4.n = 14;
1005
1056
  break;
1006
1057
  case 13:
1007
- _context3.p = 13;
1008
- _t4 = _context3.v;
1058
+ _context4.p = 13;
1059
+ _t4 = _context4.v;
1009
1060
  console.error('Erreur API détectée:', _t4.message);
1010
1061
  console.error('Stack trace complet:', _t4.stack);
1011
1062
  console.error('Configuration SDK:', {
@@ -1037,9 +1088,9 @@
1037
1088
  this.displayServiceUnavailable(containerId, this.config.type);
1038
1089
  throw new Error('Service non disponible');
1039
1090
  case 14:
1040
- return _context3.a(2);
1091
+ return _context4.a(2);
1041
1092
  }
1042
- }, _callee3, this, [[7, 13], [4, 6]]);
1093
+ }, _callee4, this, [[7, 13], [4, 6]]);
1043
1094
  }));
1044
1095
  function generateQR() {
1045
1096
  return _generateQR.apply(this, arguments);
@@ -1053,41 +1104,41 @@
1053
1104
  }, {
1054
1105
  key: "generateCustomQR",
1055
1106
  value: (function () {
1056
- var _generateCustomQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(containerId, type) {
1107
+ var _generateCustomQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(containerId, type) {
1057
1108
  var options,
1058
1109
  response,
1059
1110
  imageBaseUrl,
1060
1111
  qrImageUrl,
1061
- _args4 = arguments,
1112
+ _args5 = arguments,
1062
1113
  _t5;
1063
- return _regenerator().w(function (_context4) {
1064
- while (1) switch (_context4.p = _context4.n) {
1114
+ return _regenerator().w(function (_context5) {
1115
+ while (1) switch (_context5.p = _context5.n) {
1065
1116
  case 0:
1066
- options = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
1117
+ options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
1067
1118
  if (!this.initPromise) {
1068
- _context4.n = 2;
1119
+ _context5.n = 2;
1069
1120
  break;
1070
1121
  }
1071
- _context4.n = 1;
1122
+ _context5.n = 1;
1072
1123
  return this.initPromise;
1073
1124
  case 1:
1074
1125
  this.initPromise = null;
1075
1126
  case 2:
1076
1127
  if (this.isInitialized) {
1077
- _context4.n = 3;
1128
+ _context5.n = 3;
1078
1129
  break;
1079
1130
  }
1080
1131
  throw new Error('SunuID: SDK non initialisé');
1081
1132
  case 3:
1082
- _context4.p = 3;
1083
- _context4.n = 4;
1133
+ _context5.p = 3;
1134
+ _context5.n = 4;
1084
1135
  return this.makeRequest('/qr-generate', _objectSpread2({
1085
1136
  type: type
1086
1137
  }, options));
1087
1138
  case 4:
1088
- response = _context4.v;
1139
+ response = _context5.v;
1089
1140
  if (!response.success) {
1090
- _context4.n = 5;
1141
+ _context5.n = 5;
1091
1142
  break;
1092
1143
  }
1093
1144
  // Construire l'URL complète de l'image QR avec la base URL pour les images
@@ -1100,18 +1151,18 @@
1100
1151
  console.log('📄 Code de session:', response.data.code);
1101
1152
  console.log('🆔 Service ID:', response.data.service_id);
1102
1153
  this.startAutoRefresh(containerId, type, options);
1103
- return _context4.a(2, _objectSpread2(_objectSpread2({}, response.data), {}, {
1154
+ return _context5.a(2, _objectSpread2(_objectSpread2({}, response.data), {}, {
1104
1155
  qrCodeUrl: qrImageUrl,
1105
1156
  sessionId: response.data.service_id
1106
1157
  }));
1107
1158
  case 5:
1108
1159
  throw new Error(response.message || 'Erreur lors de la génération du QR code');
1109
1160
  case 6:
1110
- _context4.n = 8;
1161
+ _context5.n = 8;
1111
1162
  break;
1112
1163
  case 7:
1113
- _context4.p = 7;
1114
- _t5 = _context4.v;
1164
+ _context5.p = 7;
1165
+ _t5 = _context5.v;
1115
1166
  console.error('Erreur API détectée:', _t5.message);
1116
1167
  console.error('Stack trace complet:', _t5.stack);
1117
1168
  console.error('Configuration SDK (Custom):', {
@@ -1125,9 +1176,9 @@
1125
1176
  this.displayServiceUnavailable(containerId, type);
1126
1177
  throw new Error('Service non disponible');
1127
1178
  case 8:
1128
- return _context4.a(2);
1179
+ return _context5.a(2);
1129
1180
  }
1130
- }, _callee4, this, [[3, 7]]);
1181
+ }, _callee5, this, [[3, 7]]);
1131
1182
  }));
1132
1183
  function generateCustomQR(_x, _x2) {
1133
1184
  return _generateCustomQR.apply(this, arguments);
@@ -1138,16 +1189,16 @@
1138
1189
  }, {
1139
1190
  key: "generateAuthQR",
1140
1191
  value: function () {
1141
- var _generateAuthQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(containerId) {
1192
+ var _generateAuthQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(containerId) {
1142
1193
  var options,
1143
- _args5 = arguments;
1144
- return _regenerator().w(function (_context5) {
1145
- while (1) switch (_context5.n) {
1194
+ _args6 = arguments;
1195
+ return _regenerator().w(function (_context6) {
1196
+ while (1) switch (_context6.n) {
1146
1197
  case 0:
1147
- options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
1148
- return _context5.a(2, this.generateQR(containerId, options));
1198
+ options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
1199
+ return _context6.a(2, this.generateQR(containerId, options));
1149
1200
  }
1150
- }, _callee5, this);
1201
+ }, _callee6, this);
1151
1202
  }));
1152
1203
  function generateAuthQR(_x3) {
1153
1204
  return _generateAuthQR.apply(this, arguments);
@@ -1157,31 +1208,31 @@
1157
1208
  }, {
1158
1209
  key: "generateKYCQR",
1159
1210
  value: function () {
1160
- var _generateKYCQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(containerId) {
1211
+ var _generateKYCQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(containerId) {
1161
1212
  var options,
1162
1213
  originalType,
1163
- _args6 = arguments;
1164
- return _regenerator().w(function (_context6) {
1165
- while (1) switch (_context6.p = _context6.n) {
1214
+ _args7 = arguments;
1215
+ return _regenerator().w(function (_context7) {
1216
+ while (1) switch (_context7.p = _context7.n) {
1166
1217
  case 0:
1167
- options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
1218
+ options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
1168
1219
  // Sauvegarder le type actuel
1169
1220
  originalType = this.config.type; // Changer temporairement le type pour KYC
1170
1221
  this.config.type = 1;
1171
- _context6.p = 1;
1172
- _context6.n = 2;
1222
+ _context7.p = 1;
1223
+ _context7.n = 2;
1173
1224
  return this.generateQR(containerId, options);
1174
1225
  case 2:
1175
- return _context6.a(2, _context6.v);
1226
+ return _context7.a(2, _context7.v);
1176
1227
  case 3:
1177
- _context6.p = 3;
1228
+ _context7.p = 3;
1178
1229
  // Restaurer le type original
1179
1230
  this.config.type = originalType;
1180
- return _context6.f(3);
1231
+ return _context7.f(3);
1181
1232
  case 4:
1182
- return _context6.a(2);
1233
+ return _context7.a(2);
1183
1234
  }
1184
- }, _callee6, this, [[1,, 3, 4]]);
1235
+ }, _callee7, this, [[1,, 3, 4]]);
1185
1236
  }));
1186
1237
  function generateKYCQR(_x4) {
1187
1238
  return _generateKYCQR.apply(this, arguments);
@@ -1191,31 +1242,31 @@
1191
1242
  }, {
1192
1243
  key: "generateSignatureQR",
1193
1244
  value: function () {
1194
- var _generateSignatureQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(containerId) {
1245
+ var _generateSignatureQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(containerId) {
1195
1246
  var options,
1196
1247
  originalType,
1197
- _args7 = arguments;
1198
- return _regenerator().w(function (_context7) {
1199
- while (1) switch (_context7.p = _context7.n) {
1248
+ _args8 = arguments;
1249
+ return _regenerator().w(function (_context8) {
1250
+ while (1) switch (_context8.p = _context8.n) {
1200
1251
  case 0:
1201
- options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
1252
+ options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
1202
1253
  // Sauvegarder le type actuel
1203
1254
  originalType = this.config.type; // Changer temporairement le type pour Signature
1204
1255
  this.config.type = 3;
1205
- _context7.p = 1;
1206
- _context7.n = 2;
1256
+ _context8.p = 1;
1257
+ _context8.n = 2;
1207
1258
  return this.generateQR(containerId, options);
1208
1259
  case 2:
1209
- return _context7.a(2, _context7.v);
1260
+ return _context8.a(2, _context8.v);
1210
1261
  case 3:
1211
- _context7.p = 3;
1262
+ _context8.p = 3;
1212
1263
  // Restaurer le type original
1213
1264
  this.config.type = originalType;
1214
- return _context7.f(3);
1265
+ return _context8.f(3);
1215
1266
  case 4:
1216
- return _context7.a(2);
1267
+ return _context8.a(2);
1217
1268
  }
1218
- }, _callee7, this, [[1,, 3, 4]]);
1269
+ }, _callee8, this, [[1,, 3, 4]]);
1219
1270
  }));
1220
1271
  function generateSignatureQR(_x5) {
1221
1272
  return _generateSignatureQR.apply(this, arguments);
@@ -1228,43 +1279,43 @@
1228
1279
  }, {
1229
1280
  key: "checkQRStatus",
1230
1281
  value: (function () {
1231
- var _checkQRStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(sessionId) {
1282
+ var _checkQRStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(sessionId) {
1232
1283
  var response, _t6;
1233
- return _regenerator().w(function (_context8) {
1234
- while (1) switch (_context8.p = _context8.n) {
1284
+ return _regenerator().w(function (_context9) {
1285
+ while (1) switch (_context9.p = _context9.n) {
1235
1286
  case 0:
1236
1287
  if (this.isInitialized) {
1237
- _context8.n = 1;
1288
+ _context9.n = 1;
1238
1289
  break;
1239
1290
  }
1240
1291
  throw new Error('SunuID: SDK non initialisé');
1241
1292
  case 1:
1242
- _context8.p = 1;
1243
- _context8.n = 2;
1293
+ _context9.p = 1;
1294
+ _context9.n = 2;
1244
1295
  return this.makeRequest('/qr-status', {
1245
1296
  serviceId: sessionId
1246
1297
  });
1247
1298
  case 2:
1248
- response = _context8.v;
1299
+ response = _context9.v;
1249
1300
  if (!response.success) {
1250
- _context8.n = 3;
1301
+ _context9.n = 3;
1251
1302
  break;
1252
1303
  }
1253
- return _context8.a(2, response.data);
1304
+ return _context9.a(2, response.data);
1254
1305
  case 3:
1255
1306
  throw new Error(response.message || 'Erreur lors de la vérification du statut');
1256
1307
  case 4:
1257
- _context8.n = 6;
1308
+ _context9.n = 6;
1258
1309
  break;
1259
1310
  case 5:
1260
- _context8.p = 5;
1261
- _t6 = _context8.v;
1311
+ _context9.p = 5;
1312
+ _t6 = _context9.v;
1262
1313
  this.handleError(_t6);
1263
1314
  throw _t6;
1264
1315
  case 6:
1265
- return _context8.a(2);
1316
+ return _context9.a(2);
1266
1317
  }
1267
- }, _callee8, this, [[1, 5]]);
1318
+ }, _callee9, this, [[1, 5]]);
1268
1319
  }));
1269
1320
  function checkQRStatus(_x6) {
1270
1321
  return _checkQRStatus.apply(this, arguments);
@@ -1278,47 +1329,47 @@
1278
1329
  }, {
1279
1330
  key: "generateQRWithContent",
1280
1331
  value: (function () {
1281
- var _generateQRWithContent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(content, containerId, type) {
1332
+ var _generateQRWithContent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(content, containerId, type) {
1282
1333
  var options,
1283
1334
  localQRUrl,
1284
- _args9 = arguments,
1335
+ _args0 = arguments,
1285
1336
  _t7;
1286
- return _regenerator().w(function (_context9) {
1287
- while (1) switch (_context9.p = _context9.n) {
1337
+ return _regenerator().w(function (_context0) {
1338
+ while (1) switch (_context0.p = _context0.n) {
1288
1339
  case 0:
1289
- options = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : {};
1340
+ options = _args0.length > 3 && _args0[3] !== undefined ? _args0[3] : {};
1290
1341
  console.log('🎨 Génération QR avec contenu:', content);
1291
- _context9.p = 1;
1342
+ _context0.p = 1;
1292
1343
  if (!(window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1' || window.location.protocol === 'file:')) {
1293
- _context9.n = 3;
1344
+ _context0.n = 3;
1294
1345
  break;
1295
1346
  }
1296
1347
  console.log('🏠 Utilisation service QR local...');
1297
- _context9.n = 2;
1348
+ _context0.n = 2;
1298
1349
  return this.generateQRLocal(content, containerId, type, options);
1299
1350
  case 2:
1300
- localQRUrl = _context9.v;
1351
+ localQRUrl = _context0.v;
1301
1352
  if (!localQRUrl) {
1302
- _context9.n = 3;
1353
+ _context0.n = 3;
1303
1354
  break;
1304
1355
  }
1305
- return _context9.a(2, localQRUrl);
1356
+ return _context0.a(2, localQRUrl);
1306
1357
  case 3:
1307
1358
  // Fallback vers le service QR distant
1308
1359
  console.log('🌐 Utilisation service QR distant...');
1309
- _context9.n = 4;
1360
+ _context0.n = 4;
1310
1361
  return this.generateQRRemote(content, containerId, type, options);
1311
1362
  case 4:
1312
- return _context9.a(2, _context9.v);
1363
+ return _context0.a(2, _context0.v);
1313
1364
  case 5:
1314
- _context9.p = 5;
1315
- _t7 = _context9.v;
1365
+ _context0.p = 5;
1366
+ _t7 = _context0.v;
1316
1367
  console.error('❌ Erreur génération QR:', _t7);
1317
1368
  // Fallback vers affichage simple du contenu
1318
1369
  this.displayQRContent(containerId, content, type, options);
1319
- return _context9.a(2, null);
1370
+ return _context0.a(2, null);
1320
1371
  }
1321
- }, _callee9, this, [[1, 5]]);
1372
+ }, _callee0, this, [[1, 5]]);
1322
1373
  }));
1323
1374
  function generateQRWithContent(_x7, _x8, _x9) {
1324
1375
  return _generateQRWithContent.apply(this, arguments);
@@ -1332,19 +1383,19 @@
1332
1383
  }, {
1333
1384
  key: "generateQRLocal",
1334
1385
  value: (function () {
1335
- var _generateQRLocal = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(content, containerId, type) {
1386
+ var _generateQRLocal = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(content, containerId, type) {
1336
1387
  var options,
1337
1388
  response,
1338
1389
  data,
1339
1390
  qrUrl,
1340
- _args0 = arguments,
1391
+ _args1 = arguments,
1341
1392
  _t8;
1342
- return _regenerator().w(function (_context0) {
1343
- while (1) switch (_context0.p = _context0.n) {
1393
+ return _regenerator().w(function (_context1) {
1394
+ while (1) switch (_context1.p = _context1.n) {
1344
1395
  case 0:
1345
- options = _args0.length > 3 && _args0[3] !== undefined ? _args0[3] : {};
1346
- _context0.p = 1;
1347
- _context0.n = 2;
1396
+ options = _args1.length > 3 && _args1[3] !== undefined ? _args1[3] : {};
1397
+ _context1.p = 1;
1398
+ _context1.n = 2;
1348
1399
  return fetch('http://localhost:8000/api/generate/text', {
1349
1400
  method: 'POST',
1350
1401
  headers: {
@@ -1353,29 +1404,29 @@
1353
1404
  body: "text=".concat(encodeURIComponent(content), "&size=300")
1354
1405
  });
1355
1406
  case 2:
1356
- response = _context0.v;
1407
+ response = _context1.v;
1357
1408
  if (!response.ok) {
1358
- _context0.n = 4;
1409
+ _context1.n = 4;
1359
1410
  break;
1360
1411
  }
1361
- _context0.n = 3;
1412
+ _context1.n = 3;
1362
1413
  return response.json();
1363
1414
  case 3:
1364
- data = _context0.v;
1415
+ data = _context1.v;
1365
1416
  qrUrl = "data:image/png;base64,".concat(data.qrcode);
1366
1417
  this.displayQRCode(containerId, qrUrl, type, options);
1367
- return _context0.a(2, qrUrl);
1418
+ return _context1.a(2, qrUrl);
1368
1419
  case 4:
1369
- _context0.n = 6;
1420
+ _context1.n = 6;
1370
1421
  break;
1371
1422
  case 5:
1372
- _context0.p = 5;
1373
- _t8 = _context0.v;
1423
+ _context1.p = 5;
1424
+ _t8 = _context1.v;
1374
1425
  console.log('❌ Service QR local non disponible:', _t8.message);
1375
1426
  case 6:
1376
- return _context0.a(2, null);
1427
+ return _context1.a(2, null);
1377
1428
  }
1378
- }, _callee0, this, [[1, 5]]);
1429
+ }, _callee1, this, [[1, 5]]);
1379
1430
  }));
1380
1431
  function generateQRLocal(_x0, _x1, _x10) {
1381
1432
  return _generateQRLocal.apply(this, arguments);
@@ -1389,19 +1440,19 @@
1389
1440
  }, {
1390
1441
  key: "generateQRRemote",
1391
1442
  value: (function () {
1392
- var _generateQRRemote = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(content, containerId, type) {
1443
+ var _generateQRRemote = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(content, containerId, type) {
1393
1444
  var options,
1394
1445
  response,
1395
1446
  data,
1396
1447
  qrUrl,
1397
- _args1 = arguments,
1448
+ _args10 = arguments,
1398
1449
  _t9;
1399
- return _regenerator().w(function (_context1) {
1400
- while (1) switch (_context1.p = _context1.n) {
1450
+ return _regenerator().w(function (_context10) {
1451
+ while (1) switch (_context10.p = _context10.n) {
1401
1452
  case 0:
1402
- options = _args1.length > 3 && _args1[3] !== undefined ? _args1[3] : {};
1403
- _context1.p = 1;
1404
- _context1.n = 2;
1453
+ options = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : {};
1454
+ _context10.p = 1;
1455
+ _context10.n = 2;
1405
1456
  return fetch('https://api.sunuid.fayma.sn/qr-generate', {
1406
1457
  method: 'POST',
1407
1458
  headers: {
@@ -1414,31 +1465,31 @@
1414
1465
  })
1415
1466
  });
1416
1467
  case 2:
1417
- response = _context1.v;
1468
+ response = _context10.v;
1418
1469
  if (!response.ok) {
1419
- _context1.n = 4;
1470
+ _context10.n = 4;
1420
1471
  break;
1421
1472
  }
1422
- _context1.n = 3;
1473
+ _context10.n = 3;
1423
1474
  return response.json();
1424
1475
  case 3:
1425
- data = _context1.v;
1476
+ data = _context10.v;
1426
1477
  qrUrl = "data:image/png;base64,".concat(data.qrcode);
1427
1478
  this.displayQRCode(containerId, qrUrl, type, options);
1428
- return _context1.a(2, qrUrl);
1479
+ return _context10.a(2, qrUrl);
1429
1480
  case 4:
1430
- _context1.n = 6;
1481
+ _context10.n = 6;
1431
1482
  break;
1432
1483
  case 5:
1433
- _context1.p = 5;
1434
- _t9 = _context1.v;
1484
+ _context10.p = 5;
1485
+ _t9 = _context10.v;
1435
1486
  console.error('❌ Erreur service QR distant:', _t9);
1436
1487
  case 6:
1437
1488
  // Fallback vers affichage du contenu
1438
1489
  this.displayQRContent(containerId, content, type, options);
1439
- return _context1.a(2, null);
1490
+ return _context10.a(2, null);
1440
1491
  }
1441
- }, _callee1, this, [[1, 5]]);
1492
+ }, _callee10, this, [[1, 5]]);
1442
1493
  }));
1443
1494
  function generateQRRemote(_x11, _x12, _x13) {
1444
1495
  return _generateQRRemote.apply(this, arguments);
@@ -1496,11 +1547,11 @@
1496
1547
  }, {
1497
1548
  key: "generateCustomQRCode",
1498
1549
  value: (function () {
1499
- var _generateCustomQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(content, label) {
1550
+ var _generateCustomQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(content, label) {
1500
1551
  var qrContainer,
1501
1552
  _t0;
1502
- return _regenerator().w(function (_context10) {
1503
- while (1) switch (_context10.p = _context10.n) {
1553
+ return _regenerator().w(function (_context11) {
1554
+ while (1) switch (_context11.p = _context11.n) {
1504
1555
  case 0:
1505
1556
  console.log('🎨 Début génération QR personnalisé...');
1506
1557
  console.log('📄 Contenu:', content);
@@ -1512,37 +1563,37 @@
1512
1563
  qrContainer = document.getElementById('qr-container');
1513
1564
  }
1514
1565
  if (qrContainer) {
1515
- _context10.n = 1;
1566
+ _context11.n = 1;
1516
1567
  break;
1517
1568
  }
1518
1569
  console.error('❌ QR container not found');
1519
- return _context10.a(2);
1570
+ return _context11.a(2);
1520
1571
  case 1:
1521
1572
  console.log('✅ QR container trouvé');
1522
1573
 
1523
1574
  // Nettoyer le conteneur
1524
1575
  qrContainer.innerHTML = '<div style="text-align: center; padding: 20px;"><p>Génération QR code...</p></div>';
1525
- _context10.p = 2;
1576
+ _context11.p = 2;
1526
1577
  // Utiliser directement l'API principale (plus fiable)
1527
1578
  console.log('🎨 Tentative génération via API principale...');
1528
- _context10.n = 3;
1579
+ _context11.n = 3;
1529
1580
  return this.generateQRPHP(content, label, qrContainer);
1530
1581
  case 3:
1531
1582
  console.log('✅ QR code généré avec succès');
1532
- _context10.n = 5;
1583
+ _context11.n = 5;
1533
1584
  break;
1534
1585
  case 4:
1535
- _context10.p = 4;
1536
- _t0 = _context10.v;
1586
+ _context11.p = 4;
1587
+ _t0 = _context11.v;
1537
1588
  console.error('❌ Erreur génération API:', _t0);
1538
1589
 
1539
1590
  // Fallback final : image par défaut
1540
1591
  console.log('⚠️ Affichage image par défaut');
1541
1592
  this.displayDefaultQR(qrContainer, content, label);
1542
1593
  case 5:
1543
- return _context10.a(2);
1594
+ return _context11.a(2);
1544
1595
  }
1545
- }, _callee10, this, [[2, 4]]);
1596
+ }, _callee11, this, [[2, 4]]);
1546
1597
  }));
1547
1598
  function generateCustomQRCode(_x14, _x15) {
1548
1599
  return _generateCustomQRCode.apply(this, arguments);
@@ -1556,17 +1607,17 @@
1556
1607
  }, {
1557
1608
  key: "generateQRClientSide",
1558
1609
  value: (function () {
1559
- var _generateQRClientSide = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(content, label, qrContainer) {
1610
+ var _generateQRClientSide = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(content, label, qrContainer) {
1560
1611
  var _this2 = this;
1561
1612
  var canvas, ctx;
1562
- return _regenerator().w(function (_context11) {
1563
- while (1) switch (_context11.n) {
1613
+ return _regenerator().w(function (_context12) {
1614
+ while (1) switch (_context12.n) {
1564
1615
  case 0:
1565
- _context11.n = 1;
1616
+ _context12.n = 1;
1566
1617
  return this.ensureQRCodeLibrary();
1567
1618
  case 1:
1568
1619
  if (!(typeof QRCode === 'undefined')) {
1569
- _context11.n = 2;
1620
+ _context12.n = 2;
1570
1621
  break;
1571
1622
  }
1572
1623
  throw new Error('QRCode library non disponible');
@@ -1580,7 +1631,7 @@
1580
1631
  ctx.fillRect(0, 0, 300, 320);
1581
1632
 
1582
1633
  // Générer le QR code
1583
- return _context11.a(2, new Promise(function (resolve, reject) {
1634
+ return _context12.a(2, new Promise(function (resolve, reject) {
1584
1635
  QRCode.toCanvas(canvas, content, {
1585
1636
  width: 280,
1586
1637
  margin: 10,
@@ -1615,7 +1666,7 @@
1615
1666
  });
1616
1667
  }));
1617
1668
  }
1618
- }, _callee11, this);
1669
+ }, _callee12, this);
1619
1670
  }));
1620
1671
  function generateQRClientSide(_x16, _x17, _x18) {
1621
1672
  return _generateQRClientSide.apply(this, arguments);
@@ -1629,10 +1680,10 @@
1629
1680
  }, {
1630
1681
  key: "generateQRPHP",
1631
1682
  value: (function () {
1632
- var _generateQRPHP = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(content, label, qrContainer) {
1683
+ var _generateQRPHP = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(content, label, qrContainer) {
1633
1684
  var qrGeneratorUrl, requestBody, contentType, response, responseData, qrImageUrl, imageBaseUrl;
1634
- return _regenerator().w(function (_context12) {
1635
- while (1) switch (_context12.n) {
1685
+ return _regenerator().w(function (_context13) {
1686
+ while (1) switch (_context13.n) {
1636
1687
  case 0:
1637
1688
  // Construire l'URL - Utiliser l'API principale qui fonctionne
1638
1689
 
@@ -1670,7 +1721,7 @@
1670
1721
  label: label
1671
1722
  });
1672
1723
  }
1673
- _context12.n = 1;
1724
+ _context13.n = 1;
1674
1725
  return fetch(qrGeneratorUrl, {
1675
1726
  method: 'POST',
1676
1727
  headers: {
@@ -1680,19 +1731,19 @@
1680
1731
  body: requestBody
1681
1732
  });
1682
1733
  case 1:
1683
- response = _context12.v;
1734
+ response = _context13.v;
1684
1735
  if (response.ok) {
1685
- _context12.n = 2;
1736
+ _context13.n = 2;
1686
1737
  break;
1687
1738
  }
1688
1739
  throw new Error("Erreur HTTP: ".concat(response.status));
1689
1740
  case 2:
1690
- _context12.n = 3;
1741
+ _context13.n = 3;
1691
1742
  return response.json();
1692
1743
  case 3:
1693
- responseData = _context12.v;
1744
+ responseData = _context13.v;
1694
1745
  if (responseData.success) {
1695
- _context12.n = 4;
1746
+ _context13.n = 4;
1696
1747
  break;
1697
1748
  }
1698
1749
  throw new Error("Erreur QR: ".concat(responseData.error));
@@ -1715,9 +1766,9 @@
1715
1766
  // Afficher les instructions
1716
1767
  this.showQRInstructions(qrContainer);
1717
1768
  case 5:
1718
- return _context12.a(2);
1769
+ return _context13.a(2);
1719
1770
  }
1720
- }, _callee12, this);
1771
+ }, _callee13, this);
1721
1772
  }));
1722
1773
  function generateQRPHP(_x19, _x20, _x21) {
1723
1774
  return _generateQRPHP.apply(this, arguments);
@@ -1740,19 +1791,19 @@
1740
1791
  }, {
1741
1792
  key: "ensureQRCodeLibrary",
1742
1793
  value: (function () {
1743
- var _ensureQRCodeLibrary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
1744
- return _regenerator().w(function (_context13) {
1745
- while (1) switch (_context13.n) {
1794
+ var _ensureQRCodeLibrary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
1795
+ return _regenerator().w(function (_context14) {
1796
+ while (1) switch (_context14.n) {
1746
1797
  case 0:
1747
1798
  if (!(typeof QRCode !== 'undefined')) {
1748
- _context13.n = 1;
1799
+ _context14.n = 1;
1749
1800
  break;
1750
1801
  }
1751
1802
  console.log('✅ QRCode library déjà disponible');
1752
- return _context13.a(2, true);
1803
+ return _context14.a(2, true);
1753
1804
  case 1:
1754
1805
  console.log('📦 Chargement QRCode library...');
1755
- return _context13.a(2, new Promise(function (resolve, reject) {
1806
+ return _context14.a(2, new Promise(function (resolve, reject) {
1756
1807
  var script = document.createElement('script');
1757
1808
  script.src = 'https://cdn.jsdelivr.net/npm/qrcode@1.5.3/lib/browser.min.js';
1758
1809
  script.onload = function () {
@@ -1773,7 +1824,7 @@
1773
1824
  document.head.appendChild(script);
1774
1825
  }));
1775
1826
  }
1776
- }, _callee13);
1827
+ }, _callee14);
1777
1828
  }));
1778
1829
  function ensureQRCodeLibrary() {
1779
1830
  return _ensureQRCodeLibrary.apply(this, arguments);
@@ -1860,19 +1911,19 @@
1860
1911
  }, {
1861
1912
  key: "refreshQR",
1862
1913
  value: (function () {
1863
- var _refreshQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(containerId) {
1914
+ var _refreshQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(containerId) {
1864
1915
  var options,
1865
1916
  result,
1866
1917
  _result,
1867
- _args14 = arguments,
1918
+ _args15 = arguments,
1868
1919
  _t1;
1869
- return _regenerator().w(function (_context14) {
1870
- while (1) switch (_context14.p = _context14.n) {
1920
+ return _regenerator().w(function (_context15) {
1921
+ while (1) switch (_context15.p = _context15.n) {
1871
1922
  case 0:
1872
- options = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {};
1873
- _context14.p = 1;
1923
+ options = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : {};
1924
+ _context15.p = 1;
1874
1925
  if (!this.currentQRUrl) {
1875
- _context14.n = 3;
1926
+ _context15.n = 3;
1876
1927
  break;
1877
1928
  }
1878
1929
  console.log('🔄 Vérification du statut du QR code existant...');
@@ -1882,31 +1933,31 @@
1882
1933
 
1883
1934
  // Option 2: Régénérer le QR code seulement si nécessaire
1884
1935
  // Pour l'instant, on régénère pour s'assurer qu'il est à jour
1885
- _context14.n = 2;
1936
+ _context15.n = 2;
1886
1937
  return this.generateQR(containerId, options);
1887
1938
  case 2:
1888
- result = _context14.v;
1889
- return _context14.a(2, result);
1939
+ result = _context15.v;
1940
+ return _context15.a(2, result);
1890
1941
  case 3:
1891
1942
  console.log('🔄 Pas de QR code existant, génération d\'un nouveau...');
1892
- _context14.n = 4;
1943
+ _context15.n = 4;
1893
1944
  return this.generateQR(containerId, options);
1894
1945
  case 4:
1895
- _result = _context14.v;
1896
- return _context14.a(2, _result);
1946
+ _result = _context15.v;
1947
+ return _context15.a(2, _result);
1897
1948
  case 5:
1898
- _context14.n = 7;
1949
+ _context15.n = 7;
1899
1950
  break;
1900
1951
  case 6:
1901
- _context14.p = 6;
1902
- _t1 = _context14.v;
1952
+ _context15.p = 6;
1953
+ _t1 = _context15.v;
1903
1954
  console.error('Erreur lors du rafraîchissement:', _t1.message);
1904
1955
  this.displayServiceUnavailable(containerId, this.config.type);
1905
1956
  throw _t1;
1906
1957
  case 7:
1907
- return _context14.a(2);
1958
+ return _context15.a(2);
1908
1959
  }
1909
- }, _callee14, this, [[1, 6]]);
1960
+ }, _callee15, this, [[1, 6]]);
1910
1961
  }));
1911
1962
  function refreshQR(_x22) {
1912
1963
  return _refreshQR.apply(this, arguments);
@@ -1928,26 +1979,26 @@
1928
1979
  clearInterval(this.refreshTimer);
1929
1980
  console.log('🔄 Timer de rafraîchissement précédent arrêté');
1930
1981
  }
1931
- this.refreshTimer = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
1982
+ this.refreshTimer = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
1932
1983
  var _t10;
1933
- return _regenerator().w(function (_context15) {
1934
- while (1) switch (_context15.p = _context15.n) {
1984
+ return _regenerator().w(function (_context16) {
1985
+ while (1) switch (_context16.p = _context16.n) {
1935
1986
  case 0:
1936
- _context15.p = 0;
1987
+ _context16.p = 0;
1937
1988
  console.log('🔄 Rafraîchissement automatique du QR code...');
1938
- _context15.n = 1;
1989
+ _context16.n = 1;
1939
1990
  return _this3.refreshQR(containerId, type, options);
1940
1991
  case 1:
1941
- _context15.n = 3;
1992
+ _context16.n = 3;
1942
1993
  break;
1943
1994
  case 2:
1944
- _context15.p = 2;
1945
- _t10 = _context15.v;
1995
+ _context16.p = 2;
1996
+ _t10 = _context16.v;
1946
1997
  console.warn('Erreur lors du rafraîchissement automatique:', _t10);
1947
1998
  case 3:
1948
- return _context15.a(2);
1999
+ return _context16.a(2);
1949
2000
  }
1950
- }, _callee15, null, [[0, 2]]);
2001
+ }, _callee16, null, [[0, 2]]);
1951
2002
  })), this.config.refreshInterval);
1952
2003
  console.log("\uD83D\uDD04 Timer de rafra\xEEchissement d\xE9marr\xE9 (".concat(this.config.refreshInterval, "ms)"));
1953
2004
  }
@@ -1962,16 +2013,16 @@
1962
2013
  }, {
1963
2014
  key: "makeRequest",
1964
2015
  value: (function () {
1965
- var _makeRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(endpoint, data) {
2016
+ var _makeRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(endpoint, data) {
1966
2017
  var _window$SunuIDConfig4,
1967
2018
  _window$SunuIDConfig5,
1968
2019
  _this4 = this;
1969
2020
  var sanitizedData, endpointPath, url, retryCount, maxRetries, _loop, _ret;
1970
- return _regenerator().w(function (_context17) {
1971
- while (1) switch (_context17.n) {
2021
+ return _regenerator().w(function (_context18) {
2022
+ while (1) switch (_context18.n) {
1972
2023
  case 0:
1973
2024
  if (this.isInitialized) {
1974
- _context17.n = 1;
2025
+ _context18.n = 1;
1975
2026
  break;
1976
2027
  }
1977
2028
  this.logSecurityEvent('REQUEST_BEFORE_INIT', {
@@ -1980,12 +2031,12 @@
1980
2031
  throw new Error('SDK non initialisé');
1981
2032
  case 1:
1982
2033
  if (!this.config.secureInit) {
1983
- _context17.n = 2;
2034
+ _context18.n = 2;
1984
2035
  break;
1985
2036
  }
1986
2037
  this.config.requestCount++;
1987
2038
  if (!(this.config.requestCount > this.config.maxRequests)) {
1988
- _context17.n = 2;
2039
+ _context18.n = 2;
1989
2040
  break;
1990
2041
  }
1991
2042
  this.logSecurityEvent('API_REQUEST_LIMIT_EXCEEDED', {
@@ -2021,10 +2072,10 @@
2021
2072
  maxRetries = this.config.maxRetries;
2022
2073
  _loop = /*#__PURE__*/_regenerator().m(function _loop() {
2023
2074
  var controller, timeoutId, headers, response, errorText, errorData, result, _t11;
2024
- return _regenerator().w(function (_context16) {
2025
- while (1) switch (_context16.p = _context16.n) {
2075
+ return _regenerator().w(function (_context17) {
2076
+ while (1) switch (_context17.p = _context17.n) {
2026
2077
  case 0:
2027
- _context16.p = 0;
2078
+ _context17.p = 0;
2028
2079
  controller = new AbortController();
2029
2080
  timeoutId = setTimeout(function () {
2030
2081
  return controller.abort();
@@ -2036,7 +2087,7 @@
2036
2087
  // if (this.config.secureInit && this.config.token) {
2037
2088
  // headers['X-Secure-Token'] = this.config.token;
2038
2089
  // }
2039
- _context16.n = 1;
2090
+ _context17.n = 1;
2040
2091
  return fetch(url, {
2041
2092
  method: 'POST',
2042
2093
  headers: headers,
@@ -2044,16 +2095,16 @@
2044
2095
  signal: controller.signal
2045
2096
  });
2046
2097
  case 1:
2047
- response = _context16.v;
2098
+ response = _context17.v;
2048
2099
  clearTimeout(timeoutId);
2049
2100
  if (response.ok) {
2050
- _context16.n = 3;
2101
+ _context17.n = 3;
2051
2102
  break;
2052
2103
  }
2053
- _context16.n = 2;
2104
+ _context17.n = 2;
2054
2105
  return response.text();
2055
2106
  case 2:
2056
- errorText = _context16.v;
2107
+ errorText = _context17.v;
2057
2108
  try {
2058
2109
  errorData = JSON.parse(errorText);
2059
2110
  } catch (e) {
@@ -2068,38 +2119,38 @@
2068
2119
  });
2069
2120
  throw new Error(errorData.message || "Erreur HTTP: ".concat(response.status));
2070
2121
  case 3:
2071
- _context16.n = 4;
2122
+ _context17.n = 4;
2072
2123
  return response.json();
2073
2124
  case 4:
2074
- result = _context16.v;
2125
+ result = _context17.v;
2075
2126
  _this4.logSecurityEvent('API_REQUEST_SUCCESS', {
2076
2127
  endpoint: endpointPath,
2077
2128
  responseKeys: Object.keys(result)
2078
2129
  });
2079
- return _context16.a(2, {
2130
+ return _context17.a(2, {
2080
2131
  v: result
2081
2132
  });
2082
2133
  case 5:
2083
- _context16.p = 5;
2084
- _t11 = _context16.v;
2134
+ _context17.p = 5;
2135
+ _t11 = _context17.v;
2085
2136
  retryCount++;
2086
2137
  if (!(_t11.name === 'AbortError')) {
2087
- _context16.n = 7;
2138
+ _context17.n = 7;
2088
2139
  break;
2089
2140
  }
2090
2141
  _this4.logSecurityEvent('API_REQUEST_TIMEOUT', {
2091
2142
  retryCount: retryCount
2092
2143
  });
2093
2144
  if (!(retryCount > maxRetries)) {
2094
- _context16.n = 6;
2145
+ _context17.n = 6;
2095
2146
  break;
2096
2147
  }
2097
2148
  throw new Error('Timeout de la requête API');
2098
2149
  case 6:
2099
- return _context16.a(2, 0);
2150
+ return _context17.a(2, 0);
2100
2151
  case 7:
2101
2152
  if (!(retryCount > maxRetries)) {
2102
- _context16.n = 8;
2153
+ _context17.n = 8;
2103
2154
  break;
2104
2155
  }
2105
2156
  _this4.logSecurityEvent('API_REQUEST_MAX_RETRIES', {
@@ -2108,41 +2159,41 @@
2108
2159
  });
2109
2160
  throw _t11;
2110
2161
  case 8:
2111
- _context16.n = 9;
2162
+ _context17.n = 9;
2112
2163
  return new Promise(function (resolve) {
2113
2164
  return setTimeout(resolve, 1000 * retryCount);
2114
2165
  });
2115
2166
  case 9:
2116
- return _context16.a(2);
2167
+ return _context17.a(2);
2117
2168
  }
2118
2169
  }, _loop, null, [[0, 5]]);
2119
2170
  });
2120
2171
  case 3:
2121
2172
  if (!(retryCount <= maxRetries)) {
2122
- _context17.n = 7;
2173
+ _context18.n = 7;
2123
2174
  break;
2124
2175
  }
2125
- return _context17.d(_regeneratorValues(_loop()), 4);
2176
+ return _context18.d(_regeneratorValues(_loop()), 4);
2126
2177
  case 4:
2127
- _ret = _context17.v;
2178
+ _ret = _context18.v;
2128
2179
  if (!(_ret === 0)) {
2129
- _context17.n = 5;
2180
+ _context18.n = 5;
2130
2181
  break;
2131
2182
  }
2132
- return _context17.a(3, 3);
2183
+ return _context18.a(3, 3);
2133
2184
  case 5:
2134
2185
  if (!_ret) {
2135
- _context17.n = 6;
2186
+ _context18.n = 6;
2136
2187
  break;
2137
2188
  }
2138
- return _context17.a(2, _ret.v);
2189
+ return _context18.a(2, _ret.v);
2139
2190
  case 6:
2140
- _context17.n = 3;
2191
+ _context18.n = 3;
2141
2192
  break;
2142
2193
  case 7:
2143
- return _context17.a(2);
2194
+ return _context18.a(2);
2144
2195
  }
2145
- }, _callee16, this);
2196
+ }, _callee17, this);
2146
2197
  }));
2147
2198
  function makeRequest(_x23, _x24) {
2148
2199
  return _makeRequest.apply(this, arguments);
@@ -2213,20 +2264,20 @@
2213
2264
  }, {
2214
2265
  key: "fetchPartnerInfo",
2215
2266
  value: (function () {
2216
- var _fetchPartnerInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
2267
+ var _fetchPartnerInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
2217
2268
  var response, data, partnerId, _t12;
2218
- return _regenerator().w(function (_context18) {
2219
- while (1) switch (_context18.p = _context18.n) {
2269
+ return _regenerator().w(function (_context19) {
2270
+ while (1) switch (_context19.p = _context19.n) {
2220
2271
  case 0:
2221
- _context18.p = 0;
2222
- _context18.n = 1;
2272
+ _context19.p = 0;
2273
+ _context19.n = 1;
2223
2274
  return this.makeRequest('/debug', {
2224
2275
  type: this.config.type,
2225
2276
  client_id: this.config.clientId,
2226
2277
  secret_id: this.config.secretId
2227
2278
  });
2228
2279
  case 1:
2229
- response = _context18.v;
2280
+ response = _context19.v;
2230
2281
  console.log('📋 Réponse debug API:', response);
2231
2282
 
2232
2283
  // Vérifier la structure de la réponse
@@ -2270,17 +2321,17 @@
2270
2321
  console.warn('⚠️ Structure de réponse invalide, utilisation du partner_id par défaut');
2271
2322
  this.config.partnerName = "Partner_".concat(this.config.partnerId || 'unknown');
2272
2323
  }
2273
- _context18.n = 3;
2324
+ _context19.n = 3;
2274
2325
  break;
2275
2326
  case 2:
2276
- _context18.p = 2;
2277
- _t12 = _context18.v;
2327
+ _context19.p = 2;
2328
+ _t12 = _context19.v;
2278
2329
  console.warn('⚠️ Erreur lors de la récupération des informations du partenaire:', _t12.message);
2279
2330
  this.config.partnerName = 'Partner_unknown';
2280
2331
  case 3:
2281
- return _context18.a(2);
2332
+ return _context19.a(2);
2282
2333
  }
2283
- }, _callee17, this, [[0, 2]]);
2334
+ }, _callee18, this, [[0, 2]]);
2284
2335
  }));
2285
2336
  function fetchPartnerInfo() {
2286
2337
  return _fetchPartnerInfo.apply(this, arguments);
@@ -2318,18 +2369,18 @@
2318
2369
  }, {
2319
2370
  key: "checkConnections",
2320
2371
  value: (function () {
2321
- var _checkConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
2372
+ var _checkConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
2322
2373
  var status, testResponse, debugData, _t13;
2323
- return _regenerator().w(function (_context19) {
2324
- while (1) switch (_context19.p = _context19.n) {
2374
+ return _regenerator().w(function (_context20) {
2375
+ while (1) switch (_context20.p = _context20.n) {
2325
2376
  case 0:
2326
2377
  status = {
2327
2378
  api: false,
2328
2379
  websocket: false,
2329
2380
  ready: false
2330
2381
  }; // Vérifier l'API en utilisant l'endpoint debug avec les credentials
2331
- _context19.p = 1;
2332
- _context19.n = 2;
2382
+ _context20.p = 1;
2383
+ _context20.n = 2;
2333
2384
  return fetch(this.config.apiUrl + '/debug', {
2334
2385
  method: 'POST',
2335
2386
  headers: {
@@ -2342,29 +2393,29 @@
2342
2393
  })
2343
2394
  });
2344
2395
  case 2:
2345
- testResponse = _context19.v;
2396
+ testResponse = _context20.v;
2346
2397
  if (!testResponse.ok) {
2347
- _context19.n = 4;
2398
+ _context20.n = 4;
2348
2399
  break;
2349
2400
  }
2350
- _context19.n = 3;
2401
+ _context20.n = 3;
2351
2402
  return testResponse.json();
2352
2403
  case 3:
2353
- debugData = _context19.v;
2404
+ debugData = _context20.v;
2354
2405
  // L'API est accessible si on reçoit une réponse avec success: true
2355
2406
  status.api = debugData.success === true;
2356
2407
  console.log('🔍 API Status:', status.api ? 'accessible' : 'inaccessible');
2357
- _context19.n = 5;
2408
+ _context20.n = 5;
2358
2409
  break;
2359
2410
  case 4:
2360
2411
  status.api = false;
2361
2412
  console.log('🔍 API Status: HTTP', testResponse.status);
2362
2413
  case 5:
2363
- _context19.n = 7;
2414
+ _context20.n = 7;
2364
2415
  break;
2365
2416
  case 6:
2366
- _context19.p = 6;
2367
- _t13 = _context19.v;
2417
+ _context20.p = 6;
2418
+ _t13 = _context20.v;
2368
2419
  console.log('🔍 Test API échoué:', _t13.message);
2369
2420
  status.api = false;
2370
2421
  case 7:
@@ -2373,9 +2424,9 @@
2373
2424
 
2374
2425
  // Connexions prêtes si API est accessible
2375
2426
  status.ready = status.api;
2376
- return _context19.a(2, status);
2427
+ return _context20.a(2, status);
2377
2428
  }
2378
- }, _callee18, this, [[1, 6]]);
2429
+ }, _callee19, this, [[1, 6]]);
2379
2430
  }));
2380
2431
  function checkConnections() {
2381
2432
  return _checkConnections.apply(this, arguments);
@@ -2389,46 +2440,46 @@
2389
2440
  }, {
2390
2441
  key: "waitForConnections",
2391
2442
  value: (function () {
2392
- var _waitForConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
2443
+ var _waitForConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
2393
2444
  var timeout,
2394
2445
  startTime,
2395
2446
  status,
2396
- _args20 = arguments;
2397
- return _regenerator().w(function (_context20) {
2398
- while (1) switch (_context20.n) {
2447
+ _args21 = arguments;
2448
+ return _regenerator().w(function (_context21) {
2449
+ while (1) switch (_context21.n) {
2399
2450
  case 0:
2400
- timeout = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : 5000;
2451
+ timeout = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : 5000;
2401
2452
  startTime = Date.now();
2402
2453
  case 1:
2403
2454
  if (!(Date.now() - startTime < timeout)) {
2404
- _context20.n = 5;
2455
+ _context21.n = 5;
2405
2456
  break;
2406
2457
  }
2407
- _context20.n = 2;
2458
+ _context21.n = 2;
2408
2459
  return this.checkConnections();
2409
2460
  case 2:
2410
- status = _context20.v;
2461
+ status = _context21.v;
2411
2462
  if (!status.ready) {
2412
- _context20.n = 3;
2463
+ _context21.n = 3;
2413
2464
  break;
2414
2465
  }
2415
2466
  console.log('✅ Connexions prêtes');
2416
- return _context20.a(2, status);
2467
+ return _context21.a(2, status);
2417
2468
  case 3:
2418
2469
  console.log('⏳ Attente connexions...', status);
2419
- _context20.n = 4;
2470
+ _context21.n = 4;
2420
2471
  return new Promise(function (resolve) {
2421
2472
  return setTimeout(resolve, 1000);
2422
2473
  });
2423
2474
  case 4:
2424
- _context20.n = 1;
2475
+ _context21.n = 1;
2425
2476
  break;
2426
2477
  case 5:
2427
2478
  throw new Error('Timeout connexions - Impossible de générer le QR code');
2428
2479
  case 6:
2429
- return _context20.a(2);
2480
+ return _context21.a(2);
2430
2481
  }
2431
- }, _callee19, this);
2482
+ }, _callee20, this);
2432
2483
  }));
2433
2484
  function waitForConnections() {
2434
2485
  return _waitForConnections.apply(this, arguments);