@gusto/embedded-react-sdk 0.12.3 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/_virtual/dynamic-import-helper.js +8 -1
- package/dist/_virtual/dynamic-import-helper.js.map +1 -1
- package/dist/assets/icons/spinner_small.svg.js +10 -0
- package/dist/assets/icons/spinner_small.svg.js.map +1 -0
- package/dist/components/Base/Base.js +28 -27
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Base/useBase.d.ts +2 -0
- package/dist/components/Base/useBase.js.map +1 -1
- package/dist/components/Common/DataView/DataView.d.ts +2 -1
- package/dist/components/Common/DataView/DataView.js +20 -19
- package/dist/components/Common/DataView/DataView.js.map +1 -1
- package/dist/components/Common/DataView/useDataView.d.ts +3 -1
- package/dist/components/Common/DataView/useDataView.js +13 -11
- package/dist/components/Common/DataView/useDataView.js.map +1 -1
- package/dist/components/Common/EmptyData/EmptyData.module.scss.js +1 -1
- package/dist/components/Common/FieldDescription/FieldDescription.js +7 -14
- package/dist/components/Common/FieldDescription/FieldDescription.js.map +1 -1
- package/dist/components/Common/Fields/hooks/useField.d.ts +4 -1
- package/dist/components/Common/Fields/hooks/useField.js +31 -24
- package/dist/components/Common/Fields/hooks/useField.js.map +1 -1
- package/dist/components/Common/InlineSpinner/InlineSpinner.d.ts +6 -0
- package/dist/components/Common/InlineSpinner/InlineSpinner.js +25 -0
- package/dist/components/Common/InlineSpinner/InlineSpinner.js.map +1 -0
- package/dist/components/Common/InlineSpinner/InlineSpinner.module.scss.js +10 -0
- package/dist/components/Common/InlineSpinner/InlineSpinner.module.scss.js.map +1 -0
- package/dist/components/Common/InlineSpinner/index.d.ts +2 -0
- package/dist/components/Common/PaginationControl/PaginationControl.js +31 -28
- package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
- package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +1 -0
- package/dist/components/Common/SignatureForm/SignatureForm.js +1 -1
- package/dist/components/Common/UI/CalendarPreview/CalendarPreview.js +1 -1
- package/dist/components/Common/UI/DatePicker/DatePicker.js +1 -1
- package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
- package/dist/components/Common/UI/Tabs/Tabs.d.ts +7 -0
- package/dist/components/Common/UI/Tabs/Tabs.js +25 -0
- package/dist/components/Common/UI/Tabs/Tabs.js.map +1 -0
- package/dist/components/Common/UI/Tabs/Tabs.module.scss.js +8 -0
- package/dist/components/Common/UI/Tabs/Tabs.module.scss.js.map +1 -0
- package/dist/components/Common/UI/Tabs/TabsTypes.d.ts +51 -0
- package/dist/components/Common/UI/Tabs/index.d.ts +3 -0
- package/dist/components/Common/hooks/useNumberFormatter.js +1 -1
- package/dist/components/Common/index.d.ts +1 -0
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +5 -5
- package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.d.ts +2 -2
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +9 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +4 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +9 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +11 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccount.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +2 -2
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +9 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +2 -2
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +9 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentSigner.js +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +3 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +9 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +3 -3
- package/dist/components/Company/FederalTaxes/Form.js +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +18 -12
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +12 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Industry.js +2 -2
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +4 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +9 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +9 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +9 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +5 -5
- package/dist/components/Company/PaySchedule/usePaySchedule.js +12 -6
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +3 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +9 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +9 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +4 -4
- package/dist/components/Contractor/Address/useAddress.js +11 -5
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.js +1 -1
- package/dist/components/Contractor/ContractorList/useContractorList.js +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +52 -50
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/types.d.ts +1 -0
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js +19 -12
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js +6 -5
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +4 -4
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +7 -7
- package/dist/components/Contractor/Profile/ContractorProfile.js +1 -1
- package/dist/components/Contractor/Profile/useContractorProfile.d.ts +19 -19
- package/dist/components/Contractor/Profile/useContractorProfile.js +40 -35
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +25 -25
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Employee/Compensation/Compensation.js +10 -10
- package/dist/components/Employee/Deductions/Deductions.js +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +4 -4
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +2 -2
- package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +9 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +3 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +9 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +75 -62
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +27 -25
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +1 -0
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +9 -3
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalTaxes.js +3 -3
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +9 -3
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +2 -2
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +2 -2
- package/dist/components/Employee/PaymentMethod/BankAccount.d.ts +2 -2
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +8 -8
- package/dist/components/Employee/PaymentMethod/Split.js +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +8 -8
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +15 -9
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +2 -2
- package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +2 -2
- package/dist/components/Employee/Profile/Profile.js +15 -13
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +9 -3
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/StateTaxes.js +3 -3
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +9 -3
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +5 -5
- package/dist/components/Employee/Taxes/useTaxes.js +9 -3
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +4 -2
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +69 -33
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +10 -5
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +119 -50
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.d.ts +5 -2
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +64 -13
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +18 -2
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +117 -18
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.d.ts +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +24 -11
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +8 -6
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +35 -26
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +42 -35
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/RunPayrollFlow/RunPayroll.d.ts +2 -1
- package/dist/components/Payroll/RunPayrollFlow/RunPayroll.js +4 -4
- package/dist/components/Payroll/RunPayrollFlow/RunPayroll.js.map +1 -1
- package/dist/components/Payroll/helpers.d.ts +21 -0
- package/dist/components/Payroll/helpers.js +209 -0
- package/dist/components/Payroll/helpers.js.map +1 -0
- package/dist/components/Payroll/helpers.test.d.ts +1 -0
- package/dist/components/Payroll/usePreparedPayrollData.d.ts +14 -0
- package/dist/components/Payroll/usePreparedPayrollData.js +39 -0
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -0
- package/dist/contexts/ApiProvider/ApiProvider.js +4 -4
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +28 -26
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +3 -2
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/helpers/formattedStrings.d.ts +9 -0
- package/dist/helpers/formattedStrings.js +55 -16
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/i18n/I18n.js +15 -15
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +32 -0
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +20 -0
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PayrollList.json.js +14 -0
- package/dist/i18n/en/Payroll.PayrollList.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +18 -0
- package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -0
- package/dist/i18n/en/common.json.d.ts +8 -0
- package/dist/i18n/en/common.json.js +15 -13
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/shared/constants.d.ts +6 -0
- package/dist/shared/constants.js +43 -34
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +96 -1
- package/package.json +27 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEmployeeList.js","sources":["../../../../src/components/Employee/EmployeeList/useEmployeeList.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { OnboardingStatus } from '@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus'\nimport { createCompoundContext } from '@/components/Base'\n\n//Interface for context passed down to component slots\ntype EmployeeListContextType = {\n handleEdit: (uuid: string, onboardingStatus?: OnboardingStatus) => void\n handleDelete: (uuid: string) => Promise<void>\n handleCancelSelfOnboarding: (employeeId: string) => Promise<void>\n handleReview: (employeeId: string) => Promise<void>\n handleNew: () => void\n handleSkip: () => void\n handleFirstPage: () => void\n handlePreviousPage: () => void\n handleNextPage: () => void\n handleLastPage: () => void\n handleItemsPerPageChange: (newCount: number) => void\n currentPage: number\n totalPages: number\n employees: Employee[]\n}\n\nconst [useEmployeeList, EmployeeListProvider] =\n createCompoundContext<EmployeeListContextType>('EmployeeListContext')\nexport { useEmployeeList, EmployeeListProvider }\n"],"names":["useEmployeeList","EmployeeListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useEmployeeList.js","sources":["../../../../src/components/Employee/EmployeeList/useEmployeeList.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { OnboardingStatus } from '@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus'\nimport { createCompoundContext } from '@/components/Base'\n\n//Interface for context passed down to component slots\ntype EmployeeListContextType = {\n handleEdit: (uuid: string, onboardingStatus?: OnboardingStatus) => void\n handleDelete: (uuid: string) => Promise<void>\n handleCancelSelfOnboarding: (employeeId: string) => Promise<void>\n handleReview: (employeeId: string) => Promise<void>\n handleNew: () => void\n handleSkip: () => void\n handleFirstPage: () => void\n handlePreviousPage: () => void\n handleNextPage: () => void\n handleLastPage: () => void\n handleItemsPerPageChange: (newCount: number) => void\n currentPage: number\n totalPages: number\n employees: Employee[]\n isFetching: boolean\n}\n\nconst [useEmployeeList, EmployeeListProvider] =\n createCompoundContext<EmployeeListContextType>('EmployeeListContext')\nexport { useEmployeeList, EmployeeListProvider }\n"],"names":["useEmployeeList","EmployeeListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAuBA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as o, jsxs as b, Fragment as S } from "react/jsx-runtime";
|
|
2
|
-
import { zodResolver as v } from "
|
|
2
|
+
import { zodResolver as v } from "@hookform/resolvers/zod";
|
|
3
3
|
import { useForm as A, FormProvider as g } from "react-hook-form";
|
|
4
4
|
import { useEffect as D } from "react";
|
|
5
|
-
import { useEmployeeTaxSetupGetFederalTaxesSuspense as w } from "
|
|
6
|
-
import { useEmployeeTaxSetupUpdateFederalTaxesMutation as _ } from "
|
|
5
|
+
import { useEmployeeTaxSetupGetFederalTaxesSuspense as w } from "@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes";
|
|
6
|
+
import { useEmployeeTaxSetupUpdateFederalTaxesMutation as _ } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes";
|
|
7
7
|
import { FederalFormSchema as N, FederalForm as P } from "./FederalForm.js";
|
|
8
8
|
import { Head as I } from "./Head.js";
|
|
9
9
|
import { Actions as R } from "./Actions.js";
|
|
@@ -2,15 +2,21 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-error-boundary";
|
|
4
4
|
import "react-i18next";
|
|
5
|
+
import "@gusto/embedded-api/models/errors/apierror";
|
|
6
|
+
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
7
|
+
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
8
|
+
import "@tanstack/react-query";
|
|
5
9
|
import "../../Base/useBase.js";
|
|
6
10
|
import "../../../shared/constants.js";
|
|
7
11
|
import "classnames";
|
|
8
12
|
import "dompurify";
|
|
13
|
+
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
9
14
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
15
|
+
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
10
16
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
11
|
-
const [
|
|
17
|
+
const [u, f] = o("FederalTaxesContext");
|
|
12
18
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
f as FederalTaxesProvider,
|
|
20
|
+
u as useFederalTaxes
|
|
15
21
|
};
|
|
16
22
|
//# sourceMappingURL=useFederalTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFederalTaxes.js","sources":["../../../../src/components/Employee/FederalTaxes/useFederalTaxes.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\n\ntype FederalTaxesContextType = {\n isPending: boolean\n}\n\nconst [useFederalTaxes, FederalTaxesProvider] =\n createCompoundContext<FederalTaxesContextType>('FederalTaxesContext')\nexport { useFederalTaxes, FederalTaxesProvider }\n"],"names":["useFederalTaxes","FederalTaxesProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFederalTaxes.js","sources":["../../../../src/components/Employee/FederalTaxes/useFederalTaxes.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\n\ntype FederalTaxesContextType = {\n isPending: boolean\n}\n\nconst [useFederalTaxes, FederalTaxesProvider] =\n createCompoundContext<FederalTaxesContextType>('FederalTaxesContext')\nexport { useFederalTaxes, FederalTaxesProvider }\n"],"names":["useFederalTaxes","FederalTaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAMA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as u } from "react-i18next";
|
|
3
|
-
import { useEmployeesGetSuspense as h } from "
|
|
4
|
-
import { useCompaniesGetSuspense as g } from "
|
|
3
|
+
import { useEmployeesGetSuspense as h } from "@gusto/embedded-api/react-query/employeesGet";
|
|
4
|
+
import { useCompaniesGetSuspense as g } from "@gusto/embedded-api/react-query/companiesGet";
|
|
5
5
|
import s from "./Landing.module.scss.js";
|
|
6
6
|
import { BaseComponent as x } from "../../Base/Base.js";
|
|
7
7
|
import { useBase as y } from "../../Base/useBase.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s, Fragment as g } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as b } from "react-i18next";
|
|
3
3
|
import A from "classnames";
|
|
4
|
-
import { useEmployeesGetSuspense as B } from "
|
|
5
|
-
import { useEmployeesGetOnboardingStatusSuspense as L } from "
|
|
4
|
+
import { useEmployeesGetSuspense as B } from "@gusto/embedded-api/react-query/employeesGet";
|
|
5
|
+
import { useEmployeesGetOnboardingStatusSuspense as L } from "@gusto/embedded-api/react-query/employeesGetOnboardingStatus";
|
|
6
6
|
import y from "dompurify";
|
|
7
7
|
import { useMemo as S } from "react";
|
|
8
8
|
import r from "./OnboardingSummary.module.scss.js";
|
|
@@ -6,15 +6,15 @@ export declare const BankAccountSchema: z.ZodObject<{
|
|
|
6
6
|
accountType: z.ZodEnum<["Checking", "Savings"]>;
|
|
7
7
|
hasBankPayload: z.ZodLiteral<true>;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
name: string;
|
|
10
9
|
routingNumber: string;
|
|
11
10
|
accountNumber: string;
|
|
11
|
+
name: string;
|
|
12
12
|
accountType: "Checking" | "Savings";
|
|
13
13
|
hasBankPayload: true;
|
|
14
14
|
}, {
|
|
15
|
-
name: string;
|
|
16
15
|
routingNumber: string;
|
|
17
16
|
accountNumber: string;
|
|
17
|
+
name: string;
|
|
18
18
|
accountType: "Checking" | "Savings";
|
|
19
19
|
hasBankPayload: true;
|
|
20
20
|
}>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as n, jsxs as U } from "react/jsx-runtime";
|
|
2
|
-
import { zodResolver as x } from "
|
|
3
|
-
import { useEmployeePaymentMethodCreateMutation as H } from "
|
|
4
|
-
import { useEmployeePaymentMethodDeleteBankAccountMutation as R } from "
|
|
5
|
-
import { useEmployeePaymentMethodsGetBankAccountsSuspense as V } from "
|
|
6
|
-
import { useEmployeePaymentMethodGetSuspense as j } from "
|
|
7
|
-
import { useEmployeePaymentMethodUpdateBankAccountMutation as G } from "
|
|
8
|
-
import { useEmployeePaymentMethodUpdateMutation as K } from "
|
|
9
|
-
import { useQueryClient as z } from "
|
|
2
|
+
import { zodResolver as x } from "@hookform/resolvers/zod";
|
|
3
|
+
import { useEmployeePaymentMethodCreateMutation as H } from "@gusto/embedded-api/react-query/employeePaymentMethodCreate";
|
|
4
|
+
import { useEmployeePaymentMethodDeleteBankAccountMutation as R } from "@gusto/embedded-api/react-query/employeePaymentMethodDeleteBankAccount";
|
|
5
|
+
import { useEmployeePaymentMethodsGetBankAccountsSuspense as V } from "@gusto/embedded-api/react-query/employeePaymentMethodsGetBankAccounts";
|
|
6
|
+
import { useEmployeePaymentMethodGetSuspense as j } from "@gusto/embedded-api/react-query/employeePaymentMethodGet";
|
|
7
|
+
import { useEmployeePaymentMethodUpdateBankAccountMutation as G } from "@gusto/embedded-api/react-query/employeePaymentMethodUpdateBankAccount";
|
|
8
|
+
import { useEmployeePaymentMethodUpdateMutation as K } from "@gusto/embedded-api/react-query/employeePaymentMethodUpdate";
|
|
9
|
+
import { useQueryClient as z } from "@tanstack/react-query";
|
|
10
10
|
import { useState as Q, useMemo as T, useEffect as S } from "react";
|
|
11
11
|
import { useForm as J, FormProvider as W } from "react-hook-form";
|
|
12
12
|
import { useTranslation as X } from "react-i18next";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as x, Fragment as E, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useFormContext as B } from "react-hook-form";
|
|
3
3
|
import { useTranslation as g, Trans as V } from "react-i18next";
|
|
4
|
-
import { ErrorMessage as z } from "
|
|
4
|
+
import { ErrorMessage as z } from "@hookform/error-message";
|
|
5
5
|
import y from "dompurify";
|
|
6
6
|
import { useMemo as j, useEffect as D } from "react";
|
|
7
7
|
import { usePaymentMethod as N } from "./usePaymentMethod.js";
|
|
@@ -11,19 +11,19 @@ export declare const CombinedSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
11
11
|
type: z.ZodLiteral<"Direct Deposit">;
|
|
12
12
|
isSplit: z.ZodLiteral<false>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
name: string;
|
|
15
|
-
type: "Direct Deposit";
|
|
16
14
|
routingNumber: string;
|
|
17
15
|
accountNumber: string;
|
|
16
|
+
name: string;
|
|
18
17
|
accountType: "Checking" | "Savings";
|
|
18
|
+
type: "Direct Deposit";
|
|
19
19
|
hasBankPayload: true;
|
|
20
20
|
isSplit: false;
|
|
21
21
|
}, {
|
|
22
|
-
name: string;
|
|
23
|
-
type: "Direct Deposit";
|
|
24
22
|
routingNumber: string;
|
|
25
23
|
accountNumber: string;
|
|
24
|
+
name: string;
|
|
26
25
|
accountType: "Checking" | "Savings";
|
|
26
|
+
type: "Direct Deposit";
|
|
27
27
|
hasBankPayload: true;
|
|
28
28
|
isSplit: false;
|
|
29
29
|
}>, z.ZodObject<{
|
|
@@ -52,15 +52,15 @@ export declare const CombinedSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
52
52
|
splitAmount: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodNumber>, Record<string, number>, Record<string, number>>;
|
|
53
53
|
priority: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
54
54
|
}, "strip", z.ZodTypeAny, {
|
|
55
|
-
type: "Direct Deposit";
|
|
56
55
|
priority: Record<string, number>;
|
|
56
|
+
type: "Direct Deposit";
|
|
57
57
|
hasBankPayload: false;
|
|
58
58
|
isSplit: true;
|
|
59
59
|
splitBy: "Percentage";
|
|
60
60
|
splitAmount: Record<string, number>;
|
|
61
61
|
}, {
|
|
62
|
-
type: "Direct Deposit";
|
|
63
62
|
priority: Record<string, number>;
|
|
63
|
+
type: "Direct Deposit";
|
|
64
64
|
hasBankPayload: false;
|
|
65
65
|
isSplit: true;
|
|
66
66
|
splitBy: "Percentage";
|
|
@@ -74,16 +74,16 @@ export declare const CombinedSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
74
74
|
splitAmount: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodNumber>>;
|
|
75
75
|
remainder: z.ZodString;
|
|
76
76
|
}, "strip", z.ZodTypeAny, {
|
|
77
|
-
type: "Direct Deposit";
|
|
78
77
|
priority: Record<string, number>;
|
|
78
|
+
type: "Direct Deposit";
|
|
79
79
|
hasBankPayload: false;
|
|
80
80
|
isSplit: true;
|
|
81
81
|
splitBy: "Amount";
|
|
82
82
|
splitAmount: Record<string, number | null>;
|
|
83
83
|
remainder: string;
|
|
84
84
|
}, {
|
|
85
|
-
type: "Direct Deposit";
|
|
86
85
|
priority: Record<string, number>;
|
|
86
|
+
type: "Direct Deposit";
|
|
87
87
|
hasBankPayload: false;
|
|
88
88
|
isSplit: true;
|
|
89
89
|
splitBy: "Amount";
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { z as t } from "zod";
|
|
2
|
-
import { BankAccountSchema as
|
|
2
|
+
import { BankAccountSchema as l } from "./BankAccount.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "react-error-boundary";
|
|
6
6
|
import "react-i18next";
|
|
7
|
+
import "@gusto/embedded-api/models/errors/apierror";
|
|
8
|
+
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
9
|
+
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
10
|
+
import "@tanstack/react-query";
|
|
7
11
|
import "../../Base/useBase.js";
|
|
8
12
|
import "../../../shared/constants.js";
|
|
9
13
|
import "classnames";
|
|
10
14
|
import "dompurify";
|
|
15
|
+
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
11
16
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
17
|
+
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
12
18
|
import { createCompoundContext as a } from "../../Base/createCompoundContext.js";
|
|
13
|
-
const
|
|
14
|
-
|
|
19
|
+
const k = t.union([
|
|
20
|
+
l.extend({
|
|
15
21
|
type: t.literal("Direct Deposit"),
|
|
16
22
|
isSplit: t.literal(!1)
|
|
17
23
|
}),
|
|
@@ -32,7 +38,7 @@ const D = t.union([
|
|
|
32
38
|
splitAmount: t.record(t.string(), t.number().max(100).min(0)).refine(
|
|
33
39
|
(e) => Object.values(e).reduce((r, i) => r + i, 0) === 100,
|
|
34
40
|
(e) => ({
|
|
35
|
-
message: `percentage_split_total_error:${Object.values(e).reduce((i,
|
|
41
|
+
message: `percentage_split_total_error:${Object.values(e).reduce((i, o) => i + o, 0)}`
|
|
36
42
|
})
|
|
37
43
|
),
|
|
38
44
|
priority: t.record(t.string(), t.number())
|
|
@@ -44,16 +50,16 @@ const D = t.union([
|
|
|
44
50
|
splitBy: t.literal("Amount"),
|
|
45
51
|
priority: t.record(t.string(), t.number()).refine((e) => {
|
|
46
52
|
const r = Object.values(e);
|
|
47
|
-
return r.filter((i,
|
|
53
|
+
return r.filter((i, o) => r.indexOf(i) !== o).length === 0;
|
|
48
54
|
}),
|
|
49
55
|
splitAmount: t.record(t.string(), t.number().min(0).nullable()),
|
|
50
56
|
remainder: t.string()
|
|
51
57
|
})
|
|
52
58
|
])
|
|
53
|
-
]), [
|
|
59
|
+
]), [C, v] = a("PaymentMethodContext");
|
|
54
60
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
k as CombinedSchema,
|
|
62
|
+
v as PaymentMethodProvider,
|
|
63
|
+
C as usePaymentMethod
|
|
58
64
|
};
|
|
59
65
|
//# sourceMappingURL=usePaymentMethod.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaymentMethod.js","sources":["../../../../src/components/Employee/PaymentMethod/usePaymentMethod.ts"],"sourcesContent":["import type { EmployeeBankAccount } from '@gusto/embedded-api/models/components/employeebankaccount'\nimport type { EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod'\nimport { z } from 'zod'\nimport { BankAccountSchema } from './BankAccount'\nimport { createCompoundContext } from '@/components/Base'\n\nexport const CombinedSchema = z.union([\n BankAccountSchema.extend({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n hasBankPayload: z.literal(false),\n }),\n z.object({\n type: z.literal('Check'),\n }),\n z.discriminatedUnion('splitBy', [\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Percentage'),\n splitAmount: z.record(z.string(), z.number().max(100).min(0)).refine(\n input => Object.values(input).reduce((acc, curr) => acc + curr, 0) === 100,\n input => {\n const total = Object.values(input).reduce((acc, curr) => acc + curr, 0)\n return {\n message: `percentage_split_total_error:${total}`,\n }\n },\n ),\n priority: z.record(z.string(), z.number()),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Amount'),\n priority: z.record(z.string(), z.number()).refine(input => {\n const arr = Object.values(input)\n return arr.filter((item, index) => arr.indexOf(item) !== index).length === 0\n }),\n splitAmount: z.record(z.string(), z.number().min(0).nullable()),\n remainder: z.string(),\n }),\n ]),\n])\n\nexport type CombinedSchemaInputs = z.input<typeof CombinedSchema>\nexport type CombinedSchemaOutputs = z.output<typeof CombinedSchema>\n\ntype PaymentMethodContextType = {\n bankAccounts: EmployeeBankAccount[]\n isPending: boolean\n watchedType?: string\n mode: MODE\n paymentMethod: EmployeePaymentMethod\n handleAdd: () => void\n handleSplit: () => void\n handleCancel: () => void\n handleDelete: (uuid: string) => void\n}\n\nexport type MODE = 'ADD' | 'LIST' | 'SPLIT' | 'INITIAL'\n\nconst [usePaymentMethod, PaymentMethodProvider] =\n createCompoundContext<PaymentMethodContextType>('PaymentMethodContext')\nexport { usePaymentMethod, PaymentMethodProvider }\n"],"names":["CombinedSchema","z","BankAccountSchema","input","acc","curr","arr","item","index","usePaymentMethod","PaymentMethodProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePaymentMethod.js","sources":["../../../../src/components/Employee/PaymentMethod/usePaymentMethod.ts"],"sourcesContent":["import type { EmployeeBankAccount } from '@gusto/embedded-api/models/components/employeebankaccount'\nimport type { EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod'\nimport { z } from 'zod'\nimport { BankAccountSchema } from './BankAccount'\nimport { createCompoundContext } from '@/components/Base'\n\nexport const CombinedSchema = z.union([\n BankAccountSchema.extend({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n hasBankPayload: z.literal(false),\n }),\n z.object({\n type: z.literal('Check'),\n }),\n z.discriminatedUnion('splitBy', [\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Percentage'),\n splitAmount: z.record(z.string(), z.number().max(100).min(0)).refine(\n input => Object.values(input).reduce((acc, curr) => acc + curr, 0) === 100,\n input => {\n const total = Object.values(input).reduce((acc, curr) => acc + curr, 0)\n return {\n message: `percentage_split_total_error:${total}`,\n }\n },\n ),\n priority: z.record(z.string(), z.number()),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Amount'),\n priority: z.record(z.string(), z.number()).refine(input => {\n const arr = Object.values(input)\n return arr.filter((item, index) => arr.indexOf(item) !== index).length === 0\n }),\n splitAmount: z.record(z.string(), z.number().min(0).nullable()),\n remainder: z.string(),\n }),\n ]),\n])\n\nexport type CombinedSchemaInputs = z.input<typeof CombinedSchema>\nexport type CombinedSchemaOutputs = z.output<typeof CombinedSchema>\n\ntype PaymentMethodContextType = {\n bankAccounts: EmployeeBankAccount[]\n isPending: boolean\n watchedType?: string\n mode: MODE\n paymentMethod: EmployeePaymentMethod\n handleAdd: () => void\n handleSplit: () => void\n handleCancel: () => void\n handleDelete: (uuid: string) => void\n}\n\nexport type MODE = 'ADD' | 'LIST' | 'SPLIT' | 'INITIAL'\n\nconst [usePaymentMethod, PaymentMethodProvider] =\n createCompoundContext<PaymentMethodContextType>('PaymentMethodContext')\nexport { usePaymentMethod, PaymentMethodProvider }\n"],"names":["CombinedSchema","z","BankAccountSchema","input","acc","curr","arr","item","index","usePaymentMethod","PaymentMethodProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;;AAMO,MAAMA,IAAiBC,EAAE,MAAM;AAAA,EACpCC,EAAkB,OAAO;AAAA,IACvB,MAAMD,EAAE,QAAQ,gBAAgB;AAAA,IAChC,SAASA,EAAE,QAAQ,EAAK;AAAA,EAAA,CACzB;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,MAAMA,EAAE,QAAQ,gBAAgB;AAAA,IAChC,SAASA,EAAE,QAAQ,EAAK;AAAA,IACxB,gBAAgBA,EAAE,QAAQ,EAAK;AAAA,EAAA,CAChC;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,MAAMA,EAAE,QAAQ,OAAO;AAAA,EAAA,CACxB;AAAA,EACDA,EAAE,mBAAmB,WAAW;AAAA,IAC9BA,E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B,IAC5CC,EAAgD,sBAAsB;"}
|
|
@@ -39,8 +39,8 @@ export declare const AdminPersonalDetailsSchema: z.ZodDiscriminatedUnion<"enable
|
|
|
39
39
|
} & {
|
|
40
40
|
enableSsn: z.ZodLiteral<true>;
|
|
41
41
|
}, "strip", z.ZodTypeAny, {
|
|
42
|
-
email: string;
|
|
43
42
|
ssn: string;
|
|
43
|
+
email: string;
|
|
44
44
|
firstName: string;
|
|
45
45
|
lastName: string;
|
|
46
46
|
selfOnboarding: boolean;
|
|
@@ -50,8 +50,8 @@ export declare const AdminPersonalDetailsSchema: z.ZodDiscriminatedUnion<"enable
|
|
|
50
50
|
startDate?: string | undefined;
|
|
51
51
|
dateOfBirth?: string | undefined;
|
|
52
52
|
}, {
|
|
53
|
-
email: string;
|
|
54
53
|
ssn: string;
|
|
54
|
+
email: string;
|
|
55
55
|
firstName: string;
|
|
56
56
|
lastName: string;
|
|
57
57
|
selfOnboarding: boolean;
|
|
@@ -68,8 +68,8 @@ declare const PersonalDetailsTotalSchema: z.ZodObject<{
|
|
|
68
68
|
selfOnboarding: z.ZodBoolean;
|
|
69
69
|
enableSsn: z.ZodBoolean;
|
|
70
70
|
}, "strip", z.ZodTypeAny, {
|
|
71
|
-
email: string;
|
|
72
71
|
ssn: string;
|
|
72
|
+
email: string;
|
|
73
73
|
firstName: string;
|
|
74
74
|
lastName: string;
|
|
75
75
|
selfOnboarding: boolean;
|
|
@@ -79,8 +79,8 @@ declare const PersonalDetailsTotalSchema: z.ZodObject<{
|
|
|
79
79
|
startDate?: string | undefined;
|
|
80
80
|
dateOfBirth?: string | undefined;
|
|
81
81
|
}, {
|
|
82
|
-
email: string;
|
|
83
82
|
ssn: string;
|
|
83
|
+
email: string;
|
|
84
84
|
firstName: string;
|
|
85
85
|
lastName: string;
|
|
86
86
|
selfOnboarding: boolean;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx as t, jsxs as ae, Fragment as le } from "react/jsx-runtime";
|
|
2
|
-
import { zodResolver as ue } from "
|
|
2
|
+
import { zodResolver as ue } from "@hookform/resolvers/zod";
|
|
3
3
|
import { useState as ce, useRef as pe, useEffect as ye } from "react";
|
|
4
4
|
import { useForm as Ae, useWatch as fe, FormProvider as Ee } from "react-hook-form";
|
|
5
|
-
import { useLocationsGetSuspense as he } from "
|
|
6
|
-
import { useEmployeesCreateMutation as De } from "
|
|
7
|
-
import { useEmployeesGetSuspense as Oe } from "
|
|
8
|
-
import { useEmployeeAddressesGetSuspense as Se } from "
|
|
9
|
-
import { useEmployeeAddressesCreateMutation as ge } from "
|
|
10
|
-
import { useEmployeeAddressesUpdateMutation as Pe } from "
|
|
11
|
-
import { useEmployeeAddressesUpdateWorkAddressMutation as be } from "
|
|
12
|
-
import { useEmployeesUpdateMutation as Ne } from "
|
|
13
|
-
import { useEmployeeAddressesGetWorkAddressesSuspense as Ie } from "
|
|
14
|
-
import { useEmployeeAddressesCreateWorkAddressMutation as _e } from "
|
|
15
|
-
import { RFCDate as B } from "
|
|
16
|
-
import { useEmployeesUpdateOnboardingStatusMutation as we } from "
|
|
5
|
+
import { useLocationsGetSuspense as he } from "@gusto/embedded-api/react-query/locationsGet";
|
|
6
|
+
import { useEmployeesCreateMutation as De } from "@gusto/embedded-api/react-query/employeesCreate";
|
|
7
|
+
import { useEmployeesGetSuspense as Oe } from "@gusto/embedded-api/react-query/employeesGet";
|
|
8
|
+
import { useEmployeeAddressesGetSuspense as Se } from "@gusto/embedded-api/react-query/employeeAddressesGet";
|
|
9
|
+
import { useEmployeeAddressesCreateMutation as ge } from "@gusto/embedded-api/react-query/employeeAddressesCreate";
|
|
10
|
+
import { useEmployeeAddressesUpdateMutation as Pe } from "@gusto/embedded-api/react-query/employeeAddressesUpdate";
|
|
11
|
+
import { useEmployeeAddressesUpdateWorkAddressMutation as be } from "@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress";
|
|
12
|
+
import { useEmployeesUpdateMutation as Ne } from "@gusto/embedded-api/react-query/employeesUpdate";
|
|
13
|
+
import { useEmployeeAddressesGetWorkAddressesSuspense as Ie } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
|
|
14
|
+
import { useEmployeeAddressesCreateWorkAddressMutation as _e } from "@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress";
|
|
15
|
+
import { RFCDate as B } from "@gusto/embedded-api/types/rfcdate";
|
|
16
|
+
import { useEmployeesUpdateOnboardingStatusMutation as we } from "@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus";
|
|
17
17
|
import { AdminPersonalDetailsSchema as R, AdminSelfOnboardingPersonalDetailsSchema as Me, AdminPersonalDetails as ke } from "./AdminPersonalDetails.js";
|
|
18
18
|
import { SelfPersonalDetailsSchema as Be, SelfPersonalDetails as Re } from "./SelfPersonalDetails.js";
|
|
19
19
|
import { Head as Le } from "./Head.js";
|
|
@@ -100,7 +100,9 @@ const v = ({
|
|
|
100
100
|
enableSsn: !e.current.employee?.hasSsn,
|
|
101
101
|
ssn: ""
|
|
102
102
|
}, O = Ae({
|
|
103
|
+
// @ts-expect-error: Complex discriminated union schema causes type inference issues with zodResolver v5.2.1
|
|
103
104
|
resolver: ue(
|
|
105
|
+
// @ts-expect-error: Zod discriminated union intersection incompatible with zodResolver v5.2.1
|
|
104
106
|
(r ? q : Be).and(Ce)
|
|
105
107
|
),
|
|
106
108
|
defaultValues: r ? oe : se
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Profile.js","sources":["../../../../src/components/Employee/Profile/Profile.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { useRef, useState, useEffect } from 'react'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useLocationsGetSuspense } from '@gusto/embedded-api/react-query/locationsGet'\nimport { useEmployeesCreateMutation } from '@gusto/embedded-api/react-query/employeesCreate'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { useEmployeeAddressesGetSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGet'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { useEmployeeAddressesCreateMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreate'\nimport { useEmployeeAddressesUpdateMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdate'\nimport { useEmployeeAddressesUpdateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress'\nimport { useEmployeesUpdateMutation } from '@gusto/embedded-api/react-query/employeesUpdate'\nimport { useEmployeeAddressesGetWorkAddressesSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { useEmployeeAddressesCreateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useEmployeesUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlowComponents'\nimport {\n AdminPersonalDetails,\n AdminPersonalDetailsSchema,\n AdminSelfOnboardingPersonalDetailsSchema,\n} from './AdminPersonalDetails'\nimport { SelfPersonalDetails, SelfPersonalDetailsSchema } from './SelfPersonalDetails'\nimport { type PersonalDetailsPayload, type PersonalDetailsInputs } from './PersonalDetailsInputs'\nimport { Head } from './Head'\nimport { Actions } from './Actions'\nimport { HomeAddress, HomeAddressSchema, type HomeAddressInputs } from './HomeAddress'\nimport { WorkAddress } from './WorkAddress'\nimport { ProfileProvider } from './useProfile'\nimport { getEmployeeAddressForProfile } from './getEmployeeAddressForProfile'\nimport { Form } from '@/components/Common/Form'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport {\n componentEvents,\n EmployeeOnboardingStatus,\n EmployeeSelfOnboardingStatuses,\n} from '@/shared/constants'\nimport type { RequireAtLeastOne, WithRequired } from '@/types/Helpers'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport type ProfileDefaultValues = RequireAtLeastOne<{\n employee?: RequireAtLeastOne<{\n firstName?: string\n middleInitial?: string\n lastName?: string\n email?: string\n dateOfBirth?: string\n }>\n homeAddress?: RequireAtLeastOne<{\n street1?: string\n street2?: string\n city?: string\n state?: string\n zip?: string\n }>\n}>\ninterface ProfileProps extends CommonComponentInterface<'Employee.Profile'> {\n employeeId?: string\n companyId: string\n defaultValues?: ProfileDefaultValues\n isAdmin?: boolean\n isSelfOnboardingEnabled?: boolean\n}\n\ninterface ProfileConditionalProps {\n employee?: Employee\n homeAddresses?: EmployeeAddress[]\n workAddresses?: EmployeeWorkAddress[]\n}\n\nexport function Profile(props: ProfileProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n {props.employeeId ? (\n <RootWithEmployee {...props} employeeId={props.employeeId}>\n {props.children}\n </RootWithEmployee>\n ) : (\n <Root {...props}>{props.children}</Root>\n )}\n </BaseComponent>\n )\n}\n\n/**Accounting for conditional logic where employee data needs to be fetched only if employeeId is present */\nfunction RootWithEmployee({ employeeId, ...props }: WithRequired<ProfileProps, 'employeeId'>) {\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n const {\n data: { employeeAddressList },\n } = useEmployeeAddressesGetSuspense({ employeeId })\n const {\n data: { employeeWorkAddressesList },\n } = useEmployeeAddressesGetWorkAddressesSuspense({ employeeId })\n return (\n <Root\n {...props}\n employee={employee}\n homeAddresses={employeeAddressList}\n workAddresses={employeeWorkAddressesList}\n />\n )\n}\n\nconst Root = ({\n isAdmin = false,\n isSelfOnboardingEnabled = true,\n dictionary,\n ...props\n}: ProfileProps & ProfileConditionalProps) => {\n useI18n('Employee.Profile')\n useI18n('Employee.HomeAddress')\n useComponentDictionary('Employee.Profile', dictionary)\n const {\n companyId,\n employee,\n homeAddresses,\n workAddresses,\n children,\n className = '',\n defaultValues,\n } = props\n const { onEvent, baseSubmitHandler } = useBase()\n\n const [AdminSchema, setAdminSchema] = useState<\n typeof AdminPersonalDetailsSchema | typeof AdminSelfOnboardingPersonalDetailsSchema\n >(AdminPersonalDetailsSchema)\n\n const { data } = useLocationsGetSuspense({ companyId })\n const companyLocations = data.locationList!\n\n const { mutateAsync: createEmployee, isPending: isPendingCreateEmployee } =\n useEmployeesCreateMutation()\n const { mutateAsync: mutateEmployee, isPending: isPendingEmployeeUpdate } =\n useEmployeesUpdateMutation()\n\n const { mutateAsync: createEmployeeWorkAddress, isPending: isPendingCreateWA } =\n useEmployeeAddressesCreateWorkAddressMutation()\n const { mutateAsync: mutateEmployeeWorkAddress, isPending: isPendingWorkAddressUpdate } =\n useEmployeeAddressesUpdateWorkAddressMutation()\n\n const { mutateAsync: createEmployeeHomeAddress, isPending: isPendingAddHA } =\n useEmployeeAddressesCreateMutation()\n const { mutateAsync: mutateEmployeeHomeAddress, isPending: isPendingUpdateHA } =\n useEmployeeAddressesUpdateMutation()\n\n const {\n mutateAsync: updateEmployeeOnboardingStatus,\n isPending: isPendingUpdateOnboardingStatus,\n } = useEmployeesUpdateOnboardingStatusMutation()\n\n const existingData = { employee, workAddresses, homeAddresses }\n\n const currentHomeAddress = getEmployeeAddressForProfile(homeAddresses)\n\n const currentWorkAddress = existingData.workAddresses?.find(address => address.active)\n const mergedData = useRef({\n employee: existingData.employee,\n homeAddress: currentHomeAddress,\n workAddress: currentWorkAddress,\n })\n const initialValues = {\n firstName: mergedData.current.employee?.firstName ?? defaultValues?.employee?.firstName ?? '',\n middleInitial:\n mergedData.current.employee?.middleInitial ?? defaultValues?.employee?.middleInitial ?? '',\n lastName: mergedData.current.employee?.lastName ?? defaultValues?.employee?.lastName ?? '',\n workAddress: mergedData.current.workAddress?.locationUuid,\n startDate: mergedData.current.employee?.jobs?.[0]?.hireDate\n ? new Date(mergedData.current.employee.jobs[0].hireDate)\n : null, // By default employee response contains only current job - therefore jobs[0]\n email: mergedData.current.employee?.email ?? defaultValues?.employee?.email ?? '',\n dateOfBirth: mergedData.current.employee?.dateOfBirth\n ? new Date(mergedData.current.employee.dateOfBirth)\n : defaultValues?.employee?.dateOfBirth\n ? new Date(defaultValues.employee.dateOfBirth)\n : null,\n\n street1: mergedData.current.homeAddress?.street1 ?? defaultValues?.homeAddress?.street1 ?? '',\n street2: mergedData.current.homeAddress?.street2 ?? defaultValues?.homeAddress?.street2 ?? '',\n city: mergedData.current.homeAddress?.city ?? defaultValues?.homeAddress?.city ?? '',\n zip: mergedData.current.homeAddress?.zip ?? defaultValues?.homeAddress?.zip ?? '',\n state: mergedData.current.homeAddress?.state ?? defaultValues?.homeAddress?.state ?? '',\n courtesyWithholding: mergedData.current.homeAddress?.courtesyWithholding ?? false,\n }\n\n const adminDefaultValues =\n mergedData.current.employee?.onboarded ||\n mergedData.current.employee?.onboardingStatus ===\n EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n (mergedData.current.employee?.onboardingStatus !== undefined &&\n mergedData.current.employee.onboardingStatus !==\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE)\n ? { ...initialValues, enableSsn: false, selfOnboarding: true }\n : {\n ...initialValues,\n selfOnboarding: isSelfOnboardingEnabled\n ? mergedData.current.employee?.onboardingStatus\n ? // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses\n EmployeeSelfOnboardingStatuses.has(mergedData.current.employee.onboarding_status)\n : false\n : false,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n } // In edit mode ssn is submitted only if it has been modified\n\n const selfDetaultValues = {\n ...initialValues,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n }\n\n const formMethods = useForm<\n PersonalDetailsInputs & HomeAddressInputs,\n unknown,\n PersonalDetailsPayload & HomeAddressInputs\n >({\n resolver: zodResolver(\n (isAdmin ? AdminSchema : SelfPersonalDetailsSchema).and(HomeAddressSchema),\n ),\n defaultValues: isAdmin ? adminDefaultValues : selfDetaultValues,\n })\n\n const { handleSubmit } = formMethods\n const watchedSelfOnboarding = useWatch({ control: formMethods.control, name: 'selfOnboarding' })\n\n useEffect(() => {\n if (isAdmin) {\n if (watchedSelfOnboarding) {\n setAdminSchema(AdminSelfOnboardingPersonalDetailsSchema)\n } else {\n setAdminSchema(AdminPersonalDetailsSchema)\n }\n }\n }, [watchedSelfOnboarding, isAdmin])\n\n const onSubmit: SubmitHandler<PersonalDetailsPayload & HomeAddressInputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { workAddress, startDate, selfOnboarding, ...body } = payload\n //create or update employee\n if (!mergedData.current.employee) {\n const { employee: employeeData } = await createEmployee({\n request: {\n companyId,\n requestBody: {\n ...body,\n selfOnboarding,\n dateOfBirth: body.dateOfBirth ? new RFCDate(body.dateOfBirth) : undefined,\n },\n },\n })\n mergedData.current = { ...mergedData.current, employee: employeeData }\n onEvent(componentEvents.EMPLOYEE_CREATED, employeeData)\n } else {\n // Updating self-onboarding status\n if (\n isAdmin &&\n ((selfOnboarding &&\n mergedData.current.employee.onboardingStatus ===\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE) ||\n (!selfOnboarding &&\n mergedData.current.employee.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE))\n ) {\n const { employeeOnboardingStatus } = await updateEmployeeOnboardingStatus({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: {\n onboardingStatus: selfOnboarding\n ? EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE\n : EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE,\n },\n },\n })\n mergedData.current.employee = {\n ...mergedData.current.employee,\n onboardingStatus: employeeOnboardingStatus!\n .onboardingStatus as (typeof EmployeeOnboardingStatus)[keyof typeof EmployeeOnboardingStatus],\n }\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_STATUS_UPDATED, employeeOnboardingStatus)\n }\n const { employee: employeeData } = await mutateEmployee({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: { ...body, version: mergedData.current.employee.version as string },\n },\n })\n mergedData.current = { ...mergedData.current, employee: employeeData }\n onEvent(componentEvents.EMPLOYEE_UPDATED, employeeData)\n }\n if (typeof mergedData.current.employee?.uuid !== 'string') {\n throw new Error('Employee id is not available')\n }\n //create or update home address - only if not intended for self onboarding\n if (!watchedSelfOnboarding || !isAdmin) {\n //typeguard: in this scenario payload will contain address information\n if (!payload.selfOnboarding) {\n const { street1, street2, city, state, zip, courtesyWithholding } = payload\n if (!mergedData.current.homeAddress) {\n // Creating home address - for new employee effective_date is the same as work start date\n const { employeeAddress } = await createEmployeeHomeAddress({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: {\n street1,\n street2,\n city,\n state,\n zip,\n courtesyWithholding,\n },\n },\n })\n mergedData.current = { ...mergedData.current, homeAddress: employeeAddress }\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS_CREATED, employeeAddress)\n } else {\n const { employeeAddress } = await mutateEmployeeHomeAddress({\n request: {\n homeAddressUuid: mergedData.current.homeAddress.uuid,\n requestBody: {\n version: mergedData.current.homeAddress.version,\n street1,\n street2,\n city,\n state,\n zip,\n courtesyWithholding,\n },\n },\n })\n mergedData.current = { ...mergedData.current, homeAddress: employeeAddress }\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS_UPDATED, employeeAddress)\n }\n }\n }\n\n if (isAdmin) {\n //create or update workaddress\n if (!mergedData.current.workAddress) {\n const { employeeWorkAddress } = await createEmployeeWorkAddress({\n request: {\n employeeId: mergedData.current.employee?.uuid as string,\n requestBody: {\n locationUuid: workAddress,\n effectiveDate: new RFCDate(payload.startDate || new Date()),\n },\n },\n })\n\n mergedData.current = { ...mergedData.current, workAddress: employeeWorkAddress }\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS_CREATED, employeeWorkAddress)\n } else {\n //effective_date is excluded from update operation since it cannot be changed on initial work address\n const { employeeWorkAddress } = await mutateEmployeeWorkAddress({\n request: {\n workAddressUuid: mergedData.current.workAddress.uuid,\n requestBody: {\n version: mergedData.current.workAddress.version,\n locationUuid: workAddress,\n },\n },\n })\n mergedData.current = { ...mergedData.current, workAddress: employeeWorkAddress }\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS_UPDATED, employeeWorkAddress)\n }\n }\n\n onEvent(componentEvents.EMPLOYEE_PROFILE_DONE, {\n ...mergedData.current.employee,\n startDate,\n })\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n return (\n <section className={className}>\n <ProfileProvider\n value={{\n companyLocations,\n workAddresses,\n employee: mergedData.current.employee ?? undefined,\n isSelfOnboardingIntended: watchedSelfOnboarding,\n handleCancel,\n isAdmin,\n isSelfOnboardingEnabled,\n isPending:\n isPendingEmployeeUpdate ||\n isPendingWorkAddressUpdate ||\n isPendingAddHA ||\n isPendingUpdateHA ||\n isPendingCreateEmployee ||\n isPendingCreateWA ||\n isPendingUpdateOnboardingStatus,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <AdminPersonalDetails />\n <SelfPersonalDetails />\n <HomeAddress />\n <WorkAddress />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </ProfileProvider>\n </section>\n )\n}\n\nexport const ProfileContextual = () => {\n const { companyId, employeeId, onEvent, isAdmin, defaultValues, isSelfOnboardingEnabled } =\n useFlow<OnboardingContextInterface>()\n\n return (\n <Profile\n companyId={ensureRequired(companyId)}\n employeeId={employeeId}\n onEvent={onEvent}\n isAdmin={isAdmin}\n defaultValues={defaultValues?.profile}\n isSelfOnboardingEnabled={isSelfOnboardingEnabled}\n />\n )\n}\n"],"names":["Profile","props","jsx","BaseComponent","RootWithEmployee","Root","employeeId","employee","useEmployeesGetSuspense","employeeAddressList","useEmployeeAddressesGetSuspense","employeeWorkAddressesList","useEmployeeAddressesGetWorkAddressesSuspense","isAdmin","isSelfOnboardingEnabled","dictionary","useI18n","useComponentDictionary","companyId","homeAddresses","workAddresses","children","className","defaultValues","onEvent","baseSubmitHandler","useBase","AdminSchema","setAdminSchema","useState","AdminPersonalDetailsSchema","data","useLocationsGetSuspense","companyLocations","createEmployee","isPendingCreateEmployee","useEmployeesCreateMutation","mutateEmployee","isPendingEmployeeUpdate","useEmployeesUpdateMutation","createEmployeeWorkAddress","isPendingCreateWA","useEmployeeAddressesCreateWorkAddressMutation","mutateEmployeeWorkAddress","isPendingWorkAddressUpdate","useEmployeeAddressesUpdateWorkAddressMutation","createEmployeeHomeAddress","isPendingAddHA","useEmployeeAddressesCreateMutation","mutateEmployeeHomeAddress","isPendingUpdateHA","useEmployeeAddressesUpdateMutation","updateEmployeeOnboardingStatus","isPendingUpdateOnboardingStatus","useEmployeesUpdateOnboardingStatusMutation","existingData","currentHomeAddress","getEmployeeAddressForProfile","currentWorkAddress","address","mergedData","useRef","initialValues","adminDefaultValues","EmployeeOnboardingStatus","EmployeeSelfOnboardingStatuses","selfDetaultValues","formMethods","useForm","zodResolver","SelfPersonalDetailsSchema","HomeAddressSchema","handleSubmit","watchedSelfOnboarding","useWatch","useEffect","AdminSelfOnboardingPersonalDetailsSchema","onSubmit","payload","workAddress","startDate","selfOnboarding","body","employeeOnboardingStatus","componentEvents","employeeData","RFCDate","street1","street2","city","state","zip","courtesyWithholding","employeeAddress","employeeWorkAddress","handleCancel","ProfileProvider","FormProvider","Form","jsxs","Fragment","Head","AdminPersonalDetails","SelfPersonalDetails","HomeAddress","WorkAddress","Actions","ProfileContextual","useFlow","ensureRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFO,SAASA,GAAQC,GAA8C;AACpE,SACE,gBAAAC,EAACC,MAAe,GAAGF,GAChB,YAAM,aACL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A,QACL,kBAAA/D;AAAA,QACA,eAAAb;AAAA,QACA,UAAUwC,EAAW,QAAQ,YAAY;AAAA,QACzC,0BAA0Ba;AAAA,QAC1B,cAAAsB;AAAA,QACA,SAAAlF;AAAA,QACA,yBAAAC;AAAA,QACA,WACEwB,KACAM,KACAG,KACAG,KACAf,KACAM,KACAY;AAAA,MAAA;AAAA,MAGJ,UAAA,gBAAAnD,EAAC+F,IAAA,EAAc,GAAG9B,GAChB,UAAA,gBAAAjE,EAACgG,IAAA,EAAK,UAAU1B,GAAaK,EAAQ,GAClC,UAAAxD,KAGC,gBAAA8E,GAAAC,IAAA,EACE,UAAA;AAAA,QAAA,gBAAAlG,EAACmG,IAAA,EAAK;AAAA,0BACLC,IAAA,EAAqB;AAAA,0BACrBC,IAAA,EAAoB;AAAA,0BACpBC,IAAA,EAAY;AAAA,0BACZC,IAAA,EAAY;AAAA,0BACZC,IAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX,GAEJ,EAAA,CACF;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ,GAEaC,KAAoB,MAAM;AACrC,QAAM,EAAE,WAAAzF,GAAW,YAAAZ,GAAY,SAAAkB,GAAS,SAAAX,GAAS,eAAAU,GAAe,yBAAAT,EAAA,IAC9D8F,GAAA;AAEF,SACE,gBAAA1G;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,WAAW6G,GAAe3F,CAAS;AAAA,MACnC,YAAAZ;AAAA,MACA,SAAAkB;AAAA,MACA,SAAAX;AAAA,MACA,eAAeU,GAAe;AAAA,MAC9B,yBAAAT;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"Profile.js","sources":["../../../../src/components/Employee/Profile/Profile.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { useRef, useState, useEffect } from 'react'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useLocationsGetSuspense } from '@gusto/embedded-api/react-query/locationsGet'\nimport { useEmployeesCreateMutation } from '@gusto/embedded-api/react-query/employeesCreate'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { useEmployeeAddressesGetSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGet'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { useEmployeeAddressesCreateMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreate'\nimport { useEmployeeAddressesUpdateMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdate'\nimport { useEmployeeAddressesUpdateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress'\nimport { useEmployeesUpdateMutation } from '@gusto/embedded-api/react-query/employeesUpdate'\nimport { useEmployeeAddressesGetWorkAddressesSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { useEmployeeAddressesCreateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useEmployeesUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlowComponents'\nimport {\n AdminPersonalDetails,\n AdminPersonalDetailsSchema,\n AdminSelfOnboardingPersonalDetailsSchema,\n} from './AdminPersonalDetails'\nimport { SelfPersonalDetails, SelfPersonalDetailsSchema } from './SelfPersonalDetails'\nimport { type PersonalDetailsPayload, type PersonalDetailsInputs } from './PersonalDetailsInputs'\nimport { Head } from './Head'\nimport { Actions } from './Actions'\nimport { HomeAddress, HomeAddressSchema, type HomeAddressInputs } from './HomeAddress'\nimport { WorkAddress } from './WorkAddress'\nimport { ProfileProvider } from './useProfile'\nimport { getEmployeeAddressForProfile } from './getEmployeeAddressForProfile'\nimport { Form } from '@/components/Common/Form'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport {\n componentEvents,\n EmployeeOnboardingStatus,\n EmployeeSelfOnboardingStatuses,\n} from '@/shared/constants'\nimport type { RequireAtLeastOne, WithRequired } from '@/types/Helpers'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport type ProfileDefaultValues = RequireAtLeastOne<{\n employee?: RequireAtLeastOne<{\n firstName?: string\n middleInitial?: string\n lastName?: string\n email?: string\n dateOfBirth?: string\n }>\n homeAddress?: RequireAtLeastOne<{\n street1?: string\n street2?: string\n city?: string\n state?: string\n zip?: string\n }>\n}>\ninterface ProfileProps extends CommonComponentInterface<'Employee.Profile'> {\n employeeId?: string\n companyId: string\n defaultValues?: ProfileDefaultValues\n isAdmin?: boolean\n isSelfOnboardingEnabled?: boolean\n}\n\ninterface ProfileConditionalProps {\n employee?: Employee\n homeAddresses?: EmployeeAddress[]\n workAddresses?: EmployeeWorkAddress[]\n}\n\nexport function Profile(props: ProfileProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n {props.employeeId ? (\n <RootWithEmployee {...props} employeeId={props.employeeId}>\n {props.children}\n </RootWithEmployee>\n ) : (\n <Root {...props}>{props.children}</Root>\n )}\n </BaseComponent>\n )\n}\n\n/**Accounting for conditional logic where employee data needs to be fetched only if employeeId is present */\nfunction RootWithEmployee({ employeeId, ...props }: WithRequired<ProfileProps, 'employeeId'>) {\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n const {\n data: { employeeAddressList },\n } = useEmployeeAddressesGetSuspense({ employeeId })\n const {\n data: { employeeWorkAddressesList },\n } = useEmployeeAddressesGetWorkAddressesSuspense({ employeeId })\n return (\n <Root\n {...props}\n employee={employee}\n homeAddresses={employeeAddressList}\n workAddresses={employeeWorkAddressesList}\n />\n )\n}\n\nconst Root = ({\n isAdmin = false,\n isSelfOnboardingEnabled = true,\n dictionary,\n ...props\n}: ProfileProps & ProfileConditionalProps) => {\n useI18n('Employee.Profile')\n useI18n('Employee.HomeAddress')\n useComponentDictionary('Employee.Profile', dictionary)\n const {\n companyId,\n employee,\n homeAddresses,\n workAddresses,\n children,\n className = '',\n defaultValues,\n } = props\n const { onEvent, baseSubmitHandler } = useBase()\n\n const [AdminSchema, setAdminSchema] = useState<\n typeof AdminPersonalDetailsSchema | typeof AdminSelfOnboardingPersonalDetailsSchema\n >(AdminPersonalDetailsSchema)\n\n const { data } = useLocationsGetSuspense({ companyId })\n const companyLocations = data.locationList!\n\n const { mutateAsync: createEmployee, isPending: isPendingCreateEmployee } =\n useEmployeesCreateMutation()\n const { mutateAsync: mutateEmployee, isPending: isPendingEmployeeUpdate } =\n useEmployeesUpdateMutation()\n\n const { mutateAsync: createEmployeeWorkAddress, isPending: isPendingCreateWA } =\n useEmployeeAddressesCreateWorkAddressMutation()\n const { mutateAsync: mutateEmployeeWorkAddress, isPending: isPendingWorkAddressUpdate } =\n useEmployeeAddressesUpdateWorkAddressMutation()\n\n const { mutateAsync: createEmployeeHomeAddress, isPending: isPendingAddHA } =\n useEmployeeAddressesCreateMutation()\n const { mutateAsync: mutateEmployeeHomeAddress, isPending: isPendingUpdateHA } =\n useEmployeeAddressesUpdateMutation()\n\n const {\n mutateAsync: updateEmployeeOnboardingStatus,\n isPending: isPendingUpdateOnboardingStatus,\n } = useEmployeesUpdateOnboardingStatusMutation()\n\n const existingData = { employee, workAddresses, homeAddresses }\n\n const currentHomeAddress = getEmployeeAddressForProfile(homeAddresses)\n\n const currentWorkAddress = existingData.workAddresses?.find(address => address.active)\n const mergedData = useRef({\n employee: existingData.employee,\n homeAddress: currentHomeAddress,\n workAddress: currentWorkAddress,\n })\n const initialValues = {\n firstName: mergedData.current.employee?.firstName ?? defaultValues?.employee?.firstName ?? '',\n middleInitial:\n mergedData.current.employee?.middleInitial ?? defaultValues?.employee?.middleInitial ?? '',\n lastName: mergedData.current.employee?.lastName ?? defaultValues?.employee?.lastName ?? '',\n workAddress: mergedData.current.workAddress?.locationUuid,\n startDate: mergedData.current.employee?.jobs?.[0]?.hireDate\n ? new Date(mergedData.current.employee.jobs[0].hireDate)\n : null, // By default employee response contains only current job - therefore jobs[0]\n email: mergedData.current.employee?.email ?? defaultValues?.employee?.email ?? '',\n dateOfBirth: mergedData.current.employee?.dateOfBirth\n ? new Date(mergedData.current.employee.dateOfBirth)\n : defaultValues?.employee?.dateOfBirth\n ? new Date(defaultValues.employee.dateOfBirth)\n : null,\n\n street1: mergedData.current.homeAddress?.street1 ?? defaultValues?.homeAddress?.street1 ?? '',\n street2: mergedData.current.homeAddress?.street2 ?? defaultValues?.homeAddress?.street2 ?? '',\n city: mergedData.current.homeAddress?.city ?? defaultValues?.homeAddress?.city ?? '',\n zip: mergedData.current.homeAddress?.zip ?? defaultValues?.homeAddress?.zip ?? '',\n state: mergedData.current.homeAddress?.state ?? defaultValues?.homeAddress?.state ?? '',\n courtesyWithholding: mergedData.current.homeAddress?.courtesyWithholding ?? false,\n }\n\n const adminDefaultValues =\n mergedData.current.employee?.onboarded ||\n mergedData.current.employee?.onboardingStatus ===\n EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n (mergedData.current.employee?.onboardingStatus !== undefined &&\n mergedData.current.employee.onboardingStatus !==\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE)\n ? { ...initialValues, enableSsn: false, selfOnboarding: true }\n : {\n ...initialValues,\n selfOnboarding: isSelfOnboardingEnabled\n ? mergedData.current.employee?.onboardingStatus\n ? // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses\n EmployeeSelfOnboardingStatuses.has(mergedData.current.employee.onboarding_status)\n : false\n : false,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n } // In edit mode ssn is submitted only if it has been modified\n\n const selfDetaultValues = {\n ...initialValues,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n }\n\n const formMethods = useForm<\n PersonalDetailsInputs & HomeAddressInputs,\n unknown,\n PersonalDetailsPayload & HomeAddressInputs\n >({\n // @ts-expect-error: Complex discriminated union schema causes type inference issues with zodResolver v5.2.1\n resolver: zodResolver(\n // @ts-expect-error: Zod discriminated union intersection incompatible with zodResolver v5.2.1\n (isAdmin ? AdminSchema : SelfPersonalDetailsSchema).and(HomeAddressSchema),\n ),\n defaultValues: isAdmin ? adminDefaultValues : selfDetaultValues,\n })\n\n const { handleSubmit } = formMethods\n const watchedSelfOnboarding = useWatch({ control: formMethods.control, name: 'selfOnboarding' })\n\n useEffect(() => {\n if (isAdmin) {\n if (watchedSelfOnboarding) {\n setAdminSchema(AdminSelfOnboardingPersonalDetailsSchema)\n } else {\n setAdminSchema(AdminPersonalDetailsSchema)\n }\n }\n }, [watchedSelfOnboarding, isAdmin])\n\n const onSubmit: SubmitHandler<PersonalDetailsPayload & HomeAddressInputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { workAddress, startDate, selfOnboarding, ...body } = payload\n //create or update employee\n if (!mergedData.current.employee) {\n const { employee: employeeData } = await createEmployee({\n request: {\n companyId,\n requestBody: {\n ...body,\n selfOnboarding,\n dateOfBirth: body.dateOfBirth ? new RFCDate(body.dateOfBirth) : undefined,\n },\n },\n })\n mergedData.current = { ...mergedData.current, employee: employeeData }\n onEvent(componentEvents.EMPLOYEE_CREATED, employeeData)\n } else {\n // Updating self-onboarding status\n if (\n isAdmin &&\n ((selfOnboarding &&\n mergedData.current.employee.onboardingStatus ===\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE) ||\n (!selfOnboarding &&\n mergedData.current.employee.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE))\n ) {\n const { employeeOnboardingStatus } = await updateEmployeeOnboardingStatus({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: {\n onboardingStatus: selfOnboarding\n ? EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE\n : EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE,\n },\n },\n })\n mergedData.current.employee = {\n ...mergedData.current.employee,\n onboardingStatus: employeeOnboardingStatus!\n .onboardingStatus as (typeof EmployeeOnboardingStatus)[keyof typeof EmployeeOnboardingStatus],\n }\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_STATUS_UPDATED, employeeOnboardingStatus)\n }\n const { employee: employeeData } = await mutateEmployee({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: { ...body, version: mergedData.current.employee.version as string },\n },\n })\n mergedData.current = { ...mergedData.current, employee: employeeData }\n onEvent(componentEvents.EMPLOYEE_UPDATED, employeeData)\n }\n if (typeof mergedData.current.employee?.uuid !== 'string') {\n throw new Error('Employee id is not available')\n }\n //create or update home address - only if not intended for self onboarding\n if (!watchedSelfOnboarding || !isAdmin) {\n //typeguard: in this scenario payload will contain address information\n if (!payload.selfOnboarding) {\n const { street1, street2, city, state, zip, courtesyWithholding } = payload\n if (!mergedData.current.homeAddress) {\n // Creating home address - for new employee effective_date is the same as work start date\n const { employeeAddress } = await createEmployeeHomeAddress({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: {\n street1,\n street2,\n city,\n state,\n zip,\n courtesyWithholding,\n },\n },\n })\n mergedData.current = { ...mergedData.current, homeAddress: employeeAddress }\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS_CREATED, employeeAddress)\n } else {\n const { employeeAddress } = await mutateEmployeeHomeAddress({\n request: {\n homeAddressUuid: mergedData.current.homeAddress.uuid,\n requestBody: {\n version: mergedData.current.homeAddress.version,\n street1,\n street2,\n city,\n state,\n zip,\n courtesyWithholding,\n },\n },\n })\n mergedData.current = { ...mergedData.current, homeAddress: employeeAddress }\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS_UPDATED, employeeAddress)\n }\n }\n }\n\n if (isAdmin) {\n //create or update workaddress\n if (!mergedData.current.workAddress) {\n const { employeeWorkAddress } = await createEmployeeWorkAddress({\n request: {\n employeeId: mergedData.current.employee?.uuid as string,\n requestBody: {\n locationUuid: workAddress,\n effectiveDate: new RFCDate(payload.startDate || new Date()),\n },\n },\n })\n\n mergedData.current = { ...mergedData.current, workAddress: employeeWorkAddress }\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS_CREATED, employeeWorkAddress)\n } else {\n //effective_date is excluded from update operation since it cannot be changed on initial work address\n const { employeeWorkAddress } = await mutateEmployeeWorkAddress({\n request: {\n workAddressUuid: mergedData.current.workAddress.uuid,\n requestBody: {\n version: mergedData.current.workAddress.version,\n locationUuid: workAddress,\n },\n },\n })\n mergedData.current = { ...mergedData.current, workAddress: employeeWorkAddress }\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS_UPDATED, employeeWorkAddress)\n }\n }\n\n onEvent(componentEvents.EMPLOYEE_PROFILE_DONE, {\n ...mergedData.current.employee,\n startDate,\n })\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n return (\n <section className={className}>\n <ProfileProvider\n value={{\n companyLocations,\n workAddresses,\n employee: mergedData.current.employee ?? undefined,\n isSelfOnboardingIntended: watchedSelfOnboarding,\n handleCancel,\n isAdmin,\n isSelfOnboardingEnabled,\n isPending:\n isPendingEmployeeUpdate ||\n isPendingWorkAddressUpdate ||\n isPendingAddHA ||\n isPendingUpdateHA ||\n isPendingCreateEmployee ||\n isPendingCreateWA ||\n isPendingUpdateOnboardingStatus,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <AdminPersonalDetails />\n <SelfPersonalDetails />\n <HomeAddress />\n <WorkAddress />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </ProfileProvider>\n </section>\n )\n}\n\nexport const ProfileContextual = () => {\n const { companyId, employeeId, onEvent, isAdmin, defaultValues, isSelfOnboardingEnabled } =\n useFlow<OnboardingContextInterface>()\n\n return (\n <Profile\n companyId={ensureRequired(companyId)}\n employeeId={employeeId}\n onEvent={onEvent}\n isAdmin={isAdmin}\n defaultValues={defaultValues?.profile}\n isSelfOnboardingEnabled={isSelfOnboardingEnabled}\n />\n )\n}\n"],"names":["Profile","props","jsx","BaseComponent","RootWithEmployee","Root","employeeId","employee","useEmployeesGetSuspense","employeeAddressList","useEmployeeAddressesGetSuspense","employeeWorkAddressesList","useEmployeeAddressesGetWorkAddressesSuspense","isAdmin","isSelfOnboardingEnabled","dictionary","useI18n","useComponentDictionary","companyId","homeAddresses","workAddresses","children","className","defaultValues","onEvent","baseSubmitHandler","useBase","AdminSchema","setAdminSchema","useState","AdminPersonalDetailsSchema","data","useLocationsGetSuspense","companyLocations","createEmployee","isPendingCreateEmployee","useEmployeesCreateMutation","mutateEmployee","isPendingEmployeeUpdate","useEmployeesUpdateMutation","createEmployeeWorkAddress","isPendingCreateWA","useEmployeeAddressesCreateWorkAddressMutation","mutateEmployeeWorkAddress","isPendingWorkAddressUpdate","useEmployeeAddressesUpdateWorkAddressMutation","createEmployeeHomeAddress","isPendingAddHA","useEmployeeAddressesCreateMutation","mutateEmployeeHomeAddress","isPendingUpdateHA","useEmployeeAddressesUpdateMutation","updateEmployeeOnboardingStatus","isPendingUpdateOnboardingStatus","useEmployeesUpdateOnboardingStatusMutation","existingData","currentHomeAddress","getEmployeeAddressForProfile","currentWorkAddress","address","mergedData","useRef","initialValues","adminDefaultValues","EmployeeOnboardingStatus","EmployeeSelfOnboardingStatuses","selfDetaultValues","formMethods","useForm","zodResolver","SelfPersonalDetailsSchema","HomeAddressSchema","handleSubmit","watchedSelfOnboarding","useWatch","useEffect","AdminSelfOnboardingPersonalDetailsSchema","onSubmit","payload","workAddress","startDate","selfOnboarding","body","employeeOnboardingStatus","componentEvents","employeeData","RFCDate","street1","street2","city","state","zip","courtesyWithholding","employeeAddress","employeeWorkAddress","handleCancel","ProfileProvider","FormProvider","Form","jsxs","Fragment","Head","AdminPersonalDetails","SelfPersonalDetails","HomeAddress","WorkAddress","Actions","ProfileContextual","useFlow","ensureRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFO,SAASA,GAAQC,GAA8C;AACpE,SACE,gBAAAC,EAACC,MAAe,GAAGF,GAChB,YAAM,aACL,gBAAAC,EAACE,IAAA,EAAkB,GAAGH,GAAO,YAAYA,EAAM,YAC5C,UAAAA,EAAM,UACT,IAEA,gBAAAC,EAACG,KAAM,GAAGJ,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CAErC;AAEJ;AAGA,SAASG,GAAiB,EAAE,YAAAE,GAAY,GAAGL,KAAmD;AAC5F,QAAM;AAAA,IACJ,MAAM,EAAE,UAAAM,EAAA;AAAA,EAAS,IACfC,GAAwB,EAAE,YAAAF,GAAY,GACpC;AAAA,IACJ,MAAM,EAAE,qBAAAG,EAAA;AAAA,EAAoB,IAC1BC,GAAgC,EAAE,YAAAJ,GAAY,GAC5C;AAAA,IACJ,MAAM,EAAE,2BAAAK,EAAA;AAAA,EAA0B,IAChCC,GAA6C,EAAE,YAAAN,GAAY;AAC/D,SACE,gBAAAJ;AAAA,IAACG;AAAA,IAAA;AAAA,MACE,GAAGJ;AAAA,MACJ,UAAAM;AAAA,MACA,eAAeE;AAAA,MACf,eAAeE;AAAA,IAAA;AAAA,EAAA;AAGrB;AAEA,MAAMN,IAAO,CAAC;AAAA,EACZ,SAAAQ,IAAU;AAAA,EACV,yBAAAC,IAA0B;AAAA,EAC1B,YAAAC;AAAA,EACA,GAAGd;AACL,MAA8C;AAC5C,EAAAe,EAAQ,kBAAkB,GAC1BA,EAAQ,sBAAsB,GAC9BC,GAAuB,oBAAoBF,CAAU;AACrD,QAAM;AAAA,IACJ,WAAAG;AAAA,IACA,UAAAX;AAAA,IACA,eAAAY;AAAA,IACA,eAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC,IAAY;AAA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AAA;AAAA,EAAA;AAGN;"}
|
|
@@ -2,15 +2,21 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-error-boundary";
|
|
4
4
|
import "react-i18next";
|
|
5
|
+
import "@gusto/embedded-api/models/errors/apierror";
|
|
6
|
+
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
7
|
+
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
8
|
+
import "@tanstack/react-query";
|
|
5
9
|
import "../../Base/useBase.js";
|
|
6
10
|
import "../../../shared/constants.js";
|
|
7
11
|
import "classnames";
|
|
8
12
|
import "dompurify";
|
|
13
|
+
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
9
14
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
15
|
+
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
10
16
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
11
|
-
const [
|
|
17
|
+
const [a, v] = o("ProfileContext");
|
|
12
18
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
v as ProfileProvider,
|
|
20
|
+
a as useProfile
|
|
15
21
|
};
|
|
16
22
|
//# sourceMappingURL=useProfile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProfile.js","sources":["../../../../src/components/Employee/Profile/useProfile.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\n\n//Interface for context passed down to component slots\ntype ProfileContextType = {\n companyLocations: Location[]\n workAddresses?: EmployeeWorkAddress[]\n employee?: Employee\n isSelfOnboardingIntended?: boolean\n isPending: boolean\n isAdmin: boolean\n handleCancel: () => void\n isSelfOnboardingEnabled: boolean\n}\n\nconst [useProfile, ProfileProvider] = createCompoundContext<ProfileContextType>('ProfileContext')\nexport { useProfile, ProfileProvider }\n"],"names":["useProfile","ProfileProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useProfile.js","sources":["../../../../src/components/Employee/Profile/useProfile.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\n\n//Interface for context passed down to component slots\ntype ProfileContextType = {\n companyLocations: Location[]\n workAddresses?: EmployeeWorkAddress[]\n employee?: Employee\n isSelfOnboardingIntended?: boolean\n isPending: boolean\n isAdmin: boolean\n handleCancel: () => void\n isSelfOnboardingEnabled: boolean\n}\n\nconst [useProfile, ProfileProvider] = createCompoundContext<ProfileContextType>('ProfileContext')\nexport { useProfile, ProfileProvider }\n"],"names":["useProfile","ProfileProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,CAACA,GAAYC,CAAe,IAAIC,EAA0C,gBAAgB;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as o, jsxs as P, Fragment as b } from "react/jsx-runtime";
|
|
2
|
-
import { zodResolver as g } from "
|
|
2
|
+
import { zodResolver as g } from "@hookform/resolvers/zod";
|
|
3
3
|
import { useForm as N, FormProvider as R } from "react-hook-form";
|
|
4
4
|
import { useEffect as C } from "react";
|
|
5
|
-
import { useEmployeeTaxSetupGetStateTaxesSuspense as L } from "
|
|
6
|
-
import { useEmployeeTaxSetupUpdateStateTaxesMutation as M } from "
|
|
5
|
+
import { useEmployeeTaxSetupGetStateTaxesSuspense as L } from "@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes";
|
|
6
|
+
import { useEmployeeTaxSetupUpdateStateTaxesMutation as M } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes";
|
|
7
7
|
import { StateFormSchema as O, StateForm as I } from "./StateForm.js";
|
|
8
8
|
import { Actions as V } from "./Actions.js";
|
|
9
9
|
import { StateTaxesProvider as X } from "./useStateTaxes.js";
|
|
@@ -2,15 +2,21 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-error-boundary";
|
|
4
4
|
import "react-i18next";
|
|
5
|
+
import "@gusto/embedded-api/models/errors/apierror";
|
|
6
|
+
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
7
|
+
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
8
|
+
import "@tanstack/react-query";
|
|
5
9
|
import "../../Base/useBase.js";
|
|
6
10
|
import "../../../shared/constants.js";
|
|
7
11
|
import "classnames";
|
|
8
12
|
import "dompurify";
|
|
13
|
+
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
9
14
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
15
|
+
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
10
16
|
import { createCompoundContext as t } from "../../Base/createCompoundContext.js";
|
|
11
|
-
const [
|
|
17
|
+
const [f, v] = t("StateTaxesContext");
|
|
12
18
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
v as StateTaxesProvider,
|
|
20
|
+
f as useStateTaxes
|
|
15
21
|
};
|
|
16
22
|
//# sourceMappingURL=useStateTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStateTaxes.js","sources":["../../../../src/components/Employee/StateTaxes/useStateTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype StateTaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useStateTaxes, StateTaxesProvider] =\n createCompoundContext<StateTaxesContextType>('StateTaxesContext')\nexport { useStateTaxes, StateTaxesProvider }\n"],"names":["useStateTaxes","StateTaxesProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useStateTaxes.js","sources":["../../../../src/components/Employee/StateTaxes/useStateTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype StateTaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useStateTaxes, StateTaxesProvider] =\n createCompoundContext<StateTaxesContextType>('StateTaxesContext')\nexport { useStateTaxes, StateTaxesProvider }\n"],"names":["useStateTaxes","StateTaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AASA,MAAM,CAACA,GAAeC,CAAkB,IACtCC,EAA6C,mBAAmB;"}
|