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.
package/README.md CHANGED
@@ -44,7 +44,7 @@ npm install sunuid-sdk
44
44
 
45
45
  ## 📖 Utilisation Rapide
46
46
 
47
- > **🚀 [Démarrage en 30 secondes](GET_STARTED.md)** | **🌍 [Intégration Universelle](INTEGRATION_UNIVERSAL.md)** | **⚡ [Démarrage en 2 minutes](QUICKSTART.md)** | **💡 [Intégration simplifiée](INTEGRATION_SIMPLE.md)** | **🔒 [Intégration PHP complète](PHP_INTEGRATION.md)**
47
+ > **🚀 [Démarrage en 30 secondes](GET_STARTED.md)** | **🌍 [Intégration Universelle](INTEGRATION_UNIVERSAL.md)** | **⚡ [Démarrage en 2 minutes](QUICKSTART.md)** | **💡 [Intégration simplifiée](INTEGRATION_SIMPLE.md)** | **🔒 [Intégration PHP complète](PHP_INTEGRATION.md)** | **🏭 [Migration Production](MIGRATION_PRODUCTION.md)**
48
48
 
49
49
  ### 1. Mode Classique (Credentials visibles)
50
50
 
@@ -271,7 +271,7 @@ function _unsupportedIterableToArray(r, a) {
271
271
  * @license MIT
272
272
  */
273
273
 
274
- (function (window, _window$SunuIDConfig) {
274
+ (function (window, _window$SunuIDConfig, _window$SunuIDConfig2) {
275
275
 
276
276
  // Configuration par défaut
277
277
  var DEFAULT_CONFIG = {
@@ -299,7 +299,7 @@ function _unsupportedIterableToArray(r, a) {
299
299
  // 10 secondes
300
300
  // Options d'initialisation sécurisée
301
301
  secureInit: false,
302
- secureInitUrl: 'http://localhost:8081/secure-init.php',
302
+ 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',
303
303
  token: null
304
304
  };
305
305
 
@@ -1163,7 +1163,7 @@ function _unsupportedIterableToArray(r, a) {
1163
1163
 
1164
1164
  // Afficher un loader en attendant la réponse API et la connexion socket
1165
1165
  this.getTypeName(type);
1166
- 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 ");
1166
+ 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 ");
1167
1167
  container.appendChild(qrElement);
1168
1168
 
1169
1169
  // Stocker les informations pour la génération ultérieure
@@ -1185,6 +1185,7 @@ function _unsupportedIterableToArray(r, a) {
1185
1185
  value: (function () {
1186
1186
  var _generateCustomQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(content, label) {
1187
1187
  var qrContainer,
1188
+ qrGeneratorUrl,
1188
1189
  _response3,
1189
1190
  responseData,
1190
1191
  instructionsElement,
@@ -1213,8 +1214,9 @@ function _unsupportedIterableToArray(r, a) {
1213
1214
 
1214
1215
  // Appeler l'endpoint PHP
1215
1216
  console.log('🔄 Appel endpoint PHP...');
1217
+ qrGeneratorUrl = this.config.apiUrl.replace('/api', '') + '/qr-generator.php';
1216
1218
  _context9.n = 3;
1217
- return fetch('http://localhost:8081/qr-generator.php', {
1219
+ return fetch(qrGeneratorUrl, {
1218
1220
  method: 'POST',
1219
1221
  headers: {
1220
1222
  'Content-Type': 'application/json',
@@ -1254,7 +1256,7 @@ function _unsupportedIterableToArray(r, a) {
1254
1256
  this.currentQRUrl = responseData.data.dataUrl;
1255
1257
 
1256
1258
  // Créer le conteneur avec le QR code PHP
1257
- 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 ");
1259
+ 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 ");
1258
1260
 
1259
1261
  // Afficher les instructions et le statut maintenant que le QR est prêt
1260
1262
  instructionsElement = qrContainer.parentElement.querySelector('.sunuid-qr-instructions');
@@ -1423,8 +1425,8 @@ function _unsupportedIterableToArray(r, a) {
1423
1425
  key: "makeRequest",
1424
1426
  value: (function () {
1425
1427
  var _makeRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(endpoint, data) {
1426
- var _window$SunuIDConfig2,
1427
- _window$SunuIDConfig3,
1428
+ var _window$SunuIDConfig3,
1429
+ _window$SunuIDConfig4,
1428
1430
  _this5 = this;
1429
1431
  var sanitizedData, endpointPath, url, retryCount, maxRetries, _loop, _ret;
1430
1432
  return _regenerator().w(function (_context11) {
@@ -1464,11 +1466,11 @@ function _unsupportedIterableToArray(r, a) {
1464
1466
  console.log('🔍 Debug makeRequest - isInitialized:', this.isInitialized);
1465
1467
 
1466
1468
  // Utiliser l'endpoint depuis la configuration si disponible
1467
- 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;
1469
+ 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;
1468
1470
  url = "".concat(this.config.apiUrl).concat(endpointPath); // Debug: Afficher l'URL finale
1469
1471
  console.log('🔍 URL finale construite:', url);
1470
1472
  console.log('🔍 EndpointPath:', endpointPath);
1471
- console.log('🔍 SunuIDConfig endpoints:', JSON.stringify((_window$SunuIDConfig3 = window.SunuIDConfig) === null || _window$SunuIDConfig3 === void 0 ? void 0 : _window$SunuIDConfig3.endpoints));
1473
+ console.log('🔍 SunuIDConfig endpoints:', JSON.stringify((_window$SunuIDConfig4 = window.SunuIDConfig) === null || _window$SunuIDConfig4 === void 0 ? void 0 : _window$SunuIDConfig4.endpoints));
1472
1474
 
1473
1475
  // Log de sécurité pour la requête
1474
1476
  this.logSecurityEvent('API_REQUEST_START', {