@paro.io/expert-shared-components 1.12.6 → 1.12.8

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.
@@ -1,6 +1,7 @@
1
1
  interface DownloadFileParams {
2
2
  fileKey: string;
3
3
  downloadDocumentUrl: string;
4
+ bucketName?: string;
4
5
  }
5
- export declare const fileDownloader: ({ fileKey, downloadDocumentUrl, }: DownloadFileParams) => Promise<Blob | string | null>;
6
+ export declare const fileDownloader: ({ fileKey, downloadDocumentUrl, bucketName, }: DownloadFileParams) => Promise<Blob | string | null>;
6
7
  export {};
@@ -15,12 +15,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.fileDownloader = void 0;
16
16
  const DownloadClient_1 = __importDefault(require("../shared/DownloadClient"));
17
17
  const utils_1 = require("../shared/utils");
18
- const fileDownloader = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fileKey, downloadDocumentUrl, }) {
18
+ const fileDownloader = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fileKey, downloadDocumentUrl, bucketName, }) {
19
19
  try {
20
20
  (0, utils_1.showToast)("success", "Starting Document Download");
21
21
  const downloadClient = new DownloadClient_1.default({
22
22
  fileKey,
23
23
  downloadDocumentUrl,
24
+ bucketName,
24
25
  });
25
26
  const result = yield downloadClient.downloadDocument();
26
27
  if (result instanceof Blob) {
@@ -3,6 +3,8 @@ interface ClientDisputeProjectCardProps {
3
3
  updateClientInvoiceDisputeMutation: any;
4
4
  documentUploadUrl: string;
5
5
  downloadDocumentUrl: string;
6
+ bucketName?: string;
6
7
  }
7
- export declare const ClientDisputeProjectCard: ({ clientInvoice, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, }: ClientDisputeProjectCardProps) => JSX.Element;
8
+ export declare const handleDownloadDocument: (projectId: number, fileName: string, downloadDocumentUrl: string, bucketName: string | undefined) => Promise<void>;
9
+ export declare const ClientDisputeProjectCard: ({ clientInvoice, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, bucketName }: ClientDisputeProjectCardProps) => JSX.Element;
8
10
  export {};
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  });
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.ClientDisputeProjectCard = void 0;
35
+ exports.ClientDisputeProjectCard = exports.handleDownloadDocument = void 0;
36
36
  const react_1 = __importStar(require("react"));
37
37
  const base_ui_1 = require("@paro.io/base-ui");
38
38
  const base_ui_2 = require("@paro.io/base-ui");
@@ -94,7 +94,58 @@ const ACCEPTED_FILE_TYPES = [
94
94
  'image/png',
95
95
  'text/csv',
96
96
  ];
97
- const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, }) => {
97
+ const handleFileDownload = ({ fileData, downloadFilename, streamData, fileType = 'pdf' }) => {
98
+ var _a, _b, _c;
99
+ let byteArray = streamData ? fileData : new Uint8Array();
100
+ if (!streamData) {
101
+ const byteCharacters = atob((_b = (_a = fileData === null || fileData === void 0 ? void 0 : fileData.data) === null || _a === void 0 ? void 0 : _a.getFile) === null || _b === void 0 ? void 0 : _b.data);
102
+ const byteNumbers = new Array(byteCharacters.length);
103
+ for (let i = 0; i < byteCharacters.length; i++) {
104
+ byteNumbers[i] = byteCharacters.charCodeAt(i);
105
+ }
106
+ byteArray = new Uint8Array(byteNumbers);
107
+ }
108
+ // Map file extensions to MIME types
109
+ const mimeTypes = {
110
+ 'pdf': 'application/pdf',
111
+ 'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
112
+ 'xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
113
+ 'csv': 'text/csv',
114
+ 'doc': 'application/msword',
115
+ 'xls': 'application/vnd.ms-excel',
116
+ 'txt': 'text/plain',
117
+ 'png': 'image/png',
118
+ 'jpg': 'image/jpeg',
119
+ 'jpeg': 'image/jpeg'
120
+ };
121
+ // Get the file extension from the filename or use the provided fileType
122
+ const fileExtension = ((_c = downloadFilename.split('.').pop()) === null || _c === void 0 ? void 0 : _c.toLowerCase()) || fileType;
123
+ const mimeType = mimeTypes[fileExtension] || 'application/octet-stream';
124
+ const blob = new Blob([byteArray], { type: mimeType });
125
+ const blobUrl = URL.createObjectURL(blob);
126
+ const downloadLink = document.createElement('a');
127
+ downloadLink.href = blobUrl;
128
+ downloadLink.download = downloadFilename;
129
+ document.body.appendChild(downloadLink);
130
+ downloadLink.click();
131
+ document.body.removeChild(downloadLink);
132
+ URL.revokeObjectURL(blobUrl);
133
+ };
134
+ const handleDownloadDocument = (projectId, fileName, downloadDocumentUrl, bucketName) => __awaiter(void 0, void 0, void 0, function* () {
135
+ var _a;
136
+ // Decode the filename from URL encoding if needed
137
+ const decodedFileName = decodeURIComponent(fileName);
138
+ const downloadFileName = `project-${projectId}/${decodedFileName}`;
139
+ const downloadData = yield (0, FileDownloader_1.fileDownloader)({ downloadDocumentUrl: downloadDocumentUrl, fileKey: downloadFileName, bucketName: bucketName });
140
+ handleFileDownload({
141
+ fileData: downloadData,
142
+ downloadFilename: decodedFileName,
143
+ streamData: true,
144
+ fileType: (_a = decodedFileName.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase()
145
+ });
146
+ });
147
+ exports.handleDownloadDocument = handleDownloadDocument;
148
+ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, bucketName }) => {
98
149
  const [expandRow, setExpandRow] = (0, react_1.useState)(null);
99
150
  const classes = useStyles();
100
151
  const [projects, setProjects] = (0, react_1.useState)(clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.disputeProjects);
@@ -104,36 +155,9 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
104
155
  const [updatingDispute, setUpdatingDispute] = (0, react_1.useState)(false);
105
156
  const [uploadingFile, setUploadingFile] = (0, react_1.useState)(false);
106
157
  const fileInputRef = (0, react_1.useRef)(null);
107
- const handleDownloadPdf = ({ fileData, downloadFilename, streamData }) => {
108
- var _a, _b;
109
- let byteArray = streamData ? fileData : new Uint8Array();
110
- if (!streamData) {
111
- const byteCharacters = atob((_b = (_a = fileData === null || fileData === void 0 ? void 0 : fileData.data) === null || _a === void 0 ? void 0 : _a.getFile) === null || _b === void 0 ? void 0 : _b.data);
112
- const byteNumbers = new Array(byteCharacters.length);
113
- for (let i = 0; i < byteCharacters.length; i++) {
114
- byteNumbers[i] = byteCharacters.charCodeAt(i);
115
- }
116
- byteArray = new Uint8Array(byteNumbers);
117
- }
118
- const blob = new Blob([byteArray], { type: 'application/pdf' });
119
- const blobUrl = URL.createObjectURL(blob);
120
- const newTab = window.open(blobUrl, '_blank');
121
- const downloadLink = document.createElement('a');
122
- downloadLink.href = blobUrl;
123
- downloadLink.download = downloadFilename;
124
- document.body.appendChild(downloadLink);
125
- downloadLink.click();
126
- document.body.removeChild(downloadLink);
127
- URL.revokeObjectURL(blobUrl);
128
- if (newTab) {
129
- newTab.focus();
130
- }
131
- };
132
- const handleDownloadDocument = (projectId, fileName) => __awaiter(void 0, void 0, void 0, function* () {
133
- const downloadFileName = `project-${projectId}/${fileName}`;
134
- const downloadData = yield (0, FileDownloader_1.fileDownloader)({ downloadDocumentUrl: downloadDocumentUrl, fileKey: downloadFileName });
135
- handleDownloadPdf({ fileData: downloadData, downloadFilename: fileName, streamData: true });
136
- });
158
+ (0, react_1.useEffect)(() => {
159
+ setProjects(clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.disputeProjects);
160
+ }, [clientInvoice]);
137
161
  (0, react_1.useEffect)(() => {
138
162
  if (JSON.stringify(clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.disputeProjects) !== JSON.stringify(projects)) {
139
163
  setUpdateDispute(true);
@@ -274,8 +298,8 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
274
298
  ((row === null || row === void 0 ? void 0 : row.clientDocumentLinks)
275
299
  ? (typeof (row === null || row === void 0 ? void 0 : row.clientDocumentLinks) === 'string' ? (_b = row === null || row === void 0 ? void 0 : row.clientDocumentLinks) === null || _b === void 0 ? void 0 : _b.split(',') : [...row === null || row === void 0 ? void 0 : row.clientDocumentLinks])
276
300
  : []).map((f, index) => (react_1.default.createElement("div", { key: index, className: "m-1" },
277
- react_1.default.createElement(base_ui_1.Tag, { variant: "subtle", color: "success", label: f.split('%2F')[1], iconRight: react_1.default.createElement(base_icons_1.IconXCircle, null), onClick: () => {
278
- handleDownloadDocument(row === null || row === void 0 ? void 0 : row.projectId, f.split('%2F')[1]);
301
+ react_1.default.createElement(base_ui_1.Tag, { variant: "subtle", color: "success", label: f.split('%2F')[1], onClick: () => {
302
+ (0, exports.handleDownloadDocument)(row === null || row === void 0 ? void 0 : row.projectId, f.split('%2F')[1], downloadDocumentUrl, bucketName);
279
303
  } })))))))))))));
280
304
  })),
281
305
  updatedDispute && react_1.default.createElement("div", { className: "flex justify-end ml-auto mt-2" },
@@ -1,7 +1,9 @@
1
1
  interface DisputeSectionProps {
2
2
  dispute: any;
3
3
  documentUploadUrl: string;
4
+ downloadDocumentUrl: string;
5
+ bucketName: string;
4
6
  updateClientInvoiceDisputeMutation: (variables: any) => Promise<any>;
5
7
  }
6
- export declare const DisputeSection: ({ dispute, documentUploadUrl, updateClientInvoiceDisputeMutation, }: DisputeSectionProps) => JSX.Element;
8
+ export declare const DisputeSection: ({ dispute, documentUploadUrl, downloadDocumentUrl, bucketName, updateClientInvoiceDisputeMutation, }: DisputeSectionProps) => JSX.Element;
7
9
  export {};
@@ -38,6 +38,7 @@ const base_ui_1 = require("@paro.io/base-ui");
38
38
  const base_icons_1 = require("@paro.io/base-icons");
39
39
  const FileUploader_1 = require("../FileUploader");
40
40
  const core_1 = require("@material-ui/core");
41
+ const ClientDisputeProjectCard_1 = require("./ClientDisputeProjectCard");
41
42
  const ACCEPTED_FILE_TYPES = [
42
43
  'application/pdf',
43
44
  'application/msword',
@@ -46,12 +47,14 @@ const ACCEPTED_FILE_TYPES = [
46
47
  'image/png',
47
48
  'text/csv',
48
49
  ];
49
- const DisputeSection = ({ dispute, documentUploadUrl, updateClientInvoiceDisputeMutation, }) => {
50
+ const DisputeSection = ({ dispute, documentUploadUrl, downloadDocumentUrl, bucketName, updateClientInvoiceDisputeMutation, }) => {
50
51
  var _a, _b, _c;
51
- const fileInputRef = (0, react_1.useRef)(null);
52
+ const expertFileInputRef = (0, react_1.useRef)(null);
53
+ const clientFileInputRef = (0, react_1.useRef)(null);
52
54
  const disputeProject = (_a = dispute === null || dispute === void 0 ? void 0 : dispute.disputeProjects) === null || _a === void 0 ? void 0 : _a[0];
53
55
  const clientDocumentLinks = (_b = disputeProject === null || disputeProject === void 0 ? void 0 : disputeProject.clientDocumentLinks) === null || _b === void 0 ? void 0 : _b.split(',');
54
56
  const expertDocumentLinks = (_c = disputeProject === null || disputeProject === void 0 ? void 0 : disputeProject.expertDocumentLinks) === null || _c === void 0 ? void 0 : _c.split(',');
57
+ const projectId = disputeProject === null || disputeProject === void 0 ? void 0 : disputeProject.projectId;
55
58
  const validateFileUpload = (file) => {
56
59
  return ACCEPTED_FILE_TYPES.includes(file.type);
57
60
  };
@@ -86,8 +89,11 @@ const DisputeSection = ({ dispute, documentUploadUrl, updateClientInvoiceDispute
86
89
  reader.readAsDataURL(selectedFile);
87
90
  });
88
91
  }
89
- if (fileInputRef.current) {
90
- fileInputRef.current.value = '';
92
+ if (expertFileInputRef.current) {
93
+ expertFileInputRef.current.value = '';
94
+ }
95
+ if (clientFileInputRef.current) {
96
+ clientFileInputRef.current.value = '';
91
97
  }
92
98
  };
93
99
  return (react_1.default.createElement("div", { className: "grid grid-cols-2 gap-6" },
@@ -104,17 +110,19 @@ const DisputeSection = ({ dispute, documentUploadUrl, updateClientInvoiceDispute
104
110
  react_1.default.createElement("div", null,
105
111
  react_1.default.createElement("div", { className: "text-sm font-bold text-[#333333] mb-2" }, "Supporting Documents:"),
106
112
  react_1.default.createElement("div", { className: "flex flex-wrap gap-2" },
107
- react_1.default.createElement("input", { ref: fileInputRef, type: "file", multiple: true, accept: ACCEPTED_FILE_TYPES.join(','), className: "hidden", onChange: (e) => handleUpload(e, false) }),
108
- react_1.default.createElement("div", { className: "flex flex-wrap gap-2" }, expertDocumentLinks === null || expertDocumentLinks === void 0 ? void 0 : expertDocumentLinks.map((file, index) => (
113
+ react_1.default.createElement("input", { ref: clientFileInputRef, type: "file", multiple: true, accept: ACCEPTED_FILE_TYPES.join(','), className: "hidden", onChange: (e) => handleUpload(e, false) }),
114
+ react_1.default.createElement("div", { className: "flex flex-wrap gap-2" }, clientDocumentLinks === null || clientDocumentLinks === void 0 ? void 0 : clientDocumentLinks.map((file, index) => (
109
115
  // @ts-ignore
110
- react_1.default.createElement(core_1.Chip, { key: index, label: file.split('%2F').pop(), variant: "outlined", onClick: () => { window.open(file, '_blank'); }, sx: {
116
+ react_1.default.createElement(core_1.Chip, { key: index, label: file.split('%2F').pop(), variant: "outlined", onClick: () => {
117
+ (0, ClientDisputeProjectCard_1.handleDownloadDocument)(projectId, file.split('%2F')[1], downloadDocumentUrl, bucketName);
118
+ }, sx: {
111
119
  '&:hover': {
112
120
  cursor: 'pointer',
113
121
  backgroundColor: 'rgba(76, 175, 80, 0.1)'
114
122
  }
115
123
  } })))),
116
124
  react_1.default.createElement("div", { className: "w-full mt-2" },
117
- react_1.default.createElement(base_ui_1.Button, { label: "Add File", iconLeft: react_1.default.createElement(base_icons_1.IconPlus, { size: "sm" }), onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, size: "sm", color: "info", className: "bg-white border border-[#248384] text-[#248384]" })))))),
125
+ react_1.default.createElement(base_ui_1.Button, { label: "Add File", iconLeft: react_1.default.createElement(base_icons_1.IconPlus, { size: "sm" }), onClick: () => { var _a; return (_a = clientFileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, size: "sm", color: "info", className: "bg-white border border-[#248384] text-[#248384]" })))))),
118
126
  react_1.default.createElement("div", { className: "space-y-4" },
119
127
  react_1.default.createElement("div", { className: "flex items-center justify-between" },
120
128
  react_1.default.createElement("div", { className: "text-lg font-bold text-[#333333]" }, "Expert Rebuttal")),
@@ -125,16 +133,18 @@ const DisputeSection = ({ dispute, documentUploadUrl, updateClientInvoiceDispute
125
133
  react_1.default.createElement("div", null,
126
134
  react_1.default.createElement("div", { className: "text-sm font-bold text-[#333333] mb-2" }, "Supporting Documents:"),
127
135
  react_1.default.createElement("div", { className: "flex flex-wrap gap-2" },
128
- react_1.default.createElement("input", { ref: fileInputRef, type: "file", multiple: true, accept: ACCEPTED_FILE_TYPES.join(','), className: "hidden", onChange: (e) => handleUpload(e, true) }),
129
- react_1.default.createElement("div", { className: "flex flex-wrap gap-2" }, clientDocumentLinks === null || clientDocumentLinks === void 0 ? void 0 : clientDocumentLinks.map((file, index) => (
136
+ react_1.default.createElement("input", { ref: expertFileInputRef, type: "file", multiple: true, accept: ACCEPTED_FILE_TYPES.join(','), className: "hidden", onChange: (e) => handleUpload(e, true) }),
137
+ react_1.default.createElement("div", { className: "flex flex-wrap gap-2" }, expertDocumentLinks === null || expertDocumentLinks === void 0 ? void 0 : expertDocumentLinks.map((file, index) => (
130
138
  // @ts-ignore
131
- react_1.default.createElement(core_1.Chip, { key: index, label: file.split('%2F').pop(), variant: "outlined", onClick: () => { window.open(file, '_blank'); }, sx: {
139
+ react_1.default.createElement(core_1.Chip, { key: index, label: file.split('%2F').pop(), variant: "outlined", onClick: () => {
140
+ (0, ClientDisputeProjectCard_1.handleDownloadDocument)(projectId, file.split('%2F')[1], downloadDocumentUrl, bucketName);
141
+ }, sx: {
132
142
  '&:hover': {
133
143
  cursor: 'pointer',
134
144
  backgroundColor: 'rgba(76, 175, 80, 0.1)'
135
145
  }
136
146
  } })))),
137
147
  react_1.default.createElement("div", { className: "w-full mt-2" },
138
- react_1.default.createElement(base_ui_1.Button, { label: "Add File", iconLeft: react_1.default.createElement(base_icons_1.IconPlus, { size: "sm" }), onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, size: "sm", color: "info", className: "bg-white border border-[#248384] text-[#248384]" }))))))));
148
+ react_1.default.createElement(base_ui_1.Button, { label: "Add File", iconLeft: react_1.default.createElement(base_icons_1.IconPlus, { size: "sm" }), onClick: () => { var _a; return (_a = expertFileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, size: "sm", color: "info", className: "bg-white border border-[#248384] text-[#248384]" }))))))));
139
149
  };
140
150
  exports.DisputeSection = DisputeSection;
@@ -7,6 +7,7 @@ interface InvoiceCardProps {
7
7
  documentUploadUrl: string;
8
8
  downloadDocumentUrl: string;
9
9
  isInternal?: boolean;
10
+ bucketName?: string;
10
11
  }
11
- export declare const InvoiceCard: ({ clientInvoice, createDisputeChatMessage, user, chatMessages, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, isInternal, }: InvoiceCardProps) => JSX.Element;
12
+ export declare const InvoiceCard: ({ clientInvoice, createDisputeChatMessage, user, chatMessages, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, isInternal, bucketName }: InvoiceCardProps) => JSX.Element;
12
13
  export {};
@@ -1,10 +1,30 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
4
24
  };
5
25
  Object.defineProperty(exports, "__esModule", { value: true });
6
26
  exports.InvoiceCard = void 0;
7
- const react_1 = __importDefault(require("react"));
27
+ const react_1 = __importStar(require("react"));
8
28
  const base_ui_1 = require("@paro.io/base-ui");
9
29
  const InvoiceHeader_1 = require("./InvoiceHeader");
10
30
  const InvoiceDetails_1 = require("./InvoiceDetails");
@@ -12,18 +32,22 @@ const DisputeSection_1 = require("./DisputeSection");
12
32
  const DiscussionSection_1 = require("./DiscussionSection");
13
33
  const DecisionSection_1 = require("./DecisionSection");
14
34
  const ClientDisputeProjectCard_1 = require("./ClientDisputeProjectCard");
15
- const InvoiceCard = ({ clientInvoice, createDisputeChatMessage, user, chatMessages, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, isInternal = false, }) => {
35
+ const InvoiceCard = ({ clientInvoice, createDisputeChatMessage, user, chatMessages, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, isInternal = false, bucketName }) => {
16
36
  var _a, _b;
37
+ const [currentInvoice, setCurrentInvoice] = (0, react_1.useState)(clientInvoice);
38
+ (0, react_1.useEffect)(() => {
39
+ setCurrentInvoice(clientInvoice);
40
+ }, [clientInvoice]);
17
41
  return (react_1.default.createElement(base_ui_1.Card, { className: "w-full bg-white rounded-lg shadow-sm overflow-hidden mb-4" },
18
- react_1.default.createElement(InvoiceHeader_1.InvoiceHeader, { invoice: clientInvoice }),
42
+ react_1.default.createElement(InvoiceHeader_1.InvoiceHeader, { invoice: currentInvoice }),
19
43
  react_1.default.createElement("div", { className: "p-6 space-y-6" },
20
- react_1.default.createElement(InvoiceDetails_1.InvoiceDetails, { invoice: clientInvoice, isInternal: isInternal }),
44
+ react_1.default.createElement(InvoiceDetails_1.InvoiceDetails, { invoice: currentInvoice, isInternal: isInternal }),
21
45
  isInternal ?
22
- react_1.default.createElement(DisputeSection_1.DisputeSection, { dispute: clientInvoice, documentUploadUrl: documentUploadUrl, updateClientInvoiceDisputeMutation: updateClientInvoiceDisputeMutation })
46
+ react_1.default.createElement(DisputeSection_1.DisputeSection, { dispute: currentInvoice, documentUploadUrl: documentUploadUrl, updateClientInvoiceDisputeMutation: updateClientInvoiceDisputeMutation, downloadDocumentUrl: downloadDocumentUrl, bucketName: bucketName })
23
47
  :
24
- react_1.default.createElement(ClientDisputeProjectCard_1.ClientDisputeProjectCard, { clientInvoice: clientInvoice, updateClientInvoiceDisputeMutation: updateClientInvoiceDisputeMutation, documentUploadUrl: documentUploadUrl, downloadDocumentUrl: downloadDocumentUrl }),
25
- (clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.chatEnabled) && (react_1.default.createElement(DiscussionSection_1.DiscussionSection, { disputeId: (_b = (_a = clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.disputeProjects) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.id, currentUser: user, messages: chatMessages, onCreateMessage: createDisputeChatMessage, isInternal: isInternal })),
48
+ react_1.default.createElement(ClientDisputeProjectCard_1.ClientDisputeProjectCard, { clientInvoice: currentInvoice, updateClientInvoiceDisputeMutation: updateClientInvoiceDisputeMutation, documentUploadUrl: documentUploadUrl, downloadDocumentUrl: downloadDocumentUrl, bucketName: bucketName }),
49
+ (currentInvoice === null || currentInvoice === void 0 ? void 0 : currentInvoice.chatEnabled) && (react_1.default.createElement(DiscussionSection_1.DiscussionSection, { disputeId: (_b = (_a = currentInvoice === null || currentInvoice === void 0 ? void 0 : currentInvoice.disputeProjects) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.id, currentUser: user, messages: chatMessages, onCreateMessage: createDisputeChatMessage, isInternal: isInternal })),
26
50
  isInternal &&
27
- react_1.default.createElement(DecisionSection_1.DecisionSection, { dispute: clientInvoice, onUpdateDispute: updateClientInvoiceDisputeMutation }))));
51
+ react_1.default.createElement(DecisionSection_1.DecisionSection, { dispute: currentInvoice, onUpdateDispute: updateClientInvoiceDisputeMutation }))));
28
52
  };
29
53
  exports.InvoiceCard = InvoiceCard;
@@ -1,6 +1,7 @@
1
1
  export default class DownloadClient {
2
2
  fileKey: string;
3
3
  downloadDocumentUrl: string;
4
+ bucketName: string;
4
5
  constructor(props: any);
5
6
  downloadDocument(): Promise<any>;
6
7
  }
@@ -13,13 +13,14 @@ class DownloadClient {
13
13
  constructor(props) {
14
14
  this.downloadDocumentUrl = props.downloadDocumentUrl;
15
15
  this.fileKey = props.fileKey;
16
+ this.bucketName = props.bucketName;
16
17
  }
17
18
  downloadDocument() {
18
19
  return __awaiter(this, void 0, void 0, function* () {
19
20
  try {
20
21
  const response = yield fetch(`${this.downloadDocumentUrl}`, {
21
22
  method: 'POST',
22
- body: JSON.stringify({ key: this.fileKey }),
23
+ body: JSON.stringify({ key: this.fileKey, bucketName: this.bucketName }),
23
24
  });
24
25
  if (!response.body) {
25
26
  throw new Error('ReadableStream not supported in this environment.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paro.io/expert-shared-components",
3
- "version": "1.12.6",
3
+ "version": "1.12.8",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {