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