diff --git a/flottform/forms/src/default-component.ts b/flottform/forms/src/default-component.ts index 025cf36..9c3f81f 100644 --- a/flottform/forms/src/default-component.ts +++ b/flottform/forms/src/default-component.ts @@ -104,7 +104,7 @@ export const createDefaultFlottformComponent = ({ const flottformBaseInputHost = new FlottformFileInputHost({ flottformApi, createClientUrl, - inputField + incomingInputField: inputField }); const { @@ -260,7 +260,7 @@ const handleFileInputStates = ({ } flottformFileInputHost.on( - 'progress', + 'file-receiving-progress', ({ currentFileProgress, overallProgress, fileIndex, totalFileCount, fileName }) => { removeConnectionStatusInformation(flottformStateItemsContainer); updateOverallFilesStatusBar( @@ -279,7 +279,7 @@ const handleFileInputStates = ({ ); } ); - flottformFileInputHost.on('done', () => { + flottformFileInputHost.on('single-file-received', () => { statusInformation.innerHTML = onSuccessText ?? `✨ You have succesfully downloaded all your files.`; statusInformation.appendChild(refreshChannelButton); diff --git a/servers/demo/src/routes/belegeinreichung-client/[endpointId]/+page.svelte b/servers/demo/src/routes/belegeinreichung-client/[endpointId]/+page.svelte index 1ca32f2..174c02e 100644 --- a/servers/demo/src/routes/belegeinreichung-client/[endpointId]/+page.svelte +++ b/servers/demo/src/routes/belegeinreichung-client/[endpointId]/+page.svelte @@ -21,7 +21,7 @@ onMount(async () => { const flottformFileInputClient = new FlottformFileInputClient({ endpointId: $page.params.endpointId, - fileInput, + outgoingInputField: fileInput, flottformApi: sdpExchangeServerBase }); @@ -34,13 +34,11 @@ flottformFileInputClient.on('connected', () => { currentState = 'connected'; }); - flottformFileInputClient.on('sending', () => { - currentState = 'sending'; - }); - flottformFileInputClient.on('progress', (p) => { + flottformFileInputClient.on('file-sending-progress', (p) => { console.log('progress= ', p); + currentState = 'sending'; }); - flottformFileInputClient.on('done', () => { + flottformFileInputClient.on('single-file-transfered', () => { currentState = 'done'; }); flottformFileInputClient.on('disconnected', () => { diff --git a/servers/demo/src/routes/belegeinreichung/+page.svelte b/servers/demo/src/routes/belegeinreichung/+page.svelte index 3980b02..98b6110 100644 --- a/servers/demo/src/routes/belegeinreichung/+page.svelte +++ b/servers/demo/src/routes/belegeinreichung/+page.svelte @@ -115,7 +115,7 @@ const flottformFileInputHost = new FlottformFileInputHost({ flottformApi: sdpExchangeServerBase, createClientUrl: createDeExpenseReportClientUrl, - inputField: fileInput + incomingInputField: fileInput }); flottformFileInputHost.on('new', () => { @@ -145,14 +145,14 @@ flottformDialogDescription = 'Warte auf eine Verbindung...'; }); - flottformFileInputHost.on('receive', () => { + flottformFileInputHost.on('file-receiving-progress', () => { flottformState = 'receive'; flottformStatusWrapper = 'Empfange Daten'; flottformDialogDescription = 'Ein anderes Gerät sendet gerade Daten. Warte auf den Abschluss der Übertragung...'; }); - flottformFileInputHost.on('done', () => { + flottformFileInputHost.on('single-file-received', () => { flottformState = 'done'; hasFile = true; flottformStatusSvg = done; diff --git a/servers/demo/src/routes/customized-default-ui-client/[endpointId]/+page.svelte b/servers/demo/src/routes/customized-default-ui-client/[endpointId]/+page.svelte index 7da8f22..647213c 100644 --- a/servers/demo/src/routes/customized-default-ui-client/[endpointId]/+page.svelte +++ b/servers/demo/src/routes/customized-default-ui-client/[endpointId]/+page.svelte @@ -21,7 +21,7 @@ onMount(async () => { const flottformFileInputClient = new FlottformFileInputClient({ endpointId: $page.params.endpointId, - fileInput, + outgoingInputField: fileInput, flottformApi: sdpExchangeServerBase }); @@ -34,13 +34,11 @@ flottformFileInputClient.on('connected', () => { currentState = 'connected'; }); - flottformFileInputClient.on('sending', () => { + flottformFileInputClient.on('file-sending-progress', (p) => { currentState = 'sending'; - }); - flottformFileInputClient.on('progress', (p) => { console.log('progress= ', p); }); - flottformFileInputClient.on('done', () => { + flottformFileInputClient.on('single-file-transfered', () => { currentState = 'done'; }); flottformFileInputClient.on('disconnected', () => { diff --git a/servers/demo/src/routes/expense-report-client/[endpointId]/+page.svelte b/servers/demo/src/routes/expense-report-client/[endpointId]/+page.svelte index 6ae7737..1f56001 100644 --- a/servers/demo/src/routes/expense-report-client/[endpointId]/+page.svelte +++ b/servers/demo/src/routes/expense-report-client/[endpointId]/+page.svelte @@ -21,7 +21,7 @@ onMount(async () => { const flottformFileInputClient = new FlottformFileInputClient({ endpointId: $page.params.endpointId, - fileInput, + outgoingInputField: fileInput, flottformApi: sdpExchangeServerBase }); @@ -34,13 +34,11 @@ flottformFileInputClient.on('connected', () => { currentState = 'connected'; }); - flottformFileInputClient.on('sending', () => { + flottformFileInputClient.on('file-sending-progress', (p) => { currentState = 'sending'; - }); - flottformFileInputClient.on('progress', (p) => { console.log('progress= ', p); }); - flottformFileInputClient.on('done', () => { + flottformFileInputClient.on('single-file-transfered', () => { currentState = 'done'; }); flottformFileInputClient.on('disconnected', () => { diff --git a/servers/demo/src/routes/expense-report/+page.svelte b/servers/demo/src/routes/expense-report/+page.svelte index fa72ecd..c18469f 100644 --- a/servers/demo/src/routes/expense-report/+page.svelte +++ b/servers/demo/src/routes/expense-report/+page.svelte @@ -160,7 +160,7 @@ const flottformFileInputHost = new FlottformFileInputHost({ flottformApi: sdpExchangeServerBase, createClientUrl: createExpenseReportClientUrl, - inputField: fileInput + incomingInputField: fileInput }); flottformFileInputHost.on('new', () => { @@ -189,14 +189,14 @@ flottformDialogDescription = 'Waiting for data channel connection'; }); - flottformFileInputHost.on('receive', () => { + flottformFileInputHost.on('file-receiving-progress', () => { flottformState = 'receive'; flottformStatusWrapper = 'Receiving data'; flottformDialogDescription = 'Another device is sending data. Waiting for incoming data transfer to complete'; }); - flottformFileInputHost.on('done', () => { + flottformFileInputHost.on('single-file-received', () => { flottformState = 'done'; flottformStatusSvg = done; flottformStatusWrapper = 'Done!'; diff --git a/servers/demo/src/routes/flottform-client/[endpointId]/+page.svelte b/servers/demo/src/routes/flottform-client/[endpointId]/+page.svelte index f12f9ac..690e9c1 100644 --- a/servers/demo/src/routes/flottform-client/[endpointId]/+page.svelte +++ b/servers/demo/src/routes/flottform-client/[endpointId]/+page.svelte @@ -22,7 +22,7 @@ onMount(async () => { const flottformFileInputClient = new FlottformFileInputClient({ endpointId: $page.params.endpointId, - fileInput, + outgoingInputField: fileInput, flottformApi: sdpExchangeServerBase }); @@ -35,13 +35,11 @@ flottformFileInputClient.on('connected', () => { currentState = 'connected'; }); - flottformFileInputClient.on('sending', () => { + flottformFileInputClient.on('file-sending-progress', (p) => { currentState = 'sending'; - }); - flottformFileInputClient.on('progress', (p) => { console.log('progress= ', p); }); - flottformFileInputClient.on('done', () => { + flottformFileInputClient.on('single-file-transfered', () => { currentState = 'done'; }); flottformFileInputClient.on('disconnected', () => { diff --git a/servers/demo/src/routes/multiple-input-form-client/[endpointId]/+page.svelte b/servers/demo/src/routes/multiple-input-form-client/[endpointId]/+page.svelte index 4161a11..22f4e9a 100644 --- a/servers/demo/src/routes/multiple-input-form-client/[endpointId]/+page.svelte +++ b/servers/demo/src/routes/multiple-input-form-client/[endpointId]/+page.svelte @@ -22,7 +22,7 @@ onMount(async () => { const flottformFileInputClient = new FlottformFileInputClient({ endpointId: $page.params.endpointId, - fileInput, + outgoingInputField: fileInput, flottformApi: sdpExchangeServerBase }); @@ -35,10 +35,9 @@ flottformFileInputClient.on('connected', () => { currentState = 'connected'; }); - flottformFileInputClient.on('sending', () => { + + flottformFileInputClient.on('file-sending-progress', (p) => { currentState = 'sending'; - }); - flottformFileInputClient.on('progress', (p) => { console.log('progress= ', p); }); flottformFileInputClient.on('done', () => { diff --git a/servers/demo/src/routes/return-and-complaints-custom-client/[endpointId]/+page.svelte b/servers/demo/src/routes/return-and-complaints-custom-client/[endpointId]/+page.svelte index 5c8dce2..56c8c9f 100644 --- a/servers/demo/src/routes/return-and-complaints-custom-client/[endpointId]/+page.svelte +++ b/servers/demo/src/routes/return-and-complaints-custom-client/[endpointId]/+page.svelte @@ -22,7 +22,7 @@ onMount(async () => { const flottformFileInputClient = new FlottformFileInputClient({ endpointId: $page.params.endpointId, - fileInput, + outgoingInputField: fileInput, flottformApi: sdpExchangeServerBase }); @@ -35,13 +35,11 @@ flottformFileInputClient.on('connected', () => { currentState = 'connected'; }); - flottformFileInputClient.on('sending', () => { + flottformFileInputClient.on('file-sending-progress', (p) => { currentState = 'sending'; - }); - flottformFileInputClient.on('progress', (p) => { console.log('progress= ', p); }); - flottformFileInputClient.on('done', () => { + flottformFileInputClient.on('single-file-transfered', () => { currentState = 'done'; }); flottformFileInputClient.on('disconnected', () => { diff --git a/servers/demo/src/routes/return-and-complaints-custom/+page.svelte b/servers/demo/src/routes/return-and-complaints-custom/+page.svelte index 9d7fd6c..f511e32 100644 --- a/servers/demo/src/routes/return-and-complaints-custom/+page.svelte +++ b/servers/demo/src/routes/return-and-complaints-custom/+page.svelte @@ -166,21 +166,18 @@ flottformDialogDescription = 'Waiting for data channel connection'; }); - flottformFileInputHost.on('receive', () => { + flottformFileInputHost.on('file-receiving-progress', () => { flottformStatusWrapper = 'Receiving data'; flottformDialogDescription = 'Another device is sending data. Waiting for incoming data transfer to complete'; flottformButtonBackgroundColor = 'bg-[#7EA4FF]'; }); - flottformFileInputHost.on('single-file-transferred', (receivedFile) => { + flottformFileInputHost.on('single-file-received', (receivedFile) => { const dt = new DataTransfer(); dt.items.add(receivedFile); fileInput.files = dt.files; console.log(`Received file: ${receivedFile.name} (${receivedFile.size} bytes)`); - }); - - flottformFileInputHost.on('done', () => { flottformStatusWrapper = 'Done!'; flottformDialogDescription = 'You have received a file from another device. Please close this dialog to finish your form.';