@buerokratt-ria/common-gui-components 0.0.54 → 0.0.56

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/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ All changes to this project will be documented in this file.
4
4
 
5
5
  ## Template [MajorVersion.MediterraneanVersion.MinorVersion] - DD-MM-YYYY
6
6
 
7
+ ## [0.0.56] - 13.05.2026
8
+
9
+ - Fixed file downloads to run inside an iframe to avoid parent app navigation and beforeunload logout handling for cross-origin signed URLs.
10
+
11
+ ## [0.0.55] - 12.05.2026
12
+
13
+ - Fixed chat history download response typing
14
+
7
15
  ## [0.0.54] - 07.05.2026
8
16
 
9
17
  - Remove authenticated person fields for filtering
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerokratt-ria/common-gui-components",
3
- "version": "0.0.54",
3
+ "version": "0.0.56",
4
4
  "description": "Common GUI components and pre defined templates.",
5
5
  "main": "index.ts",
6
6
  "author": "ExiRai",
package/services/file.ts CHANGED
@@ -2,10 +2,29 @@ export const saveFile = async (
2
2
  fileUrl: string,
3
3
  fileName: `${string}.${string}`,
4
4
  ) => {
5
- const a = document.createElement('a');
5
+ const iframe = document.createElement('iframe');
6
+ // Cross-origin signed URLs can ignore the download attribute and navigate instead.
7
+ // Running the click inside an iframe keeps that navigation away from the parent app.
8
+ // This avoids triggering the parent app's beforeunload handler during file downloads.
9
+ iframe.title = 'File download';
10
+ iframe.dataset.fileDownloadFrame = 'true';
11
+ iframe.style.display = 'none';
12
+ document.body.appendChild(iframe);
13
+
14
+ const iframeDocument = iframe.contentDocument;
15
+
16
+ if (!iframeDocument) {
17
+ iframe.remove();
18
+ return;
19
+ }
20
+
21
+ const a = iframeDocument.createElement('a');
6
22
  a.href = fileUrl;
7
23
  a.download = fileName;
8
- document.body.appendChild(a);
24
+ iframeDocument.body.appendChild(a);
9
25
  a.click();
10
- a.remove();
26
+
27
+ setTimeout(() => {
28
+ iframe.remove();
29
+ }, 1000);
11
30
  };
@@ -1048,7 +1048,13 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1048
1048
  : endedChatsColumns.filter((col) => col.id && col.id !== 'detail');
1049
1049
  const columnIds = activeColumns.map((col) => col.id!);
1050
1050
 
1051
- const response = await apiDevEnded.post('chats/ended/download', {
1051
+ const response = await apiDevEnded.post<{
1052
+ readonly response: {
1053
+ readonly data: {
1054
+ readonly url: string;
1055
+ };
1056
+ };
1057
+ }>('chats/ended/download', {
1052
1058
  headers,
1053
1059
  columnIds,
1054
1060
  language: i18n.language,
@@ -1058,8 +1064,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1058
1064
  sorting: sortBy,
1059
1065
  search,
1060
1066
  });
1061
-
1062
- const downloadData = response.data.data ?? response.data;
1067
+ const downloadData = response.data.response.data;
1063
1068
 
1064
1069
  await saveFile(
1065
1070
  downloadData.url,