@paro.io/expert-shared-components 1.9.0 → 1.9.2

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.
@@ -177,7 +177,7 @@ const DocumentCenter = ({ legacyFreelancerId, openModal, setOpenModal, expertCli
177
177
  react_1.default.createElement(lab_1.TabPanel, { value: '0', style: { paddingTop: '0px' } },
178
178
  react_1.default.createElement(ClientDocumentsTable_1.ClientDocumentsTable, { legacyFreelancerId: legacyFreelancerId, expertFiles: expertClientFiles, setExpertClientFiles: setExpertClientFiles, clientAndProjectsList: clientAndProjects, uploadExpertClientFiles: uploadExpertClientFiles, updateFileLastViewed: updateFileLastViewed, deleteExpertClientFile: deleteExpertClientFile, paroDocuments: false, freelancerName: freelancerName !== null && freelancerName !== void 0 ? freelancerName : '', freelancerEmail: freelancerEmail !== null && freelancerEmail !== void 0 ? freelancerEmail : '', getFileLazyQuery: getFileLazyQuery, expertClientFilesLazyQuery: expertClientFilesLazyQuery, isClientPortal: isClientPortal, documentUploadUrl: documentUploadUrl, downloadDocumentUrl: downloadDocumentUrl, clientId: clientId })),
179
179
  react_1.default.createElement(lab_1.TabPanel, { value: '1' },
180
- react_1.default.createElement(ParoDocumentsTable_1.ParoDocumentsTable, { legacyFreelancerId: legacyFreelancerId, expiryDate: insuranceExpiryDate !== null && insuranceExpiryDate !== void 0 ? insuranceExpiryDate : '', setExpiryDate: setInsuranceExpiryDate, expertFiles: expertFiles, setExpertFiles: setExpertFiles, uploadFileData: uploadFileData, deleteFileMutation: deleteFileMutation, updateFreelancerExpiryMutation: updateFreelancerExpiryMutation, foldername: foldername !== null && foldername !== void 0 ? foldername : '', paroDocuments: true, getFileLazyQuery: getFileLazyQuery, getFilesLazyQuery: getFilesLazyQuery }))))),
180
+ react_1.default.createElement(ParoDocumentsTable_1.ParoDocumentsTable, { legacyFreelancerId: legacyFreelancerId, expiryDate: insuranceExpiryDate !== null && insuranceExpiryDate !== void 0 ? insuranceExpiryDate : '', setExpiryDate: setInsuranceExpiryDate, expertFiles: expertFiles, setExpertFiles: setExpertFiles, uploadExpertClientFiles: uploadExpertClientFiles, uploadFileData: uploadFileData, deleteFileMutation: deleteFileMutation, updateFreelancerExpiryMutation: updateFreelancerExpiryMutation, foldername: foldername !== null && foldername !== void 0 ? foldername : '', paroDocuments: true, getFileLazyQuery: getFileLazyQuery, getFilesLazyQuery: getFilesLazyQuery }))))),
181
181
  react_1.default.createElement(react_hot_toast_1.Toaster, { position: "top-center", toastOptions: {
182
182
  style: {
183
183
  zIndex: 9999,
@@ -16,6 +16,9 @@ interface DocumentUploadProps {
16
16
  error?: string | null;
17
17
  clientAndProjectsList?: any[];
18
18
  uploadExpertClientFiles?: any;
19
+ uploadInternalFile?: any;
20
+ foldername?: string;
21
+ insuranceExpiryDate?: any;
19
22
  refetchFiles?: any;
20
23
  legacyFreelancerId?: any;
21
24
  freelancerName?: string;
@@ -23,5 +26,5 @@ interface DocumentUploadProps {
23
26
  isClientPortal?: boolean;
24
27
  documentUploadUrl?: string;
25
28
  }
26
- export declare const DocumentUploadRow: ({ clientAndProject, setClientAndProject, docType, setDocType, paroDocuments, expiryDate, handleDateChange, error, clientAndProjectsList, uploadExpertClientFiles, refetchFiles, legacyFreelancerId, freelancerName, freelancerEmail, isClientPortal, documentUploadUrl, }: DocumentUploadProps) => JSX.Element;
29
+ export declare const DocumentUploadRow: ({ clientAndProject, setClientAndProject, docType, setDocType, paroDocuments, expiryDate, handleDateChange, error, clientAndProjectsList, uploadExpertClientFiles, uploadInternalFile, foldername, insuranceExpiryDate, refetchFiles, legacyFreelancerId, freelancerName, freelancerEmail, isClientPortal, documentUploadUrl, }: DocumentUploadProps) => JSX.Element;
27
30
  export {};
@@ -78,7 +78,7 @@ const generateOptions = (array, clientOptions, isClientPortal) => {
78
78
  }
79
79
  });
80
80
  };
81
- const DocumentUploadRow = ({ clientAndProject, setClientAndProject, docType, setDocType, paroDocuments, expiryDate, handleDateChange, error, clientAndProjectsList, uploadExpertClientFiles, refetchFiles, legacyFreelancerId, freelancerName, freelancerEmail, isClientPortal = false, documentUploadUrl, }) => {
81
+ const DocumentUploadRow = ({ clientAndProject, setClientAndProject, docType, setDocType, paroDocuments, expiryDate, handleDateChange, error, clientAndProjectsList, uploadExpertClientFiles, uploadInternalFile, foldername, insuranceExpiryDate, refetchFiles, legacyFreelancerId, freelancerName, freelancerEmail, isClientPortal = false, documentUploadUrl, }) => {
82
82
  const [isUploading, setIsUploading] = (0, react_1.useState)(false);
83
83
  const [documentName, setDocumentName] = (0, react_1.useState)('');
84
84
  const fileInputRef = (0, react_1.useRef)(null);
@@ -93,40 +93,69 @@ const DocumentUploadRow = ({ clientAndProject, setClientAndProject, docType, set
93
93
  const disableButton = !(documentName && checkField) && !isUploading;
94
94
  const uploadFile = (fileForUpload, fileExtension, isLargeFile, selectedFile) => {
95
95
  var _a, _b, _c, _d, _e;
96
- uploadExpertClientFiles({
97
- variables: {
98
- input: {
99
- clientId: (_a = clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.client) === null || _a === void 0 ? void 0 : _a.id,
100
- clientName: (_b = clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.client) === null || _b === void 0 ? void 0 : _b.name,
101
- email: isClientPortal ? (_c = clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.freelancer) === null || _c === void 0 ? void 0 : _c.name : freelancerEmail,
102
- fileName: `${documentName}.${fileExtension}`,
103
- fileSize: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.size,
104
- fileType: utils_1.DOCUMENT_TYPE_CONSTANTS[docType],
105
- freelancerId: isClientPortal ? (_d = clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.freelancer) === null || _d === void 0 ? void 0 : _d.id : legacyFreelancerId,
106
- freelancerName: isClientPortal ? (_e = clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.freelancer) === null || _e === void 0 ? void 0 : _e.name : freelancerName,
107
- projectId: clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.id,
108
- projectName: clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.name,
109
- uploadedBy: isClientPortal ? 'CLIENT' : 'FREELANCER',
110
- data: isLargeFile ? "" : fileForUpload,
111
- },
112
- }
113
- })
114
- .then((res) => {
115
- var _a;
116
- if ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.uploadExpertClientFilesData) {
117
- refetchFiles();
118
- (0, utils_1.showToast)('success', 'File Uploaded successfully!');
119
- }
120
- else {
96
+ paroDocuments ?
97
+ uploadInternalFile({
98
+ variables: {
99
+ input: {
100
+ foldername,
101
+ subfolder: docType,
102
+ filename: `${documentName}.${fileExtension}`,
103
+ data: fileForUpload,
104
+ expirationDate: ((docType === 'EO Insurance') && insuranceExpiryDate) ? insuranceExpiryDate : '',
105
+ valid: true,
106
+ sourceOfEOInsurance: 'Dashboard',
107
+ },
108
+ }
109
+ }).then((res) => {
110
+ var _a;
111
+ if ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.uploadFileData) {
112
+ refetchFiles();
113
+ (0, utils_1.showToast)('success', 'File Uploaded successfully!');
114
+ }
115
+ else {
116
+ (0, utils_1.showToast)('warning', 'Upload failed! Please try again.');
117
+ }
118
+ })
119
+ .catch((err) => {
121
120
  (0, utils_1.showToast)('warning', 'Upload failed! Please try again.');
122
- }
123
- })
124
- .catch((err) => {
125
- (0, utils_1.showToast)('warning', 'Upload failed! Please try again.');
126
- }).finally(() => {
127
- setIsUploading(false);
128
- setDocumentName('');
129
- });
121
+ }).finally(() => {
122
+ setIsUploading(false);
123
+ setDocumentName('');
124
+ })
125
+ : uploadExpertClientFiles({
126
+ variables: {
127
+ input: {
128
+ clientId: (_a = clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.client) === null || _a === void 0 ? void 0 : _a.id,
129
+ clientName: (_b = clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.client) === null || _b === void 0 ? void 0 : _b.name,
130
+ email: isClientPortal ? (_c = clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.freelancer) === null || _c === void 0 ? void 0 : _c.name : freelancerEmail,
131
+ fileName: `${documentName}.${fileExtension}`,
132
+ fileSize: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.size,
133
+ fileType: utils_1.DOCUMENT_TYPE_CONSTANTS[docType],
134
+ freelancerId: isClientPortal ? (_d = clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.freelancer) === null || _d === void 0 ? void 0 : _d.id : legacyFreelancerId,
135
+ freelancerName: isClientPortal ? (_e = clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.freelancer) === null || _e === void 0 ? void 0 : _e.name : freelancerName,
136
+ projectId: clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.id,
137
+ projectName: clientAndProject === null || clientAndProject === void 0 ? void 0 : clientAndProject.name,
138
+ uploadedBy: isClientPortal ? 'CLIENT' : 'FREELANCER',
139
+ data: isLargeFile ? "" : fileForUpload,
140
+ },
141
+ }
142
+ })
143
+ .then((res) => {
144
+ var _a;
145
+ if ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.uploadExpertClientFilesData) {
146
+ refetchFiles();
147
+ (0, utils_1.showToast)('success', 'File Uploaded successfully!');
148
+ }
149
+ else {
150
+ (0, utils_1.showToast)('warning', 'Upload failed! Please try again.');
151
+ }
152
+ })
153
+ .catch((err) => {
154
+ (0, utils_1.showToast)('warning', 'Upload failed! Please try again.');
155
+ }).finally(() => {
156
+ setIsUploading(false);
157
+ setDocumentName('');
158
+ });
130
159
  };
131
160
  const uploadFileRouter = (fileForUpload, fileExtension, selectedFile) => {
132
161
  setIsUploading(true);
@@ -4,6 +4,7 @@ interface DocumentTableProps {
4
4
  setExpiryDate: (expiryDate: string) => void;
5
5
  expertFiles: any[];
6
6
  setExpertFiles: (expertFiles: any[]) => void;
7
+ uploadExpertClientFiles: any;
7
8
  uploadFileData: any;
8
9
  deleteFileMutation: any;
9
10
  updateFreelancerExpiryMutation: any;
@@ -263,49 +263,6 @@ const ParoDocumentsTable = ({ legacyFreelancerId, expiryDate, setExpiryDate, exp
263
263
  setApiFoldername((_c = segments === null || segments === void 0 ? void 0 : segments.slice(0, segments.length - 1)) === null || _c === void 0 ? void 0 : _c.join('/'));
264
264
  }
265
265
  };
266
- const uploadFile = (fileForUpload, fileExtension) => {
267
- setIsUploading(true);
268
- uploadFileData({
269
- variables: {
270
- input: {
271
- foldername,
272
- subfolder: docType,
273
- filename: `${documentName}.${fileExtension}`,
274
- data: fileForUpload,
275
- expirationDate: ((docType === 'EO Insurance') && insuranceExpiryDate) ? insuranceExpiryDate : '',
276
- valid: true,
277
- sourceOfEOInsurance: 'Dashboard',
278
- },
279
- },
280
- onCompleted: () => __awaiter(void 0, void 0, void 0, function* () {
281
- refetchFiles(true);
282
- })
283
- })
284
- .then(() => {
285
- (0, utils_1.showToast)('success', 'File Uploaded successfully!');
286
- })
287
- .catch((err) => {
288
- (0, utils_1.showToast)('warning', 'Upload failed! Please try again.');
289
- });
290
- setIsUploading(false);
291
- setApiFoldername('');
292
- setDocumentName('');
293
- };
294
- const handleUpload = (event) => {
295
- const selectedFile = event.target.files && event.target.files[0];
296
- if (!(0, utils_1.validateFileUpload)(selectedFile, false)) {
297
- return;
298
- }
299
- if (selectedFile) {
300
- const fileExtension = selectedFile.name.substring(selectedFile.name.lastIndexOf('.') + 1);
301
- const reader = new FileReader();
302
- reader.onloadend = () => {
303
- const fileForUpload = String(reader.result).split(';base64,')[1];
304
- uploadFile(fileForUpload, fileExtension);
305
- };
306
- reader.readAsDataURL(selectedFile);
307
- }
308
- };
309
266
  const handleDateChange = (date) => {
310
267
  if (date) {
311
268
  const currentDate = (0, date_fns_1.startOfDay)(new Date);
@@ -319,7 +276,7 @@ const ParoDocumentsTable = ({ legacyFreelancerId, expiryDate, setExpiryDate, exp
319
276
  }
320
277
  };
321
278
  return (react_1.default.createElement(react_1.default.Fragment, null,
322
- react_1.default.createElement(DocumentUploadRow_1.DocumentUploadRow, { documentName: documentName, setDocumentName: setDocumentName, clientAndProject: clientAndProject, setClientAndProject: setClientAndProject, docType: docType, setDocType: setDocType, searchText: searchText, setSearchText: setSearchText, paroDocuments: paroDocuments, handleUpload: handleUpload, expiryDate: insuranceExpiryDate, handleDateChange: handleDateChange, error: error, isUploading: isUploading }),
279
+ react_1.default.createElement(DocumentUploadRow_1.DocumentUploadRow, { documentName: documentName, setDocumentName: setDocumentName, clientAndProject: clientAndProject, setClientAndProject: setClientAndProject, uploadInternalFile: uploadFileData, docType: docType, foldername: foldername, insuranceExpiryDate: insuranceExpiryDate, refetchFiles: refetchFiles, setDocType: setDocType, searchText: searchText, setSearchText: setSearchText, paroDocuments: paroDocuments, expiryDate: insuranceExpiryDate, handleDateChange: handleDateChange, error: error, isUploading: isUploading }),
323
280
  react_1.default.createElement(utils_1.CustomPaper, null,
324
281
  react_1.default.createElement("div", { className: 'w-1/4' },
325
282
  react_1.default.createElement(base_ui_1.Input, { placeholder: "Search Documents", type: "text", value: searchText, onChange: (e) => setSearchText(e.target.value) })),
@@ -7,6 +7,8 @@ interface ActionButtonSectionProps {
7
7
  lifetimeFSV: number;
8
8
  openServiceLinesTemplate?: boolean;
9
9
  setOpenServiceLinesTemplate: (openServiceLinesTemplate: boolean) => void;
10
+ isExpertOps?: boolean;
11
+ isInternal?: boolean;
10
12
  }
11
- declare const ActionButtonsSection: ({ isWhiteLabel, applicationStatus, publicProfileLink, setOpenAssessmentModal, setOpenServiceLinesTemplate, createExpertPublicProfileTrackingRecord, lifetimeFSV, openServiceLinesTemplate }: ActionButtonSectionProps) => JSX.Element;
13
+ declare const ActionButtonsSection: ({ isWhiteLabel, applicationStatus, publicProfileLink, setOpenAssessmentModal, setOpenServiceLinesTemplate, createExpertPublicProfileTrackingRecord, lifetimeFSV, openServiceLinesTemplate, isExpertOps, isInternal }: ActionButtonSectionProps) => JSX.Element;
12
14
  export default ActionButtonsSection;
@@ -21,10 +21,10 @@ const StyledButton = (0, styled_components_1.default)(core_1.Button) `
21
21
  const ActionButton = ({ title, ariaLabel, onClick, icon: Icon }) => (react_1.default.createElement(core_1.Tooltip, { arrow: true, placement: "top", interactive: true, className: "whitespace-nowrap", title: title },
22
22
  react_1.default.createElement(core_1.IconButton, { "aria-label": ariaLabel, onClick: onClick },
23
23
  react_1.default.createElement(Icon, null))));
24
- const ActionButtonsSection = ({ isWhiteLabel, applicationStatus, publicProfileLink, setOpenAssessmentModal, setOpenServiceLinesTemplate, createExpertPublicProfileTrackingRecord, lifetimeFSV, openServiceLinesTemplate }) => {
24
+ const ActionButtonsSection = ({ isWhiteLabel, applicationStatus, publicProfileLink, setOpenAssessmentModal, setOpenServiceLinesTemplate, createExpertPublicProfileTrackingRecord, lifetimeFSV, openServiceLinesTemplate, isExpertOps = false, isInternal = false }) => {
25
25
  return (react_1.default.createElement(core_1.Box, { style: { display: 'flex', justifyContent: 'flex-end', marginTop: '10px', alignItems: 'center' } },
26
26
  (lifetimeFSV && lifetimeFSV >= 85000) ? react_1.default.createElement(Banner_1.default, { lifetimeFSV: lifetimeFSV }) : '',
27
- react_1.default.createElement(core_1.Tooltip, { arrow: true, placement: "top", interactive: true, className: "whitespace-nowrap", title: "Service Lines" },
27
+ ((isInternal && isExpertOps) || !isInternal) && react_1.default.createElement(core_1.Tooltip, { arrow: true, placement: "top", interactive: true, className: "whitespace-nowrap", title: "Service Lines" },
28
28
  react_1.default.createElement(core_1.IconButton, { onClick: () => setOpenServiceLinesTemplate(true) },
29
29
  " ",
30
30
  react_1.default.createElement(base_icons_1.IconBriefcase, { size: "md" }),
@@ -211,7 +211,7 @@ const ExpertProfileHeader = ({ expertId, legacyFreelancerId, address: addressFor
211
211
  react_1.default.createElement(core_1.Typography, { variant: 'h5' },
212
212
  react_1.default.createElement("b", null, "Personal Information"))),
213
213
  isInternal && react_1.default.createElement(core_1.Grid, { item: true },
214
- react_1.default.createElement(ActionButtonSection_1.default, { isWhiteLabel: isWhiteLabel, applicationStatus: applicationStatus, publicProfileLink: publicProfileLink, setOpenAssessmentModal: setOpenAssessmentModal, createExpertPublicProfileTrackingRecord: createExpertPublicProfileTrackingRecord, lifetimeFSV: lifetimeFSV !== null && lifetimeFSV !== void 0 ? lifetimeFSV : 0, openServiceLinesTemplate: openServiceLinesTemplate, setOpenServiceLinesTemplate: setOpenServiceLinesTemplate }))),
214
+ react_1.default.createElement(ActionButtonSection_1.default, { isWhiteLabel: isWhiteLabel, applicationStatus: applicationStatus, publicProfileLink: publicProfileLink, setOpenAssessmentModal: setOpenAssessmentModal, createExpertPublicProfileTrackingRecord: createExpertPublicProfileTrackingRecord, lifetimeFSV: lifetimeFSV !== null && lifetimeFSV !== void 0 ? lifetimeFSV : 0, openServiceLinesTemplate: openServiceLinesTemplate, setOpenServiceLinesTemplate: setOpenServiceLinesTemplate, isExpertOps: isExpertOps, isInternal: isInternal }))),
215
215
  react_1.default.createElement(CustomPaper, { style: { minHeight: 'min-content', maxHeight: '60vh', overflow: 'auto', borderBottom: '1px solid #c1c1c1' }, className: 'personalInfo' },
216
216
  react_1.default.createElement(core_1.Divider, null),
217
217
  react_1.default.createElement(core_1.Grid, { container: true, spacing: 2, style: { display: 'flex', flexWrap: isSmallScreen ? 'wrap' : 'nowrap' } },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paro.io/expert-shared-components",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {