@gusto/embedded-react-sdk 0.32.0 → 0.34.0

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 (155) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.d.ts +5 -0
  3. package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.js +34 -0
  4. package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.js.map +1 -0
  5. package/dist/components/Common/Fields/MultiSelectComboBoxField/index.d.ts +2 -0
  6. package/dist/components/Common/SignatureForm/SignatureForm.d.ts +1 -7
  7. package/dist/components/Common/UI/Badge/Badge.js +39 -8
  8. package/dist/components/Common/UI/Badge/Badge.js.map +1 -1
  9. package/dist/components/Common/UI/Badge/Badge.module.scss.js +8 -4
  10. package/dist/components/Common/UI/Badge/Badge.module.scss.js.map +1 -1
  11. package/dist/components/Common/UI/Badge/BadgeTypes.d.ts +12 -0
  12. package/dist/components/Common/UI/Badge/BadgeTypes.js.map +1 -1
  13. package/dist/components/Common/UI/Menu/Menu.js +2 -3
  14. package/dist/components/Common/UI/Menu/Menu.js.map +1 -1
  15. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.d.ts +2 -0
  16. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +127 -0
  17. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -0
  18. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.module.scss.js +16 -0
  19. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.module.scss.js.map +1 -0
  20. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +17 -0
  21. package/dist/components/Common/UI/MultiSelectComboBox/index.d.ts +3 -0
  22. package/dist/components/Common/index.d.ts +1 -0
  23. package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.d.ts +4 -30
  24. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.d.ts +2 -26
  25. package/dist/components/Company/BankAccount/BankAccountForm/Form.d.ts +1 -7
  26. package/dist/components/Company/BankAccount/BankAccountVerify/Form.d.ts +1 -7
  27. package/dist/components/Company/FederalTaxes/useFederalTaxes.d.ts +7 -13
  28. package/dist/components/Company/Locations/LocationForm/Form.d.ts +7 -20
  29. package/dist/components/Company/PaySchedule/usePaySchedule.d.ts +7 -18
  30. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +40 -46
  31. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  32. package/dist/components/Contractor/Address/useAddress.d.ts +1 -13
  33. package/dist/components/Contractor/ContractorList/useContractorList.js +4 -4
  34. package/dist/components/Contractor/ContractorList/useContractorList.js.map +1 -1
  35. package/dist/components/Contractor/NewHireReport/NewHireReport.d.ts +5 -15
  36. package/dist/components/Contractor/NewHireReport/NewHireReport.js +28 -28
  37. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  38. package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +7 -20
  39. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.d.ts +5 -6
  40. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +108 -100
  41. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
  42. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +4 -1
  43. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +54 -50
  44. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  45. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentFormSchema.d.ts +19 -67
  46. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +27 -26
  47. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
  48. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +76 -44
  49. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
  50. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +1 -1
  51. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
  52. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +1 -1
  53. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -1
  54. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.d.ts +3 -1
  55. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js +28 -22
  56. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js.map +1 -1
  57. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.d.ts +3 -1
  58. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +63 -52
  59. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
  60. package/dist/components/Contractor/Profile/useContractorProfile.d.ts +54 -120
  61. package/dist/components/Contractor/Profile/useContractorProfile.js +47 -47
  62. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  63. package/dist/components/Employee/Compensation/useCompensation.d.ts +17 -44
  64. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.d.ts +4 -22
  65. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +59 -59
  66. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  67. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.d.ts +4 -22
  68. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +33 -33
  69. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  70. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.d.ts +5 -27
  71. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +46 -46
  72. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  73. package/dist/components/Employee/Deductions/useDeductions.d.ts +7 -26
  74. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.d.ts +5 -29
  75. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js +8 -8
  76. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js.map +1 -1
  77. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.d.ts +9 -76
  78. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.d.ts +1 -5
  79. package/dist/components/Employee/FederalTaxes/FederalForm.d.ts +7 -33
  80. package/dist/components/Employee/PaymentMethod/BankAccount.d.ts +5 -14
  81. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.d.ts +5 -6
  82. package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +12 -68
  83. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +15 -14
  84. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  85. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +17 -82
  86. package/dist/components/Employee/Profile/AdminPersonalDetails.js +38 -33
  87. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  88. package/dist/components/Employee/Profile/HomeAddress.d.ts +11 -66
  89. package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +15 -64
  90. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +23 -19
  91. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  92. package/dist/components/Employee/Profile/Profile.js +2 -5
  93. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  94. package/dist/components/Employee/Profile/SelfPersonalDetails.d.ts +8 -37
  95. package/dist/components/Employee/Profile/SelfPersonalDetails.js +22 -19
  96. package/dist/components/Employee/Profile/SelfPersonalDetails.js.map +1 -1
  97. package/dist/components/Employee/StateTaxes/StateForm.d.ts +1 -5
  98. package/dist/components/Employee/Taxes/FederalForm.d.ts +7 -33
  99. package/dist/components/Employee/Taxes/StateForm.d.ts +1 -5
  100. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.d.ts +1 -11
  101. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +1 -1
  102. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
  103. package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +6 -9
  104. package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
  105. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +84 -56
  106. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
  107. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
  108. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +56 -22
  109. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
  110. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +5 -0
  111. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.d.ts +2 -22
  112. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +22 -18
  113. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
  114. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.test.d.ts +1 -0
  115. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +12 -8
  116. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  117. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +5 -5
  118. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  119. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +2 -12
  120. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +34 -34
  121. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  122. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +38 -35
  123. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
  124. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +1 -0
  125. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
  126. package/dist/components/Payroll/usePreparedPayrollData.js +26 -26
  127. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  128. package/dist/contexts/ApiProvider/ApiProvider.js +26 -25
  129. package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
  130. package/dist/contexts/ApiProvider/apiVersionHook.d.ts +2 -0
  131. package/dist/contexts/ApiProvider/apiVersionHook.js +7 -0
  132. package/dist/contexts/ApiProvider/apiVersionHook.js.map +1 -0
  133. package/dist/contexts/ApiProvider/apiVersionHook.test.d.ts +1 -0
  134. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +60 -58
  135. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
  136. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
  137. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  138. package/dist/contexts/ThemeProvider/ThemeProvider.js +23 -23
  139. package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
  140. package/dist/helpers/validations.d.ts +2 -2
  141. package/dist/i18n/I18n.js +15 -15
  142. package/dist/i18n/I18n.js.map +1 -1
  143. package/dist/i18n/en/Contractor.Payments.PaymentSummary.json.js +42 -40
  144. package/dist/i18n/en/Contractor.Payments.PaymentSummary.json.js.map +1 -1
  145. package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +9 -9
  146. package/dist/i18n/en/Payroll.EmployeeSelection.json.js +10 -0
  147. package/dist/i18n/en/Payroll.EmployeeSelection.json.js.map +1 -0
  148. package/dist/i18n/en/Payroll.OffCycleCreation.json.js +10 -8
  149. package/dist/i18n/en/Payroll.OffCycleCreation.json.js.map +1 -1
  150. package/dist/i18n/en/common.json.d.ts +4 -1
  151. package/dist/i18n/en/common.json.js +5 -5
  152. package/dist/style.css +1 -1
  153. package/dist/types/i18next.d.ts +14 -1
  154. package/docs/reference/endpoint-inventory.json +4 -0
  155. package/package.json +13 -12
@@ -1,50 +1,50 @@
1
1
  import { jsx as n, jsxs as p } from "react/jsx-runtime";
2
2
  import { useTranslation as W } from "react-i18next";
3
- import { useForm as G, useWatch as H, FormProvider as j } from "react-hook-form";
3
+ import { useForm as H, useWatch as V, FormProvider as j } from "react-hook-form";
4
4
  import { useMemo as K, useEffect as y } from "react";
5
- import { z as i } from "zod";
6
- import { zodResolver as V } from "@hookform/resolvers/zod";
7
- import { PaymentPeriod as z } from "@gusto/embedded-api/models/components/garnishmentchildsupport";
8
- import { useGarnishmentsCreateMutation as X } from "@gusto/embedded-api/react-query/garnishmentsCreate";
9
- import { useGarnishmentsUpdateMutation as $ } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
10
- import { useComponentContext as J } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
- import { Form as Q } from "../../../Common/Form/Form.js";
5
+ import { z as o } from "zod";
6
+ import { zodResolver as z } from "@hookform/resolvers/zod";
7
+ import { PaymentPeriod as X } from "@gusto/embedded-api/models/components/garnishmentchildsupport";
8
+ import { useGarnishmentsCreateMutation as $ } from "@gusto/embedded-api/react-query/garnishmentsCreate";
9
+ import { useGarnishmentsUpdateMutation as J } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
10
+ import { useComponentContext as Q } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
+ import { Form as Z } from "../../../Common/Form/Form.js";
12
12
  import { Flex as P } from "../../../Common/Flex/Flex.js";
13
13
  import "classnames";
14
14
  import { componentEvents as M } from "../../../../shared/constants.js";
15
- import { TextInputField as Z } from "../../../Common/Fields/TextInputField/TextInputField.js";
16
- import { ActionsLayout as ee } from "../../../Common/ActionsLayout/ActionsLayout.js";
15
+ import { TextInputField as ee } from "../../../Common/Fields/TextInputField/TextInputField.js";
16
+ import { ActionsLayout as re } from "../../../Common/ActionsLayout/ActionsLayout.js";
17
17
  import { NumberInputField as D } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
18
18
  import "react-error-boundary";
19
19
  import "@gusto/embedded-api/models/errors/gustoembeddederror";
20
20
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
21
21
  import "@tanstack/react-query";
22
- import { useBase as re } from "../../../Base/useBase.js";
22
+ import { useBase as te } from "../../../Base/useBase.js";
23
23
  import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
24
24
  import "dompurify";
25
25
  import "../../../../contexts/LocaleProvider/useLocale.js";
26
- import { SelectField as f } from "../../../Common/Fields/SelectField/SelectField.js";
27
- const te = 0, ne = 0, ie = 100, oe = i.nativeEnum(z), me = i.object({
28
- state: i.string(),
29
- fipsCode: i.string(),
30
- caseNumber: i.string().nullable(),
31
- orderNumber: i.string().nullable(),
32
- remittanceNumber: i.string().nullable(),
33
- amount: i.number().min(0).transform(String),
34
- payPeriodMaximum: i.number().min(0).transform((r) => r > 0 ? r.toString() : null).nullable(),
35
- paymentPeriod: oe
26
+ import { SelectField as N } from "../../../Common/Fields/SelectField/SelectField.js";
27
+ const ne = 0, oe = 0, ie = 100, _ = "Number must be greater than or equal to 0", me = o.enum(X), ae = o.object({
28
+ state: o.string(),
29
+ fipsCode: o.string(),
30
+ caseNumber: o.string().nullable(),
31
+ orderNumber: o.string().nullable(),
32
+ remittanceNumber: o.string().nullable(),
33
+ amount: o.number().min(0, { error: _ }).transform(String),
34
+ payPeriodMaximum: o.number().min(0, { error: _ }).transform((r) => r > 0 ? r.toString() : null).nullable(),
35
+ paymentPeriod: me
36
36
  });
37
- function Ie({
37
+ function Oe({
38
38
  deduction: r,
39
- handleStateAgencySelect: _,
40
- stateAgencies: x,
39
+ handleStateAgencySelect: R,
40
+ stateAgencies: A,
41
41
  counties: l,
42
42
  singleAllCountiesFipsCode: m,
43
- employeeId: A,
44
- selectedAgency: N,
45
- onCancel: v
43
+ employeeId: x,
44
+ selectedAgency: f,
45
+ onCancel: T
46
46
  }) {
47
- const { onEvent: E, baseSubmitHandler: R } = re(), { t: e } = W("Employee.Deductions"), a = J(), g = {
47
+ const { onEvent: E, baseSubmitHandler: v } = te(), { t: e } = W("Employee.Deductions"), a = Q(), g = {
48
48
  case_number: {
49
49
  name: "caseNumber",
50
50
  description: e("caseNumberDescription")
@@ -57,11 +57,11 @@ function Ie({
57
57
  name: "remittanceNumber",
58
58
  description: e("remittanceNumberDescription")
59
59
  }
60
- }, T = N?.requiredAttributes?.map((t) => ({
60
+ }, q = f?.requiredAttributes?.map((t) => ({
61
61
  name: g[t.key].name,
62
62
  label: t.label,
63
63
  description: g[t.key].description
64
- })) || [], { mutateAsync: q, isPending: I } = X(), { mutateAsync: k, isPending: w } = $(), O = I || w, c = K(() => ({
64
+ })) || [], { mutateAsync: I, isPending: O } = $(), { mutateAsync: k, isPending: w } = J(), U = O || w, c = K(() => ({
65
65
  amount: r?.amount ? Number(r.amount) : 0,
66
66
  payPeriodMaximum: r?.payPeriodMaximum ? Number(r.payPeriodMaximum) : null,
67
67
  state: r?.childSupport?.state || "",
@@ -70,18 +70,18 @@ function Ie({
70
70
  orderNumber: r?.childSupport?.orderNumber || null,
71
71
  remittanceNumber: r?.childSupport?.remittanceNumber || null,
72
72
  paymentPeriod: r?.childSupport?.paymentPeriod
73
- }), [r]), d = G({
74
- resolver: V(me),
73
+ }), [r]), d = H({
74
+ resolver: z(ae),
75
75
  defaultValues: c
76
- }), { reset: S, setValue: o, control: U } = d, b = H({ control: U, name: "state" });
76
+ }), { reset: S, setValue: i, control: F } = d, b = V({ control: F, name: "state" });
77
77
  y(() => {
78
78
  S(c);
79
79
  }, [r, c, S]), y(() => {
80
- o("caseNumber", null), o("orderNumber", null), o("remittanceNumber", null);
81
- }, [b, o]), y(() => {
82
- typeof m == "string" && o("fipsCode", m);
83
- }, [m, o]);
84
- const F = async (t) => {
80
+ i("caseNumber", null), i("orderNumber", null), i("remittanceNumber", null);
81
+ }, [b, i]), y(() => {
82
+ typeof m == "string" && i("fipsCode", m);
83
+ }, [m, i]);
84
+ const Y = async (t) => {
85
85
  const u = {
86
86
  state: t.state,
87
87
  paymentPeriod: t.paymentPeriod,
@@ -90,7 +90,7 @@ function Ie({
90
90
  orderNumber: t.orderNumber,
91
91
  remittanceNumber: t.remittanceNumber
92
92
  };
93
- await R(t, async (s) => {
93
+ await v(t, async (s) => {
94
94
  const C = {
95
95
  active: !0,
96
96
  amount: s.amount,
@@ -117,36 +117,36 @@ function Ie({
117
117
  });
118
118
  E(M.EMPLOYEE_DEDUCTION_UPDATED, h);
119
119
  } else {
120
- const { garnishment: h } = await q({
120
+ const { garnishment: h } = await I({
121
121
  request: {
122
- employeeId: A,
122
+ employeeId: x,
123
123
  requestBody: C
124
124
  }
125
125
  });
126
126
  E(M.EMPLOYEE_DEDUCTION_CREATED, h);
127
127
  }
128
128
  });
129
- }, Y = () => {
130
- v();
131
- }, B = N?.manualPaymentRequired, L = l.length > 1 || l.length === 1 && m == null;
132
- return /* @__PURE__ */ n(j, { ...d, children: /* @__PURE__ */ n(Q, { onSubmit: d.handleSubmit(F), children: /* @__PURE__ */ p(P, { flexDirection: "column", gap: 32, children: [
129
+ }, B = () => {
130
+ T();
131
+ }, G = f?.manualPaymentRequired, L = l.length > 1 || l.length === 1 && m == null;
132
+ return /* @__PURE__ */ n(j, { ...d, children: /* @__PURE__ */ n(Z, { onSubmit: d.handleSubmit(Y), children: /* @__PURE__ */ p(P, { flexDirection: "column", gap: 32, children: [
133
133
  /* @__PURE__ */ n(a.Heading, { as: "h3", children: e("childSupportTitle") }),
134
134
  /* @__PURE__ */ p(P, { flexDirection: "column", gap: 20, children: [
135
135
  /* @__PURE__ */ n(
136
- f,
136
+ N,
137
137
  {
138
138
  name: "state",
139
139
  label: e("agency"),
140
140
  description: e("agencyDescription"),
141
- options: x,
142
- onChange: _,
141
+ options: A,
142
+ onChange: R,
143
143
  isRequired: !0
144
144
  }
145
145
  ),
146
- B && /* @__PURE__ */ n(a.Alert, { status: "warning", label: e("manualPaymentRequired") }),
146
+ G && /* @__PURE__ */ n(a.Alert, { status: "warning", label: e("manualPaymentRequired") }),
147
147
  b && /* @__PURE__ */ p(P, { flexDirection: "column", gap: 20, children: [
148
148
  L && /* @__PURE__ */ n(
149
- f,
149
+ N,
150
150
  {
151
151
  name: "fipsCode",
152
152
  label: e("county"),
@@ -155,8 +155,8 @@ function Ie({
155
155
  isRequired: !0
156
156
  }
157
157
  ),
158
- T.map(({ name: t, label: u, description: s }) => /* @__PURE__ */ n(
159
- Z,
158
+ q.map(({ name: t, label: u, description: s }) => /* @__PURE__ */ n(
159
+ ee,
160
160
  {
161
161
  name: t,
162
162
  label: u,
@@ -171,7 +171,7 @@ function Ie({
171
171
  name: "payPeriodMaximum",
172
172
  label: e("totalAmountWithheld"),
173
173
  description: e("totalAmountWithheldDescription"),
174
- min: te,
174
+ min: ne,
175
175
  adornmentStart: "$",
176
176
  isRequired: !0
177
177
  }
@@ -183,13 +183,13 @@ function Ie({
183
183
  label: e("maxPaycheckPercentage"),
184
184
  description: e("maxPaycheckPercentageDescription"),
185
185
  isRequired: !0,
186
- min: ne,
186
+ min: oe,
187
187
  max: ie,
188
188
  adornmentEnd: "%"
189
189
  }
190
190
  ),
191
191
  /* @__PURE__ */ n(
192
- f,
192
+ N,
193
193
  {
194
194
  name: "paymentPeriod",
195
195
  label: e("per"),
@@ -217,13 +217,13 @@ function Ie({
217
217
  )
218
218
  ] })
219
219
  ] }),
220
- /* @__PURE__ */ p(ee, { children: [
221
- /* @__PURE__ */ n(a.Button, { variant: "secondary", onClick: Y, children: e("cancelCta") }),
222
- b && /* @__PURE__ */ n(a.Button, { type: "submit", isLoading: O, children: e("saveCta") })
220
+ /* @__PURE__ */ p(re, { children: [
221
+ /* @__PURE__ */ n(a.Button, { variant: "secondary", onClick: B, children: e("cancelCta") }),
222
+ b && /* @__PURE__ */ n(a.Button, { type: "submit", isLoading: U, children: e("saveCta") })
223
223
  ] })
224
224
  ] }) }) });
225
225
  }
226
226
  export {
227
- Ie as default
227
+ Oe as default
228
228
  };
229
229
  //# sourceMappingURL=ChildSupportForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChildSupportForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/ChildSupportForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { PaymentPeriod } from '@gusto/embedded-api/models/components/garnishmentchildsupport'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Agencies } from '@gusto/embedded-api/models/components/childsupportdata'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, SelectField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst MINIMUM_PAY_PERIOD_AMOUNT = 0\nconst MINIMUM_PAYCHECK_PERCENTAGE = 0\nconst MAXIMUM_PAYCHECK_PERCENTAGE = 100\n\nconst ChildSupportPaymentPeriodSchema = z.nativeEnum(PaymentPeriod)\nconst ChildSupportSchema = z.object({\n state: z.string(),\n fipsCode: z.string(),\n caseNumber: z.string().nullable(),\n orderNumber: z.string().nullable(),\n remittanceNumber: z.string().nullable(),\n amount: z.number().min(0).transform(String),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n paymentPeriod: ChildSupportPaymentPeriodSchema,\n})\n\nexport type ChildSupportInputs = z.input<typeof ChildSupportSchema>\nexport type ChildSupportPayload = z.output<typeof ChildSupportSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n handleStateAgencySelect: (stateAgency: string) => void\n stateAgencies: { label: string; value: string }[]\n counties: { label: string; value: string }[]\n singleAllCountiesFipsCode: string | null | undefined\n selectedAgency?: Agencies\n onCancel: () => void\n}\n\nfunction ChildSupportForm({\n deduction,\n handleStateAgencySelect,\n stateAgencies,\n counties,\n singleAllCountiesFipsCode,\n employeeId,\n selectedAgency,\n onCancel,\n}: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER = {\n case_number: {\n name: 'caseNumber',\n description: t('caseNumberDescription'),\n },\n order_number: {\n name: 'orderNumber',\n description: t('orderNumberDescription'),\n },\n remittance_number: {\n name: 'remittanceNumber',\n description: t('remittanceNumberDescription'),\n },\n }\n const requiredSelectedAgencyAttributes =\n selectedAgency?.requiredAttributes?.map(attr => {\n return {\n name: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].name,\n label: attr.label as string,\n description: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].description,\n }\n }) || []\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultChildSupportValues: ChildSupportInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n state: deduction?.childSupport?.state || '',\n fipsCode: deduction?.childSupport?.fipsCode || '',\n caseNumber: deduction?.childSupport?.caseNumber || null,\n orderNumber: deduction?.childSupport?.orderNumber || null,\n remittanceNumber: deduction?.childSupport?.remittanceNumber || null,\n paymentPeriod: deduction?.childSupport?.paymentPeriod as PaymentPeriod,\n }\n }, [deduction])\n\n const childSupportFormMethods = useForm<ChildSupportInputs, unknown, ChildSupportPayload>({\n resolver: zodResolver(ChildSupportSchema),\n defaultValues: defaultChildSupportValues,\n })\n const { reset: resetChildSupportForm, setValue, control } = childSupportFormMethods\n const watchedStateAgency = useWatch({ control, name: 'state' })\n\n useEffect(() => {\n resetChildSupportForm(defaultChildSupportValues)\n }, [deduction, defaultChildSupportValues, resetChildSupportForm])\n\n // if in edit mode and user elects to change state agency, reset the required attribute values\n // as new selected agency might require different payload inputs, e.g. OH requires case number + order number\n useEffect(() => {\n setValue('caseNumber', null)\n setValue('orderNumber', null)\n setValue('remittanceNumber', null)\n }, [watchedStateAgency, setValue])\n\n useEffect(() => {\n if (typeof singleAllCountiesFipsCode === 'string') {\n setValue('fipsCode', singleAllCountiesFipsCode)\n }\n }, [singleAllCountiesFipsCode, setValue])\n\n const onChildSupportSubmit: SubmitHandler<ChildSupportPayload> = async data => {\n const childSupport = {\n state: data.state,\n paymentPeriod: data.paymentPeriod,\n fipsCode: data.fipsCode,\n caseNumber: data.caseNumber,\n orderNumber: data.orderNumber,\n remittanceNumber: data.remittanceNumber,\n }\n\n await baseSubmitHandler(data, async payload => {\n const requestBody = {\n active: true,\n amount: payload.amount,\n description: `Child Support - ${childSupport.caseNumber}`, // child support description follows prefix type + case number convention\n courtOrdered: true,\n garnishmentType: 'child_support' as GarnishmentType,\n times: null,\n deductAsPercentage: true, // child support must always deduct as percentage up to a pay period maximum limit and is recurring until cancelled\n payPeriodMaximum: payload.payPeriodMaximum,\n recurring: true,\n childSupport,\n }\n\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId,\n requestBody,\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...requestBody,\n version: deduction.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onCancel()\n }\n\n const isManualPaymentRequired = selectedAgency?.manualPaymentRequired\n const hasSelectableCounties =\n counties.length > 1 || (counties.length === 1 && singleAllCountiesFipsCode == null)\n\n return (\n <FormProvider {...childSupportFormMethods}>\n <Form onSubmit={childSupportFormMethods.handleSubmit(onChildSupportSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h3\">{t('childSupportTitle')}</Components.Heading>\n <Flex flexDirection=\"column\" gap={20}>\n <SelectField\n name=\"state\"\n label={t('agency')}\n description={t('agencyDescription')}\n options={stateAgencies}\n onChange={handleStateAgencySelect}\n isRequired\n />\n\n {isManualPaymentRequired && (\n <Components.Alert status=\"warning\" label={t('manualPaymentRequired')} />\n )}\n\n {watchedStateAgency && (\n <Flex flexDirection=\"column\" gap={20}>\n {hasSelectableCounties && (\n <SelectField\n name=\"fipsCode\"\n label={t('county')}\n description={t('countyDescription')}\n options={counties}\n isRequired\n />\n )}\n {/* render required inputs for respective agency, e.g. OH requires case number + order number */}\n {requiredSelectedAgencyAttributes.map(({ name, label, description }) => (\n <TextInputField\n key={name}\n name={name}\n label={label}\n description={description}\n isRequired\n />\n ))}\n <NumberInputField\n name=\"payPeriodMaximum\"\n label={t('totalAmountWithheld')}\n description={t('totalAmountWithheldDescription')}\n min={MINIMUM_PAY_PERIOD_AMOUNT}\n adornmentStart=\"$\"\n isRequired\n />\n <NumberInputField\n name=\"amount\"\n label={t('maxPaycheckPercentage')}\n description={t('maxPaycheckPercentageDescription')}\n isRequired\n min={MINIMUM_PAYCHECK_PERCENTAGE}\n max={MAXIMUM_PAYCHECK_PERCENTAGE}\n adornmentEnd=\"%\"\n />\n <SelectField\n name=\"paymentPeriod\"\n label={t('per')}\n description={t('perDescription')}\n options={[\n {\n label: t('everyWeek'),\n value: 'Every week',\n },\n {\n label: t('everyOtherWeek'),\n value: 'Every other week',\n },\n {\n label: t('twicePerMonth'),\n value: 'Twice per month',\n },\n {\n label: t('monthly'),\n value: 'Monthly',\n },\n ]}\n isRequired\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n {watchedStateAgency && (\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n )}\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default ChildSupportForm\n"],"names":["MINIMUM_PAY_PERIOD_AMOUNT","MINIMUM_PAYCHECK_PERCENTAGE","MAXIMUM_PAYCHECK_PERCENTAGE","ChildSupportPaymentPeriodSchema","z","PaymentPeriod","ChildSupportSchema","val","ChildSupportForm","deduction","handleStateAgencySelect","stateAgencies","counties","singleAllCountiesFipsCode","employeeId","selectedAgency","onCancel","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER","requiredSelectedAgencyAttributes","attr","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultChildSupportValues","useMemo","childSupportFormMethods","useForm","zodResolver","resetChildSupportForm","setValue","control","watchedStateAgency","useWatch","useEffect","onChildSupportSubmit","data","childSupport","payload","requestBody","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","isManualPaymentRequired","hasSelectableCounties","FormProvider","jsx","Form","jsxs","Flex","SelectField","name","label","description","TextInputField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAMA,KAA4B,GAC5BC,KAA8B,GAC9BC,KAA8B,KAE9BC,KAAkCC,EAAE,WAAWC,CAAa,GAC5DC,KAAqBF,EAAE,OAAO;AAAA,EAClC,OAAOA,EAAE,OAAA;AAAA,EACT,UAAUA,EAAE,OAAA;AAAA,EACZ,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,aAAaA,EAAE,OAAA,EAAS,SAAA;AAAA,EACxB,kBAAkBA,EAAE,OAAA,EAAS,SAAA;AAAA,EAC7B,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,kBAAkBA,EACf,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAG,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,eAAeJ;AACjB,CAAC;AAgBD,SAASK,GAAiB;AAAA,EACxB,WAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AACF,GAA0B;AACxB,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,GAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEbC,IAAqC;AAAA,IACzC,aAAa;AAAA,MACX,MAAM;AAAA,MACN,aAAaJ,EAAE,uBAAuB;AAAA,IAAA;AAAA,IAExC,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,aAAaA,EAAE,wBAAwB;AAAA,IAAA;AAAA,IAEzC,mBAAmB;AAAA,MACjB,MAAM;AAA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;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"ChildSupportForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/ChildSupportForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { PaymentPeriod } from '@gusto/embedded-api/models/components/garnishmentchildsupport'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Agencies } from '@gusto/embedded-api/models/components/childsupportdata'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, SelectField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst MINIMUM_PAY_PERIOD_AMOUNT = 0\nconst MINIMUM_PAYCHECK_PERCENTAGE = 0\nconst MAXIMUM_PAYCHECK_PERCENTAGE = 100\n\nconst NON_NEGATIVE_ERROR = 'Number must be greater than or equal to 0'\n\nconst ChildSupportPaymentPeriodSchema = z.enum(PaymentPeriod)\n\nconst ChildSupportSchema = z.object({\n state: z.string(),\n fipsCode: z.string(),\n caseNumber: z.string().nullable(),\n orderNumber: z.string().nullable(),\n remittanceNumber: z.string().nullable(),\n amount: z.number().min(0, { error: NON_NEGATIVE_ERROR }).transform(String),\n payPeriodMaximum: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n paymentPeriod: ChildSupportPaymentPeriodSchema,\n})\n\nexport type ChildSupportInputs = z.input<typeof ChildSupportSchema>\nexport type ChildSupportPayload = z.output<typeof ChildSupportSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n handleStateAgencySelect: (stateAgency: string) => void\n stateAgencies: { label: string; value: string }[]\n counties: { label: string; value: string }[]\n singleAllCountiesFipsCode: string | null | undefined\n selectedAgency?: Agencies\n onCancel: () => void\n}\n\nfunction ChildSupportForm({\n deduction,\n handleStateAgencySelect,\n stateAgencies,\n counties,\n singleAllCountiesFipsCode,\n employeeId,\n selectedAgency,\n onCancel,\n}: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER = {\n case_number: {\n name: 'caseNumber',\n description: t('caseNumberDescription'),\n },\n order_number: {\n name: 'orderNumber',\n description: t('orderNumberDescription'),\n },\n remittance_number: {\n name: 'remittanceNumber',\n description: t('remittanceNumberDescription'),\n },\n }\n const requiredSelectedAgencyAttributes =\n selectedAgency?.requiredAttributes?.map(attr => {\n return {\n name: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].name,\n label: attr.label as string,\n description: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].description,\n }\n }) || []\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultChildSupportValues: ChildSupportInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n state: deduction?.childSupport?.state || '',\n fipsCode: deduction?.childSupport?.fipsCode || '',\n caseNumber: deduction?.childSupport?.caseNumber || null,\n orderNumber: deduction?.childSupport?.orderNumber || null,\n remittanceNumber: deduction?.childSupport?.remittanceNumber || null,\n paymentPeriod: deduction?.childSupport?.paymentPeriod as PaymentPeriod,\n }\n }, [deduction])\n\n const childSupportFormMethods = useForm<ChildSupportInputs, unknown, ChildSupportPayload>({\n resolver: zodResolver(ChildSupportSchema),\n defaultValues: defaultChildSupportValues,\n })\n const { reset: resetChildSupportForm, setValue, control } = childSupportFormMethods\n const watchedStateAgency = useWatch({ control, name: 'state' })\n\n useEffect(() => {\n resetChildSupportForm(defaultChildSupportValues)\n }, [deduction, defaultChildSupportValues, resetChildSupportForm])\n\n // if in edit mode and user elects to change state agency, reset the required attribute values\n // as new selected agency might require different payload inputs, e.g. OH requires case number + order number\n useEffect(() => {\n setValue('caseNumber', null)\n setValue('orderNumber', null)\n setValue('remittanceNumber', null)\n }, [watchedStateAgency, setValue])\n\n useEffect(() => {\n if (typeof singleAllCountiesFipsCode === 'string') {\n setValue('fipsCode', singleAllCountiesFipsCode)\n }\n }, [singleAllCountiesFipsCode, setValue])\n\n const onChildSupportSubmit: SubmitHandler<ChildSupportPayload> = async data => {\n const childSupport = {\n state: data.state,\n paymentPeriod: data.paymentPeriod,\n fipsCode: data.fipsCode,\n caseNumber: data.caseNumber,\n orderNumber: data.orderNumber,\n remittanceNumber: data.remittanceNumber,\n }\n\n await baseSubmitHandler(data, async payload => {\n const requestBody = {\n active: true,\n amount: payload.amount,\n description: `Child Support - ${childSupport.caseNumber}`, // child support description follows prefix type + case number convention\n courtOrdered: true,\n garnishmentType: 'child_support' as GarnishmentType,\n times: null,\n deductAsPercentage: true, // child support must always deduct as percentage up to a pay period maximum limit and is recurring until cancelled\n payPeriodMaximum: payload.payPeriodMaximum,\n recurring: true,\n childSupport,\n }\n\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId,\n requestBody,\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...requestBody,\n version: deduction.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onCancel()\n }\n\n const isManualPaymentRequired = selectedAgency?.manualPaymentRequired\n const hasSelectableCounties =\n counties.length > 1 || (counties.length === 1 && singleAllCountiesFipsCode == null)\n\n return (\n <FormProvider {...childSupportFormMethods}>\n <Form onSubmit={childSupportFormMethods.handleSubmit(onChildSupportSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h3\">{t('childSupportTitle')}</Components.Heading>\n <Flex flexDirection=\"column\" gap={20}>\n <SelectField\n name=\"state\"\n label={t('agency')}\n description={t('agencyDescription')}\n options={stateAgencies}\n onChange={handleStateAgencySelect}\n isRequired\n />\n\n {isManualPaymentRequired && (\n <Components.Alert status=\"warning\" label={t('manualPaymentRequired')} />\n )}\n\n {watchedStateAgency && (\n <Flex flexDirection=\"column\" gap={20}>\n {hasSelectableCounties && (\n <SelectField\n name=\"fipsCode\"\n label={t('county')}\n description={t('countyDescription')}\n options={counties}\n isRequired\n />\n )}\n {/* render required inputs for respective agency, e.g. OH requires case number + order number */}\n {requiredSelectedAgencyAttributes.map(({ name, label, description }) => (\n <TextInputField\n key={name}\n name={name}\n label={label}\n description={description}\n isRequired\n />\n ))}\n <NumberInputField\n name=\"payPeriodMaximum\"\n label={t('totalAmountWithheld')}\n description={t('totalAmountWithheldDescription')}\n min={MINIMUM_PAY_PERIOD_AMOUNT}\n adornmentStart=\"$\"\n isRequired\n />\n <NumberInputField\n name=\"amount\"\n label={t('maxPaycheckPercentage')}\n description={t('maxPaycheckPercentageDescription')}\n isRequired\n min={MINIMUM_PAYCHECK_PERCENTAGE}\n max={MAXIMUM_PAYCHECK_PERCENTAGE}\n adornmentEnd=\"%\"\n />\n <SelectField\n name=\"paymentPeriod\"\n label={t('per')}\n description={t('perDescription')}\n options={[\n {\n label: t('everyWeek'),\n value: 'Every week',\n },\n {\n label: t('everyOtherWeek'),\n value: 'Every other week',\n },\n {\n label: t('twicePerMonth'),\n value: 'Twice per month',\n },\n {\n label: t('monthly'),\n value: 'Monthly',\n },\n ]}\n isRequired\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n {watchedStateAgency && (\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n )}\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default ChildSupportForm\n"],"names":["MINIMUM_PAY_PERIOD_AMOUNT","MINIMUM_PAYCHECK_PERCENTAGE","MAXIMUM_PAYCHECK_PERCENTAGE","NON_NEGATIVE_ERROR","ChildSupportPaymentPeriodSchema","z","PaymentPeriod","ChildSupportSchema","val","ChildSupportForm","deduction","handleStateAgencySelect","stateAgencies","counties","singleAllCountiesFipsCode","employeeId","selectedAgency","onCancel","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER","requiredSelectedAgencyAttributes","attr","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultChildSupportValues","useMemo","childSupportFormMethods","useForm","zodResolver","resetChildSupportForm","setValue","control","watchedStateAgency","useWatch","useEffect","onChildSupportSubmit","data","childSupport","payload","requestBody","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","isManualPaymentRequired","hasSelectableCounties","FormProvider","jsx","Form","jsxs","Flex","SelectField","name","label","description","TextInputField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MA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C/C,KAAKrB;AAAA,YACL,gBAAe;AAAA,YACf,YAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAEZ,gBAAA0D;AAAA,UAACS;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,OAAO9C,EAAE,uBAAuB;AAAA,YAChC,aAAaA,EAAE,kCAAkC;AAAA,YACjD,YAAU;AAAA,YACV,KAAKpB;AAAA,YACL,KAAKC;AAAA,YACL,cAAa;AAAA,UAAA;AAAA,QAAA;AAAA,QAEf,gBAAAwD;AAAA,UAACI;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,OAAOzC,EAAE,KAAK;AAAA,YACd,aAAaA,EAAE,gBAAgB;AAAA,YAC/B,SAAS;AAAA,cACP;AAAA,gBACE,OAAOA,EAAE,WAAW;AAAA,gBACpB,OAAO;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,OAAOA,EAAE,gBAAgB;AAAA,gBACzB,OAAO;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,OAAOA,EAAE,eAAe;AAAA,gBACxB,OAAO;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,OAAOA,EAAE,SAAS;AAAA,gBAClB,OAAO;AAAA,cAAA;AAAA,YACT;AAAA,YAEF,YAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACZ,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACC+C,IAAA,EACC,UAAA;AAAA,MAAA,gBAAAV,EAACnC,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAAS+B,GAC7C,UAAAjC,EAAE,WAAW,EAAA,CAChB;AAAA,MACCsB,KACC,gBAAAe,EAACnC,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWW,GACzC,UAAAb,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -3,32 +3,14 @@ import { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
3
3
  import { CommonComponentInterface } from '../../../Base';
4
4
  export declare const DeductionSchema: z.ZodObject<{
5
5
  active: z.ZodBoolean;
6
- amount: z.ZodEffects<z.ZodNumber, string, number>;
6
+ amount: z.ZodPipe<z.ZodNumber, z.ZodTransform<string, number>>;
7
7
  description: z.ZodString;
8
8
  times: z.ZodNullable<z.ZodNumber>;
9
9
  recurring: z.ZodBoolean;
10
- annualMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
11
- totalAmount: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
10
+ annualMaximum: z.ZodNullable<z.ZodPipe<z.ZodNumber, z.ZodTransform<string | null, number>>>;
11
+ totalAmount: z.ZodNullable<z.ZodPipe<z.ZodNumber, z.ZodTransform<string | null, number>>>;
12
12
  deductAsPercentage: z.ZodBoolean;
13
- }, "strip", z.ZodTypeAny, {
14
- description: string;
15
- active: boolean;
16
- totalAmount: string | null;
17
- amount: string;
18
- recurring: boolean;
19
- times: number | null;
20
- annualMaximum: string | null;
21
- deductAsPercentage: boolean;
22
- }, {
23
- description: string;
24
- active: boolean;
25
- totalAmount: number | null;
26
- amount: number;
27
- recurring: boolean;
28
- times: number | null;
29
- annualMaximum: number | null;
30
- deductAsPercentage: boolean;
31
- }>;
13
+ }, z.core.$strip>;
32
14
  export type DeductionInputs = z.input<typeof DeductionSchema>;
33
15
  export type DeductionPayload = z.output<typeof DeductionSchema>;
34
16
  interface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {
@@ -1,40 +1,40 @@
1
- import { jsx as t, jsxs as o, Fragment as S } from "react/jsx-runtime";
2
- import { useTranslation as T } from "react-i18next";
3
- import { useForm as L, useWatch as f, FormProvider as O } from "react-hook-form";
4
- import { useMemo as N } from "react";
1
+ import { jsx as t, jsxs as o, Fragment as F } from "react/jsx-runtime";
2
+ import { useTranslation as S } from "react-i18next";
3
+ import { useForm as L, useWatch as f, FormProvider as N } from "react-hook-form";
4
+ import { useMemo as V } from "react";
5
5
  import { z as r } from "zod";
6
- import { zodResolver as V } from "@hookform/resolvers/zod";
7
- import { useGarnishmentsCreateMutation as w } from "@gusto/embedded-api/react-query/garnishmentsCreate";
8
- import { useGarnishmentsUpdateMutation as B } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
9
- import { useComponentContext as I } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
6
+ import { zodResolver as I } from "@hookform/resolvers/zod";
7
+ import { useGarnishmentsCreateMutation as _ } from "@gusto/embedded-api/react-query/garnishmentsCreate";
8
+ import { useGarnishmentsUpdateMutation as w } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
9
+ import { useComponentContext as B } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
10
10
  import { Form as U } from "../../../Common/Form/Form.js";
11
11
  import { Flex as m } from "../../../Common/Flex/Flex.js";
12
12
  import "classnames";
13
- import { componentEvents as b } from "../../../../shared/constants.js";
14
- import { RadioGroupField as g } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
15
- import { TextInputField as _ } from "../../../Common/Fields/TextInputField/TextInputField.js";
13
+ import { componentEvents as g } from "../../../../shared/constants.js";
14
+ import { RadioGroupField as h } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
15
+ import { TextInputField as G } from "../../../Common/Fields/TextInputField/TextInputField.js";
16
16
  import { ActionsLayout as j } from "../../../Common/ActionsLayout/ActionsLayout.js";
17
17
  import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
18
18
  import "react-error-boundary";
19
19
  import "@gusto/embedded-api/models/errors/gustoembeddederror";
20
20
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
21
21
  import "@tanstack/react-query";
22
- import { useBase as G } from "../../../Base/useBase.js";
22
+ import { useBase as $ } from "../../../Base/useBase.js";
23
23
  import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
24
24
  import "dompurify";
25
25
  import "../../../../contexts/LocaleProvider/useLocale.js";
26
- const $ = r.object({
26
+ const d = "Number must be greater than or equal to 0", z = r.object({
27
27
  active: r.boolean(),
28
- amount: r.number().min(0).transform(String),
28
+ amount: r.number().min(0, { error: d }).transform(String),
29
29
  description: r.string().min(1),
30
30
  times: r.number().nullable(),
31
31
  recurring: r.boolean(),
32
- annualMaximum: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
33
- totalAmount: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
32
+ annualMaximum: r.number().min(0, { error: d }).transform((e) => e > 0 ? e.toString() : null).nullable(),
33
+ totalAmount: r.number().min(0, { error: d }).transform((e) => e > 0 ? e.toString() : null).nullable(),
34
34
  deductAsPercentage: r.boolean()
35
35
  });
36
- function be({ deduction: e, employeeId: h, onCancel: D }) {
37
- const { onEvent: d, baseSubmitHandler: A } = G(), { t: n } = T("Employee.Deductions"), u = I(), { mutateAsync: x, isPending: P } = w(), { mutateAsync: y, isPending: E } = B(), v = P || E, C = N(() => ({
36
+ function ge({ deduction: e, employeeId: A, onCancel: D }) {
37
+ const { onEvent: p, baseSubmitHandler: x } = $(), { t: n } = S("Employee.Deductions"), u = B(), { mutateAsync: E, isPending: P } = _(), { mutateAsync: y, isPending: R } = w(), v = P || R, C = V(() => ({
38
38
  amount: e?.amount ? Number(e.amount) : 0,
39
39
  description: e?.description ?? "",
40
40
  times: e?.times ?? null,
@@ -44,10 +44,10 @@ function be({ deduction: e, employeeId: h, onCancel: D }) {
44
44
  deductAsPercentage: e?.deductAsPercentage ?? !0,
45
45
  active: !0
46
46
  }), [e]), s = L({
47
- resolver: V($),
47
+ resolver: I(z),
48
48
  defaultValues: C
49
- }), { control: p } = s, M = f({ control: p, name: "recurring" }), i = f({ control: p, name: "deductAsPercentage" }), q = async (R) => {
50
- await A(R, async (a) => {
49
+ }), { control: b } = s, M = f({ control: b, name: "recurring" }), i = f({ control: b, name: "deductAsPercentage" }), q = async (T) => {
50
+ await x(T, async (a) => {
51
51
  if (e) {
52
52
  const { garnishment: l } = await y({
53
53
  request: {
@@ -59,28 +59,28 @@ function be({ deduction: e, employeeId: h, onCancel: D }) {
59
59
  }
60
60
  }
61
61
  });
62
- d(b.EMPLOYEE_DEDUCTION_UPDATED, l);
62
+ p(g.EMPLOYEE_DEDUCTION_UPDATED, l);
63
63
  } else {
64
- const { garnishment: l } = await x({
64
+ const { garnishment: l } = await E({
65
65
  request: {
66
- employeeId: h,
66
+ employeeId: A,
67
67
  requestBody: { ...a, courtOrdered: !1, times: a.recurring ? null : 1 }
68
68
  // custom deductions cannot be court ordered/garnishment
69
69
  }
70
70
  });
71
- d(b.EMPLOYEE_DEDUCTION_CREATED, l);
71
+ p(g.EMPLOYEE_DEDUCTION_CREATED, l);
72
72
  }
73
73
  });
74
- }, F = () => {
74
+ }, O = () => {
75
75
  D();
76
76
  };
77
- return /* @__PURE__ */ t(O, { ...s, children: /* @__PURE__ */ t(U, { onSubmit: s.handleSubmit(q), children: /* @__PURE__ */ t(m, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(S, { children: [
77
+ return /* @__PURE__ */ t(N, { ...s, children: /* @__PURE__ */ t(U, { onSubmit: s.handleSubmit(q), children: /* @__PURE__ */ t(m, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(F, { children: [
78
78
  /* @__PURE__ */ t(u.Heading, { as: "h3", children: n("customDeductionTitle") }),
79
79
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
80
80
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
81
- /* @__PURE__ */ t(_, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
81
+ /* @__PURE__ */ t(G, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
82
82
  /* @__PURE__ */ t(
83
- g,
83
+ h,
84
84
  {
85
85
  name: "recurring",
86
86
  label: n("frequencyLabel"),
@@ -92,7 +92,7 @@ function be({ deduction: e, employeeId: h, onCancel: D }) {
92
92
  }
93
93
  ),
94
94
  /* @__PURE__ */ t(
95
- g,
95
+ h,
96
96
  {
97
97
  name: "deductAsPercentage",
98
98
  label: n("deductionTypeLabelV2"),
@@ -143,13 +143,13 @@ function be({ deduction: e, employeeId: h, onCancel: D }) {
143
143
  ] })
144
144
  ] }),
145
145
  /* @__PURE__ */ o(j, { children: [
146
- /* @__PURE__ */ t(u.Button, { variant: "secondary", onClick: F, children: n("cancelCta") }),
146
+ /* @__PURE__ */ t(u.Button, { variant: "secondary", onClick: O, children: n("cancelCta") }),
147
147
  /* @__PURE__ */ t(u.Button, { type: "submit", isLoading: v, children: n("saveCta") })
148
148
  ] })
149
149
  ] }) }) }) });
150
150
  }
151
151
  export {
152
- $ as DeductionSchema,
153
- be as default
152
+ z as DeductionSchema,
153
+ ge as default
154
154
  };
155
155
  //# sourceMappingURL=CustomDeductionForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomDeductionForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n onCancel: () => void\n}\n\nfunction CustomDeductionForm({ deduction, employeeId, onCancel }: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, courtOrdered: false, times: payload.recurring ? null : 1 }, // custom deductions cannot be court ordered/garnishment\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onCancel()\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{t('customDeductionTitle')}</Components.Heading>\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default CustomDeductionForm\n"],"names":["DeductionSchema","z","val","CustomDeductionForm","deduction","employeeId","onCancel","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AACxB,CAAC;AAWD,SAASE,GAAoB,EAAE,WAAAC,GAAW,YAAAC,GAAY,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ChB;AAAA,MACA,gBAAA4B,EAAC1B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAAV,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"CustomDeductionForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst NON_NEGATIVE_ERROR = 'Number must be greater than or equal to 0'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0, { error: NON_NEGATIVE_ERROR }).transform(String),\n description: z.string().min(1),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n onCancel: () => void\n}\n\nfunction CustomDeductionForm({ deduction, employeeId, onCancel }: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, courtOrdered: false, times: payload.recurring ? null : 1 }, // custom deductions cannot be court ordered/garnishment\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onCancel()\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{t('customDeductionTitle')}</Components.Heading>\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default CustomDeductionForm\n"],"names":["NON_NEGATIVE_ERROR","DeductionSchema","z","val","CustomDeductionForm","deduction","employeeId","onCancel","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,IAAqB,6CAEdC,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,GAAG,EAAE,OAAOF,EAAA,CAAoB,EAAE,UAAU,MAAM;AAAA,EACzE,aAAaE,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,SACA,IAAI,GAAG,EAAE,OAAOF,GAAoB,EACpC,UAAU,CAAAG,MAAQA,IAAM,IAAIA,EAAI,aAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,SACA,IAAI,GAAG,EAAE,OAAOF,GAAoB,EACpC,UAAU,CAAAG,MAAQA,IAAM,IAAIA,EAAI,aAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AACxB,CAAC;AAWD,SAASE,GAAoB,EAAE,WAAAC,GAAW,YAAAC,GAAY,UAAAC,KAAmC;AACvF,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAM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ACd;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -4,15 +4,15 @@ import { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1emp
4
4
  import { CommonComponentInterface } from '../../../Base';
5
5
  export declare const DeductionSchema: z.ZodObject<{
6
6
  active: z.ZodBoolean;
7
- amount: z.ZodEffects<z.ZodNumber, string, number>;
7
+ amount: z.ZodPipe<z.ZodNumber, z.ZodTransform<string, number>>;
8
8
  description: z.ZodString;
9
9
  courtOrdered: z.ZodBoolean;
10
10
  times: z.ZodNullable<z.ZodNumber>;
11
11
  recurring: z.ZodBoolean;
12
- annualMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
13
- totalAmount: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
12
+ annualMaximum: z.ZodNullable<z.ZodPipe<z.ZodNumber, z.ZodTransform<string | null, number>>>;
13
+ totalAmount: z.ZodNullable<z.ZodPipe<z.ZodNumber, z.ZodTransform<string | null, number>>>;
14
14
  deductAsPercentage: z.ZodBoolean;
15
- garnishmentType: z.ZodNativeEnum<{
15
+ garnishmentType: z.ZodEnum<{
16
16
  readonly ChildSupport: "child_support";
17
17
  readonly FederalTaxLien: "federal_tax_lien";
18
18
  readonly StateTaxLien: "state_tax_lien";
@@ -21,29 +21,7 @@ export declare const DeductionSchema: z.ZodObject<{
21
21
  readonly FederalLoan: "federal_loan";
22
22
  readonly OtherGarnishment: "other_garnishment";
23
23
  }>;
24
- }, "strip", z.ZodTypeAny, {
25
- description: string;
26
- active: boolean;
27
- totalAmount: string | null;
28
- amount: string;
29
- garnishmentType: "child_support" | "federal_tax_lien" | "state_tax_lien" | "student_loan" | "creditor_garnishment" | "federal_loan" | "other_garnishment";
30
- recurring: boolean;
31
- courtOrdered: boolean;
32
- times: number | null;
33
- annualMaximum: string | null;
34
- deductAsPercentage: boolean;
35
- }, {
36
- description: string;
37
- active: boolean;
38
- totalAmount: number | null;
39
- amount: number;
40
- garnishmentType: "child_support" | "federal_tax_lien" | "state_tax_lien" | "student_loan" | "creditor_garnishment" | "federal_loan" | "other_garnishment";
41
- recurring: boolean;
42
- courtOrdered: boolean;
43
- times: number | null;
44
- annualMaximum: number | null;
45
- deductAsPercentage: boolean;
46
- }>;
24
+ }, z.core.$strip>;
47
25
  export type DeductionInputs = z.input<typeof DeductionSchema>;
48
26
  export type DeductionPayload = z.output<typeof DeductionSchema>;
49
27
  interface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {