@paro.io/expert-shared-components 1.12.2 → 1.12.4
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/lib/components/FileDownloader/index.d.ts +6 -0
- package/lib/components/FileDownloader/index.js +46 -0
- package/lib/components/Invoices/ClientDisputeProjectCard.d.ts +1 -2
- package/lib/components/Invoices/ClientDisputeProjectCard.js +3 -11
- package/lib/components/Invoices/DiscussionSection.js +1 -1
- package/lib/components/Invoices/InvoiceCard.d.ts +1 -2
- package/lib/components/Invoices/InvoiceCard.js +2 -2
- package/lib/components/Invoices/index.d.ts +1 -0
- package/lib/components/Invoices/index.js +3 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.fileDownloader = void 0;
|
|
16
|
+
const DownloadClient_1 = __importDefault(require("../shared/DownloadClient"));
|
|
17
|
+
const utils_1 = require("../shared/utils");
|
|
18
|
+
const fileDownloader = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fileKey, downloadDocumentUrl, }) {
|
|
19
|
+
try {
|
|
20
|
+
(0, utils_1.showToast)("success", "Starting Document Download");
|
|
21
|
+
const downloadClient = new DownloadClient_1.default({
|
|
22
|
+
fileKey,
|
|
23
|
+
downloadDocumentUrl,
|
|
24
|
+
});
|
|
25
|
+
const result = yield downloadClient.downloadDocument();
|
|
26
|
+
if (result instanceof Blob) {
|
|
27
|
+
// Handle Blob (e.g., save to file or display)
|
|
28
|
+
(0, utils_1.showToast)("success", "Document Download Successful");
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
else if (typeof result === "string") {
|
|
32
|
+
// Handle text or JSON response
|
|
33
|
+
(0, utils_1.showToast)("success", "Document Download Successful");
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
throw new Error("Unexpected response type");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error(`Error Downloading File: ${error}`);
|
|
42
|
+
(0, utils_1.showToast)("warning", "Error downloading file. Please try again.");
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
exports.fileDownloader = fileDownloader;
|
|
@@ -3,7 +3,6 @@ interface ClientDisputeProjectCardProps {
|
|
|
3
3
|
updateClientInvoiceDisputeMutation: any;
|
|
4
4
|
documentUploadUrl: string;
|
|
5
5
|
downloadDocumentUrl: string;
|
|
6
|
-
refetchInvoiceDisputes: any;
|
|
7
6
|
}
|
|
8
|
-
export declare const ClientDisputeProjectCard: ({ clientInvoice, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl,
|
|
7
|
+
export declare const ClientDisputeProjectCard: ({ clientInvoice, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, }: ClientDisputeProjectCardProps) => JSX.Element;
|
|
9
8
|
export {};
|
|
@@ -31,9 +31,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
35
|
exports.ClientDisputeProjectCard = void 0;
|
|
39
36
|
const react_1 = __importStar(require("react"));
|
|
@@ -42,7 +39,7 @@ const base_ui_2 = require("@paro.io/base-ui");
|
|
|
42
39
|
const core_1 = require("@material-ui/core");
|
|
43
40
|
const base_icons_1 = require("@paro.io/base-icons");
|
|
44
41
|
const FileUploader_1 = require("../FileUploader");
|
|
45
|
-
const
|
|
42
|
+
const FileDownloader_1 = require("../FileDownloader");
|
|
46
43
|
const useStyles = (0, core_1.makeStyles)((theme) => ({
|
|
47
44
|
root: {
|
|
48
45
|
width: "100%",
|
|
@@ -97,7 +94,7 @@ const ACCEPTED_FILE_TYPES = [
|
|
|
97
94
|
'image/png',
|
|
98
95
|
'text/csv',
|
|
99
96
|
];
|
|
100
|
-
const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl,
|
|
97
|
+
const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, }) => {
|
|
101
98
|
const [expandRow, setExpandRow] = (0, react_1.useState)(null);
|
|
102
99
|
const classes = useStyles();
|
|
103
100
|
const [projects, setProjects] = (0, react_1.useState)(clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.disputeProjects);
|
|
@@ -134,8 +131,7 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
|
|
|
134
131
|
};
|
|
135
132
|
const handleDownloadDocument = (projectId, fileName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
136
133
|
const downloadFileName = `project-${projectId}/${fileName}`;
|
|
137
|
-
const
|
|
138
|
-
const downloadData = yield downloadClient.downloadDocument();
|
|
134
|
+
const downloadData = yield (0, FileDownloader_1.fileDownloader)({ downloadDocumentUrl: downloadDocumentUrl, fileKey: downloadFileName });
|
|
139
135
|
handleDownloadPdf({ fileData: downloadData, downloadFilename: fileName, streamData: true });
|
|
140
136
|
});
|
|
141
137
|
(0, react_1.useEffect)(() => {
|
|
@@ -183,8 +179,6 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
|
|
|
183
179
|
updateClientInvoiceDisputeMutation: updateClientInvoiceDisputeMutation,
|
|
184
180
|
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 : [],
|
|
185
181
|
isExpert: false,
|
|
186
|
-
}).then(() => {
|
|
187
|
-
refetchInvoiceDisputes();
|
|
188
182
|
});
|
|
189
183
|
resolve();
|
|
190
184
|
}
|
|
@@ -227,8 +221,6 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
|
|
|
227
221
|
})),
|
|
228
222
|
}
|
|
229
223
|
}
|
|
230
|
-
}).then(() => {
|
|
231
|
-
refetchInvoiceDisputes();
|
|
232
224
|
});
|
|
233
225
|
}
|
|
234
226
|
catch (error) {
|
|
@@ -61,7 +61,7 @@ const DiscussionSection = ({ disputeId, currentUser, messages, onCreateMessage,
|
|
|
61
61
|
disputeId,
|
|
62
62
|
messageText: newMessage,
|
|
63
63
|
visibility,
|
|
64
|
-
senderId: (_a = currentUser === null || currentUser === void 0 ? void 0 : currentUser.app_metadata) === null || _a === void 0 ? void 0 : _a.userId,
|
|
64
|
+
senderId: isInternal ? (_a = currentUser === null || currentUser === void 0 ? void 0 : currentUser.app_metadata) === null || _a === void 0 ? void 0 : _a.userId : currentUser === null || currentUser === void 0 ? void 0 : currentUser.userId,
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
});
|
|
@@ -7,7 +7,6 @@ interface InvoiceCardProps {
|
|
|
7
7
|
documentUploadUrl: string;
|
|
8
8
|
downloadDocumentUrl: string;
|
|
9
9
|
isInternal?: boolean;
|
|
10
|
-
refetchInvoiceDisputes: any;
|
|
11
10
|
}
|
|
12
|
-
export declare const InvoiceCard: ({ clientInvoice, createDisputeChatMessage, user, chatMessages, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, isInternal,
|
|
11
|
+
export declare const InvoiceCard: ({ clientInvoice, createDisputeChatMessage, user, chatMessages, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, isInternal, }: InvoiceCardProps) => JSX.Element;
|
|
13
12
|
export {};
|
|
@@ -12,7 +12,7 @@ const DisputeSection_1 = require("./DisputeSection");
|
|
|
12
12
|
const DiscussionSection_1 = require("./DiscussionSection");
|
|
13
13
|
const DecisionSection_1 = require("./DecisionSection");
|
|
14
14
|
const ClientDisputeProjectCard_1 = require("./ClientDisputeProjectCard");
|
|
15
|
-
const InvoiceCard = ({ clientInvoice, createDisputeChatMessage, user, chatMessages, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, isInternal = false,
|
|
15
|
+
const InvoiceCard = ({ clientInvoice, createDisputeChatMessage, user, chatMessages, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, isInternal = false, }) => {
|
|
16
16
|
var _a, _b;
|
|
17
17
|
return (react_1.default.createElement(base_ui_1.Card, { className: "w-full bg-white rounded-lg shadow-sm overflow-hidden mb-4" },
|
|
18
18
|
react_1.default.createElement(InvoiceHeader_1.InvoiceHeader, { invoice: clientInvoice }),
|
|
@@ -21,7 +21,7 @@ const InvoiceCard = ({ clientInvoice, createDisputeChatMessage, user, chatMessag
|
|
|
21
21
|
isInternal ?
|
|
22
22
|
react_1.default.createElement(DisputeSection_1.DisputeSection, { dispute: clientInvoice, documentUploadUrl: documentUploadUrl, updateClientInvoiceDisputeMutation: updateClientInvoiceDisputeMutation })
|
|
23
23
|
:
|
|
24
|
-
react_1.default.createElement(ClientDisputeProjectCard_1.ClientDisputeProjectCard, { clientInvoice: clientInvoice, updateClientInvoiceDisputeMutation: updateClientInvoiceDisputeMutation, documentUploadUrl: documentUploadUrl, downloadDocumentUrl: downloadDocumentUrl
|
|
24
|
+
react_1.default.createElement(ClientDisputeProjectCard_1.ClientDisputeProjectCard, { clientInvoice: clientInvoice, updateClientInvoiceDisputeMutation: updateClientInvoiceDisputeMutation, documentUploadUrl: documentUploadUrl, downloadDocumentUrl: downloadDocumentUrl }),
|
|
25
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 })),
|
|
26
26
|
isInternal &&
|
|
27
27
|
react_1.default.createElement(DecisionSection_1.DecisionSection, { dispute: clientInvoice, onUpdateDispute: updateClientInvoiceDisputeMutation }))));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvoiceCard = void 0;
|
|
3
|
+
exports.DiscussionSection = exports.InvoiceCard = void 0;
|
|
4
4
|
var InvoiceCard_1 = require("./InvoiceCard");
|
|
5
5
|
Object.defineProperty(exports, "InvoiceCard", { enumerable: true, get: function () { return InvoiceCard_1.InvoiceCard; } });
|
|
6
|
+
var DiscussionSection_1 = require("./DiscussionSection");
|
|
7
|
+
Object.defineProperty(exports, "DiscussionSection", { enumerable: true, get: function () { return DiscussionSection_1.DiscussionSection; } });
|
package/lib/index.d.ts
CHANGED
|
@@ -13,3 +13,5 @@ export { ActiveProjectCard } from './components/ProjectCard/ActiveProjectCard';
|
|
|
13
13
|
export { InvoiceCard } from './components/Invoices/InvoiceCard';
|
|
14
14
|
export { DiscussionThread } from './components/DiscussionThread';
|
|
15
15
|
export { fileUploader } from './components/FileUploader';
|
|
16
|
+
export { DiscussionSection } from './components/Invoices/DiscussionSection';
|
|
17
|
+
export { fileDownloader } from './components/FileDownloader';
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fileUploader = exports.DiscussionThread = exports.InvoiceCard = exports.ActiveProjectCard = exports.sharedUtils = exports.ServiceLinesTemplate = exports.HeaderNavBar = exports.DocumentCenter = exports.ProfileCompletedPercentage = exports.ExpertProfileHeader = exports.OrganizationChart = exports.FirmEmployeeSection = exports.ClientReferenceSection = exports.Reviews = exports.ReviewsTab = void 0;
|
|
3
|
+
exports.fileDownloader = exports.DiscussionSection = exports.fileUploader = exports.DiscussionThread = exports.InvoiceCard = exports.ActiveProjectCard = exports.sharedUtils = exports.ServiceLinesTemplate = exports.HeaderNavBar = exports.DocumentCenter = exports.ProfileCompletedPercentage = exports.ExpertProfileHeader = exports.OrganizationChart = exports.FirmEmployeeSection = exports.ClientReferenceSection = exports.Reviews = exports.ReviewsTab = void 0;
|
|
4
4
|
var ReviewsTab_1 = require("./components/ReviewsTab");
|
|
5
5
|
Object.defineProperty(exports, "ReviewsTab", { enumerable: true, get: function () { return ReviewsTab_1.ReviewsTab; } });
|
|
6
6
|
var Reviews_1 = require("./components/Reviews");
|
|
@@ -31,3 +31,7 @@ var DiscussionThread_1 = require("./components/DiscussionThread");
|
|
|
31
31
|
Object.defineProperty(exports, "DiscussionThread", { enumerable: true, get: function () { return DiscussionThread_1.DiscussionThread; } });
|
|
32
32
|
var FileUploader_1 = require("./components/FileUploader");
|
|
33
33
|
Object.defineProperty(exports, "fileUploader", { enumerable: true, get: function () { return FileUploader_1.fileUploader; } });
|
|
34
|
+
var DiscussionSection_1 = require("./components/Invoices/DiscussionSection");
|
|
35
|
+
Object.defineProperty(exports, "DiscussionSection", { enumerable: true, get: function () { return DiscussionSection_1.DiscussionSection; } });
|
|
36
|
+
var FileDownloader_1 = require("./components/FileDownloader");
|
|
37
|
+
Object.defineProperty(exports, "fileDownloader", { enumerable: true, get: function () { return FileDownloader_1.fileDownloader; } });
|