@gusto/embedded-react-sdk 0.54.0 → 0.54.1

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 (168) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/components/Common/Loading/Loading.d.ts +6 -1
  3. package/dist/components/Common/Loading/Loading.js +13 -12
  4. package/dist/components/Common/Loading/Loading.js.map +1 -1
  5. package/dist/components/Common/Loading/Loading.module.scss.js +1 -1
  6. package/dist/components/Common/PayrollLoading/PayrollLoading.js +1 -1
  7. package/dist/components/Common/PayrollLoading/PayrollLoading.js.map +1 -1
  8. package/dist/components/Common/UI/Alert/Alert.js +8 -8
  9. package/dist/components/Common/UI/Alert/Alert.js.map +1 -1
  10. package/dist/components/Common/UI/Alert/Alert.module.scss.js +18 -16
  11. package/dist/components/Common/UI/Alert/Alert.module.scss.js.map +1 -1
  12. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  13. package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
  14. package/dist/components/Common/UI/Menu/Menu.js +19 -18
  15. package/dist/components/Common/UI/Menu/Menu.js.map +1 -1
  16. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  17. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -5
  18. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  19. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -5
  20. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  21. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -7
  22. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  23. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -5
  24. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  25. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -5
  26. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  27. package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/fields.js +4 -4
  28. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +8 -10
  29. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  30. package/dist/components/Company/Industry/Context.js +6 -8
  31. package/dist/components/Company/Industry/Context.js.map +1 -1
  32. package/dist/components/Company/Industry/Industry.js +2 -2
  33. package/dist/components/Company/Industry/Industry.js.map +1 -1
  34. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -5
  35. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  36. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -5
  37. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  38. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +20 -19
  39. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  40. package/dist/components/Company/OnboardingOverview/context.js +3 -5
  41. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  42. package/dist/components/Company/PaySchedule/PaySchedule.js +20 -19
  43. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  44. package/dist/components/Company/PaySchedule/PayScheduleForm.js +29 -28
  45. package/dist/components/Company/PaySchedule/PayScheduleForm.js.map +1 -1
  46. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.d.ts +1 -1
  47. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js +5 -5
  48. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js.map +1 -1
  49. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.js +24 -21
  50. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.js.map +1 -1
  51. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js +11 -11
  52. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
  53. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -5
  54. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  55. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -5
  56. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  57. package/dist/components/Company/StateTaxes/TaxRateManagement/TaxRateHistorySection.js +14 -13
  58. package/dist/components/Company/StateTaxes/TaxRateManagement/TaxRateHistorySection.js.map +1 -1
  59. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +3 -5
  60. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
  61. package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js +22 -21
  62. package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js.map +1 -1
  63. package/dist/components/Contractor/Documents/shared/SignatureForm/useContractorSignatureForm/fields.js +8 -8
  64. package/dist/components/Contractor/Landing/Landing.js +30 -29
  65. package/dist/components/Contractor/Landing/Landing.js.map +1 -1
  66. package/dist/components/Contractor/OnboardingSummary/OnboardingSummary.js +18 -17
  67. package/dist/components/Contractor/OnboardingSummary/OnboardingSummary.js.map +1 -1
  68. package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/fields.js +1 -1
  69. package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.d.ts +41 -0
  70. package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js +175 -0
  71. package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js.map +1 -0
  72. package/dist/components/Contractor/Payments/CreateHistoricalPayment/index.d.ts +1 -0
  73. package/dist/components/Contractor/Payments/CreateHistoricalPayment/useFormDictionary.d.ts +18 -0
  74. package/dist/components/Contractor/Payments/{HistoricalPaymentAmounts → CreateHistoricalPayment}/useFormDictionary.js +37 -7
  75. package/dist/components/Contractor/Payments/CreateHistoricalPayment/useFormDictionary.js.map +1 -0
  76. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.d.ts +30 -0
  77. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js +56 -0
  78. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js.map +1 -0
  79. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/index.d.ts +1 -0
  80. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/useFormDictionary.d.ts +9 -0
  81. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/useFormDictionary.js +33 -0
  82. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/useFormDictionary.js.map +1 -0
  83. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +46 -131
  84. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
  85. package/dist/components/Contractor/Payments/PaymentSummary/useFormDictionary.d.ts +9 -0
  86. package/dist/components/Contractor/Payments/PaymentSummary/useFormDictionary.js +36 -0
  87. package/dist/components/Contractor/Payments/PaymentSummary/useFormDictionary.js.map +1 -0
  88. package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.d.ts +83 -0
  89. package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.js +124 -0
  90. package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.js.map +1 -0
  91. package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/index.d.ts +1 -0
  92. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/fields.js +16 -16
  93. package/dist/components/Contractor/exports/contractorManagement.d.ts +2 -2
  94. package/dist/components/Contractor/exports/contractorManagement.js +20 -20
  95. package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js +4 -4
  96. package/dist/components/Employee/Compensation/shared/useJobForm/fields.js +6 -6
  97. package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js +8 -8
  98. package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js +4 -4
  99. package/dist/components/Employee/Documents/management/DocumentManager.js +2 -1
  100. package/dist/components/Employee/Documents/management/DocumentManager.js.map +1 -1
  101. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -5
  102. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  103. package/dist/components/Employee/Documents/shared/useSignEmployeeForm/fields.js +1 -1
  104. package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
  105. package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/fields.js +4 -4
  106. package/dist/components/Employee/Landing/Landing.js +31 -30
  107. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  108. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +59 -58
  109. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
  110. package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js +4 -4
  111. package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +4 -4
  112. package/dist/components/Employee/PaymentMethod/shared/useBankForm/fields.js +1 -1
  113. package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js +4 -4
  114. package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/fields.js +8 -8
  115. package/dist/components/Employee/Profile/shared/useHomeAddressForm/fields.js +5 -5
  116. package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.js +4 -4
  117. package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldComponents.js +8 -8
  118. package/dist/components/Flow/Flow.js +27 -20
  119. package/dist/components/Flow/Flow.js.map +1 -1
  120. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +44 -44
  121. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  122. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +108 -108
  123. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  124. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +1 -1
  125. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  126. package/dist/components/Payroll/usePreparedPayrollData.js +8 -10
  127. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  128. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +23 -23
  129. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js.map +1 -1
  130. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.d.ts +4 -11
  131. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js +8 -8
  132. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js.map +1 -1
  133. package/dist/i18n/I18n.js +7 -7
  134. package/dist/i18n/I18n.js.map +1 -1
  135. package/dist/i18n/en/Company.PaySchedule.json.js +5 -5
  136. package/dist/i18n/en/Company.StateTaxes.json.js +1 -1
  137. package/dist/i18n/en/Company.TimeOff.EmployeeTable.json.js +20 -18
  138. package/dist/i18n/en/Company.TimeOff.EmployeeTable.json.js.map +1 -1
  139. package/dist/i18n/en/Contractor.ManagementContractorList.json.js +46 -44
  140. package/dist/i18n/en/Contractor.ManagementContractorList.json.js.map +1 -1
  141. package/dist/i18n/en/Contractor.Payments.CreateHistoricalPayment.json.js +36 -0
  142. package/dist/i18n/en/Contractor.Payments.CreateHistoricalPayment.json.js.map +1 -0
  143. package/dist/i18n/en/Contractor.Payments.HistoricalPaymentSummary.json.js +48 -0
  144. package/dist/i18n/en/Contractor.Payments.HistoricalPaymentSummary.json.js.map +1 -0
  145. package/dist/i18n/en/Contractor.Payments.PaymentSummary.json.js +7 -7
  146. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +29 -27
  147. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js.map +1 -1
  148. package/dist/i18n/types.d.ts +219 -105
  149. package/dist/shared/constants.d.ts +12 -4
  150. package/dist/shared/constants.js +23 -19
  151. package/dist/shared/constants.js.map +1 -1
  152. package/dist/style.css +1 -1
  153. package/docs/guides/endpoint-inventory.json +30 -1
  154. package/package.json +17 -16
  155. package/dist/components/Contractor/Payments/HistoricalPaymentAmounts/HistoricalPaymentAmounts.d.ts +0 -33
  156. package/dist/components/Contractor/Payments/HistoricalPaymentAmounts/HistoricalPaymentAmounts.js +0 -62
  157. package/dist/components/Contractor/Payments/HistoricalPaymentAmounts/HistoricalPaymentAmounts.js.map +0 -1
  158. package/dist/components/Contractor/Payments/HistoricalPaymentAmounts/index.d.ts +0 -1
  159. package/dist/components/Contractor/Payments/HistoricalPaymentAmounts/useFormDictionary.d.ts +0 -9
  160. package/dist/components/Contractor/Payments/HistoricalPaymentAmounts/useFormDictionary.js.map +0 -1
  161. package/dist/components/Contractor/Payments/HistoricalPaymentContractors/HistoricalPaymentContractors.d.ts +0 -27
  162. package/dist/components/Contractor/Payments/HistoricalPaymentContractors/HistoricalPaymentContractors.js +0 -56
  163. package/dist/components/Contractor/Payments/HistoricalPaymentContractors/HistoricalPaymentContractors.js.map +0 -1
  164. package/dist/components/Contractor/Payments/HistoricalPaymentContractors/index.d.ts +0 -1
  165. package/dist/i18n/en/Contractor.Payments.HistoricalPaymentAmounts.json.js +0 -36
  166. package/dist/i18n/en/Contractor.Payments.HistoricalPaymentAmounts.json.js.map +0 -1
  167. package/dist/i18n/en/Contractor.Payments.HistoricalPaymentContractors.json.js +0 -18
  168. package/dist/i18n/en/Contractor.Payments.HistoricalPaymentContractors.json.js.map +0 -1
@@ -0,0 +1,41 @@
1
+ import { BaseComponentInterface } from '../../../Base';
2
+ /**
3
+ * Props for {@link CreateHistoricalPayment}.
4
+ *
5
+ * @alpha
6
+ */
7
+ export interface CreateHistoricalPaymentProps extends BaseComponentInterface<'Contractor.Payments.CreateHistoricalPayment'> {
8
+ /** UUID of the company recording the historical payment. */
9
+ companyId: string;
10
+ }
11
+ /**
12
+ * Records a historical contractor payment — one that already happened outside Gusto and does not
13
+ * move money — by picking a paid date and the contractors being paid, entering hours, wages,
14
+ * bonuses, and reimbursements for them, then reviewing and submitting.
15
+ *
16
+ * @remarks
17
+ * Every contractor payment is fixed to the `Historical Payment` payment method, so there is no
18
+ * payment method choice or debit information to review.
19
+ * Continue on the contractor-selection step is disabled until the paid date is valid and at least
20
+ * one contractor is selected. Continue on the amounts step is disabled until at least one selected
21
+ * contractor has a payment total greater than zero, and swaps the amounts grid for an in-place
22
+ * review (mirroring `CreatePayment`'s preview step); Edit returns to the grid without losing
23
+ * entered amounts, and Submit creates the contractor payment group. Once creation succeeds, the
24
+ * Edit and Submit buttons are replaced with a success message, since the creation token has been
25
+ * consumed and the host is expected to navigate away (e.g. to `HistoricalPaymentSummary`).
26
+ *
27
+ * @events
28
+ * | Event | Description | Data |
29
+ * | ----- | ----------- | ---- |
30
+ * | `contractor/historicalPayments/edit` | The edit modal was opened for a contractor. | — |
31
+ * | `contractor/historicalPayments/update` | A contractor's payment values were updated locally. | The updated form values (hours, wage, bonus, reimbursement, payment method, etc.). |
32
+ * | `contractor/historicalPayments/preview` | The preview API call succeeded. | The contractor payment group preview response. |
33
+ * | `contractor/historicalPayments/backToEdit` | The user returned from preview to continue editing. | — |
34
+ * | `contractor/historicalPayments/created` | The payment group was successfully created. | The created contractor payment group response. |
35
+ *
36
+ * @param props - See {@link CreateHistoricalPaymentProps}.
37
+ * @returns The rendered contractor-selection screen, the payment-amounts entry screen, or its
38
+ * in-place review.
39
+ * @alpha
40
+ */
41
+ export declare function CreateHistoricalPayment(props: CreateHistoricalPaymentProps): import("react").JSX.Element;
@@ -0,0 +1,175 @@
1
+ import { jsx as t, jsxs as i } from "react/jsx-runtime";
2
+ import { useContractorsListSuspense as j } from "@gusto/embedded-api/react-query/contractorsList";
3
+ import { useContractorPaymentGroupsPreviewMutation as q } from "@gusto/embedded-api/react-query/contractorPaymentGroupsPreview";
4
+ import { useContractorPaymentGroupsCreateMutation as W } from "@gusto/embedded-api/react-query/contractorPaymentGroupsCreate";
5
+ import { RFCDate as O } from "@gusto/embedded-api/types/rfcdate";
6
+ import { useMemo as U, useState as y } from "react";
7
+ import { useTranslation as x } from "react-i18next";
8
+ import { usePaymentAmountsEditor as K } from "../shared/usePaymentAmountsEditor.js";
9
+ import { getHistoricalPaymentCheckDateBounds as V } from "../shared/historicalPaymentDateBounds.js";
10
+ import { useCreateHistoricalPaymentDictionary as z, useCreateHistoricalPaymentReviewDictionary as J } from "./useFormDictionary.js";
11
+ import { formatDateToStringDate as Q } from "../../../../helpers/dateFormatting.js";
12
+ import { Flex as c, FlexItem as X } from "../../../Common/Flex/Flex.js";
13
+ import { ActionsLayout as Z } from "../../../Common/ActionsLayout/ActionsLayout.js";
14
+ import { BaseComponent as $ } from "../../../Base/Base.js";
15
+ import { useBase as tt } from "../../../Base/useBase.js";
16
+ import { useComponentContext as M } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
17
+ import { useI18n as et, useComponentDictionary as nt } from "../../../../i18n/I18n.js";
18
+ import { useDateFormatter as rt } from "../../../../hooks/useDateFormatter.js";
19
+ import { componentEvents as p } from "../../../../shared/constants.js";
20
+ import { SelectContractors as ot } from "../../shared/SelectContractors/SelectContractors.js";
21
+ import { PaymentSummaryBlock as at } from "../shared/PaymentSummaryBlock/PaymentSummaryBlock.js";
22
+ import { SetPaymentAmounts as it } from "../shared/SetPaymentAmounts/SetPaymentAmounts.js";
23
+ const S = ["Historical Payment"];
24
+ function Ot(a) {
25
+ return /* @__PURE__ */ t($, { ...a, componentName: "Contractor.Payments.CreateHistoricalPayment", children: /* @__PURE__ */ t(ct, { ...a }) });
26
+ }
27
+ function ct({ companyId: a, dictionary: R, onEvent: h }) {
28
+ et("Contractor.Payments.CreateHistoricalPayment"), nt("Contractor.Payments.CreateHistoricalPayment", R);
29
+ const { t: e } = x("Contractor.Payments.CreateHistoricalPayment"), { Heading: r, Text: f, Button: u, DatePicker: m } = M(), { minDate: d, maxDate: C } = U(() => V(), []), [o, I] = y(null), [P, E] = y([]), [l, D] = y(null);
30
+ let s = null;
31
+ o !== null && o > C ? s = e("select.dateInFutureError") : o !== null && o < d && (s = e("select.dateTooEarlyError", {
32
+ year: o.getFullYear(),
33
+ allowedYear: d.getFullYear()
34
+ }));
35
+ const T = P.length > 0 && o !== null && s === null, g = () => {
36
+ if (!T) return;
37
+ const A = Q(o);
38
+ A && D({ contractorIds: P, checkDate: A });
39
+ };
40
+ return l ? /* @__PURE__ */ t(
41
+ st,
42
+ {
43
+ companyId: a,
44
+ contractorIds: l.contractorIds,
45
+ checkDate: l.checkDate,
46
+ onEvent: h
47
+ }
48
+ ) : /* @__PURE__ */ i(c, { flexDirection: "column", gap: 32, children: [
49
+ /* @__PURE__ */ i(c, { flexDirection: "column", gap: 4, children: [
50
+ /* @__PURE__ */ t(r, { as: "h2", children: e("select.heading") }),
51
+ /* @__PURE__ */ t(f, { variant: "supporting", children: e("select.subtitle") })
52
+ ] }),
53
+ /* @__PURE__ */ t(
54
+ m,
55
+ {
56
+ label: e("select.dateLabel"),
57
+ isRequired: !0,
58
+ value: o,
59
+ onChange: I,
60
+ minDate: d,
61
+ maxDate: C,
62
+ isInvalid: s !== null,
63
+ errorMessage: s ?? void 0
64
+ }
65
+ ),
66
+ /* @__PURE__ */ t(ot, { companyId: a, onSelectionChange: E }),
67
+ /* @__PURE__ */ t(Z, { children: /* @__PURE__ */ t(u, { onClick: g, variant: "primary", isDisabled: !T, children: e("select.continueButton") }) })
68
+ ] });
69
+ }
70
+ function st({ companyId: a, contractorIds: R, checkDate: h, onEvent: e }) {
71
+ const { t: r } = x("Contractor.Payments.CreateHistoricalPayment"), { Heading: f, Text: u, Button: m, Alert: d } = M(), { baseSubmitHandler: C } = tt(), { formatLongWithYear: o } = rt(), I = z(), P = J(), { data: E } = j({ companyUuid: a }), l = (E.contractors ?? []).filter(
72
+ (n) => R.includes(n.uuid)
73
+ ), { virtualContractorPayments: D, totals: s, editModal: T } = K({
74
+ contractors: l,
75
+ allowedPaymentMethods: S,
76
+ onEditOpen: () => {
77
+ e(p.CONTRACTOR_HISTORICAL_PAYMENT_EDIT);
78
+ },
79
+ onEditSave: (n) => {
80
+ e(p.CONTRACTOR_HISTORICAL_PAYMENT_UPDATE, n);
81
+ }
82
+ }), g = s.total > 0, { mutateAsync: A, isPending: b } = q(), { mutateAsync: B, isPending: L } = W(), [w, k] = y(null), [_, N] = y(!1), H = () => D.filter((n) => n.isTouched).map(({ isTouched: n, ...v }) => v), Y = async () => {
83
+ g && await C(null, async () => {
84
+ const n = await A({
85
+ request: {
86
+ companyId: a,
87
+ requestBody: {
88
+ checkDate: new O(h),
89
+ contractorPayments: H()
90
+ }
91
+ }
92
+ });
93
+ k(n.contractorPaymentGroupPreview || null), e(
94
+ p.CONTRACTOR_HISTORICAL_PAYMENT_PREVIEW,
95
+ n.contractorPaymentGroupPreview
96
+ );
97
+ });
98
+ }, G = () => {
99
+ k(null), e(p.CONTRACTOR_HISTORICAL_PAYMENT_BACK_TO_EDIT);
100
+ }, F = async () => {
101
+ const n = w?.creationToken;
102
+ !n || _ || await C(null, async () => {
103
+ const v = await B({
104
+ request: {
105
+ companyId: a,
106
+ requestBody: {
107
+ checkDate: new O(h),
108
+ creationToken: n,
109
+ contractorPayments: H()
110
+ }
111
+ }
112
+ });
113
+ v.contractorPaymentGroup && (N(!0), e(
114
+ p.CONTRACTOR_HISTORICAL_PAYMENT_CREATED,
115
+ v.contractorPaymentGroup
116
+ ));
117
+ });
118
+ };
119
+ return w ? /* @__PURE__ */ i(c, { flexDirection: "column", gap: 32, children: [
120
+ /* @__PURE__ */ i(c, { justifyContent: "space-between", alignItems: "flex-start", gap: 16, children: [
121
+ /* @__PURE__ */ i(c, { flexDirection: "column", gap: 4, children: [
122
+ /* @__PURE__ */ t(f, { as: "h2", children: r("review.title") }),
123
+ /* @__PURE__ */ t(u, { variant: "supporting", children: r("review.subtitle", {
124
+ checkDate: o(w.checkDate ?? "")
125
+ }) })
126
+ ] }),
127
+ !_ && /* @__PURE__ */ i(c, { justifyContent: "flex-end", gap: 16, children: [
128
+ /* @__PURE__ */ t(m, { onClick: G, variant: "secondary", children: r("review.editButton") }),
129
+ /* @__PURE__ */ t(m, { onClick: F, variant: "primary", isLoading: L, children: r("review.submitButton") })
130
+ ] })
131
+ ] }),
132
+ _ && /* @__PURE__ */ t(d, { status: "success", label: r("review.successTitle"), children: /* @__PURE__ */ t(u, { children: r("review.successMessage") }) }),
133
+ /* @__PURE__ */ t(
134
+ at,
135
+ {
136
+ contractorPaymentGroup: w,
137
+ contractors: l,
138
+ showDebitColumns: !1,
139
+ dictionary: P
140
+ }
141
+ )
142
+ ] }) : /* @__PURE__ */ i(c, { flexDirection: "column", gap: 32, children: [
143
+ /* @__PURE__ */ i(c, { justifyContent: "flex-end", gap: 16, children: [
144
+ /* @__PURE__ */ i(c, { flexDirection: "column", gap: 4, children: [
145
+ /* @__PURE__ */ t(f, { as: "h2", children: r("amounts.heading") }),
146
+ /* @__PURE__ */ t(u, { variant: "supporting", children: r("amounts.subtitle") })
147
+ ] }),
148
+ /* @__PURE__ */ t(X, { children: /* @__PURE__ */ t(
149
+ m,
150
+ {
151
+ onClick: Y,
152
+ variant: "primary",
153
+ isDisabled: !g,
154
+ isLoading: b,
155
+ children: r("amounts.continueButton")
156
+ }
157
+ ) })
158
+ ] }),
159
+ /* @__PURE__ */ t(
160
+ it,
161
+ {
162
+ contractors: l,
163
+ contractorPayments: D,
164
+ totals: s,
165
+ allowedPaymentMethods: S,
166
+ editModal: T,
167
+ dictionary: I
168
+ }
169
+ )
170
+ ] });
171
+ }
172
+ export {
173
+ Ot as CreateHistoricalPayment
174
+ };
175
+ //# sourceMappingURL=CreateHistoricalPayment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateHistoricalPayment.js","sources":["../../../../../src/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.tsx"],"sourcesContent":["import { useContractorsListSuspense } from '@gusto/embedded-api/react-query/contractorsList'\nimport { useContractorPaymentGroupsPreviewMutation } from '@gusto/embedded-api/react-query/contractorPaymentGroupsPreview'\nimport { useContractorPaymentGroupsCreateMutation } from '@gusto/embedded-api/react-query/contractorPaymentGroupsCreate'\nimport type { ContractorPaymentGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentgrouppreview'\nimport type { PostV1CompaniesCompanyIdContractorPaymentGroupsPaymentMethod as ContractorPaymentMethod } from '@gusto/embedded-api/models/operations/postv1companiescompanyidcontractorpaymentgroups'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useMemo, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { usePaymentAmountsEditor } from '../shared/usePaymentAmountsEditor'\nimport { SetPaymentAmounts } from '../shared/SetPaymentAmounts'\nimport { PaymentSummaryBlock } from '../shared/PaymentSummaryBlock'\nimport { getHistoricalPaymentCheckDateBounds } from '../shared/historicalPaymentDateBounds'\nimport {\n useCreateHistoricalPaymentDictionary,\n useCreateHistoricalPaymentReviewDictionary,\n} from './useFormDictionary'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { ActionsLayout, Flex, FlexItem } from '@/components/Common'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { componentEvents } from '@/shared/constants'\nimport { SelectContractors } from '@/components/Contractor/shared/SelectContractors/SelectContractors'\n\nconst ALLOWED_PAYMENT_METHODS: ContractorPaymentMethod[] = ['Historical Payment']\n\n/**\n * Props for {@link CreateHistoricalPayment}.\n *\n * @alpha\n */\nexport interface CreateHistoricalPaymentProps extends BaseComponentInterface<'Contractor.Payments.CreateHistoricalPayment'> {\n /** UUID of the company recording the historical payment. */\n companyId: string\n}\n\n/**\n * Records a historical contractor payment — one that already happened outside Gusto and does not\n * move money — by picking a paid date and the contractors being paid, entering hours, wages,\n * bonuses, and reimbursements for them, then reviewing and submitting.\n *\n * @remarks\n * Every contractor payment is fixed to the `Historical Payment` payment method, so there is no\n * payment method choice or debit information to review.\n * Continue on the contractor-selection step is disabled until the paid date is valid and at least\n * one contractor is selected. Continue on the amounts step is disabled until at least one selected\n * contractor has a payment total greater than zero, and swaps the amounts grid for an in-place\n * review (mirroring `CreatePayment`'s preview step); Edit returns to the grid without losing\n * entered amounts, and Submit creates the contractor payment group. Once creation succeeds, the\n * Edit and Submit buttons are replaced with a success message, since the creation token has been\n * consumed and the host is expected to navigate away (e.g. to `HistoricalPaymentSummary`).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/historicalPayments/edit` | The edit modal was opened for a contractor. | — |\n * | `contractor/historicalPayments/update` | A contractor's payment values were updated locally. | The updated form values (hours, wage, bonus, reimbursement, payment method, etc.). |\n * | `contractor/historicalPayments/preview` | The preview API call succeeded. | The contractor payment group preview response. |\n * | `contractor/historicalPayments/backToEdit` | The user returned from preview to continue editing. | — |\n * | `contractor/historicalPayments/created` | The payment group was successfully created. | The created contractor payment group response. |\n *\n * @param props - See {@link CreateHistoricalPaymentProps}.\n * @returns The rendered contractor-selection screen, the payment-amounts entry screen, or its\n * in-place review.\n * @alpha\n */\nexport function CreateHistoricalPayment(props: CreateHistoricalPaymentProps) {\n return (\n <BaseComponent {...props} componentName=\"Contractor.Payments.CreateHistoricalPayment\">\n <Root {...props} />\n </BaseComponent>\n )\n}\n\ninterface ContractorSelection {\n contractorIds: string[]\n checkDate: string\n}\n\nfunction Root({ companyId, dictionary, onEvent }: CreateHistoricalPaymentProps) {\n useI18n('Contractor.Payments.CreateHistoricalPayment')\n useComponentDictionary('Contractor.Payments.CreateHistoricalPayment', dictionary)\n const { t } = useTranslation('Contractor.Payments.CreateHistoricalPayment')\n const { Heading, Text, Button, DatePicker } = useComponentContext()\n\n const { minDate, maxDate } = useMemo(() => getHistoricalPaymentCheckDateBounds(), [])\n const [checkDate, setCheckDate] = useState<Date | null>(null)\n const [selectedIds, setSelectedIds] = useState<string[]>([])\n const [selection, setSelection] = useState<ContractorSelection | null>(null)\n\n let dateError: string | null = null\n if (checkDate !== null && checkDate > maxDate) {\n dateError = t('select.dateInFutureError')\n } else if (checkDate !== null && checkDate < minDate) {\n dateError = t('select.dateTooEarlyError', {\n year: checkDate.getFullYear(),\n allowedYear: minDate.getFullYear(),\n })\n }\n\n const canContinue = selectedIds.length > 0 && checkDate !== null && dateError === null\n\n const handleContinue = () => {\n if (!canContinue) return\n const checkDateString = formatDateToStringDate(checkDate)\n if (!checkDateString) return\n setSelection({ contractorIds: selectedIds, checkDate: checkDateString })\n }\n\n if (!selection) {\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('select.heading')}</Heading>\n <Text variant=\"supporting\">{t('select.subtitle')}</Text>\n </Flex>\n\n <DatePicker\n label={t('select.dateLabel')}\n isRequired\n value={checkDate}\n onChange={setCheckDate}\n minDate={minDate}\n maxDate={maxDate}\n isInvalid={dateError !== null}\n errorMessage={dateError ?? undefined}\n />\n\n <SelectContractors companyId={companyId} onSelectionChange={setSelectedIds} />\n\n <ActionsLayout>\n <Button onClick={handleContinue} variant=\"primary\" isDisabled={!canContinue}>\n {t('select.continueButton')}\n </Button>\n </ActionsLayout>\n </Flex>\n )\n }\n\n return (\n <AmountsAndReview\n companyId={companyId}\n contractorIds={selection.contractorIds}\n checkDate={selection.checkDate}\n onEvent={onEvent}\n />\n )\n}\n\ninterface AmountsAndReviewProps {\n companyId: string\n contractorIds: string[]\n checkDate: string\n onEvent: CreateHistoricalPaymentProps['onEvent']\n}\n\nfunction AmountsAndReview({ companyId, contractorIds, checkDate, onEvent }: AmountsAndReviewProps) {\n const { t } = useTranslation('Contractor.Payments.CreateHistoricalPayment')\n const { Heading, Text, Button, Alert } = useComponentContext()\n const { baseSubmitHandler } = useBase()\n const { formatLongWithYear } = useDateFormatter()\n const paymentAmountsDictionary = useCreateHistoricalPaymentDictionary()\n const reviewDictionary = useCreateHistoricalPaymentReviewDictionary()\n\n const { data: contractorList } = useContractorsListSuspense({ companyUuid: companyId })\n const contractors = (contractorList.contractors ?? []).filter(contractor =>\n contractorIds.includes(contractor.uuid),\n )\n\n const { virtualContractorPayments, totals, editModal } = usePaymentAmountsEditor({\n contractors,\n allowedPaymentMethods: ALLOWED_PAYMENT_METHODS,\n onEditOpen: () => {\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_EDIT)\n },\n onEditSave: data => {\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_UPDATE, data)\n },\n })\n\n const canContinue = totals.total > 0\n\n const { mutateAsync: previewContractorPaymentGroup, isPending: isPreviewing } =\n useContractorPaymentGroupsPreviewMutation()\n const { mutateAsync: createContractorPaymentGroup, isPending: isCreating } =\n useContractorPaymentGroupsCreateMutation()\n\n const [previewData, setPreviewData] = useState<ContractorPaymentGroupPreview | null>(null)\n const [isCreated, setIsCreated] = useState(false)\n\n const touchedContractorPayments = () =>\n virtualContractorPayments\n .filter(payment => payment.isTouched)\n .map(({ isTouched: _isTouched, ...rest }) => rest)\n\n const handleContinue = async () => {\n if (!canContinue) return\n\n await baseSubmitHandler(null, async () => {\n const response = await previewContractorPaymentGroup({\n request: {\n companyId,\n requestBody: {\n checkDate: new RFCDate(checkDate),\n contractorPayments: touchedContractorPayments(),\n },\n },\n })\n setPreviewData(response.contractorPaymentGroupPreview || null)\n onEvent(\n componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_PREVIEW,\n response.contractorPaymentGroupPreview,\n )\n })\n }\n\n const handleBackToEdit = () => {\n setPreviewData(null)\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_BACK_TO_EDIT)\n }\n\n const handleSubmit = async () => {\n const creationToken = previewData?.creationToken\n if (!creationToken || isCreated) return\n\n await baseSubmitHandler(null, async () => {\n const response = await createContractorPaymentGroup({\n request: {\n companyId,\n requestBody: {\n checkDate: new RFCDate(checkDate),\n creationToken,\n contractorPayments: touchedContractorPayments(),\n },\n },\n })\n\n if (!response.contractorPaymentGroup) return\n\n setIsCreated(true)\n onEvent(\n componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_CREATED,\n response.contractorPaymentGroup,\n )\n })\n }\n\n if (previewData) {\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex justifyContent=\"space-between\" alignItems=\"flex-start\" gap={16}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('review.title')}</Heading>\n <Text variant=\"supporting\">\n {t('review.subtitle', {\n checkDate: formatLongWithYear(previewData.checkDate ?? ''),\n })}\n </Text>\n </Flex>\n {!isCreated && (\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Button onClick={handleBackToEdit} variant=\"secondary\">\n {t('review.editButton')}\n </Button>\n <Button onClick={handleSubmit} variant=\"primary\" isLoading={isCreating}>\n {t('review.submitButton')}\n </Button>\n </Flex>\n )}\n </Flex>\n\n {isCreated && (\n <Alert status=\"success\" label={t('review.successTitle')}>\n <Text>{t('review.successMessage')}</Text>\n </Alert>\n )}\n\n <PaymentSummaryBlock\n contractorPaymentGroup={previewData}\n contractors={contractors}\n showDebitColumns={false}\n dictionary={reviewDictionary}\n />\n </Flex>\n )\n }\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('amounts.heading')}</Heading>\n <Text variant=\"supporting\">{t('amounts.subtitle')}</Text>\n </Flex>\n <FlexItem>\n <Button\n onClick={handleContinue}\n variant=\"primary\"\n isDisabled={!canContinue}\n isLoading={isPreviewing}\n >\n {t('amounts.continueButton')}\n </Button>\n </FlexItem>\n </Flex>\n\n <SetPaymentAmounts\n contractors={contractors}\n contractorPayments={virtualContractorPayments}\n totals={totals}\n allowedPaymentMethods={ALLOWED_PAYMENT_METHODS}\n editModal={editModal}\n dictionary={paymentAmountsDictionary}\n />\n </Flex>\n )\n}\n"],"names":["ALLOWED_PAYMENT_METHODS","CreateHistoricalPayment","props","jsx","BaseComponent","Root","companyId","dictionary","onEvent","useI18n","useComponentDictionary","t","useTranslation","Heading","Text","Button","DatePicker","useComponentContext","minDate","maxDate","useMemo","getHistoricalPaymentCheckDateBounds","checkDate","setCheckDate","useState","selectedIds","setSelectedIds","selection","setSelection","dateError","canContinue","handleContinue","checkDateString","formatDateToStringDate","AmountsAndReview","jsxs","Flex","SelectContractors","ActionsLayout","contractorIds","Alert","baseSubmitHandler","useBase","formatLongWithYear","useDateFormatter","paymentAmountsDictionary","useCreateHistoricalPaymentDictionary","reviewDictionary","useCreateHistoricalPaymentReviewDictionary","contractorList","useContractorsListSuspense","contractors","contractor","virtualContractorPayments","totals","editModal","usePaymentAmountsEditor","componentEvents","data","previewContractorPaymentGroup","isPreviewing","useContractorPaymentGroupsPreviewMutation","createContractorPaymentGroup","isCreating","useContractorPaymentGroupsCreateMutation","previewData","setPreviewData","isCreated","setIsCreated","touchedContractorPayments","payment","_isTouched","rest","response","RFCDate","handleBackToEdit","handleSubmit","creationToken","PaymentSummaryBlock","FlexItem","SetPaymentAmounts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAMA,IAAqD,CAAC,oBAAoB;AA0CzE,SAASC,GAAwBC,GAAqC;AAC3E,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GAAO,eAAc,+CACtC,UAAA,gBAAAC,EAACE,IAAA,EAAM,GAAGH,EAAA,CAAO,EAAA,CACnB;AAEJ;AAOA,SAASG,GAAK,EAAE,WAAAC,GAAW,YAAAC,GAAY,SAAAC,KAAyC;AAC9E,EAAAC,GAAQ,6CAA6C,GACrDC,GAAuB,+CAA+CH,CAAU;AAChF,QAAM,EAAE,GAAAI,EAAA,IAAMC,EAAe,6CAA6C,GACpE,EAAE,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAA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EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAD,EAACC,GAAA,EAAK,gBAAe,YAAW,KAAK,IACnC,UAAA;AAAA,MAAA,gBAAAD,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,QAAA,gBAAAjC,EAACU,GAAA,EAAQ,IAAG,MAAM,UAAAF,EAAE,iBAAiB,GAAE;AAAA,0BACtCG,GAAA,EAAK,SAAQ,cAAc,UAAAH,EAAE,kBAAkB,EAAA,CAAE;AAAA,MAAA,GACpD;AAAA,wBACCoE,GAAA,EACC,UAAA,gBAAA5E;AAAA,QAACY;AAAA,QAAA;AAAA,UACC,SAASgB;AAAA,UACT,SAAQ;AAAA,UACR,YAAY,CAACD;AAAA,UACb,WAAW8B;AAAA,UAEV,YAAE,wBAAwB;AAAA,QAAA;AAAA,MAAA,EAC7B,CACF;AAAA,IAAA,GACF;AAAA,IAEA,gBAAAzD;AAAA,MAAC6E;AAAA,MAAA;AAAA,QACC,aAAA7B;AAAA,QACA,oBAAoBE;AAAA,QACpB,QAAAC;AAAA,QACA,uBAAuBtD;AAAA,QACvB,WAAAuD;AAAA,QACA,YAAYV;AAAA,MAAA;AAAA,IAAA;AAAA,EACd,GACF;AAEJ;"}
@@ -0,0 +1 @@
1
+ export { CreateHistoricalPayment, type CreateHistoricalPaymentProps, } from './CreateHistoricalPayment';
@@ -0,0 +1,18 @@
1
+ import { SetPaymentAmountsDictionary } from '../shared/SetPaymentAmounts';
2
+ import { PaymentSummaryBlockDictionary } from '../shared/PaymentSummaryBlock';
3
+ /**
4
+ * Resolves `SetPaymentAmounts`'s text against `CreateHistoricalPayment`'s own
5
+ * `Contractor.Payments.CreateHistoricalPayment` namespace, so partner
6
+ * overrides on that namespace flow into the shared grid and edit modal.
7
+ *
8
+ * @internal
9
+ */
10
+ export declare function useCreateHistoricalPaymentDictionary(): SetPaymentAmountsDictionary;
11
+ /**
12
+ * Resolves `PaymentSummaryBlock`'s text against `CreateHistoricalPayment`'s own
13
+ * `Contractor.Payments.CreateHistoricalPayment` namespace (under the `review` key), so partner
14
+ * overrides on that namespace flow into the in-place review step.
15
+ *
16
+ * @internal
17
+ */
18
+ export declare function useCreateHistoricalPaymentReviewDictionary(): PaymentSummaryBlockDictionary;
@@ -1,8 +1,8 @@
1
- import { useMemo as r } from "react";
2
- import { useTranslation as o } from "react-i18next";
3
- function s() {
4
- const { t } = o("Contractor.Payments.HistoricalPaymentAmounts");
5
- return r(
1
+ import { useMemo as e } from "react";
2
+ import { useTranslation as a } from "react-i18next";
3
+ function i() {
4
+ const { t } = a("Contractor.Payments.CreateHistoricalPayment");
5
+ return e(
6
6
  () => ({
7
7
  hoursAndPaymentsLabel: t("hoursAndPaymentsLabel"),
8
8
  contractorTableHeaders: {
@@ -26,7 +26,7 @@ function s() {
26
26
  subtitle: t("editContractorPayment.subtitle"),
27
27
  hoursLabel: t("editContractorPayment.hoursLabel"),
28
28
  hoursAdornment: t("editContractorPayment.hoursAdornment"),
29
- hoursPayDescription: (e, a) => t("editContractorPayment.hoursPayDescription", { rate: e, total: a }),
29
+ hoursPayDescription: (o, r) => t("editContractorPayment.hoursPayDescription", { rate: o, total: r }),
30
30
  wageLabel: t("editContractorPayment.wageLabel"),
31
31
  bonusLabel: t("editContractorPayment.bonusLabel"),
32
32
  reimbursementLabel: t("editContractorPayment.reimbursementLabel"),
@@ -47,7 +47,37 @@ function s() {
47
47
  [t]
48
48
  );
49
49
  }
50
+ function s() {
51
+ const { t } = a("Contractor.Payments.CreateHistoricalPayment", {
52
+ keyPrefix: "review"
53
+ });
54
+ return e(
55
+ () => ({
56
+ paymentSummaryTitle: t("paymentSummaryTitle"),
57
+ totalAmount: t("totalAmount"),
58
+ contractorPayDate: t("contractorPayDate"),
59
+ contractorPaymentsTitle: t("contractorPaymentsTitle"),
60
+ contractor: t("contractor"),
61
+ wageType: t("wageType"),
62
+ paymentMethod: t("paymentMethod"),
63
+ paymentMethods: {
64
+ directDeposit: t("paymentMethods.directDeposit"),
65
+ check: t("paymentMethods.check"),
66
+ historicalPayment: t("paymentMethods.historicalPayment")
67
+ },
68
+ hours: t("hours"),
69
+ wage: t("wage"),
70
+ bonus: t("bonus"),
71
+ reimbursement: t("reimbursement"),
72
+ total: t("total"),
73
+ totalsLabel: t("totalsLabel"),
74
+ notAvailable: t("notAvailable")
75
+ }),
76
+ [t]
77
+ );
78
+ }
50
79
  export {
51
- s as useHistoricalPaymentAmountsDictionary
80
+ i as useCreateHistoricalPaymentDictionary,
81
+ s as useCreateHistoricalPaymentReviewDictionary
52
82
  };
53
83
  //# sourceMappingURL=useFormDictionary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormDictionary.js","sources":["../../../../../src/components/Contractor/Payments/CreateHistoricalPayment/useFormDictionary.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { SetPaymentAmountsDictionary } from '../shared/SetPaymentAmounts'\nimport type { PaymentSummaryBlockDictionary } from '../shared/PaymentSummaryBlock'\n\n/**\n * Resolves `SetPaymentAmounts`'s text against `CreateHistoricalPayment`'s own\n * `Contractor.Payments.CreateHistoricalPayment` namespace, so partner\n * overrides on that namespace flow into the shared grid and edit modal.\n *\n * @internal\n */\nexport function useCreateHistoricalPaymentDictionary(): SetPaymentAmountsDictionary {\n const { t } = useTranslation('Contractor.Payments.CreateHistoricalPayment')\n\n return useMemo<SetPaymentAmountsDictionary>(\n () => ({\n hoursAndPaymentsLabel: t('hoursAndPaymentsLabel'),\n contractorTableHeaders: {\n contractor: t('contractorTableHeaders.contractor'),\n wageType: t('contractorTableHeaders.wageType'),\n paymentMethod: t('contractorTableHeaders.paymentMethod'),\n hours: t('contractorTableHeaders.hours'),\n wage: t('contractorTableHeaders.wage'),\n bonus: t('contractorTableHeaders.bonus'),\n reimbursement: t('contractorTableHeaders.reimbursement'),\n total: t('contractorTableHeaders.total'),\n },\n emptyTableTitle: t('emptyTableTitle'),\n emptyTableDescription: t('emptyTableDescription'),\n na: t('na'),\n totalsLabel: t('totalsLabel'),\n editContractor: t('editContractor'),\n perHour: t('perHour'),\n editContractorPayment: {\n title: t('editContractorPayment.title'),\n subtitle: t('editContractorPayment.subtitle'),\n hoursLabel: t('editContractorPayment.hoursLabel'),\n hoursAdornment: t('editContractorPayment.hoursAdornment'),\n hoursPayDescription: (rate, total) =>\n t('editContractorPayment.hoursPayDescription', { rate, total }),\n wageLabel: t('editContractorPayment.wageLabel'),\n bonusLabel: t('editContractorPayment.bonusLabel'),\n reimbursementLabel: t('editContractorPayment.reimbursementLabel'),\n paymentMethodLabel: t('editContractorPayment.paymentMethodLabel'),\n cancelCta: t('editContractorPayment.cancelCta'),\n saveCta: t('editContractorPayment.saveCta'),\n paymentMethods: {\n check: t('editContractorPayment.paymentMethods.check'),\n directDeposit: t('editContractorPayment.paymentMethods.directDeposit'),\n historicalPayment: t('editContractorPayment.paymentMethods.historicalPayment'),\n },\n errors: {\n directDepositNotAvailable: t('editContractorPayment.errors.directDepositNotAvailable'),\n unsupportedPaymentMethod: t('editContractorPayment.errors.unsupportedPaymentMethod'),\n },\n },\n }),\n [t],\n )\n}\n\n/**\n * Resolves `PaymentSummaryBlock`'s text against `CreateHistoricalPayment`'s own\n * `Contractor.Payments.CreateHistoricalPayment` namespace (under the `review` key), so partner\n * overrides on that namespace flow into the in-place review step.\n *\n * @internal\n */\nexport function useCreateHistoricalPaymentReviewDictionary(): PaymentSummaryBlockDictionary {\n const { t } = useTranslation('Contractor.Payments.CreateHistoricalPayment', {\n keyPrefix: 'review',\n })\n\n return useMemo<PaymentSummaryBlockDictionary>(\n () => ({\n paymentSummaryTitle: t('paymentSummaryTitle'),\n totalAmount: t('totalAmount'),\n contractorPayDate: t('contractorPayDate'),\n contractorPaymentsTitle: t('contractorPaymentsTitle'),\n contractor: t('contractor'),\n wageType: t('wageType'),\n paymentMethod: t('paymentMethod'),\n paymentMethods: {\n directDeposit: t('paymentMethods.directDeposit'),\n check: t('paymentMethods.check'),\n historicalPayment: t('paymentMethods.historicalPayment'),\n },\n hours: t('hours'),\n wage: t('wage'),\n bonus: t('bonus'),\n reimbursement: t('reimbursement'),\n total: t('total'),\n totalsLabel: t('totalsLabel'),\n notAvailable: t('notAvailable'),\n }),\n [t],\n )\n}\n"],"names":["useCreateHistoricalPaymentDictionary","useTranslation","useMemo","rate","total","useCreateHistoricalPaymentReviewDictionary"],"mappings":";;AAYO,SAASA,IAAoE;AAClF,QAAM,EAAE,EAAA,IAAMC,EAAe,6CAA6C;AAE1E,SAAOC;AAAA,IACL,OAAO;AAAA,MACL,uBAAuB,EAAE,uBAAuB;AAAA,MAChD,wBAAwB;AAAA,QACtB,YAAY,EAAE,mCAAmC;AAAA,QACjD,UAAU,EAAE,iCAAiC;AAAA,QAC7C,eAAe,EAAE,sCAAsC;AAAA,QACvD,OAAO,EAAE,8BAA8B;AAAA,QACvC,MAAM,EAAE,6BAA6B;AAAA,QACrC,OAAO,EAAE,8BAA8B;AAAA,QACvC,eAAe,EAAE,sCAAsC;AAAA,QACvD,OAAO,EAAE,8BAA8B;AAAA,MAAA;AAAA,MAEzC,iBAAiB,EAAE,iBAAiB;AAAA,MACpC,uBAAuB,EAAE,uBAAuB;AAAA,MAChD,IAAI,EAAE,IAAI;AAAA,MACV,aAAa,EAAE,aAAa;AAAA,MAC5B,gBAAgB,EAAE,gBAAgB;AAAA,MAClC,SAAS,EAAE,SAAS;AAAA,MACpB,uBAAuB;AAAA,QACrB,OAAO,EAAE,6BAA6B;AAAA,QACtC,UAAU,EAAE,gCAAgC;AAAA,QAC5C,YAAY,EAAE,kCAAkC;AAAA,QAChD,gBAAgB,EAAE,sCAAsC;AAAA,QACxD,qBAAqB,CAACC,GAAMC,MAC1B,EAAE,6CAA6C,EAAE,MAAAD,GAAM,OAAAC,GAAO;AAAA,QAChE,WAAW,EAAE,iCAAiC;AAAA,QAC9C,YAAY,EAAE,kCAAkC;AAAA,QAChD,oBAAoB,EAAE,0CAA0C;AAAA,QA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PaymentSummary}.
4
+ *
5
+ * @alpha
6
+ */
7
+ export interface HistoricalPaymentSummaryProps extends BaseComponentInterface<'Contractor.Payments.HistoricalPaymentSummary'> {
8
+ /** UUID of the historical contractor payment group to summarize. */
9
+ paymentGroupId: string;
10
+ /** UUID of the company that owns the payment group. */
11
+ companyId: string;
12
+ }
13
+ /**
14
+ * Displays the summary of a successfully recorded historical contractor payment.
15
+ *
16
+ * @remarks
17
+ * Fetches the created contractor payment group by ID and renders a per-contractor breakdown.
18
+ * Historical payments don't move money, so unlike `PaymentSummary` there is no debit account,
19
+ * debit date, or wire-transfer confirmation to show.
20
+ *
21
+ * @events
22
+ * | Event | Description | Data |
23
+ * | ----- | ----------- | ---- |
24
+ * | `contractor/historicalPayments/exit` | User is done reviewing the summary. | — |
25
+ *
26
+ * @param props - See {@link HistoricalPaymentSummaryProps}.
27
+ * @returns The rendered payment summary, or `null` when the payment group cannot be loaded.
28
+ * @alpha
29
+ */
30
+ export declare function HistoricalPaymentSummary(props: HistoricalPaymentSummaryProps): import("react").JSX.Element;
@@ -0,0 +1,56 @@
1
+ import { jsx as t, jsxs as e } from "react/jsx-runtime";
2
+ import { useTranslation as S } from "react-i18next";
3
+ import { useContractorPaymentGroupsGetSuspense as g } from "@gusto/embedded-api/react-query/contractorPaymentGroupsGet";
4
+ import { useContractorsListSuspense as T } from "@gusto/embedded-api/react-query/contractorsList";
5
+ import { useHistoricalPaymentSummaryDictionary as x } from "./useFormDictionary.js";
6
+ import { Flex as a } from "../../../Common/Flex/Flex.js";
7
+ import { BaseComponent as H } from "../../../Base/Base.js";
8
+ import "../../../Base/useBase.js";
9
+ import { useComponentContext as G } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
10
+ import { useI18n as O, useComponentDictionary as b } from "../../../../i18n/I18n.js";
11
+ import { useDateFormatter as A } from "../../../../hooks/useDateFormatter.js";
12
+ import { ContractorOnboardingStatus as I, componentEvents as E } from "../../../../shared/constants.js";
13
+ import { PaymentSummaryBlock as L } from "../shared/PaymentSummaryBlock/PaymentSummaryBlock.js";
14
+ function q(r) {
15
+ return /* @__PURE__ */ t(H, { ...r, componentName: "Contractor.Payments.HistoricalPaymentSummary", children: /* @__PURE__ */ t(N, { ...r }) });
16
+ }
17
+ function N({ paymentGroupId: r, companyId: c, dictionary: s, onEvent: u }) {
18
+ O("Contractor.Payments.HistoricalPaymentSummary"), b("Contractor.Payments.HistoricalPaymentSummary", s);
19
+ const { t: o } = S("Contractor.Payments.HistoricalPaymentSummary"), { Heading: l, Text: m, Button: y, Alert: p } = G(), { formatLongWithYear: f } = A(), d = x(), { data: C } = g({
20
+ contractorPaymentGroupUuid: r
21
+ }), n = C.contractorPaymentGroup, { data: P } = T({ companyUuid: c }), h = (P.contractors || []).filter(
22
+ (i) => i.isActive && i.onboardingStatus === I.ONBOARDING_COMPLETED
23
+ );
24
+ if (!n)
25
+ return null;
26
+ const D = () => {
27
+ u(E.CONTRACTOR_HISTORICAL_PAYMENT_EXIT);
28
+ };
29
+ return /* @__PURE__ */ e(a, { flexDirection: "column", gap: 24, children: [
30
+ /* @__PURE__ */ t(p, { status: "success", label: o("successTitle"), children: /* @__PURE__ */ t(m, { children: o("successMessage", {
31
+ count: n.contractorPayments?.length ?? 0
32
+ }) }) }),
33
+ /* @__PURE__ */ e(a, { justifyContent: "space-between", alignItems: "flex-start", children: [
34
+ /* @__PURE__ */ e(a, { flexDirection: "column", gap: 2, children: [
35
+ /* @__PURE__ */ t(l, { as: "h2", children: o("summaryTitle") }),
36
+ /* @__PURE__ */ t(m, { variant: "supporting", children: o("summarySubtitle", {
37
+ checkDate: f(n.checkDate ?? "")
38
+ }) })
39
+ ] }),
40
+ /* @__PURE__ */ t(y, { onClick: D, variant: "primary", children: o("doneCta") })
41
+ ] }),
42
+ /* @__PURE__ */ t(
43
+ L,
44
+ {
45
+ contractorPaymentGroup: n,
46
+ contractors: h,
47
+ showDebitColumns: !1,
48
+ dictionary: d
49
+ }
50
+ )
51
+ ] });
52
+ }
53
+ export {
54
+ q as HistoricalPaymentSummary
55
+ };
56
+ //# sourceMappingURL=HistoricalPaymentSummary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HistoricalPaymentSummary.js","sources":["../../../../../src/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useContractorPaymentGroupsGetSuspense } from '@gusto/embedded-api/react-query/contractorPaymentGroupsGet'\nimport { useContractorsListSuspense } from '@gusto/embedded-api/react-query/contractorsList'\nimport { PaymentSummaryBlock } from '../shared/PaymentSummaryBlock'\nimport { useHistoricalPaymentSummaryDictionary } from './useFormDictionary'\nimport { Flex } from '@/components/Common'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { componentEvents, ContractorOnboardingStatus } from '@/shared/constants'\n\n/**\n * Props for {@link HistoricalPaymentSummary}.\n *\n * @alpha\n */\nexport interface HistoricalPaymentSummaryProps extends BaseComponentInterface<'Contractor.Payments.HistoricalPaymentSummary'> {\n /** UUID of the historical contractor payment group to summarize. */\n paymentGroupId: string\n /** UUID of the company that owns the payment group. */\n companyId: string\n}\n\n/**\n * Displays the summary of a successfully recorded historical contractor payment.\n *\n * @remarks\n * Fetches the created contractor payment group by ID and renders a per-contractor breakdown.\n * Historical payments don't move money, so unlike `PaymentSummary` there is no debit account,\n * debit date, or wire-transfer confirmation to show.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/historicalPayments/exit` | User is done reviewing the summary. | — |\n *\n * @param props - See {@link HistoricalPaymentSummaryProps}.\n * @returns The rendered payment summary, or `null` when the payment group cannot be loaded.\n * @alpha\n */\nexport function HistoricalPaymentSummary(props: HistoricalPaymentSummaryProps) {\n return (\n <BaseComponent {...props} componentName=\"Contractor.Payments.HistoricalPaymentSummary\">\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ paymentGroupId, companyId, dictionary, onEvent }: HistoricalPaymentSummaryProps) {\n useI18n('Contractor.Payments.HistoricalPaymentSummary')\n useComponentDictionary('Contractor.Payments.HistoricalPaymentSummary', dictionary)\n const { t } = useTranslation('Contractor.Payments.HistoricalPaymentSummary')\n const { Heading, Text, Button, Alert } = useComponentContext()\n const { formatLongWithYear } = useDateFormatter()\n const summaryDictionary = useHistoricalPaymentSummaryDictionary()\n\n const { data: paymentGroupData } = useContractorPaymentGroupsGetSuspense({\n contractorPaymentGroupUuid: paymentGroupId,\n })\n const contractorPaymentGroup = paymentGroupData.contractorPaymentGroup\n\n const { data: contractorList } = useContractorsListSuspense({ companyUuid: companyId })\n const contractors = (contractorList.contractors || []).filter(\n contractor =>\n contractor.isActive &&\n contractor.onboardingStatus === ContractorOnboardingStatus.ONBOARDING_COMPLETED,\n )\n\n if (!contractorPaymentGroup) {\n return null\n }\n\n const handleDone = () => {\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_EXIT)\n }\n\n return (\n <Flex flexDirection=\"column\" gap={24}>\n <Alert status=\"success\" label={t('successTitle')}>\n <Text>\n {t('successMessage', {\n count: contractorPaymentGroup.contractorPayments?.length ?? 0,\n })}\n </Text>\n </Alert>\n\n <Flex justifyContent=\"space-between\" alignItems=\"flex-start\">\n <Flex flexDirection=\"column\" gap={2}>\n <Heading as=\"h2\">{t('summaryTitle')}</Heading>\n <Text variant=\"supporting\">\n {t('summarySubtitle', {\n checkDate: formatLongWithYear(contractorPaymentGroup.checkDate ?? ''),\n })}\n </Text>\n </Flex>\n <Button onClick={handleDone} variant=\"primary\">\n {t('doneCta')}\n </Button>\n </Flex>\n\n <PaymentSummaryBlock\n contractorPaymentGroup={contractorPaymentGroup}\n contractors={contractors}\n showDebitColumns={false}\n dictionary={summaryDictionary}\n />\n </Flex>\n )\n}\n"],"names":["HistoricalPaymentSummary","props","jsx","BaseComponent","Root","paymentGroupId","companyId","dictionary","onEvent","useI18n","useComponentDictionary","t","useTranslation","Heading","Text","Button","Alert","useComponentContext","formatLongWithYear","useDateFormatter","summaryDictionary","useHistoricalPaymentSummaryDictionary","paymentGroupData","useContractorPaymentGroupsGetSuspense","contractorPaymentGroup","contractorList","useContractorsListSuspense","contractors","contractor","ContractorOnboardingStatus","handleDone","componentEvents","jsxs","Flex","PaymentSummaryBlock"],"mappings":";;;;;;;;;;;;;AAyCO,SAASA,EAAyBC,GAAsC;AAC7E,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GAAO,eAAc,gDACtC,UAAA,gBAAAC,EAACE,GAAA,EAAM,GAAGH,EAAA,CAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,gBAAAC,GAAgB,WAAAC,GAAW,YAAAC,GAAY,SAAAC,KAA0C;AAC/F,EAAAC,EAAQ,8CAA8C,GACtDC,EAAuB,gDAAgDH,CAAU;AACjF,QAAM,EAAE,GAAAI,EAAA,IAAMC,EAAe,8CAA8C,GACrE,EAAE,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAAQ,OAAAC,EAAA,IAAUC,EAAA,GACnC,EAAE,oBAAAC,EAAA,IAAuBC,EAAA,GACzBC,IAAoBC,EAAA,GAEpB,EAAE,MAAMC,EAAA,IAAqBC,EAAsC;AAAA,IACvE,4BAA4BlB;AAAA,EAAA,CAC7B,GACKmB,IAAyBF,EAAiB,wBAE1C,EAAE,MAAMG,EAAA,IAAmBC,EAA2B,EAAE,aAAapB,GAAW,GAChFqB,KAAeF,EAAe,eAAe,CAAA,GAAI;AAAA,IACrD,CAAAG,MACEA,EAAW,YACXA,EAAW,qBAAqBC,EAA2B;AAAA,EAAA;AAG/D,MAAI,CAACL;AACH,WAAO;AAGT,QAAMM,IAAa,MAAM;AACvB,IAAAtB,EAAQuB,EAAgB,kCAAkC;AAAA,EAC5D;AAEA,SACE,gBAAAC,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAA/B,EAACc,GAAA,EAAM,QAAO,WAAU,OAAOL,EAAE,cAAc,GAC7C,UAAA,gBAAAT,EAACY,GAAA,EACE,UAAAH,EAAE,kBAAkB;AAAA,MACnB,OAAOa,EAAuB,oBAAoB,UAAU;AAAA,IAAA,CAC7D,GACH,EAAA,CACF;AAAA,IAEA,gBAAAQ,EAACC,GAAA,EAAK,gBAAe,iBAAgB,YAAW,cAC9C,UAAA;AAAA,MAAA,gBAAAD,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,QAAA,gBAAA/B,EAACW,GAAA,EAAQ,IAAG,MAAM,UAAAF,EAAE,cAAc,GAAE;AAAA,QACpC,gBAAAT,EAACY,GAAA,EAAK,SAAQ,cACX,YAAE,mBAAmB;AAAA,UACpB,WAAWI,EAAmBM,EAAuB,aAAa,EAAE;AAAA,QAAA,CACrE,EAAA,CACH;AAAA,MAAA,GACF;AAAA,MACA,gBAAAtB,EAACa,KAAO,SAASe,GAAY,SAAQ,WAClC,UAAAnB,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,GACF;AAAA,IAEA,gBAAAT;AAAA,MAACgC;AAAA,MAAA;AAAA,QACC,wBAAAV;AAAA,QACA,aAAAG;AAAA,QACA,kBAAkB;AAAA,QAClB,YAAYP;AAAA,MAAA;AAAA,IAAA;AAAA,EACd,GACF;AAEJ;"}
@@ -0,0 +1 @@
1
+ export { HistoricalPaymentSummary, type HistoricalPaymentSummaryProps, } from './HistoricalPaymentSummary';
@@ -0,0 +1,9 @@
1
+ import { PaymentSummaryBlockDictionary } from '../shared/PaymentSummaryBlock';
2
+ /**
3
+ * Resolves `PaymentSummaryBlock`'s text against `HistoricalPaymentSummary`'s own
4
+ * `Contractor.Payments.HistoricalPaymentSummary` namespace, so partner overrides on that
5
+ * namespace flow into the shared block.
6
+ *
7
+ * @internal
8
+ */
9
+ export declare function useHistoricalPaymentSummaryDictionary(): PaymentSummaryBlockDictionary;
@@ -0,0 +1,33 @@
1
+ import { useMemo as e } from "react";
2
+ import { useTranslation as a } from "react-i18next";
3
+ function n() {
4
+ const { t } = a("Contractor.Payments.HistoricalPaymentSummary");
5
+ return e(
6
+ () => ({
7
+ paymentSummaryTitle: t("paymentSummaryTitle"),
8
+ totalAmount: t("totalAmount"),
9
+ contractorPayDate: t("contractorPayDate"),
10
+ contractorPaymentsTitle: t("contractorPaymentsTitle"),
11
+ contractor: t("contractor"),
12
+ wageType: t("wageType"),
13
+ paymentMethod: t("paymentMethod"),
14
+ paymentMethods: {
15
+ directDeposit: t("paymentMethods.directDeposit"),
16
+ check: t("paymentMethods.check"),
17
+ historicalPayment: t("paymentMethods.historicalPayment")
18
+ },
19
+ hours: t("hours"),
20
+ wage: t("wage"),
21
+ bonus: t("bonus"),
22
+ reimbursement: t("reimbursement"),
23
+ total: t("total"),
24
+ totalsLabel: t("totalsLabel"),
25
+ notAvailable: t("notAvailable")
26
+ }),
27
+ [t]
28
+ );
29
+ }
30
+ export {
31
+ n as useHistoricalPaymentSummaryDictionary
32
+ };
33
+ //# sourceMappingURL=useFormDictionary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormDictionary.js","sources":["../../../../../src/components/Contractor/Payments/HistoricalPaymentSummary/useFormDictionary.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { PaymentSummaryBlockDictionary } from '../shared/PaymentSummaryBlock'\n\n/**\n * Resolves `PaymentSummaryBlock`'s text against `HistoricalPaymentSummary`'s own\n * `Contractor.Payments.HistoricalPaymentSummary` namespace, so partner overrides on that\n * namespace flow into the shared block.\n *\n * @internal\n */\nexport function useHistoricalPaymentSummaryDictionary(): PaymentSummaryBlockDictionary {\n const { t } = useTranslation('Contractor.Payments.HistoricalPaymentSummary')\n\n return useMemo<PaymentSummaryBlockDictionary>(\n () => ({\n paymentSummaryTitle: t('paymentSummaryTitle'),\n totalAmount: t('totalAmount'),\n contractorPayDate: t('contractorPayDate'),\n contractorPaymentsTitle: t('contractorPaymentsTitle'),\n contractor: t('contractor'),\n wageType: t('wageType'),\n paymentMethod: t('paymentMethod'),\n paymentMethods: {\n directDeposit: t('paymentMethods.directDeposit'),\n check: t('paymentMethods.check'),\n historicalPayment: t('paymentMethods.historicalPayment'),\n },\n hours: t('hours'),\n wage: t('wage'),\n bonus: t('bonus'),\n reimbursement: t('reimbursement'),\n total: t('total'),\n totalsLabel: t('totalsLabel'),\n notAvailable: t('notAvailable'),\n }),\n [t],\n )\n}\n"],"names":["useHistoricalPaymentSummaryDictionary","useTranslation","useMemo"],"mappings":";;AAWO,SAASA,IAAuE;AACrF,QAAM,EAAE,EAAA,IAAMC,EAAe,8CAA8C;AAE3E,SAAOC;AAAA,IACL,OAAO;AAAA,MACL,qBAAqB,EAAE,qBAAqB;AAAA,MAC5C,aAAa,EAAE,aAAa;AAAA,MAC5B,mBAAmB,EAAE,mBAAmB;AAAA,MACxC,yBAAyB,EAAE,yBAAyB;AAAA,MACpD,YAAY,EAAE,YAAY;AAAA,MAC1B,UAAU,EAAE,UAAU;AAAA,MACtB,eAAe,EAAE,eAAe;AAAA,MAChC,gBAAgB;AAAA,QACd,eAAe,EAAE,8BAA8B;AAAA,QAC/C,OAAO,EAAE,sBAAsB;AAAA,QAC/B,mBAAmB,EAAE,kCAAkC;AAAA,MAAA;AAAA,MAEzD,OAAO,EAAE,OAAO;AAAA,MAChB,MAAM,EAAE,MAAM;AAAA,MACd,OAAO,EAAE,OAAO;AAAA,MAChB,eAAe,EAAE,eAAe;AAAA,MAChC,OAAO,EAAE,OAAO;AAAA,MAChB,aAAa,EAAE,aAAa;AAAA,MAC5B,cAAc,EAAE,cAAc;AAAA,IAAA;AAAA,IAEhC,CAAC,CAAC;AAAA,EAAA;AAEN;"}