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.
- package/dist/sunuid-sdk.esm.js +372 -321
- package/dist/sunuid-sdk.esm.js.map +1 -1
- package/dist/sunuid-sdk.js +372 -321
- package/dist/sunuid-sdk.js.map +1 -1
- package/dist/sunuid-sdk.min.js +1 -1
- package/dist/sunuid-sdk.min.js.map +1 -1
- package/package.json +1 -1
package/dist/sunuid-sdk.js
CHANGED
|
@@ -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:
|
|
295
|
-
//
|
|
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
|
|
342
|
-
|
|
343
|
-
|
|
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
|
-
|
|
359
|
-
if (!this.handleCallback()) {
|
|
357
|
+
if (!this.isInitialized) {
|
|
360
358
|
_context.n = 1;
|
|
361
359
|
break;
|
|
362
360
|
}
|
|
363
|
-
console.log('
|
|
361
|
+
console.log('⚠️ SDK déjà initialisé, ignoré');
|
|
364
362
|
return _context.a(2);
|
|
365
363
|
case 1:
|
|
366
|
-
if (!this.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
460
|
+
_context2.n = 7;
|
|
410
461
|
break;
|
|
411
462
|
case 6:
|
|
412
|
-
|
|
413
|
-
_t =
|
|
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
|
|
470
|
+
return _context2.a(2);
|
|
420
471
|
}
|
|
421
|
-
},
|
|
472
|
+
}, _callee2, this, [[0, 6]]);
|
|
422
473
|
}));
|
|
423
|
-
function
|
|
424
|
-
return
|
|
474
|
+
function _doInit() {
|
|
475
|
+
return _doInit2.apply(this, arguments);
|
|
425
476
|
}
|
|
426
|
-
return
|
|
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
|
|
486
|
+
var _secureInit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
436
487
|
var initData, response, result, decodedToken, _t2;
|
|
437
|
-
return _regenerator().w(function (
|
|
438
|
-
while (1) switch (
|
|
488
|
+
return _regenerator().w(function (_context3) {
|
|
489
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
439
490
|
case 0:
|
|
440
|
-
|
|
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
|
-
|
|
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 =
|
|
508
|
+
response = _context3.v;
|
|
458
509
|
if (response.ok) {
|
|
459
|
-
|
|
510
|
+
_context3.n = 2;
|
|
460
511
|
break;
|
|
461
512
|
}
|
|
462
513
|
throw new Error("Erreur HTTP: ".concat(response.status));
|
|
463
514
|
case 2:
|
|
464
|
-
|
|
515
|
+
_context3.n = 3;
|
|
465
516
|
return response.json();
|
|
466
517
|
case 3:
|
|
467
|
-
result =
|
|
518
|
+
result = _context3.v;
|
|
468
519
|
console.log('📋 Réponse initialisation sécurisée:', result);
|
|
469
520
|
if (result.success) {
|
|
470
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
551
|
+
_context3.n = 8;
|
|
501
552
|
break;
|
|
502
553
|
case 7:
|
|
503
|
-
|
|
504
|
-
_t2 =
|
|
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
|
|
561
|
+
return _context3.a(2);
|
|
511
562
|
}
|
|
512
|
-
},
|
|
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
|
|
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
|
-
|
|
932
|
+
_args4 = arguments,
|
|
882
933
|
_t3,
|
|
883
934
|
_t4;
|
|
884
|
-
return _regenerator().w(function (
|
|
885
|
-
while (1) switch (
|
|
935
|
+
return _regenerator().w(function (_context4) {
|
|
936
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
886
937
|
case 0:
|
|
887
|
-
containerId =
|
|
888
|
-
options =
|
|
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
|
-
|
|
941
|
+
_context4.n = 2;
|
|
891
942
|
break;
|
|
892
943
|
}
|
|
893
|
-
|
|
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
|
-
|
|
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
|
-
|
|
909
|
-
|
|
959
|
+
_context4.p = 4;
|
|
960
|
+
_context4.n = 5;
|
|
910
961
|
return this.waitForConnections(5000);
|
|
911
962
|
case 5:
|
|
912
|
-
connectionStatus =
|
|
963
|
+
connectionStatus = _context4.v;
|
|
913
964
|
// 5 secondes max
|
|
914
965
|
console.log('✅ Connexions prêtes:', connectionStatus);
|
|
915
|
-
|
|
966
|
+
_context4.n = 7;
|
|
916
967
|
break;
|
|
917
968
|
case 6:
|
|
918
|
-
|
|
919
|
-
_t3 =
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
991
|
+
response = _context4.v;
|
|
941
992
|
if (!response.success) {
|
|
942
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1016
|
+
_context4.n = 9;
|
|
966
1017
|
break;
|
|
967
1018
|
}
|
|
968
1019
|
console.log('✅ URL QR trouvée dans un champ alternatif:', qrImageUrl);
|
|
969
|
-
|
|
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
|
|
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
|
-
|
|
1055
|
+
_context4.n = 14;
|
|
1005
1056
|
break;
|
|
1006
1057
|
case 13:
|
|
1007
|
-
|
|
1008
|
-
_t4 =
|
|
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
|
|
1091
|
+
return _context4.a(2);
|
|
1041
1092
|
}
|
|
1042
|
-
},
|
|
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
|
|
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
|
-
|
|
1112
|
+
_args5 = arguments,
|
|
1062
1113
|
_t5;
|
|
1063
|
-
return _regenerator().w(function (
|
|
1064
|
-
while (1) switch (
|
|
1114
|
+
return _regenerator().w(function (_context5) {
|
|
1115
|
+
while (1) switch (_context5.p = _context5.n) {
|
|
1065
1116
|
case 0:
|
|
1066
|
-
options =
|
|
1117
|
+
options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
|
|
1067
1118
|
if (!this.initPromise) {
|
|
1068
|
-
|
|
1119
|
+
_context5.n = 2;
|
|
1069
1120
|
break;
|
|
1070
1121
|
}
|
|
1071
|
-
|
|
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
|
-
|
|
1128
|
+
_context5.n = 3;
|
|
1078
1129
|
break;
|
|
1079
1130
|
}
|
|
1080
1131
|
throw new Error('SunuID: SDK non initialisé');
|
|
1081
1132
|
case 3:
|
|
1082
|
-
|
|
1083
|
-
|
|
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 =
|
|
1139
|
+
response = _context5.v;
|
|
1089
1140
|
if (!response.success) {
|
|
1090
|
-
|
|
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
|
|
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
|
-
|
|
1161
|
+
_context5.n = 8;
|
|
1111
1162
|
break;
|
|
1112
1163
|
case 7:
|
|
1113
|
-
|
|
1114
|
-
_t5 =
|
|
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
|
|
1179
|
+
return _context5.a(2);
|
|
1129
1180
|
}
|
|
1130
|
-
},
|
|
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
|
|
1192
|
+
var _generateAuthQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(containerId) {
|
|
1142
1193
|
var options,
|
|
1143
|
-
|
|
1144
|
-
return _regenerator().w(function (
|
|
1145
|
-
while (1) switch (
|
|
1194
|
+
_args6 = arguments;
|
|
1195
|
+
return _regenerator().w(function (_context6) {
|
|
1196
|
+
while (1) switch (_context6.n) {
|
|
1146
1197
|
case 0:
|
|
1147
|
-
options =
|
|
1148
|
-
return
|
|
1198
|
+
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
1199
|
+
return _context6.a(2, this.generateQR(containerId, options));
|
|
1149
1200
|
}
|
|
1150
|
-
},
|
|
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
|
|
1211
|
+
var _generateKYCQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(containerId) {
|
|
1161
1212
|
var options,
|
|
1162
1213
|
originalType,
|
|
1163
|
-
|
|
1164
|
-
return _regenerator().w(function (
|
|
1165
|
-
while (1) switch (
|
|
1214
|
+
_args7 = arguments;
|
|
1215
|
+
return _regenerator().w(function (_context7) {
|
|
1216
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
1166
1217
|
case 0:
|
|
1167
|
-
options =
|
|
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
|
-
|
|
1172
|
-
|
|
1222
|
+
_context7.p = 1;
|
|
1223
|
+
_context7.n = 2;
|
|
1173
1224
|
return this.generateQR(containerId, options);
|
|
1174
1225
|
case 2:
|
|
1175
|
-
return
|
|
1226
|
+
return _context7.a(2, _context7.v);
|
|
1176
1227
|
case 3:
|
|
1177
|
-
|
|
1228
|
+
_context7.p = 3;
|
|
1178
1229
|
// Restaurer le type original
|
|
1179
1230
|
this.config.type = originalType;
|
|
1180
|
-
return
|
|
1231
|
+
return _context7.f(3);
|
|
1181
1232
|
case 4:
|
|
1182
|
-
return
|
|
1233
|
+
return _context7.a(2);
|
|
1183
1234
|
}
|
|
1184
|
-
},
|
|
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
|
|
1245
|
+
var _generateSignatureQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(containerId) {
|
|
1195
1246
|
var options,
|
|
1196
1247
|
originalType,
|
|
1197
|
-
|
|
1198
|
-
return _regenerator().w(function (
|
|
1199
|
-
while (1) switch (
|
|
1248
|
+
_args8 = arguments;
|
|
1249
|
+
return _regenerator().w(function (_context8) {
|
|
1250
|
+
while (1) switch (_context8.p = _context8.n) {
|
|
1200
1251
|
case 0:
|
|
1201
|
-
options =
|
|
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
|
-
|
|
1206
|
-
|
|
1256
|
+
_context8.p = 1;
|
|
1257
|
+
_context8.n = 2;
|
|
1207
1258
|
return this.generateQR(containerId, options);
|
|
1208
1259
|
case 2:
|
|
1209
|
-
return
|
|
1260
|
+
return _context8.a(2, _context8.v);
|
|
1210
1261
|
case 3:
|
|
1211
|
-
|
|
1262
|
+
_context8.p = 3;
|
|
1212
1263
|
// Restaurer le type original
|
|
1213
1264
|
this.config.type = originalType;
|
|
1214
|
-
return
|
|
1265
|
+
return _context8.f(3);
|
|
1215
1266
|
case 4:
|
|
1216
|
-
return
|
|
1267
|
+
return _context8.a(2);
|
|
1217
1268
|
}
|
|
1218
|
-
},
|
|
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
|
|
1282
|
+
var _checkQRStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(sessionId) {
|
|
1232
1283
|
var response, _t6;
|
|
1233
|
-
return _regenerator().w(function (
|
|
1234
|
-
while (1) switch (
|
|
1284
|
+
return _regenerator().w(function (_context9) {
|
|
1285
|
+
while (1) switch (_context9.p = _context9.n) {
|
|
1235
1286
|
case 0:
|
|
1236
1287
|
if (this.isInitialized) {
|
|
1237
|
-
|
|
1288
|
+
_context9.n = 1;
|
|
1238
1289
|
break;
|
|
1239
1290
|
}
|
|
1240
1291
|
throw new Error('SunuID: SDK non initialisé');
|
|
1241
1292
|
case 1:
|
|
1242
|
-
|
|
1243
|
-
|
|
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 =
|
|
1299
|
+
response = _context9.v;
|
|
1249
1300
|
if (!response.success) {
|
|
1250
|
-
|
|
1301
|
+
_context9.n = 3;
|
|
1251
1302
|
break;
|
|
1252
1303
|
}
|
|
1253
|
-
return
|
|
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
|
-
|
|
1308
|
+
_context9.n = 6;
|
|
1258
1309
|
break;
|
|
1259
1310
|
case 5:
|
|
1260
|
-
|
|
1261
|
-
_t6 =
|
|
1311
|
+
_context9.p = 5;
|
|
1312
|
+
_t6 = _context9.v;
|
|
1262
1313
|
this.handleError(_t6);
|
|
1263
1314
|
throw _t6;
|
|
1264
1315
|
case 6:
|
|
1265
|
-
return
|
|
1316
|
+
return _context9.a(2);
|
|
1266
1317
|
}
|
|
1267
|
-
},
|
|
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
|
|
1332
|
+
var _generateQRWithContent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(content, containerId, type) {
|
|
1282
1333
|
var options,
|
|
1283
1334
|
localQRUrl,
|
|
1284
|
-
|
|
1335
|
+
_args0 = arguments,
|
|
1285
1336
|
_t7;
|
|
1286
|
-
return _regenerator().w(function (
|
|
1287
|
-
while (1) switch (
|
|
1337
|
+
return _regenerator().w(function (_context0) {
|
|
1338
|
+
while (1) switch (_context0.p = _context0.n) {
|
|
1288
1339
|
case 0:
|
|
1289
|
-
options =
|
|
1340
|
+
options = _args0.length > 3 && _args0[3] !== undefined ? _args0[3] : {};
|
|
1290
1341
|
console.log('🎨 Génération QR avec contenu:', content);
|
|
1291
|
-
|
|
1342
|
+
_context0.p = 1;
|
|
1292
1343
|
if (!(window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1' || window.location.protocol === 'file:')) {
|
|
1293
|
-
|
|
1344
|
+
_context0.n = 3;
|
|
1294
1345
|
break;
|
|
1295
1346
|
}
|
|
1296
1347
|
console.log('🏠 Utilisation service QR local...');
|
|
1297
|
-
|
|
1348
|
+
_context0.n = 2;
|
|
1298
1349
|
return this.generateQRLocal(content, containerId, type, options);
|
|
1299
1350
|
case 2:
|
|
1300
|
-
localQRUrl =
|
|
1351
|
+
localQRUrl = _context0.v;
|
|
1301
1352
|
if (!localQRUrl) {
|
|
1302
|
-
|
|
1353
|
+
_context0.n = 3;
|
|
1303
1354
|
break;
|
|
1304
1355
|
}
|
|
1305
|
-
return
|
|
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
|
-
|
|
1360
|
+
_context0.n = 4;
|
|
1310
1361
|
return this.generateQRRemote(content, containerId, type, options);
|
|
1311
1362
|
case 4:
|
|
1312
|
-
return
|
|
1363
|
+
return _context0.a(2, _context0.v);
|
|
1313
1364
|
case 5:
|
|
1314
|
-
|
|
1315
|
-
_t7 =
|
|
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
|
|
1370
|
+
return _context0.a(2, null);
|
|
1320
1371
|
}
|
|
1321
|
-
},
|
|
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
|
|
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
|
-
|
|
1391
|
+
_args1 = arguments,
|
|
1341
1392
|
_t8;
|
|
1342
|
-
return _regenerator().w(function (
|
|
1343
|
-
while (1) switch (
|
|
1393
|
+
return _regenerator().w(function (_context1) {
|
|
1394
|
+
while (1) switch (_context1.p = _context1.n) {
|
|
1344
1395
|
case 0:
|
|
1345
|
-
options =
|
|
1346
|
-
|
|
1347
|
-
|
|
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 =
|
|
1407
|
+
response = _context1.v;
|
|
1357
1408
|
if (!response.ok) {
|
|
1358
|
-
|
|
1409
|
+
_context1.n = 4;
|
|
1359
1410
|
break;
|
|
1360
1411
|
}
|
|
1361
|
-
|
|
1412
|
+
_context1.n = 3;
|
|
1362
1413
|
return response.json();
|
|
1363
1414
|
case 3:
|
|
1364
|
-
data =
|
|
1415
|
+
data = _context1.v;
|
|
1365
1416
|
qrUrl = "data:image/png;base64,".concat(data.qrcode);
|
|
1366
1417
|
this.displayQRCode(containerId, qrUrl, type, options);
|
|
1367
|
-
return
|
|
1418
|
+
return _context1.a(2, qrUrl);
|
|
1368
1419
|
case 4:
|
|
1369
|
-
|
|
1420
|
+
_context1.n = 6;
|
|
1370
1421
|
break;
|
|
1371
1422
|
case 5:
|
|
1372
|
-
|
|
1373
|
-
_t8 =
|
|
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
|
|
1427
|
+
return _context1.a(2, null);
|
|
1377
1428
|
}
|
|
1378
|
-
},
|
|
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
|
|
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
|
-
|
|
1448
|
+
_args10 = arguments,
|
|
1398
1449
|
_t9;
|
|
1399
|
-
return _regenerator().w(function (
|
|
1400
|
-
while (1) switch (
|
|
1450
|
+
return _regenerator().w(function (_context10) {
|
|
1451
|
+
while (1) switch (_context10.p = _context10.n) {
|
|
1401
1452
|
case 0:
|
|
1402
|
-
options =
|
|
1403
|
-
|
|
1404
|
-
|
|
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 =
|
|
1468
|
+
response = _context10.v;
|
|
1418
1469
|
if (!response.ok) {
|
|
1419
|
-
|
|
1470
|
+
_context10.n = 4;
|
|
1420
1471
|
break;
|
|
1421
1472
|
}
|
|
1422
|
-
|
|
1473
|
+
_context10.n = 3;
|
|
1423
1474
|
return response.json();
|
|
1424
1475
|
case 3:
|
|
1425
|
-
data =
|
|
1476
|
+
data = _context10.v;
|
|
1426
1477
|
qrUrl = "data:image/png;base64,".concat(data.qrcode);
|
|
1427
1478
|
this.displayQRCode(containerId, qrUrl, type, options);
|
|
1428
|
-
return
|
|
1479
|
+
return _context10.a(2, qrUrl);
|
|
1429
1480
|
case 4:
|
|
1430
|
-
|
|
1481
|
+
_context10.n = 6;
|
|
1431
1482
|
break;
|
|
1432
1483
|
case 5:
|
|
1433
|
-
|
|
1434
|
-
_t9 =
|
|
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
|
|
1490
|
+
return _context10.a(2, null);
|
|
1440
1491
|
}
|
|
1441
|
-
},
|
|
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
|
|
1550
|
+
var _generateCustomQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(content, label) {
|
|
1500
1551
|
var qrContainer,
|
|
1501
1552
|
_t0;
|
|
1502
|
-
return _regenerator().w(function (
|
|
1503
|
-
while (1) switch (
|
|
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
|
-
|
|
1566
|
+
_context11.n = 1;
|
|
1516
1567
|
break;
|
|
1517
1568
|
}
|
|
1518
1569
|
console.error('❌ QR container not found');
|
|
1519
|
-
return
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1583
|
+
_context11.n = 5;
|
|
1533
1584
|
break;
|
|
1534
1585
|
case 4:
|
|
1535
|
-
|
|
1536
|
-
_t0 =
|
|
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
|
|
1594
|
+
return _context11.a(2);
|
|
1544
1595
|
}
|
|
1545
|
-
},
|
|
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
|
|
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 (
|
|
1563
|
-
while (1) switch (
|
|
1613
|
+
return _regenerator().w(function (_context12) {
|
|
1614
|
+
while (1) switch (_context12.n) {
|
|
1564
1615
|
case 0:
|
|
1565
|
-
|
|
1616
|
+
_context12.n = 1;
|
|
1566
1617
|
return this.ensureQRCodeLibrary();
|
|
1567
1618
|
case 1:
|
|
1568
1619
|
if (!(typeof QRCode === 'undefined')) {
|
|
1569
|
-
|
|
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
|
|
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
|
-
},
|
|
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
|
|
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 (
|
|
1635
|
-
while (1) switch (
|
|
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
|
-
|
|
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 =
|
|
1734
|
+
response = _context13.v;
|
|
1684
1735
|
if (response.ok) {
|
|
1685
|
-
|
|
1736
|
+
_context13.n = 2;
|
|
1686
1737
|
break;
|
|
1687
1738
|
}
|
|
1688
1739
|
throw new Error("Erreur HTTP: ".concat(response.status));
|
|
1689
1740
|
case 2:
|
|
1690
|
-
|
|
1741
|
+
_context13.n = 3;
|
|
1691
1742
|
return response.json();
|
|
1692
1743
|
case 3:
|
|
1693
|
-
responseData =
|
|
1744
|
+
responseData = _context13.v;
|
|
1694
1745
|
if (responseData.success) {
|
|
1695
|
-
|
|
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
|
|
1769
|
+
return _context13.a(2);
|
|
1719
1770
|
}
|
|
1720
|
-
},
|
|
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
|
|
1744
|
-
return _regenerator().w(function (
|
|
1745
|
-
while (1) switch (
|
|
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
|
-
|
|
1799
|
+
_context14.n = 1;
|
|
1749
1800
|
break;
|
|
1750
1801
|
}
|
|
1751
1802
|
console.log('✅ QRCode library déjà disponible');
|
|
1752
|
-
return
|
|
1803
|
+
return _context14.a(2, true);
|
|
1753
1804
|
case 1:
|
|
1754
1805
|
console.log('📦 Chargement QRCode library...');
|
|
1755
|
-
return
|
|
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
|
-
},
|
|
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
|
|
1914
|
+
var _refreshQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(containerId) {
|
|
1864
1915
|
var options,
|
|
1865
1916
|
result,
|
|
1866
1917
|
_result,
|
|
1867
|
-
|
|
1918
|
+
_args15 = arguments,
|
|
1868
1919
|
_t1;
|
|
1869
|
-
return _regenerator().w(function (
|
|
1870
|
-
while (1) switch (
|
|
1920
|
+
return _regenerator().w(function (_context15) {
|
|
1921
|
+
while (1) switch (_context15.p = _context15.n) {
|
|
1871
1922
|
case 0:
|
|
1872
|
-
options =
|
|
1873
|
-
|
|
1923
|
+
options = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : {};
|
|
1924
|
+
_context15.p = 1;
|
|
1874
1925
|
if (!this.currentQRUrl) {
|
|
1875
|
-
|
|
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
|
-
|
|
1936
|
+
_context15.n = 2;
|
|
1886
1937
|
return this.generateQR(containerId, options);
|
|
1887
1938
|
case 2:
|
|
1888
|
-
result =
|
|
1889
|
-
return
|
|
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
|
-
|
|
1943
|
+
_context15.n = 4;
|
|
1893
1944
|
return this.generateQR(containerId, options);
|
|
1894
1945
|
case 4:
|
|
1895
|
-
_result =
|
|
1896
|
-
return
|
|
1946
|
+
_result = _context15.v;
|
|
1947
|
+
return _context15.a(2, _result);
|
|
1897
1948
|
case 5:
|
|
1898
|
-
|
|
1949
|
+
_context15.n = 7;
|
|
1899
1950
|
break;
|
|
1900
1951
|
case 6:
|
|
1901
|
-
|
|
1902
|
-
_t1 =
|
|
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
|
|
1958
|
+
return _context15.a(2);
|
|
1908
1959
|
}
|
|
1909
|
-
},
|
|
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
|
|
1982
|
+
this.refreshTimer = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
1932
1983
|
var _t10;
|
|
1933
|
-
return _regenerator().w(function (
|
|
1934
|
-
while (1) switch (
|
|
1984
|
+
return _regenerator().w(function (_context16) {
|
|
1985
|
+
while (1) switch (_context16.p = _context16.n) {
|
|
1935
1986
|
case 0:
|
|
1936
|
-
|
|
1987
|
+
_context16.p = 0;
|
|
1937
1988
|
console.log('🔄 Rafraîchissement automatique du QR code...');
|
|
1938
|
-
|
|
1989
|
+
_context16.n = 1;
|
|
1939
1990
|
return _this3.refreshQR(containerId, type, options);
|
|
1940
1991
|
case 1:
|
|
1941
|
-
|
|
1992
|
+
_context16.n = 3;
|
|
1942
1993
|
break;
|
|
1943
1994
|
case 2:
|
|
1944
|
-
|
|
1945
|
-
_t10 =
|
|
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
|
|
1999
|
+
return _context16.a(2);
|
|
1949
2000
|
}
|
|
1950
|
-
},
|
|
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
|
|
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 (
|
|
1971
|
-
while (1) switch (
|
|
2021
|
+
return _regenerator().w(function (_context18) {
|
|
2022
|
+
while (1) switch (_context18.n) {
|
|
1972
2023
|
case 0:
|
|
1973
2024
|
if (this.isInitialized) {
|
|
1974
|
-
|
|
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
|
-
|
|
2034
|
+
_context18.n = 2;
|
|
1984
2035
|
break;
|
|
1985
2036
|
}
|
|
1986
2037
|
this.config.requestCount++;
|
|
1987
2038
|
if (!(this.config.requestCount > this.config.maxRequests)) {
|
|
1988
|
-
|
|
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 (
|
|
2025
|
-
while (1) switch (
|
|
2075
|
+
return _regenerator().w(function (_context17) {
|
|
2076
|
+
while (1) switch (_context17.p = _context17.n) {
|
|
2026
2077
|
case 0:
|
|
2027
|
-
|
|
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
|
-
|
|
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 =
|
|
2098
|
+
response = _context17.v;
|
|
2048
2099
|
clearTimeout(timeoutId);
|
|
2049
2100
|
if (response.ok) {
|
|
2050
|
-
|
|
2101
|
+
_context17.n = 3;
|
|
2051
2102
|
break;
|
|
2052
2103
|
}
|
|
2053
|
-
|
|
2104
|
+
_context17.n = 2;
|
|
2054
2105
|
return response.text();
|
|
2055
2106
|
case 2:
|
|
2056
|
-
errorText =
|
|
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
|
-
|
|
2122
|
+
_context17.n = 4;
|
|
2072
2123
|
return response.json();
|
|
2073
2124
|
case 4:
|
|
2074
|
-
result =
|
|
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
|
|
2130
|
+
return _context17.a(2, {
|
|
2080
2131
|
v: result
|
|
2081
2132
|
});
|
|
2082
2133
|
case 5:
|
|
2083
|
-
|
|
2084
|
-
_t11 =
|
|
2134
|
+
_context17.p = 5;
|
|
2135
|
+
_t11 = _context17.v;
|
|
2085
2136
|
retryCount++;
|
|
2086
2137
|
if (!(_t11.name === 'AbortError')) {
|
|
2087
|
-
|
|
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
|
-
|
|
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
|
|
2150
|
+
return _context17.a(2, 0);
|
|
2100
2151
|
case 7:
|
|
2101
2152
|
if (!(retryCount > maxRetries)) {
|
|
2102
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
2173
|
+
_context18.n = 7;
|
|
2123
2174
|
break;
|
|
2124
2175
|
}
|
|
2125
|
-
return
|
|
2176
|
+
return _context18.d(_regeneratorValues(_loop()), 4);
|
|
2126
2177
|
case 4:
|
|
2127
|
-
_ret =
|
|
2178
|
+
_ret = _context18.v;
|
|
2128
2179
|
if (!(_ret === 0)) {
|
|
2129
|
-
|
|
2180
|
+
_context18.n = 5;
|
|
2130
2181
|
break;
|
|
2131
2182
|
}
|
|
2132
|
-
return
|
|
2183
|
+
return _context18.a(3, 3);
|
|
2133
2184
|
case 5:
|
|
2134
2185
|
if (!_ret) {
|
|
2135
|
-
|
|
2186
|
+
_context18.n = 6;
|
|
2136
2187
|
break;
|
|
2137
2188
|
}
|
|
2138
|
-
return
|
|
2189
|
+
return _context18.a(2, _ret.v);
|
|
2139
2190
|
case 6:
|
|
2140
|
-
|
|
2191
|
+
_context18.n = 3;
|
|
2141
2192
|
break;
|
|
2142
2193
|
case 7:
|
|
2143
|
-
return
|
|
2194
|
+
return _context18.a(2);
|
|
2144
2195
|
}
|
|
2145
|
-
},
|
|
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
|
|
2267
|
+
var _fetchPartnerInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
|
|
2217
2268
|
var response, data, partnerId, _t12;
|
|
2218
|
-
return _regenerator().w(function (
|
|
2219
|
-
while (1) switch (
|
|
2269
|
+
return _regenerator().w(function (_context19) {
|
|
2270
|
+
while (1) switch (_context19.p = _context19.n) {
|
|
2220
2271
|
case 0:
|
|
2221
|
-
|
|
2222
|
-
|
|
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 =
|
|
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
|
-
|
|
2324
|
+
_context19.n = 3;
|
|
2274
2325
|
break;
|
|
2275
2326
|
case 2:
|
|
2276
|
-
|
|
2277
|
-
_t12 =
|
|
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
|
|
2332
|
+
return _context19.a(2);
|
|
2282
2333
|
}
|
|
2283
|
-
},
|
|
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
|
|
2372
|
+
var _checkConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
|
|
2322
2373
|
var status, testResponse, debugData, _t13;
|
|
2323
|
-
return _regenerator().w(function (
|
|
2324
|
-
while (1) switch (
|
|
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
|
-
|
|
2332
|
-
|
|
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 =
|
|
2396
|
+
testResponse = _context20.v;
|
|
2346
2397
|
if (!testResponse.ok) {
|
|
2347
|
-
|
|
2398
|
+
_context20.n = 4;
|
|
2348
2399
|
break;
|
|
2349
2400
|
}
|
|
2350
|
-
|
|
2401
|
+
_context20.n = 3;
|
|
2351
2402
|
return testResponse.json();
|
|
2352
2403
|
case 3:
|
|
2353
|
-
debugData =
|
|
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
|
-
|
|
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
|
-
|
|
2414
|
+
_context20.n = 7;
|
|
2364
2415
|
break;
|
|
2365
2416
|
case 6:
|
|
2366
|
-
|
|
2367
|
-
_t13 =
|
|
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
|
|
2427
|
+
return _context20.a(2, status);
|
|
2377
2428
|
}
|
|
2378
|
-
},
|
|
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
|
|
2443
|
+
var _waitForConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
|
|
2393
2444
|
var timeout,
|
|
2394
2445
|
startTime,
|
|
2395
2446
|
status,
|
|
2396
|
-
|
|
2397
|
-
return _regenerator().w(function (
|
|
2398
|
-
while (1) switch (
|
|
2447
|
+
_args21 = arguments;
|
|
2448
|
+
return _regenerator().w(function (_context21) {
|
|
2449
|
+
while (1) switch (_context21.n) {
|
|
2399
2450
|
case 0:
|
|
2400
|
-
timeout =
|
|
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
|
-
|
|
2455
|
+
_context21.n = 5;
|
|
2405
2456
|
break;
|
|
2406
2457
|
}
|
|
2407
|
-
|
|
2458
|
+
_context21.n = 2;
|
|
2408
2459
|
return this.checkConnections();
|
|
2409
2460
|
case 2:
|
|
2410
|
-
status =
|
|
2461
|
+
status = _context21.v;
|
|
2411
2462
|
if (!status.ready) {
|
|
2412
|
-
|
|
2463
|
+
_context21.n = 3;
|
|
2413
2464
|
break;
|
|
2414
2465
|
}
|
|
2415
2466
|
console.log('✅ Connexions prêtes');
|
|
2416
|
-
return
|
|
2467
|
+
return _context21.a(2, status);
|
|
2417
2468
|
case 3:
|
|
2418
2469
|
console.log('⏳ Attente connexions...', status);
|
|
2419
|
-
|
|
2470
|
+
_context21.n = 4;
|
|
2420
2471
|
return new Promise(function (resolve) {
|
|
2421
2472
|
return setTimeout(resolve, 1000);
|
|
2422
2473
|
});
|
|
2423
2474
|
case 4:
|
|
2424
|
-
|
|
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
|
|
2480
|
+
return _context21.a(2);
|
|
2430
2481
|
}
|
|
2431
|
-
},
|
|
2482
|
+
}, _callee20, this);
|
|
2432
2483
|
}));
|
|
2433
2484
|
function waitForConnections() {
|
|
2434
2485
|
return _waitForConnections.apply(this, arguments);
|