@gusto/embedded-react-sdk 0.32.0 → 0.34.0-rc.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 (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 +14 -13
@@ -1,49 +1,49 @@
1
- import { jsx as t, jsxs as o, Fragment as S } from "react/jsx-runtime";
2
- import { useTranslation as L } from "react-i18next";
3
- import { useForm as N, useWatch as g, FormProvider as V } from "react-hook-form";
4
- import { useMemo as w } from "react";
1
+ import { jsx as t, jsxs as o, Fragment as L } from "react/jsx-runtime";
2
+ import { useTranslation as N } from "react-i18next";
3
+ import { useForm as V, useWatch as g, FormProvider as G } from "react-hook-form";
4
+ import { useMemo as I } from "react";
5
5
  import { z as r } from "zod";
6
- import { zodResolver as B } from "@hookform/resolvers/zod";
7
- import { GarnishmentType as G } from "@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments";
8
- import { useGarnishmentsCreateMutation as I } from "@gusto/embedded-api/react-query/garnishmentsCreate";
6
+ import { zodResolver as _ } from "@hookform/resolvers/zod";
7
+ import { GarnishmentType as w } from "@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments";
8
+ import { useGarnishmentsCreateMutation as B } from "@gusto/embedded-api/react-query/garnishmentsCreate";
9
9
  import { useGarnishmentsUpdateMutation as U } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
10
- import { useComponentContext as _ } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
- import { Form as j } from "../../../Common/Form/Form.js";
10
+ import { useComponentContext as j } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
+ import { Form as $ } from "../../../Common/Form/Form.js";
12
12
  import { Flex as m } from "../../../Common/Flex/Flex.js";
13
13
  import "classnames";
14
- import { componentEvents as b } from "../../../../shared/constants.js";
15
- import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
16
- import { TextInputField as $ } from "../../../Common/Fields/TextInputField/TextInputField.js";
17
- import { ActionsLayout as z } from "../../../Common/ActionsLayout/ActionsLayout.js";
14
+ import { componentEvents as f } from "../../../../shared/constants.js";
15
+ import { RadioGroupField as h } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
16
+ import { TextInputField as z } from "../../../Common/Fields/TextInputField/TextInputField.js";
17
+ import { ActionsLayout as H } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
18
  import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
19
19
  import "react-error-boundary";
20
20
  import "@gusto/embedded-api/models/errors/gustoembeddederror";
21
21
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
22
22
  import "@tanstack/react-query";
23
- import { useBase as H } from "../../../Base/useBase.js";
23
+ import { useBase as Y } from "../../../Base/useBase.js";
24
24
  import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
25
25
  import "dompurify";
26
26
  import "../../../../contexts/LocaleProvider/useLocale.js";
27
- const Y = r.object({
27
+ const p = "Number must be greater than or equal to 0", k = r.object({
28
28
  active: r.boolean(),
29
- amount: r.number().min(0).transform(String),
29
+ amount: r.number().min(0, { error: p }).transform(String),
30
30
  description: r.string().min(1),
31
31
  courtOrdered: r.boolean(),
32
32
  times: r.number().nullable(),
33
33
  recurring: r.boolean(),
34
- annualMaximum: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
35
- totalAmount: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
34
+ annualMaximum: r.number().min(0, { error: p }).transform((e) => e > 0 ? e.toString() : null).nullable(),
35
+ totalAmount: r.number().min(0, { error: p }).transform((e) => e > 0 ? e.toString() : null).nullable(),
36
36
  deductAsPercentage: r.boolean(),
37
- garnishmentType: r.nativeEnum(G)
37
+ garnishmentType: r.enum(w)
38
38
  });
39
- function De({
39
+ function ye({
40
40
  deduction: e,
41
- employeeId: h,
42
- selectedGarnishmentType: A,
43
- selectedGarnishmentTitle: D,
44
- onCancel: y
41
+ employeeId: A,
42
+ selectedGarnishmentType: D,
43
+ selectedGarnishmentTitle: y,
44
+ onCancel: x
45
45
  }) {
46
- const { onEvent: p, baseSubmitHandler: x } = H(), { t: n } = L("Employee.Deductions"), u = _(), { mutateAsync: P, isPending: E } = I(), { mutateAsync: v, isPending: T } = U(), M = E || T, C = w(() => ({
46
+ const { onEvent: d, baseSubmitHandler: E } = Y(), { t: n } = N("Employee.Deductions"), u = j(), { mutateAsync: P, isPending: T } = B(), { mutateAsync: R, isPending: v } = U(), M = T || v, O = I(() => ({
47
47
  amount: e?.amount ? Number(e.amount) : 0,
48
48
  description: e?.description ?? "",
49
49
  times: e?.times ?? null,
@@ -53,14 +53,14 @@ function De({
53
53
  deductAsPercentage: e?.deductAsPercentage ?? !0,
54
54
  active: !0,
55
55
  courtOrdered: !0,
56
- garnishmentType: e?.garnishmentType ?? A
57
- }), [e]), s = N({
58
- resolver: B(Y),
59
- defaultValues: C
60
- }), { control: d } = s, q = g({ control: d, name: "recurring" }), i = g({ control: d, name: "deductAsPercentage" }), F = async (R) => {
61
- await x(R, async (a) => {
56
+ garnishmentType: e?.garnishmentType ?? D
57
+ }), [e]), s = V({
58
+ resolver: _(k),
59
+ defaultValues: O
60
+ }), { control: b } = s, q = g({ control: b, name: "recurring" }), i = g({ control: b, name: "deductAsPercentage" }), C = async (S) => {
61
+ await E(S, async (a) => {
62
62
  if (e) {
63
- const { garnishment: l } = await v({
63
+ const { garnishment: l } = await R({
64
64
  request: {
65
65
  garnishmentId: e.uuid,
66
66
  requestBody: {
@@ -70,27 +70,27 @@ function De({
70
70
  }
71
71
  }
72
72
  });
73
- p(b.EMPLOYEE_DEDUCTION_UPDATED, l);
73
+ d(f.EMPLOYEE_DEDUCTION_UPDATED, l);
74
74
  } else {
75
75
  const { garnishment: l } = await P({
76
76
  request: {
77
- employeeId: h,
77
+ employeeId: A,
78
78
  requestBody: { ...a, times: a.recurring ? null : 1 }
79
79
  }
80
80
  });
81
- p(b.EMPLOYEE_DEDUCTION_CREATED, l);
81
+ d(f.EMPLOYEE_DEDUCTION_CREATED, l);
82
82
  }
83
83
  });
84
- }, O = () => {
85
- y();
84
+ }, F = () => {
85
+ x();
86
86
  };
87
- return /* @__PURE__ */ t(V, { ...s, children: /* @__PURE__ */ t(j, { onSubmit: s.handleSubmit(F), children: /* @__PURE__ */ t(m, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(S, { children: [
88
- /* @__PURE__ */ t(u.Heading, { as: "h3", children: D }),
87
+ return /* @__PURE__ */ t(G, { ...s, children: /* @__PURE__ */ t($, { onSubmit: s.handleSubmit(C), children: /* @__PURE__ */ t(m, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(L, { children: [
88
+ /* @__PURE__ */ t(u.Heading, { as: "h3", children: y }),
89
89
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
90
90
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
91
- /* @__PURE__ */ t($, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
91
+ /* @__PURE__ */ t(z, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
92
92
  /* @__PURE__ */ t(
93
- f,
93
+ h,
94
94
  {
95
95
  name: "recurring",
96
96
  label: n("frequencyLabel"),
@@ -102,7 +102,7 @@ function De({
102
102
  }
103
103
  ),
104
104
  /* @__PURE__ */ t(
105
- f,
105
+ h,
106
106
  {
107
107
  name: "deductAsPercentage",
108
108
  label: n("deductionTypeLabelV2"),
@@ -152,14 +152,14 @@ function De({
152
152
  )
153
153
  ] })
154
154
  ] }),
155
- /* @__PURE__ */ o(z, { children: [
156
- /* @__PURE__ */ t(u.Button, { variant: "secondary", onClick: O, children: n("cancelCta") }),
155
+ /* @__PURE__ */ o(H, { children: [
156
+ /* @__PURE__ */ t(u.Button, { variant: "secondary", onClick: F, children: n("cancelCta") }),
157
157
  /* @__PURE__ */ t(u.Button, { type: "submit", isLoading: M, children: n("saveCta") })
158
158
  ] })
159
159
  ] }) }) }) });
160
160
  }
161
161
  export {
162
- Y as DeductionSchema,
163
- De as default
162
+ k as DeductionSchema,
163
+ ye as default
164
164
  };
165
165
  //# sourceMappingURL=GarnishmentForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GarnishmentForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/GarnishmentForm.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 { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\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 courtOrdered: z.boolean(),\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 garnishmentType: z.nativeEnum(GarnishmentType),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n selectedGarnishmentType: GarnishmentType\n selectedGarnishmentTitle: string\n onCancel: () => void\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n onCancel,\n}: GarnishmentFormProps) {\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 courtOrdered: true,\n garnishmentType: deduction?.garnishmentType ?? selectedGarnishmentType,\n }\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, times: payload.recurring ? null : 1 },\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\">{selectedGarnishmentTitle}</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 GarnishmentForm\n"],"names":["DeductionSchema","z","val","GarnishmentType","GarnishmentForm","deduction","employeeId","selectedGarnishmentType","selectedGarnishmentTitle","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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,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,cAAcA,EAAE,QAAA;AAAA,EAChB,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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AAE,sBAAsB;AAAA,UAAA;AAAA,QAAA;AAAA,MACvC,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACCoC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAAC1B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASwB,GAC7C,UAAA1B,EAAE,WAAW,EAAA,CAChB;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":"GarnishmentForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/GarnishmentForm.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 { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\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 courtOrdered: z.boolean(),\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 garnishmentType: z.enum(GarnishmentType),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n selectedGarnishmentType: GarnishmentType\n selectedGarnishmentTitle: string\n onCancel: () => void\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n onCancel,\n}: GarnishmentFormProps) {\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 courtOrdered: true,\n garnishmentType: deduction?.garnishmentType ?? selectedGarnishmentType,\n }\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, times: payload.recurring ? null : 1 },\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\">{selectedGarnishmentTitle}</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 GarnishmentForm\n"],"names":["NON_NEGATIVE_ERROR","DeductionSchema","z","val","GarnishmentType","GarnishmentForm","deduction","employeeId","selectedGarnishmentType","selectedGarnishmentTitle","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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,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,cAAcA,EAAE,QAAA;AAAA,EAChB,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,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AAO;AAAA,YACP,OAAOnC,EAAE,kBAAkB;AAAA,YAC3B,aAAaA,EAAE,wBAAwB;AAAA,YACvC,KAAK;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP,gBAAA4B;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,gBAAe;AAAA,YACf,QAAO;AAAA,YACP,OAAOnC,EAAE,gBAAgB;AAAA,YACzB,KAAK;AAAA,YACL,aAAaA,EAAE,sBAAsB;AAAA,UAAA;AAAA,QAAA;AAAA,MACvC,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACCoC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAAC1B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASwB,GAC7C,UAAA1B,EAAE,WAAW,EAAA,CAChB;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,37 +1,18 @@
1
1
  import { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
2
2
  import { z } from 'zod';
3
3
  export type MODE = 'ADD' | 'LIST' | 'INITIAL' | 'EDIT';
4
+ export declare const NON_NEGATIVE_ERROR = "Number must be greater than or equal to 0";
4
5
  export declare const DeductionSchema: z.ZodObject<{
5
6
  active: z.ZodBoolean;
6
- amount: z.ZodEffects<z.ZodNumber, string, number>;
7
+ amount: z.ZodPipe<z.ZodNumber, z.ZodTransform<string, number>>;
7
8
  description: z.ZodString;
8
9
  courtOrdered: z.ZodBoolean;
9
10
  times: z.ZodNullable<z.ZodNumber>;
10
- recurring: z.ZodEffects<z.ZodString, boolean, string>;
11
- annualMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
12
- payPeriodMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
13
- deductAsPercentage: z.ZodEffects<z.ZodString, boolean, string>;
14
- }, "strip", z.ZodTypeAny, {
15
- description: string;
16
- active: boolean;
17
- amount: string;
18
- payPeriodMaximum: string | null;
19
- recurring: boolean;
20
- courtOrdered: boolean;
21
- times: number | null;
22
- annualMaximum: string | null;
23
- deductAsPercentage: boolean;
24
- }, {
25
- description: string;
26
- active: boolean;
27
- amount: number;
28
- payPeriodMaximum: number | null;
29
- recurring: string;
30
- courtOrdered: boolean;
31
- times: number | null;
32
- annualMaximum: number | null;
33
- deductAsPercentage: string;
34
- }>;
11
+ recurring: z.ZodPipe<z.ZodString, z.ZodTransform<boolean, string>>;
12
+ annualMaximum: z.ZodNullable<z.ZodPipe<z.ZodNumber, z.ZodTransform<string | null, number>>>;
13
+ payPeriodMaximum: z.ZodNullable<z.ZodPipe<z.ZodNumber, z.ZodTransform<string | null, number>>>;
14
+ deductAsPercentage: z.ZodPipe<z.ZodString, z.ZodTransform<boolean, string>>;
15
+ }, z.core.$strip>;
35
16
  export type DeductionInputs = z.input<typeof DeductionSchema>;
36
17
  export type DeductionPayload = z.output<typeof DeductionSchema>;
37
18
  type DeductionsContextType = {
@@ -1,43 +1,19 @@
1
1
  import { z } from 'zod';
2
- export declare const generateEmploymentEligibilitySchema: (hasDocumentNumber?: boolean | null) => z.ZodEffects<z.ZodObject<{
3
- authorizationStatus: z.ZodOptional<z.ZodNativeEnum<{
2
+ export declare const generateEmploymentEligibilitySchema: (hasDocumentNumber?: boolean | null) => z.ZodObject<{
3
+ authorizationStatus: z.ZodOptional<z.ZodEnum<{
4
4
  readonly Citizen: "citizen";
5
5
  readonly Noncitizen: "noncitizen";
6
6
  readonly PermanentResident: "permanent_resident";
7
7
  readonly Alien: "alien";
8
8
  }>>;
9
- documentType: z.ZodOptional<z.ZodNativeEnum<{
9
+ documentType: z.ZodOptional<z.ZodEnum<{
10
10
  readonly UscisAlienRegistrationNumber: "uscis_alien_registration_number";
11
11
  readonly FormI94: "form_i94";
12
12
  readonly ForeignPassport: "foreign_passport";
13
13
  }>>;
14
14
  documentNumber: z.ZodOptional<z.ZodString>;
15
- expirationDate: z.ZodOptional<z.ZodEffects<z.ZodDate, string | undefined, Date>>;
15
+ expirationDate: z.ZodOptional<z.ZodPipe<z.ZodDate, z.ZodTransform<string | undefined, Date>>>;
16
16
  country: z.ZodOptional<z.ZodString>;
17
- }, "strip", z.ZodTypeAny, {
18
- expirationDate?: string | undefined;
19
- documentNumber?: string | undefined;
20
- country?: string | undefined;
21
- authorizationStatus?: "citizen" | "permanent_resident" | "noncitizen" | "alien" | undefined;
22
- documentType?: "uscis_alien_registration_number" | "form_i94" | "foreign_passport" | undefined;
23
- }, {
24
- expirationDate?: Date | undefined;
25
- documentNumber?: string | undefined;
26
- country?: string | undefined;
27
- authorizationStatus?: "citizen" | "permanent_resident" | "noncitizen" | "alien" | undefined;
28
- documentType?: "uscis_alien_registration_number" | "form_i94" | "foreign_passport" | undefined;
29
- }>, {
30
- expirationDate?: string | undefined;
31
- documentNumber?: string | undefined;
32
- country?: string | undefined;
33
- authorizationStatus?: "citizen" | "permanent_resident" | "noncitizen" | "alien" | undefined;
34
- documentType?: "uscis_alien_registration_number" | "form_i94" | "foreign_passport" | undefined;
35
- }, {
36
- expirationDate?: Date | undefined;
37
- documentNumber?: string | undefined;
38
- country?: string | undefined;
39
- authorizationStatus?: "citizen" | "permanent_resident" | "noncitizen" | "alien" | undefined;
40
- documentType?: "uscis_alien_registration_number" | "form_i94" | "foreign_passport" | undefined;
41
- }>;
17
+ }, z.core.$strip>;
42
18
  export type EmploymentEligibilityInputs = z.input<ReturnType<typeof generateEmploymentEligibilitySchema>>;
43
19
  export type EmploymentEligibilityPayload = z.infer<ReturnType<typeof generateEmploymentEligibilitySchema>>;
@@ -1,8 +1,8 @@
1
1
  import { z as o } from "zod";
2
2
  import { I9AuthorizationDocumentType as i, AuthorizationStatus as r } from "@gusto/embedded-api/models/components/i9authorization";
3
- const u = (t) => /^[Aa]?\d{7,9}$/.test(t), n = (t) => /^\d{9} ?[A-Za-z\d]\d$/.test(t), a = (t) => o.object({
4
- authorizationStatus: o.nativeEnum(r).optional(),
5
- documentType: o.nativeEnum(i).optional(),
3
+ const t = (u) => /^[Aa]?\d{7,9}$/.test(u), m = (u) => /^\d{9} ?[A-Za-z\d]\d$/.test(u), a = (u) => o.object({
4
+ authorizationStatus: o.enum(r).optional(),
5
+ documentType: o.enum(i).optional(),
6
6
  documentNumber: o.string().optional(),
7
7
  expirationDate: o.date().transform((e) => e.toISOString().split("T")[0]).optional(),
8
8
  country: o.string().optional()
@@ -15,11 +15,11 @@ const u = (t) => /^[Aa]?\d{7,9}$/.test(t), n = (t) => /^\d{9} ?[A-Za-z\d]\d$/.te
15
15
  });
16
16
  return;
17
17
  }
18
- e.authorizationStatus === "permanent_resident" && (e.documentNumber ? u(e.documentNumber) || s.addIssue({
18
+ e.authorizationStatus === "permanent_resident" && (e.documentNumber ? t(e.documentNumber) || s.addIssue({
19
19
  code: o.ZodIssueCode.custom,
20
20
  message: "Enter a 7-9 digit USCIS number or A-Number (e.g. A123456789)",
21
21
  path: ["documentNumber"]
22
- }) : t || s.addIssue({
22
+ }) : u || s.addIssue({
23
23
  code: o.ZodIssueCode.custom,
24
24
  message: "Document number is required",
25
25
  path: ["documentNumber"]
@@ -27,15 +27,15 @@ const u = (t) => /^[Aa]?\d{7,9}$/.test(t), n = (t) => /^\d{9} ?[A-Za-z\d]\d$/.te
27
27
  code: o.ZodIssueCode.custom,
28
28
  message: "Authorization document is required",
29
29
  path: ["documentType"]
30
- }), e.documentNumber ? e.documentType === "uscis_alien_registration_number" && !u(e.documentNumber) ? s.addIssue({
30
+ }), e.documentNumber ? e.documentType === "uscis_alien_registration_number" && !t(e.documentNumber) ? s.addIssue({
31
31
  code: o.ZodIssueCode.custom,
32
32
  message: "Enter a 7-9 digit USCIS number or A-Number (e.g. A123456789)",
33
33
  path: ["documentNumber"]
34
- }) : e.documentType === "form_i94" && !n(e.documentNumber) && s.addIssue({
34
+ }) : e.documentType === "form_i94" && !m(e.documentNumber) && s.addIssue({
35
35
  code: o.ZodIssueCode.custom,
36
36
  message: "Enter a valid 11-character Form I-94 admission number",
37
37
  path: ["documentNumber"]
38
- }) : t || s.addIssue({
38
+ }) : u || s.addIssue({
39
39
  code: o.ZodIssueCode.custom,
40
40
  message: "Document number is required",
41
41
  path: ["documentNumber"]
@@ -1 +1 @@
1
- {"version":3,"file":"EmploymentEligibilitySchema.js","sources":["../../../../../src/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n AuthorizationStatus,\n I9AuthorizationDocumentType,\n} from '@gusto/embedded-api/models/components/i9authorization'\n\nconst isValidUscisNumber = (value: string) => /^[Aa]?\\d{7,9}$/.test(value)\nconst isValidI94Number = (value: string) => /^\\d{9} ?[A-Za-z\\d]\\d$/.test(value)\n\nexport const generateEmploymentEligibilitySchema = (hasDocumentNumber?: boolean | null) =>\n z\n .object({\n authorizationStatus: z.nativeEnum(AuthorizationStatus).optional(),\n documentType: z.nativeEnum(I9AuthorizationDocumentType).optional(),\n documentNumber: z.string().optional(),\n expirationDate: z\n .date()\n .transform(date => date.toISOString().split('T')[0])\n .optional(),\n country: z.string().optional(),\n })\n .superRefine((data, ctx) => {\n if (!data.authorizationStatus) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Authorization status is required',\n path: ['authorizationStatus'],\n })\n return\n }\n if (data.authorizationStatus === 'permanent_resident') {\n if (!data.documentNumber) {\n if (!hasDocumentNumber) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Document number is required',\n path: ['documentNumber'],\n })\n }\n } else if (!isValidUscisNumber(data.documentNumber)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Enter a 7-9 digit USCIS number or A-Number (e.g. A123456789)',\n path: ['documentNumber'],\n })\n }\n }\n if (data.authorizationStatus === 'alien') {\n if (!data.documentType) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Authorization document is required',\n path: ['documentType'],\n })\n }\n if (!data.documentNumber) {\n if (!hasDocumentNumber) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Document number is required',\n path: ['documentNumber'],\n })\n }\n } else if (\n data.documentType === 'uscis_alien_registration_number' &&\n !isValidUscisNumber(data.documentNumber)\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Enter a 7-9 digit USCIS number or A-Number (e.g. A123456789)',\n path: ['documentNumber'],\n })\n } else if (data.documentType === 'form_i94' && !isValidI94Number(data.documentNumber)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Enter a valid 11-character Form I-94 admission number',\n path: ['documentNumber'],\n })\n }\n if (data.documentType === 'foreign_passport' && !data.country) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Country of issuance is required',\n path: ['country'],\n })\n }\n }\n })\n\nexport type EmploymentEligibilityInputs = z.input<\n ReturnType<typeof generateEmploymentEligibilitySchema>\n>\nexport type EmploymentEligibilityPayload = z.infer<\n ReturnType<typeof generateEmploymentEligibilitySchema>\n>\n"],"names":["isValidUscisNumber","value","isValidI94Number","generateEmploymentEligibilitySchema","hasDocumentNumber","z","AuthorizationStatus","I9AuthorizationDocumentType","date","data","ctx"],"mappings":";;AAMA,MAAMA,IAAqB,CAACC,MAAkB,iBAAiB,KAAKA,CAAK,GACnEC,IAAmB,CAACD,MAAkB,wBAAwB,KAAKA,CAAK,GAEjEE,IAAsC,CAACC,MAClDC,EACG,OAAO;AAAA,EACN,qBAAqBA,EAAE,WAAWC,CAAmB,EAAE,SAAA;AAAA,EACvD,cAAcD,EAAE,WAAWE,CAA2B,EAAE,SAAA;AAAA,EACxD,gBAAgBF,EAAE,OAAA,EAAS,SAAA;AAAA,EAC3B,gBAAgBA,EACb,KAAA,EACA,UAAU,CAAAG,MAAQA,EAAK,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,CAAC,EA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EAAK,WACpDC,EAAI,SAAS;AAAA,IACX,MAAML,EAAE,aAAa;AAAA,IACrB,SAAS;AAAA,IACT,MAAM,CAAC,SAAS;AAAA,EAAA,CACjB;AAGP,CAAC;"}
1
+ {"version":3,"file":"EmploymentEligibilitySchema.js","sources":["../../../../../src/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n AuthorizationStatus,\n I9AuthorizationDocumentType,\n} from '@gusto/embedded-api/models/components/i9authorization'\n\nconst isValidUscisNumber = (value: string) => /^[Aa]?\\d{7,9}$/.test(value)\nconst isValidI94Number = (value: string) => /^\\d{9} ?[A-Za-z\\d]\\d$/.test(value)\n\nexport const generateEmploymentEligibilitySchema = (hasDocumentNumber?: boolean | null) =>\n z\n .object({\n authorizationStatus: z.enum(AuthorizationStatus).optional(),\n documentType: z.enum(I9AuthorizationDocumentType).optional(),\n documentNumber: z.string().optional(),\n expirationDate: z\n .date()\n .transform(date => date.toISOString().split('T')[0])\n .optional(),\n country: z.string().optional(),\n })\n .superRefine((data, ctx) => {\n if (!data.authorizationStatus) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Authorization status is required',\n path: ['authorizationStatus'],\n })\n return\n }\n if (data.authorizationStatus === 'permanent_resident') {\n if (!data.documentNumber) {\n if (!hasDocumentNumber) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Document number is required',\n path: ['documentNumber'],\n })\n }\n } else if (!isValidUscisNumber(data.documentNumber)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Enter a 7-9 digit USCIS number or A-Number (e.g. A123456789)',\n path: ['documentNumber'],\n })\n }\n }\n if (data.authorizationStatus === 'alien') {\n if (!data.documentType) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Authorization document is required',\n path: ['documentType'],\n })\n }\n if (!data.documentNumber) {\n if (!hasDocumentNumber) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Document number is required',\n path: ['documentNumber'],\n })\n }\n } else if (\n data.documentType === 'uscis_alien_registration_number' &&\n !isValidUscisNumber(data.documentNumber)\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Enter a 7-9 digit USCIS number or A-Number (e.g. A123456789)',\n path: ['documentNumber'],\n })\n } else if (data.documentType === 'form_i94' && !isValidI94Number(data.documentNumber)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Enter a valid 11-character Form I-94 admission number',\n path: ['documentNumber'],\n })\n }\n if (data.documentType === 'foreign_passport' && !data.country) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Country of issuance is required',\n path: ['country'],\n })\n }\n }\n })\n\nexport type EmploymentEligibilityInputs = z.input<\n ReturnType<typeof generateEmploymentEligibilitySchema>\n>\nexport type EmploymentEligibilityPayload = z.infer<\n ReturnType<typeof generateEmploymentEligibilitySchema>\n>\n"],"names":["isValidUscisNumber","value","isValidI94Number","generateEmploymentEligibilitySchema","hasDocumentNumber","z","AuthorizationStatus","I9AuthorizationDocumentType","date","data","ctx"],"mappings":";;AAMA,MAAMA,IAAqB,CAACC,MAAkB,iBAAiB,KAAKA,CAAK,GACnEC,IAAmB,CAACD,MAAkB,wBAAwB,KAAKA,CAAK,GAEjEE,IAAsC,CAACC,MAClDC,EACG,OAAO;AAAA,EACN,qBAAqBA,EAAE,KAAKC,CAAmB,EAAE,SAAA;AAAA,EACjD,cAAcD,EAAE,KAAKE,CAA2B,EAAE,SAAA;AAAA,EAClD,gBAAgBF,EAAE,OAAA,EAAS,SAAA;AAAA,EAC3B,gBAAgBA,EACb,KAAA,EACA,UAAU,CAAAG,MAAQA,EAAK,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,CAAC,EAClD,SAAA;AAAA,EACH,SAASH,EAAE,OAAA,EAAS,SAAA;AACtB,CAAC,EACA,YAAY,CAACI,GAAMC,MAAQ;AAC1B,MAAI,CAACD,EAAK,qBAA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,CAAC;"}
@@ -9,33 +9,16 @@ declare const preparerSchema: z.ZodObject<{
9
9
  state: z.ZodString;
10
10
  zip: z.ZodString;
11
11
  signature: z.ZodString;
12
- agree: z.ZodEffects<z.ZodBoolean, boolean, boolean>;
13
- }, "strip", z.ZodTypeAny, {
14
- firstName: string;
15
- lastName: string;
16
- street1: string;
17
- city: string;
18
- state: string;
19
- zip: string;
20
- signature: string;
21
- agree: boolean;
22
- street2?: string | undefined;
23
- }, {
24
- firstName: string;
25
- lastName: string;
26
- street1: string;
27
- city: string;
28
- state: string;
29
- zip: string;
30
- signature: string;
31
- agree: boolean;
32
- street2?: string | undefined;
33
- }>;
12
+ agree: z.ZodBoolean;
13
+ }, z.core.$strip>;
34
14
  export type PreparerInputs = z.infer<typeof preparerSchema>;
35
15
  declare const i9SignatureFormSchema: z.ZodObject<{
36
16
  signature: z.ZodString;
37
17
  agree: z.ZodLiteral<true>;
38
- usedPreparer: z.ZodEnum<["yes", "no"]>;
18
+ usedPreparer: z.ZodEnum<{
19
+ yes: "yes";
20
+ no: "no";
21
+ }>;
39
22
  preparers: z.ZodArray<z.ZodObject<{
40
23
  firstName: z.ZodString;
41
24
  lastName: z.ZodString;
@@ -45,59 +28,9 @@ declare const i9SignatureFormSchema: z.ZodObject<{
45
28
  state: z.ZodString;
46
29
  zip: z.ZodString;
47
30
  signature: z.ZodString;
48
- agree: z.ZodEffects<z.ZodBoolean, boolean, boolean>;
49
- }, "strip", z.ZodTypeAny, {
50
- firstName: string;
51
- lastName: string;
52
- street1: string;
53
- city: string;
54
- state: string;
55
- zip: string;
56
- signature: string;
57
- agree: boolean;
58
- street2?: string | undefined;
59
- }, {
60
- firstName: string;
61
- lastName: string;
62
- street1: string;
63
- city: string;
64
- state: string;
65
- zip: string;
66
- signature: string;
67
- agree: boolean;
68
- street2?: string | undefined;
69
- }>, "many">;
70
- }, "strip", z.ZodTypeAny, {
71
- signature: string;
72
- agree: true;
73
- usedPreparer: "yes" | "no";
74
- preparers: {
75
- firstName: string;
76
- lastName: string;
77
- street1: string;
78
- city: string;
79
- state: string;
80
- zip: string;
81
- signature: string;
82
- agree: boolean;
83
- street2?: string | undefined;
84
- }[];
85
- }, {
86
- signature: string;
87
- agree: true;
88
- usedPreparer: "yes" | "no";
89
- preparers: {
90
- firstName: string;
91
- lastName: string;
92
- street1: string;
93
- city: string;
94
- state: string;
95
- zip: string;
96
- signature: string;
97
- agree: boolean;
98
- street2?: string | undefined;
99
- }[];
100
- }>;
31
+ agree: z.ZodBoolean;
32
+ }, z.core.$strip>>;
33
+ }, z.core.$strip>;
101
34
  export type I9SignatureFormInputs = z.infer<typeof i9SignatureFormSchema>;
102
35
  interface I9SignatureFormProps extends CommonComponentInterface {
103
36
  employeeId: string;
@@ -1,11 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  declare const EmployeeDocumentsSchema: z.ZodObject<{
3
3
  includeI9: z.ZodBoolean;
4
- }, "strip", z.ZodTypeAny, {
5
- includeI9: boolean;
6
- }, {
7
- includeI9: boolean;
8
- }>;
4
+ }, z.core.$strip>;
9
5
  export type EmployeeDocumentsFormValues = z.infer<typeof EmployeeDocumentsSchema>;
10
6
  export interface EmployeeDocumentsPresentationProps {
11
7
  isEmployeeSelfOnboarding: boolean;
@@ -1,44 +1,18 @@
1
1
  import { z } from 'zod';
2
- export declare const FederalFormSchema: z.ZodDiscriminatedUnion<"w4DataType", [z.ZodObject<{
2
+ export declare const FederalFormSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
3
  w4DataType: z.ZodLiteral<"rev_2020_w4">;
4
4
  filingStatus: z.ZodString;
5
5
  twoJobs: z.ZodString;
6
- dependentsAmount: z.ZodEffects<z.ZodNumber, string, number>;
7
- otherIncome: z.ZodEffects<z.ZodNumber, string, number>;
8
- deductions: z.ZodEffects<z.ZodNumber, string, number>;
9
- extraWithholding: z.ZodEffects<z.ZodNumber, string, number>;
10
- }, "strip", z.ZodTypeAny, {
11
- deductions: string;
12
- extraWithholding: string;
13
- filingStatus: string;
14
- otherIncome: string;
15
- w4DataType: "rev_2020_w4";
16
- twoJobs: string;
17
- dependentsAmount: string;
18
- }, {
19
- deductions: number;
20
- extraWithholding: number;
21
- filingStatus: string;
22
- otherIncome: number;
23
- w4DataType: "rev_2020_w4";
24
- twoJobs: string;
25
- dependentsAmount: number;
26
- }>, z.ZodObject<{
6
+ dependentsAmount: z.ZodPipe<z.ZodNumber, z.ZodTransform<string, number>>;
7
+ otherIncome: z.ZodPipe<z.ZodNumber, z.ZodTransform<string, number>>;
8
+ deductions: z.ZodPipe<z.ZodNumber, z.ZodTransform<string, number>>;
9
+ extraWithholding: z.ZodPipe<z.ZodNumber, z.ZodTransform<string, number>>;
10
+ }, z.core.$strip>, z.ZodObject<{
27
11
  w4DataType: z.ZodLiteral<"pre_2020_w4">;
28
12
  filingStatus: z.ZodString;
29
13
  federalWithholdingAllowance: z.ZodNumber;
30
14
  additionalWithholding: z.ZodString;
31
- }, "strip", z.ZodTypeAny, {
32
- additionalWithholding: string;
33
- federalWithholdingAllowance: number;
34
- filingStatus: string;
35
- w4DataType: "pre_2020_w4";
36
- }, {
37
- additionalWithholding: string;
38
- federalWithholdingAllowance: number;
39
- filingStatus: string;
40
- w4DataType: "pre_2020_w4";
41
- }>]>;
15
+ }, z.core.$strip>], "w4DataType">;
42
16
  export type FederalFormInputs = z.input<typeof FederalFormSchema>;
43
17
  export type FederalFormPayload = z.output<typeof FederalFormSchema>;
44
18
  export declare function FederalForm(): import("react/jsx-runtime").JSX.Element;
@@ -3,20 +3,11 @@ export declare const BankAccountSchema: z.ZodObject<{
3
3
  name: z.ZodString;
4
4
  routingNumber: z.ZodString;
5
5
  accountNumber: z.ZodString;
6
- accountType: z.ZodEnum<["Checking", "Savings"]>;
6
+ accountType: z.ZodEnum<{
7
+ Checking: "Checking";
8
+ Savings: "Savings";
9
+ }>;
7
10
  hasBankPayload: z.ZodLiteral<true>;
8
- }, "strip", z.ZodTypeAny, {
9
- routingNumber: string;
10
- accountNumber: string;
11
- name: string;
12
- accountType: "Checking" | "Savings";
13
- hasBankPayload: true;
14
- }, {
15
- routingNumber: string;
16
- accountNumber: string;
17
- name: string;
18
- accountType: "Checking" | "Savings";
19
- hasBankPayload: true;
20
- }>;
11
+ }, z.core.$strip>;
21
12
  export type BankAccountInputs = z.input<typeof BankAccountSchema>;
22
13
  export type BankAccountDefaults = z.input<typeof BankAccountSchema>;
@@ -1,11 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  export declare const PaymentTypeSchema: z.ZodObject<{
3
- type: z.ZodEnum<["Check", "Direct Deposit"]>;
4
- }, "strip", z.ZodTypeAny, {
5
- type: "Check" | "Direct Deposit";
6
- }, {
7
- type: "Check" | "Direct Deposit";
8
- }>;
3
+ type: z.ZodEnum<{
4
+ Check: "Check";
5
+ "Direct Deposit": "Direct Deposit";
6
+ }>;
7
+ }, z.core.$strip>;
9
8
  export type PaymentTypeInputs = z.input<typeof PaymentTypeSchema>;
10
9
  export type PaymentTypePayload = z.output<typeof PaymentTypeSchema>;
11
10
  export declare function PaymentTypeForm(): import("react/jsx-runtime").JSX.Element | undefined;