fix: Corriger les erreurs d'initialisation et de communication

- Supprimer l'appel à initEssentialFunctions (fonction supprimée)
- Ajouter le support pour le message IFRAME_READY
- Améliorer les logs de validation WebSocket pour le debugging
- Résoudre les erreurs ReferenceError et Unknown message type
This commit is contained in:
NicolasCantu 2025-10-23 13:11:45 +02:00
parent 69424c6bf6
commit 0b94cda76e
5 changed files with 21 additions and 11 deletions

View File

@ -28,17 +28,19 @@
"license": "ISC",
"devDependencies": {
"@eslint/js": "^9.38.0",
"@testing-library/jest-dom": "^6.1.4",
"@types/jest": "^29.5.8",
"@typescript-eslint/eslint-plugin": "^8.46.2",
"@typescript-eslint/parser": "^8.46.2",
"eslint": "^9.38.0",
"jest": "^29.7.0",
"prettier": "^3.3.3",
"ts-jest": "^29.1.1",
"typescript": "^5.3.3",
"vite": "^5.4.11",
"vite-plugin-static-copy": "^1.0.6",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"@types/jest": "^29.5.8",
"@testing-library/jest-dom": "^6.1.4"
"vite-plugin-top-level-await": "^1.6.0",
"vite-plugin-wasm": "^3.5.0"
},
"dependencies": {
"axios": "^1.7.8",
@ -47,7 +49,6 @@
"pdf-lib": "^1.17.1",
"sweetalert2": "^11.14.5",
"vite-plugin-copy": "^0.1.6",
"vite-plugin-html": "^3.2.2",
"vite-plugin-wasm": "^3.3.0"
"vite-plugin-html": "^3.2.2"
}
}

View File

@ -397,6 +397,10 @@ export function initIframeCommunication() {
console.log('👂 Parent is listening for messages');
break;
case 'IFRAME_READY':
console.log('✅ Iframe is ready and initialized');
break;
default:
console.log('❓ Unknown message type from parent:', type);
}

View File

@ -61,8 +61,7 @@ async function handleLocation(path: string) {
await new Promise(requestAnimationFrame);
// Initialize essential functions
await initEssentialFunctions();
// Essential functions are now handled directly in the application
// const modalService = await ModalService.getInstance()
// modalService.injectValidationModal()

View File

@ -34,7 +34,8 @@ export async function initWebsocket(url: string) {
secureLogger.warn('Invalid WebSocket message received', {
component: 'WebSocket',
operation: 'message_validation',
errors: validation.errors
errors: validation.errors,
messagePreview: msgData.substring(0, 100) // Log first 100 chars for debugging
});
return;
}

View File

@ -1,11 +1,16 @@
import { defineConfig } from 'vite';
import path from 'path'
import path from 'path';
import wasm from 'vite-plugin-wasm';
import topLevelAwait from 'vite-plugin-top-level-await';
export default defineConfig({
optimizeDeps: {
include: ['qrcode']
},
plugins: [],
plugins: [
wasm(),
topLevelAwait()
],
build: {
outDir: 'dist',
target: 'esnext',