sunuid-sdk 1.0.40 → 1.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sunuid-sdk.esm.js +604 -349
- package/dist/sunuid-sdk.esm.js.map +1 -1
- package/dist/sunuid-sdk.js +604 -349
- package/dist/sunuid-sdk.js.map +1 -1
- package/dist/sunuid-sdk.min.js +3 -3
- 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,
|
|
@@ -314,7 +314,15 @@
|
|
|
314
314
|
token: null,
|
|
315
315
|
// Configuration pour forcer l'utilisation du serveur distant
|
|
316
316
|
forceRemoteServer: true,
|
|
317
|
-
useLocalFallback: false
|
|
317
|
+
useLocalFallback: false,
|
|
318
|
+
// Nouvelles options pour les callbacks
|
|
319
|
+
redirectAfterSuccess: null,
|
|
320
|
+
verifySignature: false,
|
|
321
|
+
tokenMaxAge: 300,
|
|
322
|
+
// 5 minutes par défaut
|
|
323
|
+
onAuthenticationSuccess: null,
|
|
324
|
+
onAuthenticationError: null,
|
|
325
|
+
state: null
|
|
318
326
|
};
|
|
319
327
|
|
|
320
328
|
/**
|
|
@@ -322,6 +330,7 @@
|
|
|
322
330
|
*/
|
|
323
331
|
var SunuID = /*#__PURE__*/function () {
|
|
324
332
|
function SunuID() {
|
|
333
|
+
var _this = this;
|
|
325
334
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
326
335
|
_classCallCheck(this, SunuID);
|
|
327
336
|
this.config = _objectSpread2(_objectSpread2({}, DEFAULT_CONFIG), config);
|
|
@@ -329,10 +338,14 @@
|
|
|
329
338
|
this.refreshTimer = null;
|
|
330
339
|
this.isInitialized = false;
|
|
331
340
|
this.socket = null;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
341
|
+
this.initPromise = null;
|
|
342
|
+
|
|
343
|
+
// Initialisation asynchrone seulement si autoInit est explicitement activé
|
|
344
|
+
if (this.config.autoInit === true) {
|
|
345
|
+
// Délai pour éviter les conflits avec d'autres scripts
|
|
346
|
+
setTimeout(function () {
|
|
347
|
+
_this.init();
|
|
348
|
+
}, 100);
|
|
336
349
|
}
|
|
337
350
|
}
|
|
338
351
|
|
|
@@ -343,26 +356,68 @@
|
|
|
343
356
|
key: "init",
|
|
344
357
|
value: (function () {
|
|
345
358
|
var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
346
|
-
var _t;
|
|
347
359
|
return _regenerator().w(function (_context) {
|
|
348
|
-
while (1) switch (_context.
|
|
360
|
+
while (1) switch (_context.n) {
|
|
349
361
|
case 0:
|
|
350
|
-
|
|
351
|
-
|
|
362
|
+
if (!this.isInitialized) {
|
|
363
|
+
_context.n = 1;
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
console.log('⚠️ SDK déjà initialisé, ignoré');
|
|
367
|
+
return _context.a(2);
|
|
368
|
+
case 1:
|
|
369
|
+
if (!this.initPromise) {
|
|
352
370
|
_context.n = 2;
|
|
353
371
|
break;
|
|
354
372
|
}
|
|
355
|
-
|
|
356
|
-
return this.
|
|
373
|
+
console.log('⚠️ Initialisation déjà en cours, attente...');
|
|
374
|
+
return _context.a(2, this.initPromise);
|
|
375
|
+
case 2:
|
|
376
|
+
this.initPromise = this._doInit();
|
|
377
|
+
return _context.a(2, this.initPromise);
|
|
378
|
+
}
|
|
379
|
+
}, _callee, this);
|
|
380
|
+
}));
|
|
381
|
+
function init() {
|
|
382
|
+
return _init.apply(this, arguments);
|
|
383
|
+
}
|
|
384
|
+
return init;
|
|
385
|
+
}()
|
|
386
|
+
/**
|
|
387
|
+
* Initialisation interne du SDK
|
|
388
|
+
*/
|
|
389
|
+
)
|
|
390
|
+
}, {
|
|
391
|
+
key: "_doInit",
|
|
392
|
+
value: (function () {
|
|
393
|
+
var _doInit2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
394
|
+
var _t;
|
|
395
|
+
return _regenerator().w(function (_context2) {
|
|
396
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
397
|
+
case 0:
|
|
398
|
+
_context2.p = 0;
|
|
399
|
+
if (!this.handleCallback()) {
|
|
400
|
+
_context2.n = 1;
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
console.log('✅ Callback traité, initialisation terminée');
|
|
404
|
+
return _context2.a(2);
|
|
357
405
|
case 1:
|
|
358
|
-
|
|
359
|
-
|
|
406
|
+
if (!this.config.secureInit) {
|
|
407
|
+
_context2.n = 3;
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
_context2.n = 2;
|
|
411
|
+
return this.secureInit();
|
|
360
412
|
case 2:
|
|
413
|
+
_context2.n = 4;
|
|
414
|
+
break;
|
|
415
|
+
case 3:
|
|
361
416
|
// Validation sécurisée des paramètres
|
|
362
417
|
if (this.config.validateInputs) {
|
|
363
418
|
this.validateSecurityParams();
|
|
364
419
|
}
|
|
365
|
-
case
|
|
420
|
+
case 4:
|
|
366
421
|
// Log de sécurité pour l'initialisation
|
|
367
422
|
this.logSecurityEvent('SDK_INIT_START', {
|
|
368
423
|
apiUrl: this.config.apiUrl,
|
|
@@ -371,9 +426,9 @@
|
|
|
371
426
|
});
|
|
372
427
|
|
|
373
428
|
// Récupérer les informations du partenaire depuis l'API
|
|
374
|
-
|
|
429
|
+
_context2.n = 5;
|
|
375
430
|
return this.fetchPartnerInfo();
|
|
376
|
-
case
|
|
431
|
+
case 5:
|
|
377
432
|
// Obscurcir les credentials dans les logs
|
|
378
433
|
this.obfuscateCredentials();
|
|
379
434
|
this.isInitialized = true;
|
|
@@ -391,24 +446,24 @@
|
|
|
391
446
|
|
|
392
447
|
// Initialiser la connexion WebSocket
|
|
393
448
|
this.initWebSocket();
|
|
394
|
-
|
|
449
|
+
_context2.n = 7;
|
|
395
450
|
break;
|
|
396
|
-
case
|
|
397
|
-
|
|
398
|
-
_t =
|
|
451
|
+
case 6:
|
|
452
|
+
_context2.p = 6;
|
|
453
|
+
_t = _context2.v;
|
|
399
454
|
this.logSecurityEvent('SDK_INIT_ERROR', {
|
|
400
455
|
error: _t.message
|
|
401
456
|
});
|
|
402
457
|
throw _t;
|
|
403
|
-
case
|
|
404
|
-
return
|
|
458
|
+
case 7:
|
|
459
|
+
return _context2.a(2);
|
|
405
460
|
}
|
|
406
|
-
},
|
|
461
|
+
}, _callee2, this, [[0, 6]]);
|
|
407
462
|
}));
|
|
408
|
-
function
|
|
409
|
-
return
|
|
463
|
+
function _doInit() {
|
|
464
|
+
return _doInit2.apply(this, arguments);
|
|
410
465
|
}
|
|
411
|
-
return
|
|
466
|
+
return _doInit;
|
|
412
467
|
}()
|
|
413
468
|
/**
|
|
414
469
|
* Initialisation sécurisée via PHP
|
|
@@ -417,19 +472,19 @@
|
|
|
417
472
|
}, {
|
|
418
473
|
key: "secureInit",
|
|
419
474
|
value: (function () {
|
|
420
|
-
var _secureInit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
475
|
+
var _secureInit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
421
476
|
var initData, response, result, decodedToken, _t2;
|
|
422
|
-
return _regenerator().w(function (
|
|
423
|
-
while (1) switch (
|
|
477
|
+
return _regenerator().w(function (_context3) {
|
|
478
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
424
479
|
case 0:
|
|
425
|
-
|
|
480
|
+
_context3.p = 0;
|
|
426
481
|
this.logSecurityEvent('SECURE_INIT_START');
|
|
427
482
|
initData = {
|
|
428
483
|
type: this.config.type,
|
|
429
484
|
partnerName: this.config.partnerName,
|
|
430
485
|
theme: this.config.theme
|
|
431
486
|
};
|
|
432
|
-
|
|
487
|
+
_context3.n = 1;
|
|
433
488
|
return fetch(this.config.secureInitUrl, {
|
|
434
489
|
method: 'POST',
|
|
435
490
|
headers: {
|
|
@@ -439,20 +494,20 @@
|
|
|
439
494
|
body: JSON.stringify(initData)
|
|
440
495
|
});
|
|
441
496
|
case 1:
|
|
442
|
-
response =
|
|
497
|
+
response = _context3.v;
|
|
443
498
|
if (response.ok) {
|
|
444
|
-
|
|
499
|
+
_context3.n = 2;
|
|
445
500
|
break;
|
|
446
501
|
}
|
|
447
502
|
throw new Error("Erreur HTTP: ".concat(response.status));
|
|
448
503
|
case 2:
|
|
449
|
-
|
|
504
|
+
_context3.n = 3;
|
|
450
505
|
return response.json();
|
|
451
506
|
case 3:
|
|
452
|
-
result =
|
|
507
|
+
result = _context3.v;
|
|
453
508
|
console.log('📋 Réponse initialisation sécurisée:', result);
|
|
454
509
|
if (result.success) {
|
|
455
|
-
|
|
510
|
+
_context3.n = 4;
|
|
456
511
|
break;
|
|
457
512
|
}
|
|
458
513
|
throw new Error(result.error || 'Erreur lors de l\'initialisation sécurisée');
|
|
@@ -464,12 +519,12 @@
|
|
|
464
519
|
// Décoder le token pour récupérer les credentials
|
|
465
520
|
decodedToken = this.decodeSecureToken(result.data.token);
|
|
466
521
|
if (!decodedToken) {
|
|
467
|
-
|
|
522
|
+
_context3.n = 5;
|
|
468
523
|
break;
|
|
469
524
|
}
|
|
470
525
|
this.config.clientId = decodedToken.client_id;
|
|
471
526
|
this.config.secretId = decodedToken.secret_id;
|
|
472
|
-
|
|
527
|
+
_context3.n = 6;
|
|
473
528
|
break;
|
|
474
529
|
case 5:
|
|
475
530
|
throw new Error('Impossible de décoder le token sécurisé');
|
|
@@ -482,19 +537,19 @@
|
|
|
482
537
|
maxRequests: result.data.max_requests
|
|
483
538
|
});
|
|
484
539
|
console.log('✅ Initialisation sécurisée réussie');
|
|
485
|
-
|
|
540
|
+
_context3.n = 8;
|
|
486
541
|
break;
|
|
487
542
|
case 7:
|
|
488
|
-
|
|
489
|
-
_t2 =
|
|
543
|
+
_context3.p = 7;
|
|
544
|
+
_t2 = _context3.v;
|
|
490
545
|
this.logSecurityEvent('SECURE_INIT_ERROR', {
|
|
491
546
|
error: _t2.message
|
|
492
547
|
});
|
|
493
548
|
throw new Error("\xC9chec de l'initialisation s\xE9curis\xE9e: ".concat(_t2.message));
|
|
494
549
|
case 8:
|
|
495
|
-
return
|
|
550
|
+
return _context3.a(2);
|
|
496
551
|
}
|
|
497
|
-
},
|
|
552
|
+
}, _callee3, this, [[0, 7]]);
|
|
498
553
|
}));
|
|
499
554
|
function secureInit() {
|
|
500
555
|
return _secureInit.apply(this, arguments);
|
|
@@ -541,14 +596,14 @@
|
|
|
541
596
|
}, {
|
|
542
597
|
key: "initWebSocket",
|
|
543
598
|
value: function initWebSocket() {
|
|
544
|
-
var
|
|
599
|
+
var _this2 = this;
|
|
545
600
|
try {
|
|
546
601
|
// Vérifier si Socket.IO est disponible
|
|
547
602
|
if (typeof io === 'undefined') {
|
|
548
603
|
console.warn('⚠️ Socket.IO non disponible, WebSocket sera initialisé plus tard');
|
|
549
604
|
// Réessayer après un délai
|
|
550
605
|
setTimeout(function () {
|
|
551
|
-
return
|
|
606
|
+
return _this2.initWebSocket();
|
|
552
607
|
}, 1000);
|
|
553
608
|
return;
|
|
554
609
|
}
|
|
@@ -572,36 +627,36 @@
|
|
|
572
627
|
// Gestion des événements WebSocket
|
|
573
628
|
this.socket.on('connect', function () {
|
|
574
629
|
console.log('🌐 WebSocket connecté avec succès');
|
|
575
|
-
console.log('📊 Socket ID:',
|
|
576
|
-
|
|
630
|
+
console.log('📊 Socket ID:', _this2.socket.id);
|
|
631
|
+
_this2.socket.connected = true;
|
|
577
632
|
});
|
|
578
633
|
this.socket.on('disconnect', function (reason) {
|
|
579
634
|
console.log('❌ WebSocket déconnecté:', reason);
|
|
580
|
-
|
|
635
|
+
_this2.socket.connected = false;
|
|
581
636
|
});
|
|
582
637
|
this.socket.on('connect_error', function (error) {
|
|
583
638
|
console.error('❌ Erreur connexion WebSocket:', error);
|
|
584
|
-
|
|
639
|
+
_this2.socket.connected = false;
|
|
585
640
|
});
|
|
586
641
|
|
|
587
642
|
// Écouter les événements spécifiques
|
|
588
643
|
this.socket.on('qr_status_update', function (data) {
|
|
589
644
|
console.log('📱 Mise à jour statut QR reçue:', data);
|
|
590
|
-
|
|
645
|
+
_this2.handleQRStatusUpdate(data);
|
|
591
646
|
});
|
|
592
647
|
this.socket.on('qr_scan_success', function (data) {
|
|
593
648
|
console.log('✅ Scan QR réussi reçu:', data);
|
|
594
|
-
|
|
649
|
+
_this2.handleQRScanSuccess(data);
|
|
595
650
|
});
|
|
596
651
|
this.socket.on('qr_expired', function (data) {
|
|
597
652
|
console.log('⏰ QR expiré reçu:', data);
|
|
598
|
-
|
|
653
|
+
_this2.handleQRExpired(data);
|
|
599
654
|
});
|
|
600
655
|
|
|
601
656
|
// Écouter l'événement qr_scan_initiated spécifiquement
|
|
602
657
|
this.socket.on('qr_scan_initiated', function (data) {
|
|
603
658
|
console.log('🔍 QR Scan Initiated reçu:', data);
|
|
604
|
-
|
|
659
|
+
_this2.showQRLoader();
|
|
605
660
|
});
|
|
606
661
|
|
|
607
662
|
// Écouter l'événement message générique (fallback)
|
|
@@ -609,7 +664,7 @@
|
|
|
609
664
|
console.log('📨 Message socket reçu:', data);
|
|
610
665
|
if (data && data.type === 'qr_scan_initiated') {
|
|
611
666
|
console.log('🔍 QR Scan Initiated détecté dans message:', data);
|
|
612
|
-
|
|
667
|
+
_this2.showQRLoader();
|
|
613
668
|
}
|
|
614
669
|
});
|
|
615
670
|
|
|
@@ -853,7 +908,7 @@
|
|
|
853
908
|
}, {
|
|
854
909
|
key: "generateQR",
|
|
855
910
|
value: (function () {
|
|
856
|
-
var _generateQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
911
|
+
var _generateQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
857
912
|
var containerId,
|
|
858
913
|
options,
|
|
859
914
|
connectionStatus,
|
|
@@ -863,25 +918,25 @@
|
|
|
863
918
|
response,
|
|
864
919
|
qrImageUrl,
|
|
865
920
|
isLocal,
|
|
866
|
-
|
|
921
|
+
_args4 = arguments,
|
|
867
922
|
_t3,
|
|
868
923
|
_t4;
|
|
869
|
-
return _regenerator().w(function (
|
|
870
|
-
while (1) switch (
|
|
924
|
+
return _regenerator().w(function (_context4) {
|
|
925
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
871
926
|
case 0:
|
|
872
|
-
containerId =
|
|
873
|
-
options =
|
|
927
|
+
containerId = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : 'sunuid-qr-container';
|
|
928
|
+
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
874
929
|
if (!this.initPromise) {
|
|
875
|
-
|
|
930
|
+
_context4.n = 2;
|
|
876
931
|
break;
|
|
877
932
|
}
|
|
878
|
-
|
|
933
|
+
_context4.n = 1;
|
|
879
934
|
return this.initPromise;
|
|
880
935
|
case 1:
|
|
881
936
|
this.initPromise = null;
|
|
882
937
|
case 2:
|
|
883
938
|
if (this.isInitialized) {
|
|
884
|
-
|
|
939
|
+
_context4.n = 3;
|
|
885
940
|
break;
|
|
886
941
|
}
|
|
887
942
|
throw new Error('SunuID: SDK non initialisé');
|
|
@@ -890,22 +945,22 @@
|
|
|
890
945
|
|
|
891
946
|
// Attendre que les connexions soient prêtes
|
|
892
947
|
console.log('🔍 Attente connexions API et WebSocket...');
|
|
893
|
-
|
|
894
|
-
|
|
948
|
+
_context4.p = 4;
|
|
949
|
+
_context4.n = 5;
|
|
895
950
|
return this.waitForConnections(5000);
|
|
896
951
|
case 5:
|
|
897
|
-
connectionStatus =
|
|
952
|
+
connectionStatus = _context4.v;
|
|
898
953
|
// 5 secondes max
|
|
899
954
|
console.log('✅ Connexions prêtes:', connectionStatus);
|
|
900
|
-
|
|
955
|
+
_context4.n = 7;
|
|
901
956
|
break;
|
|
902
957
|
case 6:
|
|
903
|
-
|
|
904
|
-
_t3 =
|
|
958
|
+
_context4.p = 6;
|
|
959
|
+
_t3 = _context4.v;
|
|
905
960
|
console.error('❌ Erreur connexions:', _t3.message);
|
|
906
961
|
throw new Error('Connexions non disponibles - Impossible de générer le QR code');
|
|
907
962
|
case 7:
|
|
908
|
-
|
|
963
|
+
_context4.p = 7;
|
|
909
964
|
// Utiliser uniquement le socketID comme contenu du QR
|
|
910
965
|
socketId = this.socket ? this.socket.id : 'timeout-socket-id';
|
|
911
966
|
qrContent = socketId;
|
|
@@ -914,7 +969,7 @@
|
|
|
914
969
|
|
|
915
970
|
// Générer le QR avec le contenu complet
|
|
916
971
|
partnerName = this.config.partnerName || 'Partner_unknown';
|
|
917
|
-
|
|
972
|
+
_context4.n = 8;
|
|
918
973
|
return this.makeRequest('/qr-generate', _objectSpread2({
|
|
919
974
|
type: this.config.type,
|
|
920
975
|
data: qrContent,
|
|
@@ -922,9 +977,9 @@
|
|
|
922
977
|
label: "".concat(this.getTypeName(this.config.type), " ").concat(partnerName)
|
|
923
978
|
}, options));
|
|
924
979
|
case 8:
|
|
925
|
-
response =
|
|
980
|
+
response = _context4.v;
|
|
926
981
|
if (!response.success) {
|
|
927
|
-
|
|
982
|
+
_context4.n = 11;
|
|
928
983
|
break;
|
|
929
984
|
}
|
|
930
985
|
// Debug: Afficher la structure complète de la réponse
|
|
@@ -939,7 +994,7 @@
|
|
|
939
994
|
|
|
940
995
|
// Vérifier si l'URL du QR code existe
|
|
941
996
|
if (qrImageUrl) {
|
|
942
|
-
|
|
997
|
+
_context4.n = 10;
|
|
943
998
|
break;
|
|
944
999
|
}
|
|
945
1000
|
console.warn('⚠️ qrCodeUrl non trouvé dans la réponse, recherche d\'alternatives...');
|
|
@@ -947,11 +1002,11 @@
|
|
|
947
1002
|
// Essayer d'autres champs possibles
|
|
948
1003
|
qrImageUrl = response.data.qr_url || response.data.qrUrl || response.data.url || response.data.image_url || response.data.imageUrl;
|
|
949
1004
|
if (!qrImageUrl) {
|
|
950
|
-
|
|
1005
|
+
_context4.n = 9;
|
|
951
1006
|
break;
|
|
952
1007
|
}
|
|
953
1008
|
console.log('✅ URL QR trouvée dans un champ alternatif:', qrImageUrl);
|
|
954
|
-
|
|
1009
|
+
_context4.n = 10;
|
|
955
1010
|
break;
|
|
956
1011
|
case 9:
|
|
957
1012
|
console.error('❌ Aucune URL QR trouvée dans la réponse');
|
|
@@ -977,7 +1032,7 @@
|
|
|
977
1032
|
sessionId: response.data.sessionId,
|
|
978
1033
|
timestamp: Date.now()
|
|
979
1034
|
});
|
|
980
|
-
return
|
|
1035
|
+
return _context4.a(2, _objectSpread2(_objectSpread2({}, response.data), {}, {
|
|
981
1036
|
qrCodeUrl: qrImageUrl,
|
|
982
1037
|
qrContent: qrContent,
|
|
983
1038
|
label: response.data.label,
|
|
@@ -986,11 +1041,11 @@
|
|
|
986
1041
|
case 11:
|
|
987
1042
|
throw new Error(response.message || 'Erreur lors de la génération du QR code');
|
|
988
1043
|
case 12:
|
|
989
|
-
|
|
1044
|
+
_context4.n = 14;
|
|
990
1045
|
break;
|
|
991
1046
|
case 13:
|
|
992
|
-
|
|
993
|
-
_t4 =
|
|
1047
|
+
_context4.p = 13;
|
|
1048
|
+
_t4 = _context4.v;
|
|
994
1049
|
console.error('Erreur API détectée:', _t4.message);
|
|
995
1050
|
console.error('Stack trace complet:', _t4.stack);
|
|
996
1051
|
console.error('Configuration SDK:', {
|
|
@@ -1022,9 +1077,9 @@
|
|
|
1022
1077
|
this.displayServiceUnavailable(containerId, this.config.type);
|
|
1023
1078
|
throw new Error('Service non disponible');
|
|
1024
1079
|
case 14:
|
|
1025
|
-
return
|
|
1080
|
+
return _context4.a(2);
|
|
1026
1081
|
}
|
|
1027
|
-
},
|
|
1082
|
+
}, _callee4, this, [[7, 13], [4, 6]]);
|
|
1028
1083
|
}));
|
|
1029
1084
|
function generateQR() {
|
|
1030
1085
|
return _generateQR.apply(this, arguments);
|
|
@@ -1038,41 +1093,41 @@
|
|
|
1038
1093
|
}, {
|
|
1039
1094
|
key: "generateCustomQR",
|
|
1040
1095
|
value: (function () {
|
|
1041
|
-
var _generateCustomQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1096
|
+
var _generateCustomQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(containerId, type) {
|
|
1042
1097
|
var options,
|
|
1043
1098
|
response,
|
|
1044
1099
|
imageBaseUrl,
|
|
1045
1100
|
qrImageUrl,
|
|
1046
|
-
|
|
1101
|
+
_args5 = arguments,
|
|
1047
1102
|
_t5;
|
|
1048
|
-
return _regenerator().w(function (
|
|
1049
|
-
while (1) switch (
|
|
1103
|
+
return _regenerator().w(function (_context5) {
|
|
1104
|
+
while (1) switch (_context5.p = _context5.n) {
|
|
1050
1105
|
case 0:
|
|
1051
|
-
options =
|
|
1106
|
+
options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
|
|
1052
1107
|
if (!this.initPromise) {
|
|
1053
|
-
|
|
1108
|
+
_context5.n = 2;
|
|
1054
1109
|
break;
|
|
1055
1110
|
}
|
|
1056
|
-
|
|
1111
|
+
_context5.n = 1;
|
|
1057
1112
|
return this.initPromise;
|
|
1058
1113
|
case 1:
|
|
1059
1114
|
this.initPromise = null;
|
|
1060
1115
|
case 2:
|
|
1061
1116
|
if (this.isInitialized) {
|
|
1062
|
-
|
|
1117
|
+
_context5.n = 3;
|
|
1063
1118
|
break;
|
|
1064
1119
|
}
|
|
1065
1120
|
throw new Error('SunuID: SDK non initialisé');
|
|
1066
1121
|
case 3:
|
|
1067
|
-
|
|
1068
|
-
|
|
1122
|
+
_context5.p = 3;
|
|
1123
|
+
_context5.n = 4;
|
|
1069
1124
|
return this.makeRequest('/qr-generate', _objectSpread2({
|
|
1070
1125
|
type: type
|
|
1071
1126
|
}, options));
|
|
1072
1127
|
case 4:
|
|
1073
|
-
response =
|
|
1128
|
+
response = _context5.v;
|
|
1074
1129
|
if (!response.success) {
|
|
1075
|
-
|
|
1130
|
+
_context5.n = 5;
|
|
1076
1131
|
break;
|
|
1077
1132
|
}
|
|
1078
1133
|
// Construire l'URL complète de l'image QR avec la base URL pour les images
|
|
@@ -1085,18 +1140,18 @@
|
|
|
1085
1140
|
console.log('📄 Code de session:', response.data.code);
|
|
1086
1141
|
console.log('🆔 Service ID:', response.data.service_id);
|
|
1087
1142
|
this.startAutoRefresh(containerId, type, options);
|
|
1088
|
-
return
|
|
1143
|
+
return _context5.a(2, _objectSpread2(_objectSpread2({}, response.data), {}, {
|
|
1089
1144
|
qrCodeUrl: qrImageUrl,
|
|
1090
1145
|
sessionId: response.data.service_id
|
|
1091
1146
|
}));
|
|
1092
1147
|
case 5:
|
|
1093
1148
|
throw new Error(response.message || 'Erreur lors de la génération du QR code');
|
|
1094
1149
|
case 6:
|
|
1095
|
-
|
|
1150
|
+
_context5.n = 8;
|
|
1096
1151
|
break;
|
|
1097
1152
|
case 7:
|
|
1098
|
-
|
|
1099
|
-
_t5 =
|
|
1153
|
+
_context5.p = 7;
|
|
1154
|
+
_t5 = _context5.v;
|
|
1100
1155
|
console.error('Erreur API détectée:', _t5.message);
|
|
1101
1156
|
console.error('Stack trace complet:', _t5.stack);
|
|
1102
1157
|
console.error('Configuration SDK (Custom):', {
|
|
@@ -1110,9 +1165,9 @@
|
|
|
1110
1165
|
this.displayServiceUnavailable(containerId, type);
|
|
1111
1166
|
throw new Error('Service non disponible');
|
|
1112
1167
|
case 8:
|
|
1113
|
-
return
|
|
1168
|
+
return _context5.a(2);
|
|
1114
1169
|
}
|
|
1115
|
-
},
|
|
1170
|
+
}, _callee5, this, [[3, 7]]);
|
|
1116
1171
|
}));
|
|
1117
1172
|
function generateCustomQR(_x, _x2) {
|
|
1118
1173
|
return _generateCustomQR.apply(this, arguments);
|
|
@@ -1123,16 +1178,16 @@
|
|
|
1123
1178
|
}, {
|
|
1124
1179
|
key: "generateAuthQR",
|
|
1125
1180
|
value: function () {
|
|
1126
|
-
var _generateAuthQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1181
|
+
var _generateAuthQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(containerId) {
|
|
1127
1182
|
var options,
|
|
1128
|
-
|
|
1129
|
-
return _regenerator().w(function (
|
|
1130
|
-
while (1) switch (
|
|
1183
|
+
_args6 = arguments;
|
|
1184
|
+
return _regenerator().w(function (_context6) {
|
|
1185
|
+
while (1) switch (_context6.n) {
|
|
1131
1186
|
case 0:
|
|
1132
|
-
options =
|
|
1133
|
-
return
|
|
1187
|
+
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
1188
|
+
return _context6.a(2, this.generateQR(containerId, options));
|
|
1134
1189
|
}
|
|
1135
|
-
},
|
|
1190
|
+
}, _callee6, this);
|
|
1136
1191
|
}));
|
|
1137
1192
|
function generateAuthQR(_x3) {
|
|
1138
1193
|
return _generateAuthQR.apply(this, arguments);
|
|
@@ -1142,31 +1197,31 @@
|
|
|
1142
1197
|
}, {
|
|
1143
1198
|
key: "generateKYCQR",
|
|
1144
1199
|
value: function () {
|
|
1145
|
-
var _generateKYCQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1200
|
+
var _generateKYCQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(containerId) {
|
|
1146
1201
|
var options,
|
|
1147
1202
|
originalType,
|
|
1148
|
-
|
|
1149
|
-
return _regenerator().w(function (
|
|
1150
|
-
while (1) switch (
|
|
1203
|
+
_args7 = arguments;
|
|
1204
|
+
return _regenerator().w(function (_context7) {
|
|
1205
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
1151
1206
|
case 0:
|
|
1152
|
-
options =
|
|
1207
|
+
options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
1153
1208
|
// Sauvegarder le type actuel
|
|
1154
1209
|
originalType = this.config.type; // Changer temporairement le type pour KYC
|
|
1155
1210
|
this.config.type = 1;
|
|
1156
|
-
|
|
1157
|
-
|
|
1211
|
+
_context7.p = 1;
|
|
1212
|
+
_context7.n = 2;
|
|
1158
1213
|
return this.generateQR(containerId, options);
|
|
1159
1214
|
case 2:
|
|
1160
|
-
return
|
|
1215
|
+
return _context7.a(2, _context7.v);
|
|
1161
1216
|
case 3:
|
|
1162
|
-
|
|
1217
|
+
_context7.p = 3;
|
|
1163
1218
|
// Restaurer le type original
|
|
1164
1219
|
this.config.type = originalType;
|
|
1165
|
-
return
|
|
1220
|
+
return _context7.f(3);
|
|
1166
1221
|
case 4:
|
|
1167
|
-
return
|
|
1222
|
+
return _context7.a(2);
|
|
1168
1223
|
}
|
|
1169
|
-
},
|
|
1224
|
+
}, _callee7, this, [[1,, 3, 4]]);
|
|
1170
1225
|
}));
|
|
1171
1226
|
function generateKYCQR(_x4) {
|
|
1172
1227
|
return _generateKYCQR.apply(this, arguments);
|
|
@@ -1176,31 +1231,31 @@
|
|
|
1176
1231
|
}, {
|
|
1177
1232
|
key: "generateSignatureQR",
|
|
1178
1233
|
value: function () {
|
|
1179
|
-
var _generateSignatureQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1234
|
+
var _generateSignatureQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(containerId) {
|
|
1180
1235
|
var options,
|
|
1181
1236
|
originalType,
|
|
1182
|
-
|
|
1183
|
-
return _regenerator().w(function (
|
|
1184
|
-
while (1) switch (
|
|
1237
|
+
_args8 = arguments;
|
|
1238
|
+
return _regenerator().w(function (_context8) {
|
|
1239
|
+
while (1) switch (_context8.p = _context8.n) {
|
|
1185
1240
|
case 0:
|
|
1186
|
-
options =
|
|
1241
|
+
options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
|
|
1187
1242
|
// Sauvegarder le type actuel
|
|
1188
1243
|
originalType = this.config.type; // Changer temporairement le type pour Signature
|
|
1189
1244
|
this.config.type = 3;
|
|
1190
|
-
|
|
1191
|
-
|
|
1245
|
+
_context8.p = 1;
|
|
1246
|
+
_context8.n = 2;
|
|
1192
1247
|
return this.generateQR(containerId, options);
|
|
1193
1248
|
case 2:
|
|
1194
|
-
return
|
|
1249
|
+
return _context8.a(2, _context8.v);
|
|
1195
1250
|
case 3:
|
|
1196
|
-
|
|
1251
|
+
_context8.p = 3;
|
|
1197
1252
|
// Restaurer le type original
|
|
1198
1253
|
this.config.type = originalType;
|
|
1199
|
-
return
|
|
1254
|
+
return _context8.f(3);
|
|
1200
1255
|
case 4:
|
|
1201
|
-
return
|
|
1256
|
+
return _context8.a(2);
|
|
1202
1257
|
}
|
|
1203
|
-
},
|
|
1258
|
+
}, _callee8, this, [[1,, 3, 4]]);
|
|
1204
1259
|
}));
|
|
1205
1260
|
function generateSignatureQR(_x5) {
|
|
1206
1261
|
return _generateSignatureQR.apply(this, arguments);
|
|
@@ -1213,43 +1268,43 @@
|
|
|
1213
1268
|
}, {
|
|
1214
1269
|
key: "checkQRStatus",
|
|
1215
1270
|
value: (function () {
|
|
1216
|
-
var _checkQRStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1271
|
+
var _checkQRStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(sessionId) {
|
|
1217
1272
|
var response, _t6;
|
|
1218
|
-
return _regenerator().w(function (
|
|
1219
|
-
while (1) switch (
|
|
1273
|
+
return _regenerator().w(function (_context9) {
|
|
1274
|
+
while (1) switch (_context9.p = _context9.n) {
|
|
1220
1275
|
case 0:
|
|
1221
1276
|
if (this.isInitialized) {
|
|
1222
|
-
|
|
1277
|
+
_context9.n = 1;
|
|
1223
1278
|
break;
|
|
1224
1279
|
}
|
|
1225
1280
|
throw new Error('SunuID: SDK non initialisé');
|
|
1226
1281
|
case 1:
|
|
1227
|
-
|
|
1228
|
-
|
|
1282
|
+
_context9.p = 1;
|
|
1283
|
+
_context9.n = 2;
|
|
1229
1284
|
return this.makeRequest('/qr-status', {
|
|
1230
1285
|
serviceId: sessionId
|
|
1231
1286
|
});
|
|
1232
1287
|
case 2:
|
|
1233
|
-
response =
|
|
1288
|
+
response = _context9.v;
|
|
1234
1289
|
if (!response.success) {
|
|
1235
|
-
|
|
1290
|
+
_context9.n = 3;
|
|
1236
1291
|
break;
|
|
1237
1292
|
}
|
|
1238
|
-
return
|
|
1293
|
+
return _context9.a(2, response.data);
|
|
1239
1294
|
case 3:
|
|
1240
1295
|
throw new Error(response.message || 'Erreur lors de la vérification du statut');
|
|
1241
1296
|
case 4:
|
|
1242
|
-
|
|
1297
|
+
_context9.n = 6;
|
|
1243
1298
|
break;
|
|
1244
1299
|
case 5:
|
|
1245
|
-
|
|
1246
|
-
_t6 =
|
|
1300
|
+
_context9.p = 5;
|
|
1301
|
+
_t6 = _context9.v;
|
|
1247
1302
|
this.handleError(_t6);
|
|
1248
1303
|
throw _t6;
|
|
1249
1304
|
case 6:
|
|
1250
|
-
return
|
|
1305
|
+
return _context9.a(2);
|
|
1251
1306
|
}
|
|
1252
|
-
},
|
|
1307
|
+
}, _callee9, this, [[1, 5]]);
|
|
1253
1308
|
}));
|
|
1254
1309
|
function checkQRStatus(_x6) {
|
|
1255
1310
|
return _checkQRStatus.apply(this, arguments);
|
|
@@ -1263,47 +1318,47 @@
|
|
|
1263
1318
|
}, {
|
|
1264
1319
|
key: "generateQRWithContent",
|
|
1265
1320
|
value: (function () {
|
|
1266
|
-
var _generateQRWithContent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1321
|
+
var _generateQRWithContent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(content, containerId, type) {
|
|
1267
1322
|
var options,
|
|
1268
1323
|
localQRUrl,
|
|
1269
|
-
|
|
1324
|
+
_args0 = arguments,
|
|
1270
1325
|
_t7;
|
|
1271
|
-
return _regenerator().w(function (
|
|
1272
|
-
while (1) switch (
|
|
1326
|
+
return _regenerator().w(function (_context0) {
|
|
1327
|
+
while (1) switch (_context0.p = _context0.n) {
|
|
1273
1328
|
case 0:
|
|
1274
|
-
options =
|
|
1329
|
+
options = _args0.length > 3 && _args0[3] !== undefined ? _args0[3] : {};
|
|
1275
1330
|
console.log('🎨 Génération QR avec contenu:', content);
|
|
1276
|
-
|
|
1331
|
+
_context0.p = 1;
|
|
1277
1332
|
if (!(window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1' || window.location.protocol === 'file:')) {
|
|
1278
|
-
|
|
1333
|
+
_context0.n = 3;
|
|
1279
1334
|
break;
|
|
1280
1335
|
}
|
|
1281
1336
|
console.log('🏠 Utilisation service QR local...');
|
|
1282
|
-
|
|
1337
|
+
_context0.n = 2;
|
|
1283
1338
|
return this.generateQRLocal(content, containerId, type, options);
|
|
1284
1339
|
case 2:
|
|
1285
|
-
localQRUrl =
|
|
1340
|
+
localQRUrl = _context0.v;
|
|
1286
1341
|
if (!localQRUrl) {
|
|
1287
|
-
|
|
1342
|
+
_context0.n = 3;
|
|
1288
1343
|
break;
|
|
1289
1344
|
}
|
|
1290
|
-
return
|
|
1345
|
+
return _context0.a(2, localQRUrl);
|
|
1291
1346
|
case 3:
|
|
1292
1347
|
// Fallback vers le service QR distant
|
|
1293
1348
|
console.log('🌐 Utilisation service QR distant...');
|
|
1294
|
-
|
|
1349
|
+
_context0.n = 4;
|
|
1295
1350
|
return this.generateQRRemote(content, containerId, type, options);
|
|
1296
1351
|
case 4:
|
|
1297
|
-
return
|
|
1352
|
+
return _context0.a(2, _context0.v);
|
|
1298
1353
|
case 5:
|
|
1299
|
-
|
|
1300
|
-
_t7 =
|
|
1354
|
+
_context0.p = 5;
|
|
1355
|
+
_t7 = _context0.v;
|
|
1301
1356
|
console.error('❌ Erreur génération QR:', _t7);
|
|
1302
1357
|
// Fallback vers affichage simple du contenu
|
|
1303
1358
|
this.displayQRContent(containerId, content, type, options);
|
|
1304
|
-
return
|
|
1359
|
+
return _context0.a(2, null);
|
|
1305
1360
|
}
|
|
1306
|
-
},
|
|
1361
|
+
}, _callee0, this, [[1, 5]]);
|
|
1307
1362
|
}));
|
|
1308
1363
|
function generateQRWithContent(_x7, _x8, _x9) {
|
|
1309
1364
|
return _generateQRWithContent.apply(this, arguments);
|
|
@@ -1317,19 +1372,19 @@
|
|
|
1317
1372
|
}, {
|
|
1318
1373
|
key: "generateQRLocal",
|
|
1319
1374
|
value: (function () {
|
|
1320
|
-
var _generateQRLocal = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1375
|
+
var _generateQRLocal = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(content, containerId, type) {
|
|
1321
1376
|
var options,
|
|
1322
1377
|
response,
|
|
1323
1378
|
data,
|
|
1324
1379
|
qrUrl,
|
|
1325
|
-
|
|
1380
|
+
_args1 = arguments,
|
|
1326
1381
|
_t8;
|
|
1327
|
-
return _regenerator().w(function (
|
|
1328
|
-
while (1) switch (
|
|
1382
|
+
return _regenerator().w(function (_context1) {
|
|
1383
|
+
while (1) switch (_context1.p = _context1.n) {
|
|
1329
1384
|
case 0:
|
|
1330
|
-
options =
|
|
1331
|
-
|
|
1332
|
-
|
|
1385
|
+
options = _args1.length > 3 && _args1[3] !== undefined ? _args1[3] : {};
|
|
1386
|
+
_context1.p = 1;
|
|
1387
|
+
_context1.n = 2;
|
|
1333
1388
|
return fetch('http://localhost:8000/api/generate/text', {
|
|
1334
1389
|
method: 'POST',
|
|
1335
1390
|
headers: {
|
|
@@ -1338,29 +1393,29 @@
|
|
|
1338
1393
|
body: "text=".concat(encodeURIComponent(content), "&size=300")
|
|
1339
1394
|
});
|
|
1340
1395
|
case 2:
|
|
1341
|
-
response =
|
|
1396
|
+
response = _context1.v;
|
|
1342
1397
|
if (!response.ok) {
|
|
1343
|
-
|
|
1398
|
+
_context1.n = 4;
|
|
1344
1399
|
break;
|
|
1345
1400
|
}
|
|
1346
|
-
|
|
1401
|
+
_context1.n = 3;
|
|
1347
1402
|
return response.json();
|
|
1348
1403
|
case 3:
|
|
1349
|
-
data =
|
|
1404
|
+
data = _context1.v;
|
|
1350
1405
|
qrUrl = "data:image/png;base64,".concat(data.qrcode);
|
|
1351
1406
|
this.displayQRCode(containerId, qrUrl, type, options);
|
|
1352
|
-
return
|
|
1407
|
+
return _context1.a(2, qrUrl);
|
|
1353
1408
|
case 4:
|
|
1354
|
-
|
|
1409
|
+
_context1.n = 6;
|
|
1355
1410
|
break;
|
|
1356
1411
|
case 5:
|
|
1357
|
-
|
|
1358
|
-
_t8 =
|
|
1412
|
+
_context1.p = 5;
|
|
1413
|
+
_t8 = _context1.v;
|
|
1359
1414
|
console.log('❌ Service QR local non disponible:', _t8.message);
|
|
1360
1415
|
case 6:
|
|
1361
|
-
return
|
|
1416
|
+
return _context1.a(2, null);
|
|
1362
1417
|
}
|
|
1363
|
-
},
|
|
1418
|
+
}, _callee1, this, [[1, 5]]);
|
|
1364
1419
|
}));
|
|
1365
1420
|
function generateQRLocal(_x0, _x1, _x10) {
|
|
1366
1421
|
return _generateQRLocal.apply(this, arguments);
|
|
@@ -1374,19 +1429,19 @@
|
|
|
1374
1429
|
}, {
|
|
1375
1430
|
key: "generateQRRemote",
|
|
1376
1431
|
value: (function () {
|
|
1377
|
-
var _generateQRRemote = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1432
|
+
var _generateQRRemote = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(content, containerId, type) {
|
|
1378
1433
|
var options,
|
|
1379
1434
|
response,
|
|
1380
1435
|
data,
|
|
1381
1436
|
qrUrl,
|
|
1382
|
-
|
|
1437
|
+
_args10 = arguments,
|
|
1383
1438
|
_t9;
|
|
1384
|
-
return _regenerator().w(function (
|
|
1385
|
-
while (1) switch (
|
|
1439
|
+
return _regenerator().w(function (_context10) {
|
|
1440
|
+
while (1) switch (_context10.p = _context10.n) {
|
|
1386
1441
|
case 0:
|
|
1387
|
-
options =
|
|
1388
|
-
|
|
1389
|
-
|
|
1442
|
+
options = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : {};
|
|
1443
|
+
_context10.p = 1;
|
|
1444
|
+
_context10.n = 2;
|
|
1390
1445
|
return fetch('https://api.sunuid.fayma.sn/qr-generate', {
|
|
1391
1446
|
method: 'POST',
|
|
1392
1447
|
headers: {
|
|
@@ -1399,31 +1454,31 @@
|
|
|
1399
1454
|
})
|
|
1400
1455
|
});
|
|
1401
1456
|
case 2:
|
|
1402
|
-
response =
|
|
1457
|
+
response = _context10.v;
|
|
1403
1458
|
if (!response.ok) {
|
|
1404
|
-
|
|
1459
|
+
_context10.n = 4;
|
|
1405
1460
|
break;
|
|
1406
1461
|
}
|
|
1407
|
-
|
|
1462
|
+
_context10.n = 3;
|
|
1408
1463
|
return response.json();
|
|
1409
1464
|
case 3:
|
|
1410
|
-
data =
|
|
1465
|
+
data = _context10.v;
|
|
1411
1466
|
qrUrl = "data:image/png;base64,".concat(data.qrcode);
|
|
1412
1467
|
this.displayQRCode(containerId, qrUrl, type, options);
|
|
1413
|
-
return
|
|
1468
|
+
return _context10.a(2, qrUrl);
|
|
1414
1469
|
case 4:
|
|
1415
|
-
|
|
1470
|
+
_context10.n = 6;
|
|
1416
1471
|
break;
|
|
1417
1472
|
case 5:
|
|
1418
|
-
|
|
1419
|
-
_t9 =
|
|
1473
|
+
_context10.p = 5;
|
|
1474
|
+
_t9 = _context10.v;
|
|
1420
1475
|
console.error('❌ Erreur service QR distant:', _t9);
|
|
1421
1476
|
case 6:
|
|
1422
1477
|
// Fallback vers affichage du contenu
|
|
1423
1478
|
this.displayQRContent(containerId, content, type, options);
|
|
1424
|
-
return
|
|
1479
|
+
return _context10.a(2, null);
|
|
1425
1480
|
}
|
|
1426
|
-
},
|
|
1481
|
+
}, _callee10, this, [[1, 5]]);
|
|
1427
1482
|
}));
|
|
1428
1483
|
function generateQRRemote(_x11, _x12, _x13) {
|
|
1429
1484
|
return _generateQRRemote.apply(this, arguments);
|
|
@@ -1481,11 +1536,11 @@
|
|
|
1481
1536
|
}, {
|
|
1482
1537
|
key: "generateCustomQRCode",
|
|
1483
1538
|
value: (function () {
|
|
1484
|
-
var _generateCustomQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1539
|
+
var _generateCustomQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(content, label) {
|
|
1485
1540
|
var qrContainer,
|
|
1486
1541
|
_t0;
|
|
1487
|
-
return _regenerator().w(function (
|
|
1488
|
-
while (1) switch (
|
|
1542
|
+
return _regenerator().w(function (_context11) {
|
|
1543
|
+
while (1) switch (_context11.p = _context11.n) {
|
|
1489
1544
|
case 0:
|
|
1490
1545
|
console.log('🎨 Début génération QR personnalisé...');
|
|
1491
1546
|
console.log('📄 Contenu:', content);
|
|
@@ -1497,37 +1552,37 @@
|
|
|
1497
1552
|
qrContainer = document.getElementById('qr-container');
|
|
1498
1553
|
}
|
|
1499
1554
|
if (qrContainer) {
|
|
1500
|
-
|
|
1555
|
+
_context11.n = 1;
|
|
1501
1556
|
break;
|
|
1502
1557
|
}
|
|
1503
1558
|
console.error('❌ QR container not found');
|
|
1504
|
-
return
|
|
1559
|
+
return _context11.a(2);
|
|
1505
1560
|
case 1:
|
|
1506
1561
|
console.log('✅ QR container trouvé');
|
|
1507
1562
|
|
|
1508
1563
|
// Nettoyer le conteneur
|
|
1509
1564
|
qrContainer.innerHTML = '<div style="text-align: center; padding: 20px;"><p>Génération QR code...</p></div>';
|
|
1510
|
-
|
|
1565
|
+
_context11.p = 2;
|
|
1511
1566
|
// Utiliser directement l'API principale (plus fiable)
|
|
1512
1567
|
console.log('🎨 Tentative génération via API principale...');
|
|
1513
|
-
|
|
1568
|
+
_context11.n = 3;
|
|
1514
1569
|
return this.generateQRPHP(content, label, qrContainer);
|
|
1515
1570
|
case 3:
|
|
1516
1571
|
console.log('✅ QR code généré avec succès');
|
|
1517
|
-
|
|
1572
|
+
_context11.n = 5;
|
|
1518
1573
|
break;
|
|
1519
1574
|
case 4:
|
|
1520
|
-
|
|
1521
|
-
_t0 =
|
|
1575
|
+
_context11.p = 4;
|
|
1576
|
+
_t0 = _context11.v;
|
|
1522
1577
|
console.error('❌ Erreur génération API:', _t0);
|
|
1523
1578
|
|
|
1524
1579
|
// Fallback final : image par défaut
|
|
1525
1580
|
console.log('⚠️ Affichage image par défaut');
|
|
1526
1581
|
this.displayDefaultQR(qrContainer, content, label);
|
|
1527
1582
|
case 5:
|
|
1528
|
-
return
|
|
1583
|
+
return _context11.a(2);
|
|
1529
1584
|
}
|
|
1530
|
-
},
|
|
1585
|
+
}, _callee11, this, [[2, 4]]);
|
|
1531
1586
|
}));
|
|
1532
1587
|
function generateCustomQRCode(_x14, _x15) {
|
|
1533
1588
|
return _generateCustomQRCode.apply(this, arguments);
|
|
@@ -1541,17 +1596,17 @@
|
|
|
1541
1596
|
}, {
|
|
1542
1597
|
key: "generateQRClientSide",
|
|
1543
1598
|
value: (function () {
|
|
1544
|
-
var _generateQRClientSide = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1545
|
-
var
|
|
1599
|
+
var _generateQRClientSide = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(content, label, qrContainer) {
|
|
1600
|
+
var _this3 = this;
|
|
1546
1601
|
var canvas, ctx;
|
|
1547
|
-
return _regenerator().w(function (
|
|
1548
|
-
while (1) switch (
|
|
1602
|
+
return _regenerator().w(function (_context12) {
|
|
1603
|
+
while (1) switch (_context12.n) {
|
|
1549
1604
|
case 0:
|
|
1550
|
-
|
|
1605
|
+
_context12.n = 1;
|
|
1551
1606
|
return this.ensureQRCodeLibrary();
|
|
1552
1607
|
case 1:
|
|
1553
1608
|
if (!(typeof QRCode === 'undefined')) {
|
|
1554
|
-
|
|
1609
|
+
_context12.n = 2;
|
|
1555
1610
|
break;
|
|
1556
1611
|
}
|
|
1557
1612
|
throw new Error('QRCode library non disponible');
|
|
@@ -1565,7 +1620,7 @@
|
|
|
1565
1620
|
ctx.fillRect(0, 0, 300, 320);
|
|
1566
1621
|
|
|
1567
1622
|
// Générer le QR code
|
|
1568
|
-
return
|
|
1623
|
+
return _context12.a(2, new Promise(function (resolve, reject) {
|
|
1569
1624
|
QRCode.toCanvas(canvas, content, {
|
|
1570
1625
|
width: 280,
|
|
1571
1626
|
margin: 10,
|
|
@@ -1589,18 +1644,18 @@
|
|
|
1589
1644
|
var dataUrl = canvas.toDataURL('image/png');
|
|
1590
1645
|
|
|
1591
1646
|
// Stocker l'URL
|
|
1592
|
-
|
|
1647
|
+
_this3.currentQRUrl = dataUrl;
|
|
1593
1648
|
|
|
1594
1649
|
// Afficher le QR code
|
|
1595
1650
|
qrContainer.innerHTML = "\n <div style=\"text-align: center; padding: 20px;\">\n <img src=\"".concat(dataUrl, "\" alt=\"QR Code\" style=\"max-width: 300px; border: 2px solid #ddd; border-radius: 10px;\">\n </div>\n ");
|
|
1596
1651
|
|
|
1597
1652
|
// Afficher les instructions
|
|
1598
|
-
|
|
1653
|
+
_this3.showQRInstructions(qrContainer);
|
|
1599
1654
|
resolve();
|
|
1600
1655
|
});
|
|
1601
1656
|
}));
|
|
1602
1657
|
}
|
|
1603
|
-
},
|
|
1658
|
+
}, _callee12, this);
|
|
1604
1659
|
}));
|
|
1605
1660
|
function generateQRClientSide(_x16, _x17, _x18) {
|
|
1606
1661
|
return _generateQRClientSide.apply(this, arguments);
|
|
@@ -1614,10 +1669,10 @@
|
|
|
1614
1669
|
}, {
|
|
1615
1670
|
key: "generateQRPHP",
|
|
1616
1671
|
value: (function () {
|
|
1617
|
-
var _generateQRPHP = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1672
|
+
var _generateQRPHP = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(content, label, qrContainer) {
|
|
1618
1673
|
var qrGeneratorUrl, requestBody, contentType, response, responseData, qrImageUrl, imageBaseUrl;
|
|
1619
|
-
return _regenerator().w(function (
|
|
1620
|
-
while (1) switch (
|
|
1674
|
+
return _regenerator().w(function (_context13) {
|
|
1675
|
+
while (1) switch (_context13.n) {
|
|
1621
1676
|
case 0:
|
|
1622
1677
|
// Construire l'URL - Utiliser l'API principale qui fonctionne
|
|
1623
1678
|
|
|
@@ -1655,7 +1710,7 @@
|
|
|
1655
1710
|
label: label
|
|
1656
1711
|
});
|
|
1657
1712
|
}
|
|
1658
|
-
|
|
1713
|
+
_context13.n = 1;
|
|
1659
1714
|
return fetch(qrGeneratorUrl, {
|
|
1660
1715
|
method: 'POST',
|
|
1661
1716
|
headers: {
|
|
@@ -1665,19 +1720,19 @@
|
|
|
1665
1720
|
body: requestBody
|
|
1666
1721
|
});
|
|
1667
1722
|
case 1:
|
|
1668
|
-
response =
|
|
1723
|
+
response = _context13.v;
|
|
1669
1724
|
if (response.ok) {
|
|
1670
|
-
|
|
1725
|
+
_context13.n = 2;
|
|
1671
1726
|
break;
|
|
1672
1727
|
}
|
|
1673
1728
|
throw new Error("Erreur HTTP: ".concat(response.status));
|
|
1674
1729
|
case 2:
|
|
1675
|
-
|
|
1730
|
+
_context13.n = 3;
|
|
1676
1731
|
return response.json();
|
|
1677
1732
|
case 3:
|
|
1678
|
-
responseData =
|
|
1733
|
+
responseData = _context13.v;
|
|
1679
1734
|
if (responseData.success) {
|
|
1680
|
-
|
|
1735
|
+
_context13.n = 4;
|
|
1681
1736
|
break;
|
|
1682
1737
|
}
|
|
1683
1738
|
throw new Error("Erreur QR: ".concat(responseData.error));
|
|
@@ -1700,9 +1755,9 @@
|
|
|
1700
1755
|
// Afficher les instructions
|
|
1701
1756
|
this.showQRInstructions(qrContainer);
|
|
1702
1757
|
case 5:
|
|
1703
|
-
return
|
|
1758
|
+
return _context13.a(2);
|
|
1704
1759
|
}
|
|
1705
|
-
},
|
|
1760
|
+
}, _callee13, this);
|
|
1706
1761
|
}));
|
|
1707
1762
|
function generateQRPHP(_x19, _x20, _x21) {
|
|
1708
1763
|
return _generateQRPHP.apply(this, arguments);
|
|
@@ -1725,19 +1780,19 @@
|
|
|
1725
1780
|
}, {
|
|
1726
1781
|
key: "ensureQRCodeLibrary",
|
|
1727
1782
|
value: (function () {
|
|
1728
|
-
var _ensureQRCodeLibrary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1729
|
-
return _regenerator().w(function (
|
|
1730
|
-
while (1) switch (
|
|
1783
|
+
var _ensureQRCodeLibrary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
1784
|
+
return _regenerator().w(function (_context14) {
|
|
1785
|
+
while (1) switch (_context14.n) {
|
|
1731
1786
|
case 0:
|
|
1732
1787
|
if (!(typeof QRCode !== 'undefined')) {
|
|
1733
|
-
|
|
1788
|
+
_context14.n = 1;
|
|
1734
1789
|
break;
|
|
1735
1790
|
}
|
|
1736
1791
|
console.log('✅ QRCode library déjà disponible');
|
|
1737
|
-
return
|
|
1792
|
+
return _context14.a(2, true);
|
|
1738
1793
|
case 1:
|
|
1739
1794
|
console.log('📦 Chargement QRCode library...');
|
|
1740
|
-
return
|
|
1795
|
+
return _context14.a(2, new Promise(function (resolve, reject) {
|
|
1741
1796
|
var script = document.createElement('script');
|
|
1742
1797
|
script.src = 'https://cdn.jsdelivr.net/npm/qrcode@1.5.3/lib/browser.min.js';
|
|
1743
1798
|
script.onload = function () {
|
|
@@ -1758,7 +1813,7 @@
|
|
|
1758
1813
|
document.head.appendChild(script);
|
|
1759
1814
|
}));
|
|
1760
1815
|
}
|
|
1761
|
-
},
|
|
1816
|
+
}, _callee14);
|
|
1762
1817
|
}));
|
|
1763
1818
|
function ensureQRCodeLibrary() {
|
|
1764
1819
|
return _ensureQRCodeLibrary.apply(this, arguments);
|
|
@@ -1845,19 +1900,19 @@
|
|
|
1845
1900
|
}, {
|
|
1846
1901
|
key: "refreshQR",
|
|
1847
1902
|
value: (function () {
|
|
1848
|
-
var _refreshQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1903
|
+
var _refreshQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(containerId) {
|
|
1849
1904
|
var options,
|
|
1850
1905
|
result,
|
|
1851
1906
|
_result,
|
|
1852
|
-
|
|
1907
|
+
_args15 = arguments,
|
|
1853
1908
|
_t1;
|
|
1854
|
-
return _regenerator().w(function (
|
|
1855
|
-
while (1) switch (
|
|
1909
|
+
return _regenerator().w(function (_context15) {
|
|
1910
|
+
while (1) switch (_context15.p = _context15.n) {
|
|
1856
1911
|
case 0:
|
|
1857
|
-
options =
|
|
1858
|
-
|
|
1912
|
+
options = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : {};
|
|
1913
|
+
_context15.p = 1;
|
|
1859
1914
|
if (!this.currentQRUrl) {
|
|
1860
|
-
|
|
1915
|
+
_context15.n = 3;
|
|
1861
1916
|
break;
|
|
1862
1917
|
}
|
|
1863
1918
|
console.log('🔄 Vérification du statut du QR code existant...');
|
|
@@ -1867,31 +1922,31 @@
|
|
|
1867
1922
|
|
|
1868
1923
|
// Option 2: Régénérer le QR code seulement si nécessaire
|
|
1869
1924
|
// Pour l'instant, on régénère pour s'assurer qu'il est à jour
|
|
1870
|
-
|
|
1925
|
+
_context15.n = 2;
|
|
1871
1926
|
return this.generateQR(containerId, options);
|
|
1872
1927
|
case 2:
|
|
1873
|
-
result =
|
|
1874
|
-
return
|
|
1928
|
+
result = _context15.v;
|
|
1929
|
+
return _context15.a(2, result);
|
|
1875
1930
|
case 3:
|
|
1876
1931
|
console.log('🔄 Pas de QR code existant, génération d\'un nouveau...');
|
|
1877
|
-
|
|
1932
|
+
_context15.n = 4;
|
|
1878
1933
|
return this.generateQR(containerId, options);
|
|
1879
1934
|
case 4:
|
|
1880
|
-
_result =
|
|
1881
|
-
return
|
|
1935
|
+
_result = _context15.v;
|
|
1936
|
+
return _context15.a(2, _result);
|
|
1882
1937
|
case 5:
|
|
1883
|
-
|
|
1938
|
+
_context15.n = 7;
|
|
1884
1939
|
break;
|
|
1885
1940
|
case 6:
|
|
1886
|
-
|
|
1887
|
-
_t1 =
|
|
1941
|
+
_context15.p = 6;
|
|
1942
|
+
_t1 = _context15.v;
|
|
1888
1943
|
console.error('Erreur lors du rafraîchissement:', _t1.message);
|
|
1889
1944
|
this.displayServiceUnavailable(containerId, this.config.type);
|
|
1890
1945
|
throw _t1;
|
|
1891
1946
|
case 7:
|
|
1892
|
-
return
|
|
1947
|
+
return _context15.a(2);
|
|
1893
1948
|
}
|
|
1894
|
-
},
|
|
1949
|
+
}, _callee15, this, [[1, 6]]);
|
|
1895
1950
|
}));
|
|
1896
1951
|
function refreshQR(_x22) {
|
|
1897
1952
|
return _refreshQR.apply(this, arguments);
|
|
@@ -1905,7 +1960,7 @@
|
|
|
1905
1960
|
}, {
|
|
1906
1961
|
key: "startAutoRefresh",
|
|
1907
1962
|
value: function startAutoRefresh(containerId, type, options) {
|
|
1908
|
-
var
|
|
1963
|
+
var _this4 = this;
|
|
1909
1964
|
if (!this.config.autoRefresh) return;
|
|
1910
1965
|
|
|
1911
1966
|
// Arrêter le timer existant s'il y en a un
|
|
@@ -1913,26 +1968,26 @@
|
|
|
1913
1968
|
clearInterval(this.refreshTimer);
|
|
1914
1969
|
console.log('🔄 Timer de rafraîchissement précédent arrêté');
|
|
1915
1970
|
}
|
|
1916
|
-
this.refreshTimer = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1971
|
+
this.refreshTimer = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
1917
1972
|
var _t10;
|
|
1918
|
-
return _regenerator().w(function (
|
|
1919
|
-
while (1) switch (
|
|
1973
|
+
return _regenerator().w(function (_context16) {
|
|
1974
|
+
while (1) switch (_context16.p = _context16.n) {
|
|
1920
1975
|
case 0:
|
|
1921
|
-
|
|
1976
|
+
_context16.p = 0;
|
|
1922
1977
|
console.log('🔄 Rafraîchissement automatique du QR code...');
|
|
1923
|
-
|
|
1924
|
-
return
|
|
1978
|
+
_context16.n = 1;
|
|
1979
|
+
return _this4.refreshQR(containerId, type, options);
|
|
1925
1980
|
case 1:
|
|
1926
|
-
|
|
1981
|
+
_context16.n = 3;
|
|
1927
1982
|
break;
|
|
1928
1983
|
case 2:
|
|
1929
|
-
|
|
1930
|
-
_t10 =
|
|
1984
|
+
_context16.p = 2;
|
|
1985
|
+
_t10 = _context16.v;
|
|
1931
1986
|
console.warn('Erreur lors du rafraîchissement automatique:', _t10);
|
|
1932
1987
|
case 3:
|
|
1933
|
-
return
|
|
1988
|
+
return _context16.a(2);
|
|
1934
1989
|
}
|
|
1935
|
-
},
|
|
1990
|
+
}, _callee16, null, [[0, 2]]);
|
|
1936
1991
|
})), this.config.refreshInterval);
|
|
1937
1992
|
console.log("\uD83D\uDD04 Timer de rafra\xEEchissement d\xE9marr\xE9 (".concat(this.config.refreshInterval, "ms)"));
|
|
1938
1993
|
}
|
|
@@ -1947,16 +2002,16 @@
|
|
|
1947
2002
|
}, {
|
|
1948
2003
|
key: "makeRequest",
|
|
1949
2004
|
value: (function () {
|
|
1950
|
-
var _makeRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2005
|
+
var _makeRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(endpoint, data) {
|
|
1951
2006
|
var _window$SunuIDConfig4,
|
|
1952
2007
|
_window$SunuIDConfig5,
|
|
1953
|
-
|
|
2008
|
+
_this5 = this;
|
|
1954
2009
|
var sanitizedData, endpointPath, url, retryCount, maxRetries, _loop, _ret;
|
|
1955
|
-
return _regenerator().w(function (
|
|
1956
|
-
while (1) switch (
|
|
2010
|
+
return _regenerator().w(function (_context18) {
|
|
2011
|
+
while (1) switch (_context18.n) {
|
|
1957
2012
|
case 0:
|
|
1958
2013
|
if (this.isInitialized) {
|
|
1959
|
-
|
|
2014
|
+
_context18.n = 1;
|
|
1960
2015
|
break;
|
|
1961
2016
|
}
|
|
1962
2017
|
this.logSecurityEvent('REQUEST_BEFORE_INIT', {
|
|
@@ -1965,12 +2020,12 @@
|
|
|
1965
2020
|
throw new Error('SDK non initialisé');
|
|
1966
2021
|
case 1:
|
|
1967
2022
|
if (!this.config.secureInit) {
|
|
1968
|
-
|
|
2023
|
+
_context18.n = 2;
|
|
1969
2024
|
break;
|
|
1970
2025
|
}
|
|
1971
2026
|
this.config.requestCount++;
|
|
1972
2027
|
if (!(this.config.requestCount > this.config.maxRequests)) {
|
|
1973
|
-
|
|
2028
|
+
_context18.n = 2;
|
|
1974
2029
|
break;
|
|
1975
2030
|
}
|
|
1976
2031
|
this.logSecurityEvent('API_REQUEST_LIMIT_EXCEEDED', {
|
|
@@ -2006,14 +2061,14 @@
|
|
|
2006
2061
|
maxRetries = this.config.maxRetries;
|
|
2007
2062
|
_loop = /*#__PURE__*/_regenerator().m(function _loop() {
|
|
2008
2063
|
var controller, timeoutId, headers, response, errorText, errorData, result, _t11;
|
|
2009
|
-
return _regenerator().w(function (
|
|
2010
|
-
while (1) switch (
|
|
2064
|
+
return _regenerator().w(function (_context17) {
|
|
2065
|
+
while (1) switch (_context17.p = _context17.n) {
|
|
2011
2066
|
case 0:
|
|
2012
|
-
|
|
2067
|
+
_context17.p = 0;
|
|
2013
2068
|
controller = new AbortController();
|
|
2014
2069
|
timeoutId = setTimeout(function () {
|
|
2015
2070
|
return controller.abort();
|
|
2016
|
-
},
|
|
2071
|
+
}, _this5.config.requestTimeout); // Headers minimaux (API SunuID n'accepte que les headers essentiels)
|
|
2017
2072
|
headers = {
|
|
2018
2073
|
'Content-Type': 'application/json'
|
|
2019
2074
|
}; // Note: En mode sécurisé, les credentials sont dans le body
|
|
@@ -2021,7 +2076,7 @@
|
|
|
2021
2076
|
// if (this.config.secureInit && this.config.token) {
|
|
2022
2077
|
// headers['X-Secure-Token'] = this.config.token;
|
|
2023
2078
|
// }
|
|
2024
|
-
|
|
2079
|
+
_context17.n = 1;
|
|
2025
2080
|
return fetch(url, {
|
|
2026
2081
|
method: 'POST',
|
|
2027
2082
|
headers: headers,
|
|
@@ -2029,16 +2084,16 @@
|
|
|
2029
2084
|
signal: controller.signal
|
|
2030
2085
|
});
|
|
2031
2086
|
case 1:
|
|
2032
|
-
response =
|
|
2087
|
+
response = _context17.v;
|
|
2033
2088
|
clearTimeout(timeoutId);
|
|
2034
2089
|
if (response.ok) {
|
|
2035
|
-
|
|
2090
|
+
_context17.n = 3;
|
|
2036
2091
|
break;
|
|
2037
2092
|
}
|
|
2038
|
-
|
|
2093
|
+
_context17.n = 2;
|
|
2039
2094
|
return response.text();
|
|
2040
2095
|
case 2:
|
|
2041
|
-
errorText =
|
|
2096
|
+
errorText = _context17.v;
|
|
2042
2097
|
try {
|
|
2043
2098
|
errorData = JSON.parse(errorText);
|
|
2044
2099
|
} catch (e) {
|
|
@@ -2046,88 +2101,88 @@
|
|
|
2046
2101
|
message: errorText
|
|
2047
2102
|
};
|
|
2048
2103
|
}
|
|
2049
|
-
|
|
2104
|
+
_this5.logSecurityEvent('API_REQUEST_ERROR', {
|
|
2050
2105
|
status: response.status,
|
|
2051
2106
|
statusText: response.statusText,
|
|
2052
2107
|
error: errorData.message
|
|
2053
2108
|
});
|
|
2054
2109
|
throw new Error(errorData.message || "Erreur HTTP: ".concat(response.status));
|
|
2055
2110
|
case 3:
|
|
2056
|
-
|
|
2111
|
+
_context17.n = 4;
|
|
2057
2112
|
return response.json();
|
|
2058
2113
|
case 4:
|
|
2059
|
-
result =
|
|
2060
|
-
|
|
2114
|
+
result = _context17.v;
|
|
2115
|
+
_this5.logSecurityEvent('API_REQUEST_SUCCESS', {
|
|
2061
2116
|
endpoint: endpointPath,
|
|
2062
2117
|
responseKeys: Object.keys(result)
|
|
2063
2118
|
});
|
|
2064
|
-
return
|
|
2119
|
+
return _context17.a(2, {
|
|
2065
2120
|
v: result
|
|
2066
2121
|
});
|
|
2067
2122
|
case 5:
|
|
2068
|
-
|
|
2069
|
-
_t11 =
|
|
2123
|
+
_context17.p = 5;
|
|
2124
|
+
_t11 = _context17.v;
|
|
2070
2125
|
retryCount++;
|
|
2071
2126
|
if (!(_t11.name === 'AbortError')) {
|
|
2072
|
-
|
|
2127
|
+
_context17.n = 7;
|
|
2073
2128
|
break;
|
|
2074
2129
|
}
|
|
2075
|
-
|
|
2130
|
+
_this5.logSecurityEvent('API_REQUEST_TIMEOUT', {
|
|
2076
2131
|
retryCount: retryCount
|
|
2077
2132
|
});
|
|
2078
2133
|
if (!(retryCount > maxRetries)) {
|
|
2079
|
-
|
|
2134
|
+
_context17.n = 6;
|
|
2080
2135
|
break;
|
|
2081
2136
|
}
|
|
2082
2137
|
throw new Error('Timeout de la requête API');
|
|
2083
2138
|
case 6:
|
|
2084
|
-
return
|
|
2139
|
+
return _context17.a(2, 0);
|
|
2085
2140
|
case 7:
|
|
2086
2141
|
if (!(retryCount > maxRetries)) {
|
|
2087
|
-
|
|
2142
|
+
_context17.n = 8;
|
|
2088
2143
|
break;
|
|
2089
2144
|
}
|
|
2090
|
-
|
|
2145
|
+
_this5.logSecurityEvent('API_REQUEST_MAX_RETRIES', {
|
|
2091
2146
|
retryCount: retryCount,
|
|
2092
2147
|
error: _t11.message
|
|
2093
2148
|
});
|
|
2094
2149
|
throw _t11;
|
|
2095
2150
|
case 8:
|
|
2096
|
-
|
|
2151
|
+
_context17.n = 9;
|
|
2097
2152
|
return new Promise(function (resolve) {
|
|
2098
2153
|
return setTimeout(resolve, 1000 * retryCount);
|
|
2099
2154
|
});
|
|
2100
2155
|
case 9:
|
|
2101
|
-
return
|
|
2156
|
+
return _context17.a(2);
|
|
2102
2157
|
}
|
|
2103
2158
|
}, _loop, null, [[0, 5]]);
|
|
2104
2159
|
});
|
|
2105
2160
|
case 3:
|
|
2106
2161
|
if (!(retryCount <= maxRetries)) {
|
|
2107
|
-
|
|
2162
|
+
_context18.n = 7;
|
|
2108
2163
|
break;
|
|
2109
2164
|
}
|
|
2110
|
-
return
|
|
2165
|
+
return _context18.d(_regeneratorValues(_loop()), 4);
|
|
2111
2166
|
case 4:
|
|
2112
|
-
_ret =
|
|
2167
|
+
_ret = _context18.v;
|
|
2113
2168
|
if (!(_ret === 0)) {
|
|
2114
|
-
|
|
2169
|
+
_context18.n = 5;
|
|
2115
2170
|
break;
|
|
2116
2171
|
}
|
|
2117
|
-
return
|
|
2172
|
+
return _context18.a(3, 3);
|
|
2118
2173
|
case 5:
|
|
2119
2174
|
if (!_ret) {
|
|
2120
|
-
|
|
2175
|
+
_context18.n = 6;
|
|
2121
2176
|
break;
|
|
2122
2177
|
}
|
|
2123
|
-
return
|
|
2178
|
+
return _context18.a(2, _ret.v);
|
|
2124
2179
|
case 6:
|
|
2125
|
-
|
|
2180
|
+
_context18.n = 3;
|
|
2126
2181
|
break;
|
|
2127
2182
|
case 7:
|
|
2128
|
-
return
|
|
2183
|
+
return _context18.a(2);
|
|
2129
2184
|
}
|
|
2130
|
-
},
|
|
2185
|
+
}, _callee17, this);
|
|
2131
2186
|
}));
|
|
2132
2187
|
function makeRequest(_x23, _x24) {
|
|
2133
2188
|
return _makeRequest.apply(this, arguments);
|
|
@@ -2198,20 +2253,20 @@
|
|
|
2198
2253
|
}, {
|
|
2199
2254
|
key: "fetchPartnerInfo",
|
|
2200
2255
|
value: (function () {
|
|
2201
|
-
var _fetchPartnerInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2256
|
+
var _fetchPartnerInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
|
|
2202
2257
|
var response, data, partnerId, _t12;
|
|
2203
|
-
return _regenerator().w(function (
|
|
2204
|
-
while (1) switch (
|
|
2258
|
+
return _regenerator().w(function (_context19) {
|
|
2259
|
+
while (1) switch (_context19.p = _context19.n) {
|
|
2205
2260
|
case 0:
|
|
2206
|
-
|
|
2207
|
-
|
|
2261
|
+
_context19.p = 0;
|
|
2262
|
+
_context19.n = 1;
|
|
2208
2263
|
return this.makeRequest('/debug', {
|
|
2209
2264
|
type: this.config.type,
|
|
2210
2265
|
client_id: this.config.clientId,
|
|
2211
2266
|
secret_id: this.config.secretId
|
|
2212
2267
|
});
|
|
2213
2268
|
case 1:
|
|
2214
|
-
response =
|
|
2269
|
+
response = _context19.v;
|
|
2215
2270
|
console.log('📋 Réponse debug API:', response);
|
|
2216
2271
|
|
|
2217
2272
|
// Vérifier la structure de la réponse
|
|
@@ -2255,17 +2310,17 @@
|
|
|
2255
2310
|
console.warn('⚠️ Structure de réponse invalide, utilisation du partner_id par défaut');
|
|
2256
2311
|
this.config.partnerName = "Partner_".concat(this.config.partnerId || 'unknown');
|
|
2257
2312
|
}
|
|
2258
|
-
|
|
2313
|
+
_context19.n = 3;
|
|
2259
2314
|
break;
|
|
2260
2315
|
case 2:
|
|
2261
|
-
|
|
2262
|
-
_t12 =
|
|
2316
|
+
_context19.p = 2;
|
|
2317
|
+
_t12 = _context19.v;
|
|
2263
2318
|
console.warn('⚠️ Erreur lors de la récupération des informations du partenaire:', _t12.message);
|
|
2264
2319
|
this.config.partnerName = 'Partner_unknown';
|
|
2265
2320
|
case 3:
|
|
2266
|
-
return
|
|
2321
|
+
return _context19.a(2);
|
|
2267
2322
|
}
|
|
2268
|
-
},
|
|
2323
|
+
}, _callee18, this, [[0, 2]]);
|
|
2269
2324
|
}));
|
|
2270
2325
|
function fetchPartnerInfo() {
|
|
2271
2326
|
return _fetchPartnerInfo.apply(this, arguments);
|
|
@@ -2303,18 +2358,18 @@
|
|
|
2303
2358
|
}, {
|
|
2304
2359
|
key: "checkConnections",
|
|
2305
2360
|
value: (function () {
|
|
2306
|
-
var _checkConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2361
|
+
var _checkConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
|
|
2307
2362
|
var status, testResponse, debugData, _t13;
|
|
2308
|
-
return _regenerator().w(function (
|
|
2309
|
-
while (1) switch (
|
|
2363
|
+
return _regenerator().w(function (_context20) {
|
|
2364
|
+
while (1) switch (_context20.p = _context20.n) {
|
|
2310
2365
|
case 0:
|
|
2311
2366
|
status = {
|
|
2312
2367
|
api: false,
|
|
2313
2368
|
websocket: false,
|
|
2314
2369
|
ready: false
|
|
2315
2370
|
}; // Vérifier l'API en utilisant l'endpoint debug avec les credentials
|
|
2316
|
-
|
|
2317
|
-
|
|
2371
|
+
_context20.p = 1;
|
|
2372
|
+
_context20.n = 2;
|
|
2318
2373
|
return fetch(this.config.apiUrl + '/debug', {
|
|
2319
2374
|
method: 'POST',
|
|
2320
2375
|
headers: {
|
|
@@ -2327,29 +2382,29 @@
|
|
|
2327
2382
|
})
|
|
2328
2383
|
});
|
|
2329
2384
|
case 2:
|
|
2330
|
-
testResponse =
|
|
2385
|
+
testResponse = _context20.v;
|
|
2331
2386
|
if (!testResponse.ok) {
|
|
2332
|
-
|
|
2387
|
+
_context20.n = 4;
|
|
2333
2388
|
break;
|
|
2334
2389
|
}
|
|
2335
|
-
|
|
2390
|
+
_context20.n = 3;
|
|
2336
2391
|
return testResponse.json();
|
|
2337
2392
|
case 3:
|
|
2338
|
-
debugData =
|
|
2393
|
+
debugData = _context20.v;
|
|
2339
2394
|
// L'API est accessible si on reçoit une réponse avec success: true
|
|
2340
2395
|
status.api = debugData.success === true;
|
|
2341
2396
|
console.log('🔍 API Status:', status.api ? 'accessible' : 'inaccessible');
|
|
2342
|
-
|
|
2397
|
+
_context20.n = 5;
|
|
2343
2398
|
break;
|
|
2344
2399
|
case 4:
|
|
2345
2400
|
status.api = false;
|
|
2346
2401
|
console.log('🔍 API Status: HTTP', testResponse.status);
|
|
2347
2402
|
case 5:
|
|
2348
|
-
|
|
2403
|
+
_context20.n = 7;
|
|
2349
2404
|
break;
|
|
2350
2405
|
case 6:
|
|
2351
|
-
|
|
2352
|
-
_t13 =
|
|
2406
|
+
_context20.p = 6;
|
|
2407
|
+
_t13 = _context20.v;
|
|
2353
2408
|
console.log('🔍 Test API échoué:', _t13.message);
|
|
2354
2409
|
status.api = false;
|
|
2355
2410
|
case 7:
|
|
@@ -2358,9 +2413,9 @@
|
|
|
2358
2413
|
|
|
2359
2414
|
// Connexions prêtes si API est accessible
|
|
2360
2415
|
status.ready = status.api;
|
|
2361
|
-
return
|
|
2416
|
+
return _context20.a(2, status);
|
|
2362
2417
|
}
|
|
2363
|
-
},
|
|
2418
|
+
}, _callee19, this, [[1, 6]]);
|
|
2364
2419
|
}));
|
|
2365
2420
|
function checkConnections() {
|
|
2366
2421
|
return _checkConnections.apply(this, arguments);
|
|
@@ -2374,46 +2429,46 @@
|
|
|
2374
2429
|
}, {
|
|
2375
2430
|
key: "waitForConnections",
|
|
2376
2431
|
value: (function () {
|
|
2377
|
-
var _waitForConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2432
|
+
var _waitForConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
|
|
2378
2433
|
var timeout,
|
|
2379
2434
|
startTime,
|
|
2380
2435
|
status,
|
|
2381
|
-
|
|
2382
|
-
return _regenerator().w(function (
|
|
2383
|
-
while (1) switch (
|
|
2436
|
+
_args21 = arguments;
|
|
2437
|
+
return _regenerator().w(function (_context21) {
|
|
2438
|
+
while (1) switch (_context21.n) {
|
|
2384
2439
|
case 0:
|
|
2385
|
-
timeout =
|
|
2440
|
+
timeout = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : 5000;
|
|
2386
2441
|
startTime = Date.now();
|
|
2387
2442
|
case 1:
|
|
2388
2443
|
if (!(Date.now() - startTime < timeout)) {
|
|
2389
|
-
|
|
2444
|
+
_context21.n = 5;
|
|
2390
2445
|
break;
|
|
2391
2446
|
}
|
|
2392
|
-
|
|
2447
|
+
_context21.n = 2;
|
|
2393
2448
|
return this.checkConnections();
|
|
2394
2449
|
case 2:
|
|
2395
|
-
status =
|
|
2450
|
+
status = _context21.v;
|
|
2396
2451
|
if (!status.ready) {
|
|
2397
|
-
|
|
2452
|
+
_context21.n = 3;
|
|
2398
2453
|
break;
|
|
2399
2454
|
}
|
|
2400
2455
|
console.log('✅ Connexions prêtes');
|
|
2401
|
-
return
|
|
2456
|
+
return _context21.a(2, status);
|
|
2402
2457
|
case 3:
|
|
2403
2458
|
console.log('⏳ Attente connexions...', status);
|
|
2404
|
-
|
|
2459
|
+
_context21.n = 4;
|
|
2405
2460
|
return new Promise(function (resolve) {
|
|
2406
2461
|
return setTimeout(resolve, 1000);
|
|
2407
2462
|
});
|
|
2408
2463
|
case 4:
|
|
2409
|
-
|
|
2464
|
+
_context21.n = 1;
|
|
2410
2465
|
break;
|
|
2411
2466
|
case 5:
|
|
2412
2467
|
throw new Error('Timeout connexions - Impossible de générer le QR code');
|
|
2413
2468
|
case 6:
|
|
2414
|
-
return
|
|
2469
|
+
return _context21.a(2);
|
|
2415
2470
|
}
|
|
2416
|
-
},
|
|
2471
|
+
}, _callee20, this);
|
|
2417
2472
|
}));
|
|
2418
2473
|
function waitForConnections() {
|
|
2419
2474
|
return _waitForConnections.apply(this, arguments);
|
|
@@ -2512,6 +2567,206 @@
|
|
|
2512
2567
|
container.innerHTML = "\n <div style=\"\n text-align: center;\n padding: 40px 20px;\n background: #f8f9fa;\n border: 2px solid #007bff;\n border-radius: 10px;\n color: #007bff;\n font-family: Arial, sans-serif;\n \">\n <div style=\"\n width: 60px;\n height: 60px;\n border: 4px solid #e3f2fd;\n border-top: 4px solid #007bff;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n margin: 0 auto 20px auto;\n \"></div>\n <h3 style=\"margin: 0 0 10px 0; color: #007bff;\">\uD83D\uDD0D Scan en cours...</h3>\n <p style=\"margin: 0; font-size: 14px;\">\n Veuillez patienter pendant la v\xE9rification de votre identit\xE9.\n </p>\n <div style=\"margin-top: 15px; font-size: 12px; color: #6c757d;\">\n \u23F1\uFE0F Traitement en cours...\n </div>\n </div>\n <style>\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n </style>\n ";
|
|
2513
2568
|
console.log('✅ Loader affiché avec succès');
|
|
2514
2569
|
}
|
|
2570
|
+
|
|
2571
|
+
/**
|
|
2572
|
+
* Gérer le callback SunuID
|
|
2573
|
+
*/
|
|
2574
|
+
}, {
|
|
2575
|
+
key: "handleCallback",
|
|
2576
|
+
value: function handleCallback() {
|
|
2577
|
+
var urlParams = new URLSearchParams(window.location.search);
|
|
2578
|
+
|
|
2579
|
+
// Vérifier si c'est un callback SunuID
|
|
2580
|
+
if (urlParams.has('token') && urlParams.has('session_id')) {
|
|
2581
|
+
console.log('🔗 Callback SunuID détecté');
|
|
2582
|
+
|
|
2583
|
+
// Récupérer les paramètres
|
|
2584
|
+
var callbackData = {
|
|
2585
|
+
token: urlParams.get('token'),
|
|
2586
|
+
state: urlParams.get('state'),
|
|
2587
|
+
session_id: urlParams.get('session_id'),
|
|
2588
|
+
user_id: urlParams.get('user_id'),
|
|
2589
|
+
partner_id: urlParams.get('partner_id'),
|
|
2590
|
+
type: urlParams.get('type'),
|
|
2591
|
+
timestamp: urlParams.get('timestamp'),
|
|
2592
|
+
signature: urlParams.get('signature')
|
|
2593
|
+
};
|
|
2594
|
+
console.log('📋 Données callback:', callbackData);
|
|
2595
|
+
|
|
2596
|
+
// Valider le callback
|
|
2597
|
+
this.validateCallback(callbackData);
|
|
2598
|
+
|
|
2599
|
+
// Traiter l'authentification
|
|
2600
|
+
this.processAuthentication(callbackData);
|
|
2601
|
+
return true;
|
|
2602
|
+
}
|
|
2603
|
+
return false;
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
/**
|
|
2607
|
+
* Valider le callback
|
|
2608
|
+
*/
|
|
2609
|
+
}, {
|
|
2610
|
+
key: "validateCallback",
|
|
2611
|
+
value: function validateCallback(data) {
|
|
2612
|
+
console.log('🔒 Validation du callback...');
|
|
2613
|
+
|
|
2614
|
+
// Vérifier l'état de sécurité
|
|
2615
|
+
if (data.state && data.state !== this.config.state) {
|
|
2616
|
+
console.error('❌ État de sécurité invalide');
|
|
2617
|
+
throw new Error('État de sécurité invalide');
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
// Vérifier la signature (si configurée)
|
|
2621
|
+
if (data.signature && this.config.verifySignature) {
|
|
2622
|
+
if (!this.verifySignature(data)) {
|
|
2623
|
+
console.error('❌ Signature invalide');
|
|
2624
|
+
throw new Error('Signature invalide');
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
// Vérifier l'expiration
|
|
2629
|
+
if (data.timestamp && this.isExpired(data.timestamp)) {
|
|
2630
|
+
console.error('❌ Token expiré');
|
|
2631
|
+
throw new Error('Token expiré');
|
|
2632
|
+
}
|
|
2633
|
+
console.log('✅ Callback validé avec succès');
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
/**
|
|
2637
|
+
* Traiter l'authentification
|
|
2638
|
+
*/
|
|
2639
|
+
}, {
|
|
2640
|
+
key: "processAuthentication",
|
|
2641
|
+
value: function processAuthentication(data) {
|
|
2642
|
+
console.log('🔐 Traitement de l\'authentification...');
|
|
2643
|
+
try {
|
|
2644
|
+
// Décoder le JWT token
|
|
2645
|
+
var decodedToken = this.decodeJWT(data.token);
|
|
2646
|
+
|
|
2647
|
+
// Vérifier les données utilisateur
|
|
2648
|
+
var userData = {
|
|
2649
|
+
user_id: decodedToken.user_id || data.user_id,
|
|
2650
|
+
session_id: decodedToken.session_id || data.session_id,
|
|
2651
|
+
partner_id: decodedToken.partner_id || data.partner_id,
|
|
2652
|
+
type: decodedToken.type || data.type,
|
|
2653
|
+
iat: decodedToken.iat,
|
|
2654
|
+
exp: decodedToken.exp
|
|
2655
|
+
};
|
|
2656
|
+
console.log('👤 Données utilisateur:', userData);
|
|
2657
|
+
|
|
2658
|
+
// Émettre l'événement de succès
|
|
2659
|
+
this.emitWebSocketEvent('authentication_success', {
|
|
2660
|
+
userData: userData,
|
|
2661
|
+
callbackData: data,
|
|
2662
|
+
timestamp: Date.now()
|
|
2663
|
+
});
|
|
2664
|
+
|
|
2665
|
+
// Appeler le callback de succès
|
|
2666
|
+
if (this.config.onAuthenticationSuccess) {
|
|
2667
|
+
this.config.onAuthenticationSuccess(userData, data);
|
|
2668
|
+
}
|
|
2669
|
+
|
|
2670
|
+
// Rediriger si configuré
|
|
2671
|
+
if (this.config.redirectAfterSuccess) {
|
|
2672
|
+
this.redirectAfterSuccess(userData);
|
|
2673
|
+
}
|
|
2674
|
+
console.log('✅ Authentification traitée avec succès');
|
|
2675
|
+
} catch (error) {
|
|
2676
|
+
console.error('❌ Erreur lors du traitement:', error);
|
|
2677
|
+
|
|
2678
|
+
// Appeler le callback d'erreur
|
|
2679
|
+
if (this.config.onAuthenticationError) {
|
|
2680
|
+
this.config.onAuthenticationError(error, data);
|
|
2681
|
+
}
|
|
2682
|
+
throw error;
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
/**
|
|
2687
|
+
* Décoder un JWT token
|
|
2688
|
+
*/
|
|
2689
|
+
}, {
|
|
2690
|
+
key: "decodeJWT",
|
|
2691
|
+
value: function decodeJWT(token) {
|
|
2692
|
+
try {
|
|
2693
|
+
// Décodage simple du JWT (sans vérification de signature)
|
|
2694
|
+
var parts = token.split('.');
|
|
2695
|
+
if (parts.length !== 3) {
|
|
2696
|
+
throw new Error('Format JWT invalide');
|
|
2697
|
+
}
|
|
2698
|
+
var payload = parts[1];
|
|
2699
|
+
var decoded = JSON.parse(atob(payload));
|
|
2700
|
+
return decoded;
|
|
2701
|
+
} catch (error) {
|
|
2702
|
+
console.error('❌ Erreur décodage JWT:', error);
|
|
2703
|
+
throw new Error('Token JWT invalide');
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
/**
|
|
2708
|
+
* Vérifier la signature
|
|
2709
|
+
*/
|
|
2710
|
+
}, {
|
|
2711
|
+
key: "verifySignature",
|
|
2712
|
+
value: function verifySignature(data) {
|
|
2713
|
+
// Implémentation basique - à adapter selon vos besoins
|
|
2714
|
+
var expectedSignature = this.generateSignature(data);
|
|
2715
|
+
return data.signature === expectedSignature;
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
/**
|
|
2719
|
+
* Générer une signature
|
|
2720
|
+
*/
|
|
2721
|
+
}, {
|
|
2722
|
+
key: "generateSignature",
|
|
2723
|
+
value: function generateSignature(data) {
|
|
2724
|
+
// Implémentation basique - à adapter selon vos besoins
|
|
2725
|
+
var payload = "".concat(data.token, ".").concat(data.state, ".").concat(data.session_id, ".").concat(data.timestamp);
|
|
2726
|
+
return btoa(payload).slice(0, 12); // Signature simplifiée
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
/**
|
|
2730
|
+
* Vérifier l'expiration
|
|
2731
|
+
*/
|
|
2732
|
+
}, {
|
|
2733
|
+
key: "isExpired",
|
|
2734
|
+
value: function isExpired(timestamp) {
|
|
2735
|
+
var currentTime = Math.floor(Date.now() / 1000);
|
|
2736
|
+
var tokenTime = parseInt(timestamp);
|
|
2737
|
+
var maxAge = this.config.tokenMaxAge || 300; // 5 minutes par défaut
|
|
2738
|
+
|
|
2739
|
+
return currentTime - tokenTime > maxAge;
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
/**
|
|
2743
|
+
* Rediriger après succès
|
|
2744
|
+
*/
|
|
2745
|
+
}, {
|
|
2746
|
+
key: "redirectAfterSuccess",
|
|
2747
|
+
value: function redirectAfterSuccess(userData) {
|
|
2748
|
+
var redirectUrl = this.config.redirectAfterSuccess;
|
|
2749
|
+
|
|
2750
|
+
// Remplacer les variables dans l'URL
|
|
2751
|
+
redirectUrl = redirectUrl.replace('{user_id}', userData.user_id).replace('{session_id}', userData.session_id).replace('{partner_id}', userData.partner_id).replace('{type}', userData.type);
|
|
2752
|
+
console.log('🔄 Redirection vers:', redirectUrl);
|
|
2753
|
+
|
|
2754
|
+
// Redirection avec délai pour permettre les callbacks
|
|
2755
|
+
setTimeout(function () {
|
|
2756
|
+
window.location.href = redirectUrl;
|
|
2757
|
+
}, 100);
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
/**
|
|
2761
|
+
* Générer un état de sécurité
|
|
2762
|
+
*/
|
|
2763
|
+
}, {
|
|
2764
|
+
key: "generateState",
|
|
2765
|
+
value: function generateState() {
|
|
2766
|
+
var state = 'sunuid_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);
|
|
2767
|
+
this.config.state = state;
|
|
2768
|
+
return state;
|
|
2769
|
+
}
|
|
2515
2770
|
}]);
|
|
2516
2771
|
}(); // Exposer la classe globalement
|
|
2517
2772
|
window.SunuID = SunuID;
|