sunuid-sdk 1.0.26 → 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 +1 -1
- package/dist/sunuid-sdk.esm.js +30 -9
- package/dist/sunuid-sdk.esm.js.map +1 -1
- package/dist/sunuid-sdk.js +30 -9
- 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/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
|
|
package/dist/sunuid-sdk.esm.js
CHANGED
|
@@ -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: '
|
|
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
|
|
|
@@ -829,6 +829,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
829
829
|
// Construire l'URL complète de l'image QR avec la base URL pour les images
|
|
830
830
|
imageBaseUrl = 'https://sunuid.fayma.sn';
|
|
831
831
|
qrImageUrl = "".concat(imageBaseUrl).concat(response.data.qrcode);
|
|
832
|
+
this.currentQRUrl = qrImageUrl; // Stocker l'URL pour getQRCode()
|
|
832
833
|
this.displayQRCode(containerId, qrImageUrl, this.config.type, options);
|
|
833
834
|
|
|
834
835
|
// Générer le QR code personnalisé avec le type + code de l'API + socket ID
|
|
@@ -1162,7 +1163,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
1162
1163
|
|
|
1163
1164
|
// Afficher un loader en attendant la réponse API et la connexion socket
|
|
1164
1165
|
this.getTypeName(type);
|
|
1165
|
-
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
|
|
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 ");
|
|
1166
1167
|
container.appendChild(qrElement);
|
|
1167
1168
|
|
|
1168
1169
|
// Stocker les informations pour la génération ultérieure
|
|
@@ -1184,6 +1185,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
1184
1185
|
value: (function () {
|
|
1185
1186
|
var _generateCustomQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(content, label) {
|
|
1186
1187
|
var qrContainer,
|
|
1188
|
+
qrGeneratorUrl,
|
|
1187
1189
|
_response3,
|
|
1188
1190
|
responseData,
|
|
1189
1191
|
instructionsElement,
|
|
@@ -1212,8 +1214,9 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
1212
1214
|
|
|
1213
1215
|
// Appeler l'endpoint PHP
|
|
1214
1216
|
console.log('🔄 Appel endpoint PHP...');
|
|
1217
|
+
qrGeneratorUrl = this.config.apiUrl.replace('/api', '') + '/qr-generator.php';
|
|
1215
1218
|
_context9.n = 3;
|
|
1216
|
-
return fetch(
|
|
1219
|
+
return fetch(qrGeneratorUrl, {
|
|
1217
1220
|
method: 'POST',
|
|
1218
1221
|
headers: {
|
|
1219
1222
|
'Content-Type': 'application/json',
|
|
@@ -1249,8 +1252,11 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
1249
1252
|
console.log('📊 Taille:', responseData.data.size + 'px');
|
|
1250
1253
|
console.log('📊 Longueur base64:', responseData.data.length + ' caractères');
|
|
1251
1254
|
|
|
1255
|
+
// Stocker l'URL du QR code pour getQRCode()
|
|
1256
|
+
this.currentQRUrl = responseData.data.dataUrl;
|
|
1257
|
+
|
|
1252
1258
|
// Créer le conteneur avec le QR code PHP
|
|
1253
|
-
qrContainer.innerHTML = "\n <div class=\"sunuid-qr-ready\" style=\"text-align: center; padding: 20px;\">\n <img src=\"".concat(responseData.data.dataUrl, "\" alt=\"QR Code
|
|
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 ");
|
|
1254
1260
|
|
|
1255
1261
|
// Afficher les instructions et le statut maintenant que le QR est prêt
|
|
1256
1262
|
instructionsElement = qrContainer.parentElement.querySelector('.sunuid-qr-instructions');
|
|
@@ -1419,8 +1425,8 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
1419
1425
|
key: "makeRequest",
|
|
1420
1426
|
value: (function () {
|
|
1421
1427
|
var _makeRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(endpoint, data) {
|
|
1422
|
-
var _window$
|
|
1423
|
-
_window$
|
|
1428
|
+
var _window$SunuIDConfig3,
|
|
1429
|
+
_window$SunuIDConfig4,
|
|
1424
1430
|
_this5 = this;
|
|
1425
1431
|
var sanitizedData, endpointPath, url, retryCount, maxRetries, _loop, _ret;
|
|
1426
1432
|
return _regenerator().w(function (_context11) {
|
|
@@ -1460,11 +1466,11 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
1460
1466
|
console.log('🔍 Debug makeRequest - isInitialized:', this.isInitialized);
|
|
1461
1467
|
|
|
1462
1468
|
// Utiliser l'endpoint depuis la configuration si disponible
|
|
1463
|
-
endpointPath = ((_window$
|
|
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;
|
|
1464
1470
|
url = "".concat(this.config.apiUrl).concat(endpointPath); // Debug: Afficher l'URL finale
|
|
1465
1471
|
console.log('🔍 URL finale construite:', url);
|
|
1466
1472
|
console.log('🔍 EndpointPath:', endpointPath);
|
|
1467
|
-
console.log('🔍 SunuIDConfig endpoints:', JSON.stringify((_window$
|
|
1473
|
+
console.log('🔍 SunuIDConfig endpoints:', JSON.stringify((_window$SunuIDConfig4 = window.SunuIDConfig) === null || _window$SunuIDConfig4 === void 0 ? void 0 : _window$SunuIDConfig4.endpoints));
|
|
1468
1474
|
|
|
1469
1475
|
// Log de sécurité pour la requête
|
|
1470
1476
|
this.logSecurityEvent('API_REQUEST_START', {
|
|
@@ -1680,6 +1686,21 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
1680
1686
|
}
|
|
1681
1687
|
}
|
|
1682
1688
|
|
|
1689
|
+
/**
|
|
1690
|
+
* Obtenir l'URL du QR code généré
|
|
1691
|
+
*/
|
|
1692
|
+
}, {
|
|
1693
|
+
key: "getQRCode",
|
|
1694
|
+
value: function getQRCode() {
|
|
1695
|
+
// Retourner l'URL du QR code si disponible
|
|
1696
|
+
if (this.currentQRUrl) {
|
|
1697
|
+
return this.currentQRUrl;
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
// Sinon, retourner une URL par défaut ou null
|
|
1701
|
+
return null;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1683
1704
|
/**
|
|
1684
1705
|
* Nettoyer les ressources
|
|
1685
1706
|
*/
|