@paro.io/expert-shared-components 1.4.11 → 1.5.0

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.
Files changed (28) hide show
  1. package/lib/components/DocumentCenter/ClientDocumentsTable.d.ts +18 -0
  2. package/lib/components/DocumentCenter/ClientDocumentsTable.js +378 -0
  3. package/lib/components/DocumentCenter/DeleteDocumentModal.d.ts +8 -0
  4. package/lib/components/DocumentCenter/DeleteDocumentModal.js +13 -0
  5. package/lib/components/DocumentCenter/DocumentCenter.d.ts +23 -0
  6. package/lib/components/DocumentCenter/DocumentCenter.js +185 -0
  7. package/lib/components/DocumentCenter/DocumentTable.d.ts +15 -0
  8. package/lib/components/DocumentCenter/DocumentTable.js +350 -0
  9. package/lib/components/DocumentCenter/DocumentUploadRow.d.ts +26 -0
  10. package/lib/components/DocumentCenter/DocumentUploadRow.js +173 -0
  11. package/lib/components/DocumentCenter/ParoDocumentsTable.d.ts +16 -0
  12. package/lib/components/DocumentCenter/ParoDocumentsTable.js +380 -0
  13. package/lib/components/DocumentCenter/UploadFilesButton.d.ts +6 -0
  14. package/lib/components/DocumentCenter/UploadFilesButton.js +29 -0
  15. package/lib/components/DocumentCenter/index.d.ts +1 -0
  16. package/lib/components/DocumentCenter/index.js +5 -0
  17. package/lib/components/ExpertProfileHeader/Banner.d.ts +6 -0
  18. package/lib/components/ExpertProfileHeader/Banner.js +7 -5
  19. package/lib/components/ExpertProfileHeader/EarningsSection.d.ts +2 -1
  20. package/lib/components/ExpertProfileHeader/EarningsSection.js +8 -3
  21. package/lib/components/ExpertProfileHeader/ExpertProfileHeader.js +1 -1
  22. package/lib/components/shared/ToastNotification.d.ts +10 -0
  23. package/lib/components/shared/ToastNotification.js +63 -0
  24. package/lib/components/shared/utils.d.ts +29 -0
  25. package/lib/components/shared/utils.js +162 -1
  26. package/lib/index.d.ts +1 -0
  27. package/lib/index.js +3 -1
  28. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  export declare const isOnClickEvent: (potentialEvent: any) => boolean;
2
3
  export declare const formatTenure: (timestamp: string) => string;
3
4
  export declare const isOlderThan30Days: (timestamp: string | number) => boolean;
@@ -5,3 +6,31 @@ export declare const getPreviousMonthStartDate: (previous: boolean) => string;
5
6
  export declare const stateAbbreviationMap: {
6
7
  [key: string]: string;
7
8
  };
9
+ export declare const getFileMimeType: (filename: string) => "application/pdf" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-powerpoint" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/octet-stream";
10
+ export declare const handleDownloadPdf: ({ fileData, downloadFilename, }: {
11
+ fileData: any;
12
+ downloadFilename: string;
13
+ }) => void;
14
+ export declare const CustomPaper: React.ComponentType<Pick<import("@material-ui/core").PaperProps, "variant" | "id" | "square" | "color" | "content" | "translate" | "hidden" | "slot" | "style" | "title" | "dir" | "rel" | "accessKey" | "draggable" | "lang" | "prefix" | "role" | "children" | "contentEditable" | "enterKeyHint" | "inputMode" | "nonce" | "tabIndex" | "ref" | "suppressHydrationWarning" | "elevation" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "autoCapitalize" | "autoFocus" | "contextMenu" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "component" | "innerRef"> & import("@material-ui/core").StyledComponentProps<"root"> & {
15
+ className?: string;
16
+ }>;
17
+ export type Order = 'asc' | 'desc';
18
+ export declare function getComparator<Key extends keyof any>(order: Order, orderBy: Key, descendingComparator: any): (a: {
19
+ [key in Key]: any;
20
+ }, b: {
21
+ [key in Key]: any;
22
+ }) => number;
23
+ export declare function stableSort<T>(array: readonly T[], comparator: (a: T, b: T) => number): T[];
24
+ export declare function compareItems<T>(a: T, b: T, orderBy: keyof T): 0 | 1 | -1;
25
+ export declare const formatDate: (timestamp: string | number | Date) => string;
26
+ export declare const ACCEPTED_FILE_TYPES: string[];
27
+ export declare const MAX_FILE_SIZE = 5242880;
28
+ export declare const showToast: (type: "success" | "warning", message: string) => void;
29
+ export declare const validateFileUpload: (file: File | null, isClientTab: boolean) => boolean;
30
+ export declare const DOCUMENT_TYPE_CONSTANTS: {
31
+ "Financial Documents": string;
32
+ "Contractual and Legal Documents": string;
33
+ "Operational and Management Documents": string;
34
+ "Tax and Compliance Documents": string;
35
+ "Project Specific Documents": string;
36
+ };
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stateAbbreviationMap = exports.getPreviousMonthStartDate = exports.isOlderThan30Days = exports.formatTenure = exports.isOnClickEvent = void 0;
3
+ exports.DOCUMENT_TYPE_CONSTANTS = exports.validateFileUpload = exports.showToast = exports.MAX_FILE_SIZE = exports.ACCEPTED_FILE_TYPES = exports.formatDate = exports.CustomPaper = exports.handleDownloadPdf = exports.getFileMimeType = exports.stateAbbreviationMap = exports.getPreviousMonthStartDate = exports.isOlderThan30Days = exports.formatTenure = exports.isOnClickEvent = void 0;
4
+ exports.getComparator = getComparator;
5
+ exports.stableSort = stableSort;
6
+ exports.compareItems = compareItems;
7
+ const core_1 = require("@material-ui/core");
8
+ const ReviewsTab_1 = require("../ReviewsTab/ReviewsTab");
4
9
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
10
  const isOnClickEvent = (potentialEvent) => {
6
11
  return (potentialEvent === null || potentialEvent === void 0 ? void 0 : potentialEvent.type) === 'mouseup' || (potentialEvent === null || potentialEvent === void 0 ? void 0 : potentialEvent.type) === 'keydown' || (potentialEvent === null || potentialEvent === void 0 ? void 0 : potentialEvent.type) === 'click';
@@ -105,3 +110,159 @@ exports.stateAbbreviationMap = {
105
110
  SK: 'Saskatchewan',
106
111
  YT: 'Yukon'
107
112
  };
113
+ const getFileMimeType = (filename) => {
114
+ var _a;
115
+ const extension = (_a = filename.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
116
+ switch (extension) {
117
+ case 'pdf':
118
+ return 'application/pdf';
119
+ case 'doc':
120
+ return 'application/msword';
121
+ case 'docx':
122
+ return 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
123
+ case 'ppt':
124
+ return 'application/vnd.ms-powerpoint';
125
+ case 'xls':
126
+ return 'application/vnd.ms-excel';
127
+ case 'xlsx':
128
+ return 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
129
+ default:
130
+ return 'application/octet-stream';
131
+ }
132
+ };
133
+ exports.getFileMimeType = getFileMimeType;
134
+ const handleDownloadPdf = ({ fileData, downloadFilename, }) => {
135
+ var _a, _b;
136
+ const byteCharacters = atob((_b = (_a = fileData === null || fileData === void 0 ? void 0 : fileData.data) === null || _a === void 0 ? void 0 : _a.getFile) === null || _b === void 0 ? void 0 : _b.data);
137
+ const byteNumbers = new Array(byteCharacters.length);
138
+ for (let i = 0; i < byteCharacters.length; i++) {
139
+ byteNumbers[i] = byteCharacters.charCodeAt(i);
140
+ }
141
+ const byteArray = new Uint8Array(byteNumbers);
142
+ const blob = new Blob([byteArray], { type: 'application/pdf' });
143
+ const blobUrl = URL.createObjectURL(blob);
144
+ const newTab = window.open(blobUrl, '_blank');
145
+ const downloadLink = document.createElement('a');
146
+ downloadLink.href = blobUrl;
147
+ downloadLink.download = downloadFilename;
148
+ document.body.appendChild(downloadLink);
149
+ downloadLink.click();
150
+ document.body.removeChild(downloadLink);
151
+ URL.revokeObjectURL(blobUrl);
152
+ if (newTab) {
153
+ newTab.focus();
154
+ }
155
+ };
156
+ exports.handleDownloadPdf = handleDownloadPdf;
157
+ exports.CustomPaper = (0, core_1.styled)(core_1.Paper)({
158
+ overflow: 'auto',
159
+ padding: '12px',
160
+ scrollbarWidth: 'auto', // For Firefox
161
+ '-ms-overflow-style': 'auto', // For IE 10+
162
+ '&::-webkit-scrollbar': {
163
+ width: '6px',
164
+ height: '6px',
165
+ },
166
+ '&::-webkit-scrollbar-track': {
167
+ background: '#C1C1C1',
168
+ borderRadius: '4px',
169
+ },
170
+ '&::-webkit-scrollbar-thumb': {
171
+ background: '#F1F1F1',
172
+ },
173
+ '&::-webkit-scrollbar-thumb:hover': {
174
+ background: '#FFFFFF',
175
+ },
176
+ });
177
+ function getComparator(order, orderBy, descendingComparator) {
178
+ return order === 'desc'
179
+ ? (a, b) => descendingComparator(a, b, orderBy)
180
+ : (a, b) => -descendingComparator(a, b, orderBy);
181
+ }
182
+ function stableSort(array, comparator) {
183
+ const stabilizedThis = array.map((el, index) => [el, index]);
184
+ stabilizedThis.sort((a, b) => {
185
+ const order = comparator(a[0], b[0]);
186
+ if (order !== 0) {
187
+ return order;
188
+ }
189
+ return a[1] - b[1];
190
+ });
191
+ return stabilizedThis.map((el) => el[0]);
192
+ }
193
+ function compareItems(a, b, orderBy) {
194
+ const selectedColumnA = a === null || a === void 0 ? void 0 : a[orderBy];
195
+ const selectedColumnB = b === null || b === void 0 ? void 0 : b[orderBy];
196
+ if (selectedColumnA === 'N/A' && selectedColumnB !== 'N/A') {
197
+ return 1;
198
+ }
199
+ if (selectedColumnA !== 'N/A' && selectedColumnB === 'N/A') {
200
+ return -1;
201
+ }
202
+ if (selectedColumnB === undefined) {
203
+ return -1;
204
+ }
205
+ if (selectedColumnA === undefined) {
206
+ return 1;
207
+ }
208
+ //@ts-ignore
209
+ if (selectedColumnB < selectedColumnA) {
210
+ return -1;
211
+ }
212
+ //@ts-ignore
213
+ if (selectedColumnB > selectedColumnA) {
214
+ return 1;
215
+ }
216
+ return 0;
217
+ }
218
+ ;
219
+ const formatDate = (timestamp) => {
220
+ const date = new Date(timestamp);
221
+ const month = String(date.getUTCMonth() + 1).padStart(2, '0');
222
+ const day = String(date.getUTCDate()).padStart(2, '0');
223
+ const year = date.getUTCFullYear();
224
+ return `${month}-${day}-${year}`;
225
+ };
226
+ exports.formatDate = formatDate;
227
+ exports.ACCEPTED_FILE_TYPES = [
228
+ 'application/pdf',
229
+ 'application/msword',
230
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
231
+ 'application/vnd.ms-powerpoint',
232
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
233
+ 'application/vnd.ms-excel',
234
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
235
+ ];
236
+ exports.MAX_FILE_SIZE = 5242880; // 5MB
237
+ const showToast = (type, message) => {
238
+ (0, ReviewsTab_1.toastNotification)({
239
+ position: 'top-center',
240
+ color: type,
241
+ message,
242
+ icon: type,
243
+ });
244
+ };
245
+ exports.showToast = showToast;
246
+ const validateFileUpload = (file, isClientTab) => {
247
+ if (!file) {
248
+ (0, exports.showToast)('warning', 'No file selected.');
249
+ return false;
250
+ }
251
+ if (!exports.ACCEPTED_FILE_TYPES.includes(file.type)) {
252
+ (0, exports.showToast)('warning', 'Invalid file type. Please upload a valid file (PDF, DOC, DOCX, PPT, XLS, XLSX).');
253
+ return false;
254
+ }
255
+ if (file.size > exports.MAX_FILE_SIZE && !isClientTab) {
256
+ (0, exports.showToast)('warning', 'Document did not upload due to the file size being too large, please reduce the file size below 5 MB');
257
+ return false;
258
+ }
259
+ return true;
260
+ };
261
+ exports.validateFileUpload = validateFileUpload;
262
+ exports.DOCUMENT_TYPE_CONSTANTS = {
263
+ "Financial Documents": "FINANCIAL_DOCUMENTS",
264
+ "Contractual and Legal Documents": "CONTRACTUAL_AND_LEGAL_DOCUMENTS",
265
+ "Operational and Management Documents": "OPERATIONAL_AND_MANAGEMENT_DOCUMENTS",
266
+ "Tax and Compliance Documents": "TAX_AND_COMPLIANCE_DOCUMENTS",
267
+ "Project Specific Documents": "PROJECT_SPECIFIC_DOCUMENTS"
268
+ };
package/lib/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export { FirmEmployeeSection } from './components/FirmEmployeeSection';
5
5
  export { OrganizationChart } from './components/OrganizationChart';
6
6
  export { ExpertProfileHeader } from './components/ExpertProfileHeader';
7
7
  export { ProfileCompletedPercentage } from './components/ProfileCompletedPercentange';
8
+ export { DocumentCenter } from './components/DocumentCenter';
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProfileCompletedPercentage = exports.ExpertProfileHeader = exports.OrganizationChart = exports.FirmEmployeeSection = exports.ClientReferenceSection = exports.Reviews = exports.ReviewsTab = void 0;
3
+ 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");
@@ -15,3 +15,5 @@ var ExpertProfileHeader_1 = require("./components/ExpertProfileHeader");
15
15
  Object.defineProperty(exports, "ExpertProfileHeader", { enumerable: true, get: function () { return ExpertProfileHeader_1.ExpertProfileHeader; } });
16
16
  var ProfileCompletedPercentange_1 = require("./components/ProfileCompletedPercentange");
17
17
  Object.defineProperty(exports, "ProfileCompletedPercentage", { enumerable: true, get: function () { return ProfileCompletedPercentange_1.ProfileCompletedPercentage; } });
18
+ var DocumentCenter_1 = require("./components/DocumentCenter");
19
+ Object.defineProperty(exports, "DocumentCenter", { enumerable: true, get: function () { return DocumentCenter_1.DocumentCenter; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paro.io/expert-shared-components",
3
- "version": "1.4.11",
3
+ "version": "1.5.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {