@paro.io/expert-shared-components 1.12.43 → 1.12.45
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/Escalations/EscalationChat.js +7 -7
- package/lib/components/Escalations/EscalationIssueCard.js +5 -3
- package/lib/components/Escalations/EscalationRespondForm.js +4 -1
- package/lib/components/Escalations/EscalationSubmitForm.js +8 -5
- package/lib/components/Escalations/Escalations.js +14 -2
- package/lib/components/FileUploader/index.js +0 -29
- package/lib/components/shared/UploadClient.js +0 -2
- package/package.json +1 -1
|
@@ -60,7 +60,7 @@ const EscalationChat = ({ activeChatIssue, showEscalationChat, setShowEscalation
|
|
|
60
60
|
return new Promise((resolve, reject) => {
|
|
61
61
|
const reader = new FileReader();
|
|
62
62
|
reader.onloadend = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
-
var _a;
|
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
64
64
|
try {
|
|
65
65
|
const res = yield (0, FileUploader_1.fileUploader)({
|
|
66
66
|
file: selectedFile,
|
|
@@ -73,11 +73,11 @@ const EscalationChat = ({ activeChatIssue, showEscalationChat, setShowEscalation
|
|
|
73
73
|
uploadExpertClientFiles: uploadExpertClientFiles,
|
|
74
74
|
createProjectEscalation: createProjectEscalation,
|
|
75
75
|
extraData: {
|
|
76
|
-
clientId: activeChatIssue.client.id,
|
|
77
|
-
clientName: activeChatIssue.client.name,
|
|
78
|
-
email: isExpert ?
|
|
79
|
-
freelancerId: activeChatIssue.freelancer.id,
|
|
80
|
-
freelancerName: (
|
|
76
|
+
clientId: (_a = activeChatIssue.client.id) !== null && _a !== void 0 ? _a : 0,
|
|
77
|
+
clientName: (_b = activeChatIssue.client.name) !== null && _b !== void 0 ? _b : '',
|
|
78
|
+
email: isExpert ? (_e = (_d = (_c = activeChatIssue === null || activeChatIssue === void 0 ? void 0 : activeChatIssue.client) === null || _c === void 0 ? void 0 : _c.primaryContact) === null || _d === void 0 ? void 0 : _d.email) !== null && _e !== void 0 ? _e : '' : (_f = user === null || user === void 0 ? void 0 : user.email) !== null && _f !== void 0 ? _f : '',
|
|
79
|
+
freelancerId: (_g = activeChatIssue.freelancer.id) !== null && _g !== void 0 ? _g : 0,
|
|
80
|
+
freelancerName: (_h = activeChatIssue.freelancer.name) !== null && _h !== void 0 ? _h : '',
|
|
81
81
|
projectName: activeChatIssue.projectDetails.length > 0 ? activeChatIssue.projectDetails[0].projectName : '',
|
|
82
82
|
}
|
|
83
83
|
});
|
|
@@ -86,7 +86,7 @@ const EscalationChat = ({ activeChatIssue, showEscalationChat, setShowEscalation
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
catch (error) {
|
|
89
|
-
|
|
89
|
+
console.error("faile upload failed", error);
|
|
90
90
|
}
|
|
91
91
|
finally {
|
|
92
92
|
resolve();
|
|
@@ -8,6 +8,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const base_ui_1 = require("@paro.io/base-ui");
|
|
9
9
|
const ClientDisputeProjectCard_1 = require("../Invoices/ClientDisputeProjectCard");
|
|
10
10
|
const base_icons_1 = require("@paro.io/base-icons");
|
|
11
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
11
12
|
const getBackgroundColor = (type) => {
|
|
12
13
|
switch (type) {
|
|
13
14
|
case 'Critical':
|
|
@@ -39,10 +40,11 @@ const EscalationIssueCard = ({ issues, isExpert, openEscalationChat, showRespond
|
|
|
39
40
|
: '';
|
|
40
41
|
const docs = [issue.expertSupportingDocuments, issue.clientSupportingDocuments, issue.internalSupportingDocuments];
|
|
41
42
|
const processedDocs = docs
|
|
42
|
-
.filter(doc => doc !== null && doc !== undefined && doc !== '')
|
|
43
|
+
.filter(doc => doc !== null && doc !== undefined && doc !== '' && doc !== "NULL")
|
|
43
44
|
.flatMap(doc => doc.split(','))
|
|
44
45
|
.map(doc => doc.trim())
|
|
45
|
-
.filter(doc => doc !== '');
|
|
46
|
+
.filter(doc => doc !== '' || doc !== "NULL");
|
|
47
|
+
console.log({ processedDocs, docs });
|
|
46
48
|
return (react_1.default.createElement("div", { key: issue.id, className: "border border-gray-200 rounded-lg bg-white p-4" },
|
|
47
49
|
react_1.default.createElement("div", { className: "flex items-center justify-between mb-3" },
|
|
48
50
|
react_1.default.createElement("div", { className: "flex-1 ml-2" },
|
|
@@ -61,7 +63,7 @@ const EscalationIssueCard = ({ issues, isExpert, openEscalationChat, showRespond
|
|
|
61
63
|
react_1.default.createElement("span", { className: "font-bold" }, issue.submittedByUser.firstName + " " + issue.submittedByUser.lastName),
|
|
62
64
|
issue.createdAt && react_1.default.createElement(react_1.default.Fragment, null,
|
|
63
65
|
" \u2022 Submitted on: ",
|
|
64
|
-
react_1.default.createElement("span", { className: "font-bold" }, issue.createdAt)))),
|
|
66
|
+
react_1.default.createElement("span", { className: "font-bold" }, (0, dayjs_1.default)(issue.createdAt).format("MM-DD-YYYY"))))),
|
|
65
67
|
react_1.default.createElement("div", { className: "text-sm text-gray-600 mb-3" }, issue.outcome),
|
|
66
68
|
processedDocs && processedDocs.length > 0 && (react_1.default.createElement("div", { className: "flex flex-wrap gap-2" },
|
|
67
69
|
react_1.default.createElement("span", { className: "text-sm font-bold text-gray-500 items-center" }, "Supporting Documents: "),
|
|
@@ -38,6 +38,7 @@ const base_icons_1 = require("@paro.io/base-icons");
|
|
|
38
38
|
const base_ui_1 = require("@paro.io/base-ui");
|
|
39
39
|
const FileUploader_1 = require("../FileUploader");
|
|
40
40
|
const EscalationIssueCard_1 = require("./EscalationIssueCard");
|
|
41
|
+
const utils_1 = require("../shared/utils");
|
|
41
42
|
exports.ACCEPTED_FILE_TYPES = [
|
|
42
43
|
'application/pdf',
|
|
43
44
|
'application/msword',
|
|
@@ -122,7 +123,7 @@ const EscalationRespondForm = ({ goBack, selectedIssue, documentUploadUrl, downl
|
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
catch (error) {
|
|
125
|
-
|
|
126
|
+
console.error("Failed to upload file", error);
|
|
126
127
|
}
|
|
127
128
|
finally {
|
|
128
129
|
resolve();
|
|
@@ -155,9 +156,11 @@ const EscalationRespondForm = ({ goBack, selectedIssue, documentUploadUrl, downl
|
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
});
|
|
159
|
+
(0, utils_1.showToast)("success", "Response submitted!");
|
|
158
160
|
}
|
|
159
161
|
catch (error) {
|
|
160
162
|
console.error("Failed to send response!", error);
|
|
163
|
+
(0, utils_1.showToast)("warning", "Failed to update response!");
|
|
161
164
|
}
|
|
162
165
|
finally {
|
|
163
166
|
setSubmitting(false);
|
|
@@ -113,6 +113,7 @@ const EscalationSubmitForm = ({ goBack, goHome, expertsOrClients, projects, docu
|
|
|
113
113
|
return new Promise((resolve, reject) => {
|
|
114
114
|
const reader = new FileReader();
|
|
115
115
|
reader.onloadend = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
116
117
|
try {
|
|
117
118
|
const res = yield (0, FileUploader_1.fileUploader)({
|
|
118
119
|
file: selectedFile,
|
|
@@ -125,11 +126,11 @@ const EscalationSubmitForm = ({ goBack, goHome, expertsOrClients, projects, docu
|
|
|
125
126
|
uploadExpertClientFiles: uploadExpertClientFiles,
|
|
126
127
|
createProjectEscalation: createProjectEscalation,
|
|
127
128
|
extraData: {
|
|
128
|
-
clientId: isExpert ? selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.id : user === null || user === void 0 ? void 0 : user.userId,
|
|
129
|
-
clientName: isExpert ? selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.name : user === null || user === void 0 ? void 0 : user.name,
|
|
130
|
-
email: isExpert ?
|
|
131
|
-
freelancerId: isExpert ? user === null || user === void 0 ? void 0 : user.userId : selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.id,
|
|
132
|
-
freelancerName: isExpert ? user === null || user === void 0 ? void 0 : user.name : selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.name,
|
|
129
|
+
clientId: isExpert ? (_a = selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.id) !== null && _a !== void 0 ? _a : 0 : (_b = user === null || user === void 0 ? void 0 : user.userId) !== null && _b !== void 0 ? _b : 0,
|
|
130
|
+
clientName: isExpert ? (_c = selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.name) !== null && _c !== void 0 ? _c : '' : (_d = user === null || user === void 0 ? void 0 : user.name) !== null && _d !== void 0 ? _d : '',
|
|
131
|
+
email: isExpert ? (_f = (_e = selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.primaryContact) === null || _e === void 0 ? void 0 : _e.email) !== null && _f !== void 0 ? _f : '' : (_g = user === null || user === void 0 ? void 0 : user.email) !== null && _g !== void 0 ? _g : '',
|
|
132
|
+
freelancerId: isExpert ? (_h = user === null || user === void 0 ? void 0 : user.userId) !== null && _h !== void 0 ? _h : 0 : (_j = selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.id) !== null && _j !== void 0 ? _j : 0,
|
|
133
|
+
freelancerName: isExpert ? (_k = user === null || user === void 0 ? void 0 : user.name) !== null && _k !== void 0 ? _k : '' : (_l = selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.name) !== null && _l !== void 0 ? _l : '',
|
|
133
134
|
projectName: selectedProjects.length > 0 ? selectedProjects[0].name : '',
|
|
134
135
|
}
|
|
135
136
|
});
|
|
@@ -196,9 +197,11 @@ const EscalationSubmitForm = ({ goBack, goHome, expertsOrClients, projects, docu
|
|
|
196
197
|
input: formData
|
|
197
198
|
}
|
|
198
199
|
});
|
|
200
|
+
(0, utils_1.showToast)("success", "Escalation created successfully!");
|
|
199
201
|
}
|
|
200
202
|
catch (error) {
|
|
201
203
|
console.error("Failed to create an escalation!", error);
|
|
204
|
+
(0, utils_1.showToast)("warning", "Failed to create escalation!");
|
|
202
205
|
}
|
|
203
206
|
finally {
|
|
204
207
|
setSubmitting(false);
|
|
@@ -44,10 +44,22 @@ const Escalations = ({ expertsOrClients, projects, isExpert = false, escalations
|
|
|
44
44
|
const [selectedProject, setSelectedProject] = (0, react_1.useState)(null);
|
|
45
45
|
const [selectedIssueId, setSelectedIssueId] = (0, react_1.useState)(null); // using selectedIssueId 0 for new escalation submission
|
|
46
46
|
const [showEscalationChat, setShowEscalationChat] = (0, react_1.useState)(false);
|
|
47
|
-
const [activeChatIssue, setActiveChatIssue] = (0, react_1.useState)(null);
|
|
47
|
+
const [activeChatIssue, setActiveChatIssue] = (0, react_1.useState)(null);
|
|
48
48
|
const [activeEscalationTab, setActiveEscalationTab] = (0, react_1.useState)('action-required');
|
|
49
49
|
const [showSuspensionModal, setShowSuspensionModal] = (0, react_1.useState)(false);
|
|
50
|
-
const activeIssues = escalations.filter(issue => {
|
|
50
|
+
const activeIssues = escalations.filter(issue => {
|
|
51
|
+
var _a;
|
|
52
|
+
const userTypeId = (_a = issue === null || issue === void 0 ? void 0 : issue.submittedByUser) === null || _a === void 0 ? void 0 : _a.userTypeId;
|
|
53
|
+
const internalEscalationTo = issue === null || issue === void 0 ? void 0 : issue.internalEscalationTo;
|
|
54
|
+
const status = issue === null || issue === void 0 ? void 0 : issue.status;
|
|
55
|
+
// Determine if this issue should be shown to the current user
|
|
56
|
+
const isRelevantEscalation = (isExpert
|
|
57
|
+
? (internalEscalationTo === 'expert' || internalEscalationTo === 'both')
|
|
58
|
+
: (internalEscalationTo === 'client' || internalEscalationTo === 'both'));
|
|
59
|
+
return ((userTypeId !== user.userTypeId ||
|
|
60
|
+
(userTypeId === 2 && isRelevantEscalation)) &&
|
|
61
|
+
status === 'InProgress');
|
|
62
|
+
});
|
|
51
63
|
const inProgressIssues = escalations.filter(issue => { var _a; return ((_a = issue === null || issue === void 0 ? void 0 : issue.submittedByUser) === null || _a === void 0 ? void 0 : _a.userTypeId) === user.userTypeId && (issue === null || issue === void 0 ? void 0 : issue.status) === 'InProgress'; });
|
|
52
64
|
const resolvedIssues = escalations.filter(issue => (issue === null || issue === void 0 ? void 0 : issue.status) === 'Resolved');
|
|
53
65
|
const goBack = () => {
|
|
@@ -16,26 +16,6 @@ exports.fileUploader = void 0;
|
|
|
16
16
|
const UploadClient_1 = __importDefault(require("../shared/UploadClient"));
|
|
17
17
|
const utils_1 = require("../shared/utils");
|
|
18
18
|
const fileUploader = (_a) => __awaiter(void 0, [_a], void 0, function* ({ file, projectId, documentUploadUrl, updateClientInvoiceDisputeMutation, updateProjectEscalation, uploadExpertClientFiles, createProjectEscalation, bucketName, disputeId, escalationId, escalationNumber, previousFiles, isExpert, extraData, }) {
|
|
19
|
-
console.log("input params here in file uploader is ", {
|
|
20
|
-
file,
|
|
21
|
-
disputeId,
|
|
22
|
-
escalationId,
|
|
23
|
-
projectId,
|
|
24
|
-
documentUploadUrl,
|
|
25
|
-
bucketName,
|
|
26
|
-
updateClientInvoiceDisputeMutation,
|
|
27
|
-
updateProjectEscalation,
|
|
28
|
-
uploadExpertClientFiles,
|
|
29
|
-
createProjectEscalation,
|
|
30
|
-
previousFiles,
|
|
31
|
-
isExpert,
|
|
32
|
-
extraData,
|
|
33
|
-
});
|
|
34
|
-
// Add these debug logs
|
|
35
|
-
console.log("escalationId exists?", !!escalationId);
|
|
36
|
-
console.log("escalationId value:", escalationId);
|
|
37
|
-
console.log("updateProjectEscalation exists?", !!updateProjectEscalation);
|
|
38
|
-
console.log("typeof updateProjectEscalation:", typeof updateProjectEscalation);
|
|
39
19
|
const documentLinks = previousFiles ? (typeof previousFiles === 'string' ? previousFiles.split(',') : [...previousFiles]) : [];
|
|
40
20
|
try {
|
|
41
21
|
(0, utils_1.showToast)('success', 'Starting Document Upload');
|
|
@@ -51,7 +31,6 @@ const fileUploader = (_a) => __awaiter(void 0, [_a], void 0, function* ({ file,
|
|
|
51
31
|
const resParsed = JSON.parse(res);
|
|
52
32
|
const documentLink = resParsed === null || resParsed === void 0 ? void 0 : resParsed.Location;
|
|
53
33
|
documentLinks.push(documentLink); // Add the new file to the documentLinks array
|
|
54
|
-
console.log("document links are ", documentLinks);
|
|
55
34
|
const promises = [];
|
|
56
35
|
if (disputeId) {
|
|
57
36
|
promises.push(updateClientInvoiceDisputeMutation({
|
|
@@ -69,11 +48,7 @@ const fileUploader = (_a) => __awaiter(void 0, [_a], void 0, function* ({ file,
|
|
|
69
48
|
},
|
|
70
49
|
}));
|
|
71
50
|
}
|
|
72
|
-
console.log("Escalation id is ", escalationId);
|
|
73
|
-
console.log("About to check escalationId condition");
|
|
74
51
|
if (escalationNumber) {
|
|
75
|
-
console.log("escalationId condition is TRUE - adding updateProjectEscalation to promises");
|
|
76
|
-
console.log("updateProjectEscalation function:", updateProjectEscalation);
|
|
77
52
|
const escalationPromise = updateProjectEscalation({
|
|
78
53
|
variables: {
|
|
79
54
|
input: Object.assign({ escalationId }, (isExpert ? {
|
|
@@ -83,16 +58,12 @@ const fileUploader = (_a) => __awaiter(void 0, [_a], void 0, function* ({ file,
|
|
|
83
58
|
}))
|
|
84
59
|
},
|
|
85
60
|
});
|
|
86
|
-
console.log("Created escalation promise:", escalationPromise);
|
|
87
61
|
promises.push(escalationPromise);
|
|
88
|
-
console.log("Added escalation promise to promises array");
|
|
89
62
|
}
|
|
90
63
|
else {
|
|
91
64
|
console.log("escalationId condition is FALSE");
|
|
92
65
|
}
|
|
93
|
-
console.log("promises are ", promises.length, promises);
|
|
94
66
|
if (uploadExpertClientFiles && extraData) {
|
|
95
|
-
console.log("extra data is ", extraData);
|
|
96
67
|
promises.push(uploadExpertClientFiles({
|
|
97
68
|
variables: {
|
|
98
69
|
input: {
|
|
@@ -33,7 +33,6 @@ class UploadClient {
|
|
|
33
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
34
|
try {
|
|
35
35
|
const fileName = this.generateS3Key(this.state.projectId, this.state.escalationId, this.state.fileName);
|
|
36
|
-
console.log('File Name', fileName);
|
|
37
36
|
this.state = Object.assign(Object.assign({}, this.state), { fileName: fileName });
|
|
38
37
|
const params = {
|
|
39
38
|
fileName: this.state.fileName,
|
|
@@ -123,7 +122,6 @@ class UploadClient {
|
|
|
123
122
|
throw new Error('Failed to complete multipart upload');
|
|
124
123
|
}
|
|
125
124
|
const { responseData } = yield response.json();
|
|
126
|
-
console.log('Upload Complete', responseData);
|
|
127
125
|
return `${JSON.stringify(responseData)}`;
|
|
128
126
|
}
|
|
129
127
|
catch (error) {
|