sunuid-sdk 1.0.27 → 1.0.29
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 +1 -1
- package/dist/sunuid-sdk.esm.js +22 -8
- package/dist/sunuid-sdk.esm.js.map +1 -1
- package/dist/sunuid-sdk.js +22 -8
- package/dist/sunuid-sdk.js.map +1 -1
- package/dist/sunuid-sdk.min.js +1 -1
- package/dist/sunuid-sdk.min.js.map +1 -1
- package/package.json +1 -1
package/dist/sunuid-sdk.js
CHANGED
|
@@ -302,7 +302,12 @@
|
|
|
302
302
|
// 10 secondes
|
|
303
303
|
// Options d'initialisation sécurisée
|
|
304
304
|
secureInit: false,
|
|
305
|
-
secureInitUrl:
|
|
305
|
+
secureInitUrl: function (_window$SunuIDConfig2, _window$SunuIDConfig3) {
|
|
306
|
+
if ((_window$SunuIDConfig2 = window.SunuIDConfig) !== null && _window$SunuIDConfig2 !== void 0 && (_window$SunuIDConfig2 = _window$SunuIDConfig2.apiUrl) !== null && _window$SunuIDConfig2 !== void 0 && _window$SunuIDConfig2.includes('api.sunuid.fayma.sn')) {
|
|
307
|
+
return 'https://sunuid.fayma.sn/secure-init.php';
|
|
308
|
+
}
|
|
309
|
+
return ((_window$SunuIDConfig3 = window.SunuIDConfig) === null || _window$SunuIDConfig3 === void 0 || (_window$SunuIDConfig3 = _window$SunuIDConfig3.apiUrl) === null || _window$SunuIDConfig3 === void 0 ? void 0 : _window$SunuIDConfig3.replace('/api', '')) + '/secure-init.php' || 'https://sunuid.fayma.sn/secure-init.php';
|
|
310
|
+
}(),
|
|
306
311
|
token: null
|
|
307
312
|
};
|
|
308
313
|
|
|
@@ -1166,7 +1171,7 @@
|
|
|
1166
1171
|
|
|
1167
1172
|
// Afficher un loader en attendant la réponse API et la connexion socket
|
|
1168
1173
|
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
|
|
1174
|
+
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
1175
|
container.appendChild(qrElement);
|
|
1171
1176
|
|
|
1172
1177
|
// Stocker les informations pour la génération ultérieure
|
|
@@ -1188,6 +1193,7 @@
|
|
|
1188
1193
|
value: (function () {
|
|
1189
1194
|
var _generateCustomQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(content, label) {
|
|
1190
1195
|
var qrContainer,
|
|
1196
|
+
qrGeneratorUrl,
|
|
1191
1197
|
_response3,
|
|
1192
1198
|
responseData,
|
|
1193
1199
|
instructionsElement,
|
|
@@ -1216,8 +1222,16 @@
|
|
|
1216
1222
|
|
|
1217
1223
|
// Appeler l'endpoint PHP
|
|
1218
1224
|
console.log('🔄 Appel endpoint PHP...');
|
|
1225
|
+
// Construire l'URL du QR generator de manière plus robuste
|
|
1226
|
+
|
|
1227
|
+
if (this.config.apiUrl.includes('api.sunuid.fayma.sn')) {
|
|
1228
|
+
qrGeneratorUrl = 'https://sunuid.fayma.sn/qr-generator.php';
|
|
1229
|
+
} else {
|
|
1230
|
+
qrGeneratorUrl = this.config.apiUrl.replace('/api', '') + '/qr-generator.php';
|
|
1231
|
+
}
|
|
1232
|
+
console.log('🔗 URL QR Generator:', qrGeneratorUrl);
|
|
1219
1233
|
_context9.n = 3;
|
|
1220
|
-
return fetch(
|
|
1234
|
+
return fetch(qrGeneratorUrl, {
|
|
1221
1235
|
method: 'POST',
|
|
1222
1236
|
headers: {
|
|
1223
1237
|
'Content-Type': 'application/json',
|
|
@@ -1257,7 +1271,7 @@
|
|
|
1257
1271
|
this.currentQRUrl = responseData.data.dataUrl;
|
|
1258
1272
|
|
|
1259
1273
|
// 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
|
|
1274
|
+
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
1275
|
|
|
1262
1276
|
// Afficher les instructions et le statut maintenant que le QR est prêt
|
|
1263
1277
|
instructionsElement = qrContainer.parentElement.querySelector('.sunuid-qr-instructions');
|
|
@@ -1426,8 +1440,8 @@
|
|
|
1426
1440
|
key: "makeRequest",
|
|
1427
1441
|
value: (function () {
|
|
1428
1442
|
var _makeRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(endpoint, data) {
|
|
1429
|
-
var _window$
|
|
1430
|
-
_window$
|
|
1443
|
+
var _window$SunuIDConfig4,
|
|
1444
|
+
_window$SunuIDConfig5,
|
|
1431
1445
|
_this5 = this;
|
|
1432
1446
|
var sanitizedData, endpointPath, url, retryCount, maxRetries, _loop, _ret;
|
|
1433
1447
|
return _regenerator().w(function (_context11) {
|
|
@@ -1467,11 +1481,11 @@
|
|
|
1467
1481
|
console.log('🔍 Debug makeRequest - isInitialized:', this.isInitialized);
|
|
1468
1482
|
|
|
1469
1483
|
// Utiliser l'endpoint depuis la configuration si disponible
|
|
1470
|
-
endpointPath = ((_window$
|
|
1484
|
+
endpointPath = ((_window$SunuIDConfig4 = window.SunuIDConfig) === null || _window$SunuIDConfig4 === void 0 || (_window$SunuIDConfig4 = _window$SunuIDConfig4.endpoints) === null || _window$SunuIDConfig4 === void 0 ? void 0 : _window$SunuIDConfig4[endpoint.replace('/', '')]) || endpoint;
|
|
1471
1485
|
url = "".concat(this.config.apiUrl).concat(endpointPath); // Debug: Afficher l'URL finale
|
|
1472
1486
|
console.log('🔍 URL finale construite:', url);
|
|
1473
1487
|
console.log('🔍 EndpointPath:', endpointPath);
|
|
1474
|
-
console.log('🔍 SunuIDConfig endpoints:', JSON.stringify((_window$
|
|
1488
|
+
console.log('🔍 SunuIDConfig endpoints:', JSON.stringify((_window$SunuIDConfig5 = window.SunuIDConfig) === null || _window$SunuIDConfig5 === void 0 ? void 0 : _window$SunuIDConfig5.endpoints));
|
|
1475
1489
|
|
|
1476
1490
|
// Log de sécurité pour la requête
|
|
1477
1491
|
this.logSecurityEvent('API_REQUEST_START', {
|