@paro.io/expert-shared-components 1.11.2 → 1.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +2 -2
  3. package/lib/components/ClientReferencesSection/DeleteButton.js +11 -11
  4. package/lib/components/ClientReferencesSection/ParoError.js +10 -10
  5. package/lib/components/ClientReferencesSection/TagsSection.js +2 -2
  6. package/lib/components/ClientReferencesSection/styles/BrandedTypography.js +2 -2
  7. package/lib/components/ClientReferencesSection/styles/Buttons.js +15 -15
  8. package/lib/components/ClientReferencesSection/styles/Name.js +5 -5
  9. package/lib/components/ClientReferencesSection/styles/NullContentConditionalColor.js +4 -4
  10. package/lib/components/ClientReferencesSection/styles/SectionBody.js +11 -11
  11. package/lib/components/ClientReferencesSection/styles/SectionTitle.js +6 -6
  12. package/lib/components/ClientReferencesSection/styles/Tags.js +2 -2
  13. package/lib/components/DiscussionThread/DiscussionThread.d.ts +2 -2
  14. package/lib/components/DiscussionThread/DiscussionThread.js +64 -41
  15. package/lib/components/DocumentCenter/DocumentTable.d.ts +15 -15
  16. package/lib/components/DocumentCenter/DocumentTable.js +350 -350
  17. package/lib/components/DocumentCenter/UploadFilesButton.d.ts +6 -6
  18. package/lib/components/DocumentCenter/UploadFilesButton.js +29 -29
  19. package/lib/components/EarningsTracker/ActiveProjectCard.d.ts +52 -52
  20. package/lib/components/EarningsTracker/ActiveProjectCard.js +161 -161
  21. package/lib/components/EarningsTracker/CenterCardUI.d.ts +13 -13
  22. package/lib/components/EarningsTracker/CenterCardUI.js +134 -134
  23. package/lib/components/EarningsTracker/EarningsTracker.d.ts +52 -52
  24. package/lib/components/EarningsTracker/EarningsTracker.js +508 -508
  25. package/lib/components/EarningsTracker/EditDateModal.d.ts +22 -22
  26. package/lib/components/EarningsTracker/EditDateModal.js +149 -149
  27. package/lib/components/EarningsTracker/EmailModal.d.ts +14 -14
  28. package/lib/components/EarningsTracker/EmailModal.js +79 -79
  29. package/lib/components/EarningsTracker/EndProjectModal.d.ts +56 -56
  30. package/lib/components/EarningsTracker/EndProjectModal.js +221 -221
  31. package/lib/components/EarningsTracker/LeftCardUI.d.ts +18 -18
  32. package/lib/components/EarningsTracker/LeftCardUI.js +189 -189
  33. package/lib/components/EarningsTracker/LogTimeModalAuthenticated.d.ts +52 -52
  34. package/lib/components/EarningsTracker/LogTimeModalAuthenticated.js +358 -358
  35. package/lib/components/EarningsTracker/ProgressBar.d.ts +4 -4
  36. package/lib/components/EarningsTracker/ProgressBar.js +66 -66
  37. package/lib/components/EarningsTracker/ReviewRequestModal.d.ts +17 -17
  38. package/lib/components/EarningsTracker/ReviewRequestModal.js +135 -135
  39. package/lib/components/EarningsTracker/RightCardUI.d.ts +46 -46
  40. package/lib/components/EarningsTracker/RightCardUI.js +231 -231
  41. package/lib/components/EarningsTracker/index.d.ts +1 -1
  42. package/lib/components/EarningsTracker/index.js +5 -5
  43. package/lib/components/ExpertProfileHeader/ActionButtonSection.js +6 -6
  44. package/lib/components/ExpertProfileHeader/ProfileSection.js +7 -7
  45. package/lib/components/Invoices/DecisionSection.d.ts +7 -0
  46. package/lib/components/Invoices/DecisionSection.js +95 -0
  47. package/lib/components/Invoices/DiscussionSection.d.ts +19 -0
  48. package/lib/components/Invoices/DiscussionSection.js +163 -0
  49. package/lib/components/Invoices/DisputeProjectCard.d.ts +20 -0
  50. package/lib/components/Invoices/DisputeProjectCard.js +79 -0
  51. package/lib/components/Invoices/DisputeSection.d.ts +7 -0
  52. package/lib/components/Invoices/DisputeSection.js +94 -0
  53. package/lib/components/Invoices/InvoiceCard.d.ts +8 -3
  54. package/lib/components/Invoices/InvoiceCard.js +18 -204
  55. package/lib/components/Invoices/InvoiceDetails.d.ts +5 -0
  56. package/lib/components/Invoices/InvoiceDetails.js +34 -0
  57. package/lib/components/Invoices/InvoiceHeader.d.ts +5 -0
  58. package/lib/components/Invoices/InvoiceHeader.js +29 -0
  59. package/lib/components/OrganizationChart/OrganizationChart.d.ts +15 -15
  60. package/lib/components/OrganizationChart/OrganizationChart.js +312 -312
  61. package/lib/components/OrganizationChart/PersonCard.js +5 -5
  62. package/lib/components/OrganizationChart/utils.js +79 -79
  63. package/lib/components/ProjectCard/ProgressBar.js +4 -4
  64. package/lib/components/ProjectCard/ReviewRequestModal.js +5 -5
  65. package/lib/components/Reviews/Pagination.js +6 -6
  66. package/lib/components/ReviewsTab/RatingHeader.js +6 -6
  67. package/lib/components/ReviewsTab/expert-shared-components.code-workspace +20 -20
  68. package/lib/components/ReviewsTab/reviewRequestModal.js +5 -5
  69. package/lib/components/shared/Image.js +13 -13
  70. package/lib/components/shared/ProfileTextField.d.ts +18 -18
  71. package/lib/components/shared/ProfileTextField.js +16 -16
  72. package/lib/components/shared/StyledActionButtons.d.ts +7 -7
  73. package/lib/components/shared/StyledActionButtons.js +15 -15
  74. package/lib/components/shared/ToastNotification.d.ts +10 -10
  75. package/lib/components/shared/ToastNotification.js +63 -63
  76. package/package.json +61 -61
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Paro, Inc
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Paro, Inc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,2 +1,2 @@
1
- # expert-shared-components
2
- Repository to store Components shared between the Expert Apps and Internal Apps
1
+ # expert-shared-components
2
+ Repository to store Components shared between the Expert Apps and Internal Apps
@@ -15,26 +15,26 @@ const omitDeleteButtonIconProps = ["isDisabled"];
15
15
  const omitDeleteButtonTypographyProps = ["isDisabled"];
16
16
  const DeleteButtonTypography = (0, styled_components_1.default)((props) => {
17
17
  return react_1.default.createElement(Typography_1.default, Object.assign({}, (0, omit_1.default)(props, omitDeleteButtonTypographyProps)));
18
- }) `
19
- padding-right: 17px;
20
- color: ${colors_1.default.deleteButtonRed} !important ;
18
+ }) `
19
+ padding-right: 17px;
20
+ color: ${colors_1.default.deleteButtonRed} !important ;
21
21
  ${({ isDisabled }) => {
22
22
  return (isDisabled &&
23
- `
24
- color: ${colors_1.default.notice} !important;
23
+ `
24
+ color: ${colors_1.default.notice} !important;
25
25
  `);
26
- }}
26
+ }}
27
27
  `;
28
28
  const DeleteButtonIcon = (0, styled_components_1.default)((props) => {
29
29
  return react_1.default.createElement(Clear_1.default, Object.assign({}, (0, omit_1.default)(props, omitDeleteButtonIconProps)));
30
- }) `
31
- color: ${colors_1.default.deleteButtonRed} !important ;
30
+ }) `
31
+ color: ${colors_1.default.deleteButtonRed} !important ;
32
32
  ${({ isDisabled }) => {
33
33
  return (isDisabled &&
34
- `
35
- color: ${colors_1.default.notice} !important;
34
+ `
35
+ color: ${colors_1.default.notice} !important;
36
36
  `);
37
- }}
37
+ }}
38
38
  `;
39
39
  const DeleteButton = ({ buttonText, onClick, variant = "text", isDisabled, className }) => {
40
40
  return (react_1.default.createElement(Buttons_1.StyledEditOrDeleteButton, { onClick: () => {
@@ -9,18 +9,18 @@ const core_1 = require("@material-ui/core");
9
9
  const styled_components_1 = __importDefault(require("styled-components"));
10
10
  const colors_1 = __importDefault(require("./constants/colors"));
11
11
  const AlertSnackBarButton_1 = require("./AlertSnackBarButton");
12
- const ErrorBox = (0, styled_components_1.default)(core_1.Box) `
13
- width: 100%;
14
- padding-bottom: 100;
12
+ const ErrorBox = (0, styled_components_1.default)(core_1.Box) `
13
+ width: 100%;
14
+ padding-bottom: 100;
15
15
  `;
16
- const ParoTitle = (0, styled_components_1.default)(core_1.Box) `
17
- color: ${colors_1.default.paroBlack};
18
- padding: 0px 0px 18px 0px;
16
+ const ParoTitle = (0, styled_components_1.default)(core_1.Box) `
17
+ color: ${colors_1.default.paroBlack};
18
+ padding: 0px 0px 18px 0px;
19
19
  `;
20
- const ParoSubtitle = styled_components_1.default.div `
21
- color: ${colors_1.default.paroBlack};
22
- margin-bottom: 24px;
23
- font-size: 1rem;
20
+ const ParoSubtitle = styled_components_1.default.div `
21
+ color: ${colors_1.default.paroBlack};
22
+ margin-bottom: 24px;
23
+ font-size: 1rem;
24
24
  `;
25
25
  const ParoError = ({ handleClose }) => {
26
26
  const handleCancelLanguage = handleClose ? "Close" : "Retry";
@@ -9,8 +9,8 @@ const core_1 = require("@material-ui/core");
9
9
  const styled_components_1 = __importDefault(require("styled-components"));
10
10
  const NullContentConditionalColor_1 = require("./styles/NullContentConditionalColor");
11
11
  const Tags_1 = require("./styles/Tags");
12
- const ProfileTags = (0, styled_components_1.default)(Tags_1.Tags) `
13
- margin: 0 5px 8px 0;
12
+ const ProfileTags = (0, styled_components_1.default)(Tags_1.Tags) `
13
+ margin: 0 5px 8px 0;
14
14
  `;
15
15
  const TagsSection = ({ multiLine, tags = [], tagsExpected, }) => {
16
16
  if ((tags === null || tags === void 0 ? void 0 : tags.length) < 1) {
@@ -7,6 +7,6 @@ exports.StyledTypography = void 0;
7
7
  const Typography_1 = __importDefault(require("@material-ui/core/Typography"));
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const colors_1 = __importDefault(require("../constants/colors"));
10
- exports.StyledTypography = (0, styled_components_1.default)(Typography_1.default) `
11
- color: ${colors_1.default.paroDeepblue} !important ;
10
+ exports.StyledTypography = (0, styled_components_1.default)(Typography_1.default) `
11
+ color: ${colors_1.default.paroDeepblue} !important ;
12
12
  `;
@@ -7,21 +7,21 @@ exports.StyledEditOrDeleteButton = exports.HeaderButtonUnderline = exports.Heade
7
7
  const core_1 = require("@material-ui/core");
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const colors_1 = __importDefault(require("../constants/colors"));
10
- exports.HeaderButtons = (0, styled_components_1.default)(core_1.Button) `
11
- margin-left: 0px !important;
12
- padding-left: 0px !important;
13
- span {
14
- color: ${colors_1.default.buttonText} !important;
15
- }
10
+ exports.HeaderButtons = (0, styled_components_1.default)(core_1.Button) `
11
+ margin-left: 0px !important;
12
+ padding-left: 0px !important;
13
+ span {
14
+ color: ${colors_1.default.buttonText} !important;
15
+ }
16
16
  `;
17
- exports.HeaderButtonUnderline = (0, styled_components_1.default)(exports.HeaderButtons) `
18
- text-decoration: underline;
17
+ exports.HeaderButtonUnderline = (0, styled_components_1.default)(exports.HeaderButtons) `
18
+ text-decoration: underline;
19
19
  `;
20
- exports.StyledEditOrDeleteButton = (0, styled_components_1.default)(core_1.Button) `
21
- margin: 10px 0px !important;
22
- background-color: ${colors_1.default.primary};
23
- color: ${colors_1.default.white};
24
- :hover {
25
- color: ${colors_1.default.primary} !important;
26
- }
20
+ exports.StyledEditOrDeleteButton = (0, styled_components_1.default)(core_1.Button) `
21
+ margin: 10px 0px !important;
22
+ background-color: ${colors_1.default.primary};
23
+ color: ${colors_1.default.white};
24
+ :hover {
25
+ color: ${colors_1.default.primary} !important;
26
+ }
27
27
  `;
@@ -11,12 +11,12 @@ const styled_components_1 = __importDefault(require("styled-components"));
11
11
  const colors_1 = __importDefault(require("../constants/colors"));
12
12
  exports.Name = (0, styled_components_1.default)((props) => {
13
13
  return react_1.default.createElement(core_1.Typography, Object.assign({}, (0, omit_1.default)(props, ["isNull"])));
14
- }) `
15
- font-family: Roboto-Bold;
14
+ }) `
15
+ font-family: Roboto-Bold;
16
16
  ${({ isNull }) => {
17
17
  return (isNull &&
18
- `
19
- color: ${colors_1.default.paroRed} !important;
18
+ `
19
+ color: ${colors_1.default.paroRed} !important;
20
20
  `);
21
- }}
21
+ }}
22
22
  `;
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.NullContentConditionalColor = void 0;
7
7
  const styled_components_1 = __importDefault(require("styled-components"));
8
8
  const colors_1 = __importDefault(require("../constants/colors"));
9
- exports.NullContentConditionalColor = styled_components_1.default.span `
9
+ exports.NullContentConditionalColor = styled_components_1.default.span `
10
10
  ${(props) => {
11
11
  return (props.isNull &&
12
- `
13
- color: ${colors_1.default.paroRed} !important
12
+ `
13
+ color: ${colors_1.default.paroRed} !important
14
14
  `);
15
- }}
15
+ }}
16
16
  `;
@@ -10,18 +10,18 @@ const styled_components_1 = __importDefault(require("styled-components"));
10
10
  const colors_1 = __importDefault(require("../constants/colors"));
11
11
  exports.SectionBody = (0, styled_components_1.default)((props) => {
12
12
  return react_1.default.createElement("div", Object.assign({}, (0, omit_1.default)(props, ["atLeastOneValueIsNull"])));
13
- }) `
14
- background-color: ${colors_1.default.white};
15
- border-radius: 2px;
16
- border: 1px Solid ${colors_1.default.lightGray};
17
- color: ${colors_1.default.paroBlack};
18
- font-family: Roboto;
19
- padding: 32.5px 42.5px 32.5px 42.5px;
20
- width: 100%;
13
+ }) `
14
+ background-color: ${colors_1.default.white};
15
+ border-radius: 2px;
16
+ border: 1px Solid ${colors_1.default.lightGray};
17
+ color: ${colors_1.default.paroBlack};
18
+ font-family: Roboto;
19
+ padding: 32.5px 42.5px 32.5px 42.5px;
20
+ width: 100%;
21
21
  ${({ atLeastOneValueIsNull }) => {
22
22
  return (atLeastOneValueIsNull &&
23
- `
24
- border-color: ${colors_1.default.paroRed} !important;
23
+ `
24
+ border-color: ${colors_1.default.paroRed} !important;
25
25
  `);
26
- }}
26
+ }}
27
27
  `;
@@ -10,12 +10,12 @@ const styled_components_1 = __importDefault(require("styled-components"));
10
10
  const colors_1 = __importDefault(require("../constants/colors"));
11
11
  exports.SectionTitle = (0, styled_components_1.default)((props) => {
12
12
  return react_1.default.createElement("div", Object.assign({}, (0, omit_1.default)(props, ["noBottomPadding"])));
13
- }) `
14
- font-family: Roboto-Bold;
15
- font-size: 20px;
16
- color: ${colors_1.default.paroBlack};
17
- padding: 23px 0px 15.5px 0px;
13
+ }) `
14
+ font-family: Roboto-Bold;
15
+ font-size: 20px;
16
+ color: ${colors_1.default.paroBlack};
17
+ padding: 23px 0px 15.5px 0px;
18
18
  ${({ noBottomPadding }) => {
19
19
  return noBottomPadding && "padding-bottom: 0 !important;";
20
- }}
20
+ }}
21
21
  `;
@@ -6,6 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Tags = void 0;
7
7
  const core_1 = require("@material-ui/core");
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
- exports.Tags = (0, styled_components_1.default)(core_1.Chip) `
10
- font-family: Roboto-Bold;
9
+ exports.Tags = (0, styled_components_1.default)(core_1.Chip) `
10
+ font-family: Roboto-Bold;
11
11
  `;
@@ -8,7 +8,6 @@ interface ChatMessages {
8
8
  firstName: string;
9
9
  lastName: string;
10
10
  userTypeId: number;
11
- avatar: string | null;
12
11
  };
13
12
  messageText: string;
14
13
  visibility: "ALL" | "INTERNAL_ONLY" | "CLIENT_INTERNAL_ONLY" | "EXPERT_INTERNAL_ONLY";
@@ -20,6 +19,7 @@ interface DiscussionThreadProps {
20
19
  currentUser: any;
21
20
  initialThreads: ChatMessages[] | [];
22
21
  createDisputeChatMessage: any;
22
+ disputeId: number;
23
23
  }
24
- export declare const DiscussionThread: ({ currentUser, initialThreads, createDisputeChatMessage, }: DiscussionThreadProps) => React.JSX.Element;
24
+ export declare const DiscussionThread: ({ currentUser, initialThreads, createDisputeChatMessage, disputeId, }: DiscussionThreadProps) => React.JSX.Element;
25
25
  export {};
@@ -22,52 +22,75 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
25
34
  Object.defineProperty(exports, "__esModule", { value: true });
26
35
  exports.DiscussionThread = void 0;
27
36
  const react_1 = __importStar(require("react"));
28
37
  const base_ui_1 = require("@paro.io/base-ui");
29
- const DiscussionThread = ({ currentUser, initialThreads, createDisputeChatMessage, }) => {
38
+ const DiscussionThread = ({ currentUser, initialThreads, createDisputeChatMessage, disputeId, }) => {
30
39
  const [messages, setMessages] = (0, react_1.useState)(initialThreads);
40
+ const [sending, setSending] = (0, react_1.useState)(false);
31
41
  const [comment, setComment] = (0, react_1.useState)("");
32
42
  const threadsEndRef = (0, react_1.useRef)(null);
33
- const [invalid, setInvalid] = (0, react_1.useState)(false);
43
+ const didMountRef = (0, react_1.useRef)(false);
34
44
  // Auto scroll to bottom when messages change
35
45
  (0, react_1.useEffect)(() => {
36
- var _a;
37
- (_a = threadsEndRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
38
- }, [messages]);
39
- const handleSend = () => {
40
- setInvalid(false);
41
- if (comment) {
42
- createDisputeChatMessage();
43
- handleSendMessage();
44
- setComment("");
46
+ if (didMountRef.current) {
47
+ if (threadsEndRef.current) {
48
+ threadsEndRef.current.scrollIntoView({ behavior: "smooth" });
49
+ }
45
50
  }
46
51
  else {
47
- setInvalid(true);
52
+ didMountRef.current = true;
48
53
  }
49
- };
50
- const handleSendMessage = () => {
51
- const newMsg = {
52
- messageId: 0, // update required
53
- disputeId: messages[0].disputeId,
54
- sender: {
55
- id: currentUser.id,
56
- email: currentUser.email,
57
- firstName: currentUser.name.split(' ')[0] || '',
58
- lastName: currentUser.name.split(' ')[1] || '',
59
- userTypeId: currentUser.userTypeId,
60
- avatar: currentUser.avatar,
61
- },
62
- messageText: comment,
63
- visibility: "ALL",
64
- createdAt: new Date().toISOString(),
65
- updatedAt: new Date().toISOString(),
66
- isDeleted: false,
67
- };
68
- setMessages([...messages, newMsg]);
69
- setComment("");
70
- };
54
+ }, [messages]);
55
+ const handleSend = () => __awaiter(void 0, void 0, void 0, function* () {
56
+ setSending(true);
57
+ try {
58
+ if (comment) {
59
+ const chatInput = {
60
+ disputeId: disputeId,
61
+ messageText: comment,
62
+ senderId: currentUser === null || currentUser === void 0 ? void 0 : currentUser.userId,
63
+ visibility: "ALL"
64
+ };
65
+ yield createDisputeChatMessage({
66
+ variables: {
67
+ input: chatInput
68
+ }
69
+ }).then((res) => {
70
+ const newMsg = {
71
+ messageId: res.data.createDisputeChatMessage.messageId,
72
+ disputeId: res.data.createDisputeChatMessage.disputeId,
73
+ sender: res.data.createDisputeChatMessage.sender,
74
+ messageText: res.data.createDisputeChatMessage.messageText,
75
+ visibility: res.data.createDisputeChatMessage.visibility,
76
+ createdAt: res.data.createDisputeChatMessage.createdAt,
77
+ updatedAt: res.data.createDisputeChatMessage.updatedAt,
78
+ isDeleted: res.data.createDisputeChatMessage.isDeleted,
79
+ };
80
+ setMessages([...messages, newMsg]);
81
+ setComment("");
82
+ }).catch((error) => {
83
+ console.error("Error creating dispute chat message:", error);
84
+ });
85
+ }
86
+ }
87
+ catch (error) {
88
+ console.error("Error sending message:", error);
89
+ }
90
+ finally {
91
+ setSending(false);
92
+ }
93
+ });
71
94
  const handleKeyPress = (e) => {
72
95
  if (e.key === "Enter" && !e.shiftKey) {
73
96
  e.preventDefault();
@@ -87,17 +110,17 @@ const DiscussionThread = ({ currentUser, initialThreads, createDisputeChatMessag
87
110
  .toUpperCase()
88
111
  .substring(0, 2);
89
112
  };
90
- return (react_1.default.createElement("div", { className: "flex flex-col w-full rounded-lg bg-white px-4 h-auto" },
113
+ return (react_1.default.createElement("div", { className: "flex flex-col w-full rounded-lg bg-white h-auto" },
91
114
  react_1.default.createElement("div", { className: `py-3 flex items-center` },
92
115
  react_1.default.createElement("div", { className: "font-semibold text-gray-800 capitalize" }, "Discussion Thread")),
93
- react_1.default.createElement("div", { className: "flex-1 max-h-[30vh] overflow-y-auto border rounded-md p-2" },
116
+ messages.length ? react_1.default.createElement("div", { className: "flex-1 max-h-[30vh] overflow-y-auto border rounded-md p-2" },
94
117
  messages.map((message) => {
95
- var _a;
96
- const isCurrentUser = currentUser.id === message.sender.id;
118
+ const isCurrentUser = currentUser.userId === message.sender.id;
97
119
  const userName = message.sender.firstName + message.sender.lastName;
98
120
  const timestamp = message.updatedAt ? message.updatedAt : message.createdAt;
99
121
  return (react_1.default.createElement("div", { key: message.messageId, className: `flex mb-4 ${isCurrentUser ? 'justify-end' : 'justify-start'}` },
100
- !isCurrentUser && (react_1.default.createElement("div", { className: "flex-shrink-0 mr-2" }, ((_a = message.sender) === null || _a === void 0 ? void 0 : _a.avatar) ? (react_1.default.createElement("img", { src: message.sender.avatar, alt: userName, className: "h-8 w-8 rounded-full" })) : (react_1.default.createElement("div", { className: "h-8 w-8 rounded-full bg-gray-400 flex items-center justify-center text-white text-xs font-medium bg-[#5f4508]" }, getInitials(userName || 'User'))))),
122
+ !isCurrentUser && (react_1.default.createElement("div", { className: "flex-shrink-0 mr-2" },
123
+ react_1.default.createElement("div", { className: "h-8 w-8 rounded-full bg-gray-400 flex items-center justify-center text-white text-xs font-medium bg-[#5f4508]" }, getInitials(userName || 'User')))),
101
124
  react_1.default.createElement("div", { className: `ml-1 min-w-min max-w-[75%] break-words` },
102
125
  !isCurrentUser && (react_1.default.createElement("div", { className: "text-xs text-gray-500 font-medium mb-1" }, userName || 'Unknown User')),
103
126
  react_1.default.createElement("div", { className: `px-4 py-2 rounded-lg ${isCurrentUser
@@ -105,10 +128,10 @@ const DiscussionThread = ({ currentUser, initialThreads, createDisputeChatMessag
105
128
  : 'bg-[#f9d8a7] border rounded-bl-none'}` }, message.messageText),
106
129
  react_1.default.createElement("div", { className: "text-xs text-gray-500 mt-1" }, formatTime(timestamp)))));
107
130
  }),
108
- react_1.default.createElement("div", { ref: threadsEndRef })),
131
+ react_1.default.createElement("div", { ref: threadsEndRef })) : react_1.default.createElement(react_1.default.Fragment, null),
109
132
  react_1.default.createElement("div", { className: "py-3" },
110
133
  react_1.default.createElement("div", { className: "flex items-center" },
111
134
  react_1.default.createElement("textarea", { value: comment, onChange: (e) => setComment(e.target.value), onKeyDown: handleKeyPress, placeholder: "Type your message here...", className: "flex-1 border rounded-lg px-3 py-2 resize-none focus:outline-none focus:ring-2 focus:ring-blue-500", rows: 1 }),
112
- react_1.default.createElement(base_ui_1.Button, { label: "Send", onClick: handleSend, disabled: !comment.trim(), color: "primary", className: "ml-2 px-4 py-2" })))));
135
+ react_1.default.createElement(base_ui_1.Button, { label: "Send", onClick: handleSend, disabled: !comment.trim(), isLoading: sending, color: "primary", className: "ml-2 px-4 py-2" })))));
113
136
  };
114
137
  exports.DiscussionThread = DiscussionThread;
@@ -1,15 +1,15 @@
1
- interface DocumentTableProps {
2
- legacyFreelancerId: number;
3
- paroProjectsData: any;
4
- expiryDate: string;
5
- expertFiles: any[];
6
- uploadExpertClientFiles: any;
7
- uploadFileData: any;
8
- deleteFileMutation: any;
9
- updateFreelancerExpiryMutation: any;
10
- GetFilesDocument: any;
11
- foldername: string;
12
- paroDocuments: boolean;
13
- }
14
- export declare const DocumentTable: ({ legacyFreelancerId, paroProjectsData, expiryDate, expertFiles, uploadExpertClientFiles, uploadFileData, deleteFileMutation, updateFreelancerExpiryMutation, GetFilesDocument, foldername, paroDocuments }: DocumentTableProps) => JSX.Element;
15
- export {};
1
+ interface DocumentTableProps {
2
+ legacyFreelancerId: number;
3
+ paroProjectsData: any;
4
+ expiryDate: string;
5
+ expertFiles: any[];
6
+ uploadExpertClientFiles: any;
7
+ uploadFileData: any;
8
+ deleteFileMutation: any;
9
+ updateFreelancerExpiryMutation: any;
10
+ GetFilesDocument: any;
11
+ foldername: string;
12
+ paroDocuments: boolean;
13
+ }
14
+ export declare const DocumentTable: ({ legacyFreelancerId, paroProjectsData, expiryDate, expertFiles, uploadExpertClientFiles, uploadFileData, deleteFileMutation, updateFreelancerExpiryMutation, GetFilesDocument, foldername, paroDocuments }: DocumentTableProps) => JSX.Element;
15
+ export {};