@gusto/embedded-react-sdk 0.44.0 → 0.44.2

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 (170) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/components/Base/useBaseSubmit.js +6 -6
  3. package/dist/components/Base/useBaseSubmit.js.map +1 -1
  4. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
  5. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +1 -1
  6. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +1 -1
  7. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +1 -1
  8. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +1 -1
  9. package/dist/components/Company/AssignSignatory/TitleSelect.js +1 -1
  10. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +1 -1
  11. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +1 -1
  12. package/dist/components/Company/BankAccount/BankAccountForm/context.js +1 -1
  13. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +1 -1
  14. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +1 -1
  15. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +1 -1
  16. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +9 -9
  17. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  18. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +1 -1
  19. package/dist/components/Company/FederalTaxes/Actions.js +1 -1
  20. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +1 -1
  21. package/dist/components/Company/Industry/Actions.js +1 -1
  22. package/dist/components/Company/Industry/Context.js +1 -1
  23. package/dist/components/Company/Industry/Edit.js +1 -1
  24. package/dist/components/Company/Locations/LocationForm/Actions.js +1 -1
  25. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +1 -1
  26. package/dist/components/Company/Locations/LocationsList/Actions.js +1 -1
  27. package/dist/components/Company/Locations/LocationsList/List.js +1 -1
  28. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +1 -1
  29. package/dist/components/Company/OnboardingOverview/context.js +1 -1
  30. package/dist/components/Company/PaySchedule/PaySchedule.d.ts +2 -2
  31. package/dist/components/Company/PaySchedule/PaySchedule.js +6 -6
  32. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  33. package/dist/components/Company/PaySchedule/PayScheduleList.js +8 -8
  34. package/dist/components/Company/PaySchedule/PayScheduleList.js.map +1 -1
  35. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +3 -3
  36. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js +12 -12
  37. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
  38. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +1 -1
  39. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +1 -1
  40. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +1 -1
  41. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +1 -1
  42. package/dist/components/Contractor/Address/Address.js +16 -16
  43. package/dist/components/Contractor/Address/Address.js.map +1 -1
  44. package/dist/components/Contractor/Address/Form.js +4 -4
  45. package/dist/components/Contractor/Address/useAddress.js +1 -1
  46. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +8 -8
  47. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  48. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
  49. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +5 -5
  50. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
  51. package/dist/components/Contractor/Profile/useContractorProfile.js +1 -1
  52. package/dist/components/Contractor/Submit/Submit.js +22 -20
  53. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  54. package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.d.ts +1 -1
  55. package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js +6 -6
  56. package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js.map +1 -1
  57. package/dist/components/Employee/Dashboard/hooks/useEmployeeForms.js +3 -3
  58. package/dist/components/Employee/Dashboard/hooks/useEmployeeForms.js.map +1 -1
  59. package/dist/components/Employee/Deductions/Deductions.js +7 -7
  60. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  61. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +24 -24
  62. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  63. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +13 -9
  64. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  65. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +2 -2
  66. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
  67. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.d.ts +1 -2
  68. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +17 -17
  69. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  70. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +30 -30
  71. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  72. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +1 -1
  73. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +8 -8
  74. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  75. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +1 -1
  76. package/dist/components/Employee/DocumentSigner/DocumentSigner.js +1 -1
  77. package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
  78. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +12 -12
  79. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
  80. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js +1 -1
  81. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js.map +1 -1
  82. package/dist/components/Employee/FederalTaxes/management/FederalTaxes.js +1 -1
  83. package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js +1 -1
  84. package/dist/components/Employee/PaymentMethod/Actions.js +1 -1
  85. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
  86. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +1 -1
  87. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +14 -14
  88. package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
  89. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
  90. package/dist/components/Employee/PaymentMethod/Split.js +1 -1
  91. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +1 -1
  92. package/dist/components/Employee/Profile/management/Profile.js +1 -1
  93. package/dist/components/Employee/Profile/onboarding/AdminProfile.js +1 -1
  94. package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js +1 -1
  95. package/dist/components/Employee/StateTaxes/management/StateTaxes.js +1 -1
  96. package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js +1 -1
  97. package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.js +19 -17
  98. package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.js.map +1 -1
  99. package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.module.scss.js +8 -0
  100. package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.module.scss.js.map +1 -0
  101. package/dist/components/Employee/Taxes/Actions.js +1 -1
  102. package/dist/components/Employee/Taxes/FederalForm.js +1 -1
  103. package/dist/components/Employee/Taxes/useTaxes.js +1 -1
  104. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +11 -11
  105. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
  106. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js +3 -3
  107. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js.map +1 -1
  108. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +40 -45
  109. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
  110. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +1 -1
  111. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
  112. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +17 -17
  113. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
  114. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +7 -7
  115. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -1
  116. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +1 -1
  117. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +1 -1
  118. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +1 -1
  119. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +1 -1
  120. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +10 -10
  121. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
  122. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.d.ts +2 -2
  123. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +21 -25
  124. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
  125. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +1 -1
  126. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  127. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +2 -2
  128. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +1 -1
  129. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  130. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +4 -4
  131. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  132. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +1 -1
  133. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  134. package/dist/components/Payroll/PayrollList/PayrollList.js +4 -4
  135. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  136. package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +2 -2
  137. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  138. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +5 -5
  139. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
  140. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +1 -1
  141. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
  142. package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +7 -7
  143. package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -1
  144. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.d.ts +1 -1
  145. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +70 -53
  146. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
  147. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +1 -1
  148. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
  149. package/dist/components/Payroll/helpers.d.ts +1 -1
  150. package/dist/components/Payroll/helpers.js.map +1 -1
  151. package/dist/components/Payroll/usePreparedPayrollData.d.ts +2 -2
  152. package/dist/components/Payroll/usePreparedPayrollData.js +10 -10
  153. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  154. package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js +1 -1
  155. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +41 -41
  156. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
  157. package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +1 -1
  158. package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js +1 -1
  159. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +1 -1
  160. package/dist/helpers/dateFormatting.js +52 -56
  161. package/dist/helpers/dateFormatting.js.map +1 -1
  162. package/dist/partner-hook-utils/form/fields/CheckboxHookField.js +1 -1
  163. package/dist/partner-hook-utils/form/fields/NumberInputHookField.js +1 -1
  164. package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js +1 -1
  165. package/dist/partner-hook-utils/form/fields/SelectHookField.js +1 -1
  166. package/dist/partner-hook-utils/form/fields/SwitchHookField.js +1 -1
  167. package/dist/partner-hook-utils/form/fields/TextInputHookField.js +1 -1
  168. package/dist/style.css +1 -1
  169. package/dist/test-utils/assertions.d.ts +4 -0
  170. package/package.json +13 -10
@@ -4,8 +4,8 @@ import { useTranslation as x } from "react-i18next";
4
4
  import { EmployeeStateTaxesView as y } from "../shared/EmployeeStateTaxesView.js";
5
5
  import { BaseBoundaries as E, BaseLayout as C } from "../../../Base/Base.js";
6
6
  import "../../../Base/useBase.js";
7
- import { componentEvents as c } from "../../../../shared/constants.js";
8
7
  import "classnames";
8
+ import { componentEvents as c } from "../../../../shared/constants.js";
9
9
  import { ActionsLayout as h } from "../../../Common/ActionsLayout/ActionsLayout.js";
10
10
  import { useI18n as L, useComponentDictionary as A } from "../../../../i18n/I18n.js";
11
11
  import { useComponentContext as b } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
@@ -3,8 +3,8 @@ import { useTranslation as u } from "react-i18next";
3
3
  import { EmployeeStateTaxesView as p } from "../shared/EmployeeStateTaxesView.js";
4
4
  import { BaseBoundaries as c, BaseLayout as E } from "../../../Base/Base.js";
5
5
  import "../../../Base/useBase.js";
6
- import { componentEvents as s } from "../../../../shared/constants.js";
7
6
  import "classnames";
7
+ import { componentEvents as s } from "../../../../shared/constants.js";
8
8
  import { ActionsLayout as T } from "../../../Common/ActionsLayout/ActionsLayout.js";
9
9
  import { useI18n as S, useComponentDictionary as l } from "../../../../i18n/I18n.js";
10
10
  import { useComponentContext as f } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
@@ -1,32 +1,34 @@
1
- import { jsx as t, jsxs as e } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as e } from "react/jsx-runtime";
2
2
  import { Fragment as x } from "react";
3
3
  import { useTranslation as m } from "react-i18next";
4
- import { BaseLayout as C } from "../../../Base/Base.js";
4
+ import y from "classnames";
5
+ import C from "./EmployeeStateTaxesView.module.scss.js";
6
+ import { BaseLayout as F } from "../../../Base/Base.js";
5
7
  import "../../../Base/useBase.js";
6
- import { Form as F } from "../../../Common/Form/Form.js";
7
- import { SDKFormProvider as H } from "../../../../partner-hook-utils/form/SDKFormProvider.js";
8
- import { useComponentContext as y } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
9
- function w({
8
+ import { Form as H } from "../../../Common/Form/Form.js";
9
+ import { SDKFormProvider as N } from "../../../../partner-hook-utils/form/SDKFormProvider.js";
10
+ import { useComponentContext as S } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
+ function K({
10
12
  stateTaxes: r,
11
- onSubmit: n,
12
- actions: s,
13
+ onSubmit: s,
14
+ actions: n,
13
15
  alert: i,
14
16
  className: a
15
17
  }) {
16
- const { t: c } = m("Employee.StateTaxes"), { t: l } = m("common"), p = y(), d = r.form.Fields;
17
- return /* @__PURE__ */ t("section", { className: a, children: /* @__PURE__ */ t(C, { error: r.errorHandling.errors, children: /* @__PURE__ */ t(H, { formHookResult: r, children: /* @__PURE__ */ e(F, { onSubmit: n, children: [
18
+ const { t: c } = m("Employee.StateTaxes"), { t: l } = m("common"), p = S(), f = r.form.Fields;
19
+ return /* @__PURE__ */ o("section", { className: y(C.container, a), children: /* @__PURE__ */ o(F, { error: r.errorHandling.errors, children: /* @__PURE__ */ o(N, { formHookResult: r, children: /* @__PURE__ */ e(H, { onSubmit: s, children: [
18
20
  i,
19
- d.map((o) => {
20
- const f = l(`statesHash.${o.state}`, o.state);
21
+ f.map((t) => {
22
+ const d = l(`statesHash.${t.state}`, t.state);
21
23
  return /* @__PURE__ */ e(x, { children: [
22
- /* @__PURE__ */ t(p.Heading, { as: "h2", children: c("stateTaxesTitle", { state: f }) }),
23
- o.questions.map(({ questionId: h, Field: u }) => /* @__PURE__ */ t(u, {}, h))
24
- ] }, o.state);
24
+ /* @__PURE__ */ o(p.Heading, { as: "h2", children: c("stateTaxesTitle", { state: d }) }),
25
+ t.questions.map(({ questionId: h, Field: u }) => /* @__PURE__ */ o(u, {}, h))
26
+ ] }, t.state);
25
27
  }),
26
- s
28
+ n
27
29
  ] }) }) }) });
28
30
  }
29
31
  export {
30
- w as EmployeeStateTaxesView
32
+ K as EmployeeStateTaxesView
31
33
  };
32
34
  //# sourceMappingURL=EmployeeStateTaxesView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmployeeStateTaxesView.js","sources":["../../../../../src/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.tsx"],"sourcesContent":["import { Fragment, type ReactNode } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { type useEmployeeStateTaxesForm } from './useEmployeeStateTaxesForm'\nimport { BaseLayout } from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ntype ReadyEmployeeStateTaxesForm = Extract<\n ReturnType<typeof useEmployeeStateTaxesForm>,\n { isLoading: false }\n>\n\nexport interface EmployeeStateTaxesViewProps {\n stateTaxes: ReadyEmployeeStateTaxesForm\n onSubmit: () => void | Promise<void>\n actions: ReactNode\n alert?: ReactNode\n className?: string\n}\n\nexport function EmployeeStateTaxesView({\n stateTaxes,\n onSubmit,\n actions,\n alert,\n className,\n}: EmployeeStateTaxesViewProps) {\n const { t } = useTranslation('Employee.StateTaxes')\n const { t: tCommon } = useTranslation('common')\n const Components = useComponentContext()\n const groups = stateTaxes.form.Fields\n\n return (\n <section className={className}>\n <BaseLayout error={stateTaxes.errorHandling.errors}>\n <SDKFormProvider formHookResult={stateTaxes}>\n <Form onSubmit={onSubmit}>\n {alert}\n\n {groups.map(group => {\n const stateName = tCommon(`statesHash.${group.state}`, group.state)\n return (\n <Fragment key={group.state}>\n <Components.Heading as=\"h2\">\n {t('stateTaxesTitle', { state: stateName })}\n </Components.Heading>\n\n {group.questions.map(({ questionId, Field }) => {\n return <Field key={questionId} />\n })}\n </Fragment>\n )\n })}\n\n {actions}\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n </section>\n )\n}\n"],"names":["EmployeeStateTaxesView","stateTaxes","onSubmit","actions","alert","className","t","useTranslation","tCommon","Components","useComponentContext","groups","jsx","BaseLayout","SDKFormProvider","jsxs","Form","group","stateName","Fragment","questionId","Field"],"mappings":";;;;;;;;AAqBO,SAASA,EAAuB;AAAA,EACrC,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AACF,GAAgC;AAC9B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5C,EAAE,GAAGC,MAAYD,EAAe,QAAQ,GACxCE,IAAaC,EAAA,GACbC,IAASV,EAAW,KAAK;AAE/B,SACE,gBAAAW,EAAC,WAAA,EAAQ,WAAAP,GACP,UAAA,gBAAAO,EAACC,KAAW,OAAOZ,EAAW,cAAc,QAC1C,4BAACa,GAAA,EAAgB,gBAAgBb,GAC/B,UAAA,gBAAAc,EAACC,KAAK,UAAAd,GACH,UAAA;AAAA,IAAAE;AAAA,IAEAO,EAAO,IAAI,CAAAM,MAAS;AACnB,YAAMC,IAAYV,EAAQ,cAAcS,EAAM,KAAK,IAAIA,EAAM,KAAK;AAClE,+BACGE,GAAA,EACC,UAAA;AAAA,QAAA,gBAAAP,EAACH,EAAW,SAAX,EAAmB,IAAG,MACpB,UAAAH,EAAE,mBAAmB,EAAE,OAAOY,EAAA,CAAW,EAAA,CAC5C;AAAA,QAECD,EAAM,UAAU,IAAI,CAAC,EAAE,YAAAG,GAAY,OAAAC,QAC3B,gBAAAT,EAACS,OAAWD,CAAY,CAChC;AAAA,MAAA,EAAA,GAPYH,EAAM,KAQrB;AAAA,IAEJ,CAAC;AAAA,IAEAd;AAAA,EAAA,GACH,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"EmployeeStateTaxesView.js","sources":["../../../../../src/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.tsx"],"sourcesContent":["import { Fragment, type ReactNode } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport { type useEmployeeStateTaxesForm } from './useEmployeeStateTaxesForm'\nimport styles from './EmployeeStateTaxesView.module.scss'\nimport { BaseLayout } from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ntype ReadyEmployeeStateTaxesForm = Extract<\n ReturnType<typeof useEmployeeStateTaxesForm>,\n { isLoading: false }\n>\n\nexport interface EmployeeStateTaxesViewProps {\n stateTaxes: ReadyEmployeeStateTaxesForm\n onSubmit: () => void | Promise<void>\n actions: ReactNode\n alert?: ReactNode\n className?: string\n}\n\nexport function EmployeeStateTaxesView({\n stateTaxes,\n onSubmit,\n actions,\n alert,\n className,\n}: EmployeeStateTaxesViewProps) {\n const { t } = useTranslation('Employee.StateTaxes')\n const { t: tCommon } = useTranslation('common')\n const Components = useComponentContext()\n const groups = stateTaxes.form.Fields\n\n return (\n <section className={classNames(styles.container, className)}>\n <BaseLayout error={stateTaxes.errorHandling.errors}>\n <SDKFormProvider formHookResult={stateTaxes}>\n <Form onSubmit={onSubmit}>\n {alert}\n\n {groups.map(group => {\n const stateName = tCommon(`statesHash.${group.state}`, group.state)\n return (\n <Fragment key={group.state}>\n <Components.Heading as=\"h2\">\n {t('stateTaxesTitle', { state: stateName })}\n </Components.Heading>\n\n {group.questions.map(({ questionId, Field }) => {\n return <Field key={questionId} />\n })}\n </Fragment>\n )\n })}\n\n {actions}\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n </section>\n )\n}\n"],"names":["EmployeeStateTaxesView","stateTaxes","onSubmit","actions","alert","className","t","useTranslation","tCommon","Components","useComponentContext","groups","jsx","classNames","styles","BaseLayout","SDKFormProvider","jsxs","Form","group","stateName","Fragment","questionId","Field"],"mappings":";;;;;;;;;;AAuBO,SAASA,EAAuB;AAAA,EACrC,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AACF,GAAgC;AAC9B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5C,EAAE,GAAGC,MAAYD,EAAe,QAAQ,GACxCE,IAAaC,EAAA,GACbC,IAASV,EAAW,KAAK;AAE/B,SACE,gBAAAW,EAAC,aAAQ,WAAWC,EAAWC,EAAO,WAAWT,CAAS,GACxD,UAAA,gBAAAO,EAACG,GAAA,EAAW,OAAOd,EAAW,cAAc,QAC1C,UAAA,gBAAAW,EAACI,GAAA,EAAgB,gBAAgBf,GAC/B,UAAA,gBAAAgB,EAACC,KAAK,UAAAhB,GACH,UAAA;AAAA,IAAAE;AAAA,IAEAO,EAAO,IAAI,CAAAQ,MAAS;AACnB,YAAMC,IAAYZ,EAAQ,cAAcW,EAAM,KAAK,IAAIA,EAAM,KAAK;AAClE,+BACGE,GAAA,EACC,UAAA;AAAA,QAAA,gBAAAT,EAACH,EAAW,SAAX,EAAmB,IAAG,MACpB,UAAAH,EAAE,mBAAmB,EAAE,OAAOc,EAAA,CAAW,EAAA,CAC5C;AAAA,QAECD,EAAM,UAAU,IAAI,CAAC,EAAE,YAAAG,GAAY,OAAAC,QAC3B,gBAAAX,EAACW,OAAWD,CAAY,CAChC;AAAA,MAAA,EAAA,GAPYH,EAAM,KAQrB;AAAA,IAEJ,CAAC;AAAA,IAEAhB;AAAA,EAAA,GACH,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -0,0 +1,8 @@
1
+ const n = "_container_18572_1", t = {
2
+ container: n
3
+ };
4
+ export {
5
+ n as container,
6
+ t as default
7
+ };
8
+ //# sourceMappingURL=EmployeeStateTaxesView.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmployeeStateTaxesView.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,8 +1,8 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { useTranslation as r } from "react-i18next";
3
3
  import { useTaxes as s } from "./useTaxes.js";
4
- import "../../../shared/constants.js";
5
4
  import "classnames";
5
+ import "../../../shared/constants.js";
6
6
  import { ActionsLayout as m } from "../../Common/ActionsLayout/ActionsLayout.js";
7
7
  import { useComponentContext as e } from "../../../contexts/ComponentAdapter/useComponentContext.js";
8
8
  const l = () => {
@@ -1,8 +1,8 @@
1
1
  import { jsxs as l, Fragment as a, jsx as r } from "react/jsx-runtime";
2
2
  import { useTranslation as s, Trans as m } from "react-i18next";
3
3
  import { z as t } from "zod";
4
- import "../../../shared/constants.js";
5
4
  import "classnames";
5
+ import "../../../shared/constants.js";
6
6
  import { useComponentContext as u } from "../../../contexts/ComponentAdapter/useComponentContext.js";
7
7
  import { SelectField as d } from "../../Common/Fields/SelectField/SelectField.js";
8
8
  import { RadioGroupField as f } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
@@ -7,7 +7,7 @@ import "../../Base/useBase.js";
7
7
  import "@gusto/embedded-api/models/errors/apierror";
8
8
  import "@gusto/embedded-api/models/errors/gustoembeddederror";
9
9
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
10
- import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
10
+ import "@gusto/embedded-api/models/errors/unprocessableentityerror";
11
11
  import "@gusto/embedded-api/models/errors/httpclienterrors";
12
12
  import "dompurify";
13
13
  import "../../../contexts/LocaleProvider/useLocale.js";
@@ -22,29 +22,29 @@ const K = ({ employeeId: e, companyId: f, dictionary: D }) => {
22
22
  V("Employee.Terminations.TerminateEmployee", D), z("Employee.Terminations.TerminateEmployee");
23
23
  const c = S(), { onEvent: i, baseSubmitHandler: C } = Q(), {
24
24
  data: { employee: u }
25
- } = Y({ employeeId: e }), { data: r } = q({ employeeId: e }), { mutateAsync: O, isPending: A } = b(), { mutateAsync: L, isPending: h } = B(), { mutateAsync: N, isPending: M } = G(), { refetch: _ } = k(
25
+ } = Y({ employeeId: e }), { data: r } = q({ employeeId: e }), { mutateAsync: O, isPending: A } = b(), { mutateAsync: h, isPending: N } = B(), { mutateAsync: M, isPending: _ } = G(), { refetch: R } = k(
26
26
  { companyId: f },
27
27
  { enabled: !1 }
28
28
  );
29
- if (u?.terminated && r.terminationList?.[0])
29
+ if (u?.terminated && r.terminations?.[0])
30
30
  return i(n.EMPLOYEE_TERMINATION_VIEW_SUMMARY, {
31
31
  employeeId: e,
32
- effectiveDate: r.terminationList[0].effectiveDate,
33
- termination: r.terminationList[0]
32
+ effectiveDate: r.terminations[0].effectiveDate,
33
+ termination: r.terminations[0]
34
34
  }), null;
35
- const R = J({
35
+ const L = J({
36
36
  first_name: u?.firstName,
37
37
  last_name: u?.lastName
38
- }), s = r.terminationList?.[0];
38
+ }), s = r.terminations?.[0];
39
39
  return /* @__PURE__ */ y(
40
40
  H,
41
41
  {
42
- employeeName: R,
42
+ employeeName: L,
43
43
  existingTermination: s,
44
44
  onSubmit: async (g) => {
45
45
  const { lastDayOfWork: U, payrollOption: o } = g, m = U.toISOString().split("T")[0];
46
46
  await C({ effectiveDate: m, payrollOption: o }, async () => {
47
- const l = o === "dismissalPayroll", d = s ? await L({
47
+ const l = o === "dismissalPayroll", d = s ? await h({
48
48
  request: {
49
49
  employeeId: e,
50
50
  requestBody: {
@@ -66,12 +66,12 @@ const K = ({ employeeId: e, companyId: f, dictionary: D }) => {
66
66
  let T;
67
67
  if (l)
68
68
  try {
69
- const { data: E } = await _(), w = E?.unprocessedTerminationPayPeriodList?.filter(
69
+ const { data: E } = await R(), w = E?.unprocessedTerminationPayPeriods?.filter(
70
70
  (t) => t.employeeUuid === e
71
71
  ) ?? [], a = [];
72
72
  for (const t of w)
73
73
  if (t.startDate && t.endDate) {
74
- const P = await N({
74
+ const P = await M({
75
75
  request: {
76
76
  companyId: f,
77
77
  requestBody: {
@@ -113,7 +113,7 @@ const K = ({ employeeId: e, companyId: f, dictionary: D }) => {
113
113
  onCancel: () => {
114
114
  i(n.CANCEL);
115
115
  },
116
- isLoading: A || h || M
116
+ isLoading: A || N || _
117
117
  }
118
118
  );
119
119
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TerminateEmployee.js","sources":["../../../../../src/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.tsx"],"sourcesContent":["import { useQueryClient } from '@tanstack/react-query'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport {\n useEmployeeEmploymentsGetTerminationsSuspense,\n invalidateAllEmployeeEmploymentsGetTerminations,\n} from '@gusto/embedded-api/react-query/employeeEmploymentsGetTerminations'\nimport { useEmployeeEmploymentsCreateTerminationMutation } from '@gusto/embedded-api/react-query/employeeEmploymentsCreateTermination'\nimport { useEmployeeEmploymentsUpdateTerminationMutation } from '@gusto/embedded-api/react-query/employeeEmploymentsUpdateTermination'\nimport { usePayrollsCreateOffCycleMutation } from '@gusto/embedded-api/react-query/payrollsCreateOffCycle'\nimport {\n usePaySchedulesGetUnprocessedTerminationPeriods,\n invalidateAllPaySchedulesGetUnprocessedTerminationPeriods,\n} from '@gusto/embedded-api/react-query/paySchedulesGetUnprocessedTerminationPeriods'\nimport { invalidateAllPayrollsList } from '@gusto/embedded-api/react-query/payrollsList'\nimport { OffCycleReason } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport type { PayrollOption } from '../types'\nimport { TerminateEmployeePresentation } from './TerminateEmployeePresentation'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\nexport interface TerminateEmployeeProps extends BaseComponentInterface<'Employee.Terminations.TerminateEmployee'> {\n employeeId: string\n companyId: string\n}\n\nexport interface TerminateEmployeeFormData {\n lastDayOfWork: Date\n payrollOption: PayrollOption\n}\n\nexport function TerminateEmployee(props: TerminateEmployeeProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ employeeId, companyId, dictionary }: TerminateEmployeeProps) => {\n useComponentDictionary('Employee.Terminations.TerminateEmployee', dictionary)\n useI18n('Employee.Terminations.TerminateEmployee')\n\n const queryClient = useQueryClient()\n const { onEvent, baseSubmitHandler } = useBase()\n\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n\n const { data: terminationsData } = useEmployeeEmploymentsGetTerminationsSuspense({ employeeId })\n\n const { mutateAsync: createTermination, isPending: isCreatingTermination } =\n useEmployeeEmploymentsCreateTerminationMutation()\n\n const { mutateAsync: updateTermination, isPending: isUpdatingTermination } =\n useEmployeeEmploymentsUpdateTerminationMutation()\n\n const { mutateAsync: createOffCyclePayroll, isPending: isCreatingPayroll } =\n usePayrollsCreateOffCycleMutation()\n\n const { refetch: fetchTerminationPeriods } = usePaySchedulesGetUnprocessedTerminationPeriods(\n { companyId },\n { enabled: false },\n )\n\n // If employee is already terminated, redirect to summary with existing termination data\n // Don't pass payrollOption to avoid showing the success alert\n if (employee?.terminated && terminationsData.terminationList?.[0]) {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_VIEW_SUMMARY, {\n employeeId,\n effectiveDate: terminationsData.terminationList[0].effectiveDate!,\n termination: terminationsData.terminationList[0],\n })\n return null\n }\n\n const employeeName = firstLastName({\n first_name: employee?.firstName,\n last_name: employee?.lastName,\n })\n\n const existingTermination = terminationsData.terminationList?.[0]\n\n const handleSubmit = async (formData: TerminateEmployeeFormData) => {\n const { lastDayOfWork, payrollOption } = formData\n const effectiveDate = lastDayOfWork.toISOString().split('T')[0]!\n\n await baseSubmitHandler({ effectiveDate, payrollOption }, async () => {\n const runTerminationPayroll = payrollOption === 'dismissalPayroll'\n\n const result = existingTermination\n ? await updateTermination({\n request: {\n employeeId,\n requestBody: {\n version: existingTermination.version!,\n effectiveDate,\n runTerminationPayroll,\n },\n },\n })\n : await createTermination({\n request: {\n employeeId,\n requestBody: {\n effectiveDate,\n runTerminationPayroll,\n },\n },\n })\n\n await invalidateAllEmployeeEmploymentsGetTerminations(queryClient)\n\n let firstPayrollUuid: string | undefined\n\n if (runTerminationPayroll) {\n try {\n const { data: terminationPeriodsData } = await fetchTerminationPeriods()\n\n const employeePeriods =\n terminationPeriodsData?.unprocessedTerminationPayPeriodList?.filter(\n period => period.employeeUuid === employeeId,\n ) ?? []\n\n const createdPayrolls = []\n\n for (const terminationPeriod of employeePeriods) {\n if (terminationPeriod.startDate && terminationPeriod.endDate) {\n const payrollResult = await createOffCyclePayroll({\n request: {\n companyId,\n requestBody: {\n offCycle: true,\n offCycleReason: OffCycleReason.DismissedEmployee,\n startDate: new RFCDate(terminationPeriod.startDate),\n endDate: new RFCDate(terminationPeriod.endDate),\n employeeUuids: [employeeId],\n checkDate: terminationPeriod.checkDate\n ? new RFCDate(terminationPeriod.checkDate)\n : undefined,\n },\n },\n })\n\n if (payrollResult.payrollUnprocessed) {\n createdPayrolls.push(payrollResult.payrollUnprocessed)\n }\n }\n }\n\n if (createdPayrolls.length > 0) {\n firstPayrollUuid = createdPayrolls[0]?.payrollUuid ?? createdPayrolls[0]?.uuid\n\n await invalidateAllPayrollsList(queryClient)\n await invalidateAllPaySchedulesGetUnprocessedTerminationPeriods(queryClient)\n\n onEvent(componentEvents.EMPLOYEE_TERMINATION_PAYROLL_CREATED, {\n payrolls: createdPayrolls,\n })\n }\n } catch (payrollError) {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_PAYROLL_FAILED, {\n error: payrollError,\n employeeId,\n })\n }\n }\n\n const eventType = existingTermination\n ? componentEvents.EMPLOYEE_TERMINATION_UPDATED\n : componentEvents.EMPLOYEE_TERMINATION_CREATED\n\n onEvent(eventType, {\n termination: result.termination,\n payrollOption,\n runTerminationPayroll,\n })\n\n onEvent(componentEvents.EMPLOYEE_TERMINATION_DONE, {\n employeeId,\n effectiveDate,\n payrollOption,\n payrollUuid: firstPayrollUuid,\n termination: result.termination,\n ...(payrollOption === 'anotherWay' && { manualHandling: true }),\n })\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n const isPending = isCreatingTermination || isUpdatingTermination || isCreatingPayroll\n\n return (\n <TerminateEmployeePresentation\n employeeName={employeeName}\n existingTermination={existingTermination}\n onSubmit={handleSubmit}\n onCancel={handleCancel}\n isLoading={isPending}\n />\n )\n}\n"],"names":["TerminateEmployee","props","jsx","BaseComponent","Root","employeeId","companyId","dictionary","useComponentDictionary","useI18n","queryClient","useQueryClient","onEvent","baseSubmitHandler","useBase","employee","useEmployeesGetSuspense","terminationsData","useEmployeeEmploymentsGetTerminationsSuspense","createTermination","isCreatingTermination","useEmployeeEmploymentsCreateTerminationMutation","updateTermination","isUpdatingTermination","useEmployeeEmploymentsUpdateTerminationMutation","createOffCyclePayroll","isCreatingPayroll","usePayrollsCreateOffCycleMutation","fetchTerminationPeriods","usePaySchedulesGetUnprocessedTerminationPeriods","componentEvents","employeeName","firstLastName","existingTermination","TerminateEmployeePresentation","formData","lastDayOfWork","payrollOption","effectiveDate","runTerminationPayroll","result","invalidateAllEmployeeEmploymentsGetTerminations","firstPayrollUuid","terminationPeriodsData","employeePeriods","period","createdPayrolls","terminationPeriod","payrollResult","OffCycleReason","RFCDate","invalidateAllPayrollsList","invalidateAllPaySchedulesGetUnprocessedTerminationPeriods","payrollError","eventType"],"mappings":";;;;;;;;;;;;;;;;;AAmCO,SAASA,GAAkBC,GAA+B;AAC/D,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,IAAO,CAAC,EAAE,YAAAC,GAAY,WAAAC,GAAW,YAAAC,QAAyC;AAC9E,EAAAC,EAAuB,2CAA2CD,CAAU,GAC5EE,EAAQ,yCAAyC;AAEjD,QAAMC,IAAcC,EAAA,GACd,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GAEjC;AAAA,IACJ,MAAM,EAAE,UAAAC,EAAA;AAAA,EAAS,IACfC,EAAwB,EAAE,YAAAX,GAAY,GAEpC,EAAE,MAAMY,EAAA,IAAqBC,EAA8C,EAAE,YAAAb,GAAY,GAEzF,EAAE,aAAac,GAAmB,WAAWC,EAAA,IACjDC,EAAA,GAEI,EAAE,aAAaC,GAAmB,WAAWC,EAAA,IACjDC,EAAA,GAEI,EAAE,aAAaC,GAAuB,WAAWC,EAAA,IACrDC,EA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AA,YACjD,YAAAzB;AAAA,YACA,eAAAiC;AAAA,YACA,eAAAD;AAAA,YACA,aAAaK;AAAA,YACb,aAAaF,EAAO;AAAA,YACpB,GAAIH,MAAkB,gBAAgB,EAAE,gBAAgB,GAAA;AAAA,UAAK,CAC9D;AAAA,QACH,CAAC;AAAA,MACH;AAAA,MAaI,UAXiB,MAAM;AACzB,QAAAzB,EAAQkB,EAAgB,MAAM;AAAA,MAChC;AAAA,MAUI,WARcV,KAAyBG,KAAyBG;AAAA,IAQrD;AAAA,EAAA;AAGjB;"}
1
+ {"version":3,"file":"TerminateEmployee.js","sources":["../../../../../src/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.tsx"],"sourcesContent":["import { useQueryClient } from '@tanstack/react-query'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport {\n useEmployeeEmploymentsGetTerminationsSuspense,\n invalidateAllEmployeeEmploymentsGetTerminations,\n} from '@gusto/embedded-api/react-query/employeeEmploymentsGetTerminations'\nimport { useEmployeeEmploymentsCreateTerminationMutation } from '@gusto/embedded-api/react-query/employeeEmploymentsCreateTermination'\nimport { useEmployeeEmploymentsUpdateTerminationMutation } from '@gusto/embedded-api/react-query/employeeEmploymentsUpdateTermination'\nimport { usePayrollsCreateOffCycleMutation } from '@gusto/embedded-api/react-query/payrollsCreateOffCycle'\nimport {\n usePaySchedulesGetUnprocessedTerminationPeriods,\n invalidateAllPaySchedulesGetUnprocessedTerminationPeriods,\n} from '@gusto/embedded-api/react-query/paySchedulesGetUnprocessedTerminationPeriods'\nimport { invalidateAllPayrollsList } from '@gusto/embedded-api/react-query/payrollsList'\nimport { OffCycleReason } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport type { PayrollOption } from '../types'\nimport { TerminateEmployeePresentation } from './TerminateEmployeePresentation'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\nexport interface TerminateEmployeeProps extends BaseComponentInterface<'Employee.Terminations.TerminateEmployee'> {\n employeeId: string\n companyId: string\n}\n\nexport interface TerminateEmployeeFormData {\n lastDayOfWork: Date\n payrollOption: PayrollOption\n}\n\nexport function TerminateEmployee(props: TerminateEmployeeProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ employeeId, companyId, dictionary }: TerminateEmployeeProps) => {\n useComponentDictionary('Employee.Terminations.TerminateEmployee', dictionary)\n useI18n('Employee.Terminations.TerminateEmployee')\n\n const queryClient = useQueryClient()\n const { onEvent, baseSubmitHandler } = useBase()\n\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n\n const { data: terminationsData } = useEmployeeEmploymentsGetTerminationsSuspense({ employeeId })\n\n const { mutateAsync: createTermination, isPending: isCreatingTermination } =\n useEmployeeEmploymentsCreateTerminationMutation()\n\n const { mutateAsync: updateTermination, isPending: isUpdatingTermination } =\n useEmployeeEmploymentsUpdateTerminationMutation()\n\n const { mutateAsync: createOffCyclePayroll, isPending: isCreatingPayroll } =\n usePayrollsCreateOffCycleMutation()\n\n const { refetch: fetchTerminationPeriods } = usePaySchedulesGetUnprocessedTerminationPeriods(\n { companyId },\n { enabled: false },\n )\n\n // If employee is already terminated, redirect to summary with existing termination data\n // Don't pass payrollOption to avoid showing the success alert\n if (employee?.terminated && terminationsData.terminations?.[0]) {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_VIEW_SUMMARY, {\n employeeId,\n effectiveDate: terminationsData.terminations[0].effectiveDate!,\n termination: terminationsData.terminations[0],\n })\n return null\n }\n\n const employeeName = firstLastName({\n first_name: employee?.firstName,\n last_name: employee?.lastName,\n })\n\n const existingTermination = terminationsData.terminations?.[0]\n\n const handleSubmit = async (formData: TerminateEmployeeFormData) => {\n const { lastDayOfWork, payrollOption } = formData\n const effectiveDate = lastDayOfWork.toISOString().split('T')[0]!\n\n await baseSubmitHandler({ effectiveDate, payrollOption }, async () => {\n const runTerminationPayroll = payrollOption === 'dismissalPayroll'\n\n const result = existingTermination\n ? await updateTermination({\n request: {\n employeeId,\n requestBody: {\n version: existingTermination.version!,\n effectiveDate,\n runTerminationPayroll,\n },\n },\n })\n : await createTermination({\n request: {\n employeeId,\n requestBody: {\n effectiveDate,\n runTerminationPayroll,\n },\n },\n })\n\n await invalidateAllEmployeeEmploymentsGetTerminations(queryClient)\n\n let firstPayrollUuid: string | undefined\n\n if (runTerminationPayroll) {\n try {\n const { data: terminationPeriodsData } = await fetchTerminationPeriods()\n\n const employeePeriods =\n terminationPeriodsData?.unprocessedTerminationPayPeriods?.filter(\n period => period.employeeUuid === employeeId,\n ) ?? []\n\n const createdPayrolls = []\n\n for (const terminationPeriod of employeePeriods) {\n if (terminationPeriod.startDate && terminationPeriod.endDate) {\n const payrollResult = await createOffCyclePayroll({\n request: {\n companyId,\n requestBody: {\n offCycle: true,\n offCycleReason: OffCycleReason.DismissedEmployee,\n startDate: new RFCDate(terminationPeriod.startDate),\n endDate: new RFCDate(terminationPeriod.endDate),\n employeeUuids: [employeeId],\n checkDate: terminationPeriod.checkDate\n ? new RFCDate(terminationPeriod.checkDate)\n : undefined,\n },\n },\n })\n\n if (payrollResult.payrollUnprocessed) {\n createdPayrolls.push(payrollResult.payrollUnprocessed)\n }\n }\n }\n\n if (createdPayrolls.length > 0) {\n firstPayrollUuid = createdPayrolls[0]?.payrollUuid ?? createdPayrolls[0]?.uuid\n\n await invalidateAllPayrollsList(queryClient)\n await invalidateAllPaySchedulesGetUnprocessedTerminationPeriods(queryClient)\n\n onEvent(componentEvents.EMPLOYEE_TERMINATION_PAYROLL_CREATED, {\n payrolls: createdPayrolls,\n })\n }\n } catch (payrollError) {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_PAYROLL_FAILED, {\n error: payrollError,\n employeeId,\n })\n }\n }\n\n const eventType = existingTermination\n ? componentEvents.EMPLOYEE_TERMINATION_UPDATED\n : componentEvents.EMPLOYEE_TERMINATION_CREATED\n\n onEvent(eventType, {\n termination: result.termination,\n payrollOption,\n runTerminationPayroll,\n })\n\n onEvent(componentEvents.EMPLOYEE_TERMINATION_DONE, {\n employeeId,\n effectiveDate,\n payrollOption,\n payrollUuid: firstPayrollUuid,\n termination: result.termination,\n ...(payrollOption === 'anotherWay' && { manualHandling: true }),\n })\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n const isPending = isCreatingTermination || isUpdatingTermination || isCreatingPayroll\n\n return (\n <TerminateEmployeePresentation\n employeeName={employeeName}\n existingTermination={existingTermination}\n onSubmit={handleSubmit}\n onCancel={handleCancel}\n isLoading={isPending}\n />\n )\n}\n"],"names":["TerminateEmployee","props","jsx","BaseComponent","Root","employeeId","companyId","dictionary","useComponentDictionary","useI18n","queryClient","useQueryClient","onEvent","baseSubmitHandler","useBase","employee","useEmployeesGetSuspense","terminationsData","useEmployeeEmploymentsGetTerminationsSuspense","createTermination","isCreatingTermination","useEmployeeEmploymentsCreateTerminationMutation","updateTermination","isUpdatingTermination","useEmployeeEmploymentsUpdateTerminationMutation","createOffCyclePayroll","isCreatingPayroll","usePayrollsCreateOffCycleMutation","fetchTerminationPeriods","usePaySchedulesGetUnprocessedTerminationPeriods","componentEvents","employeeName","firstLastName","existingTermination","TerminateEmployeePresentation","formData","lastDayOfWork","payrollOption","effectiveDate","runTerminationPayroll","result","invalidateAllEmployeeEmploymentsGetTerminations","firstPayrollUuid","terminationPeriodsData","employeePeriods","period","createdPayrolls","terminationPeriod","payrollResult","OffCycleReason","RFCDate","invalidateAllPayrollsList","invalidateAllPaySchedulesGetUnprocessedTerminationPeriods","payrollError","eventType"],"mappings":";;;;;;;;;;;;;;;;;AAmCO,SAASA,GAAkBC,GAA+B;AAC/D,SACE,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BACF,CACD;AAED,kBAAIC,EAAc,sBAChBF,EAAgB,KAAKE,EAAc,kBAAkB;AAAA,gBAEzD;AAGF,cAAIF,EAAgB,SAAS,MAC3BJ,IAAmBI,EAAgB,CAAC,GAAG,eAAeA,EAAgB,CAAC,GAAG,MAE1E,MAAMK,EAA0BzC,CAAW,GAC3C,MAAM0C,EAA0D1C,CAAW,GAE3EE,EAAQkB,EAAgB,sCAAsC;AAAA,gBAC5D,UAAUgB;AAAA,cAAA,CACX;AAAA,YAEL,SAASO,GAAc;AACrB,cAAAzC,EAAQkB,EAAgB,qCAAqC;AAAA,gBAC3D,OAAOuB;AAAA,gBACP,YAAAhD;AAAA,cAAA,CACD;AAAA,YACH;AAGF,gBAAMiD,IAAYrB,IACdH,EAAgB,+BAChBA,EAAgB;AAEpB,UAAAlB,EAAQ0C,GAAW;AAAA,YACjB,aAAad,EAAO;AAAA,YACpB,eAAAH;AAAA,YACA,uBAAAE;AAAA,UAAA,CACD,GAED3B,EAAQkB,EAAgB,2BAA2B;AAAA,YACjD,YAAAzB;AAAA,YACA,eAAAiC;AAAA,YACA,eAAAD;AAAA,YACA,aAAaK;AAAA,YACb,aAAaF,EAAO;AAAA,YACpB,GAAIH,MAAkB,gBAAgB,EAAE,gBAAgB,GAAA;AAAA,UAAK,CAC9D;AAAA,QACH,CAAC;AAAA,MACH;AAAA,MAaI,UAXiB,MAAM;AACzB,QAAAzB,EAAQkB,EAAgB,MAAM;AAAA,MAChC;AAAA,MAUI,WARcV,KAAyBG,KAAyBG;AAAA,IAQrD;AAAA,EAAA;AAGjB;"}
@@ -24,7 +24,7 @@ const W = ({
24
24
  H("Employee.Terminations.TerminationSummary", D), Q("Employee.Terminations.TerminationSummary");
25
25
  const m = b(), { onEvent: t, baseSubmitHandler: d } = z(), [T, a] = I(!1), {
26
26
  data: { employee: s }
27
- } = B({ employeeId: n }), { data: p } = G({ employeeId: n }), { mutateAsync: P, isPending: c } = k(), L = [s?.firstName, s?.lastName].filter(Boolean).join(" "), u = p.terminationList ?? [], e = u.find((Y) => Y.active) ?? u[0], f = e?.effectiveDate, R = e?.cancelable === !0, E = F(f), h = new Date((/* @__PURE__ */ new Date()).toDateString()), N = !s?.terminated && E ? E >= h : !1, y = i === "anotherWay", O = !y && (e?.runTerminationPayroll === !0 || i === "dismissalPayroll"), _ = i !== void 0, g = () => {
27
+ } = B({ employeeId: n }), { data: p } = G({ employeeId: n }), { mutateAsync: P, isPending: c } = k(), R = [s?.firstName, s?.lastName].filter(Boolean).join(" "), u = p.terminations ?? [], e = u.find((Y) => Y.active) ?? u[0], f = e?.effectiveDate, h = e?.cancelable === !0, E = F(f), L = new Date((/* @__PURE__ */ new Date()).toDateString()), N = !s?.terminated && E ? E >= L : !1, y = i === "anotherWay", O = !y && (e?.runTerminationPayroll === !0 || i === "dismissalPayroll"), _ = i !== void 0, g = () => {
28
28
  a(!0);
29
29
  }, A = () => {
30
30
  a(!1);
@@ -61,9 +61,9 @@ const W = ({
61
61
  return e ? /* @__PURE__ */ r(
62
62
  x,
63
63
  {
64
- employeeName: L,
64
+ employeeName: R,
65
65
  effectiveDate: f,
66
- canCancel: R,
66
+ canCancel: h,
67
67
  canEdit: N,
68
68
  showRunPayroll: O,
69
69
  showRunOffCyclePayroll: y,
@@ -1 +1 @@
1
- {"version":3,"file":"TerminationSummary.js","sources":["../../../../../src/components/Employee/Terminations/TerminationSummary/TerminationSummary.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport {\n useEmployeeEmploymentsGetTerminationsSuspense,\n invalidateAllEmployeeEmploymentsGetTerminations,\n} from '@gusto/embedded-api/react-query/employeeEmploymentsGetTerminations'\nimport { useEmployeeEmploymentsDeleteTerminationMutation } from '@gusto/embedded-api/react-query/employeeEmploymentsDeleteTermination'\nimport { invalidateAllEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport type { PayrollOption } from '../types'\nimport { TerminationSummaryPresentation } from './TerminationSummaryPresentation'\nimport { normalizeToDate } from '@/helpers/dateFormatting'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentDictionary, useI18n } from '@/i18n'\n\nexport interface TerminationSummaryProps extends BaseComponentInterface<'Employee.Terminations.TerminationSummary'> {\n employeeId: string\n companyId: string\n payrollOption?: PayrollOption\n payrollUuid?: string\n}\n\nexport function TerminationSummary(props: TerminationSummaryProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({\n employeeId,\n companyId,\n payrollOption,\n payrollUuid,\n dictionary,\n}: TerminationSummaryProps) => {\n useComponentDictionary('Employee.Terminations.TerminationSummary', dictionary)\n useI18n('Employee.Terminations.TerminationSummary')\n\n const queryClient = useQueryClient()\n const { onEvent, baseSubmitHandler } = useBase()\n\n const [isCancelDialogOpen, setIsCancelDialogOpen] = useState(false)\n\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n\n const { data: terminationsData } = useEmployeeEmploymentsGetTerminationsSuspense({ employeeId })\n\n const { mutateAsync: deleteTermination, isPending: isDeleting } =\n useEmployeeEmploymentsDeleteTerminationMutation()\n\n const employeeName = [employee?.firstName, employee?.lastName].filter(Boolean).join(' ')\n\n const terminations = terminationsData.terminationList ?? []\n const termination = terminations.find(t => t.active) ?? terminations[0]\n\n const effectiveDate = termination?.effectiveDate\n const canCancel = termination?.cancelable === true\n const effectiveDateLocal = normalizeToDate(effectiveDate)\n const todayMidnight = new Date(new Date().toDateString())\n const canEdit =\n !employee?.terminated && effectiveDateLocal ? effectiveDateLocal >= todayMidnight : false\n\n const showRunOffCyclePayroll = payrollOption === 'anotherWay'\n const showRunPayroll =\n !showRunOffCyclePayroll &&\n (termination?.runTerminationPayroll === true || payrollOption === 'dismissalPayroll')\n\n // Only show success alert if payrollOption is provided (meaning we just completed the termination)\n // Don't show it if we're just viewing an existing termination (employee already terminated)\n const showSuccessAlert = payrollOption !== undefined\n\n const handleCancelClick = () => {\n setIsCancelDialogOpen(true)\n }\n\n const handleDialogClose = () => {\n setIsCancelDialogOpen(false)\n }\n\n const handleConfirmCancel = async () => {\n if (!termination) return\n\n await baseSubmitHandler({ terminationId: termination.uuid }, async () => {\n await deleteTermination({\n request: {\n employeeId,\n },\n })\n\n await invalidateAllEmployeeEmploymentsGetTerminations(queryClient)\n await invalidateAllEmployeesList(queryClient)\n\n setIsCancelDialogOpen(false)\n\n onEvent(componentEvents.EMPLOYEE_TERMINATION_CANCELLED, {\n employeeId,\n termination,\n })\n })\n }\n\n const handleEditDismissal = () => {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_EDIT, {\n employeeId,\n termination,\n })\n }\n\n const handleRunDismissalPayroll = () => {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_RUN_PAYROLL, {\n employeeId,\n companyId,\n payrollUuid,\n termination,\n })\n }\n\n const handleRunOffCyclePayroll = () => {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_RUN_OFF_CYCLE_PAYROLL, {\n employeeId,\n companyId,\n termination,\n })\n }\n\n if (!termination) {\n return null\n }\n\n return (\n <TerminationSummaryPresentation\n employeeName={employeeName}\n effectiveDate={effectiveDate}\n canCancel={canCancel}\n canEdit={canEdit}\n showRunPayroll={showRunPayroll}\n showRunOffCyclePayroll={showRunOffCyclePayroll}\n showSuccessAlert={showSuccessAlert}\n onCancelClick={handleCancelClick}\n onEditDismissal={handleEditDismissal}\n onRunDismissalPayroll={handleRunDismissalPayroll}\n onRunOffCyclePayroll={handleRunOffCyclePayroll}\n isLoading={isDeleting}\n isCancelDialogOpen={isCancelDialogOpen}\n onDialogClose={handleDialogClose}\n onDialogConfirm={handleConfirmCancel}\n isCancelling={isDeleting}\n />\n )\n}\n"],"names":["TerminationSummary","props","jsx","BaseComponent","Root","employeeId","companyId","payrollOption","payrollUuid","dictionary","useComponentDictionary","useI18n","queryClient","useQueryClient","onEvent","baseSubmitHandler","useBase","isCancelDialogOpen","setIsCancelDialogOpen","useState","employee","useEmployeesGetSuspense","terminationsData","useEmployeeEmploymentsGetTerminationsSuspense","deleteTermination","isDeleting","useEmployeeEmploymentsDeleteTerminationMutation","employeeName","terminations","termination","t","effectiveDate","canCancel","effectiveDateLocal","normalizeToDate","todayMidnight","canEdit","showRunOffCyclePayroll","showRunPayroll","showSuccessAlert","handleCancelClick","handleDialogClose","handleConfirmCancel","invalidateAllEmployeeEmploymentsGetTerminations","invalidateAllEmployeesList","componentEvents","handleEditDismissal","handleRunDismissalPayroll","handleRunOffCyclePayroll","TerminationSummaryPresentation"],"mappings":";;;;;;;;;;;;;AAyBO,SAASA,GAAmBC,GAAgC;AACjE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,IAAO,CAAC;AAAA,EACZ,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AACF,MAA+B;AAC7B,EAAAC,EAAuB,4CAA4CD,CAAU,GAC7EE,EAAQ,0CAA0C;AAElD,QAAMC,IAAcC,EAAA,GACd,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GAEjC,CAACC,GAAoBC,CAAqB,IAAIC,EAAS,EAAK,GAE5D;AAAA,IACJ,MAAM,EAAE,UAAAC,EAAA;AAAA,EAAS,IACfC,EAAwB,EAAE,YAAAhB,GAAY,GAEpC,EAAE,MAAMiB,EAAA,IAAqBC,EAA8C,EAAE,YAAAlB,GAAY,GAEzF,EAAE,aAAamB,GAAmB,WAAWC,EAAA,IACjDC,EAAA,GAEIC,IAAe,CAACP,GAAU,WAAWA,GAAU,QAAQ,EAAE,OAAO,OAA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AA2B,MAAM;AACrC,IAAAlC,EAAQ+B,EAAgB,4CAA4C;AAAA,MAClE,YAAAxC;AAAA,MACA,WAAAC;AAAA,MACA,aAAAuB;AAAA,IAAA,CACD;AAAA,EACH;AAEA,SAAKA,IAKH,gBAAA3B;AAAA,IAAC+C;AAAA,IAAA;AAAA,MACC,cAAAtB;AAAA,MACA,eAAAI;AAAA,MACA,WAAAC;AAAA,MACA,SAAAI;AAAA,MACA,gBAAAE;AAAA,MACA,wBAAAD;AAAA,MACA,kBAAAE;AAAA,MACA,eAAeC;AAAA,MACf,iBAAiBM;AAAA,MACjB,uBAAuBC;AAAA,MACvB,sBAAsBC;AAAA,MACtB,WAAWvB;AAAA,MACX,oBAAAR;AAAA,MACA,eAAewB;AAAA,MACf,iBAAiBC;AAAA,MACjB,cAAcjB;AAAA,IAAA;AAAA,EAAA,IApBT;AAuBX;"}
1
+ {"version":3,"file":"TerminationSummary.js","sources":["../../../../../src/components/Employee/Terminations/TerminationSummary/TerminationSummary.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport {\n useEmployeeEmploymentsGetTerminationsSuspense,\n invalidateAllEmployeeEmploymentsGetTerminations,\n} from '@gusto/embedded-api/react-query/employeeEmploymentsGetTerminations'\nimport { useEmployeeEmploymentsDeleteTerminationMutation } from '@gusto/embedded-api/react-query/employeeEmploymentsDeleteTermination'\nimport { invalidateAllEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport type { PayrollOption } from '../types'\nimport { TerminationSummaryPresentation } from './TerminationSummaryPresentation'\nimport { normalizeToDate } from '@/helpers/dateFormatting'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentDictionary, useI18n } from '@/i18n'\n\nexport interface TerminationSummaryProps extends BaseComponentInterface<'Employee.Terminations.TerminationSummary'> {\n employeeId: string\n companyId: string\n payrollOption?: PayrollOption\n payrollUuid?: string\n}\n\nexport function TerminationSummary(props: TerminationSummaryProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({\n employeeId,\n companyId,\n payrollOption,\n payrollUuid,\n dictionary,\n}: TerminationSummaryProps) => {\n useComponentDictionary('Employee.Terminations.TerminationSummary', dictionary)\n useI18n('Employee.Terminations.TerminationSummary')\n\n const queryClient = useQueryClient()\n const { onEvent, baseSubmitHandler } = useBase()\n\n const [isCancelDialogOpen, setIsCancelDialogOpen] = useState(false)\n\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n\n const { data: terminationsData } = useEmployeeEmploymentsGetTerminationsSuspense({ employeeId })\n\n const { mutateAsync: deleteTermination, isPending: isDeleting } =\n useEmployeeEmploymentsDeleteTerminationMutation()\n\n const employeeName = [employee?.firstName, employee?.lastName].filter(Boolean).join(' ')\n\n const terminations = terminationsData.terminations ?? []\n const termination = terminations.find(t => t.active) ?? terminations[0]\n\n const effectiveDate = termination?.effectiveDate\n const canCancel = termination?.cancelable === true\n const effectiveDateLocal = normalizeToDate(effectiveDate)\n const todayMidnight = new Date(new Date().toDateString())\n const canEdit =\n !employee?.terminated && effectiveDateLocal ? effectiveDateLocal >= todayMidnight : false\n\n const showRunOffCyclePayroll = payrollOption === 'anotherWay'\n const showRunPayroll =\n !showRunOffCyclePayroll &&\n (termination?.runTerminationPayroll === true || payrollOption === 'dismissalPayroll')\n\n // Only show success alert if payrollOption is provided (meaning we just completed the termination)\n // Don't show it if we're just viewing an existing termination (employee already terminated)\n const showSuccessAlert = payrollOption !== undefined\n\n const handleCancelClick = () => {\n setIsCancelDialogOpen(true)\n }\n\n const handleDialogClose = () => {\n setIsCancelDialogOpen(false)\n }\n\n const handleConfirmCancel = async () => {\n if (!termination) return\n\n await baseSubmitHandler({ terminationId: termination.uuid }, async () => {\n await deleteTermination({\n request: {\n employeeId,\n },\n })\n\n await invalidateAllEmployeeEmploymentsGetTerminations(queryClient)\n await invalidateAllEmployeesList(queryClient)\n\n setIsCancelDialogOpen(false)\n\n onEvent(componentEvents.EMPLOYEE_TERMINATION_CANCELLED, {\n employeeId,\n termination,\n })\n })\n }\n\n const handleEditDismissal = () => {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_EDIT, {\n employeeId,\n termination,\n })\n }\n\n const handleRunDismissalPayroll = () => {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_RUN_PAYROLL, {\n employeeId,\n companyId,\n payrollUuid,\n termination,\n })\n }\n\n const handleRunOffCyclePayroll = () => {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_RUN_OFF_CYCLE_PAYROLL, {\n employeeId,\n companyId,\n termination,\n })\n }\n\n if (!termination) {\n return null\n }\n\n return (\n <TerminationSummaryPresentation\n employeeName={employeeName}\n effectiveDate={effectiveDate}\n canCancel={canCancel}\n canEdit={canEdit}\n showRunPayroll={showRunPayroll}\n showRunOffCyclePayroll={showRunOffCyclePayroll}\n showSuccessAlert={showSuccessAlert}\n onCancelClick={handleCancelClick}\n onEditDismissal={handleEditDismissal}\n onRunDismissalPayroll={handleRunDismissalPayroll}\n onRunOffCyclePayroll={handleRunOffCyclePayroll}\n isLoading={isDeleting}\n isCancelDialogOpen={isCancelDialogOpen}\n onDialogClose={handleDialogClose}\n onDialogConfirm={handleConfirmCancel}\n isCancelling={isDeleting}\n />\n )\n}\n"],"names":["TerminationSummary","props","jsx","BaseComponent","Root","employeeId","companyId","payrollOption","payrollUuid","dictionary","useComponentDictionary","useI18n","queryClient","useQueryClient","onEvent","baseSubmitHandler","useBase","isCancelDialogOpen","setIsCancelDialogOpen","useState","employee","useEmployeesGetSuspense","terminationsData","useEmployeeEmploymentsGetTerminationsSuspense","deleteTermination","isDeleting","useEmployeeEmploymentsDeleteTerminationMutation","employeeName","terminations","termination","t","effectiveDate","canCancel","effectiveDateLocal","normalizeToDate","todayMidnight","canEdit","showRunOffCyclePayroll","showRunPayroll","showSuccessAlert","handleCancelClick","handleDialogClose","handleConfirmCancel","invalidateAllEmployeeEmploymentsGetTerminations","invalidateAllEmployeesList","componentEvents","handleEditDismissal","handleRunDismissalPayroll","handleRunOffCyclePayroll","TerminationSummaryPresentation"],"mappings":";;;;;;;;;;;;;AAyBO,SAASA,GAAmBC,GAAgC;AACjE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,IAAO,CAAC;AAAA,EACZ,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AACF,MAA+B;AAC7B,EAAAC,EAAuB,4CAA4CD,CAAU,GAC7EE,EAAQ,0CAA0C;AAElD,QAAMC,IAAcC,EAAA,GACd,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GAEjC,CAACC,GAAoBC,CAAqB,IAAIC,EAAS,EAAK,GAE5D;AAAA,IACJ,MAAM,EAAE,UAAAC,EAAA;AAAA,EAAS,IACfC,EAAwB,EAAE,YAAAhB,GAAY,GAEpC,EAAE,MAAMiB,EAAA,IAAqBC,EAA8C,EAAE,YAAAlB,GAAY,GAEzF,EAAE,aAAamB,GAAmB,WAAWC,EAAA,IACjDC,EAAA,GAEIC,IAAe,CAACP,GAAU,WAAWA,GAAU,QAAQ,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAEjFQ,IAAeN,EAAiB,gBAAgB,CAAA,GAChDO,IAAcD,EAAa,KAAK,CAAAE,MAAKA,EAAE,MAAM,KAAKF,EAAa,CAAC,GAEhEG,IAAgBF,GAAa,eAC7BG,IAAYH,GAAa,eAAe,IACxCI,IAAqBC,EAAgBH,CAAa,GAClDI,IAAgB,IAAI,0BAAS,KAAA,GAAO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AA,MACA,SAAAI;AAAA,MACA,gBAAAE;AAAA,MACA,wBAAAD;AAAA,MACA,kBAAAE;AAAA,MACA,eAAeC;AAAA,MACf,iBAAiBM;AAAA,MACjB,uBAAuBC;AAAA,MACvB,sBAAsBC;AAAA,MACtB,WAAWvB;AAAA,MACX,oBAAAR;AAAA,MACA,eAAewB;AAAA,MACf,iBAAiBC;AAAA,MACjB,cAAcjB;AAAA,IAAA;AAAA,EAAA,IApBT;AAuBX;"}
@@ -8,11 +8,11 @@ import { useIsMutating as K } from "@tanstack/react-query";
8
8
  import { useInformationRequestsGetInformationRequestsSuspense as _ } from "@gusto/embedded-api/react-query/informationRequestsGetInformationRequests";
9
9
  import { useInformationRequestsSubmitMutation as V, mutationKeyInformationRequestsSubmit as X } from "@gusto/embedded-api/react-query/informationRequestsSubmit";
10
10
  import { ResponseType as u } from "@gusto/embedded-api/models/components/informationrequest";
11
- import { ResponseType as b } from "@gusto/embedded-api/models/operations/submitinformationrequest";
12
- import r from "./InformationRequestForm.module.scss.js";
11
+ import { ResponseType as U } from "@gusto/embedded-api/models/operations/submitinformationrequest";
12
+ import i from "./InformationRequestForm.module.scss.js";
13
13
  import { BaseComponent as Y } from "../../Base/Base.js";
14
14
  import { useBase as $ } from "../../Base/useBase.js";
15
- import { Flex as T } from "../../Common/Flex/Flex.js";
15
+ import { Flex as q } from "../../Common/Flex/Flex.js";
16
16
  import "classnames";
17
17
  import { informationRequestEvents as P } from "../../../shared/constants.js";
18
18
  import { FileInputField as J } from "../../Common/Fields/FileInputField/FileInputField.js";
@@ -24,39 +24,37 @@ import { TextInputField as te } from "../../Common/Fields/TextInputField/TextInp
24
24
  const M = "gusto-sdk-information-request-form", oe = ["image/jpeg", "image/png", "application/pdf"], se = {
25
25
  ALLOWED_TAGS: ["a", "b", "strong"],
26
26
  ALLOWED_ATTR: ["target", "href", "rel"]
27
- }, re = 5e3, ie = f.record(
27
+ }, ie = 5e3, re = f.record(
28
28
  f.string(),
29
29
  f.union([f.string().min(1), f.instanceof(File)])
30
30
  );
31
31
  function ae(o) {
32
32
  return /* @__PURE__ */ e(Y, { ...o, children: /* @__PURE__ */ e(le, { ...o, children: o.children }) });
33
33
  }
34
- const ue = (o) => new Promise((s, i) => {
34
+ const ue = (o) => new Promise((s, r) => {
35
35
  const n = new FileReader();
36
36
  n.onload = () => {
37
37
  s(n.result);
38
- }, n.onerror = i, n.readAsDataURL(o);
38
+ }, n.onerror = r, n.readAsDataURL(o);
39
39
  }), me = [u.Text, u.Document];
40
40
  function O(o) {
41
- return o.some(
42
- (s) => s.responseType && !me.includes(s.responseType)
43
- );
41
+ return o.some((s) => !me.includes(s.responseType));
44
42
  }
45
43
  function ce(o) {
46
44
  return o.some((s) => s.responseType === u.Persona);
47
45
  }
48
- function le({ companyId: o, requestId: s, dictionary: i }) {
49
- ee("InformationRequests.InformationRequestForm", i), C("InformationRequests.InformationRequestForm");
50
- const { t: n } = D("InformationRequests.InformationRequestForm"), { Alert: y, Heading: q, Text: m } = A(), { onEvent: g, baseSubmitHandler: I } = $(), { data: U } = _({
46
+ function le({ companyId: o, requestId: s, dictionary: r }) {
47
+ ee("InformationRequests.InformationRequestForm", r), C("InformationRequests.InformationRequestForm");
48
+ const { t: n } = D("InformationRequests.InformationRequestForm"), { Alert: T, Heading: y, Text: m } = A(), { onEvent: g, baseSubmitHandler: I } = $(), { data: x } = _({
51
49
  companyUuid: o
52
- }), l = U.informationRequestList?.find((t) => t.uuid === s), a = l?.requiredQuestions ?? [], F = l?.blockingPayroll ?? !1, w = O(a), x = ce(a), { mutateAsync: L } = V(), v = {}, E = [];
50
+ }), l = x.informationRequests?.find((t) => t.uuid === s), a = l?.requiredQuestions ?? [], F = l?.blockingPayroll ?? !1, w = O(a), N = ce(a), { mutateAsync: Q } = V(), v = {}, E = [];
53
51
  a.forEach((t) => {
54
- !t.questionUuid || !t.responseType || (t.responseType === u.Text ? (E.push(t.questionUuid), v[t.questionUuid] = "") : t.responseType === u.Document && (E.push(t.questionUuid), v[t.questionUuid] = void 0));
52
+ t.responseType === u.Text ? (E.push(t.questionUuid), v[t.questionUuid] = "") : t.responseType === u.Document && (E.push(t.questionUuid), v[t.questionUuid] = void 0);
55
53
  });
56
- const N = W({
57
- resolver: G(ie),
54
+ const b = W({
55
+ resolver: G(re),
58
56
  defaultValues: v
59
- }), Q = async (t) => {
57
+ }), L = async (t) => {
60
58
  await I(t, async () => {
61
59
  const h = (await Promise.all(
62
60
  E.map(async (p) => {
@@ -64,21 +62,21 @@ function le({ companyId: o, requestId: s, dictionary: i }) {
64
62
  if (typeof d == "string")
65
63
  return {
66
64
  questionUuid: p,
67
- responseType: b.Text,
65
+ responseType: U.Text,
68
66
  textResponse: d
69
67
  };
70
68
  if (d instanceof File) {
71
69
  const z = await ue(d);
72
70
  return {
73
71
  questionUuid: p,
74
- responseType: b.Document,
72
+ responseType: U.Document,
75
73
  fileResponse: z,
76
74
  fileName: d.name
77
75
  };
78
76
  }
79
77
  return null;
80
78
  })
81
- )).filter((p) => p !== null), S = await L({
79
+ )).filter((p) => p !== null), S = await Q({
82
80
  request: {
83
81
  informationRequestUuid: s,
84
82
  requestBody: {
@@ -89,33 +87,32 @@ function le({ companyId: o, requestId: s, dictionary: i }) {
89
87
  g(P.INFORMATION_REQUEST_FORM_DONE, S.informationRequest);
90
88
  });
91
89
  }, k = (t) => {
92
- if (!t.questionUuid || !t.responseType) return null;
93
90
  const R = t.questionUuid, h = t.responseType === u.Document, S = t.responseType === u.Text;
94
- return /* @__PURE__ */ c("div", { className: r.questionCard, children: [
95
- /* @__PURE__ */ c("div", { className: r.questionDescription, children: [
91
+ return /* @__PURE__ */ c("div", { className: i.questionCard, children: [
92
+ /* @__PURE__ */ c("div", { className: i.questionDescription, children: [
96
93
  /* @__PURE__ */ e(m, { size: "sm", weight: "medium", children: n(h ? "questionTypes.document" : "questionTypes.answer") }),
97
94
  /* @__PURE__ */ e(m, { size: "sm", variant: "supporting", children: /* @__PURE__ */ e(
98
95
  "span",
99
96
  {
100
97
  dangerouslySetInnerHTML: {
101
- __html: B.sanitize(t.questionText ?? "", se)
98
+ __html: B.sanitize(t.questionText, se)
102
99
  }
103
100
  }
104
101
  ) })
105
102
  ] }),
106
- /* @__PURE__ */ e("hr", { className: r.divider }),
107
- S && /* @__PURE__ */ e("div", { className: r.textInputWrapper, children: /* @__PURE__ */ e(
103
+ /* @__PURE__ */ e("hr", { className: i.divider }),
104
+ S && /* @__PURE__ */ e("div", { className: i.textInputWrapper, children: /* @__PURE__ */ e(
108
105
  te,
109
106
  {
110
107
  name: R,
111
108
  label: n("fields.textAnswer.label"),
112
109
  placeholder: n("fields.textAnswer.placeholder"),
113
- maxLength: re,
110
+ maxLength: ie,
114
111
  isRequired: !0,
115
112
  errorMessage: n("validation.required")
116
113
  }
117
114
  ) }),
118
- h && /* @__PURE__ */ e("div", { className: r.fileInputWrapper, children: /* @__PURE__ */ e(
115
+ h && /* @__PURE__ */ e("div", { className: i.fileInputWrapper, children: /* @__PURE__ */ e(
119
116
  J,
120
117
  {
121
118
  name: R,
@@ -126,37 +123,35 @@ function le({ companyId: o, requestId: s, dictionary: i }) {
126
123
  }
127
124
  ) })
128
125
  ] }, R);
129
- }, j = /* @__PURE__ */ c("div", { className: r.questionCard, children: [
130
- /* @__PURE__ */ c("div", { className: r.questionDescription, children: [
131
- /* @__PURE__ */ e(m, { weight: "medium", children: n(x ? "unsupported.persona.title" : "unsupported.generic.title") }),
126
+ }, j = /* @__PURE__ */ c("div", { className: i.questionCard, children: [
127
+ /* @__PURE__ */ c("div", { className: i.questionDescription, children: [
128
+ /* @__PURE__ */ e(m, { weight: "medium", children: n(N ? "unsupported.persona.title" : "unsupported.generic.title") }),
132
129
  /* @__PURE__ */ e(m, { children: n(
133
- x ? "unsupported.persona.description" : "unsupported.generic.description"
130
+ N ? "unsupported.persona.description" : "unsupported.generic.description"
134
131
  ) })
135
132
  ] }),
136
- /* @__PURE__ */ e("hr", { className: r.divider }),
137
- /* @__PURE__ */ e("div", { className: r.contactSupport, children: /* @__PURE__ */ e(m, { variant: "supporting", children: n("unsupported.contactSupport") }) })
133
+ /* @__PURE__ */ e("hr", { className: i.divider }),
134
+ /* @__PURE__ */ e("div", { className: i.contactSupport, children: /* @__PURE__ */ e(m, { variant: "supporting", children: n("unsupported.contactSupport") }) })
138
135
  ] });
139
- return /* @__PURE__ */ e("div", { className: r.root, children: /* @__PURE__ */ c(T, { flexDirection: "column", gap: 16, children: [
140
- /* @__PURE__ */ e(q, { as: "h2", children: n("title") }),
141
- F && /* @__PURE__ */ e(y, { status: "error", label: n("blockingAlert.title"), disableScrollIntoView: !0, children: n("blockingAlert.description") }),
142
- w ? j : /* @__PURE__ */ e(H, { ...N, children: /* @__PURE__ */ e(Z, { id: M, onSubmit: N.handleSubmit(Q), children: /* @__PURE__ */ e(T, { flexDirection: "column", gap: 16, children: a.map(k) }) }) })
136
+ return /* @__PURE__ */ e("div", { className: i.root, children: /* @__PURE__ */ c(q, { flexDirection: "column", gap: 16, children: [
137
+ /* @__PURE__ */ e(y, { as: "h2", children: n("title") }),
138
+ F && /* @__PURE__ */ e(T, { status: "error", label: n("blockingAlert.title"), disableScrollIntoView: !0, children: n("blockingAlert.description") }),
139
+ w ? j : /* @__PURE__ */ e(H, { ...b, children: /* @__PURE__ */ e(Z, { id: M, onSubmit: b.handleSubmit(L), children: /* @__PURE__ */ e(q, { flexDirection: "column", gap: 16, children: a.map(k) }) }) })
143
140
  ] }) });
144
141
  }
145
142
  const pe = ({ onEvent: o }) => {
146
143
  C("InformationRequests.InformationRequestForm");
147
- const { t: s } = D("InformationRequests.InformationRequestForm"), { Button: i } = A(), { companyId: n, selectedRequestId: y } = ne(), { data: q } = _({
144
+ const { t: s } = D("InformationRequests.InformationRequestForm"), { Button: r } = A(), { companyId: n, selectedRequestId: T } = ne(), { data: y } = _({
148
145
  companyUuid: n
149
- }), g = q.informationRequestList?.find(
150
- (F) => F.uuid === y
151
- )?.requiredQuestions ?? [], I = O(g), l = K({
146
+ }), g = y.informationRequests?.find((F) => F.uuid === T)?.requiredQuestions ?? [], I = O(g), l = K({
152
147
  mutationKey: X()
153
148
  }) > 0, a = () => {
154
149
  o(P.INFORMATION_REQUEST_FORM_CANCEL);
155
150
  };
156
- return I ? /* @__PURE__ */ e(T, { justifyContent: "flex-end", gap: 12, children: /* @__PURE__ */ e(i, { variant: "secondary", onClick: a, children: s("cta.close") }) }) : /* @__PURE__ */ c(T, { justifyContent: "flex-end", gap: 12, children: [
157
- /* @__PURE__ */ e(i, { variant: "secondary", onClick: a, isDisabled: l, children: s("cta.cancel") }),
151
+ return I ? /* @__PURE__ */ e(q, { justifyContent: "flex-end", gap: 12, children: /* @__PURE__ */ e(r, { variant: "secondary", onClick: a, children: s("cta.close") }) }) : /* @__PURE__ */ c(q, { justifyContent: "flex-end", gap: 12, children: [
152
+ /* @__PURE__ */ e(r, { variant: "secondary", onClick: a, isDisabled: l, children: s("cta.cancel") }),
158
153
  /* @__PURE__ */ e(
159
- i,
154
+ r,
160
155
  {
161
156
  variant: "primary",
162
157
  type: "submit",