@paro.io/expert-shared-components 1.9.7 → 1.9.8

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.
@@ -34,7 +34,6 @@ const core_1 = require("@material-ui/core");
34
34
  const lab_1 = require("@material-ui/lab");
35
35
  const dayjs_1 = __importDefault(require("dayjs"));
36
36
  const styles_1 = require("@material-ui/core/styles");
37
- const moment_1 = __importDefault(require("moment"));
38
37
  const Star_1 = __importDefault(require("@material-ui/icons/Star"));
39
38
  const RightCardUI_1 = require("./RightCardUI");
40
39
  const LeftCardUI_1 = require("./LeftCardUI");
@@ -54,10 +53,10 @@ const CheckItem = ({ checked, text }) => (react_1.default.createElement("div", {
54
53
  exports.CheckItem = CheckItem;
55
54
  const getAllProjectRecommendationData = ({ projectData }) => {
56
55
  var _a;
57
- const date = (0, moment_1.default)();
58
- const lastDayOfMonth = (0, moment_1.default)().endOf('month');
59
- const daysLeftInProject = (0, moment_1.default)(projectData === null || projectData === void 0 ? void 0 : projectData.endDate).diff(date, 'day');
60
- const checkDays = (0, moment_1.default)(projectData === null || projectData === void 0 ? void 0 : projectData.endDate).isBefore(lastDayOfMonth) ? lastDayOfMonth.date() : daysLeftInProject;
56
+ const date = (0, dayjs_1.default)();
57
+ const lastDayOfMonth = (0, dayjs_1.default)().endOf('month');
58
+ const daysLeftInProject = (0, dayjs_1.default)(projectData === null || projectData === void 0 ? void 0 : projectData.endDate).diff(date, 'day');
59
+ const checkDays = (0, dayjs_1.default)(projectData === null || projectData === void 0 ? void 0 : projectData.endDate).isBefore(lastDayOfMonth) ? lastDayOfMonth.date() : daysLeftInProject;
61
60
  const remainingWeeks = Math.ceil(checkDays / 7);
62
61
  const minFloorHours = (projectData === null || projectData === void 0 ? void 0 : projectData.minFloorHours) !== null && (projectData === null || projectData === void 0 ? void 0 : projectData.minFloorHours) !== undefined && (projectData === null || projectData === void 0 ? void 0 : projectData.minFloorHours) !== 0 ? projectData === null || projectData === void 0 ? void 0 : projectData.minFloorHours : projectData === null || projectData === void 0 ? void 0 : projectData.totalEstimatedMinHours;
63
62
  const maxFloorHours = projectData === null || projectData === void 0 ? void 0 : projectData.maxHours;
@@ -108,7 +107,7 @@ const ActiveProjectCard = ({ project, projectsData, expertName, freelancerId, fr
108
107
  const [expand, setExpand] = (0, react_1.useState)(projectHealth === "!" ? true : false);
109
108
  const projectRateType = checkProjectRateType((_b = project === null || project === void 0 ? void 0 : project.projectScope) === null || _b === void 0 ? void 0 : _b.freelanceRateTypeId);
110
109
  const projectFrequencyType = checkProjectFrequencyType((_c = project === null || project === void 0 ? void 0 : project.projectScope) === null || _c === void 0 ? void 0 : _c.projectFrequencyId);
111
- const checkStartDate = (0, moment_1.default)(project === null || project === void 0 ? void 0 : project.startDate).isSameOrAfter((0, moment_1.default)());
110
+ const checkStartDate = (0, dayjs_1.default)(project === null || project === void 0 ? void 0 : project.startDate).isSame((0, dayjs_1.default)(), 'day') || (0, dayjs_1.default)(project === null || project === void 0 ? void 0 : project.startDate).isAfter((0, dayjs_1.default)());
112
111
  const classes = (0, exports.useStyles)();
113
112
  let sumOfRatingValuesOfSingleProject = 0;
114
113
  project === null || project === void 0 ? void 0 : project.rating.forEach((rating) => sumOfRatingValuesOfSingleProject += rating.overallRating);
@@ -8,7 +8,6 @@ const react_1 = __importDefault(require("react"));
8
8
  const ProgressBar_1 = require("./ProgressBar");
9
9
  const dayjs_1 = __importDefault(require("dayjs"));
10
10
  const base_ui_1 = require("@paro.io/base-ui");
11
- const moment_1 = __importDefault(require("moment"));
12
11
  const utc_1 = __importDefault(require("dayjs/plugin/utc"));
13
12
  const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
14
13
  const ActiveProjectCard_1 = require("./ActiveProjectCard");
@@ -16,19 +15,19 @@ dayjs_1.default.extend(utc_1.default);
16
15
  dayjs_1.default.extend(timezone_1.default);
17
16
  const getRecommendations = ({ weeklyHoursLogged, hoursToComplete, loggedHours, minFloorHours, maxFloorHours, hoursPerWeek, startDate, endDate, minFloorName, projectFrequencyType, projectRateType, tasks }) => {
18
17
  const items = [];
19
- if ((0, moment_1.default)(endDate).isBefore(startDate, 'day')) {
18
+ if ((0, dayjs_1.default)(endDate).isBefore(startDate, 'day')) {
20
19
  items.push(react_1.default.createElement("li", { key: "pastStartDate" }, "Please select a future end date or move your start date to a previous date."));
21
20
  }
22
- if ((0, moment_1.default)(startDate).isBefore((0, moment_1.default)(), 'day') && loggedHours <= 0) {
21
+ if ((0, dayjs_1.default)(startDate).isBefore((0, dayjs_1.default)(), 'day') && loggedHours <= 0) {
23
22
  items.push(react_1.default.createElement("li", { key: "pastStartDate" }, "Please log hours for this project or request to move the project start date to later a date."));
24
23
  }
25
24
  if (!endDate) {
26
25
  items.push(react_1.default.createElement("li", { key: "noEndDate" }, "Please edit end date above for this project."));
27
26
  }
28
- if (endDate && (0, moment_1.default)(endDate).isBefore((0, moment_1.default)(), 'day')) {
27
+ if (endDate && (0, dayjs_1.default)(endDate).isBefore((0, dayjs_1.default)(), 'day')) {
29
28
  items.push(react_1.default.createElement("li", { key: "pastEndDate" }, "Please edit end date above for this project since today's date is past the project's listed end date."));
30
29
  }
31
- if (loggedHours < minFloorHours && endDate && !weeklyHoursLogged && hoursPerWeek && (0, moment_1.default)(endDate).isSameOrAfter((0, moment_1.default)(), 'day')) {
30
+ if (loggedHours < minFloorHours && endDate && !weeklyHoursLogged && hoursPerWeek && ((0, dayjs_1.default)(startDate).isSame((0, dayjs_1.default)(), 'day') || (0, dayjs_1.default)(startDate).isAfter((0, dayjs_1.default)()))) {
32
31
  items.push(react_1.default.createElement("li", { key: "behindMFH" }, `You need to log ${(0, ProgressBar_1.formatNumberingSystem)(hoursPerWeek)} hours per week to get back on track by the ${projectFrequencyType === "Recurring" ? "end of the month." : "end date."}`));
33
32
  }
34
33
  if (loggedHours <= minFloorHours) {
@@ -71,11 +70,11 @@ const calculateFixedEarnings = (projectFrequencyType, projectData, clientPortal)
71
70
  };
72
71
  const CenterCardUI = ({ startDate, endDate, projectRateType, projectData, projectFrequencyType, project, adhocProject, clientPortal, }) => {
73
72
  var _a, _b, _c, _d;
74
- const date = (0, moment_1.default)();
73
+ const date = (0, dayjs_1.default)();
75
74
  const today = date.date();
76
- const lastDayOfMonth = (0, moment_1.default)().endOf('month');
77
- const daysInOneTimeProject = (endDate && startDate) ? Math.max((0, moment_1.default)(endDate).diff((0, moment_1.default)(startDate), 'days'), 0) : "-";
78
- const daysLeftInOneTime = endDate ? Math.max((0, moment_1.default)(endDate).diff((0, moment_1.default)(date), 'days'), 0) : "-";
75
+ const lastDayOfMonth = (0, dayjs_1.default)().endOf('month');
76
+ const daysInOneTimeProject = (endDate && startDate) ? Math.max((0, dayjs_1.default)(endDate).diff((0, dayjs_1.default)(startDate), 'days'), 0) : "-";
77
+ const daysLeftInOneTime = endDate ? Math.max((0, dayjs_1.default)(endDate).diff((0, dayjs_1.default)(date), 'days'), 0) : "-";
79
78
  const { minFloorHours, maxFloorHours, loggedHours, weeklyHoursLogged, hoursPerWeek, minFloorName, hoursToComplete, remainingWeeks } = (0, ActiveProjectCard_1.getAllProjectRecommendationData)({ projectData });
80
79
  const totalDays = lastDayOfMonth.date();
81
80
  const payRate = (_a = projectData === null || projectData === void 0 ? void 0 : projectData.expertRate) !== null && _a !== void 0 ? _a : 0;
@@ -90,14 +89,14 @@ const CenterCardUI = ({ startDate, endDate, projectRateType, projectData, projec
90
89
  react_1.default.createElement(base_ui_1.TableCell, null, "Project Type"))),
91
90
  react_1.default.createElement(base_ui_1.TableBody, null,
92
91
  react_1.default.createElement(base_ui_1.TableRow, { className: "border border-solid" },
93
- ((0, moment_1.default)(startDate).isBefore((0, moment_1.default)(), 'day') && (Number(loggedHours) < 0)) ?
92
+ ((0, dayjs_1.default)(startDate).isBefore((0, dayjs_1.default)(), 'day') && (Number(loggedHours) < 0)) ?
94
93
  react_1.default.createElement(base_ui_1.TableCell, { className: "text-[#A73A43] font-bold text-lg" },
95
94
  startDate ? (0, dayjs_1.default)(startDate).format('MM/DD/YYYY') : "-",
96
95
  react_1.default.createElement("br", null),
97
96
  "Past Due")
98
97
  :
99
98
  react_1.default.createElement(base_ui_1.TableCell, { className: "text-black font-bold text-lg" }, (_c = (0, dayjs_1.default)(startDate).format('MM/DD/YYYY')) !== null && _c !== void 0 ? _c : "-"),
100
- endDate === null || (0, moment_1.default)(endDate).isBefore((0, moment_1.default)(), 'day') ?
99
+ endDate === null || (0, dayjs_1.default)(endDate).isBefore((0, dayjs_1.default)(), 'day') ?
101
100
  react_1.default.createElement(base_ui_1.TableCell, { className: "text-[#A73A43] font-bold text-lg" }, endDate ? react_1.default.createElement(react_1.default.Fragment, null,
102
101
  (0, dayjs_1.default)(endDate).format('MM/DD/YYYY'),
103
102
  " ",
@@ -43,7 +43,6 @@ const classnames_1 = __importDefault(require("classnames"));
43
43
  const dayjs_1 = __importDefault(require("dayjs"));
44
44
  const react_hot_toast_1 = __importDefault(require("react-hot-toast"));
45
45
  const ActiveProjectCard_1 = require("./ActiveProjectCard");
46
- const moment_1 = __importDefault(require("moment"));
47
46
  const pickers_1 = require("@material-ui/pickers");
48
47
  const dayjs_2 = __importDefault(require("@date-io/dayjs"));
49
48
  const core_1 = require("@material-ui/core");
@@ -146,8 +145,8 @@ const LogTimeModalAuthenticated = ({ project, freelancerId, showTimeModal, setSh
146
145
  const [error, setError] = (0, react_1.useState)(false);
147
146
  const currProjectHours = parseFloat(projectData === null || projectData === void 0 ? void 0 : projectData.hoursInvoiced);
148
147
  const { hoursPerWeek, minFloorHours } = (0, ActiveProjectCard_1.getAllProjectRecommendationData)({ projectData });
149
- const firstDateOfMonth = (0, moment_1.default)().startOf('month').format('MM/DD/YY');
150
- const lastDateOfMonth = (0, moment_1.default)().endOf('month').format('MM/DD/YY');
148
+ const firstDateOfMonth = (0, dayjs_1.default)().startOf('month').format('MM/DD/YY');
149
+ const lastDateOfMonth = (0, dayjs_1.default)().endOf('month').format('MM/DD/YY');
151
150
  const isRecurringHourlyProject = ((_a = project === null || project === void 0 ? void 0 : project.projectScope) === null || _a === void 0 ? void 0 : _a.projectFrequencyId) === 1 || ((_b = project === null || project === void 0 ? void 0 : project.projectScope) === null || _b === void 0 ? void 0 : _b.projectFrequencyId) === 2;
152
151
  const auth0Roles = user && getAuth0Roles && getAuth0Roles(user);
153
152
  const disableHoursRounding = auth0Roles && auth0Roles.includes('expert_disable_rounding');
@@ -259,7 +258,7 @@ const LogTimeModalAuthenticated = ({ project, freelancerId, showTimeModal, setSh
259
258
  const totalHours = disableHoursRounding ? parseFloat(addHoursAndMinutes(Number(hours), Number(minutes) || 0).toFixed(2)) : parseFloat((roundedTime.hours + roundedTime.minutes / 60).toFixed(2));
260
259
  let progressBarHours = 0;
261
260
  if (isRecurringHourlyProject) {
262
- progressBarHours = (0, moment_1.default)(timeLogDate).isBetween(firstDateOfMonth, lastDateOfMonth, null, '[]') ? totalHours : 0;
261
+ progressBarHours = ((0, dayjs_1.default)(timeLogDate).isAfter(firstDateOfMonth, 'day') && (0, dayjs_1.default)(timeLogDate).isBefore(lastDateOfMonth, 'day') || (0, dayjs_1.default)(timeLogDate).isSame(firstDateOfMonth, 'day') || (0, dayjs_1.default)(timeLogDate).isSame(lastDateOfMonth, 'day')) ? totalHours : 0;
263
262
  }
264
263
  else {
265
264
  progressBarHours = totalHours;
@@ -203,7 +203,9 @@ const RightCardUI = ({ project, expertName, freelancerId, freelancerEmail, isAut
203
203
  react_1.default.createElement(base_ui_1.Button, { label: requestReviewButtonLabel(), disabled: requestReviewButtonLabel() !== 'Request Review', size: "sm", className: "w-full", onClick: () => setRequestModal(true), isLoading: sowLoading })) : null,
204
204
  clientPortal && react_1.default.createElement(react_1.default.Fragment, null,
205
205
  react_1.default.createElement("h1", { className: "text-[#64748B] text-md font-bold" }, "Actions"),
206
- react_1.default.createElement(base_ui_1.Button, { label: signedSow ? "DOWNLOAD SOW" : "SIGN SOW", size: "sm", disabled: !sowId, className: "w-full", onClick: () => { downloadSow(project === null || project === void 0 ? void 0 : project.scopeOfWorkId); }, isLoading: sowLoading }),
206
+ react_1.default.createElement(base_ui_1.Button, { label: signedSow ? "DOWNLOAD SOW" : "SIGN SOW", size: "sm", disabled: !sowId, className: "w-full", onClick: () => {
207
+ signedSow ? downloadSow(project === null || project === void 0 ? void 0 : project.scopeOfWorkId) : window.open(`/contract/${project === null || project === void 0 ? void 0 : project.contractId}`, '_blank');
208
+ }, isLoading: sowLoading }),
207
209
  signedSow &&
208
210
  react_1.default.createElement(base_ui_1.Button, { label: "SUBMIT REVIEW", size: "sm", className: "w-full", onClick: () => setOpenReviewModal(true) })),
209
211
  react_1.default.createElement("div", { className: "gap-y-1 mt-4" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paro.io/expert-shared-components",
3
- "version": "1.9.7",
3
+ "version": "1.9.8",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -32,7 +32,6 @@
32
32
  "@types/react-input-mask": "^3.0.5",
33
33
  "dayjs": "^1.10.7",
34
34
  "lodash": "^4.17.21",
35
- "moment": "2.29.4",
36
35
  "react": "^18.2.0",
37
36
  "react-copy-to-clipboard": "^5.0.4",
38
37
  "react-datepicker": "^4.6.0",