@paro.io/expert-shared-components 1.9.1 → 1.9.3
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/ClientReferencesSection/DeleteButton.js +11 -11
- package/lib/components/ClientReferencesSection/ParoError.js +10 -10
- package/lib/components/ClientReferencesSection/TagsSection.js +2 -2
- package/lib/components/ClientReferencesSection/styles/BrandedTypography.js +2 -2
- package/lib/components/ClientReferencesSection/styles/Buttons.js +15 -15
- package/lib/components/ClientReferencesSection/styles/Name.js +5 -5
- package/lib/components/ClientReferencesSection/styles/NullContentConditionalColor.js +4 -4
- package/lib/components/ClientReferencesSection/styles/SectionBody.js +11 -11
- package/lib/components/ClientReferencesSection/styles/SectionTitle.js +6 -6
- package/lib/components/ClientReferencesSection/styles/Tags.js +2 -2
- package/lib/components/DocumentCenter/DocumentCenter.js +1 -1
- package/lib/components/DocumentCenter/DocumentTable.d.ts +15 -15
- package/lib/components/DocumentCenter/DocumentTable.js +350 -350
- package/lib/components/DocumentCenter/DocumentUploadRow.d.ts +4 -1
- package/lib/components/DocumentCenter/DocumentUploadRow.js +63 -34
- package/lib/components/DocumentCenter/ParoDocumentsTable.d.ts +1 -0
- package/lib/components/DocumentCenter/ParoDocumentsTable.js +1 -44
- package/lib/components/DocumentCenter/UploadFilesButton.d.ts +6 -6
- package/lib/components/DocumentCenter/UploadFilesButton.js +29 -29
- package/lib/components/ExpertProfileHeader/ActionButtonSection.js +6 -6
- package/lib/components/ExpertProfileHeader/ProfileSection.js +7 -7
- package/lib/components/OrganizationChart/OrgChart.d.ts +2 -0
- package/lib/components/OrganizationChart/OrgChart.js +232 -0
- package/lib/components/OrganizationChart/OrganizationChart.js +7 -7
- package/lib/components/OrganizationChart/index.d.ts +1 -1
- package/lib/components/OrganizationChart/index.js +2 -2
- package/lib/components/OrganizationChart/utils.d.ts +39 -0
- package/lib/components/OrganizationChart/utils.js +233 -0
- package/lib/components/Reviews/Pagination.js +6 -6
- package/lib/components/ReviewsTab/RatingHeader.js +6 -6
- package/lib/components/ReviewsTab/expert-shared-components.code-workspace +20 -20
- package/lib/components/ReviewsTab/reviewRequestModal.js +5 -5
- package/lib/components/shared/Error.d.ts +6 -6
- package/lib/components/shared/Error.js +40 -40
- package/lib/components/shared/Image.js +13 -13
- package/lib/components/shared/ProfileTextField.d.ts +18 -18
- package/lib/components/shared/ProfileTextField.js +16 -16
- package/lib/components/shared/StyledActionButtons.d.ts +7 -7
- package/lib/components/shared/StyledActionButtons.js +15 -15
- package/lib/components/shared/ToastNotification.d.ts +10 -10
- package/lib/components/shared/ToastNotification.js +63 -63
- package/package.json +59 -59
|
@@ -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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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);
|
|
@@ -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,
|
|
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) })),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
interface UploadFilesButtonProps {
|
|
2
|
-
onFileSelect: (file: File) => void;
|
|
3
|
-
isLoading?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare const UploadFilesButton: ({ onFileSelect, isLoading, }: UploadFilesButtonProps) => JSX.Element;
|
|
6
|
-
export {};
|
|
1
|
+
interface UploadFilesButtonProps {
|
|
2
|
+
onFileSelect: (file: File) => void;
|
|
3
|
+
isLoading?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const UploadFilesButton: ({ onFileSelect, isLoading, }: UploadFilesButtonProps) => JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UploadFilesButton = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const base_ui_1 = require("@paro.io/base-ui");
|
|
9
|
-
const react_2 = require("react");
|
|
10
|
-
const UploadFilesButton = ({ onFileSelect, isLoading, }) => {
|
|
11
|
-
const fileInputRef = (0, react_2.useRef)(null);
|
|
12
|
-
const handleClick = () => {
|
|
13
|
-
var _a;
|
|
14
|
-
(_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
15
|
-
};
|
|
16
|
-
const handleFileChange = (event) => {
|
|
17
|
-
var _a;
|
|
18
|
-
const file = (_a = event.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
19
|
-
if (file) {
|
|
20
|
-
onFileSelect(file);
|
|
21
|
-
}
|
|
22
|
-
// Reset input value to allow uploading the same file again
|
|
23
|
-
event.target.value = '';
|
|
24
|
-
};
|
|
25
|
-
return (react_1.default.createElement("div", null,
|
|
26
|
-
react_1.default.createElement("input", { type: "file", ref: fileInputRef, onChange: handleFileChange, className: "hidden", accept: ".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx" }),
|
|
27
|
-
react_1.default.createElement(base_ui_1.Button, { onClick: handleClick, disabled: isLoading })));
|
|
28
|
-
};
|
|
29
|
-
exports.UploadFilesButton = UploadFilesButton;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UploadFilesButton = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const base_ui_1 = require("@paro.io/base-ui");
|
|
9
|
+
const react_2 = require("react");
|
|
10
|
+
const UploadFilesButton = ({ onFileSelect, isLoading, }) => {
|
|
11
|
+
const fileInputRef = (0, react_2.useRef)(null);
|
|
12
|
+
const handleClick = () => {
|
|
13
|
+
var _a;
|
|
14
|
+
(_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
15
|
+
};
|
|
16
|
+
const handleFileChange = (event) => {
|
|
17
|
+
var _a;
|
|
18
|
+
const file = (_a = event.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
19
|
+
if (file) {
|
|
20
|
+
onFileSelect(file);
|
|
21
|
+
}
|
|
22
|
+
// Reset input value to allow uploading the same file again
|
|
23
|
+
event.target.value = '';
|
|
24
|
+
};
|
|
25
|
+
return (react_1.default.createElement("div", null,
|
|
26
|
+
react_1.default.createElement("input", { type: "file", ref: fileInputRef, onChange: handleFileChange, className: "hidden", accept: ".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx" }),
|
|
27
|
+
react_1.default.createElement(base_ui_1.Button, { onClick: handleClick, disabled: isLoading })));
|
|
28
|
+
};
|
|
29
|
+
exports.UploadFilesButton = UploadFilesButton;
|
|
@@ -11,12 +11,12 @@ const CopyToClipboardAlert_1 = __importDefault(require("../shared/CopyToClipboar
|
|
|
11
11
|
const colors_1 = __importDefault(require("../ClientReferencesSection/constants/colors"));
|
|
12
12
|
const Banner_1 = __importDefault(require("./Banner"));
|
|
13
13
|
const base_icons_1 = require("@paro.io/base-icons");
|
|
14
|
-
const StyledButton = (0, styled_components_1.default)(core_1.Button) `
|
|
15
|
-
margin: 0px !important;
|
|
16
|
-
padding: 26px 0 18px 0 !important;
|
|
17
|
-
span {
|
|
18
|
-
color: ${colors_1.default.buttonText} !important
|
|
19
|
-
}
|
|
14
|
+
const StyledButton = (0, styled_components_1.default)(core_1.Button) `
|
|
15
|
+
margin: 0px !important;
|
|
16
|
+
padding: 26px 0 18px 0 !important;
|
|
17
|
+
span {
|
|
18
|
+
color: ${colors_1.default.buttonText} !important
|
|
19
|
+
}
|
|
20
20
|
`;
|
|
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 },
|
|
@@ -53,13 +53,13 @@ const formatPhoneNumber = (phone) => {
|
|
|
53
53
|
return `(${numericPhone.slice(0, 3)}) ${numericPhone.slice(3, 6)} - ${numericPhone.slice(6)}`;
|
|
54
54
|
};
|
|
55
55
|
exports.formatPhoneNumber = formatPhoneNumber;
|
|
56
|
-
exports.ProfilePhotoPreview = styled_components_1.default.img `
|
|
57
|
-
height: 86px;
|
|
58
|
-
width: 86px;
|
|
59
|
-
border: 1px solid ${colors_1.default.lightGray};
|
|
60
|
-
border-radius: 50%;
|
|
61
|
-
object-fit: cover;
|
|
62
|
-
object-position: top;
|
|
56
|
+
exports.ProfilePhotoPreview = styled_components_1.default.img `
|
|
57
|
+
height: 86px;
|
|
58
|
+
width: 86px;
|
|
59
|
+
border: 1px solid ${colors_1.default.lightGray};
|
|
60
|
+
border-radius: 50%;
|
|
61
|
+
object-fit: cover;
|
|
62
|
+
object-position: top;
|
|
63
63
|
`;
|
|
64
64
|
const ProfileSection = ({ legacyFreelancerId, imageUrl, shouldAllowEditProfile, firstName, lastName, primaryServiceLine, editServiceLine, city, stateAbbreviation, email, phone, setOpen, paroProjectsData, getUserDocument, uploadUserPhotoMutation, loadingNewImage, imageUpdateError, isInternal, getUserByEmail, updateUserEmail, updateUserMutation, getUserByEmailLazyQuery, updateUserPassword, verifyUserPassword, getExpertRates, paroTenure, hourlyRate, }) => {
|
|
65
65
|
var _a;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.OrganizationChart = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const core_1 = require("@material-ui/core");
|
|
29
|
+
const icons_1 = require("@material-ui/icons");
|
|
30
|
+
const utils_1 = require("./utils");
|
|
31
|
+
const PersonCard = ({ name, position, experience, location, initial, noOfchildren, }) => (react_1.default.createElement("div", { className: "relative group" },
|
|
32
|
+
react_1.default.createElement("div", { className: "flex flex-col items-center" },
|
|
33
|
+
react_1.default.createElement("div", { className: "flex flex-col items-center mb-2" },
|
|
34
|
+
react_1.default.createElement("div", { className: `
|
|
35
|
+
-mb-4 z-10 w-12 h-12 rounded-full bg-[#434889] flex items-center justify-center
|
|
36
|
+
text-white font-semibold text-lg
|
|
37
|
+
transition-all duration-200 hover:bg-[#102377]
|
|
38
|
+
${noOfchildren > 0 ? 'hover:shadow-lg' : ''}
|
|
39
|
+
` },
|
|
40
|
+
initial,
|
|
41
|
+
noOfchildren > 0 && (react_1.default.createElement("div", { className: "absolute -bottom-3 w-6 h-6 rounded bg-gray-400 flex items-center justify-center text-white text-sm" }, noOfchildren)))),
|
|
42
|
+
react_1.default.createElement("div", { className: "p-4 bg-white rounded-lg shadow-sm border text-center w-48 transition-all duration-200 group-hover:shadow-md" },
|
|
43
|
+
react_1.default.createElement("div", { className: "font-semibold text-[#102377]" }, name),
|
|
44
|
+
react_1.default.createElement("div", { className: "text-sm text-gray-600" }, position),
|
|
45
|
+
react_1.default.createElement("div", { className: "text-xs text-gray-500" },
|
|
46
|
+
experience,
|
|
47
|
+
" Years Experience"),
|
|
48
|
+
react_1.default.createElement("div", { className: "text-xs text-gray-500" }, location)))));
|
|
49
|
+
const ServicesCard = ({ uniqueServices, employeeCount, employeeLocation, totalYears }) => {
|
|
50
|
+
const [expanded, setExpanded] = (0, react_1.useState)(false);
|
|
51
|
+
const handleExpandClick = () => {
|
|
52
|
+
setExpanded((prev) => !prev);
|
|
53
|
+
};
|
|
54
|
+
const highlightsExists = (employeeCount > 0 || employeeLocation !== 'none' || totalYears > 0);
|
|
55
|
+
const uniqueServicesExists = (uniqueServices === null || uniqueServices === void 0 ? void 0 : uniqueServices.length) >= 1;
|
|
56
|
+
const theme = (0, core_1.useTheme)();
|
|
57
|
+
const smallScreen = (0, core_1.useMediaQuery)(theme.breakpoints.down('lg'));
|
|
58
|
+
return (highlightsExists || uniqueServicesExists) ? react_1.default.createElement(utils_1.InfoCard, null,
|
|
59
|
+
react_1.default.createElement(core_1.Grid, { item: true, container: true, direction: 'row', justifyContent: 'space-between', alignItems: 'center' },
|
|
60
|
+
react_1.default.createElement(core_1.Typography, { variant: "subtitle1", gutterBottom: true },
|
|
61
|
+
react_1.default.createElement("b", null, "Services Offered & Highlights")),
|
|
62
|
+
react_1.default.createElement(core_1.Tooltip, { title: !expanded ? "Expand to view services offered & highlights" : "", arrow: true, placement: 'top' },
|
|
63
|
+
react_1.default.createElement(core_1.IconButton, { onClick: handleExpandClick }, expanded ? react_1.default.createElement(icons_1.ExpandLess, null) : react_1.default.createElement(icons_1.ExpandMore, null)))),
|
|
64
|
+
react_1.default.createElement(core_1.Collapse, { in: expanded },
|
|
65
|
+
react_1.default.createElement(core_1.Grid, { container: true, spacing: 2, style: { paddingLeft: 12 }, direction: smallScreen ? 'column' : 'row' },
|
|
66
|
+
uniqueServicesExists && react_1.default.createElement(core_1.Grid, { item: true },
|
|
67
|
+
react_1.default.createElement(core_1.Typography, { variant: "subtitle1", gutterBottom: true },
|
|
68
|
+
react_1.default.createElement("b", null, "Services Offered")),
|
|
69
|
+
react_1.default.createElement("ul", { className: "pl-2 my-0" }, uniqueServices === null || uniqueServices === void 0 ? void 0 : uniqueServices.map((service) => {
|
|
70
|
+
return react_1.default.createElement("li", null, service);
|
|
71
|
+
}))),
|
|
72
|
+
react_1.default.createElement(core_1.Box, { m: 1, mb: smallScreen ? 1 : 2 },
|
|
73
|
+
react_1.default.createElement(core_1.Divider, { orientation: smallScreen ? 'horizontal' : 'vertical' })),
|
|
74
|
+
highlightsExists && react_1.default.createElement(core_1.Grid, { item: true },
|
|
75
|
+
react_1.default.createElement(core_1.Typography, { variant: "subtitle1", gutterBottom: true },
|
|
76
|
+
react_1.default.createElement("b", null, "Highlights")),
|
|
77
|
+
react_1.default.createElement("ul", { className: "pl-2 my-0" },
|
|
78
|
+
employeeCount > 0 && react_1.default.createElement("li", null,
|
|
79
|
+
employeeCount,
|
|
80
|
+
" Team Members"),
|
|
81
|
+
employeeLocation !== 'none' && react_1.default.createElement("li", null, employeeLocation),
|
|
82
|
+
totalYears > 0 && react_1.default.createElement("li", null,
|
|
83
|
+
totalYears,
|
|
84
|
+
" years of combined experience")))))) : react_1.default.createElement(react_1.default.Fragment, null);
|
|
85
|
+
};
|
|
86
|
+
const RenderChildren = ({ children, zooming, isDragging }) => {
|
|
87
|
+
const childWidth = 100 / children.length;
|
|
88
|
+
const hasSiblings = children.length > 1;
|
|
89
|
+
const childRefs = (0, react_1.useRef)([]);
|
|
90
|
+
const horizontalLineRefs = (0, react_1.useRef)([]);
|
|
91
|
+
(0, react_1.useEffect)(() => {
|
|
92
|
+
if (hasSiblings && !zooming && !isDragging) {
|
|
93
|
+
children.forEach((child, index) => {
|
|
94
|
+
const firstChildRef = childRefs.current[index];
|
|
95
|
+
const lastChildRef = childRefs.current[children.length - 1];
|
|
96
|
+
if (firstChildRef && lastChildRef && horizontalLineRefs.current[index]) {
|
|
97
|
+
const firstChildRect = firstChildRef.getBoundingClientRect();
|
|
98
|
+
const lastChildRect = lastChildRef.getBoundingClientRect();
|
|
99
|
+
horizontalLineRefs.current[index].style.left = `${(firstChildRect.width / 2)}px`;
|
|
100
|
+
horizontalLineRefs.current[index].style.right = `${(lastChildRect.width / 2)}px`;
|
|
101
|
+
horizontalLineRefs.current[index].style.width = 'auto';
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}, [hasSiblings, children, zooming, isDragging]);
|
|
106
|
+
return (react_1.default.createElement("div", { className: "flex flex-col w-full" },
|
|
107
|
+
react_1.default.createElement("div", { className: "relative w-full flex flex-col items-center" },
|
|
108
|
+
hasSiblings && react_1.default.createElement(utils_1.ConnectorContainer, { className: "parent-vertical-line" }),
|
|
109
|
+
react_1.default.createElement("div", { className: "relative w-full" },
|
|
110
|
+
react_1.default.createElement("div", { className: "flex justify-between relative", style: {
|
|
111
|
+
margin: '0 auto',
|
|
112
|
+
width: '100%'
|
|
113
|
+
} },
|
|
114
|
+
hasSiblings && (react_1.default.createElement(utils_1.ConnectorContainer, { ref: (el) => horizontalLineRefs.current[0] = el, className: "horizontal-line" })),
|
|
115
|
+
react_1.default.createElement("div", { className: `flex gap-16 relative w-full justify-${hasSiblings ? 'between' : 'center'}` }, children.map((child, index) => {
|
|
116
|
+
var _a, _b;
|
|
117
|
+
return (react_1.default.createElement("div", { key: child.name, className: "flex flex-col items-center", style: { width: `${childWidth}%` } },
|
|
118
|
+
react_1.default.createElement(utils_1.ConnectorContainer, { ref: (el) => childRefs.current[index] = el, className: "child-vertical-line" }),
|
|
119
|
+
react_1.default.createElement("div", { className: "flex flex-col items-center relative" },
|
|
120
|
+
react_1.default.createElement(PersonCard, Object.assign({}, child, { noOfchildren: (_b = (_a = child === null || child === void 0 ? void 0 : child.children) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 })),
|
|
121
|
+
child.children && child.children.length > 0 && (react_1.default.createElement(RenderChildren, { children: child.children, zooming: zooming, isDragging: isDragging })))));
|
|
122
|
+
})))))));
|
|
123
|
+
};
|
|
124
|
+
const OrganizationChart = ({ expertFirms, openModal, setOpenModal, firstName, lastName, primaryServiceLine, city, stateAbbreviation, paroTenure, isPublicProfile, }) => {
|
|
125
|
+
var _a, _b, _c, _d;
|
|
126
|
+
const services = (_a = expertFirms === null || expertFirms === void 0 ? void 0 : expertFirms.expertFirmClientReferences) === null || _a === void 0 ? void 0 : _a.flatMap((obj) => { var _a; return (_a = obj === null || obj === void 0 ? void 0 : obj.services) !== null && _a !== void 0 ? _a : []; });
|
|
127
|
+
const uniqueServices = (0, utils_1.parseServices)(services);
|
|
128
|
+
const employeeLocation = (0, utils_1.checkEmployeeLocation)(expertFirms === null || expertFirms === void 0 ? void 0 : expertFirms.expertFirmEmployees);
|
|
129
|
+
const totalYears = (0, utils_1.getTotalYearsWithFirm)(expertFirms === null || expertFirms === void 0 ? void 0 : expertFirms.expertFirmEmployees);
|
|
130
|
+
const treeData = (0, utils_1.transformEmployeeData)(expertFirms.expertFirmEmployees, firstName, lastName, primaryServiceLine, city, stateAbbreviation, paroTenure);
|
|
131
|
+
const groupedEmployees = (_b = expertFirms === null || expertFirms === void 0 ? void 0 : expertFirms.expertFirmEmployees) === null || _b === void 0 ? void 0 : _b.reduce((acc, obj) => {
|
|
132
|
+
if (!acc[obj.level]) {
|
|
133
|
+
acc[obj.level] = [];
|
|
134
|
+
}
|
|
135
|
+
acc[obj.level].push(obj);
|
|
136
|
+
return acc;
|
|
137
|
+
}, {});
|
|
138
|
+
const [scale, setScale] = (0, react_1.useState)(1);
|
|
139
|
+
const [position, setPosition] = (0, react_1.useState)({ x: 0, y: (groupedEmployees === null || groupedEmployees === void 0 ? void 0 : groupedEmployees.length) >= 2 ? -100 : 1 });
|
|
140
|
+
const isDraggingRef = (0, react_1.useRef)(false);
|
|
141
|
+
const lastMousePosRef = (0, react_1.useRef)(null);
|
|
142
|
+
const zoomingRef = (0, react_1.useRef)(false);
|
|
143
|
+
const zoomTimeoutRef = (0, react_1.useRef)(null);
|
|
144
|
+
const MAX_ZOOM_IN = 5;
|
|
145
|
+
const MAX_ZOOM_OUT = 0.2;
|
|
146
|
+
const CONTENT_SIZE = 10;
|
|
147
|
+
// Center the content
|
|
148
|
+
const centerContent = (newScale) => {
|
|
149
|
+
const centerX = (CONTENT_SIZE * newScale) / 2;
|
|
150
|
+
const centerY = (CONTENT_SIZE * newScale) / 2;
|
|
151
|
+
setPosition({ x: centerX, y: centerY });
|
|
152
|
+
};
|
|
153
|
+
const handleWheel = (event) => {
|
|
154
|
+
event.preventDefault();
|
|
155
|
+
const zoomFactor = 0.1;
|
|
156
|
+
if (!zoomingRef.current) {
|
|
157
|
+
zoomingRef.current = true;
|
|
158
|
+
if (event.deltaY < 0) {
|
|
159
|
+
setScale((prev) => Math.min(prev + zoomFactor, MAX_ZOOM_IN));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
setScale((prev) => {
|
|
163
|
+
const newScale = Math.max(prev - zoomFactor, MAX_ZOOM_OUT);
|
|
164
|
+
if (newScale === MAX_ZOOM_OUT) {
|
|
165
|
+
centerContent(newScale); // Center content when zoomed out fully
|
|
166
|
+
}
|
|
167
|
+
return newScale;
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
if (zoomTimeoutRef.current)
|
|
171
|
+
clearTimeout(zoomTimeoutRef.current);
|
|
172
|
+
zoomTimeoutRef.current = setTimeout(() => {
|
|
173
|
+
zoomingRef.current = false;
|
|
174
|
+
}, 10);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const handleMouseDown = (event) => {
|
|
178
|
+
isDraggingRef.current = true; // Start dragging
|
|
179
|
+
lastMousePosRef.current = { x: event.clientX, y: event.clientY };
|
|
180
|
+
};
|
|
181
|
+
const handleMouseMove = (event) => {
|
|
182
|
+
if (isDraggingRef.current && lastMousePosRef.current) {
|
|
183
|
+
const dx = event.clientX - lastMousePosRef.current.x;
|
|
184
|
+
const dy = event.clientY - lastMousePosRef.current.y;
|
|
185
|
+
setPosition((prev) => ({
|
|
186
|
+
x: prev.x + dx,
|
|
187
|
+
y: prev.y + dy,
|
|
188
|
+
}));
|
|
189
|
+
lastMousePosRef.current = { x: event.clientX, y: event.clientY };
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const handleMouseUp = () => {
|
|
193
|
+
isDraggingRef.current = false;
|
|
194
|
+
};
|
|
195
|
+
const handleDoubleClick = () => {
|
|
196
|
+
const newScale = 1;
|
|
197
|
+
setScale(newScale);
|
|
198
|
+
centerContent(newScale);
|
|
199
|
+
};
|
|
200
|
+
return (react_1.default.createElement(utils_1.CustomDialog, { open: openModal, onClose: () => setOpenModal(false), fullScreen: true, scroll: "paper" },
|
|
201
|
+
react_1.default.createElement("div", { className: "w-full h-full bg-gray-50 relative" },
|
|
202
|
+
react_1.default.createElement(core_1.Grid, { container: true, justifyContent: "space-between", alignItems: "center", style: { padding: '1rem' } },
|
|
203
|
+
react_1.default.createElement(core_1.Box, null,
|
|
204
|
+
react_1.default.createElement(core_1.Typography, { variant: "subtitle1" },
|
|
205
|
+
react_1.default.createElement(core_1.Box, null, "Organizational Structure & Services")),
|
|
206
|
+
react_1.default.createElement(core_1.Typography, { variant: "caption" },
|
|
207
|
+
react_1.default.createElement(core_1.Box, null, "See what services the organization offers and where they're located"))),
|
|
208
|
+
react_1.default.createElement(core_1.IconButton, { onClick: () => setOpenModal(false), style: { position: 'absolute', top: 0, right: 0 } },
|
|
209
|
+
react_1.default.createElement(icons_1.Close, null))),
|
|
210
|
+
isPublicProfile && (react_1.default.createElement(ServicesCard, { uniqueServices: uniqueServices, employeeCount: expertFirms.employeeCount, employeeLocation: employeeLocation, totalYears: totalYears })),
|
|
211
|
+
react_1.default.createElement(core_1.DialogContent, { onWheel: handleWheel, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, onDoubleClick: handleDoubleClick, style: {
|
|
212
|
+
overflow: 'hidden',
|
|
213
|
+
width: '100%',
|
|
214
|
+
height: '100vh',
|
|
215
|
+
position: 'relative',
|
|
216
|
+
} },
|
|
217
|
+
react_1.default.createElement("div", { onMouseDown: handleMouseDown, style: {
|
|
218
|
+
transform: `translate(${position.x}px, ${position.y}px) scale(${scale})`,
|
|
219
|
+
transformOrigin: 'center',
|
|
220
|
+
transition: 'transform 0.1s',
|
|
221
|
+
width: '100%',
|
|
222
|
+
height: '100%',
|
|
223
|
+
position: 'relative',
|
|
224
|
+
cursor: isDraggingRef.current ? 'grabbing' : 'grab',
|
|
225
|
+
userSelect: 'none',
|
|
226
|
+
} },
|
|
227
|
+
react_1.default.createElement("div", { className: "p-8" },
|
|
228
|
+
react_1.default.createElement("div", { className: "flex flex-col items-center" },
|
|
229
|
+
react_1.default.createElement(PersonCard, Object.assign({}, treeData, { noOfchildren: (_d = (_c = treeData === null || treeData === void 0 ? void 0 : treeData.children) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0 })),
|
|
230
|
+
react_1.default.createElement(RenderChildren, { children: treeData.children || [], zooming: zoomingRef.current, isDragging: isDraggingRef.current }))))))));
|
|
231
|
+
};
|
|
232
|
+
exports.OrganizationChart = OrganizationChart;
|
|
@@ -34,13 +34,13 @@ const Close_1 = __importDefault(require("@material-ui/icons/Close"));
|
|
|
34
34
|
const cdn_1 = require("../shared/constants/cdn");
|
|
35
35
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
36
36
|
const defaultAvatar = cdn_1.CDN_URL + 'defaultAvatar.png';
|
|
37
|
-
const ProfilePhotoPreview = styled_components_1.default.img `
|
|
38
|
-
height: 86px;
|
|
39
|
-
width: 86px;
|
|
40
|
-
border: 1px solid #e4e5e4;
|
|
41
|
-
border-radius: 50%;
|
|
42
|
-
object-fit: cover;
|
|
43
|
-
object-position: top;
|
|
37
|
+
const ProfilePhotoPreview = styled_components_1.default.img `
|
|
38
|
+
height: 86px;
|
|
39
|
+
width: 86px;
|
|
40
|
+
border: 1px solid #e4e5e4;
|
|
41
|
+
border-radius: 50%;
|
|
42
|
+
object-fit: cover;
|
|
43
|
+
object-position: top;
|
|
44
44
|
`;
|
|
45
45
|
const CustomDialog = (0, core_1.styled)(Dialog_1.default)(({ theme }) => ({
|
|
46
46
|
'& .MuiDialog-paper': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { OrganizationChart } from './
|
|
1
|
+
export { OrganizationChart } from './OrgChart';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrganizationChart = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "OrganizationChart", { enumerable: true, get: function () { return
|
|
4
|
+
var OrgChart_1 = require("./OrgChart");
|
|
5
|
+
Object.defineProperty(exports, "OrganizationChart", { enumerable: true, get: function () { return OrgChart_1.OrganizationChart; } });
|