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

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.
@@ -8,5 +8,5 @@ interface UploadFileParams {
8
8
  previousFiles: string | string[];
9
9
  isExpert: boolean;
10
10
  }
11
- export declare const fileUploader: ({ file, projectId, documentUploadUrl, updateClientInvoiceDisputeMutation, disputeId, previousFiles, isExpert, }: UploadFileParams) => Promise<boolean>;
11
+ export declare const fileUploader: ({ file, projectId, documentUploadUrl, updateClientInvoiceDisputeMutation, disputeId, previousFiles, isExpert, }: UploadFileParams) => Promise<any>;
12
12
  export {};
@@ -26,11 +26,11 @@ const fileUploader = (_a) => __awaiter(void 0, [_a], void 0, function* ({ file,
26
26
  documentUploadUrl,
27
27
  bucketName: 'expert-client-dispute-files',
28
28
  });
29
- yield uploadClient.triggerMultipartUpload().then((res) => {
29
+ yield uploadClient.triggerMultipartUpload().then((res) => __awaiter(void 0, void 0, void 0, function* () {
30
30
  const resParsed = JSON.parse(res);
31
31
  const documentLink = resParsed === null || resParsed === void 0 ? void 0 : resParsed.Location;
32
32
  documentLinks.push(documentLink); // Add the new file to the documentLinks array
33
- updateClientInvoiceDisputeMutation({
33
+ disputeId && (yield updateClientInvoiceDisputeMutation({
34
34
  variables: {
35
35
  input: {
36
36
  disputeId: disputeId,
@@ -43,11 +43,11 @@ const fileUploader = (_a) => __awaiter(void 0, [_a], void 0, function* ({ file,
43
43
  ]
44
44
  },
45
45
  },
46
- });
46
+ }));
47
47
  console.log(`Multipart File uploaded successfully with ${res}`);
48
48
  (0, utils_1.showToast)('success', 'Document Upload Successful');
49
- });
50
- return true;
49
+ }));
50
+ return documentLinks;
51
51
  }
52
52
  catch (error) {
53
53
  (0, utils_1.showToast)('warning', 'Error uploading file. Please try again.');
@@ -194,7 +194,7 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
194
194
  reader.onloadend = () => __awaiter(void 0, void 0, void 0, function* () {
195
195
  var _a, _b, _c, _d, _e;
196
196
  try {
197
- yield (0, FileUploader_1.fileUploader)({
197
+ const res = yield (0, FileUploader_1.fileUploader)({
198
198
  file: selectedFile,
199
199
  documentName: selectedFile.name,
200
200
  disputeId: clientInvoice.disputeId,
@@ -204,11 +204,20 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
204
204
  previousFiles: (_e = (_d = (_c = clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.disputeProjects) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.clientDocumentLinks) !== null && _e !== void 0 ? _e : [],
205
205
  isExpert: false,
206
206
  });
207
- resolve();
207
+ if (res) {
208
+ setProjects((prevProjects) => prevProjects.map((p) => {
209
+ var _a, _b;
210
+ return p.projectId === ((_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.projectId)
211
+ ? Object.assign(Object.assign({}, p), { clientDocumentLinks: res.join(",") }) : p;
212
+ }));
213
+ }
208
214
  }
209
215
  catch (error) {
210
216
  reject(error);
211
217
  }
218
+ finally {
219
+ resolve();
220
+ }
212
221
  });
213
222
  reader.readAsDataURL(selectedFile);
214
223
  });
@@ -298,7 +307,7 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
298
307
  ((row === null || row === void 0 ? void 0 : row.clientDocumentLinks)
299
308
  ? (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])
300
309
  : []).map((f, index) => (react_1.default.createElement("div", { key: index, className: "m-1" },
301
- react_1.default.createElement(base_ui_1.Tag, { variant: "subtle", color: "success", label: f.split('%2F')[1], onClick: () => {
310
+ react_1.default.createElement(base_ui_1.Tag, { variant: "subtle", color: "success", label: f.split('%2F')[1], iconLeft: react_1.default.createElement(base_icons_1.IconDocumentDownload, { size: "sm" }), onClick: () => {
302
311
  (0, exports.handleDownloadDocument)(row === null || row === void 0 ? void 0 : row.projectId, f.split('%2F')[1], downloadDocumentUrl, bucketName);
303
312
  } })))))))))))));
304
313
  })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paro.io/expert-shared-components",
3
- "version": "1.12.8",
3
+ "version": "1.12.10",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {