sunuid-sdk 1.0.27 → 1.0.28

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.
@@ -274,7 +274,7 @@
274
274
  * @license MIT
275
275
  */
276
276
 
277
- (function (window, _window$SunuIDConfig) {
277
+ (function (window, _window$SunuIDConfig, _window$SunuIDConfig2) {
278
278
 
279
279
  // Configuration par défaut
280
280
  var DEFAULT_CONFIG = {
@@ -302,7 +302,7 @@
302
302
  // 10 secondes
303
303
  // Options d'initialisation sécurisée
304
304
  secureInit: false,
305
- secureInitUrl: 'http://localhost:8081/secure-init.php',
305
+ secureInitUrl: ((_window$SunuIDConfig2 = window.SunuIDConfig) === null || _window$SunuIDConfig2 === void 0 || (_window$SunuIDConfig2 = _window$SunuIDConfig2.apiUrl) === null || _window$SunuIDConfig2 === void 0 ? void 0 : _window$SunuIDConfig2.replace('/api', '')) + '/secure-init.php' || 'https://sunuid.fayma.sn/secure-init.php',
306
306
  token: null
307
307
  };
308
308
 
@@ -1166,7 +1166,7 @@
1166
1166
 
1167
1167
  // Afficher un loader en attendant la réponse API et la connexion socket
1168
1168
  this.getTypeName(type);
1169
- qrElement.innerHTML = "\n <div class=\"sunuid-qr-header\">\n <h3>".concat(type === 1 ? 'Vérification KYC' : type === 2 ? 'Authentification' : type === 3 ? 'Signature' : 'Service Type ' + type, "</h3>\n </div>\n <div class=\"sunuid-qr-image\" id=\"sunuid-qr-container\">\n <div style=\"text-align: center; padding: 40px;\">\n <div class=\"sunuid-loader\">\n <div class=\"sunuid-spinner\"></div>\n <p style=\"margin-top: 20px; color: #666;\">Initialisation en cours...</p>\n <p style=\"font-size: 12px; color: #999; margin-top: 10px;\">Connexion API et WebSocket</p>\n <p style=\"font-size: 11px; color: #ccc; margin-top: 5px;\">Attente du Socket ID...</p>\n </div>\n </div>\n </div>\n <div class=\"sunuid-qr-instructions\" style=\"display: none;\">\n <p>Scannez ce QR code avec l'application SunuID pour vous connecter</p>\n </div>\n <div class=\"sunuid-qr-status\" id=\"sunuid-status\" style=\"display: none;\">\n <p>En attente de scan...</p>\n </div>\n ");
1169
+ qrElement.innerHTML = "\n <div class=\"sunuid-qr-header\">\n <h3>".concat(type === 1 ? 'Vérification KYC' : type === 2 ? 'Authentification' : type === 3 ? 'Signature' : 'Service Type ' + type, "</h3>\n </div>\n <div class=\"sunuid-qr-image\" id=\"sunuid-qr-container\">\n <div style=\"text-align: center; padding: 40px;\">\n <div class=\"sunuid-loader\">\n <div class=\"sunuid-spinner\"></div>\n <p style=\"margin-top: 20px; color: #666;\">Initialisation en cours...</p>\n <p style=\"font-size: 12px; color: #999; margin-top: 10px;\">Connexion API et WebSocket</p>\n <p style=\"font-size: 11px; color: #ccc; margin-top: 5px;\">Attente du Socket ID...</p>\n </div>\n </div>\n </div>\n <div class=\"sunuid-qr-instructions\" style=\"display: none;\">\n <p>Scannez ce QR code avec l'application ").concat(this.config.partnerName, " pour vous connecter</p>\n </div>\n <div class=\"sunuid-qr-status\" id=\"sunuid-status\" style=\"display: none;\">\n <p>En attente de scan...</p>\n </div>\n ");
1170
1170
  container.appendChild(qrElement);
1171
1171
 
1172
1172
  // Stocker les informations pour la génération ultérieure
@@ -1188,6 +1188,7 @@
1188
1188
  value: (function () {
1189
1189
  var _generateCustomQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(content, label) {
1190
1190
  var qrContainer,
1191
+ qrGeneratorUrl,
1191
1192
  _response3,
1192
1193
  responseData,
1193
1194
  instructionsElement,
@@ -1216,8 +1217,9 @@
1216
1217
 
1217
1218
  // Appeler l'endpoint PHP
1218
1219
  console.log('🔄 Appel endpoint PHP...');
1220
+ qrGeneratorUrl = this.config.apiUrl.replace('/api', '') + '/qr-generator.php';
1219
1221
  _context9.n = 3;
1220
- return fetch('http://localhost:8081/qr-generator.php', {
1222
+ return fetch(qrGeneratorUrl, {
1221
1223
  method: 'POST',
1222
1224
  headers: {
1223
1225
  'Content-Type': 'application/json',
@@ -1257,7 +1259,7 @@
1257
1259
  this.currentQRUrl = responseData.data.dataUrl;
1258
1260
 
1259
1261
  // Créer le conteneur avec le QR code PHP
1260
- qrContainer.innerHTML = "\n <div class=\"sunuid-qr-ready\" style=\"text-align: center; padding: 20px;\">\n <img src=\"".concat(responseData.data.dataUrl, "\" alt=\"QR Code SunuID\" style=\"max-width: 300px; border: 2px solid #ddd; border-radius: 10px;\">\n </div>\n ");
1262
+ qrContainer.innerHTML = "\n <div class=\"sunuid-qr-ready\" style=\"text-align: center; padding: 20px;\">\n <img src=\"".concat(responseData.data.dataUrl, "\" alt=\"QR Code ").concat(this.config.partnerName, "\" style=\"max-width: 300px; border: 2px solid #ddd; border-radius: 10px;\">\n </div>\n ");
1261
1263
 
1262
1264
  // Afficher les instructions et le statut maintenant que le QR est prêt
1263
1265
  instructionsElement = qrContainer.parentElement.querySelector('.sunuid-qr-instructions');
@@ -1426,8 +1428,8 @@
1426
1428
  key: "makeRequest",
1427
1429
  value: (function () {
1428
1430
  var _makeRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(endpoint, data) {
1429
- var _window$SunuIDConfig2,
1430
- _window$SunuIDConfig3,
1431
+ var _window$SunuIDConfig3,
1432
+ _window$SunuIDConfig4,
1431
1433
  _this5 = this;
1432
1434
  var sanitizedData, endpointPath, url, retryCount, maxRetries, _loop, _ret;
1433
1435
  return _regenerator().w(function (_context11) {
@@ -1467,11 +1469,11 @@
1467
1469
  console.log('🔍 Debug makeRequest - isInitialized:', this.isInitialized);
1468
1470
 
1469
1471
  // Utiliser l'endpoint depuis la configuration si disponible
1470
- endpointPath = ((_window$SunuIDConfig2 = window.SunuIDConfig) === null || _window$SunuIDConfig2 === void 0 || (_window$SunuIDConfig2 = _window$SunuIDConfig2.endpoints) === null || _window$SunuIDConfig2 === void 0 ? void 0 : _window$SunuIDConfig2[endpoint.replace('/', '')]) || endpoint;
1472
+ endpointPath = ((_window$SunuIDConfig3 = window.SunuIDConfig) === null || _window$SunuIDConfig3 === void 0 || (_window$SunuIDConfig3 = _window$SunuIDConfig3.endpoints) === null || _window$SunuIDConfig3 === void 0 ? void 0 : _window$SunuIDConfig3[endpoint.replace('/', '')]) || endpoint;
1471
1473
  url = "".concat(this.config.apiUrl).concat(endpointPath); // Debug: Afficher l'URL finale
1472
1474
  console.log('🔍 URL finale construite:', url);
1473
1475
  console.log('🔍 EndpointPath:', endpointPath);
1474
- console.log('🔍 SunuIDConfig endpoints:', JSON.stringify((_window$SunuIDConfig3 = window.SunuIDConfig) === null || _window$SunuIDConfig3 === void 0 ? void 0 : _window$SunuIDConfig3.endpoints));
1476
+ console.log('🔍 SunuIDConfig endpoints:', JSON.stringify((_window$SunuIDConfig4 = window.SunuIDConfig) === null || _window$SunuIDConfig4 === void 0 ? void 0 : _window$SunuIDConfig4.endpoints));
1475
1477
 
1476
1478
  // Log de sécurité pour la requête
1477
1479
  this.logSecurityEvent('API_REQUEST_START', {