@pubuduth-aplicy/chat-ui 2.1.55 → 2.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubuduth-aplicy/chat-ui",
3
- "version": "2.1.55",
3
+ "version": "2.1.56",
4
4
  "description": "This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -14,7 +14,6 @@
14
14
  "dependencies": {
15
15
  "@tanstack/react-query": "^5.67.2",
16
16
  "axios": "^1.8.2",
17
- "file-saver": "^2.0.5",
18
17
  "react": "^19.0.0",
19
18
  "react-dom": "^19.0.0",
20
19
  "react-intersection-observer": "^9.16.0",
@@ -23,7 +22,6 @@
23
22
  },
24
23
  "devDependencies": {
25
24
  "@eslint/js": "^9.21.0",
26
- "@types/file-saver": "^2.0.7",
27
25
  "@types/react": "^19.0.10",
28
26
  "@types/react-dom": "^19.0.4",
29
27
  "@vitejs/plugin-react": "^4.3.4",
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import { MessageStatus } from "../../types/type";
3
3
  import { useChatContext } from "../../providers/ChatProvider";
4
- import { saveAs } from 'file-saver';
5
4
  import { useEffect, useState } from "react";
6
5
  import { FileType } from "../common/FilePreview";
7
6
 
@@ -66,35 +65,23 @@ const Message = ({ message }: MessageProps) => {
66
65
  }
67
66
  };
68
67
 
69
- const handleDownload = (url: string, name: string,index:number) => {
68
+ const handleDownload = async (url: string, name: string, index: number) => {
70
69
  setDownloadingIndex(index);
71
70
  try {
72
- saveAs(url, name);
71
+ const response = await fetch(url);
72
+ const blob = await response.blob();
73
+ const link = document.createElement("a");
74
+ link.href = URL.createObjectURL(blob);
75
+ link.download = name;
76
+ link.click();
77
+ URL.revokeObjectURL(link.href);
73
78
  } catch (error) {
74
79
  console.error("Download failed:", error);
75
80
  } finally {
76
81
  setDownloadingIndex(null);
77
82
  }
78
-
79
83
  };
80
84
 
81
- // const handleDownload = async (url: string, name: string, index: number) => {
82
- // setDownloadingIndex(index);
83
- // try {
84
- // const response = await fetch(url);
85
- // const blob = await response.blob();
86
- // const link = document.createElement("a");
87
- // link.href = URL.createObjectURL(blob);
88
- // link.download = name;
89
- // link.click();
90
- // URL.revokeObjectURL(link.href);
91
- // } catch (error) {
92
- // console.error("Download failed:", error);
93
- // } finally {
94
- // setDownloadingIndex(null);
95
- // }
96
- // };
97
-
98
85
  const renderMedia = () => {
99
86
  if (!message.media || message.media.length === 0) return null;
100
87