@gusto/embedded-react-sdk 0.8.1 → 0.8.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.
- package/CHANGELOG.md +11 -3
- package/dist/components/Base/Base.d.ts +6 -5
- package/dist/components/Base/Base.js +40 -39
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Base/index.d.ts +1 -0
- package/dist/components/Common/ActionsLayout/index.d.ts +1 -0
- package/dist/components/Common/DataView/DataCards/index.d.ts +1 -0
- package/dist/components/Common/DataView/index.d.ts +1 -0
- package/dist/components/Common/DocumentList/index.d.ts +1 -0
- package/dist/components/Common/DocumentViewer/index.d.ts +1 -0
- package/dist/components/Common/FieldCaption/index.d.ts +1 -0
- package/dist/components/Common/FieldDescription/index.d.ts +1 -0
- package/dist/components/Common/FieldErrorMessage/index.d.ts +1 -0
- package/dist/components/Common/FieldLayout/index.d.ts +1 -0
- package/dist/components/Common/Fields/CheckboxField/index.d.ts +1 -0
- package/dist/components/Common/Fields/CheckboxGroupField/index.d.ts +1 -0
- package/dist/components/Common/Fields/ComboBoxField/index.d.ts +1 -0
- package/dist/components/Common/Fields/DatePickerField/index.d.ts +1 -0
- package/dist/components/Common/Fields/NumberInputField/index.d.ts +1 -0
- package/dist/components/Common/Fields/RadioGroupField/index.d.ts +1 -0
- package/dist/components/Common/Fields/SelectField/index.d.ts +1 -0
- package/dist/components/Common/Fields/SwitchField/index.d.ts +1 -0
- package/dist/components/Common/Fields/TextInputField/index.d.ts +1 -0
- package/dist/components/Common/Fieldset/index.d.ts +1 -0
- package/dist/components/Common/Flex/index.d.ts +1 -0
- package/dist/components/Common/Form/index.d.ts +1 -0
- package/dist/components/Common/HamburgerMenu/index.d.ts +1 -0
- package/dist/components/Common/HorizontalFieldLayout/index.d.ts +1 -0
- package/dist/components/Common/PaginationControl/index.d.ts +1 -0
- package/dist/components/Common/ReorderableList/index.d.ts +1 -0
- package/dist/components/Common/SignatureForm/index.d.ts +1 -0
- package/dist/components/Common/TaxInputs/index.d.ts +1 -0
- package/dist/components/Common/UI/Alert/index.d.ts +1 -0
- package/dist/components/Common/UI/Button/index.d.ts +1 -0
- package/dist/components/Common/UI/CalendarPreview/index.d.ts +1 -0
- package/dist/components/Common/UI/Checkbox/index.d.ts +1 -0
- package/dist/components/Common/UI/CheckboxGroup/index.d.ts +1 -0
- package/dist/components/Common/UI/DatePicker/index.d.ts +1 -0
- package/dist/components/Common/UI/Heading/index.d.ts +1 -0
- package/dist/components/Common/UI/Input/index.d.ts +1 -0
- package/dist/components/Common/UI/Link/index.d.ts +1 -0
- package/dist/components/Common/UI/List/index.d.ts +1 -0
- package/dist/components/Common/UI/Menu/index.d.ts +1 -0
- package/dist/components/Common/UI/NumberInput/index.d.ts +1 -0
- package/dist/components/Common/UI/ProgressBar/index.d.ts +1 -0
- package/dist/components/Common/UI/Radio/index.d.ts +1 -0
- package/dist/components/Common/UI/RadioGroup/index.d.ts +1 -0
- package/dist/components/Common/UI/Select/index.d.ts +1 -0
- package/dist/components/Common/UI/Switch/index.d.ts +1 -0
- package/dist/components/Common/UI/Table/index.d.ts +1 -0
- package/dist/components/Common/UI/Text/index.d.ts +1 -0
- package/dist/components/Common/UI/TextInput/index.d.ts +1 -0
- package/dist/components/Common/VisuallyHidden/index.d.ts +1 -0
- package/dist/components/Common/index.d.ts +1 -0
- package/dist/components/Company/AssignSignatory/AssignSignatory.d.ts +3 -3
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +20 -19
- package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/index.d.ts +1 -0
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/index.d.ts +1 -0
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/index.d.ts +1 -0
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccount.d.ts +10 -0
- package/dist/components/Company/BankAccount/BankAccount.js +32 -0
- package/dist/components/Company/BankAccount/BankAccount.js.map +1 -0
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -0
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.d.ts +13 -0
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +63 -0
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -0
- package/dist/components/Company/DocumentSigner/DocumentList/Head.js.map +1 -0
- package/dist/components/Company/DocumentSigner/DocumentList/List.js.map +1 -0
- package/dist/components/Company/DocumentSigner/DocumentList/ManageSignatories.js.map +1 -0
- package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/index.d.ts +1 -0
- package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -0
- package/dist/components/Company/DocumentSigner/DocumentSigner.d.ts +12 -0
- package/dist/components/Company/DocumentSigner/DocumentSigner.js +41 -0
- package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -0
- package/dist/components/Company/DocumentSigner/SignatureForm/Actions.js.map +1 -0
- package/dist/components/Company/DocumentSigner/SignatureForm/Form.js.map +1 -0
- package/dist/components/Company/DocumentSigner/SignatureForm/Head.js.map +1 -0
- package/dist/components/Company/DocumentSigner/SignatureForm/Preview.js.map +1 -0
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.d.ts +14 -0
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +72 -0
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -0
- package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/index.d.ts +1 -0
- package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -0
- package/dist/components/Company/DocumentSigner/assignSignatoryState.js.map +1 -0
- package/dist/components/Company/DocumentSigner/documentSignerStateMachine.js.map +1 -0
- package/dist/components/Company/DocumentSigner/index.d.ts +2 -0
- package/dist/components/Company/DocumentSigner/stateMachine.js.map +1 -0
- package/dist/components/Company/FederalTaxes/FederalTaxes.d.ts +1 -4
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +27 -27
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/index.d.ts +1 -0
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +11 -12
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Industry.d.ts +1 -1
- package/dist/components/Company/Industry/Industry.js +29 -28
- package/dist/components/Company/Industry/Industry.js.map +1 -1
- package/dist/components/Company/Industry/index.d.ts +1 -0
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/Locations.d.ts +9 -0
- package/dist/components/Company/Locations/Locations.js +27 -0
- package/dist/components/Company/Locations/Locations.js.map +1 -0
- package/dist/components/Company/Locations/LocationsList/LocationsList.d.ts +3 -3
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +27 -32
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/index.d.ts +1 -0
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingFlow/OnboardingFlowComponents.d.ts +2 -2
- package/dist/components/Company/OnboardingFlow/OnboardingFlowComponents.js +13 -13
- package/dist/components/Company/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
- package/dist/components/Company/OnboardingFlow/onboardingStateMachine.js +3 -3
- package/dist/components/Company/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.d.ts +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +15 -15
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.d.ts +2 -2
- package/dist/components/Company/PaySchedule/PaySchedule.js +63 -62
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/index.d.ts +1 -0
- package/dist/components/Company/PaySchedule/index.d.ts +1 -0
- package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxes.d.ts +9 -0
- package/dist/components/Company/StateTaxes/StateTaxes.js +27 -0
- package/dist/components/Company/StateTaxes/StateTaxes.js.map +1 -0
- package/dist/components/Company/StateTaxes/{StateTaxesFlowComponents.js → StateTaxesComponents.js} +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesComponents.js.map +1 -0
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.d.ts +3 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js +1 -1
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +1 -1
- package/dist/components/Company/index.d.ts +7 -6
- package/dist/components/Company/index.js +18 -18
- package/dist/components/Employee/Compensation/Compensation.d.ts +1 -1
- package/dist/components/Employee/Compensation/Compensation.js +45 -44
- package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
- package/dist/components/Employee/Compensation/Edit.js +17 -16
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Compensation/index.d.ts +1 -0
- package/dist/components/Employee/Compensation/useCompensation.d.ts +6 -46
- package/dist/components/Employee/Compensation/useCompensation.js +60 -45
- package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
- package/dist/components/Employee/Deductions/Deductions.d.ts +2 -2
- package/dist/components/Employee/Deductions/Deductions.js +73 -71
- package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
- package/dist/components/Employee/Deductions/index.d.ts +1 -0
- package/dist/components/Employee/Deductions/useDeductions.js +6 -7
- package/dist/components/Employee/Deductions/useDeductions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentSigner.d.ts +11 -0
- package/dist/components/Employee/DocumentSigner/DocumentSigner.js +27 -0
- package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -0
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/index.d.ts +2 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.d.ts +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +38 -38
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -4
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.d.ts +1 -1
- package/dist/components/Employee/Landing/Landing.js +5 -5
- package/dist/components/Employee/Landing/Landing.js.map +1 -1
- package/dist/components/Employee/Landing/index.d.ts +1 -0
- package/dist/components/Employee/OnboardingFlow/OnboardingFlow.d.ts +27 -0
- package/dist/components/Employee/OnboardingFlow/OnboardingFlow.js +29 -0
- package/dist/components/Employee/OnboardingFlow/OnboardingFlow.js.map +1 -0
- package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js +107 -0
- package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js.map +1 -0
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.d.ts +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +30 -30
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/index.d.ts +1 -0
- package/dist/components/Employee/PaymentMethod/PaymentMethod.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +68 -68
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/index.d.ts +1 -0
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +1 -1
- package/dist/components/Employee/Profile/Profile.d.ts +1 -1
- package/dist/components/Employee/Profile/Profile.js +89 -88
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/SelfPersonalDetails.d.ts +2 -2
- package/dist/components/Employee/Profile/index.d.ts +1 -0
- package/dist/components/Employee/Profile/useProfile.js +3 -4
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.d.ts +17 -0
- package/dist/components/{Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingComponents.js → Employee/SelfOnboardingFlow/SelfOnboardingComponents.js} +7 -7
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -0
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.d.ts +2 -0
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.js +22 -0
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.js.map +1 -0
- package/dist/components/{Flow/StateMachines/employeeSelfOnboarding.js → Employee/SelfOnboardingFlow/selfOnboardingMachine.js} +4 -4
- package/dist/components/Employee/SelfOnboardingFlow/selfOnboardingMachine.js.map +1 -0
- package/dist/components/Employee/Taxes/StateForm.d.ts +3 -3
- package/dist/components/Employee/Taxes/StateForm.js +1 -1
- package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.d.ts +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +82 -78
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/components/Employee/Taxes/index.d.ts +1 -0
- package/dist/components/Employee/Taxes/useTaxes.js +3 -4
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Employee/index.d.ts +4 -1
- package/dist/components/Employee/index.js +20 -16
- package/dist/components/Employee/index.js.map +1 -1
- package/dist/components/Flow/useFlow.d.ts +2 -1
- package/dist/components/Flow/useFlow.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.d.ts +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +17 -17
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/GustoApiProvider/index.d.ts +1 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +2 -7
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +16 -14
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/GustoProvider/index.d.ts +2 -1
- package/dist/contexts/LocaleProvider/index.d.ts +1 -0
- package/dist/contexts/ThemeProvider/index.d.ts +1 -0
- package/dist/contexts/index.d.ts +1 -0
- package/dist/hooks/useForkRef/index.d.ts +1 -0
- package/dist/i18n/I18n.d.ts +2 -0
- package/dist/i18n/I18n.js +27 -21
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/index.d.ts +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +7 -13
- package/dist/index.js.map +1 -1
- package/dist/shared/constants.d.ts +1 -1
- package/dist/shared/constants.js +1 -1
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/Helpers.d.ts +14 -0
- package/dist/types/i18next.d.ts +60 -61
- package/package.json +1 -1
- package/dist/components/Company/BankAccount/BankAccountFlow.d.ts +0 -5
- package/dist/components/Company/BankAccount/BankAccountFlow.js +0 -24
- package/dist/components/Company/BankAccount/BankAccountFlow.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/DocumentList/Actions.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/DocumentList/DocumentList.d.ts +0 -13
- package/dist/components/Company/DocumentSignerFlow/DocumentList/DocumentList.js +0 -69
- package/dist/components/Company/DocumentSignerFlow/DocumentList/DocumentList.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/DocumentList/Head.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/DocumentList/List.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/DocumentList/ManageSignatories.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/DocumentList/useDocumentList.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/DocumentSignerFlow.d.ts +0 -6
- package/dist/components/Company/DocumentSignerFlow/DocumentSignerFlow.js +0 -35
- package/dist/components/Company/DocumentSignerFlow/DocumentSignerFlow.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/SignatureForm/Actions.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/SignatureForm/Form.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/SignatureForm/Head.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/SignatureForm/Preview.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/SignatureForm/SignatureForm.d.ts +0 -17
- package/dist/components/Company/DocumentSignerFlow/SignatureForm/SignatureForm.js +0 -78
- package/dist/components/Company/DocumentSignerFlow/SignatureForm/SignatureForm.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/SignatureForm/useSignatureForm.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/assignSignatoryState.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/documentSignerStateMachine.js.map +0 -1
- package/dist/components/Company/DocumentSignerFlow/index.d.ts +0 -1
- package/dist/components/Company/DocumentSignerFlow/stateMachine.js.map +0 -1
- package/dist/components/Company/Locations/LocationsFlow.d.ts +0 -5
- package/dist/components/Company/Locations/LocationsFlow.js +0 -21
- package/dist/components/Company/Locations/LocationsFlow.js.map +0 -1
- package/dist/components/Company/StateTaxes/StateTaxesFlow.d.ts +0 -5
- package/dist/components/Company/StateTaxes/StateTaxesFlow.js +0 -21
- package/dist/components/Company/StateTaxes/StateTaxesFlow.js.map +0 -1
- package/dist/components/Company/StateTaxes/StateTaxesFlowComponents.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/DocumentSignerFlow.d.ts +0 -5
- package/dist/components/Employee/DocumentSigner/DocumentSignerFlow.js +0 -21
- package/dist/components/Employee/DocumentSigner/DocumentSignerFlow.js.map +0 -1
- package/dist/components/Flow/EmployeeOnboardingFlow.d.ts +0 -27
- package/dist/components/Flow/EmployeeOnboardingFlow.js +0 -29
- package/dist/components/Flow/EmployeeOnboardingFlow.js.map +0 -1
- package/dist/components/Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingComponents.d.ts +0 -5
- package/dist/components/Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingComponents.js.map +0 -1
- package/dist/components/Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingFlow.d.ts +0 -13
- package/dist/components/Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingFlow.js +0 -26
- package/dist/components/Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingFlow.js.map +0 -1
- package/dist/components/Flow/StateMachines/employeeOnboarding.js +0 -136
- package/dist/components/Flow/StateMachines/employeeOnboarding.js.map +0 -1
- package/dist/components/Flow/StateMachines/employeeSelfOnboarding.js.map +0 -1
- package/dist/components/Flow/StateMachines/index.d.ts +0 -2
- package/dist/components/Flow/index.d.ts +0 -2
- package/dist/components/Flow/index.js +0 -7
- package/dist/components/Flow/index.js.map +0 -1
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/Actions.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/Actions.js +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/Head.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/Head.js +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/List.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/List.js +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/ManageSignatories.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/ManageSignatories.js +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/ManageSignatories.module.scss.js +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/ManageSignatories.module.scss.js.map +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/DocumentList/useDocumentList.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Actions.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Actions.js +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Form.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Form.js +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Head.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Head.js +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Preview.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/Preview.js +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/SignatureForm/useSignatureForm.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/assignSignatoryState.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/assignSignatoryState.js +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/documentSignerStateMachine.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/documentSignerStateMachine.js +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/stateMachine.d.ts +0 -0
- /package/dist/components/Company/{DocumentSignerFlow → DocumentSigner}/stateMachine.js +0 -0
- /package/dist/components/Company/{DocumentSignerFlow/useDocumentSignerFlow.d.ts → DocumentSigner/useDocumentSigner.d.ts} +0 -0
- /package/dist/components/Company/StateTaxes/{StateTaxesFlowComponents.d.ts → StateTaxesComponents.d.ts} +0 -0
- /package/dist/components/{Flow/StateMachines/employeeOnboarding.d.ts → Employee/OnboardingFlow/onboardingStateMachine.d.ts} +0 -0
- /package/dist/components/{Flow/StateMachines/employeeSelfOnboarding.d.ts → Employee/SelfOnboardingFlow/selfOnboardingMachine.d.ts} +0 -0
|
@@ -1,80 +1,81 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { zodResolver as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { useForm as
|
|
5
|
-
import { useLocationsGetSuspense as
|
|
6
|
-
import { useEmployeesCreateMutation as
|
|
7
|
-
import { useEmployeesGetSuspense as
|
|
8
|
-
import { useEmployeeAddressesGetSuspense as
|
|
9
|
-
import { useEmployeeAddressesCreateMutation as
|
|
10
|
-
import { useEmployeeAddressesUpdateMutation as
|
|
11
|
-
import { useEmployeeAddressesUpdateWorkAddressMutation as
|
|
12
|
-
import { useEmployeesUpdateMutation as
|
|
13
|
-
import { useEmployeeAddressesGetWorkAddressesSuspense as
|
|
14
|
-
import { useEmployeeAddressesCreateWorkAddressMutation as
|
|
15
|
-
import { RFCDate as
|
|
16
|
-
import { useEmployeesUpdateOnboardingStatusMutation as
|
|
17
|
-
import { invalidateEmployeesList as
|
|
18
|
-
import { useQueryClient as
|
|
19
|
-
import { AdminPersonalDetailsSchema as
|
|
1
|
+
import { jsx as t, jsxs as pe, Fragment as ye } from "react/jsx-runtime";
|
|
2
|
+
import { zodResolver as Ae } from "@hookform/resolvers/zod";
|
|
3
|
+
import { useRef as Ee } from "react";
|
|
4
|
+
import { useForm as fe, useWatch as he, FormProvider as De } from "react-hook-form";
|
|
5
|
+
import { useLocationsGetSuspense as Oe } from "@gusto/embedded-api/react-query/locationsGet";
|
|
6
|
+
import { useEmployeesCreateMutation as Se } from "@gusto/embedded-api/react-query/employeesCreate";
|
|
7
|
+
import { useEmployeesGetSuspense as Pe } from "@gusto/embedded-api/react-query/employeesGet";
|
|
8
|
+
import { useEmployeeAddressesGetSuspense as ge } from "@gusto/embedded-api/react-query/employeeAddressesGet";
|
|
9
|
+
import { useEmployeeAddressesCreateMutation as be } from "@gusto/embedded-api/react-query/employeeAddressesCreate";
|
|
10
|
+
import { useEmployeeAddressesUpdateMutation as Ne } from "@gusto/embedded-api/react-query/employeeAddressesUpdate";
|
|
11
|
+
import { useEmployeeAddressesUpdateWorkAddressMutation as Ie } from "@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress";
|
|
12
|
+
import { useEmployeesUpdateMutation as _e } from "@gusto/embedded-api/react-query/employeesUpdate";
|
|
13
|
+
import { useEmployeeAddressesGetWorkAddressesSuspense as we } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
|
|
14
|
+
import { useEmployeeAddressesCreateWorkAddressMutation as ke } from "@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress";
|
|
15
|
+
import { RFCDate as Me } from "@gusto/embedded-api/types/rfcdate";
|
|
16
|
+
import { useEmployeesUpdateOnboardingStatusMutation as Re } from "@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus";
|
|
17
|
+
import { invalidateEmployeesList as Le } from "@gusto/embedded-api/react-query/employeesList";
|
|
18
|
+
import { useQueryClient as Be } from "@tanstack/react-query";
|
|
19
|
+
import { AdminPersonalDetailsSchema as Ce, AdminPersonalDetails as L } from "./AdminPersonalDetails.js";
|
|
20
20
|
import { SelfPersonalDetailsSchema as ve, SelfPersonalDetails as B } from "./SelfPersonalDetails.js";
|
|
21
|
-
import { Head as
|
|
22
|
-
import { Actions as
|
|
23
|
-
import { HomeAddressSchema as
|
|
21
|
+
import { Head as C } from "./Head.js";
|
|
22
|
+
import { Actions as v } from "./Actions.js";
|
|
23
|
+
import { HomeAddressSchema as We, HomeAddress as W } from "./HomeAddress.js";
|
|
24
24
|
import { WorkAddress as U } from "./WorkAddress.js";
|
|
25
|
-
import { ProfileProvider as
|
|
26
|
-
import { getEmployeeAddressForProfile as
|
|
27
|
-
import { Form as
|
|
28
|
-
import { BaseComponent as
|
|
29
|
-
import { useBase as
|
|
30
|
-
import { useI18n as R } from "../../../i18n/I18n.js";
|
|
31
|
-
import { EmployeeOnboardingStatus as l, EmployeeSelfOnboardingStatuses as
|
|
32
|
-
import { useFlow as
|
|
33
|
-
import { ensureRequired as
|
|
25
|
+
import { ProfileProvider as Ue } from "./useProfile.js";
|
|
26
|
+
import { getEmployeeAddressForProfile as qe } from "./getEmployeeAddressForProfile.js";
|
|
27
|
+
import { Form as Te } from "../../Common/Form/Form.js";
|
|
28
|
+
import { BaseComponent as He } from "../../Base/Base.js";
|
|
29
|
+
import { useBase as Ge } from "../../Base/useBase.js";
|
|
30
|
+
import { useI18n as R, useComponentDictionary as Fe } from "../../../i18n/I18n.js";
|
|
31
|
+
import { EmployeeOnboardingStatus as l, EmployeeSelfOnboardingStatuses as Ve, componentEvents as d } from "../../../shared/constants.js";
|
|
32
|
+
import { useFlow as Ye } from "../../Flow/useFlow.js";
|
|
33
|
+
import { ensureRequired as xe } from "../../../helpers/ensureRequired.js";
|
|
34
34
|
function m(r) {
|
|
35
|
-
return /* @__PURE__ */ t(
|
|
35
|
+
return /* @__PURE__ */ t(He, { ...r, children: r.employeeId ? /* @__PURE__ */ t(ze, { ...r, employeeId: r.employeeId, children: r.children }) : /* @__PURE__ */ t(q, { ...r, children: r.children }) });
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function ze({ employeeId: r, ...a }) {
|
|
38
38
|
const {
|
|
39
39
|
data: { employee: u }
|
|
40
|
-
} = Se({ employeeId: r }), {
|
|
41
|
-
data: { employeeAddressList: i }
|
|
42
40
|
} = Pe({ employeeId: r }), {
|
|
43
|
-
data: {
|
|
44
|
-
} =
|
|
41
|
+
data: { employeeAddressList: c }
|
|
42
|
+
} = ge({ employeeId: r }), {
|
|
43
|
+
data: { employeeWorkAddressList: i }
|
|
44
|
+
} = we({ employeeId: r });
|
|
45
45
|
return /* @__PURE__ */ t(
|
|
46
46
|
q,
|
|
47
47
|
{
|
|
48
48
|
...a,
|
|
49
49
|
employee: u,
|
|
50
|
-
homeAddresses:
|
|
51
|
-
workAddresses:
|
|
50
|
+
homeAddresses: c,
|
|
51
|
+
workAddresses: i
|
|
52
52
|
}
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
const q = ({
|
|
56
56
|
isAdmin: r = !1,
|
|
57
57
|
isSelfOnboardingEnabled: a = !0,
|
|
58
|
-
|
|
58
|
+
dictionary: u,
|
|
59
|
+
...c
|
|
59
60
|
}) => {
|
|
60
|
-
R("Employee.Profile"), R("Employee.HomeAddress");
|
|
61
|
+
R("Employee.Profile"), R("Employee.HomeAddress"), Fe("Employee.Profile", u);
|
|
61
62
|
const {
|
|
62
63
|
companyId: i,
|
|
63
|
-
employee:
|
|
64
|
-
homeAddresses:
|
|
64
|
+
employee: f,
|
|
65
|
+
homeAddresses: T,
|
|
65
66
|
workAddresses: S,
|
|
66
67
|
children: P,
|
|
67
|
-
className:
|
|
68
|
+
className: H = "",
|
|
68
69
|
defaultValues: s
|
|
69
|
-
} =
|
|
70
|
-
mutateAsync:
|
|
71
|
-
isPending:
|
|
72
|
-
} =
|
|
73
|
-
onSettled: () =>
|
|
74
|
-
}), g = { employee:
|
|
70
|
+
} = c, { onEvent: n, baseSubmitHandler: G } = Ge(), F = Be(), { data: V } = Oe({ companyId: i }), Y = V.locationList, { mutateAsync: x, isPending: z } = Se(), { mutateAsync: j, isPending: K } = _e(), { mutateAsync: Q, isPending: J } = ke(), { mutateAsync: X, isPending: Z } = Ie(), { mutateAsync: $, isPending: ee } = be(), { mutateAsync: re, isPending: te } = Ne(), {
|
|
71
|
+
mutateAsync: oe,
|
|
72
|
+
isPending: se
|
|
73
|
+
} = Re({
|
|
74
|
+
onSettled: () => Le(F, [i])
|
|
75
|
+
}), g = { employee: f, workAddresses: S }, ne = qe(T), de = g.workAddresses?.find((O) => O.active), e = Ee({
|
|
75
76
|
employee: g.employee,
|
|
76
|
-
homeAddress:
|
|
77
|
-
workAddress:
|
|
77
|
+
homeAddress: ne,
|
|
78
|
+
workAddress: de
|
|
78
79
|
}), h = {
|
|
79
80
|
firstName: e.current.employee?.firstName ?? s?.employee?.firstName ?? "",
|
|
80
81
|
middleInitial: e.current.employee?.middleInitial ?? s?.employee?.middleInitial ?? "",
|
|
@@ -90,29 +91,29 @@ const q = ({
|
|
|
90
91
|
zip: e.current.homeAddress?.zip ?? s?.homeAddress?.zip ?? "",
|
|
91
92
|
state: e.current.homeAddress?.state ?? s?.homeAddress?.state ?? "",
|
|
92
93
|
courtesyWithholding: e.current.homeAddress?.courtesyWithholding ?? !1
|
|
93
|
-
},
|
|
94
|
+
}, ie = e.current.employee?.onboarded || e.current.employee?.onboardingStatus === l.ONBOARDING_COMPLETED || e.current.employee?.onboardingStatus !== void 0 && e.current.employee.onboardingStatus !== l.ADMIN_ONBOARDING_INCOMPLETE ? { ...h, enableSsn: !1, selfOnboarding: !0 } : {
|
|
94
95
|
...h,
|
|
95
96
|
selfOnboarding: a && e.current.employee?.onboardingStatus ? (
|
|
96
97
|
// @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses
|
|
97
|
-
|
|
98
|
+
Ve.has(e.current.employee.onboarding_status)
|
|
98
99
|
) : !1,
|
|
99
100
|
enableSsn: !e.current.employee?.hasSsn,
|
|
100
101
|
ssn: ""
|
|
101
|
-
},
|
|
102
|
+
}, me = {
|
|
102
103
|
...h,
|
|
103
104
|
enableSsn: !e.current.employee?.hasSsn,
|
|
104
105
|
ssn: ""
|
|
105
|
-
}, D =
|
|
106
|
-
resolver:
|
|
107
|
-
(r ?
|
|
106
|
+
}, D = fe({
|
|
107
|
+
resolver: Ae(
|
|
108
|
+
(r ? Ce : ve).and(We)
|
|
108
109
|
),
|
|
109
|
-
defaultValues: r ?
|
|
110
|
-
}), { handleSubmit:
|
|
111
|
-
await
|
|
112
|
-
const { workAddress: N, startDate:
|
|
110
|
+
defaultValues: r ? ie : me
|
|
111
|
+
}), { handleSubmit: ae } = D, b = he({ control: D.control, name: "selfOnboarding" }), le = async (O) => {
|
|
112
|
+
await G(O, async (A) => {
|
|
113
|
+
const { workAddress: N, startDate: ce, selfOnboarding: E, ...I } = A;
|
|
113
114
|
if (e.current.employee) {
|
|
114
115
|
if (E && e.current.employee.onboardingStatus === l.ADMIN_ONBOARDING_INCOMPLETE || !E && e.current.employee.onboardingStatus === l.SELF_ONBOARDING_PENDING_INVITE) {
|
|
115
|
-
const { employeeOnboardingStatus: p } = await
|
|
116
|
+
const { employeeOnboardingStatus: p } = await oe({
|
|
116
117
|
request: {
|
|
117
118
|
employeeId: e.current.employee.uuid,
|
|
118
119
|
requestBody: {
|
|
@@ -125,7 +126,7 @@ const q = ({
|
|
|
125
126
|
onboardingStatus: p.onboardingStatus
|
|
126
127
|
}, n(d.EMPLOYEE_ONBOARDING_STATUS_UPDATED, p);
|
|
127
128
|
}
|
|
128
|
-
const { employee: o } = await
|
|
129
|
+
const { employee: o } = await j({
|
|
129
130
|
request: {
|
|
130
131
|
employeeId: e.current.employee.uuid,
|
|
131
132
|
requestBody: { ...I, version: e.current.employee.version }
|
|
@@ -133,7 +134,7 @@ const q = ({
|
|
|
133
134
|
});
|
|
134
135
|
e.current = { ...e.current, employee: o }, n(d.EMPLOYEE_UPDATED, o);
|
|
135
136
|
} else {
|
|
136
|
-
const { employee: o } = await
|
|
137
|
+
const { employee: o } = await x({
|
|
137
138
|
request: {
|
|
138
139
|
companyId: i,
|
|
139
140
|
requestBody: { ...I, selfOnboarding: E }
|
|
@@ -146,7 +147,7 @@ const q = ({
|
|
|
146
147
|
if ((!b || !r) && !A.selfOnboarding) {
|
|
147
148
|
const { street1: o, street2: p, city: _, state: w, zip: k, courtesyWithholding: M } = A;
|
|
148
149
|
if (e.current.homeAddress) {
|
|
149
|
-
const { employeeAddress: y } = await
|
|
150
|
+
const { employeeAddress: y } = await re({
|
|
150
151
|
request: {
|
|
151
152
|
homeAddressUuid: e.current.homeAddress.uuid,
|
|
152
153
|
requestBody: {
|
|
@@ -162,7 +163,7 @@ const q = ({
|
|
|
162
163
|
});
|
|
163
164
|
e.current = { ...e.current, homeAddress: y }, n(d.EMPLOYEE_HOME_ADDRESS_UPDATED, y);
|
|
164
165
|
} else {
|
|
165
|
-
const { employeeAddress: y } = await
|
|
166
|
+
const { employeeAddress: y } = await $({
|
|
166
167
|
request: {
|
|
167
168
|
employeeId: e.current.employee.uuid,
|
|
168
169
|
requestBody: {
|
|
@@ -180,7 +181,7 @@ const q = ({
|
|
|
180
181
|
}
|
|
181
182
|
if (r)
|
|
182
183
|
if (e.current.workAddress) {
|
|
183
|
-
const { employeeWorkAddress: o } = await
|
|
184
|
+
const { employeeWorkAddress: o } = await X({
|
|
184
185
|
request: {
|
|
185
186
|
workAddressUuid: e.current.workAddress.uuid,
|
|
186
187
|
requestBody: {
|
|
@@ -191,12 +192,12 @@ const q = ({
|
|
|
191
192
|
});
|
|
192
193
|
e.current = { ...e.current, workAddress: o }, n(d.EMPLOYEE_WORK_ADDRESS_UPDATED, o);
|
|
193
194
|
} else {
|
|
194
|
-
const { employeeWorkAddress: o } = await
|
|
195
|
+
const { employeeWorkAddress: o } = await Q({
|
|
195
196
|
request: {
|
|
196
197
|
employeeId: e.current.employee?.uuid,
|
|
197
198
|
requestBody: {
|
|
198
199
|
locationUuid: N,
|
|
199
|
-
effectiveDate: new
|
|
200
|
+
effectiveDate: new Me(A.startDate || /* @__PURE__ */ new Date())
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
});
|
|
@@ -204,58 +205,58 @@ const q = ({
|
|
|
204
205
|
}
|
|
205
206
|
n(d.EMPLOYEE_PROFILE_DONE, {
|
|
206
207
|
...e.current.employee,
|
|
207
|
-
startDate:
|
|
208
|
+
startDate: ce
|
|
208
209
|
});
|
|
209
210
|
});
|
|
210
|
-
},
|
|
211
|
+
}, ue = () => {
|
|
211
212
|
n(d.CANCEL);
|
|
212
213
|
};
|
|
213
|
-
return /* @__PURE__ */ t("section", { className:
|
|
214
|
-
|
|
214
|
+
return /* @__PURE__ */ t("section", { className: H, children: /* @__PURE__ */ t(
|
|
215
|
+
Ue,
|
|
215
216
|
{
|
|
216
217
|
value: {
|
|
217
|
-
companyLocations:
|
|
218
|
+
companyLocations: Y,
|
|
218
219
|
workAddresses: S,
|
|
219
220
|
employee: e.current.employee ?? void 0,
|
|
220
221
|
isSelfOnboardingIntended: b,
|
|
221
|
-
handleCancel:
|
|
222
|
+
handleCancel: ue,
|
|
222
223
|
isAdmin: r,
|
|
223
224
|
isSelfOnboardingEnabled: a,
|
|
224
|
-
isPending:
|
|
225
|
+
isPending: K || Z || ee || te || z || J || se
|
|
225
226
|
},
|
|
226
|
-
children: /* @__PURE__ */ t(
|
|
227
|
-
/* @__PURE__ */ t(
|
|
227
|
+
children: /* @__PURE__ */ t(De, { ...D, children: /* @__PURE__ */ t(Te, { onSubmit: ae(le), children: P || /* @__PURE__ */ pe(ye, { children: [
|
|
228
|
+
/* @__PURE__ */ t(C, {}),
|
|
228
229
|
/* @__PURE__ */ t(L, {}),
|
|
229
230
|
/* @__PURE__ */ t(B, {}),
|
|
230
231
|
/* @__PURE__ */ t(W, {}),
|
|
231
232
|
/* @__PURE__ */ t(U, {}),
|
|
232
|
-
/* @__PURE__ */ t(
|
|
233
|
+
/* @__PURE__ */ t(v, {})
|
|
233
234
|
] }) }) })
|
|
234
235
|
}
|
|
235
236
|
) });
|
|
236
237
|
};
|
|
237
|
-
m.Head =
|
|
238
|
-
m.Actions =
|
|
238
|
+
m.Head = C;
|
|
239
|
+
m.Actions = v;
|
|
239
240
|
m.AdminPersonalDetails = L;
|
|
240
241
|
m.SelfPersonalDetails = B;
|
|
241
242
|
m.HomeAddress = W;
|
|
242
243
|
m.WorkAddress = U;
|
|
243
|
-
const
|
|
244
|
-
const { companyId: r, employeeId: a, onEvent: u, isAdmin:
|
|
244
|
+
const Ir = () => {
|
|
245
|
+
const { companyId: r, employeeId: a, onEvent: u, isAdmin: c, defaultValues: i, isSelfOnboardingEnabled: f } = Ye();
|
|
245
246
|
return /* @__PURE__ */ t(
|
|
246
247
|
m,
|
|
247
248
|
{
|
|
248
|
-
companyId:
|
|
249
|
+
companyId: xe(r),
|
|
249
250
|
employeeId: a,
|
|
250
251
|
onEvent: u,
|
|
251
|
-
isAdmin:
|
|
252
|
-
defaultValues:
|
|
252
|
+
isAdmin: c,
|
|
253
|
+
defaultValues: i?.profile,
|
|
253
254
|
isSelfOnboardingEnabled: f
|
|
254
255
|
}
|
|
255
256
|
);
|
|
256
257
|
};
|
|
257
258
|
export {
|
|
258
259
|
m as Profile,
|
|
259
|
-
|
|
260
|
+
Ir as ProfileContextual
|
|
260
261
|
};
|
|
261
262
|
//# sourceMappingURL=Profile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Profile.js","sources":["../../../../src/components/Employee/Profile/Profile.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { useRef } 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 { invalidateEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { AdminPersonalDetails, AdminPersonalDetailsSchema } 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 type { EmployeeOnboardingContextInterface } from '@/components/Flow/EmployeeOnboardingFlow'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\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 {\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: { employeeWorkAddressList },\n } = useEmployeeAddressesGetWorkAddressesSuspense({ employeeId })\n return (\n <Root\n {...props}\n employee={employee}\n homeAddresses={employeeAddressList}\n workAddresses={employeeWorkAddressList}\n />\n )\n}\n\nconst Root = ({\n isAdmin = false,\n isSelfOnboardingEnabled = true,\n ...props\n}: ProfileProps & ProfileConditionalProps) => {\n useI18n('Employee.Profile')\n useI18n('Employee.HomeAddress')\n const {\n companyId,\n employee,\n homeAddresses,\n workAddresses,\n children,\n className = '',\n defaultValues,\n } = props\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\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 onSettled: () => invalidateEmployeesList(queryClient, [companyId]),\n })\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 ? AdminPersonalDetailsSchema : 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 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: { ...body, selfOnboarding },\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 (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 as string,\n requestBody: {\n version: mergedData.current.homeAddress.version as string,\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\nProfile.Head = Head\nProfile.Actions = Actions\nProfile.AdminPersonalDetails = AdminPersonalDetails\nProfile.SelfPersonalDetails = SelfPersonalDetails\nProfile.HomeAddress = HomeAddress\nProfile.WorkAddress = WorkAddress\n\nexport const ProfileContextual = () => {\n const { companyId, employeeId, onEvent, isAdmin, defaultValues, isSelfOnboardingEnabled } =\n useFlow<EmployeeOnboardingContextInterface>()\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","employeeWorkAddressList","useEmployeeAddressesGetWorkAddressesSuspense","isAdmin","isSelfOnboardingEnabled","useI18n","companyId","homeAddresses","workAddresses","children","className","defaultValues","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","data","useLocationsGetSuspense","companyLocations","createEmployee","isPendingCreateEmployee","useEmployeesCreateMutation","mutateEmployee","isPendingEmployeeUpdate","useEmployeesUpdateMutation","createEmployeeWorkAddress","isPendingCreateWA","useEmployeeAddressesCreateWorkAddressMutation","mutateEmployeeWorkAddress","isPendingWorkAddressUpdate","useEmployeeAddressesUpdateWorkAddressMutation","createEmployeeHomeAddress","isPendingAddHA","useEmployeeAddressesCreateMutation","mutateEmployeeHomeAddress","isPendingUpdateHA","useEmployeeAddressesUpdateMutation","updateEmployeeOnboardingStatus","isPendingUpdateOnboardingStatus","useEmployeesUpdateOnboardingStatusMutation","invalidateEmployeesList","existingData","currentHomeAddress","getEmployeeAddressForProfile","currentWorkAddress","address","mergedData","useRef","initialValues","adminDefaultValues","EmployeeOnboardingStatus","EmployeeSelfOnboardingStatuses","selfDetaultValues","formMethods","useForm","zodResolver","AdminPersonalDetailsSchema","SelfPersonalDetailsSchema","HomeAddressSchema","handleSubmit","watchedSelfOnboarding","useWatch","onSubmit","payload","workAddress","startDate","selfOnboarding","body","employeeOnboardingStatus","componentEvents","employeeData","street1","street2","city","state","zip","courtesyWithholding","employeeAddress","employeeWorkAddress","RFCDate","handleCancel","ProfileProvider","FormProvider","Form","jsxs","Fragment","Head","AdminPersonalDetails","SelfPersonalDetails","HomeAddress","WorkAddress","Actions","ProfileContextual","useFlow","ensureRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EO,SAASA,EAAQC,GAA8C;AAElE,SAAA,gBAAAC,EAACC,MAAe,GAAGF,GAChB,YAAM,aACL,gBAAAC,EAACE,IAAkB,EAAA,GAAGH,GAAO,YAAYA,EAAM,YAC5C,UAAAA,EAAM,SACT,CAAA,IAEA,gBAAAC,EAACG,KAAM,GAAGJ,GAAQ,UAAMA,EAAA,SAAA,CAAS,EAErC,CAAA;AAEJ;AAGA,SAASG,GAAiB,EAAE,YAAAE,GAAY,GAAGL,KAAmD;AACtF,QAAA;AAAA,IACJ,MAAM,EAAE,UAAAM,EAAS;AAAA,EAAA,IACfC,GAAwB,EAAE,YAAAF,GAAY,GACpC;AAAA,IACJ,MAAM,EAAE,qBAAAG,EAAoB;AAAA,EAAA,IAC1BC,GAAgC,EAAE,YAAAJ,GAAY,GAC5C;AAAA,IACJ,MAAM,EAAE,yBAAAK,EAAwB;AAAA,EAAA,IAC9BC,GAA6C,EAAE,YAAAN,GAAY;AAE7D,SAAA,gBAAAJ;AAAA,IAACG;AAAA,IAAA;AAAA,MACE,GAAGJ;AAAA,MACJ,UAAAM;AAAA,MACA,eAAeE;AAAA,MACf,eAAeE;AAAA,IAAA;AAAA,EACjB;AAEJ;AAEA,MAAMN,IAAO,CAAC;AAAA,EACZ,SAAAQ,IA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SAAAT,GAAS,eAAAQ,GAAe,yBAAAP,MAC9D0F,GAA4C;AAG5C,SAAA,gBAAAtG;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,WAAWyG,GAAezF,CAAS;AAAA,MACnC,YAAAV;AAAA,MACA,SAAAgB;AAAA,MACA,SAAAT;AAAA,MACA,eAAeQ,GAAe;AAAA,MAC9B,yBAAAP;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"Profile.js","sources":["../../../../src/components/Employee/Profile/Profile.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { useRef } 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 { invalidateEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport { useQueryClient } from '@tanstack/react-query'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport { AdminPersonalDetails, AdminPersonalDetailsSchema } 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: { employeeWorkAddressList },\n } = useEmployeeAddressesGetWorkAddressesSuspense({ employeeId })\n return (\n <Root\n {...props}\n employee={employee}\n homeAddresses={employeeAddressList}\n workAddresses={employeeWorkAddressList}\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 const queryClient = useQueryClient()\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 onSettled: () => invalidateEmployeesList(queryClient, [companyId]),\n })\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 ? AdminPersonalDetailsSchema : 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 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: { ...body, selfOnboarding },\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 (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 as string,\n requestBody: {\n version: mergedData.current.homeAddress.version as string,\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\nProfile.Head = Head\nProfile.Actions = Actions\nProfile.AdminPersonalDetails = AdminPersonalDetails\nProfile.SelfPersonalDetails = SelfPersonalDetails\nProfile.HomeAddress = HomeAddress\nProfile.WorkAddress = WorkAddress\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","employeeWorkAddressList","useEmployeeAddressesGetWorkAddressesSuspense","isAdmin","isSelfOnboardingEnabled","dictionary","useI18n","useComponentDictionary","companyId","homeAddresses","workAddresses","children","className","defaultValues","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","data","useLocationsGetSuspense","companyLocations","createEmployee","isPendingCreateEmployee","useEmployeesCreateMutation","mutateEmployee","isPendingEmployeeUpdate","useEmployeesUpdateMutation","createEmployeeWorkAddress","isPendingCreateWA","useEmployeeAddressesCreateWorkAddressMutation","mutateEmployeeWorkAddress","isPendingWorkAddressUpdate","useEmployeeAddressesUpdateWorkAddressMutation","createEmployeeHomeAddress","isPendingAddHA","useEmployeeAddressesCreateMutation","mutateEmployeeHomeAddress","isPendingUpdateHA","useEmployeeAddressesUpdateMutation","updateEmployeeOnboardingStatus","isPendingUpdateOnboardingStatus","useEmployeesUpdateOnboardingStatusMutation","invalidateEmployeesList","existingData","currentHomeAddress","getEmployeeAddressForProfile","currentWorkAddress","address","mergedData","useRef","initialValues","adminDefaultValues","EmployeeOnboardingStatus","EmployeeSelfOnboardingStatuses","selfDetaultValues","formMethods","useForm","zodResolver","AdminPersonalDetailsSchema","SelfPersonalDetailsSchema","HomeAddressSchema","handleSubmit","watchedSelfOnboarding","useWatch","onSubmit","payload","workAddress","startDate","selfOnboarding","body","employeeOnboardingStatus","componentEvents","employeeData","street1","street2","city","state","zip","courtesyWithholding","employeeAddress","employeeWorkAddress","RFCDate","handleCancel","ProfileProvider","FormProvider","Form","jsxs","Fragment","Head","AdminPersonalDetails","SelfPersonalDetails","HomeAddress","WorkAddress","Actions","ProfileContextual","useFlow","ensureRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EO,SAASA,EAAQC,GAA8C;AAElE,SAAA,gBAAAC,EAACC,MAAe,GAAGF,GAChB,YAAM,aACL,gBAAAC,EAACE,IAAkB,EAAA,GAAGH,GAAO,YAAYA,EAAM,YAC5C,UAAAA,EAAM,SACT,CAAA,IAEA,gBAAAC,EAACG,KAAM,GAAGJ,GAAQ,UAAMA,EAAA,SAAA,CAAS,EAErC,CAAA;AAEJ;AAGA,SAASG,GAAiB,EAAE,YAAAE,GAAY,GAAGL,KAAmD;AACtF,QAAA;AAAA,IACJ,MAAM,EAAE,UAAAM,EAAS;AAAA,EAAA,IACfC,GAAwB,EAAE,YAAAF,GAAY,GACpC;AAAA,IACJ,MAAM,EAAE,qBAAAG,EAAoB;AAAA,EAAA,IAC1BC,GAAgC,EAAE,YAAAJ,GAAY,GAC5C;AAAA,IACJ,MAAM,EAAE,yBAAAK,EAAwB;AAAA,EAAA,IAC9BC,GAA6C,EAAE,YAAAN,GAAY;AAE7D,SAAA,gBAAAJ;AAAA,IAACG;AAAA,IAAA;AAAA,MACE,GAAGJ;AAAA,MACJ,UAAAM;AAAA,MACA,eAAeE;AAAA,MACf,eAAeE;AAAA,IAAA;AAAA,EACjB;AAEJ;AAEA,MAAMN,IAAO,CAAC;AAAA,EACZ,SAAAQ,IAAU;AAAA,EACV,yBAAAC,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AAAZ,GAAY,SAAAkB,GAAS,SAAAX,GAAS,eAAAU,GAAe,yBAAAT,MAC9D4F,GAAoC;AAGpC,SAAA,gBAAAxG;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,WAAW2G,GAAezF,CAAS;AAAA,MACnC,YAAAZ;AAAA,MACA,SAAAkB;AAAA,MACA,SAAAX;AAAA,MACA,eAAeU,GAAe;AAAA,MAC9B,yBAAAT;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -18,8 +18,8 @@ export declare const SelfPersonalDetailsSchema: z.ZodDiscriminatedUnion<"enableS
|
|
|
18
18
|
ssn: string;
|
|
19
19
|
firstName: string;
|
|
20
20
|
lastName: string;
|
|
21
|
-
dateOfBirth: Date;
|
|
22
21
|
enableSsn: true;
|
|
22
|
+
dateOfBirth: Date;
|
|
23
23
|
middleInitial?: string | undefined;
|
|
24
24
|
}>, z.ZodObject<{
|
|
25
25
|
firstName: z.ZodString;
|
|
@@ -38,8 +38,8 @@ export declare const SelfPersonalDetailsSchema: z.ZodDiscriminatedUnion<"enableS
|
|
|
38
38
|
}, {
|
|
39
39
|
firstName: string;
|
|
40
40
|
lastName: string;
|
|
41
|
-
dateOfBirth: Date;
|
|
42
41
|
enableSsn: false;
|
|
42
|
+
dateOfBirth: Date;
|
|
43
43
|
middleInitial?: string | undefined;
|
|
44
44
|
}>]>;
|
|
45
45
|
export declare const SelfPersonalDetails: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -7,11 +7,10 @@ import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
|
7
7
|
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
8
8
|
import "../../Base/useBase.js";
|
|
9
9
|
import "dompurify";
|
|
10
|
-
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
10
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
12
|
-
const [
|
|
11
|
+
const [x, C] = o("ProfileContext");
|
|
13
12
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
C as ProfileProvider,
|
|
14
|
+
x as useProfile
|
|
16
15
|
};
|
|
17
16
|
//# 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;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PaymentMethodBankAccount } from '@gusto/embedded-api/models/components/paymentmethodbankaccount';
|
|
2
|
+
import { FlowContextInterface } from '../../Flow/useFlow';
|
|
3
|
+
import { BaseComponentInterface } from '../../Base';
|
|
4
|
+
export interface SelfOnboardingFlowProps extends BaseComponentInterface {
|
|
5
|
+
companyId: string;
|
|
6
|
+
employeeId: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SelfOnboardingContextInterface extends FlowContextInterface {
|
|
9
|
+
companyId: string;
|
|
10
|
+
employeeId: string;
|
|
11
|
+
paymentMethod?: PaymentMethodBankAccount;
|
|
12
|
+
}
|
|
13
|
+
export declare function Landing(): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function Profile(): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function Taxes(): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function PaymentMethod(): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function OnboardingSummary(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import { useFlow as r } from "../useFlow.js";
|
|
3
2
|
import { ensureRequired as n } from "../../../helpers/ensureRequired.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { useFlow as r } from "../../Flow/useFlow.js";
|
|
4
|
+
import { Landing as i } from "../Landing/Landing.js";
|
|
5
|
+
import { OnboardingSummary as a } from "../OnboardingSummary/OnboardingSummary.js";
|
|
6
|
+
import { PaymentMethod as d } from "../PaymentMethod/PaymentMethod.js";
|
|
7
|
+
import { Taxes as p } from "../Taxes/Taxes.js";
|
|
8
|
+
import { Profile as s } from "../Profile/Profile.js";
|
|
9
9
|
function v() {
|
|
10
10
|
const { companyId: e, employeeId: o, onEvent: t } = r();
|
|
11
11
|
return /* @__PURE__ */ m(
|
|
@@ -55,4 +55,4 @@ export {
|
|
|
55
55
|
x as Profile,
|
|
56
56
|
E as Taxes
|
|
57
57
|
};
|
|
58
|
-
//# sourceMappingURL=
|
|
58
|
+
//# sourceMappingURL=SelfOnboardingComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfOnboardingComponents.js","sources":["../../../../src/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.tsx"],"sourcesContent":["import type { PaymentMethodBankAccount } from '@gusto/embedded-api/models/components/paymentmethodbankaccount'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport type { FlowContextInterface } from '@/components/Flow/useFlow'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { Landing as LandingComponent } from '@/components/Employee/Landing'\nimport { Profile as ProfileComponent } from '@/components/Employee/Profile'\nimport { Taxes as TaxesComponent } from '@/components/Employee/Taxes'\nimport { PaymentMethod as PaymentMethodComponent } from '@/components/Employee/PaymentMethod'\nimport { OnboardingSummary as OnboardingSummaryComponent } from '@/components/Employee/OnboardingSummary'\n\nexport interface SelfOnboardingFlowProps extends BaseComponentInterface {\n companyId: string\n employeeId: string\n}\nexport interface SelfOnboardingContextInterface extends FlowContextInterface {\n companyId: string\n employeeId: string\n paymentMethod?: PaymentMethodBankAccount\n}\n\nexport function Landing() {\n const { companyId, employeeId, onEvent } = useFlow<SelfOnboardingContextInterface>()\n return (\n <LandingComponent\n companyId={ensureRequired(companyId)}\n employeeId={ensureRequired(employeeId)}\n onEvent={onEvent}\n />\n )\n}\n\nexport function Profile() {\n const { companyId, employeeId, onEvent } = useFlow<SelfOnboardingContextInterface>()\n return (\n <ProfileComponent\n companyId={ensureRequired(companyId)}\n employeeId={ensureRequired(employeeId)}\n onEvent={onEvent}\n isAdmin={false}\n />\n )\n}\n\nexport function Taxes() {\n const { employeeId, onEvent } = useFlow<SelfOnboardingContextInterface>()\n return <TaxesComponent employeeId={ensureRequired(employeeId)} onEvent={onEvent} />\n}\n\nexport function PaymentMethod() {\n const { employeeId, onEvent } = useFlow<SelfOnboardingContextInterface>()\n return <PaymentMethodComponent employeeId={ensureRequired(employeeId)} onEvent={onEvent} />\n}\n\nexport function OnboardingSummary() {\n const { employeeId, onEvent } = useFlow<SelfOnboardingContextInterface>()\n return (\n <OnboardingSummaryComponent\n employeeId={ensureRequired(employeeId)}\n onEvent={onEvent}\n isAdmin={false}\n />\n )\n}\n"],"names":["Landing","companyId","employeeId","onEvent","useFlow","jsx","LandingComponent","ensureRequired","Profile","ProfileComponent","Taxes","TaxesComponent","PaymentMethod","PaymentMethodComponent","OnboardingSummary","OnboardingSummaryComponent"],"mappings":";;;;;;;;AAqBO,SAASA,IAAU;AACxB,QAAM,EAAE,WAAAC,GAAW,YAAAC,GAAY,SAAAC,EAAA,IAAYC,EAAwC;AAEjF,SAAA,gBAAAC;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,WAAWC,EAAeN,CAAS;AAAA,MACnC,YAAYM,EAAeL,CAAU;AAAA,MACrC,SAAAC;AAAA,IAAA;AAAA,EACF;AAEJ;AAEO,SAASK,IAAU;AACxB,QAAM,EAAE,WAAAP,GAAW,YAAAC,GAAY,SAAAC,EAAA,IAAYC,EAAwC;AAEjF,SAAA,gBAAAC;AAAA,IAACI;AAAAA,IAAA;AAAA,MACC,WAAWF,EAAeN,CAAS;AAAA,MACnC,YAAYM,EAAeL,CAAU;AAAA,MACrC,SAAAC;AAAA,MACA,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;AAEO,SAASO,IAAQ;AACtB,QAAM,EAAE,YAAAR,GAAY,SAAAC,EAAQ,IAAIC,EAAwC;AACxE,2BAAQO,GAAe,EAAA,YAAYJ,EAAeL,CAAU,GAAG,SAAAC,GAAkB;AACnF;AAEO,SAASS,IAAgB;AAC9B,QAAM,EAAE,YAAAV,GAAY,SAAAC,EAAQ,IAAIC,EAAwC;AACxE,2BAAQS,GAAuB,EAAA,YAAYN,EAAeL,CAAU,GAAG,SAAAC,GAAkB;AAC3F;AAEO,SAASW,IAAoB;AAClC,QAAM,EAAE,YAAAZ,GAAY,SAAAC,EAAQ,IAAIC,EAAwC;AAEtE,SAAA,gBAAAC;AAAA,IAACU;AAAAA,IAAA;AAAA,MACC,YAAYR,EAAeL,CAAU;AAAA,MACrC,SAAAC;AAAA,MACA,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { createMachine as t } from "robot3";
|
|
3
|
+
import { Landing as a } from "./SelfOnboardingComponents.js";
|
|
4
|
+
import { employeeSelfOnboardingMachine as p } from "./selfOnboardingMachine.js";
|
|
5
|
+
import { Flow as c } from "../../Flow/Flow.js";
|
|
6
|
+
const h = ({ companyId: o, employeeId: e, onEvent: n }) => {
|
|
7
|
+
const r = t(
|
|
8
|
+
"index",
|
|
9
|
+
p,
|
|
10
|
+
(m) => ({
|
|
11
|
+
...m,
|
|
12
|
+
component: a,
|
|
13
|
+
companyId: o,
|
|
14
|
+
employeeId: e
|
|
15
|
+
})
|
|
16
|
+
);
|
|
17
|
+
return /* @__PURE__ */ i(c, { machine: r, onEvent: n });
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
h as SelfOnboardingFlow
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=SelfOnboardingFlow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfOnboardingFlow.js","sources":["../../../../src/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport type {\n SelfOnboardingContextInterface,\n SelfOnboardingFlowProps,\n} from './SelfOnboardingComponents'\nimport { Landing } from './SelfOnboardingComponents'\nimport { employeeSelfOnboardingMachine } from './selfOnboardingMachine'\nimport { Flow } from '@/components/Flow/Flow'\n\nexport const SelfOnboardingFlow = ({ companyId, employeeId, onEvent }: SelfOnboardingFlowProps) => {\n const manageEmployees = createMachine(\n 'index',\n employeeSelfOnboardingMachine,\n (initialContext: SelfOnboardingContextInterface) => ({\n ...initialContext,\n component: Landing,\n companyId,\n employeeId,\n }),\n )\n return <Flow machine={manageEmployees} onEvent={onEvent} />\n}\n"],"names":["SelfOnboardingFlow","companyId","employeeId","onEvent","manageEmployees","createMachine","employeeSelfOnboardingMachine","initialContext","Landing","jsx","Flow"],"mappings":";;;;;AASO,MAAMA,IAAqB,CAAC,EAAE,WAAAC,GAAW,YAAAC,GAAY,SAAAC,QAAuC;AACjG,QAAMC,IAAkBC;AAAA,IACtB;AAAA,IACAC;AAAA,IACA,CAACC,OAAoD;AAAA,MACnD,GAAGA;AAAA,MACH,WAAWC;AAAA,MACX,WAAAP;AAAA,MACA,YAAAC;AAAA,IACF;AAAA,EACF;AACA,SAAQ,gBAAAO,EAAAC,GAAA,EAAK,SAASN,GAAiB,SAAAD,EAAkB,CAAA;AAC3D;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { invoke as i, state as t, createMachine as r, transition as o, reduce as n } from "robot3";
|
|
2
|
+
import { OnboardingSummary as E, PaymentMethod as p, Taxes as c, Profile as a } from "./SelfOnboardingComponents.js";
|
|
2
3
|
import { componentEvents as m } from "../../../shared/constants.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { documentSignerMachine as l } from "../../Employee/DocumentSigner/stateMachine.js";
|
|
4
|
+
import { DocumentListContextual as O } from "../DocumentSigner/documentSignerStateMachine.js";
|
|
5
|
+
import { documentSignerMachine as l } from "../DocumentSigner/stateMachine.js";
|
|
6
6
|
const y = r(
|
|
7
7
|
"index",
|
|
8
8
|
l,
|
|
@@ -70,4 +70,4 @@ const y = r(
|
|
|
70
70
|
export {
|
|
71
71
|
s as employeeSelfOnboardingMachine
|
|
72
72
|
};
|
|
73
|
-
//# sourceMappingURL=
|
|
73
|
+
//# sourceMappingURL=selfOnboardingMachine.js.map
|