@gusto/embedded-react-sdk 0.38.0-rc.2 → 0.39.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 (76) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  3. package/dist/components/Common/UI/DatePicker/DatePicker.module.scss.js +6 -6
  4. package/dist/components/Common/UI/DateRangePicker/DateRangePicker.module.scss.js +11 -11
  5. package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
  6. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  7. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +11 -11
  8. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
  9. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  10. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
  11. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  12. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
  13. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  14. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
  15. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  16. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  17. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  18. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
  19. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  20. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
  21. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  22. package/dist/components/Company/Industry/Context.js +6 -7
  23. package/dist/components/Company/Industry/Context.js.map +1 -1
  24. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
  25. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  26. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
  27. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  28. package/dist/components/Company/OnboardingOverview/context.js +3 -4
  29. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  30. package/dist/components/Company/PaySchedule/_parts/Edit.js +6 -6
  31. package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
  32. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  33. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
  34. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  35. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
  36. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  37. package/dist/components/Contractor/Address/useAddress.js +5 -6
  38. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  39. package/dist/components/Contractor/Profile/ContractorProfileForm.js +6 -6
  40. package/dist/components/Contractor/Profile/useContractorProfile.js +2 -3
  41. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  42. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +2 -3
  43. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  44. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +2 -3
  45. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  46. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +2 -3
  47. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  48. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  49. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  50. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +16 -16
  51. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
  52. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  53. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -4
  54. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  55. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
  56. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  57. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +1 -1
  58. package/dist/components/Employee/Profile/useProfile.js +3 -4
  59. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  60. package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -4
  61. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  62. package/dist/components/Employee/Taxes/useTaxes.js +3 -4
  63. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  64. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +10 -10
  65. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +14 -14
  66. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
  67. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.module.scss.js +14 -14
  68. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +10 -10
  69. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +2 -3
  70. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  71. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +1 -1
  72. package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js +10 -10
  73. package/dist/components/Payroll/usePreparedPayrollData.js +2 -3
  74. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  75. package/dist/style.css +1 -1
  76. package/package.json +5 -5
@@ -6,13 +6,13 @@ import { usePaySchedule as x } from "../usePaySchedule.js";
6
6
  import n from "./Edit.module.scss.js";
7
7
  import { Flex as y } from "../../../Common/Flex/Flex.js";
8
8
  import { Grid as E } from "../../../Common/Grid/Grid.js";
9
+ import { DatePickerField as h } from "../../../Common/Fields/DatePickerField/DatePickerField.js";
9
10
  import { useComponentContext as N } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
10
11
  import { useDateFormatter as F } from "../../../../hooks/useDateFormatter.js";
11
12
  import { TextInputField as R } from "../../../Common/Fields/TextInputField/TextInputField.js";
12
13
  import { SelectField as O } from "../../../Common/Fields/SelectField/SelectField.js";
13
14
  import { RadioGroupField as M } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
14
- import { NumberInputField as h } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
15
- import { DatePickerField as f } from "../../../Common/Fields/DatePickerField/DatePickerField.js";
15
+ import { NumberInputField as f } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
16
16
  const K = () => {
17
17
  const o = N(), { t: e } = q("Company.PaySchedule"), P = F(), { payPeriodPreview: r, mode: u, payPreviewLoading: D, paymentSpeedDays: v } = x(), { setValue: d } = S(), [a, b] = C(0), i = p({ name: "frequency" }), l = p({ name: "customTwicePerMonth" }), w = i === "Twice per month" && l === "custom" || i === "Monthly", g = i === "Twice per month" && l === "custom";
18
18
  return T(() => {
@@ -47,7 +47,7 @@ const K = () => {
47
47
  }
48
48
  ),
49
49
  /* @__PURE__ */ t(
50
- f,
50
+ h,
51
51
  {
52
52
  name: "anchorPayDate",
53
53
  label: e("labels.firstPayDate"),
@@ -59,7 +59,7 @@ const K = () => {
59
59
  }
60
60
  ),
61
61
  /* @__PURE__ */ t(
62
- f,
62
+ h,
63
63
  {
64
64
  name: "anchorEndOfPayPeriod",
65
65
  label: e("labels.firstPayPeriodEndDate"),
@@ -67,8 +67,8 @@ const K = () => {
67
67
  isRequired: !0
68
68
  }
69
69
  ),
70
- /* @__PURE__ */ t("div", { className: w ? "" : n.visuallyHidden, children: /* @__PURE__ */ t(h, { name: "day1", label: e("labels.firstPayDayOfTheMonth"), isRequired: !0 }) }),
71
- /* @__PURE__ */ t("div", { className: g ? "" : n.visuallyHidden, children: /* @__PURE__ */ t(h, { name: "day2", label: e("labels.lastPayDayOfTheMonth"), isRequired: !0 }) })
70
+ /* @__PURE__ */ t("div", { className: w ? "" : n.visuallyHidden, children: /* @__PURE__ */ t(f, { name: "day1", label: e("labels.firstPayDayOfTheMonth"), isRequired: !0 }) }),
71
+ /* @__PURE__ */ t("div", { className: g ? "" : n.visuallyHidden, children: /* @__PURE__ */ t(f, { name: "day2", label: e("labels.lastPayDayOfTheMonth"), isRequired: !0 }) })
72
72
  ] }) }),
73
73
  /* @__PURE__ */ t(y, { flexDirection: "column", gap: 4, justifyContent: "center", alignItems: "center", children: r && r[a] ? /* @__PURE__ */ m("div", { className: n.calendarContainer, children: [
74
74
  !D && /* @__PURE__ */ t(
@@ -12,9 +12,8 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
12
12
  import "@gusto/embedded-api/models/errors/httpclienterrors";
13
13
  import "../../../shared/constants.js";
14
14
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
15
- import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
16
15
  import { createCompoundContext as t } from "../../Base/createCompoundContext.js";
17
- const S = o.object({
16
+ const x = o.object({
18
17
  frequency: o.enum(["Every week", "Every other week", "Twice per month", "Monthly"]),
19
18
  anchorPayDate: o.date().optional(),
20
19
  anchorEndOfPayPeriod: o.date().optional(),
@@ -22,10 +21,10 @@ const S = o.object({
22
21
  day2: o.number().min(1).max(31).optional(),
23
22
  customName: o.string().optional(),
24
23
  customTwicePerMonth: o.string().optional()
25
- }), [f, w] = t("PayScheduleContext");
24
+ }), [S, f] = t("PayScheduleContext");
26
25
  export {
27
- w as PayScheduleProvider,
28
- S as PayScheduleSchema,
29
- f as usePaySchedule
26
+ f as PayScheduleProvider,
27
+ x as PayScheduleSchema,
28
+ S as usePaySchedule
30
29
  };
31
30
  //# sourceMappingURL=usePaySchedule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/usePaySchedule.ts"],"sourcesContent":["import type { PayScheduleCreateUpdate } from '@gusto/embedded-api/models/components/payschedulecreateupdate'\nimport type {\n PaySchedule,\n PaySchedule as PayScheduleType,\n} from '@gusto/embedded-api/models/components/payschedule'\nimport type { PaySchedulePreviewPayPeriod } from '@gusto/embedded-api/models/components/payschedulepreviewpayperiod'\nimport { z } from 'zod'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport { createCompoundContext } from '@/components/Base'\n\nexport type MODE =\n | 'LIST_PAY_SCHEDULES'\n | 'ADD_PAY_SCHEDULE'\n | 'EDIT_PAY_SCHEDULE'\n | 'PREVIEW_PAY_SCHEDULE'\n\ntype PayScheduleContextType = {\n companyId: string\n handleAdd: () => void\n handleEdit: (schedule: PayScheduleType) => void\n handleCancel: () => void\n handleContinue: () => void\n mode: MODE\n isPending: boolean\n paySchedules: PaySchedule[] | undefined | null\n currentPaySchedule: PayScheduleType | undefined | null\n payPeriodPreview?: PaySchedulePreviewPayPeriod[]\n payPreviewLoading?: boolean\n paymentSpeedDays: number\n}\n\nexport const PayScheduleSchema = z.object({\n frequency: z.enum(['Every week', 'Every other week', 'Twice per month', 'Monthly']),\n anchorPayDate: z.date().optional(),\n anchorEndOfPayPeriod: z.date().optional(),\n day1: z.number().min(1).max(31).optional(),\n day2: z.number().min(1).max(31).optional(),\n customName: z.string().optional(),\n customTwicePerMonth: z.string().optional(),\n})\n\nexport type PayScheduleInputs = z.input<typeof PayScheduleSchema>\nexport type PayScheduleOutputs = z.output<typeof PayScheduleSchema>\n\nexport type PayScheduleDefaultValues = RequireAtLeastOne<\n Partial<\n Pick<\n PayScheduleCreateUpdate,\n 'anchorPayDate' | 'anchorEndOfPayPeriod' | 'day1' | 'day2' | 'customName' | 'frequency'\n >\n >\n>\n\nconst [usePaySchedule, PayScheduleProvider] =\n createCompoundContext<PayScheduleContextType>('PayScheduleContext')\nexport { usePaySchedule, PayScheduleProvider }\n"],"names":["PayScheduleSchema","z","usePaySchedule","PayScheduleProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AA+BO,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACxC,WAAWA,EAAE,KAAK,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,CAAC;AAAA,EAClF,eAAeA,EAAE,KAAA,EAAO,SAAA;AAAA,EACxB,sBAAsBA,EAAE,KAAA,EAAO,SAAA;AAAA,EAC/B,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAA;AAAA,EAChC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAA;AAAA,EAChC,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,qBAAqBA,EAAE,OAAA,EAAS,SAAA;AAClC,CAAC,GAcK,CAACC,GAAgBC,CAAmB,IACxCC,EAA8C,oBAAoB;"}
1
+ {"version":3,"file":"usePaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/usePaySchedule.ts"],"sourcesContent":["import type { PayScheduleCreateUpdate } from '@gusto/embedded-api/models/components/payschedulecreateupdate'\nimport type {\n PaySchedule,\n PaySchedule as PayScheduleType,\n} from '@gusto/embedded-api/models/components/payschedule'\nimport type { PaySchedulePreviewPayPeriod } from '@gusto/embedded-api/models/components/payschedulepreviewpayperiod'\nimport { z } from 'zod'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport { createCompoundContext } from '@/components/Base'\n\nexport type MODE =\n | 'LIST_PAY_SCHEDULES'\n | 'ADD_PAY_SCHEDULE'\n | 'EDIT_PAY_SCHEDULE'\n | 'PREVIEW_PAY_SCHEDULE'\n\ntype PayScheduleContextType = {\n companyId: string\n handleAdd: () => void\n handleEdit: (schedule: PayScheduleType) => void\n handleCancel: () => void\n handleContinue: () => void\n mode: MODE\n isPending: boolean\n paySchedules: PaySchedule[] | undefined | null\n currentPaySchedule: PayScheduleType | undefined | null\n payPeriodPreview?: PaySchedulePreviewPayPeriod[]\n payPreviewLoading?: boolean\n paymentSpeedDays: number\n}\n\nexport const PayScheduleSchema = z.object({\n frequency: z.enum(['Every week', 'Every other week', 'Twice per month', 'Monthly']),\n anchorPayDate: z.date().optional(),\n anchorEndOfPayPeriod: z.date().optional(),\n day1: z.number().min(1).max(31).optional(),\n day2: z.number().min(1).max(31).optional(),\n customName: z.string().optional(),\n customTwicePerMonth: z.string().optional(),\n})\n\nexport type PayScheduleInputs = z.input<typeof PayScheduleSchema>\nexport type PayScheduleOutputs = z.output<typeof PayScheduleSchema>\n\nexport type PayScheduleDefaultValues = RequireAtLeastOne<\n Partial<\n Pick<\n PayScheduleCreateUpdate,\n 'anchorPayDate' | 'anchorEndOfPayPeriod' | 'day1' | 'day2' | 'customName' | 'frequency'\n >\n >\n>\n\nconst [usePaySchedule, PayScheduleProvider] =\n createCompoundContext<PayScheduleContextType>('PayScheduleContext')\nexport { usePaySchedule, PayScheduleProvider }\n"],"names":["PayScheduleSchema","z","usePaySchedule","PayScheduleProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;AA+BO,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACxC,WAAWA,EAAE,KAAK,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,CAAC;AAAA,EAClF,eAAeA,EAAE,KAAA,EAAO,SAAA;AAAA,EACxB,sBAAsBA,EAAE,KAAA,EAAO,SAAA;AAAA,EAC/B,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAA;AAAA,EAChC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAA;AAAA,EAChC,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,qBAAqBA,EAAE,OAAA,EAAS,SAAA;AAClC,CAAC,GAcK,CAACC,GAAgBC,CAAmB,IACxCC,EAA8C,oBAAoB;"}
@@ -11,11 +11,10 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
11
11
  import "@gusto/embedded-api/models/errors/httpclienterrors";
12
12
  import "../../../../shared/constants.js";
13
13
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
14
- import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
15
14
  import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
16
- const [d, u] = t("StateTaxesFormContext");
15
+ const [c, d] = t("StateTaxesFormContext");
17
16
  export {
18
- u as StateTaxesFormProvider,
19
- d as useStateTaxesForm
17
+ d as StateTaxesFormProvider,
18
+ c as useStateTaxesForm
20
19
  };
21
20
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/context.ts"],"sourcesContent":["import type { TaxRequirementsState } from '@gusto/embedded-api/models/components/taxrequirementsstate'\nimport { createCompoundContext } from '@/components/Base'\n\ninterface StateTaxFormContext {\n isPending: boolean\n state: string\n stateTaxRequirements: TaxRequirementsState\n handleCancel: () => void\n}\n\nconst [useStateTaxesForm, StateTaxesFormProvider] =\n createCompoundContext<StateTaxFormContext>('StateTaxesFormContext')\n\nexport { useStateTaxesForm, StateTaxesFormProvider }\n"],"names":["useStateTaxesForm","StateTaxesFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAA2C,uBAAuB;"}
1
+ {"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/context.ts"],"sourcesContent":["import type { TaxRequirementsState } from '@gusto/embedded-api/models/components/taxrequirementsstate'\nimport { createCompoundContext } from '@/components/Base'\n\ninterface StateTaxFormContext {\n isPending: boolean\n state: string\n stateTaxRequirements: TaxRequirementsState\n handleCancel: () => void\n}\n\nconst [useStateTaxesForm, StateTaxesFormProvider] =\n createCompoundContext<StateTaxFormContext>('StateTaxesFormContext')\n\nexport { useStateTaxesForm, StateTaxesFormProvider }\n"],"names":["useStateTaxesForm","StateTaxesFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAA2C,uBAAuB;"}
@@ -11,11 +11,10 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
11
11
  import "@gusto/embedded-api/models/errors/httpclienterrors";
12
12
  import "../../../../shared/constants.js";
13
13
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
14
- import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
15
14
  import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
16
- const [d, u] = t("StateTaxesListContext");
15
+ const [c, d] = t("StateTaxesListContext");
17
16
  export {
18
- u as StateTaxesListProvider,
19
- d as useStateTaxesList
17
+ d as StateTaxesListProvider,
18
+ c as useStateTaxesList
20
19
  };
21
20
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/context.ts"],"sourcesContent":["import type { TaxRequirementStatesList } from '@gusto/embedded-api/models/components/taxrequirementstateslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype StateTaxesListContextType = {\n isPending: boolean\n stateTaxRequirements: TaxRequirementStatesList[]\n handleContinue: () => void\n handleChange: (state: string) => void\n}\n\nconst [useStateTaxesList, StateTaxesListProvider] =\n createCompoundContext<StateTaxesListContextType>('StateTaxesListContext')\n\nexport { useStateTaxesList, StateTaxesListProvider }\n"],"names":["useStateTaxesList","StateTaxesListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAAiD,uBAAuB;"}
1
+ {"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/context.ts"],"sourcesContent":["import type { TaxRequirementStatesList } from '@gusto/embedded-api/models/components/taxrequirementstateslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype StateTaxesListContextType = {\n isPending: boolean\n stateTaxRequirements: TaxRequirementStatesList[]\n handleContinue: () => void\n handleChange: (state: string) => void\n}\n\nconst [useStateTaxesList, StateTaxesListProvider] =\n createCompoundContext<StateTaxesListContextType>('StateTaxesListContext')\n\nexport { useStateTaxesList, StateTaxesListProvider }\n"],"names":["useStateTaxesList","StateTaxesListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAAiD,uBAAuB;"}
@@ -12,20 +12,19 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
12
12
  import "@gusto/embedded-api/models/errors/httpclienterrors";
13
13
  import "../../../shared/constants.js";
14
14
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
15
- import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
16
15
  import { createCompoundContext as r } from "../../Base/createCompoundContext.js";
17
- const z = t.object({
16
+ const u = t.object({
18
17
  street1: t.string().min(1),
19
18
  street2: t.string().optional(),
20
19
  city: t.string().min(1),
21
20
  state: t.string().min(1),
22
21
  zip: t.string().min(1)
23
- }), [b, h] = r(
22
+ }), [z, b] = r(
24
23
  "ContractorAddressContext"
25
24
  );
26
25
  export {
27
- z as AddressFormSchema,
28
- h as AddressProvider,
29
- b as useAddress
26
+ u as AddressFormSchema,
27
+ b as AddressProvider,
28
+ z as useAddress
30
29
  };
31
30
  //# sourceMappingURL=useAddress.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAddress.js","sources":["../../../../src/components/Contractor/Address/useAddress.ts"],"sourcesContent":["import type { Contractor, ContractorType } from '@gusto/embedded-api/models/components/contractor'\nimport type { ContractorAddress } from '@gusto/embedded-api/models/components/contractoraddress'\nimport { z } from 'zod'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\nexport interface AddressContextType {\n contractor?: Contractor\n contractorType?: ContractorType\n address?: ContractorAddress\n isPending: boolean\n}\n\nexport type AddressDefaultValues = RequireAtLeastOne<\n Pick<ContractorAddress, 'street1' | 'street2' | 'city' | 'state' | 'zip'>\n>\n\nexport const AddressFormSchema = z.object({\n street1: z.string().min(1),\n street2: z.string().optional(),\n city: z.string().min(1),\n state: z.string().min(1),\n zip: z.string().min(1),\n})\n\nexport type AddressFormValues = z.infer<typeof AddressFormSchema>\n\nconst [useAddress, AddressProvider] = createCompoundContext<AddressContextType>(\n 'ContractorAddressContext',\n)\n\nexport { useAddress, AddressProvider }\n"],"names":["AddressFormSchema","z","useAddress","AddressProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAiBO,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACxC,SAASA,EAAE,SAAS,IAAI,CAAC;AAAA,EACzB,SAASA,EAAE,OAAA,EAAS,SAAA;AAAA,EACpB,MAAMA,EAAE,SAAS,IAAI,CAAC;AAAA,EACtB,OAAOA,EAAE,SAAS,IAAI,CAAC;AAAA,EACvB,KAAKA,EAAE,OAAA,EAAS,IAAI,CAAC;AACvB,CAAC,GAIK,CAACC,GAAYC,CAAe,IAAIC;AAAA,EACpC;AACF;"}
1
+ {"version":3,"file":"useAddress.js","sources":["../../../../src/components/Contractor/Address/useAddress.ts"],"sourcesContent":["import type { Contractor, ContractorType } from '@gusto/embedded-api/models/components/contractor'\nimport type { ContractorAddress } from '@gusto/embedded-api/models/components/contractoraddress'\nimport { z } from 'zod'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\nexport interface AddressContextType {\n contractor?: Contractor\n contractorType?: ContractorType\n address?: ContractorAddress\n isPending: boolean\n}\n\nexport type AddressDefaultValues = RequireAtLeastOne<\n Pick<ContractorAddress, 'street1' | 'street2' | 'city' | 'state' | 'zip'>\n>\n\nexport const AddressFormSchema = z.object({\n street1: z.string().min(1),\n street2: z.string().optional(),\n city: z.string().min(1),\n state: z.string().min(1),\n zip: z.string().min(1),\n})\n\nexport type AddressFormValues = z.infer<typeof AddressFormSchema>\n\nconst [useAddress, AddressProvider] = createCompoundContext<AddressContextType>(\n 'ContractorAddressContext',\n)\n\nexport { useAddress, AddressProvider }\n"],"names":["AddressFormSchema","z","useAddress","AddressProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;AAiBO,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACxC,SAASA,EAAE,SAAS,IAAI,CAAC;AAAA,EACzB,SAASA,EAAE,OAAA,EAAS,SAAA;AAAA,EACpB,MAAMA,EAAE,SAAS,IAAI,CAAC;AAAA,EACtB,OAAOA,EAAE,SAAS,IAAI,CAAC;AAAA,EACvB,KAAKA,EAAE,OAAA,EAAS,IAAI,CAAC;AACvB,CAAC,GAIK,CAACC,GAAYC,CAAe,IAAIC;AAAA,EACpC;AACF;"}
@@ -6,15 +6,15 @@ import { useComponentContext as D } from "../../../contexts/ComponentAdapter/use
6
6
  import { useI18n as I } from "../../../i18n/I18n.js";
7
7
  import { Form as O } from "../../Common/Form/Form.js";
8
8
  import { Grid as n } from "../../Common/Grid/Grid.js";
9
- import { Flex as x } from "../../Common/Flex/Flex.js";
9
+ import { DatePickerField as x } from "../../Common/Fields/DatePickerField/DatePickerField.js";
10
10
  import { usePlaceholderSSN as w, normalizeSSN as E } from "../../../helpers/ssn.js";
11
11
  import { usePlaceholderEin as j, normalizeEin as v } from "../../../helpers/federalEin.js";
12
12
  import { ContractorOnboardingStatus as G } from "../../../shared/constants.js";
13
13
  import { TextInputField as l } from "../../Common/Fields/TextInputField/TextInputField.js";
14
14
  import { RadioGroupField as d } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
15
15
  import { NumberInputField as z } from "../../Common/Fields/NumberInputField/NumberInputField.js";
16
- import { SwitchField as A } from "../../Common/Fields/SwitchField/SwitchField.js";
17
- import { DatePickerField as B } from "../../Common/Fields/DatePickerField/DatePickerField.js";
16
+ import { Flex as A } from "../../Common/Flex/Flex.js";
17
+ import { SwitchField as B } from "../../Common/Fields/SwitchField/SwitchField.js";
18
18
  function re({
19
19
  formMethods: u,
20
20
  handleSubmit: f,
@@ -42,7 +42,7 @@ function re({
42
42
  ] }),
43
43
  /* @__PURE__ */ i("div", { className: C.switchFieldContainer, children: /* @__PURE__ */ r(n, { gap: 16, children: [
44
44
  /* @__PURE__ */ i(
45
- A,
45
+ B,
46
46
  {
47
47
  name: "selfOnboarding",
48
48
  label: e("fields.selfOnboarding.label"),
@@ -126,7 +126,7 @@ function re({
126
126
  }
127
127
  ),
128
128
  /* @__PURE__ */ i(
129
- B,
129
+ x,
130
130
  {
131
131
  name: "startDate",
132
132
  label: e("fields.startDate.label"),
@@ -135,7 +135,7 @@ function re({
135
135
  }
136
136
  )
137
137
  ] }),
138
- /* @__PURE__ */ i(x, { gap: 12, justifyContent: "flex-end", children: /* @__PURE__ */ i(a.Button, { type: "submit", variant: "primary", isDisabled: o.isSubmitting, children: o.isSubmitting ? e(s ? "buttons.updating" : "buttons.creating") : e(s ? "buttons.update" : "buttons.create") }) })
138
+ /* @__PURE__ */ i(A, { gap: 12, justifyContent: "flex-end", children: /* @__PURE__ */ i(a.Button, { type: "submit", variant: "primary", isDisabled: o.isSubmitting, children: o.isSubmitting ? e(s ? "buttons.updating" : "buttons.creating") : e(s ? "buttons.update" : "buttons.create") }) })
139
139
  ] }) }) });
140
140
  }
141
141
  export {
@@ -17,7 +17,6 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
17
17
  import { SDKInternalError as Y } from "../../../types/sdkError.js";
18
18
  import { ContractorSelfOnboardingStatuses as x, componentEvents as b, ContractorOnboardingStatus as ee } from "../../../shared/constants.js";
19
19
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
20
- import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
21
20
  import { useI18n as oe } from "../../../i18n/I18n.js";
22
21
  import { SSN_REGEX as se, NAME_REGEX as T } from "../../../helpers/validations.js";
23
22
  import { removeNonDigits as ae } from "../../../helpers/formattedStrings.js";
@@ -96,7 +95,7 @@ const i = L, a = J, ie = s.object({
96
95
  });
97
96
  }
98
97
  );
99
- function Ae({
98
+ function Be({
100
99
  companyId: t,
101
100
  contractorId: f,
102
101
  defaultValues: m,
@@ -231,6 +230,6 @@ export {
231
230
  a as ContractorType,
232
231
  i as WageType,
233
232
  re as createContractorProfileValidationSchema,
234
- Ae as useContractorProfile
233
+ Be as useContractorProfile
235
234
  };
236
235
  //# sourceMappingURL=useContractorProfile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useContractorProfile.js","sources":["../../../../src/components/Contractor/Profile/useContractorProfile.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { useForm, useWatch } from 'react-hook-form'\nimport { z } from 'zod'\nimport { useContractorsCreateMutation } from '@gusto/embedded-api/react-query/contractorsCreate'\nimport { useContractorsUpdateMutation } from '@gusto/embedded-api/react-query/contractorsUpdate'\nimport type { ContractorCreateRequestBody } from '@gusto/embedded-api/models/components/contractorcreaterequestbody'\nimport type { ContractorUpdateRequestBody } from '@gusto/embedded-api/models/components/contractorupdaterequestbody'\nimport {\n ContractorWageType as ApiWageType,\n ContractorType as ApiContractorType,\n type Contractor,\n} from '@gusto/embedded-api/models/components/contractor'\nimport { useBase } from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport {\n componentEvents,\n ContractorOnboardingStatus,\n ContractorSelfOnboardingStatuses,\n} from '@/shared/constants'\nimport { SSN_REGEX, NAME_REGEX } from '@/helpers/validations'\nimport { removeNonDigits } from '@/helpers/formattedStrings'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { normalizeEin } from '@/helpers/federalEin'\nimport { SDKInternalError } from '@/types/sdkError'\n\n// Re-export the API types for convenience\nexport const WageType = ApiWageType\nexport const ContractorType = ApiContractorType\n\n// Form schema definition - exported for use in stories and tests\nconst ContractorProfileSchema = z.object({\n // Self-onboarding toggle\n selfOnboarding: z.boolean(),\n email: z.string().email().optional(),\n\n // Required contractor fields\n contractorType: z.enum([ContractorType.Individual, ContractorType.Business]),\n wageType: z.enum([WageType.Hourly, WageType.Fixed]),\n startDate: z.date(),\n\n // Individual contractor fields\n firstName: z.string().min(1).regex(NAME_REGEX).optional(),\n middleInitial: z.string().optional(),\n lastName: z.string().min(1).regex(NAME_REGEX).optional(),\n ssn: z.string().optional(),\n\n // Business contractor fields\n businessName: z.string().optional(),\n ein: z.string().optional(),\n\n // Wage fields\n hourlyRate: z.number().min(0).optional(),\n})\n\nexport type ContractorProfileFormData = z.infer<typeof ContractorProfileSchema>\n\n// Create validation schema - exported for stories\nexport const createContractorProfileValidationSchema = (\n t: (key: string) => string,\n hasSsn: boolean,\n hasEin: boolean,\n) => {\n return ContractorProfileSchema.superRefine(\n (data: ContractorProfileFormData, ctx: z.RefinementCtx) => {\n // Email validation for contractor invitation\n if (data.selfOnboarding && !data.email) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['email'],\n message: t('validations.email'),\n })\n }\n\n // Individual contractor validations\n if (data.contractorType === ContractorType.Individual) {\n if (!data.firstName) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['firstName'],\n message: t('validations.firstName'),\n })\n }\n\n if (!data.lastName) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['lastName'],\n message: t('validations.lastName'),\n })\n }\n\n if (!data.ssn) {\n if (!hasSsn && !data.selfOnboarding) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ssn'],\n message: t('validations.ssn'),\n })\n }\n } else {\n // Validate SSN format\n const cleanSSN = removeNonDigits(data.ssn)\n if (!SSN_REGEX.test(cleanSSN)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ssn'],\n message: t('validations.ssnFormat'),\n })\n }\n }\n }\n\n // Business contractor validations\n if (data.contractorType === ContractorType.Business) {\n if (!data.businessName) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['businessName'],\n message: t('validations.businessName'),\n })\n }\n\n if (!data.ein) {\n if (!hasEin && !data.selfOnboarding) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ein'],\n message: t('validations.ein'),\n })\n }\n } else {\n // Validate EIN format after normalization (XX-XXXXXXX)\n const normalizedEin = normalizeEin(data.ein)\n if (!/^\\d{2}-\\d{7}$/.test(normalizedEin)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ein'],\n message: t('validations.einFormat'),\n })\n }\n }\n }\n\n // Hourly rate validation for hourly contractors\n if (data.wageType === WageType.Hourly) {\n if (data.hourlyRate === undefined || data.hourlyRate < 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hourlyRate'],\n message: t('validations.hourlyRate'),\n })\n }\n }\n },\n )\n}\n\nexport interface UseContractorProfileProps {\n companyId: string\n contractorId?: string\n defaultValues?: Partial<ContractorProfileFormData>\n existingContractor?: Contractor\n}\n\nexport function useContractorProfile({\n companyId,\n contractorId,\n defaultValues,\n existingContractor,\n}: UseContractorProfileProps) {\n useI18n('Contractor.Profile')\n const { t } = useTranslation('Contractor.Profile')\n const { onEvent, baseSubmitHandler } = useBase()\n\n // Create validation schema with translations\n const validationSchema = createContractorProfileValidationSchema(\n t as (key: string) => string,\n existingContractor?.hasSsn ?? false,\n existingContractor?.hasEin ?? false,\n )\n\n // API mutations\n const { mutateAsync: createContractor, isPending: isCreating } = useContractorsCreateMutation()\n const { mutateAsync: updateContractor, isPending: isUpdating } = useContractorsUpdateMutation()\n\n // Prepare default values from existing contractor or provided defaults\n const formDefaultValues = useMemo(\n () => ({\n selfOnboarding: false,\n contractorType: ContractorType.Business,\n wageType: WageType.Fixed,\n startDate: new Date(),\n ...defaultValues,\n // Override with existing contractor data if available\n ...(existingContractor && {\n selfOnboarding: existingContractor.onboardingStatus\n ? // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses\n ContractorSelfOnboardingStatuses.has(existingContractor.onboardingStatus)\n : false,\n contractorType: existingContractor.type || ContractorType.Business,\n wageType: existingContractor.wageType || WageType.Fixed,\n startDate: existingContractor.startDate\n ? new Date(existingContractor.startDate)\n : new Date(),\n firstName: existingContractor.firstName || undefined,\n middleInitial: existingContractor.middleInitial || undefined,\n lastName: existingContractor.lastName || undefined,\n businessName: existingContractor.businessName || undefined,\n email: existingContractor.email || undefined,\n hourlyRate: existingContractor.hourlyRate\n ? (() => {\n const parsed = parseFloat(existingContractor.hourlyRate)\n return isNaN(parsed) ? undefined : parsed\n })()\n : undefined,\n }),\n }),\n [existingContractor, defaultValues],\n )\n\n // Form setup\n const formMethods = useForm<ContractorProfileFormData, unknown, ContractorProfileFormData>({\n resolver: zodResolver(validationSchema),\n defaultValues: formDefaultValues,\n ...(existingContractor && { values: formDefaultValues }),\n resetOptions: { keepDirtyValues: true },\n })\n\n const { handleSubmit, formState } = formMethods\n\n // Watch form values for conditional rendering\n const watchedType = useWatch({ control: formMethods.control, name: 'contractorType' })\n const watchedWageType = useWatch({ control: formMethods.control, name: 'wageType' })\n const watchedSelfOnboarding = useWatch({\n control: formMethods.control,\n name: 'selfOnboarding',\n })\n\n // Helper function to transform form data to API payload\n const transformFormDataToCreatePayload = (\n data: ContractorProfileFormData,\n ): ContractorCreateRequestBody => {\n const basePayload = {\n type: data.contractorType,\n wageType: data.wageType,\n startDate: formatDateToStringDate(data.startDate) || '',\n selfOnboarding: data.selfOnboarding,\n email: data.selfOnboarding ? data.email : undefined,\n hourlyRate: data.wageType === WageType.Hourly ? String(data.hourlyRate) : undefined,\n isActive: true,\n }\n\n if (data.contractorType === ContractorType.Individual) {\n return {\n ...basePayload,\n firstName: data.firstName,\n middleInitial: data.middleInitial || undefined,\n lastName: data.lastName,\n ssn: data.ssn,\n fileNewHireReport: false, // Default value\n }\n } else {\n return {\n ...basePayload,\n fileNewHireReport: false, // Default value\n businessName: data.businessName,\n ein: data.ein?.replace(/-/g, ''),\n }\n }\n }\n\n const transformFormDataToUpdatePayload = (\n data: ContractorProfileFormData,\n version: string,\n ): ContractorUpdateRequestBody => {\n const createPayload = transformFormDataToCreatePayload(data)\n return {\n ...createPayload,\n version,\n }\n }\n\n // Event handlers\n const onSubmit: SubmitHandler<ContractorProfileFormData> = async data => {\n await baseSubmitHandler(data, async payload => {\n let contractorId = existingContractor?.uuid\n if (existingContractor) {\n // Update existing contractor\n if (!existingContractor.version) {\n throw new SDKInternalError('Contractor version is required for updates')\n }\n const version = existingContractor.version\n const apiPayload = transformFormDataToUpdatePayload(payload, version)\n\n const updateResponse = await updateContractor({\n request: {\n contractorUuid: contractorId!,\n contractorUpdateRequestBody: apiPayload,\n },\n })\n\n onEvent(componentEvents.CONTRACTOR_UPDATED, updateResponse.contractor)\n } else {\n // Create new contractor\n const apiPayload = transformFormDataToCreatePayload(payload)\n\n const createResponse = await createContractor({\n request: {\n companyUuid: companyId,\n contractorCreateRequestBody: apiPayload,\n },\n })\n\n contractorId = createResponse.contractor?.uuid\n onEvent(componentEvents.CONTRACTOR_CREATED, createResponse.contractor)\n }\n\n onEvent(componentEvents.CONTRACTOR_PROFILE_DONE, {\n selfOnboarding:\n payload.selfOnboarding &&\n existingContractor?.onboardingStatus !==\n ContractorOnboardingStatus.ADMIN_ONBOARDING_REVIEW,\n contractorId,\n })\n })\n }\n\n // Conditional rendering helpers\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion\n const shouldShowEmailField = !!watchedSelfOnboarding\n const shouldShowBusinessFields = watchedType === ContractorType.Business\n const shouldShowIndividualFields = watchedType === ContractorType.Individual\n const shouldShowHourlyRate = watchedWageType === WageType.Hourly\n const shouldShowSsnField = watchedType === ContractorType.Individual && !watchedSelfOnboarding\n const shouldShowEinField = watchedType === ContractorType.Business && !watchedSelfOnboarding\n\n // Form field options\n const contractorTypeOptions = [\n { label: 'Individual', value: ContractorType.Individual },\n { label: 'Business', value: ContractorType.Business },\n ]\n\n const wageTypeOptions = [\n { label: 'Hourly', value: WageType.Hourly },\n { label: 'Fixed', value: WageType.Fixed },\n ]\n\n // Determine if we're currently submitting (creating or updating)\n const isSubmitting = isCreating || isUpdating\n // Return only what the component actually needs\n return {\n // Form methods and submission\n formMethods,\n handleSubmit: handleSubmit(onSubmit),\n formState: {\n ...formState,\n isSubmitting,\n },\n\n // Conditional rendering flags\n shouldShowEmailField,\n shouldShowBusinessFields,\n shouldShowIndividualFields,\n shouldShowHourlyRate,\n shouldShowSsnField,\n shouldShowEinField,\n\n // Form options\n contractorTypeOptions,\n wageTypeOptions,\n\n // Component state\n isEditing: !!contractorId,\n }\n}\n"],"names":["WageType","ApiWageType","ContractorType","ApiContractorType","ContractorProfileSchema","z","NAME_REGEX","createContractorProfileValidationSchema","hasSsn","hasEin","data","ctx","cleanSSN","removeNonDigits","SSN_REGEX","normalizedEin","normalizeEin","useContractorProfile","companyId","contractorId","defaultValues","existingContractor","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","validationSchema","createContractor","isCreating","useContractorsCreateMutation","updateContractor","isUpdating","useContractorsUpdateMutation","formDefaultValues","useMemo","ContractorSelfOnboardingStatuses","parsed","formMethods","useForm","zodResolver","handleSubmit","formState","watchedType","useWatch","watchedWageType","watchedSelfOnboarding","transformFormDataToCreatePayload","basePayload","formatDateToStringDate","transformFormDataToUpdatePayload","version","onSubmit","payload","SDKInternalError","apiPayload","updateResponse","componentEvents","createResponse","ContractorOnboardingStatus","shouldShowEmailField","shouldShowBusinessFields","shouldShowIndividualFields","shouldShowHourlyRate","shouldShowSsnField","shouldShowEinField","contractorTypeOptions","wageTypeOptions","isSubmitting"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6BO,MAAMA,IAAWC,GACXC,IAAiBC,GAGxBC,KAA0BC,EAAE,OAAO;AAAA;AAAA,EAEvC,gBAAgBA,EAAE,QAAA;AAAA,EAClB,OAA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AA;AAAA,EAAS,GAGhDkE,IAAkB;AAAA,IACtB,EAAE,OAAO,UAAU,OAAOpE,EAAS,OAAA;AAAA,IACnC,EAAE,OAAO,SAAS,OAAOA,EAAS,MAAA;AAAA,EAAM,GAIpCqE,IAAevC,KAAcG;AAEnC,SAAO;AAAA;AAAA,IAEL,aAAAM;AAAA,IACA,cAAcG,EAAaW,CAAQ;AAAA,IACnC,WAAW;AAAA,MACT,GAAGV;AAAA,MACH,cAAA0B;AAAA,IAAA;AAAA;AAAA,IAIF,sBAAAR;AAAA,IACA,0BAAAC;AAAA,IACA,4BAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,oBAAAC;AAAA;AAAA,IAGA,uBAAAC;AAAA,IACA,iBAAAC;AAAA;AAAA,IAGA,WAAW,CAAC,CAACjD;AAAA,EAAA;AAEjB;"}
1
+ {"version":3,"file":"useContractorProfile.js","sources":["../../../../src/components/Contractor/Profile/useContractorProfile.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { useForm, useWatch } from 'react-hook-form'\nimport { z } from 'zod'\nimport { useContractorsCreateMutation } from '@gusto/embedded-api/react-query/contractorsCreate'\nimport { useContractorsUpdateMutation } from '@gusto/embedded-api/react-query/contractorsUpdate'\nimport type { ContractorCreateRequestBody } from '@gusto/embedded-api/models/components/contractorcreaterequestbody'\nimport type { ContractorUpdateRequestBody } from '@gusto/embedded-api/models/components/contractorupdaterequestbody'\nimport {\n ContractorWageType as ApiWageType,\n ContractorType as ApiContractorType,\n type Contractor,\n} from '@gusto/embedded-api/models/components/contractor'\nimport { useBase } from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport {\n componentEvents,\n ContractorOnboardingStatus,\n ContractorSelfOnboardingStatuses,\n} from '@/shared/constants'\nimport { SSN_REGEX, NAME_REGEX } from '@/helpers/validations'\nimport { removeNonDigits } from '@/helpers/formattedStrings'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { normalizeEin } from '@/helpers/federalEin'\nimport { SDKInternalError } from '@/types/sdkError'\n\n// Re-export the API types for convenience\nexport const WageType = ApiWageType\nexport const ContractorType = ApiContractorType\n\n// Form schema definition - exported for use in stories and tests\nconst ContractorProfileSchema = z.object({\n // Self-onboarding toggle\n selfOnboarding: z.boolean(),\n email: z.string().email().optional(),\n\n // Required contractor fields\n contractorType: z.enum([ContractorType.Individual, ContractorType.Business]),\n wageType: z.enum([WageType.Hourly, WageType.Fixed]),\n startDate: z.date(),\n\n // Individual contractor fields\n firstName: z.string().min(1).regex(NAME_REGEX).optional(),\n middleInitial: z.string().optional(),\n lastName: z.string().min(1).regex(NAME_REGEX).optional(),\n ssn: z.string().optional(),\n\n // Business contractor fields\n businessName: z.string().optional(),\n ein: z.string().optional(),\n\n // Wage fields\n hourlyRate: z.number().min(0).optional(),\n})\n\nexport type ContractorProfileFormData = z.infer<typeof ContractorProfileSchema>\n\n// Create validation schema - exported for stories\nexport const createContractorProfileValidationSchema = (\n t: (key: string) => string,\n hasSsn: boolean,\n hasEin: boolean,\n) => {\n return ContractorProfileSchema.superRefine(\n (data: ContractorProfileFormData, ctx: z.RefinementCtx) => {\n // Email validation for contractor invitation\n if (data.selfOnboarding && !data.email) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['email'],\n message: t('validations.email'),\n })\n }\n\n // Individual contractor validations\n if (data.contractorType === ContractorType.Individual) {\n if (!data.firstName) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['firstName'],\n message: t('validations.firstName'),\n })\n }\n\n if (!data.lastName) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['lastName'],\n message: t('validations.lastName'),\n })\n }\n\n if (!data.ssn) {\n if (!hasSsn && !data.selfOnboarding) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ssn'],\n message: t('validations.ssn'),\n })\n }\n } else {\n // Validate SSN format\n const cleanSSN = removeNonDigits(data.ssn)\n if (!SSN_REGEX.test(cleanSSN)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ssn'],\n message: t('validations.ssnFormat'),\n })\n }\n }\n }\n\n // Business contractor validations\n if (data.contractorType === ContractorType.Business) {\n if (!data.businessName) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['businessName'],\n message: t('validations.businessName'),\n })\n }\n\n if (!data.ein) {\n if (!hasEin && !data.selfOnboarding) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ein'],\n message: t('validations.ein'),\n })\n }\n } else {\n // Validate EIN format after normalization (XX-XXXXXXX)\n const normalizedEin = normalizeEin(data.ein)\n if (!/^\\d{2}-\\d{7}$/.test(normalizedEin)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ein'],\n message: t('validations.einFormat'),\n })\n }\n }\n }\n\n // Hourly rate validation for hourly contractors\n if (data.wageType === WageType.Hourly) {\n if (data.hourlyRate === undefined || data.hourlyRate < 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hourlyRate'],\n message: t('validations.hourlyRate'),\n })\n }\n }\n },\n )\n}\n\nexport interface UseContractorProfileProps {\n companyId: string\n contractorId?: string\n defaultValues?: Partial<ContractorProfileFormData>\n existingContractor?: Contractor\n}\n\nexport function useContractorProfile({\n companyId,\n contractorId,\n defaultValues,\n existingContractor,\n}: UseContractorProfileProps) {\n useI18n('Contractor.Profile')\n const { t } = useTranslation('Contractor.Profile')\n const { onEvent, baseSubmitHandler } = useBase()\n\n // Create validation schema with translations\n const validationSchema = createContractorProfileValidationSchema(\n t as (key: string) => string,\n existingContractor?.hasSsn ?? false,\n existingContractor?.hasEin ?? false,\n )\n\n // API mutations\n const { mutateAsync: createContractor, isPending: isCreating } = useContractorsCreateMutation()\n const { mutateAsync: updateContractor, isPending: isUpdating } = useContractorsUpdateMutation()\n\n // Prepare default values from existing contractor or provided defaults\n const formDefaultValues = useMemo(\n () => ({\n selfOnboarding: false,\n contractorType: ContractorType.Business,\n wageType: WageType.Fixed,\n startDate: new Date(),\n ...defaultValues,\n // Override with existing contractor data if available\n ...(existingContractor && {\n selfOnboarding: existingContractor.onboardingStatus\n ? // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses\n ContractorSelfOnboardingStatuses.has(existingContractor.onboardingStatus)\n : false,\n contractorType: existingContractor.type || ContractorType.Business,\n wageType: existingContractor.wageType || WageType.Fixed,\n startDate: existingContractor.startDate\n ? new Date(existingContractor.startDate)\n : new Date(),\n firstName: existingContractor.firstName || undefined,\n middleInitial: existingContractor.middleInitial || undefined,\n lastName: existingContractor.lastName || undefined,\n businessName: existingContractor.businessName || undefined,\n email: existingContractor.email || undefined,\n hourlyRate: existingContractor.hourlyRate\n ? (() => {\n const parsed = parseFloat(existingContractor.hourlyRate)\n return isNaN(parsed) ? undefined : parsed\n })()\n : undefined,\n }),\n }),\n [existingContractor, defaultValues],\n )\n\n // Form setup\n const formMethods = useForm<ContractorProfileFormData, unknown, ContractorProfileFormData>({\n resolver: zodResolver(validationSchema),\n defaultValues: formDefaultValues,\n ...(existingContractor && { values: formDefaultValues }),\n resetOptions: { keepDirtyValues: true },\n })\n\n const { handleSubmit, formState } = formMethods\n\n // Watch form values for conditional rendering\n const watchedType = useWatch({ control: formMethods.control, name: 'contractorType' })\n const watchedWageType = useWatch({ control: formMethods.control, name: 'wageType' })\n const watchedSelfOnboarding = useWatch({\n control: formMethods.control,\n name: 'selfOnboarding',\n })\n\n // Helper function to transform form data to API payload\n const transformFormDataToCreatePayload = (\n data: ContractorProfileFormData,\n ): ContractorCreateRequestBody => {\n const basePayload = {\n type: data.contractorType,\n wageType: data.wageType,\n startDate: formatDateToStringDate(data.startDate) || '',\n selfOnboarding: data.selfOnboarding,\n email: data.selfOnboarding ? data.email : undefined,\n hourlyRate: data.wageType === WageType.Hourly ? String(data.hourlyRate) : undefined,\n isActive: true,\n }\n\n if (data.contractorType === ContractorType.Individual) {\n return {\n ...basePayload,\n firstName: data.firstName,\n middleInitial: data.middleInitial || undefined,\n lastName: data.lastName,\n ssn: data.ssn,\n fileNewHireReport: false, // Default value\n }\n } else {\n return {\n ...basePayload,\n fileNewHireReport: false, // Default value\n businessName: data.businessName,\n ein: data.ein?.replace(/-/g, ''),\n }\n }\n }\n\n const transformFormDataToUpdatePayload = (\n data: ContractorProfileFormData,\n version: string,\n ): ContractorUpdateRequestBody => {\n const createPayload = transformFormDataToCreatePayload(data)\n return {\n ...createPayload,\n version,\n }\n }\n\n // Event handlers\n const onSubmit: SubmitHandler<ContractorProfileFormData> = async data => {\n await baseSubmitHandler(data, async payload => {\n let contractorId = existingContractor?.uuid\n if (existingContractor) {\n // Update existing contractor\n if (!existingContractor.version) {\n throw new SDKInternalError('Contractor version is required for updates')\n }\n const version = existingContractor.version\n const apiPayload = transformFormDataToUpdatePayload(payload, version)\n\n const updateResponse = await updateContractor({\n request: {\n contractorUuid: contractorId!,\n contractorUpdateRequestBody: apiPayload,\n },\n })\n\n onEvent(componentEvents.CONTRACTOR_UPDATED, updateResponse.contractor)\n } else {\n // Create new contractor\n const apiPayload = transformFormDataToCreatePayload(payload)\n\n const createResponse = await createContractor({\n request: {\n companyUuid: companyId,\n contractorCreateRequestBody: apiPayload,\n },\n })\n\n contractorId = createResponse.contractor?.uuid\n onEvent(componentEvents.CONTRACTOR_CREATED, createResponse.contractor)\n }\n\n onEvent(componentEvents.CONTRACTOR_PROFILE_DONE, {\n selfOnboarding:\n payload.selfOnboarding &&\n existingContractor?.onboardingStatus !==\n ContractorOnboardingStatus.ADMIN_ONBOARDING_REVIEW,\n contractorId,\n })\n })\n }\n\n // Conditional rendering helpers\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion\n const shouldShowEmailField = !!watchedSelfOnboarding\n const shouldShowBusinessFields = watchedType === ContractorType.Business\n const shouldShowIndividualFields = watchedType === ContractorType.Individual\n const shouldShowHourlyRate = watchedWageType === WageType.Hourly\n const shouldShowSsnField = watchedType === ContractorType.Individual && !watchedSelfOnboarding\n const shouldShowEinField = watchedType === ContractorType.Business && !watchedSelfOnboarding\n\n // Form field options\n const contractorTypeOptions = [\n { label: 'Individual', value: ContractorType.Individual },\n { label: 'Business', value: ContractorType.Business },\n ]\n\n const wageTypeOptions = [\n { label: 'Hourly', value: WageType.Hourly },\n { label: 'Fixed', value: WageType.Fixed },\n ]\n\n // Determine if we're currently submitting (creating or updating)\n const isSubmitting = isCreating || isUpdating\n // Return only what the component actually needs\n return {\n // Form methods and submission\n formMethods,\n handleSubmit: handleSubmit(onSubmit),\n formState: {\n ...formState,\n isSubmitting,\n },\n\n // Conditional rendering flags\n shouldShowEmailField,\n shouldShowBusinessFields,\n shouldShowIndividualFields,\n shouldShowHourlyRate,\n shouldShowSsnField,\n shouldShowEinField,\n\n // Form options\n contractorTypeOptions,\n wageTypeOptions,\n\n // Component state\n isEditing: !!contractorId,\n }\n}\n"],"names":["WageType","ApiWageType","ContractorType","ApiContractorType","ContractorProfileSchema","z","NAME_REGEX","createContractorProfileValidationSchema","hasSsn","hasEin","data","ctx","cleanSSN","removeNonDigits","SSN_REGEX","normalizedEin","normalizeEin","useContractorProfile","companyId","contractorId","defaultValues","existingContractor","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","validationSchema","createContractor","isCreating","useContractorsCreateMutation","updateContractor","isUpdating","useContractorsUpdateMutation","formDefaultValues","useMemo","ContractorSelfOnboardingStatuses","parsed","formMethods","useForm","zodResolver","handleSubmit","formState","watchedType","useWatch","watchedWageType","watchedSelfOnboarding","transformFormDataToCreatePayload","basePayload","formatDateToStringDate","transformFormDataToUpdatePayload","version","onSubmit","payload","SDKInternalError","apiPayload","updateResponse","componentEvents","createResponse","ContractorOnboardingStatus","shouldShowEmailField","shouldShowBusinessFields","shouldShowIndividualFields","shouldShowHourlyRate","shouldShowSsnField","shouldShowEinField","contractorTypeOptions","wageTypeOptions","isSubmitting"],"mappings":";;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B,MAAgB1C,EAAe,YAAY,CAAC6C,GAGjEoB,IAAwB;AAAA,IAC5B,EAAE,OAAO,cAAc,OAAOjE,EAAe,WAAA;AAAA,IAC7C,EAAE,OAAO,YAAY,OAAOA,EAAe,SAAA;AAAA,EAAS,GAGhDkE,IAAkB;AAAA,IACtB,EAAE,OAAO,UAAU,OAAOpE,EAAS,OAAA;AAAA,IACnC,EAAE,OAAO,SAAS,OAAOA,EAAS,MAAA;AAAA,EAAM,GAIpCqE,IAAevC,KAAcG;AAEnC,SAAO;AAAA;AAAA,IAEL,aAAAM;AAAA,IACA,cAAcG,EAAaW,CAAQ;AAAA,IACnC,WAAW;AAAA,MACT,GAAGV;AAAA,MACH,cAAA0B;AAAA,IAAA;AAAA;AAAA,IAIF,sBAAAR;AAAA,IACA,0BAAAC;AAAA,IACA,4BAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,oBAAAC;AAAA;AAAA,IAGA,uBAAAC;AAAA,IACA,iBAAAC;AAAA;AAAA,IAGA,WAAW,CAAC,CAACjD;AAAA,EAAA;AAEjB;"}
@@ -20,7 +20,6 @@ import "@gusto/embedded-api/models/errors/sdkvalidationerror";
20
20
  import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
21
21
  import "@gusto/embedded-api/models/errors/httpclienterrors";
22
22
  import { componentEvents as M } from "../../../../shared/constants.js";
23
- import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
24
23
  import { SelectField as f } from "../../../Common/Fields/SelectField/SelectField.js";
25
24
  import { TextInputField as te } from "../../../Common/Fields/TextInputField/TextInputField.js";
26
25
  import { NumberInputField as D } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
@@ -34,7 +33,7 @@ const ne = 0, oe = 0, ie = 100, _ = "Number must be greater than or equal to 0",
34
33
  payPeriodMaximum: o.number().min(0, { error: _ }).transform((r) => r > 0 ? r.toString() : null).nullable(),
35
34
  paymentPeriod: me
36
35
  });
37
- function Oe({
36
+ function Ie({
38
37
  deduction: r,
39
38
  handleStateAgencySelect: A,
40
39
  stateAgencies: R,
@@ -229,6 +228,6 @@ function Oe({
229
228
  ] }) }) });
230
229
  }
231
230
  export {
232
- Oe as default
231
+ Ie as default
233
232
  };
234
233
  //# 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 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 } as const\n\n const requiredSelectedAgencyAttributes =\n selectedAgency?.requiredAttributes\n ?.map(attr => {\n if (!attr.key) {\n return null\n }\n if (!Object.prototype.hasOwnProperty.call(ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER, attr.key)) {\n return null\n }\n const key = attr.key as keyof typeof ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER\n const mappedAttr = ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[key]\n return {\n name: mappedAttr.name,\n label: attr.label as string,\n description: mappedAttr.description,\n }\n })\n .filter((attr): attr is NonNullable<typeof attr> => attr !== null) || []\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","key","mappedAttr","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,IAAqB,6CAErBC,KAAkCC,EAAE,KAAKC,CAAa,GAEtDC,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,GAAG,EAAE,OAAOF,EAAA,CAAoB,EAAE,UAAU,MAAM;AAAA,EACzE,kBAAkBE,EACf,SACA,IAAI,GAAG,EAAE,OAAOF,GAAoB,EACpC,UAAU,CAAAK,MAAQA,IAAM,IAAIA,EAAI,aAAa,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,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S;AAAA,gBAClB,OAAO;AAAA,cAAA;AAAA,YACT;AAAA,YAEF,YAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACZ,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACCiD,IAAA,EACC,UAAA;AAAA,MAAA,gBAAAV,EAACrC,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASiC,GAC7C,UAAAnC,EAAE,WAAW,EAAA,CAChB;AAAA,MACCwB,KACC,gBAAAe,EAACrC,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWa,GACzC,UAAAf,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CAEJ;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 } as const\n\n const requiredSelectedAgencyAttributes =\n selectedAgency?.requiredAttributes\n ?.map(attr => {\n if (!attr.key) {\n return null\n }\n if (!Object.prototype.hasOwnProperty.call(ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER, attr.key)) {\n return null\n }\n const key = attr.key as keyof typeof ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER\n const mappedAttr = ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[key]\n return {\n name: mappedAttr.name,\n label: attr.label as string,\n description: mappedAttr.description,\n }\n })\n .filter((attr): attr is NonNullable<typeof attr> => attr !== null) || []\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","key","mappedAttr","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,IAAqB,6CAErBC,KAAkCC,EAAE,KAAKC,CAAa,GAEtDC,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,GAAG,EAAE,OAAOF,EAAA,CAAoB,EAAE,UAAU,MAAM;AAAA,EACzE,kBAAkBE,EACf,SACA,IAAI,GAAG,EAAE,OAAOF,GAAoB,EACpC,UAAU,CAAAK,MAAQA,IAAM,IAAIA,EAAI,aAAa,IAAK,EAClD,SAAA;AAAA,EACH,eAAeJ;AACjB,CAAC;AAgBD,SAASK,GAAiB;AAAA,EACxB,WAAAC;AAAA,EACA,yBAAAC;AAA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E,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,sBACCiD,IAAA,EACC,UAAA;AAAA,MAAA,gBAAAV,EAACrC,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASiC,GAC7C,UAAAnC,EAAE,WAAW,EAAA,CAChB;AAAA,MACCwB,KACC,gBAAAe,EAACrC,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWa,GACzC,UAAAf,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -19,7 +19,6 @@ import "@gusto/embedded-api/models/errors/sdkvalidationerror";
19
19
  import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
20
20
  import "@gusto/embedded-api/models/errors/httpclienterrors";
21
21
  import { componentEvents as g } from "../../../../shared/constants.js";
22
- import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
23
22
  import { TextInputField as $ } from "../../../Common/Fields/TextInputField/TextInputField.js";
24
23
  import { RadioGroupField as h } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
25
24
  import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
@@ -33,7 +32,7 @@ const d = "Number must be greater than or equal to 0", z = r.object({
33
32
  totalAmount: r.number().min(0, { error: d }).transform((e) => e > 0 ? e.toString() : null).nullable(),
34
33
  deductAsPercentage: r.boolean()
35
34
  });
36
- function ge({ deduction: e, employeeId: A, onCancel: D }) {
35
+ function fe({ deduction: e, employeeId: A, onCancel: D }) {
37
36
  const { onEvent: p, baseSubmitHandler: x } = j(), { t: n } = S("Employee.Deductions"), u = B(), { mutateAsync: E, isPending: P } = _(), { mutateAsync: y, isPending: R } = w(), v = P || R, C = V(() => ({
38
37
  amount: e?.amount ? Number(e.amount) : 0,
39
38
  description: e?.description ?? "",
@@ -150,6 +149,6 @@ function ge({ deduction: e, employeeId: A, onCancel: D }) {
150
149
  }
151
150
  export {
152
151
  z as DeductionSchema,
153
- ge as default
152
+ fe as default
154
153
  };
155
154
  //# 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\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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ACCoC,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":"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,WAAA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,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;"}
@@ -20,7 +20,6 @@ import "@gusto/embedded-api/models/errors/sdkvalidationerror";
20
20
  import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
21
21
  import "@gusto/embedded-api/models/errors/httpclienterrors";
22
22
  import { componentEvents as f } from "../../../../shared/constants.js";
23
- import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
24
23
  import { TextInputField as Y } from "../../../Common/Fields/TextInputField/TextInputField.js";
25
24
  import { RadioGroupField as h } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
26
25
  import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
@@ -36,7 +35,7 @@ const p = "Number must be greater than or equal to 0", k = r.object({
36
35
  deductAsPercentage: r.boolean(),
37
36
  garnishmentType: r.enum(w)
38
37
  });
39
- function ye({
38
+ function De({
40
39
  deduction: e,
41
40
  employeeId: A,
42
41
  selectedGarnishmentType: D,
@@ -160,6 +159,6 @@ function ye({
160
159
  }
161
160
  export {
162
161
  k as DeductionSchema,
163
- ye as default
162
+ De as default
164
163
  };
165
164
  //# sourceMappingURL=GarnishmentForm.js.map