@gusto/embedded-react-sdk 0.55.3 → 0.55.5
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/CHANGELOG.md +29 -0
- package/dist/components/Common/DataView/DataCards/DataCards.d.ts +2 -1
- package/dist/components/Common/DataView/DataCards/DataCards.js +63 -54
- package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
- package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js +14 -12
- package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js.map +1 -1
- package/dist/components/Common/DataView/DataTable/DataTable.d.ts +2 -1
- package/dist/components/Common/DataView/DataTable/DataTable.js +75 -66
- package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
- package/dist/components/Common/DataView/DataTable/DataTable.module.scss.js +8 -4
- package/dist/components/Common/DataView/DataTable/DataTable.module.scss.js.map +1 -1
- package/dist/components/Common/DataView/DataView.js +18 -17
- package/dist/components/Common/DataView/DataView.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +27 -25
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +41 -36
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.d.ts +1 -0
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.d.ts +9 -2
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +19 -18
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +63 -62
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/AddTaxRateDialog.js +69 -65
- package/dist/components/Company/StateTaxes/TaxRateManagement/AddTaxRateDialog.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/toHistoryRows.js +30 -23
- package/dist/components/Company/StateTaxes/TaxRateManagement/toHistoryRows.js.map +1 -1
- package/dist/components/Company/StateTaxes/shared/RequirementFields.d.ts +8 -4
- package/dist/components/Company/StateTaxes/shared/RequirementFields.js +13 -12
- package/dist/components/Company/StateTaxes/shared/RequirementFields.js.map +1 -1
- package/dist/components/Company/StateTaxes/shared/prepareRequirements.d.ts +29 -0
- package/dist/components/Company/StateTaxes/shared/prepareRequirements.js +24 -0
- package/dist/components/Company/StateTaxes/shared/prepareRequirements.js.map +1 -0
- package/dist/components/Company/StateTaxes/shared/prepareRequirements.test.d.ts +1 -0
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +68 -55
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +36 -35
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js +84 -96
- package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js.map +1 -1
- package/dist/components/Flow/Flow.js +22 -22
- package/dist/components/Flow/Flow.js.map +1 -1
- package/dist/components/Flow/useFlow.js +3 -3
- package/dist/components/InformationRequests/InformationRequests.d.ts +1 -1
- package/dist/components/InformationRequests/InformationRequests.js +66 -52
- package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +52 -50
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +86 -67
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +4 -0
- package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.d.ts +1 -1
- package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js +26 -21
- package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js.map +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.d.ts +8 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +29 -17
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js +21 -18
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js +9 -7
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.d.ts +2 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +193 -191
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +3 -2
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +31 -31
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +254 -243
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +83 -76
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +23 -22
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +108 -97
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +38 -37
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +176 -167
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +2 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +173 -164
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/helpers/openPdfInNewTab.d.ts +15 -0
- package/dist/helpers/openPdfInNewTab.js +28 -0
- package/dist/helpers/openPdfInNewTab.js.map +1 -0
- package/dist/i18n/en/Company.StateTaxes.json.js +1 -1
- package/dist/i18n/en/Payroll.OffCycleCreation.json.js +11 -9
- package/dist/i18n/en/Payroll.OffCycleCreation.json.js.map +1 -1
- package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js +7 -7
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +29 -27
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +43 -41
- package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -1
- package/dist/i18n/types.d.ts +20 -0
- package/dist/style.css +1 -1
- package/package.json +17 -17
|
@@ -1,49 +1,59 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as b, useMemo as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useMemo as a, useCallback as B } from "react";
|
|
3
|
+
import { keepPreviousData as G } from "@tanstack/react-query";
|
|
4
|
+
import { useContractorPaymentGroupsGetList as Y } from "@gusto/embedded-api/react-query/contractorPaymentGroupsGetList";
|
|
5
|
+
import { useInformationRequestsGetInformationRequestsSuspense as v } from "@gusto/embedded-api/react-query/informationRequestsGetInformationRequests";
|
|
5
6
|
import { InformationRequestStatus as g } from "@gusto/embedded-api/models/components/informationrequest";
|
|
6
|
-
import { PaymentsListPresentation as
|
|
7
|
-
import { useComponentDictionary as
|
|
8
|
-
import { BaseComponent as
|
|
7
|
+
import { PaymentsListPresentation as U } from "./PaymentsListPresentation.js";
|
|
8
|
+
import { useComponentDictionary as W } from "../../../../i18n/I18n.js";
|
|
9
|
+
import { BaseComponent as x, BaseLayout as F } from "../../../Base/Base.js";
|
|
9
10
|
import "../../../Base/useBase.js";
|
|
10
|
-
import { componentEvents as
|
|
11
|
-
import { usePagination as
|
|
12
|
-
function
|
|
13
|
-
return /* @__PURE__ */
|
|
11
|
+
import { componentEvents as c } from "../../../../shared/constants.js";
|
|
12
|
+
import { usePagination as H } from "../../../../hooks/usePagination/usePagination.js";
|
|
13
|
+
function it(t) {
|
|
14
|
+
return /* @__PURE__ */ r(V, { ...t });
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
return /* @__PURE__ */
|
|
16
|
+
function V(t) {
|
|
17
|
+
return /* @__PURE__ */ r(x, { ...t, children: /* @__PURE__ */ r(z, { ...t, children: t.children }) });
|
|
17
18
|
}
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
return e.setMonth(e.getMonth() - t),
|
|
19
|
+
const j = (t = 3) => {
|
|
20
|
+
const s = /* @__PURE__ */ new Date(), e = /* @__PURE__ */ new Date();
|
|
21
|
+
return e.setMonth(e.getMonth() - t), s.setMonth(s.getMonth() + (12 - t)), {
|
|
21
22
|
startDate: e.toISOString().split("T")[0] || "",
|
|
22
|
-
endDate:
|
|
23
|
+
endDate: s.toISOString().split("T")[0] || ""
|
|
23
24
|
};
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
}, z = ({
|
|
26
|
+
companyId: t,
|
|
27
|
+
dictionary: s,
|
|
28
|
+
onEvent: e,
|
|
29
|
+
alerts: R,
|
|
30
|
+
LoaderComponent: h
|
|
31
|
+
}) => {
|
|
32
|
+
W("Contractor.Payments.PaymentsList", s);
|
|
33
|
+
const [m, C] = b(3), { currentPage: T, itemsPerPage: D, getPaginationProps: O } = H(), { startDate: y, endDate: A } = a(() => j(m), [m]), { data: u, isFetching: M } = Y(
|
|
34
|
+
{
|
|
35
|
+
companyId: t,
|
|
36
|
+
startDate: y,
|
|
37
|
+
endDate: A,
|
|
38
|
+
page: T,
|
|
39
|
+
per: D
|
|
40
|
+
},
|
|
41
|
+
{ placeholderData: G, throwOnError: !0 }
|
|
42
|
+
), p = u?.contractorPaymentGroupWithBlockers || [], { data: w } = v({
|
|
33
43
|
companyUuid: t
|
|
34
|
-
}),
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
37
|
-
(
|
|
44
|
+
}), f = w.informationRequests ?? [], _ = a(() => p.some((n) => (n.creditBlockers || []).some((i) => {
|
|
45
|
+
if (i.status !== "unresolved") return !1;
|
|
46
|
+
const o = i.unblockOptions?.find(
|
|
47
|
+
(E) => E.unblockType === "submit_wire"
|
|
38
48
|
);
|
|
39
|
-
return
|
|
40
|
-
})), [
|
|
41
|
-
e(
|
|
42
|
-
}, [e]), P =
|
|
43
|
-
const n = [], d =
|
|
44
|
-
(
|
|
45
|
-
),
|
|
46
|
-
(
|
|
49
|
+
return o && "metadata" in o && o.metadata.wireInRequestUuid;
|
|
50
|
+
})), [p]), l = B(() => {
|
|
51
|
+
e(c.CONTRACTOR_PAYMENT_RFI_RESPOND);
|
|
52
|
+
}, [e]), P = a(() => {
|
|
53
|
+
const n = [], d = f.some(
|
|
54
|
+
(o) => o.status === g.PendingResponse
|
|
55
|
+
), i = f.some(
|
|
56
|
+
(o) => o.status === g.PendingReview
|
|
47
57
|
);
|
|
48
58
|
return d ? n.push({
|
|
49
59
|
type: "error",
|
|
@@ -51,39 +61,42 @@ const x = (t = 3) => {
|
|
|
51
61
|
content: "rfiPendingResponseDescription",
|
|
52
62
|
onAction: l,
|
|
53
63
|
actionLabel: "rfiRespondCta"
|
|
54
|
-
}) :
|
|
64
|
+
}) : i && n.push({
|
|
55
65
|
type: "info",
|
|
56
66
|
title: "rfiPendingReviewTitle",
|
|
57
67
|
content: "rfiPendingReviewDescription"
|
|
58
68
|
}), n;
|
|
59
|
-
}, [
|
|
60
|
-
e(
|
|
61
|
-
},
|
|
62
|
-
e(
|
|
63
|
-
},
|
|
69
|
+
}, [f, l]), I = () => {
|
|
70
|
+
e(c.CONTRACTOR_PAYMENT_CREATE);
|
|
71
|
+
}, N = () => {
|
|
72
|
+
e(c.CONTRACTOR_HISTORICAL_PAYMENT_CREATE);
|
|
73
|
+
}, L = (n) => {
|
|
64
74
|
C(n);
|
|
65
75
|
}, S = (n) => {
|
|
66
|
-
e(
|
|
67
|
-
}, q =
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
e(c.CONTRACTOR_PAYMENT_VIEW, { paymentId: n });
|
|
77
|
+
}, q = a(() => [...P, ...R || []], [P, R]);
|
|
78
|
+
if (!u)
|
|
79
|
+
return /* @__PURE__ */ r(F, { isLoading: !0, LoaderComponent: h });
|
|
80
|
+
const k = O(u.httpMeta.response.headers, M);
|
|
81
|
+
return /* @__PURE__ */ r(
|
|
82
|
+
U,
|
|
70
83
|
{
|
|
71
|
-
contractorPayments:
|
|
84
|
+
contractorPayments: p,
|
|
72
85
|
numberOfMonths: m,
|
|
73
|
-
onCreatePayment:
|
|
74
|
-
onCreateHistoricalPayment:
|
|
75
|
-
onDateRangeChange:
|
|
86
|
+
onCreatePayment: I,
|
|
87
|
+
onCreateHistoricalPayment: N,
|
|
88
|
+
onDateRangeChange: L,
|
|
76
89
|
onViewPayment: S,
|
|
77
90
|
alerts: q,
|
|
78
91
|
companyId: t,
|
|
79
92
|
hasUnresolvedWireInRequests: _,
|
|
80
93
|
onEvent: e,
|
|
81
|
-
paginationProps:
|
|
94
|
+
paginationProps: k
|
|
82
95
|
}
|
|
83
96
|
);
|
|
84
97
|
};
|
|
85
98
|
export {
|
|
86
|
-
|
|
87
|
-
|
|
99
|
+
it as PaymentsList,
|
|
100
|
+
V as PaymentsListInternal
|
|
88
101
|
};
|
|
89
102
|
//# sourceMappingURL=PaymentsList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentsList.js","sources":["../../../../../src/components/Contractor/Payments/PaymentsList/PaymentsList.tsx"],"sourcesContent":["import { useState, useMemo, useCallback } from 'react'\nimport { useContractorPaymentGroupsGetListSuspense } from '@gusto/embedded-api/react-query/contractorPaymentGroupsGetList'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport { InformationRequestStatus } from '@gusto/embedded-api/models/components/informationrequest'\nimport type { InternalAlert } from '../types'\nimport { PaymentsListPresentation } from './PaymentsListPresentation'\nimport { useComponentDictionary } from '@/i18n'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\nimport { usePagination } from '@/hooks/usePagination/usePagination'\n\n/**\n * Props for {@link PaymentsList}.\n *\n * @public\n */\nexport interface PaymentsListProps extends BaseComponentInterface<'Contractor.Payments.PaymentsList'> {\n /** UUID of the company whose contractor payment groups should be listed. */\n companyId: string\n}\n\n/**\n * Props for the flow-internal {@link PaymentsListInternal}, which layers\n * flow-injected alerts on top of the public {@link PaymentsListProps}.\n *\n * @internal\n */\nexport interface PaymentsListInternalProps extends PaymentsListProps {\n /** Flow-injected alerts (e.g. wire-transfer confirmation, payment cancellation). */\n alerts?: InternalAlert[]\n}\n\n/**\n * Displays a list of contractor payment groups for a company.\n *\n * Supports viewing payment history, creating new payments, and filtering by date range.\n * Surfaces alerts for pending information requests and wire transfer requirements.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/payments/create` | User chooses to create a new payment | — |\n * | `contractor/payments/view` | User selects a payment group to view | `{ paymentId: string }` |\n * | `contractor/payments/rfi/respond` | User clicks to respond to an information request alert | — |\n *\n * @param props - Component props.\n * @returns The rendered payments list.\n * @public\n */\nexport function PaymentsList(props: PaymentsListProps) {\n return <PaymentsListInternal {...props} />\n}\n\n/**\n * Flow-internal entry point for {@link PaymentsList} that accepts flow-injected\n * alerts. Partners use {@link PaymentsList}; flows render this directly.\n *\n * @internal\n */\nexport function PaymentsListInternal(props: PaymentsListInternalProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst calculateDateRange = (months: number = 3) => {\n const endDate = new Date()\n const startDate = new Date()\n\n startDate.setMonth(startDate.getMonth() - months)\n //Max range allowed by the API is 12 months\n endDate.setMonth(endDate.getMonth() + (12 - months))\n\n return {\n startDate: startDate.toISOString().split('T')[0] || '',\n endDate: endDate.toISOString().split('T')[0] || '',\n }\n}\n\nconst Root = ({ companyId, dictionary, onEvent, alerts }: PaymentsListInternalProps) => {\n useComponentDictionary('Contractor.Payments.PaymentsList', dictionary)\n\n const [numberOfMonths, setNumberOfMonths] = useState(3)\n const { currentPage, itemsPerPage, getPaginationProps } = usePagination()\n\n const { startDate, endDate } = useMemo(() => calculateDateRange(numberOfMonths), [numberOfMonths])\n\n const { data } = useContractorPaymentGroupsGetListSuspense({\n companyId,\n startDate,\n endDate,\n page: currentPage,\n per: itemsPerPage,\n })\n const contractorPayments = data.contractorPaymentGroupWithBlockers || []\n const paginationProps = getPaginationProps(data.httpMeta.response.headers)\n\n const { data: informationRequestsData } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n const informationRequests = informationRequestsData.informationRequests ?? []\n\n const hasUnresolvedWireInRequests = useMemo(() => {\n return contractorPayments.some(payment => {\n const creditBlockers = payment.creditBlockers || []\n return creditBlockers.some(blocker => {\n if (blocker.status !== 'unresolved') return false\n const wireOption = blocker.unblockOptions?.find(\n option => option.unblockType === 'submit_wire',\n )\n return wireOption && 'metadata' in wireOption && wireOption.metadata.wireInRequestUuid\n })\n })\n }, [contractorPayments])\n\n const handleRespondToRfi = useCallback(() => {\n onEvent(componentEvents.CONTRACTOR_PAYMENT_RFI_RESPOND)\n }, [onEvent])\n\n const rfiAlerts = useMemo(() => {\n const rfiAlertsArray: InternalAlert[] = []\n\n const hasPendingResponseRfis = informationRequests.some(\n request => request.status === InformationRequestStatus.PendingResponse,\n )\n const hasPendingReviewRfis = informationRequests.some(\n request => request.status === InformationRequestStatus.PendingReview,\n )\n\n if (hasPendingResponseRfis) {\n rfiAlertsArray.push({\n type: 'error',\n title: 'rfiPendingResponseTitle',\n content: 'rfiPendingResponseDescription',\n onAction: handleRespondToRfi,\n actionLabel: 'rfiRespondCta',\n })\n } else if (hasPendingReviewRfis) {\n rfiAlertsArray.push({\n type: 'info',\n title: 'rfiPendingReviewTitle',\n content: 'rfiPendingReviewDescription',\n })\n }\n\n return rfiAlertsArray\n }, [informationRequests, handleRespondToRfi])\n\n const onCreatePayment = () => {\n onEvent(componentEvents.CONTRACTOR_PAYMENT_CREATE)\n }\n\n const onCreateHistoricalPayment = () => {\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_CREATE)\n }\n\n const handleDateRangeChange = (numberOfMonths: number) => {\n setNumberOfMonths(numberOfMonths)\n }\n\n const onViewPayment = (paymentId: string) => {\n onEvent(componentEvents.CONTRACTOR_PAYMENT_VIEW, { paymentId })\n }\n\n const allAlerts = useMemo(() => {\n return [...rfiAlerts, ...(alerts || [])]\n }, [rfiAlerts, alerts])\n\n return (\n <PaymentsListPresentation\n contractorPayments={contractorPayments}\n numberOfMonths={numberOfMonths}\n onCreatePayment={onCreatePayment}\n onCreateHistoricalPayment={onCreateHistoricalPayment}\n onDateRangeChange={handleDateRangeChange}\n onViewPayment={onViewPayment}\n alerts={allAlerts}\n companyId={companyId}\n hasUnresolvedWireInRequests={hasUnresolvedWireInRequests}\n onEvent={onEvent}\n paginationProps={paginationProps}\n />\n )\n}\n"],"names":["PaymentsList","props","jsx","PaymentsListInternal","BaseComponent","Root","calculateDateRange","months","endDate","startDate","companyId","dictionary","onEvent","alerts","useComponentDictionary","numberOfMonths","setNumberOfMonths","useState","currentPage","itemsPerPage","getPaginationProps","usePagination","useMemo","data","useContractorPaymentGroupsGetListSuspense","contractorPayments","paginationProps","informationRequestsData","useInformationRequestsGetInformationRequestsSuspense","informationRequests","hasUnresolvedWireInRequests","payment","blocker","wireOption","option","handleRespondToRfi","useCallback","componentEvents","rfiAlerts","rfiAlertsArray","hasPendingResponseRfis","request","InformationRequestStatus","hasPendingReviewRfis","onCreatePayment","onCreateHistoricalPayment","handleDateRangeChange","onViewPayment","paymentId","allAlerts","PaymentsListPresentation"],"mappings":";;;;;;;;;;;AAiDO,SAASA,GAAaC,GAA0B;AACrD,SAAO,gBAAAC,EAACC,GAAA,EAAsB,GAAGF,EAAA,CAAO;AAC1C;AAQO,SAASE,EAAqBF,GAAkC;AACrE,SACE,gBAAAC,EAACE,GAAA,EAAe,GAAGH,GACjB,UAAA,gBAAAC,EAACG,KAAM,GAAGJ,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMK,IAAqB,CAACC,IAAiB,MAAM;AACjD,QAAMC,wBAAc,KAAA,GACdC,wBAAgB,KAAA;AAEtB,SAAAA,EAAU,SAASA,EAAU,SAAA,IAAaF,CAAM,GAEhDC,EAAQ,SAASA,EAAQ,SAAA,KAAc,KAAKD,EAAO,GAE5C;AAAA,IACL,WAAWE,EAAU,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,KAAK;AAAA,IACpD,SAASD,EAAQ,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,KAAK;AAAA,EAAA;AAEpD,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Q,WAAWC,EAAyB;AAAA,IAAA,GAEnDC,IAAuBd,EAAoB;AAAA,MAC/C,CAAAY,MAAWA,EAAQ,WAAWC,EAAyB;AAAA,IAAA;AAGzD,WAAIF,IACFD,EAAe,KAAK;AAAA,MAClB,MAAM;AAAA,MACN,OAAO;AAAA,MACP,SAAS;AAAA,MACT,UAAUJ;AAAA,MACV,aAAa;AAAA,IAAA,CACd,IACQQ,KACTJ,EAAe,KAAK;AAAA,MAClB,MAAM;AAAA,MACN,OAAO;AAAA,MACP,SAAS;AAAA,IAAA,CACV,GAGIA;AAAA,EACT,GAAG,CAACV,GAAqBM,CAAkB,CAAC,GAEtCS,IAAkB,MAAM;AAC5B,IAAAhC,EAAQyB,EAAgB,yBAAyB;AAAA,EACnD,GAEMQ,IAA4B,MAAM;AACtC,IAAAjC,EAAQyB,EAAgB,oCAAoC;AAAA,EAC9D,GAEMS,IAAwB,CAAC/B,MAA2B;AACxD,IAAAC,EAAkBD,CAAc;AAAA,EAClC,GAEMgC,IAAgB,CAACC,MAAsB;AAC3C,IAAApC,EAAQyB,EAAgB,yBAAyB,EAAE,WAAAW,EAAA,CAAW;AAAA,EAChE,GAEMC,IAAY3B,EAAQ,MACjB,CAAC,GAAGgB,GAAW,GAAIzB,KAAU,CAAA,CAAG,GACtC,CAACyB,GAAWzB,CAAM,CAAC;AAEtB,SACE,gBAAAX;AAAA,IAACgD;AAAA,IAAA;AAAA,MACC,oBAAAzB;AAAA,MACA,gBAAAV;AAAA,MACA,iBAAA6B;AAAA,MACA,2BAAAC;AAAA,MACA,mBAAmBC;AAAA,MACnB,eAAAC;AAAA,MACA,QAAQE;AAAA,MACR,WAAAvC;AAAA,MACA,6BAAAoB;AAAA,MACA,SAAAlB;AAAA,MACA,iBAAAc;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"PaymentsList.js","sources":["../../../../../src/components/Contractor/Payments/PaymentsList/PaymentsList.tsx"],"sourcesContent":["import { useState, useMemo, useCallback } from 'react'\nimport { keepPreviousData } from '@tanstack/react-query'\nimport { useContractorPaymentGroupsGetList } from '@gusto/embedded-api/react-query/contractorPaymentGroupsGetList'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport { InformationRequestStatus } from '@gusto/embedded-api/models/components/informationrequest'\nimport type { InternalAlert } from '../types'\nimport { PaymentsListPresentation } from './PaymentsListPresentation'\nimport { useComponentDictionary } from '@/i18n'\nimport { BaseComponent, BaseLayout, type BaseComponentInterface } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\nimport { usePagination } from '@/hooks/usePagination/usePagination'\n\n/**\n * Props for {@link PaymentsList}.\n *\n * @public\n */\nexport interface PaymentsListProps extends BaseComponentInterface<'Contractor.Payments.PaymentsList'> {\n /** UUID of the company whose contractor payment groups should be listed. */\n companyId: string\n}\n\n/**\n * Props for the flow-internal {@link PaymentsListInternal}, which layers\n * flow-injected alerts on top of the public {@link PaymentsListProps}.\n *\n * @internal\n */\nexport interface PaymentsListInternalProps extends PaymentsListProps {\n /** Flow-injected alerts (e.g. wire-transfer confirmation, payment cancellation). */\n alerts?: InternalAlert[]\n}\n\n/**\n * Displays a list of contractor payment groups for a company.\n *\n * Supports viewing payment history, creating new payments, and filtering by date range.\n * Surfaces alerts for pending information requests and wire transfer requirements.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/payments/create` | User chooses to create a new payment | — |\n * | `contractor/payments/view` | User selects a payment group to view | `{ paymentId: string }` |\n * | `contractor/payments/rfi/respond` | User clicks to respond to an information request alert | — |\n *\n * @param props - Component props.\n * @returns The rendered payments list.\n * @public\n */\nexport function PaymentsList(props: PaymentsListProps) {\n return <PaymentsListInternal {...props} />\n}\n\n/**\n * Flow-internal entry point for {@link PaymentsList} that accepts flow-injected\n * alerts. Partners use {@link PaymentsList}; flows render this directly.\n *\n * @internal\n */\nexport function PaymentsListInternal(props: PaymentsListInternalProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst calculateDateRange = (months: number = 3) => {\n const endDate = new Date()\n const startDate = new Date()\n\n startDate.setMonth(startDate.getMonth() - months)\n //Max range allowed by the API is 12 months\n endDate.setMonth(endDate.getMonth() + (12 - months))\n\n return {\n startDate: startDate.toISOString().split('T')[0] || '',\n endDate: endDate.toISOString().split('T')[0] || '',\n }\n}\n\nconst Root = ({\n companyId,\n dictionary,\n onEvent,\n alerts,\n LoaderComponent,\n}: PaymentsListInternalProps) => {\n useComponentDictionary('Contractor.Payments.PaymentsList', dictionary)\n\n const [numberOfMonths, setNumberOfMonths] = useState(3)\n const { currentPage, itemsPerPage, getPaginationProps } = usePagination()\n\n const { startDate, endDate } = useMemo(() => calculateDateRange(numberOfMonths), [numberOfMonths])\n\n const { data, isFetching } = useContractorPaymentGroupsGetList(\n {\n companyId,\n startDate,\n endDate,\n page: currentPage,\n per: itemsPerPage,\n },\n { placeholderData: keepPreviousData, throwOnError: true },\n )\n const contractorPayments = data?.contractorPaymentGroupWithBlockers || []\n\n const { data: informationRequestsData } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n const informationRequests = informationRequestsData.informationRequests ?? []\n\n const hasUnresolvedWireInRequests = useMemo(() => {\n return contractorPayments.some(payment => {\n const creditBlockers = payment.creditBlockers || []\n return creditBlockers.some(blocker => {\n if (blocker.status !== 'unresolved') return false\n const wireOption = blocker.unblockOptions?.find(\n option => option.unblockType === 'submit_wire',\n )\n return wireOption && 'metadata' in wireOption && wireOption.metadata.wireInRequestUuid\n })\n })\n }, [contractorPayments])\n\n const handleRespondToRfi = useCallback(() => {\n onEvent(componentEvents.CONTRACTOR_PAYMENT_RFI_RESPOND)\n }, [onEvent])\n\n const rfiAlerts = useMemo(() => {\n const rfiAlertsArray: InternalAlert[] = []\n\n const hasPendingResponseRfis = informationRequests.some(\n request => request.status === InformationRequestStatus.PendingResponse,\n )\n const hasPendingReviewRfis = informationRequests.some(\n request => request.status === InformationRequestStatus.PendingReview,\n )\n\n if (hasPendingResponseRfis) {\n rfiAlertsArray.push({\n type: 'error',\n title: 'rfiPendingResponseTitle',\n content: 'rfiPendingResponseDescription',\n onAction: handleRespondToRfi,\n actionLabel: 'rfiRespondCta',\n })\n } else if (hasPendingReviewRfis) {\n rfiAlertsArray.push({\n type: 'info',\n title: 'rfiPendingReviewTitle',\n content: 'rfiPendingReviewDescription',\n })\n }\n\n return rfiAlertsArray\n }, [informationRequests, handleRespondToRfi])\n\n const onCreatePayment = () => {\n onEvent(componentEvents.CONTRACTOR_PAYMENT_CREATE)\n }\n\n const onCreateHistoricalPayment = () => {\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_CREATE)\n }\n\n const handleDateRangeChange = (numberOfMonths: number) => {\n setNumberOfMonths(numberOfMonths)\n }\n\n const onViewPayment = (paymentId: string) => {\n onEvent(componentEvents.CONTRACTOR_PAYMENT_VIEW, { paymentId })\n }\n\n const allAlerts = useMemo(() => {\n return [...rfiAlerts, ...(alerts || [])]\n }, [rfiAlerts, alerts])\n\n if (!data) {\n return <BaseLayout isLoading LoaderComponent={LoaderComponent} />\n }\n\n const paginationProps = getPaginationProps(data.httpMeta.response.headers, isFetching)\n\n return (\n <PaymentsListPresentation\n contractorPayments={contractorPayments}\n numberOfMonths={numberOfMonths}\n onCreatePayment={onCreatePayment}\n onCreateHistoricalPayment={onCreateHistoricalPayment}\n onDateRangeChange={handleDateRangeChange}\n onViewPayment={onViewPayment}\n alerts={allAlerts}\n companyId={companyId}\n hasUnresolvedWireInRequests={hasUnresolvedWireInRequests}\n onEvent={onEvent}\n paginationProps={paginationProps}\n />\n )\n}\n"],"names":["PaymentsList","props","jsx","PaymentsListInternal","BaseComponent","Root","calculateDateRange","months","endDate","startDate","companyId","dictionary","onEvent","alerts","LoaderComponent","useComponentDictionary","numberOfMonths","setNumberOfMonths","useState","currentPage","itemsPerPage","getPaginationProps","usePagination","useMemo","data","isFetching","useContractorPaymentGroupsGetList","keepPreviousData","contractorPayments","informationRequestsData","useInformationRequestsGetInformationRequestsSuspense","informationRequests","hasUnresolvedWireInRequests","payment","blocker","wireOption","option","handleRespondToRfi","useCallback","componentEvents","rfiAlerts","rfiAlertsArray","hasPendingResponseRfis","request","InformationRequestStatus","hasPendingReviewRfis","onCreatePayment","onCreateHistoricalPayment","handleDateRangeChange","onViewPayment","paymentId","allAlerts","BaseLayout","paginationProps","PaymentsListPresentation"],"mappings":";;;;;;;;;;;;AAkDO,SAASA,GAAaC,GAA0B;AACrD,SAAO,gBAAAC,EAACC,GAAA,EAAsB,GAAGF,EAAA,CAAO;AAC1C;AAQO,SAASE,EAAqBF,GAAkC;AACrE,SACE,gBAAAC,EAACE,GAAA,EAAe,GAAGH,GACjB,UAAA,gBAAAC,EAACG,KAAM,GAAGJ,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMK,IAAqB,CAACC,IAAiB,MAAM;AACjD,QAAMC,wBAAc,KAAA,GACdC,wBAAgB,KAAA;AAEtB,SAAAA,EAAU,SAASA,EAAU,SAAA,IAAaF,CAAM,GAEhDC,EAAQ,SAASA,EAAQ,SAAA,KAAc,KAAKD,EAAO,GAE5C;AAAA,IACL,WAAWE,EAAU,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,KAAK;AAAA,IACpD,SAASD,EAAQ,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,KAAK;AAAA,EAAA;AAEpD,GAEMH,IAAO,CAAC;AAAA,EACZ,WAAAK;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,iBAAAC;AACF,MAAiC;AAC/B,EAAAC,EAAuB,oCAAoCJ,CAAU;AAErE,QAAM,CAACK,GAAgBC,CAAiB,IAAIC,EAAS,CAAC,GAChD,EAAE,aAAAC,GAAa,cAAAC,GAAc,oBAAAC,EAAA,IAAuBC,EAAA,GAEp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,UAAUJ;AAAA,MACV,aAAa;AAAA,IAAA,CACd,IACQQ,KACTJ,EAAe,KAAK;AAAA,MAClB,MAAM;AAAA,MACN,OAAO;AAAA,MACP,SAAS;AAAA,IAAA,CACV,GAGIA;AAAA,EACT,GAAG,CAACV,GAAqBM,CAAkB,CAAC,GAEtCS,IAAkB,MAAM;AAC5B,IAAAlC,EAAQ2B,EAAgB,yBAAyB;AAAA,EACnD,GAEMQ,IAA4B,MAAM;AACtC,IAAAnC,EAAQ2B,EAAgB,oCAAoC;AAAA,EAC9D,GAEMS,IAAwB,CAAChC,MAA2B;AACxD,IAAAC,EAAkBD,CAAc;AAAA,EAClC,GAEMiC,IAAgB,CAACC,MAAsB;AAC3C,IAAAtC,EAAQ2B,EAAgB,yBAAyB,EAAE,WAAAW,EAAA,CAAW;AAAA,EAChE,GAEMC,IAAY5B,EAAQ,MACjB,CAAC,GAAGiB,GAAW,GAAI3B,KAAU,CAAA,CAAG,GACtC,CAAC2B,GAAW3B,CAAM,CAAC;AAEtB,MAAI,CAACW;AACH,WAAO,gBAAAtB,EAACkD,GAAA,EAAW,WAAS,IAAC,iBAAAtC,EAAA,CAAkC;AAGjE,QAAMuC,IAAkBhC,EAAmBG,EAAK,SAAS,SAAS,SAASC,CAAU;AAErF,SACE,gBAAAvB;AAAA,IAACoD;AAAA,IAAA;AAAA,MACC,oBAAA1B;AAAA,MACA,gBAAAZ;AAAA,MACA,iBAAA8B;AAAA,MACA,2BAAAC;AAAA,MACA,mBAAmBC;AAAA,MACnB,eAAAC;AAAA,MACA,QAAQE;AAAA,MACR,WAAAzC;AAAA,MACA,6BAAAsB;AAAA,MACA,SAAApB;AAAA,MACA,iBAAAyC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -8,32 +8,32 @@ import { useComponentContext as R } from "../../../../contexts/ComponentAdapter/
|
|
|
8
8
|
import { useI18n as T } from "../../../../i18n/I18n.js";
|
|
9
9
|
import V from "../../../../hooks/useNumberFormatter.js";
|
|
10
10
|
import B from "../../../../assets/icons/eye.svg.js";
|
|
11
|
-
import
|
|
11
|
+
import p from "../../../../assets/icons/plus-circle.svg.js";
|
|
12
12
|
import { useDateFormatter as I } from "../../../../hooks/useDateFormatter.js";
|
|
13
13
|
import { ConfirmWireDetails as M } from "../../../Payroll/ConfirmWireDetails/ConfirmWireDetails.js";
|
|
14
14
|
import { WithUnstableFeature as W } from "../../../../contexts/UnstableFeaturesProvider/WithUnstableFeature.js";
|
|
15
15
|
import { useDataView as E } from "../../../Common/DataView/useDataView.js";
|
|
16
16
|
import { DataView as H } from "../../../Common/DataView/DataView.js";
|
|
17
17
|
const at = ({
|
|
18
|
-
contractorPayments:
|
|
19
|
-
numberOfMonths:
|
|
20
|
-
onCreatePayment:
|
|
21
|
-
onCreateHistoricalPayment:
|
|
22
|
-
onDateRangeChange:
|
|
23
|
-
onViewPayment:
|
|
18
|
+
contractorPayments: s,
|
|
19
|
+
numberOfMonths: y,
|
|
20
|
+
onCreatePayment: l,
|
|
21
|
+
onCreateHistoricalPayment: f,
|
|
22
|
+
onDateRangeChange: b,
|
|
23
|
+
onViewPayment: g,
|
|
24
24
|
alerts: c = [],
|
|
25
|
-
companyId:
|
|
26
|
-
hasUnresolvedWireInRequests:
|
|
25
|
+
companyId: C,
|
|
26
|
+
hasUnresolvedWireInRequests: D,
|
|
27
27
|
onEvent: P,
|
|
28
|
-
paginationProps:
|
|
28
|
+
paginationProps: m
|
|
29
29
|
}) => {
|
|
30
|
-
const { Box: v, Button: r, Heading:
|
|
30
|
+
const { Box: v, Button: r, Heading: d, Text: u, Select: x, ButtonIcon: L, Alert: w } = R();
|
|
31
31
|
T("Contractor.Payments.PaymentsList");
|
|
32
|
-
const { t: n } = $("Contractor.Payments.PaymentsList"),
|
|
32
|
+
const { t: n } = $("Contractor.Payments.PaymentsList"), h = V("currency"), { formatLongWithYear: A } = I(), F = [
|
|
33
33
|
{ value: "3", label: n("dateRanges.last3Months") },
|
|
34
34
|
{ value: "6", label: n("dateRanges.last6Months") }
|
|
35
|
-
], { ...
|
|
36
|
-
data:
|
|
35
|
+
], { ...N } = E({
|
|
36
|
+
data: s,
|
|
37
37
|
columns: [
|
|
38
38
|
{
|
|
39
39
|
title: n("paymentDateColumnLabel"),
|
|
@@ -42,12 +42,12 @@ const at = ({
|
|
|
42
42
|
{
|
|
43
43
|
title: n("wageTotalColumnLabel"),
|
|
44
44
|
justify: "end",
|
|
45
|
-
render: ({ totals: e }) =>
|
|
45
|
+
render: ({ totals: e }) => h(Number(e?.wageAmount || 0))
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
title: n("reimbursementTotalColumnLabel"),
|
|
49
49
|
justify: "end",
|
|
50
|
-
render: ({ totals: e }) =>
|
|
50
|
+
render: ({ totals: e }) => h(Number(e?.reimbursementAmount) || 0)
|
|
51
51
|
}
|
|
52
52
|
],
|
|
53
53
|
itemMenu: ({ uuid: e }) => /* @__PURE__ */ t(
|
|
@@ -56,7 +56,7 @@ const at = ({
|
|
|
56
56
|
"aria-label": n("viewPaymentCta"),
|
|
57
57
|
variant: "tertiary",
|
|
58
58
|
onClick: () => {
|
|
59
|
-
|
|
59
|
+
g(e || "");
|
|
60
60
|
},
|
|
61
61
|
children: /* @__PURE__ */ t(B, { "aria-hidden": !0 })
|
|
62
62
|
}
|
|
@@ -65,17 +65,18 @@ const at = ({
|
|
|
65
65
|
r,
|
|
66
66
|
{
|
|
67
67
|
variant: "secondary",
|
|
68
|
-
icon: /* @__PURE__ */ t(
|
|
69
|
-
onClick:
|
|
68
|
+
icon: /* @__PURE__ */ t(p, { "aria-hidden": !0 }),
|
|
69
|
+
onClick: l,
|
|
70
70
|
children: n("createPaymentCta")
|
|
71
71
|
}
|
|
72
72
|
) }) }),
|
|
73
|
-
pagination:
|
|
73
|
+
pagination: m,
|
|
74
|
+
isFetching: m?.isFetching
|
|
74
75
|
});
|
|
75
76
|
return /* @__PURE__ */ a(i, { flexDirection: "column", gap: 24, children: [
|
|
76
|
-
/* @__PURE__ */ t(i, { flexDirection: "column", gap: 16, children: /* @__PURE__ */ t(
|
|
77
|
-
|
|
78
|
-
c.length > 0 && /* @__PURE__ */ t(i, { flexDirection: "column", gap: 16, children: c.map((e,
|
|
77
|
+
/* @__PURE__ */ t(i, { flexDirection: "column", gap: 16, children: /* @__PURE__ */ t(d, { as: "h1", styledAs: "h2", children: n("title") }) }),
|
|
78
|
+
D && /* @__PURE__ */ t(M, { companyId: C, onEvent: P }),
|
|
79
|
+
c.length > 0 && /* @__PURE__ */ t(i, { flexDirection: "column", gap: 16, children: c.map((e, j) => /* @__PURE__ */ t(
|
|
79
80
|
w,
|
|
80
81
|
{
|
|
81
82
|
label: n(`alerts.${e.title}`, e.translationParams),
|
|
@@ -86,7 +87,7 @@ const at = ({
|
|
|
86
87
|
e.onAction && e.actionLabel && /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(r, { variant: "secondary", onClick: e.onAction, children: n(`alerts.${e.actionLabel}`) }) })
|
|
87
88
|
] })
|
|
88
89
|
},
|
|
89
|
-
`${e.type}-${e.title}-${
|
|
90
|
+
`${e.type}-${e.title}-${j}`
|
|
90
91
|
)) }),
|
|
91
92
|
/* @__PURE__ */ a(
|
|
92
93
|
i,
|
|
@@ -102,29 +103,29 @@ const at = ({
|
|
|
102
103
|
},
|
|
103
104
|
justifyContent: "space-between",
|
|
104
105
|
children: [
|
|
105
|
-
/* @__PURE__ */ t(
|
|
106
|
+
/* @__PURE__ */ t(d, { as: "h2", styledAs: "h4", children: n("subtitle") }),
|
|
106
107
|
/* @__PURE__ */ a("div", { className: o.actionsContainer, children: [
|
|
107
108
|
/* @__PURE__ */ t(
|
|
108
109
|
x,
|
|
109
110
|
{
|
|
110
111
|
id: "date-range-select",
|
|
111
|
-
value:
|
|
112
|
+
value: y.toString(),
|
|
112
113
|
onChange: (e) => {
|
|
113
|
-
|
|
114
|
+
b(Number(e));
|
|
114
115
|
},
|
|
115
|
-
options:
|
|
116
|
+
options: F,
|
|
116
117
|
isRequired: !0,
|
|
117
118
|
label: n("startDate"),
|
|
118
119
|
placeholder: "",
|
|
119
120
|
shouldVisuallyHideLabel: !0
|
|
120
121
|
}
|
|
121
122
|
),
|
|
122
|
-
|
|
123
|
+
s.length > 0 && /* @__PURE__ */ t(
|
|
123
124
|
r,
|
|
124
125
|
{
|
|
125
|
-
onClick:
|
|
126
|
+
onClick: l,
|
|
126
127
|
variant: "secondary",
|
|
127
|
-
icon: /* @__PURE__ */ t(
|
|
128
|
+
icon: /* @__PURE__ */ t(p, { "aria-hidden": !0 }),
|
|
128
129
|
className: o.nowrap,
|
|
129
130
|
children: n("createPaymentCta")
|
|
130
131
|
}
|
|
@@ -133,15 +134,15 @@ const at = ({
|
|
|
133
134
|
]
|
|
134
135
|
}
|
|
135
136
|
),
|
|
136
|
-
/* @__PURE__ */ t(H, { label: n("subtitle"), ...
|
|
137
|
+
/* @__PURE__ */ t(H, { label: n("subtitle"), ...N }),
|
|
137
138
|
/* @__PURE__ */ t(W, { feature: "historicalPayments", children: /* @__PURE__ */ t("div", { className: o.historicalPaymentCta, children: /* @__PURE__ */ t(
|
|
138
139
|
v,
|
|
139
140
|
{
|
|
140
141
|
header: /* @__PURE__ */ a(i, { flexDirection: "column", gap: 4, children: [
|
|
141
|
-
/* @__PURE__ */ t(
|
|
142
|
-
/* @__PURE__ */ t(
|
|
142
|
+
/* @__PURE__ */ t(u, { weight: "semibold", children: n("historicalPaymentCta.title") }),
|
|
143
|
+
/* @__PURE__ */ t(u, { variant: "supporting", children: n("historicalPaymentCta.description") })
|
|
143
144
|
] }),
|
|
144
|
-
footer: /* @__PURE__ */ t(r, { variant: "secondary", onClick:
|
|
145
|
+
footer: /* @__PURE__ */ t(r, { variant: "secondary", onClick: f, children: n("historicalPaymentCta.button") })
|
|
145
146
|
}
|
|
146
147
|
) }) })
|
|
147
148
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentsListPresentation.js","sources":["../../../../../src/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { ContractorPaymentGroupWithBlockers } from '@gusto/embedded-api/models/components/contractorpaymentgroupwithblockers'\nimport type { InternalAlert } from '../types'\nimport styles from './PaymentsListPresentation.module.scss'\nimport { DataView, Flex, EmptyData, ActionsLayout, useDataView } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport EyeIcon from '@/assets/icons/eye.svg?react'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { ConfirmWireDetails } from '@/components/Payroll/ConfirmWireDetails'\nimport type { EventType } from '@/shared/constants'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport { WithUnstableFeature } from '@/contexts/UnstableFeaturesProvider/WithUnstableFeature'\n\ninterface ContractorPaymentPaymentsListPresentationProps {\n numberOfMonths: number\n contractorPayments: ContractorPaymentGroupWithBlockers[]\n onCreatePayment: () => void\n onCreateHistoricalPayment: () => void\n onDateRangeChange: (numberOfMonths: number) => void\n onViewPayment: (paymentId: string) => void\n alerts?: InternalAlert[]\n companyId: string\n hasUnresolvedWireInRequests: boolean\n onEvent: (type: EventType, data?: unknown) => void\n paginationProps?: PaginationControlProps\n}\n\n/** @internal */\nexport const PaymentsListPresentation = ({\n contractorPayments,\n numberOfMonths,\n onCreatePayment,\n onCreateHistoricalPayment,\n onDateRangeChange,\n onViewPayment,\n alerts = [],\n companyId,\n hasUnresolvedWireInRequests,\n onEvent,\n paginationProps,\n}: ContractorPaymentPaymentsListPresentationProps) => {\n const { Box, Button, Heading, Text, Select, ButtonIcon, Alert } = useComponentContext()\n useI18n('Contractor.Payments.PaymentsList')\n const { t } = useTranslation('Contractor.Payments.PaymentsList')\n const currencyFormatter = useNumberFormatter('currency')\n const { formatLongWithYear } = useDateFormatter()\n\n const dateRangeOptions = [\n { value: '3', label: t('dateRanges.last3Months') },\n { value: '6', label: t('dateRanges.last6Months') },\n ]\n const { ...dataViewProps } = useDataView({\n data: contractorPayments,\n columns: [\n {\n title: t('paymentDateColumnLabel'),\n render: ({ checkDate }) => formatLongWithYear(checkDate) || 'N/A',\n },\n {\n title: t('wageTotalColumnLabel'),\n justify: 'end',\n render: ({ totals }) => currencyFormatter(Number(totals?.wageAmount || 0)),\n },\n {\n title: t('reimbursementTotalColumnLabel'),\n justify: 'end',\n render: ({ totals }) => currencyFormatter(Number(totals?.reimbursementAmount) || 0),\n },\n ],\n itemMenu: ({ uuid }) => (\n <ButtonIcon\n aria-label={t('viewPaymentCta')}\n variant=\"tertiary\"\n onClick={() => {\n onViewPayment(uuid || '')\n }}\n >\n <EyeIcon aria-hidden />\n </ButtonIcon>\n ),\n emptyState: () => (\n <EmptyData title={t('noPaymentsFound')} description={t('noPaymentsDescription')}>\n <ActionsLayout justifyContent=\"center\">\n <Button\n variant=\"secondary\"\n icon={<PlusCircleIcon aria-hidden />}\n onClick={onCreatePayment}\n >\n {t('createPaymentCta')}\n </Button>\n </ActionsLayout>\n </EmptyData>\n ),\n pagination: paginationProps,\n })\n\n return (\n <Flex flexDirection=\"column\" gap={24}>\n <Flex flexDirection=\"column\" gap={16}>\n <Heading as=\"h1\" styledAs=\"h2\">\n {t('title')}\n </Heading>\n </Flex>\n\n {hasUnresolvedWireInRequests && (\n <ConfirmWireDetails companyId={companyId} onEvent={onEvent} />\n )}\n\n {alerts.length > 0 && (\n <Flex flexDirection=\"column\" gap={16}>\n {alerts.map((alert, index) => (\n <Alert\n key={`${alert.type}-${alert.title}-${index}`}\n label={t(`alerts.${alert.title}` as never, alert.translationParams)}\n status={alert.type}\n onDismiss={alert.onDismiss}\n >\n <Flex flexDirection=\"column\" gap={12}>\n {typeof alert.content === 'string'\n ? t(`alerts.${alert.content}` as never)\n : (alert.content ?? null)}\n {alert.onAction && alert.actionLabel && (\n <div>\n <Button variant=\"secondary\" onClick={alert.onAction}>\n {t(`alerts.${alert.actionLabel}` as never)}\n </Button>\n </div>\n )}\n </Flex>\n </Alert>\n ))}\n </Flex>\n )}\n\n <Flex\n flexDirection={{\n base: 'column',\n small: 'row',\n }}\n gap={16}\n alignItems={{\n base: 'stretch',\n small: 'center',\n }}\n justifyContent=\"space-between\"\n >\n <Heading as=\"h2\" styledAs=\"h4\">\n {t('subtitle')}\n </Heading>\n <div className={styles.actionsContainer}>\n <Select\n id=\"date-range-select\"\n value={numberOfMonths.toString()}\n onChange={value => {\n onDateRangeChange(Number(value))\n }}\n options={dateRangeOptions}\n isRequired\n label={t('startDate')}\n placeholder=\"\"\n shouldVisuallyHideLabel\n />\n {contractorPayments.length > 0 && (\n <Button\n onClick={onCreatePayment}\n variant=\"secondary\"\n icon={<PlusCircleIcon aria-hidden />}\n className={styles.nowrap}\n >\n {t('createPaymentCta')}\n </Button>\n )}\n </div>\n </Flex>\n\n <DataView label={t('subtitle')} {...dataViewProps} />\n\n <WithUnstableFeature feature=\"historicalPayments\">\n <div className={styles.historicalPaymentCta}>\n <Box\n header={\n <Flex flexDirection=\"column\" gap={4}>\n <Text weight=\"semibold\">{t('historicalPaymentCta.title')}</Text>\n <Text variant=\"supporting\">{t('historicalPaymentCta.description')}</Text>\n </Flex>\n }\n footer={\n <Button variant=\"secondary\" onClick={onCreateHistoricalPayment}>\n {t('historicalPaymentCta.button')}\n </Button>\n }\n />\n </div>\n </WithUnstableFeature>\n </Flex>\n )\n}\n"],"names":["PaymentsListPresentation","contractorPayments","numberOfMonths","onCreatePayment","onCreateHistoricalPayment","onDateRangeChange","onViewPayment","alerts","companyId","hasUnresolvedWireInRequests","onEvent","paginationProps","Box","Button","Heading","Text","Select","ButtonIcon","Alert","useComponentContext","useI18n","t","useTranslation","currencyFormatter","useNumberFormatter","formatLongWithYear","useDateFormatter","dateRangeOptions","dataViewProps","useDataView","checkDate","totals","uuid","jsx","EyeIcon","EmptyData","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pB,aAAY;AAAA,gBACZ,yBAAuB;AAAA,cAAA;AAAA,YAAA;AAAA,YAExBpB,EAAmB,SAAS,KAC3B,gBAAAgC;AAAA,cAACpB;AAAA,cAAA;AAAA,gBACC,SAASV;AAAA,gBACT,SAAQ;AAAA,gBACR,MAAM,gBAAA8B,EAACI,GAAA,EAAe,eAAW,GAAA,CAAC;AAAA,gBAClC,WAAWM,EAAO;AAAA,gBAEjB,YAAE,kBAAkB;AAAA,cAAA;AAAA,YAAA;AAAA,UACvB,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,sBAGDE,GAAA,EAAS,OAAOxB,EAAE,UAAU,GAAI,GAAGO,GAAe;AAAA,IAEnD,gBAAAK,EAACa,KAAoB,SAAQ,sBAC3B,4BAAC,OAAA,EAAI,WAAWH,EAAO,sBACrB,UAAA,gBAAAV;AAAA,MAACrB;AAAA,MAAA;AAAA,QACC,QACE,gBAAA0B,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,UAAA,gBAAAN,EAAClB,GAAA,EAAK,QAAO,YAAY,UAAAM,EAAE,4BAA4B,GAAE;AAAA,4BACxDN,GAAA,EAAK,SAAQ,cAAc,UAAAM,EAAE,kCAAkC,EAAA,CAAE;AAAA,QAAA,GACpE;AAAA,QAEF,0BACGR,GAAA,EAAO,SAAQ,aAAY,SAAST,GAClC,UAAAiB,EAAE,6BAA6B,EAAA,CAClC;AAAA,MAAA;AAAA,IAAA,GAGN,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PaymentsListPresentation.js","sources":["../../../../../src/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { ContractorPaymentGroupWithBlockers } from '@gusto/embedded-api/models/components/contractorpaymentgroupwithblockers'\nimport type { InternalAlert } from '../types'\nimport styles from './PaymentsListPresentation.module.scss'\nimport { DataView, Flex, EmptyData, ActionsLayout, useDataView } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport EyeIcon from '@/assets/icons/eye.svg?react'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { ConfirmWireDetails } from '@/components/Payroll/ConfirmWireDetails'\nimport type { EventType } from '@/shared/constants'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport { WithUnstableFeature } from '@/contexts/UnstableFeaturesProvider/WithUnstableFeature'\n\ninterface ContractorPaymentPaymentsListPresentationProps {\n numberOfMonths: number\n contractorPayments: ContractorPaymentGroupWithBlockers[]\n onCreatePayment: () => void\n onCreateHistoricalPayment: () => void\n onDateRangeChange: (numberOfMonths: number) => void\n onViewPayment: (paymentId: string) => void\n alerts?: InternalAlert[]\n companyId: string\n hasUnresolvedWireInRequests: boolean\n onEvent: (type: EventType, data?: unknown) => void\n paginationProps?: PaginationControlProps\n}\n\n/** @internal */\nexport const PaymentsListPresentation = ({\n contractorPayments,\n numberOfMonths,\n onCreatePayment,\n onCreateHistoricalPayment,\n onDateRangeChange,\n onViewPayment,\n alerts = [],\n companyId,\n hasUnresolvedWireInRequests,\n onEvent,\n paginationProps,\n}: ContractorPaymentPaymentsListPresentationProps) => {\n const { Box, Button, Heading, Text, Select, ButtonIcon, Alert } = useComponentContext()\n useI18n('Contractor.Payments.PaymentsList')\n const { t } = useTranslation('Contractor.Payments.PaymentsList')\n const currencyFormatter = useNumberFormatter('currency')\n const { formatLongWithYear } = useDateFormatter()\n\n const dateRangeOptions = [\n { value: '3', label: t('dateRanges.last3Months') },\n { value: '6', label: t('dateRanges.last6Months') },\n ]\n const { ...dataViewProps } = useDataView({\n data: contractorPayments,\n columns: [\n {\n title: t('paymentDateColumnLabel'),\n render: ({ checkDate }) => formatLongWithYear(checkDate) || 'N/A',\n },\n {\n title: t('wageTotalColumnLabel'),\n justify: 'end',\n render: ({ totals }) => currencyFormatter(Number(totals?.wageAmount || 0)),\n },\n {\n title: t('reimbursementTotalColumnLabel'),\n justify: 'end',\n render: ({ totals }) => currencyFormatter(Number(totals?.reimbursementAmount) || 0),\n },\n ],\n itemMenu: ({ uuid }) => (\n <ButtonIcon\n aria-label={t('viewPaymentCta')}\n variant=\"tertiary\"\n onClick={() => {\n onViewPayment(uuid || '')\n }}\n >\n <EyeIcon aria-hidden />\n </ButtonIcon>\n ),\n emptyState: () => (\n <EmptyData title={t('noPaymentsFound')} description={t('noPaymentsDescription')}>\n <ActionsLayout justifyContent=\"center\">\n <Button\n variant=\"secondary\"\n icon={<PlusCircleIcon aria-hidden />}\n onClick={onCreatePayment}\n >\n {t('createPaymentCta')}\n </Button>\n </ActionsLayout>\n </EmptyData>\n ),\n pagination: paginationProps,\n isFetching: paginationProps?.isFetching,\n })\n\n return (\n <Flex flexDirection=\"column\" gap={24}>\n <Flex flexDirection=\"column\" gap={16}>\n <Heading as=\"h1\" styledAs=\"h2\">\n {t('title')}\n </Heading>\n </Flex>\n\n {hasUnresolvedWireInRequests && (\n <ConfirmWireDetails companyId={companyId} onEvent={onEvent} />\n )}\n\n {alerts.length > 0 && (\n <Flex flexDirection=\"column\" gap={16}>\n {alerts.map((alert, index) => (\n <Alert\n key={`${alert.type}-${alert.title}-${index}`}\n label={t(`alerts.${alert.title}` as never, alert.translationParams)}\n status={alert.type}\n onDismiss={alert.onDismiss}\n >\n <Flex flexDirection=\"column\" gap={12}>\n {typeof alert.content === 'string'\n ? t(`alerts.${alert.content}` as never)\n : (alert.content ?? null)}\n {alert.onAction && alert.actionLabel && (\n <div>\n <Button variant=\"secondary\" onClick={alert.onAction}>\n {t(`alerts.${alert.actionLabel}` as never)}\n </Button>\n </div>\n )}\n </Flex>\n </Alert>\n ))}\n </Flex>\n )}\n\n <Flex\n flexDirection={{\n base: 'column',\n small: 'row',\n }}\n gap={16}\n alignItems={{\n base: 'stretch',\n small: 'center',\n }}\n justifyContent=\"space-between\"\n >\n <Heading as=\"h2\" styledAs=\"h4\">\n {t('subtitle')}\n </Heading>\n <div className={styles.actionsContainer}>\n <Select\n id=\"date-range-select\"\n value={numberOfMonths.toString()}\n onChange={value => {\n onDateRangeChange(Number(value))\n }}\n options={dateRangeOptions}\n isRequired\n label={t('startDate')}\n placeholder=\"\"\n shouldVisuallyHideLabel\n />\n {contractorPayments.length > 0 && (\n <Button\n onClick={onCreatePayment}\n variant=\"secondary\"\n icon={<PlusCircleIcon aria-hidden />}\n className={styles.nowrap}\n >\n {t('createPaymentCta')}\n </Button>\n )}\n </div>\n </Flex>\n\n <DataView label={t('subtitle')} {...dataViewProps} />\n\n <WithUnstableFeature feature=\"historicalPayments\">\n <div className={styles.historicalPaymentCta}>\n <Box\n header={\n <Flex flexDirection=\"column\" gap={4}>\n <Text weight=\"semibold\">{t('historicalPaymentCta.title')}</Text>\n <Text variant=\"supporting\">{t('historicalPaymentCta.description')}</Text>\n </Flex>\n }\n footer={\n <Button variant=\"secondary\" onClick={onCreateHistoricalPayment}>\n {t('historicalPaymentCta.button')}\n </Button>\n }\n />\n </div>\n </WithUnstableFeature>\n </Flex>\n )\n}\n"],"names":["PaymentsListPresentation","contractorPayments","numberOfMonths","onCreatePayment","onCreateHistoricalPayment","onDateRangeChange","onViewPayment","alerts","companyId","hasUnresolvedWireInRequests","onEvent","paginationProps","Box","Button","Heading","Text","Select","ButtonIcon","Alert","useComponentContext","useI18n","t","useTranslation","currencyFormatter","useNumberFormatter","formatLongWithYear","useDateFormatter","dateRangeOptions","dataViewProps","useDataView","checkDate","totals","uuid","jsx","EyeIcon","EmptyData","ActionsLayout","PlusCircleIcon","jsxs","Flex","ConfirmWireDetails","alert","index","styles","value","DataView","WithUnstableFeature"],"mappings":";;;;;;;;;;;;;;;;AA+BO,MAAMA,KAA2B,CAAC;AAAA,EACvC,oBAAAC;AAAA,EACA,gBAAAC;AAAA,E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