@paro.io/expert-shared-components 1.12.27 → 1.12.28

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.
@@ -3,8 +3,9 @@ interface InvoiceDetailsProps {
3
3
  isInternal: boolean;
4
4
  isClient: boolean;
5
5
  reactAppUrl?: string;
6
+ isLateDisputeAllowed?: boolean;
6
7
  }
7
8
  export declare const getStatusColor: (status: string) => "success" | "primary" | "info" | "warning";
8
9
  export declare const getStatusText: (status: string) => "" | "Resolved" | "In Progress" | "Under Review";
9
- export declare const InvoiceDetails: ({ invoice, isInternal, isClient, reactAppUrl }: InvoiceDetailsProps) => JSX.Element;
10
+ export declare const InvoiceDetails: ({ invoice, isInternal, isClient, reactAppUrl, isLateDisputeAllowed }: InvoiceDetailsProps) => JSX.Element;
10
11
  export {};
@@ -34,12 +34,15 @@ const getStatusText = (status) => {
34
34
  }
35
35
  };
36
36
  exports.getStatusText = getStatusText;
37
- const InvoiceDetails = ({ invoice, isInternal = false, isClient = false, reactAppUrl = 'https://internal.parodev.io' }) => {
38
- var _a, _b, _c, _d, _e, _f, _g, _h;
37
+ const InvoiceDetails = ({ invoice, isInternal = false, isClient = false, reactAppUrl = 'https://internal.parodev.io', isLateDisputeAllowed = false }) => {
38
+ var _a, _b, _c, _d, _e, _f, _g;
39
39
  const clientInvoiceUrl = `${reactAppUrl}/invoices/${(_a = invoice === null || invoice === void 0 ? void 0 : invoice.invoice) === null || _a === void 0 ? void 0 : _a.id}?month=${(_b = invoice === null || invoice === void 0 ? void 0 : invoice.invoice) === null || _b === void 0 ? void 0 : _b.month}&companyId=${(_c = invoice === null || invoice === void 0 ? void 0 : invoice.invoice) === null || _c === void 0 ? void 0 : _c.clientId}`;
40
40
  const internalInvoiceUrl = `${reactAppUrl}/client/${(_d = invoice === null || invoice === void 0 ? void 0 : invoice.invoice) === null || _d === void 0 ? void 0 : _d.clientId}/invoices/${(_e = invoice === null || invoice === void 0 ? void 0 : invoice.invoice) === null || _e === void 0 ? void 0 : _e.id}?month=${(_f = invoice === null || invoice === void 0 ? void 0 : invoice.invoice) === null || _f === void 0 ? void 0 : _f.month}`;
41
- const editableDate = (0, dayjs_1.default)().date(7).format("MMM DD");
42
- const daysLeft = (7 - (0, dayjs_1.default)().diff((0, dayjs_1.default)((_g = invoice === null || invoice === void 0 ? void 0 : invoice.invoice) === null || _g === void 0 ? void 0 : _g.dateGenerated), 'day')) > 0;
41
+ const today = (0, dayjs_1.default)();
42
+ const firstDayOfMonth = (0, dayjs_1.default)().startOf('month');
43
+ const disputeDaysLeft = isLateDisputeAllowed ? 14 - today.diff(firstDayOfMonth, 'day') : 7 - today.diff(firstDayOfMonth, 'day');
44
+ const daysLeft = disputeDaysLeft > 0;
45
+ const editableDate = (0, dayjs_1.default)().date(isLateDisputeAllowed ? 14 : 7).format("MMM DD");
43
46
  return (react_1.default.createElement("div", { className: "space-y-6" },
44
47
  react_1.default.createElement("div", { className: "flex items-center space-x-4" },
45
48
  react_1.default.createElement(base_ui_1.Tag, { color: (0, exports.getStatusColor)(invoice === null || invoice === void 0 ? void 0 : invoice.status), label: (0, exports.getStatusText)(invoice === null || invoice === void 0 ? void 0 : invoice.status), borderRadius: "full", variant: "subtle" }),
@@ -48,7 +51,7 @@ const InvoiceDetails = ({ invoice, isInternal = false, isClient = false, reactAp
48
51
  "Last updated: ",
49
52
  (0, dayjs_1.default)(invoice === null || invoice === void 0 ? void 0 : invoice.disputeUpdatedDate).format('MMM D, YYYY')),
50
53
  (isInternal || isClient) && (react_1.default.createElement("a", { href: isInternal ? internalInvoiceUrl : clientInvoiceUrl, target: "_blank", rel: "noopener noreferrer", className: "text-sm text-[#248384] hover:text-[#195C5C]" }, "View Invoice"))),
51
- isInternal && ((_h = invoice === null || invoice === void 0 ? void 0 : invoice.disputeProjects) === null || _h === void 0 ? void 0 : _h.length) > 0 && (react_1.default.createElement("div", { className: "space-y-4" },
54
+ isInternal && ((_g = invoice === null || invoice === void 0 ? void 0 : invoice.disputeProjects) === null || _g === void 0 ? void 0 : _g.length) > 0 && (react_1.default.createElement("div", { className: "space-y-4" },
52
55
  react_1.default.createElement("div", { className: "grid grid-cols-1 gap-4" }, invoice.disputeProjects.map((project) => (react_1.default.createElement(DisputeProjectCard_1.DisputeProjectCard, { key: project.id, project: project, client: invoice === null || invoice === void 0 ? void 0 : invoice.client, disputeDate: invoice === null || invoice === void 0 ? void 0 : invoice.disputeDate, disputeUpdatedDate: invoice === null || invoice === void 0 ? void 0 : invoice.disputeUpdatedDate }))))))));
53
56
  };
54
57
  exports.InvoiceDetails = InvoiceDetails;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paro.io/expert-shared-components",
3
- "version": "1.12.27",
3
+ "version": "1.12.28",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {