@gusto/embedded-react-sdk 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -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/DataCards.js +21 -21
- package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
- 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/ComboBox/ComboBox.js +28 -27
- package/dist/components/Common/UI/ComboBox/ComboBox.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +6 -6
- 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 +4 -3
- 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 +4 -3
- 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 +6 -5
- 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 +4 -3
- 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 +4 -3
- 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 +4 -3
- 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 +6 -5
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +7 -6
- 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 +4 -3
- 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 +4 -3
- 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 +4 -3
- 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 +6 -5
- 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/Actions.js +10 -10
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +29 -29
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
- 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 +4 -3
- 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/Contractor/Address/Actions.d.ts +1 -0
- package/dist/components/Contractor/Address/Actions.js +13 -0
- package/dist/components/Contractor/Address/Actions.js.map +1 -0
- package/dist/components/Contractor/Address/Address.d.ts +16 -0
- package/dist/components/Contractor/Address/Address.js +74 -0
- package/dist/components/Contractor/Address/Address.js.map +1 -0
- package/dist/components/Contractor/Address/Form.d.ts +1 -0
- package/dist/components/Contractor/Address/Form.js +57 -0
- package/dist/components/Contractor/Address/Form.js.map +1 -0
- package/dist/components/Contractor/Address/Head.d.ts +1 -0
- package/dist/components/Contractor/Address/Head.js +15 -0
- package/dist/components/Contractor/Address/Head.js.map +1 -0
- package/dist/components/Contractor/Address/index.d.ts +2 -0
- package/dist/components/Contractor/Address/useAddress.d.ts +33 -0
- package/dist/components/Contractor/Address/useAddress.js +28 -0
- package/dist/components/Contractor/Address/useAddress.js.map +1 -0
- package/dist/components/Contractor/index.d.ts +2 -0
- package/dist/components/Contractor/index.js +5 -0
- package/dist/components/{Flow → Contractor}/index.js.map +1 -1
- 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 -5
- package/dist/components/Employee/Deductions/useDeductions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- 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 +4 -3
- 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/List.js +9 -9
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +2 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
- 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 +9 -8
- 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 +117 -112
- 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 +4 -3
- 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 +2 -2
- 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 +93 -86
- 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.d.ts +2 -2
- package/dist/components/Employee/Taxes/useTaxes.js +4 -3
- 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 +2 -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 +23 -17
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.Address.json.js +35 -0
- package/dist/i18n/en/Contractor.Address.json.js.map +1 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +7 -11
- package/dist/index.js.map +1 -1
- package/dist/shared/constants.d.ts +7 -1
- package/dist/shared/constants.js +52 -46
- 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 +80 -62
- package/package.json +5 -2
- 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/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,49 +1,64 @@
|
|
|
1
|
-
import { z as
|
|
2
|
-
import { createCompoundContext as
|
|
3
|
-
import { FlsaStatus as
|
|
4
|
-
import { yearlyRate as
|
|
5
|
-
const
|
|
6
|
-
jobTitle:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
r.EXEMPT,
|
|
20
|
-
r.SALARIED_NONEXEMPT,
|
|
21
|
-
r.NONEXEMPT,
|
|
22
|
-
r.OWNER,
|
|
23
|
-
r.COMMISSION_ONLY_EXEMPT,
|
|
24
|
-
r.COMISSION_ONLY_NONEXEMPT
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
import { createCompoundContext as u } from "../../Base/createCompoundContext.js";
|
|
3
|
+
import { FlsaStatus as s, FLSA_OVERTIME_SALARY_LIMIT as d } from "../../../shared/constants.js";
|
|
4
|
+
import { yearlyRate as n } from "../../../helpers/payRateCalculator.js";
|
|
5
|
+
const C = e.object({
|
|
6
|
+
jobTitle: e.string().min(1),
|
|
7
|
+
adjustForMinimumWage: e.boolean(),
|
|
8
|
+
minimumWageId: e.string().optional(),
|
|
9
|
+
stateWcCovered: e.boolean().optional(),
|
|
10
|
+
stateWcClassCode: e.string().optional(),
|
|
11
|
+
twoPercentShareholder: e.boolean().optional(),
|
|
12
|
+
flsaStatus: e.enum([
|
|
13
|
+
s.EXEMPT,
|
|
14
|
+
s.SALARIED_NONEXEMPT,
|
|
15
|
+
s.NONEXEMPT,
|
|
16
|
+
s.OWNER,
|
|
17
|
+
s.COMMISSION_ONLY_EXEMPT,
|
|
18
|
+
s.COMMISSION_ONLY_NONEXEMPT
|
|
25
19
|
]),
|
|
26
|
-
paymentUnit:
|
|
27
|
-
rate:
|
|
28
|
-
}).
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
path: ["
|
|
32
|
-
|
|
33
|
-
).
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
path: ["
|
|
42
|
-
|
|
43
|
-
),
|
|
20
|
+
paymentUnit: e.enum(["Hour", "Week", "Month", "Year", "Paycheck"]),
|
|
21
|
+
rate: e.number().optional()
|
|
22
|
+
}).superRefine((t, o) => {
|
|
23
|
+
t.adjustForMinimumWage && (!t.minimumWageId || t.minimumWageId.trim() === "") && o.addIssue({
|
|
24
|
+
code: e.ZodIssueCode.custom,
|
|
25
|
+
path: ["minimumWageId"],
|
|
26
|
+
message: "minimumWageId is required when adjustForMinimumWage is true"
|
|
27
|
+
}), t.stateWcCovered === !0 && (!t.stateWcClassCode || t.stateWcClassCode.trim() === "") && o.addIssue({
|
|
28
|
+
code: e.ZodIssueCode.custom,
|
|
29
|
+
path: ["stateWcClassCode"],
|
|
30
|
+
message: "stateWcClassCode is required when stateWcCovered is true"
|
|
31
|
+
});
|
|
32
|
+
const { flsaStatus: m, paymentUnit: i, rate: a } = t;
|
|
33
|
+
m === s.EXEMPT || m === s.SALARIED_NONEXEMPT || m === s.NONEXEMPT ? ((a === void 0 || a < 1) && o.addIssue({
|
|
34
|
+
code: e.ZodIssueCode.custom,
|
|
35
|
+
path: ["rate"],
|
|
36
|
+
message: "rate must be at least 1 for this FLSA status"
|
|
37
|
+
}), m === s.EXEMPT && a !== void 0 && n(Number(a), i) < d && o.addIssue({
|
|
38
|
+
code: e.ZodIssueCode.custom,
|
|
39
|
+
path: ["rate"],
|
|
40
|
+
message: "FLSA Exempt employees must meet salary threshold"
|
|
41
|
+
})) : m === s.OWNER ? (i !== "Paycheck" && o.addIssue({
|
|
42
|
+
code: e.ZodIssueCode.custom,
|
|
43
|
+
path: ["paymentUnit"],
|
|
44
|
+
message: "paymentUnit must be Paycheck for OWNER"
|
|
45
|
+
}), (a === void 0 || a < 1) && o.addIssue({
|
|
46
|
+
code: e.ZodIssueCode.custom,
|
|
47
|
+
path: ["rate"],
|
|
48
|
+
message: "rate must be at least 1 for OWNER"
|
|
49
|
+
})) : [s.COMMISSION_ONLY_EXEMPT, s.COMMISSION_ONLY_NONEXEMPT].includes(m) && (i !== "Year" && o.addIssue({
|
|
50
|
+
code: e.ZodIssueCode.custom,
|
|
51
|
+
path: ["paymentUnit"],
|
|
52
|
+
message: "paymentUnit must be Year for commission-only FLSA statuses"
|
|
53
|
+
}), a !== 0 && o.addIssue({
|
|
54
|
+
code: e.ZodIssueCode.custom,
|
|
55
|
+
path: ["rate"],
|
|
56
|
+
message: "rate must be exactly 0 for commission-only FLSA statuses"
|
|
57
|
+
}));
|
|
58
|
+
}), [E, l] = u("CompensationContext");
|
|
44
59
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
l as CompensationProvider,
|
|
61
|
+
C as CompensationSchema,
|
|
62
|
+
E as useCompensation
|
|
48
63
|
};
|
|
49
64
|
//# sourceMappingURL=useCompensation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCompensation.js","sources":["../../../../src/components/Employee/Compensation/useCompensation.ts"],"sourcesContent":["import type { Job } from '@gusto/embedded-api/models/components/job'\nimport type { MinimumWage } from '@gusto/embedded-api/models/components/minimumwage'\nimport { z } from 'zod'\nimport { createCompoundContext } from '@/components/Base/createCompoundContext'\nimport { FLSA_OVERTIME_SALARY_LIMIT, FlsaStatus } from '@/shared/constants'\nimport { yearlyRate } from '@/helpers/payRateCalculator'\n\nexport const CompensationSchema = z\n .object({\n jobTitle: z.string().min(1),\n
|
|
1
|
+
{"version":3,"file":"useCompensation.js","sources":["../../../../src/components/Employee/Compensation/useCompensation.ts"],"sourcesContent":["import type { Job } from '@gusto/embedded-api/models/components/job'\nimport type { MinimumWage } from '@gusto/embedded-api/models/components/minimumwage'\nimport { z } from 'zod'\nimport { createCompoundContext } from '@/components/Base/createCompoundContext'\nimport { FLSA_OVERTIME_SALARY_LIMIT, FlsaStatus } from '@/shared/constants'\nimport { yearlyRate } from '@/helpers/payRateCalculator'\n\nexport const CompensationSchema = z\n .object({\n jobTitle: z.string().min(1),\n adjustForMinimumWage: z.boolean(),\n minimumWageId: z.string().optional(),\n stateWcCovered: z.boolean().optional(),\n stateWcClassCode: z.string().optional(),\n twoPercentShareholder: z.boolean().optional(),\n flsaStatus: z.enum([\n FlsaStatus.EXEMPT,\n FlsaStatus.SALARIED_NONEXEMPT,\n FlsaStatus.NONEXEMPT,\n FlsaStatus.OWNER,\n FlsaStatus.COMMISSION_ONLY_EXEMPT,\n FlsaStatus.COMMISSION_ONLY_NONEXEMPT,\n ]),\n paymentUnit: z.enum(['Hour', 'Week', 'Month', 'Year', 'Paycheck']),\n rate: z.number().optional(),\n })\n .superRefine((data, ctx) => {\n // adjustForMinimumWage\n if (data.adjustForMinimumWage && (!data.minimumWageId || data.minimumWageId.trim() === '')) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['minimumWageId'],\n message: 'minimumWageId is required when adjustForMinimumWage is true',\n })\n }\n\n // stateWcCovered\n if (\n data.stateWcCovered === true &&\n (!data.stateWcClassCode || data.stateWcClassCode.trim() === '')\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['stateWcClassCode'],\n message: 'stateWcClassCode is required when stateWcCovered is true',\n })\n }\n\n // FLSA logic\n const { flsaStatus, paymentUnit, rate } = data\n if (\n flsaStatus === FlsaStatus.EXEMPT ||\n flsaStatus === FlsaStatus.SALARIED_NONEXEMPT ||\n flsaStatus === FlsaStatus.NONEXEMPT\n ) {\n if (rate === undefined || rate < 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: 'rate must be at least 1 for this FLSA status',\n })\n }\n // For EXEMPT, check salary threshold\n if (\n flsaStatus === FlsaStatus.EXEMPT &&\n rate !== undefined &&\n yearlyRate(Number(rate), paymentUnit) < FLSA_OVERTIME_SALARY_LIMIT\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: 'FLSA Exempt employees must meet salary threshold',\n })\n }\n } else if (flsaStatus === FlsaStatus.OWNER) {\n if (paymentUnit !== 'Paycheck') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['paymentUnit'],\n message: 'paymentUnit must be Paycheck for OWNER',\n })\n }\n if (rate === undefined || rate < 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: 'rate must be at least 1 for OWNER',\n })\n }\n } else if (\n [FlsaStatus.COMMISSION_ONLY_EXEMPT, FlsaStatus.COMMISSION_ONLY_NONEXEMPT].includes(flsaStatus)\n ) {\n if (paymentUnit !== 'Year') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['paymentUnit'],\n message: 'paymentUnit must be Year for commission-only FLSA statuses',\n })\n }\n if (rate !== 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: 'rate must be exactly 0 for commission-only FLSA statuses',\n })\n }\n }\n })\n\nexport type CompensationInputs = z.input<typeof CompensationSchema>\nexport type CompensationOutputs = z.output<typeof CompensationSchema>\n\nexport type MODE =\n | 'LIST'\n | 'ADD_ADDITIONAL_JOB'\n | 'ADD_INITIAL_JOB'\n | 'EDIT_ADDITIONAL_JOB'\n | 'EDIT_INITIAL_JOB'\n | 'PROCEED'\n\ntype CompensationContextType = {\n employeeJobs: Job[]\n currentJob?: Job | null\n primaryFlsaStatus?: string\n isPending: boolean\n mode: MODE\n showFlsaChangeWarning: boolean\n minimumWages: MinimumWage[]\n state?: string\n showTwoPercentStakeholder?: boolean\n submitWithEffect: (newMode: MODE) => void\n handleAdd: () => void\n handleEdit: (uuid: string) => void\n handleDelete: (uuid: string) => void\n handleFlsaChange: (status: string | number) => void\n handleCancelAddJob: () => void\n}\nconst [useCompensation, CompensationProvider] =\n createCompoundContext<CompensationContextType>('CompensationContext')\nexport { useCompensation, CompensationProvider }\n"],"names":["CompensationSchema","z","FlsaStatus","data","ctx","flsaStatus","paymentUnit","rate","yearlyRate","FLSA_OVERTIME_SALARY_LIMIT","useCompensation","CompensationProvider","createCompoundContext"],"mappings":";;;;AAOa,MAAAA,IAAqBC,EAC/B,OAAO;AAAA,EACN,UAAUA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC1B,sBAAsBA,EAAE,QAAQ;AAAA,EAChC,eAAeA,EAAE,OAAO,EAAE,SAAS;AAAA,EACnC,gBAAgBA,EAAE,QAAQ,EAAE,SAAS;AAAA,EACrC,kBAAkBA,EAAE,OAAO,EAAE,SAAS;AAAA,EACtC,uBAAuBA,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC5C,YAAYA,EAAE,KAAK;AAAA,IACjBC,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,EAAA,CACZ;AAAA,EACD,aAAaD,EAAE,KAAK,CAAC,QAAQ,QAAQ,SAAS,QAAQ,UAAU,CAAC;AAAA,EACjE,MAAMA,EAAE,OAAO,EAAE,SAAS;AAC5B,CAAC,EACA,YAAY,CAACE,GAAMC,MAAQ;AAEtB,EAAAD,EAAK,yBAAyB,CAACA,EAAK,iBAAiBA,EAAK,cAAc,WAAW,OACrFC,EAAI,SAAS;AAAA,IACX,MAAMH,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,eAAe;AAAA,IACtB,SAAS;AAAA,EAAA,CACV,GAKDE,EAAK,mBAAmB,OACvB,CAACA,EAAK,oBAAoBA,EAAK,iBAAiB,KAAK,MAAM,OAE5DC,EAAI,SAAS;AA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AqB;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BaseComponentInterface, CommonComponentInterface } from '../../Base';
|
|
3
|
-
interface DeductionsProps extends CommonComponentInterface {
|
|
3
|
+
interface DeductionsProps extends CommonComponentInterface<'Employee.Deductions'> {
|
|
4
4
|
employeeId: string;
|
|
5
5
|
}
|
|
6
6
|
declare const IncludeDeductionsSchema: z.ZodObject<{
|
|
@@ -12,6 +12,6 @@ declare const IncludeDeductionsSchema: z.ZodObject<{
|
|
|
12
12
|
}>;
|
|
13
13
|
export type IncludeDeductionsPayload = z.output<typeof IncludeDeductionsSchema>;
|
|
14
14
|
export declare function Deductions(props: DeductionsProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export declare const Root: ({ employeeId, className }: DeductionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const Root: ({ employeeId, className, dictionary }: DeductionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export declare const DeductionsContextual: () => import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useTranslation as
|
|
3
|
-
import { useState as M, useMemo as
|
|
1
|
+
import { jsx as t, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as q } from "react-i18next";
|
|
3
|
+
import { useState as M, useMemo as y, useEffect as B } from "react";
|
|
4
4
|
import { z as A } from "zod";
|
|
5
|
-
import { useForm as
|
|
5
|
+
import { useForm as O, FormProvider as T } from "react-hook-form";
|
|
6
6
|
import { zodResolver as R } from "@hookform/resolvers/zod";
|
|
7
|
-
import { useGarnishmentsListSuspense as
|
|
8
|
-
import { useGarnishmentsCreateMutation as
|
|
9
|
-
import { useGarnishmentsUpdateMutation as
|
|
10
|
-
import { useQueryClient as
|
|
11
|
-
import { DeductionSchema as
|
|
12
|
-
import { BaseComponent as
|
|
13
|
-
import { useBase as
|
|
14
|
-
import { Form as
|
|
15
|
-
import { useI18n as
|
|
7
|
+
import { useGarnishmentsListSuspense as G, invalidateGarnishmentsList as L } from "@gusto/embedded-api/react-query/garnishmentsList";
|
|
8
|
+
import { useGarnishmentsCreateMutation as j } from "@gusto/embedded-api/react-query/garnishmentsCreate";
|
|
9
|
+
import { useGarnishmentsUpdateMutation as z } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
|
|
10
|
+
import { useQueryClient as H } from "@tanstack/react-query";
|
|
11
|
+
import { DeductionSchema as V, DeductionsProvider as Q } from "./useDeductions.js";
|
|
12
|
+
import { BaseComponent as k } from "../../Base/Base.js";
|
|
13
|
+
import { useBase as J } from "../../Base/useBase.js";
|
|
14
|
+
import { Form as S } from "../../Common/Form/Form.js";
|
|
15
|
+
import { useComponentDictionary as K, useI18n as W } from "../../../i18n/I18n.js";
|
|
16
16
|
import { componentEvents as s } from "../../../shared/constants.js";
|
|
17
|
-
import { Actions as
|
|
18
|
-
import { IncludeDeductionsForm as
|
|
19
|
-
import { Head as
|
|
20
|
-
import { DeductionForm as
|
|
21
|
-
import { DeductionsList as
|
|
22
|
-
import { useFlow as
|
|
17
|
+
import { Actions as N } from "./Actions.js";
|
|
18
|
+
import { IncludeDeductionsForm as X } from "./IncludeDeductionsForm.js";
|
|
19
|
+
import { Head as _ } from "./Head.js";
|
|
20
|
+
import { DeductionForm as Z } from "./DeductionForm.js";
|
|
21
|
+
import { DeductionsList as $ } from "./DeductionsList.js";
|
|
22
|
+
import { useFlow as ee } from "../../Flow/useFlow.js";
|
|
23
23
|
A.object({ includeDeductions: A.enum(["Yes", "No"]) });
|
|
24
|
-
function
|
|
25
|
-
return /* @__PURE__ */ t(
|
|
24
|
+
function te(n) {
|
|
25
|
+
return /* @__PURE__ */ t(k, { ...n, children: /* @__PURE__ */ t(ne, { ...n, children: n.children }) });
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
const { onEvent:
|
|
29
|
-
|
|
30
|
-
}), { mutateAsync:
|
|
31
|
-
onSettled: () =>
|
|
32
|
-
}),
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
const ne = ({ employeeId: n, className: d, dictionary: a }) => {
|
|
28
|
+
const { onEvent: i, baseSubmitHandler: h } = J(), f = H();
|
|
29
|
+
K("Employee.Deductions", a);
|
|
30
|
+
const { data: b } = G({ employeeId: n }), p = b.garnishmentList, { mutateAsync: g, isPending: x } = z({
|
|
31
|
+
onSettled: () => L(f, [n])
|
|
32
|
+
}), { mutateAsync: w, isPending: F } = j({
|
|
33
|
+
onSettled: () => L(f, [n])
|
|
34
|
+
}), U = p.filter((r) => r.active), [u, m] = M(U.length < 1 ? "INITIAL" : "LIST"), [e, l] = M(null);
|
|
35
|
+
W("Employee.Deductions");
|
|
36
|
+
const D = y(() => ({
|
|
35
37
|
amount: e?.amount ? Number(e.amount) : 0,
|
|
36
38
|
description: e?.description ?? "",
|
|
37
39
|
times: e?.times ?? null,
|
|
@@ -41,19 +43,19 @@ const ee = ({ employeeId: n, className: d }) => {
|
|
|
41
43
|
deductAsPercentage: e?.deductAsPercentage?.toString() ?? "true",
|
|
42
44
|
active: !0,
|
|
43
45
|
courtOrdered: e?.courtOrdered ?? !1
|
|
44
|
-
}), [e]),
|
|
46
|
+
}), [e]), P = O({
|
|
45
47
|
// resolver: zodResolver(IncludeDeductionsSchema),
|
|
46
48
|
defaultValues: { includeDeductions: "No" }
|
|
47
|
-
}),
|
|
48
|
-
resolver: R(
|
|
49
|
-
defaultValues:
|
|
50
|
-
}), { reset:
|
|
49
|
+
}), E = O({
|
|
50
|
+
resolver: R(V),
|
|
51
|
+
defaultValues: D
|
|
52
|
+
}), { reset: v } = E;
|
|
51
53
|
B(() => {
|
|
52
|
-
|
|
53
|
-
}, [e,
|
|
54
|
-
const
|
|
55
|
-
await
|
|
56
|
-
const { garnishment: c } = await
|
|
54
|
+
v(D);
|
|
55
|
+
}, [e, D, v, u]);
|
|
56
|
+
const Y = async (r) => {
|
|
57
|
+
await h(r, async (o) => {
|
|
58
|
+
const { garnishment: c } = await g({
|
|
57
59
|
request: {
|
|
58
60
|
garnishmentId: o.uuid,
|
|
59
61
|
requestBody: {
|
|
@@ -64,28 +66,28 @@ const ee = ({ employeeId: n, className: d }) => {
|
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
});
|
|
67
|
-
|
|
69
|
+
i(s.EMPLOYEE_DEDUCTION_DELETED, c);
|
|
68
70
|
});
|
|
69
|
-
},
|
|
70
|
-
await
|
|
71
|
+
}, I = async (r) => {
|
|
72
|
+
await h(r, async (o) => {
|
|
71
73
|
if ("includeDeductions" in o)
|
|
72
74
|
if (o.includeDeductions === "Yes")
|
|
73
|
-
m("ADD"),
|
|
75
|
+
m("ADD"), i(s.EMPLOYEE_DEDUCTION_ADD);
|
|
74
76
|
else {
|
|
75
|
-
|
|
77
|
+
i(s.EMPLOYEE_DEDUCTION_DONE);
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
80
|
if (!("includeDeductions" in o)) {
|
|
79
81
|
if (u === "ADD") {
|
|
80
|
-
const { garnishment: c } = await
|
|
82
|
+
const { garnishment: c } = await w({
|
|
81
83
|
request: {
|
|
82
84
|
employeeId: n,
|
|
83
85
|
requestBody: { ...o, times: o.recurring ? null : 1 }
|
|
84
86
|
}
|
|
85
87
|
});
|
|
86
|
-
|
|
88
|
+
i(s.EMPLOYEE_DEDUCTION_CREATED, c);
|
|
87
89
|
} else if (u === "EDIT") {
|
|
88
|
-
const { garnishment: c } = await
|
|
90
|
+
const { garnishment: c } = await g({
|
|
89
91
|
request: {
|
|
90
92
|
garnishmentId: e?.uuid ?? "",
|
|
91
93
|
requestBody: {
|
|
@@ -95,61 +97,61 @@ const ee = ({ employeeId: n, className: d }) => {
|
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
});
|
|
98
|
-
|
|
100
|
+
i(s.EMPLOYEE_DEDUCTION_UPDATED, c), l(null);
|
|
99
101
|
}
|
|
100
102
|
m("LIST");
|
|
101
103
|
}
|
|
102
104
|
});
|
|
103
105
|
};
|
|
104
106
|
return /* @__PURE__ */ t("section", { className: d, children: /* @__PURE__ */ t(
|
|
105
|
-
|
|
107
|
+
Q,
|
|
106
108
|
{
|
|
107
109
|
value: {
|
|
108
|
-
isPending:
|
|
110
|
+
isPending: F || x,
|
|
109
111
|
employeeId: n,
|
|
110
112
|
mode: u,
|
|
111
|
-
deductions:
|
|
113
|
+
deductions: p,
|
|
112
114
|
handleAdd: () => {
|
|
113
115
|
m("ADD");
|
|
114
116
|
},
|
|
115
117
|
handleCancel: () => {
|
|
116
|
-
m("LIST"),
|
|
118
|
+
m("LIST"), l(null);
|
|
117
119
|
},
|
|
118
|
-
handleDelete:
|
|
119
|
-
handleEdit: (
|
|
120
|
-
m("EDIT"),
|
|
120
|
+
handleDelete: Y,
|
|
121
|
+
handleEdit: (r) => {
|
|
122
|
+
m("EDIT"), l(r);
|
|
121
123
|
},
|
|
122
124
|
handlePassthrough: () => {
|
|
123
|
-
|
|
125
|
+
i(s.EMPLOYEE_DEDUCTION_DONE);
|
|
124
126
|
}
|
|
125
127
|
},
|
|
126
|
-
children: u === "INITIAL" ? /* @__PURE__ */ t(
|
|
127
|
-
/* @__PURE__ */ t(
|
|
128
|
-
/* @__PURE__ */ t(K, {}),
|
|
129
|
-
/* @__PURE__ */ t(S, {})
|
|
130
|
-
] }) }) : /* @__PURE__ */ t(O, { ...D, children: /* @__PURE__ */ I(L, { onSubmit: D.handleSubmit(v), children: [
|
|
131
|
-
/* @__PURE__ */ t(N, {}),
|
|
128
|
+
children: u === "INITIAL" ? /* @__PURE__ */ t(T, { ...P, children: /* @__PURE__ */ C(S, { onSubmit: P.handleSubmit(I), children: [
|
|
129
|
+
/* @__PURE__ */ t(_, {}),
|
|
132
130
|
/* @__PURE__ */ t(X, {}),
|
|
133
|
-
/* @__PURE__ */ t(
|
|
134
|
-
|
|
131
|
+
/* @__PURE__ */ t(N, {})
|
|
132
|
+
] }) }) : /* @__PURE__ */ t(T, { ...E, children: /* @__PURE__ */ C(S, { onSubmit: E.handleSubmit(I), children: [
|
|
133
|
+
/* @__PURE__ */ t(_, {}),
|
|
134
|
+
/* @__PURE__ */ t($, {}),
|
|
135
|
+
/* @__PURE__ */ t(Z, {}),
|
|
136
|
+
/* @__PURE__ */ t(N, {})
|
|
135
137
|
] }) })
|
|
136
138
|
}
|
|
137
139
|
) });
|
|
138
|
-
},
|
|
139
|
-
const { employeeId: n, onEvent: d } =
|
|
140
|
+
}, Ne = () => {
|
|
141
|
+
const { employeeId: n, onEvent: d } = ee(), { t: a } = q("common");
|
|
140
142
|
if (!n)
|
|
141
143
|
throw new Error(
|
|
142
|
-
|
|
144
|
+
a("errors.missingParamsOrContext", {
|
|
143
145
|
component: "Deductions",
|
|
144
146
|
param: "employeeId",
|
|
145
147
|
provider: "FlowProvider"
|
|
146
148
|
})
|
|
147
149
|
);
|
|
148
|
-
return /* @__PURE__ */ t(
|
|
150
|
+
return /* @__PURE__ */ t(te, { employeeId: n, onEvent: d });
|
|
149
151
|
};
|
|
150
152
|
export {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
te as Deductions,
|
|
154
|
+
Ne as DeductionsContextual,
|
|
155
|
+
ne as Root
|
|
154
156
|
};
|
|
155
157
|
//# sourceMappingURL=Deductions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deductions.js","sources":["../../../../src/components/Employee/Deductions/Deductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEffect, useMemo, useState } from 'react'\nimport { z } from 'zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {\n useGarnishmentsListSuspense,\n invalidateGarnishmentsList,\n} from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useQueryClient } from '@tanstack/react-query'\nimport {\n type DeductionInputs,\n type DeductionPayload,\n DeductionSchema,\n DeductionsProvider,\n type MODE,\n} from './useDeductions'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Actions } from '@/components/Employee/Deductions/Actions'\nimport { IncludeDeductionsForm } from '@/components/Employee/Deductions/IncludeDeductionsForm'\nimport { Head } from '@/components/Employee/Deductions/Head'\nimport { DeductionForm } from '@/components/Employee/Deductions/DeductionForm'\nimport { DeductionsList } from '@/components/Employee/Deductions/DeductionsList'\nimport type { EmployeeOnboardingContextInterface } from '@/components/Flow/EmployeeOnboardingFlow'\nimport { useFlow } from '@/components/Flow/useFlow'\n\ninterface DeductionsProps extends CommonComponentInterface {\n employeeId: string\n}\n\nconst IncludeDeductionsSchema = z.object({ includeDeductions: z.enum(['Yes', 'No']) })\nexport type IncludeDeductionsPayload = z.output<typeof IncludeDeductionsSchema>\n\nexport function Deductions(props: DeductionsProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\nexport const Root = ({ employeeId, className }: DeductionsProps) => {\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n\n // Used for deletion or edit of deduction\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation({\n onSettled: () => invalidateGarnishmentsList(queryClient, [employeeId]),\n })\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation({\n onSettled: () => invalidateGarnishmentsList(queryClient, [employeeId]),\n })\n\n const activeDeductions = deductions.filter(deduction => deduction.active)\n const [mode, setMode] = useState<MODE>(activeDeductions.length < 1 ? 'INITIAL' : 'LIST')\n const [currentDeduction, setCurrentDeduction] = useState<Garnishment | null>(null)\n useI18n('Employee.Deductions')\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: currentDeduction?.amount ? Number(currentDeduction.amount) : 0,\n description: currentDeduction?.description ?? '',\n times: currentDeduction?.times ?? null,\n recurring: currentDeduction?.recurring?.toString() ?? 'true',\n annualMaximum: currentDeduction?.annualMaximum\n ? Number(currentDeduction.annualMaximum)\n : null,\n payPeriodMaximum: currentDeduction?.payPeriodMaximum\n ? Number(currentDeduction.payPeriodMaximum)\n : null,\n deductAsPercentage: currentDeduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: currentDeduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [currentDeduction])\n\n const includeDeductionsFormMethods = useForm<IncludeDeductionsPayload>({\n // resolver: zodResolver(IncludeDeductionsSchema),\n defaultValues: { includeDeductions: 'No' },\n })\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n\n const { reset: resetForm } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [currentDeduction, defaultValues, resetForm, mode])\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n //Deletion of deduction is simply updating it with active: false\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n })\n }\n const onSubmit: SubmitHandler<DeductionPayload | IncludeDeductionsPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if ('includeDeductions' in payload) {\n if (payload.includeDeductions === 'Yes') {\n setMode('ADD')\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n return\n }\n }\n if (!('includeDeductions' in payload)) {\n if (mode === 'ADD') {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else if (mode === 'EDIT') {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: currentDeduction?.uuid ?? '',\n requestBody: {\n ...payload,\n version: currentDeduction?.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n setCurrentDeduction(null)\n }\n setMode('LIST')\n }\n })\n }\n const handleAdd = () => {\n setMode('ADD')\n }\n const handleCancel = () => {\n setMode('LIST')\n setCurrentDeduction(null)\n }\n const handleEdit = (deduction: Garnishment) => {\n setMode('EDIT')\n setCurrentDeduction(deduction)\n }\n const handlePassthrough = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n return (\n <section className={className}>\n <DeductionsProvider\n value={{\n isPending: isPendingCreate || isPendingUpdate,\n employeeId,\n mode,\n deductions,\n handleAdd,\n handleCancel,\n handleDelete,\n handleEdit,\n handlePassthrough,\n }}\n >\n {mode === 'INITIAL' ? (\n <FormProvider {...includeDeductionsFormMethods}>\n <Form onSubmit={includeDeductionsFormMethods.handleSubmit(onSubmit)}>\n <Head />\n <IncludeDeductionsForm />\n <Actions />\n </Form>\n </FormProvider>\n ) : (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Head />\n <DeductionsList />\n <DeductionForm />\n <Actions />\n </Form>\n </FormProvider>\n )}\n </DeductionsProvider>\n </section>\n )\n}\n\nexport const DeductionsContextual = () => {\n const { employeeId, onEvent } = useFlow<EmployeeOnboardingContextInterface>()\n const { t } = useTranslation('common')\n\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'Deductions',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Deductions employeeId={employeeId} onEvent={onEvent} />\n}\n"],"names":["z","Deductions","props","jsx","BaseComponent","Root","employeeId","className","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","data","useGarnishmentsListSuspense","deductions","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","invalidateGarnishmentsList","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","activeDeductions","deduction","mode","setMode","useState","currentDeduction","setCurrentDeduction","useI18n","defaultValues","useMemo","includeDeductionsFormMethods","useForm","formMethods","zodResolver","DeductionSchema","resetForm","useEffect","handleDelete","payload","garnishment","componentEvents","onSubmit","createDeductionResponse","updateDeductionResponse","DeductionsProvider","FormProvider","jsxs","Form","Head","IncludeDeductionsForm","Actions","DeductionsList","DeductionForm","DeductionsContextual","useFlow","t","useTranslation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyCgCA,EAAE,OAAO,EAAE,mBAAmBA,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,EAAG,CAAA;AAG9E,SAASC,EAAWC,GAAiD;AAExE,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AACO,MAAMG,KAAO,CAAC,EAAE,YAAAC,GAAY,WAAAC,QAAiC;AAClE,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GACzCC,IAAcC,EAAe,GAE7B,EAAE,MAAAC,EAAK,IAAIC,EAA4B,EAAE,YAAAR,GAAY,GACrDS,IAAaF,EAAK,iBAGlB,EAAE,aAAaG,GAAiB,WAAWC,EAAA,IAC/CC,EAA8B;AAAA,IAC5B,WAAW,MAAMC,EAA2BR,GAAa,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,MAAM;AACxC,QAAM,EAAE,YAAAlD,GAAY,SAAAE,EAAQ,IAAIiD,EAA4C,GACtE,EAAE,GAAAC,EAAA,IAAMC,EAAe,QAAQ;AAErC,MAAI,CAACrD;AACH,UAAM,IAAI;AAAA,MACRoD,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEK,SAAA,gBAAAvD,EAACF,GAAW,EAAA,YAAAK,GAAwB,SAAAE,EAAkB,CAAA;AAC/D;"}
|
|
1
|
+
{"version":3,"file":"Deductions.js","sources":["../../../../src/components/Employee/Deductions/Deductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEffect, useMemo, useState } from 'react'\nimport { z } from 'zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {\n useGarnishmentsListSuspense,\n invalidateGarnishmentsList,\n} from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useQueryClient } from '@tanstack/react-query'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport {\n type DeductionInputs,\n type DeductionPayload,\n DeductionSchema,\n DeductionsProvider,\n type MODE,\n} from './useDeductions'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Actions } from '@/components/Employee/Deductions/Actions'\nimport { IncludeDeductionsForm } from '@/components/Employee/Deductions/IncludeDeductionsForm'\nimport { Head } from '@/components/Employee/Deductions/Head'\nimport { DeductionForm } from '@/components/Employee/Deductions/DeductionForm'\nimport { DeductionsList } from '@/components/Employee/Deductions/DeductionsList'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface DeductionsProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nconst IncludeDeductionsSchema = z.object({ includeDeductions: z.enum(['Yes', 'No']) })\nexport type IncludeDeductionsPayload = z.output<typeof IncludeDeductionsSchema>\n\nexport function Deductions(props: DeductionsProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\nexport const Root = ({ employeeId, className, dictionary }: DeductionsProps) => {\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n useComponentDictionary('Employee.Deductions', dictionary)\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n\n // Used for deletion or edit of deduction\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation({\n onSettled: () => invalidateGarnishmentsList(queryClient, [employeeId]),\n })\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation({\n onSettled: () => invalidateGarnishmentsList(queryClient, [employeeId]),\n })\n\n const activeDeductions = deductions.filter(deduction => deduction.active)\n const [mode, setMode] = useState<MODE>(activeDeductions.length < 1 ? 'INITIAL' : 'LIST')\n const [currentDeduction, setCurrentDeduction] = useState<Garnishment | null>(null)\n useI18n('Employee.Deductions')\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: currentDeduction?.amount ? Number(currentDeduction.amount) : 0,\n description: currentDeduction?.description ?? '',\n times: currentDeduction?.times ?? null,\n recurring: currentDeduction?.recurring?.toString() ?? 'true',\n annualMaximum: currentDeduction?.annualMaximum\n ? Number(currentDeduction.annualMaximum)\n : null,\n payPeriodMaximum: currentDeduction?.payPeriodMaximum\n ? Number(currentDeduction.payPeriodMaximum)\n : null,\n deductAsPercentage: currentDeduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: currentDeduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [currentDeduction])\n\n const includeDeductionsFormMethods = useForm<IncludeDeductionsPayload>({\n // resolver: zodResolver(IncludeDeductionsSchema),\n defaultValues: { includeDeductions: 'No' },\n })\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n\n const { reset: resetForm } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [currentDeduction, defaultValues, resetForm, mode])\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n //Deletion of deduction is simply updating it with active: false\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n })\n }\n const onSubmit: SubmitHandler<DeductionPayload | IncludeDeductionsPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if ('includeDeductions' in payload) {\n if (payload.includeDeductions === 'Yes') {\n setMode('ADD')\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n return\n }\n }\n if (!('includeDeductions' in payload)) {\n if (mode === 'ADD') {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else if (mode === 'EDIT') {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: currentDeduction?.uuid ?? '',\n requestBody: {\n ...payload,\n version: currentDeduction?.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n setCurrentDeduction(null)\n }\n setMode('LIST')\n }\n })\n }\n const handleAdd = () => {\n setMode('ADD')\n }\n const handleCancel = () => {\n setMode('LIST')\n setCurrentDeduction(null)\n }\n const handleEdit = (deduction: Garnishment) => {\n setMode('EDIT')\n setCurrentDeduction(deduction)\n }\n const handlePassthrough = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n return (\n <section className={className}>\n <DeductionsProvider\n value={{\n isPending: isPendingCreate || isPendingUpdate,\n employeeId,\n mode,\n deductions,\n handleAdd,\n handleCancel,\n handleDelete,\n handleEdit,\n handlePassthrough,\n }}\n >\n {mode === 'INITIAL' ? (\n <FormProvider {...includeDeductionsFormMethods}>\n <Form onSubmit={includeDeductionsFormMethods.handleSubmit(onSubmit)}>\n <Head />\n <IncludeDeductionsForm />\n <Actions />\n </Form>\n </FormProvider>\n ) : (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Head />\n <DeductionsList />\n <DeductionForm />\n <Actions />\n </Form>\n </FormProvider>\n )}\n </DeductionsProvider>\n </section>\n )\n}\n\nexport const DeductionsContextual = () => {\n const { employeeId, onEvent } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation('common')\n\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'Deductions',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Deductions employeeId={employeeId} onEvent={onEvent} />\n}\n"],"names":["z","Deductions","props","jsx","BaseComponent","Root","employeeId","className","dictionary","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","useComponentDictionary","data","useGarnishmentsListSuspense","deductions","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","invalidateGarnishmentsList","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","activeDeductions","deduction","mode","setMode","useState","currentDeduction","setCurrentDeduction","useI18n","defaultValues","useMemo","includeDeductionsFormMethods","useForm","formMethods","zodResolver","DeductionSchema","resetForm","useEffect","handleDelete","payload","garnishment","componentEvents","onSubmit","createDeductionResponse","updateDeductionResponse","DeductionsProvider","FormProvider","jsxs","Form","Head","IncludeDeductionsForm","Actions","DeductionsList","DeductionForm","DeductionsContextual","useFlow","t","useTranslation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0CgCA,EAAE,OAAO,EAAE,mBAAmBA,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,EAAG,CAAA;AAG9E,SAASC,GAAWC,GAAiD;AAExE,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AACO,MAAMG,KAAO,CAAC,EAAE,YAAAC,GAAY,WAAAC,GAAW,YAAAC,QAAkC;AAC9E,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GACzCC,IAAcC,EAAe;AACnC,EAAAC,EAAuB,uBAAuBN,CAAU;AAExD,QAAM,EAAE,MAAAO,EAAK,IAAIC,EAA4B,EAAE,YAAAV,GAAY,GACrDW,IAAaF,EAAK,iBAGlB,EAAE,aAAaG,GAAiB,WAAWC,EAAA,IAC/CC,EAA8B;AAAA,IAC5B,WAAW,MAAMC,EAA2BT,GAAa,CAACN,CAAU,CAAC;AAAA,EAAA,CACtE,GACG,EAAE,aAAagB,GAAiB,WAAWC,EAAA,IAC/CC,EAA8B;AAAA,IAC5B,WAAW,MAAMH,EAA2BT,GAAa,CAACN,CAAU,CAAC;AAAA,EAAA,CACtE,GAEGmB,IAAmBR,EAAW,OAAO,CAAAS,MAAaA,EAAU,MAAM,GAClE,CAACC,GAAMC,CAAO,IAAIC,EAAeJ,EAAiB,SAAS,IAAI,YAAY,MAAM,GACjF,CAACK,GAAkBC,CAAmB,IAAIF,EAA6B,IAAI;AACjF,EAAAG,EAAQ,qBAAqB;AAEvB,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embedded-api/models/errors/apierror";
|
|
|
7
7
|
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
8
8
|
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
9
9
|
import "../../Base/useBase.js";
|
|
10
|
+
import "../../../shared/constants.js";
|
|
10
11
|
import "dompurify";
|
|
11
12
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
13
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
13
|
-
const
|
|
14
|
+
const f = r.object({
|
|
14
15
|
active: r.boolean(),
|
|
15
16
|
amount: r.number().min(0).transform(String),
|
|
16
17
|
description: r.string().min(1),
|
|
@@ -21,10 +22,10 @@ const g = r.object({
|
|
|
21
22
|
annualMaximum: r.number().min(0).transform((t) => t > 0 ? t.toString() : null).nullable(),
|
|
22
23
|
payPeriodMaximum: r.number().min(0).transform((t) => t > 0 ? t.toString() : null).nullable(),
|
|
23
24
|
deductAsPercentage: r.string().transform((t) => t === "true")
|
|
24
|
-
}), [
|
|
25
|
+
}), [x, D] = o("DeductionsContext");
|
|
25
26
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
f as DeductionSchema,
|
|
28
|
+
D as DeductionsProvider,
|
|
29
|
+
x as useDeductions
|
|
29
30
|
};
|
|
30
31
|
//# sourceMappingURL=useDeductions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeductions.js","sources":["../../../../src/components/Employee/Deductions/useDeductions.ts"],"sourcesContent":["import type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { z } from 'zod'\nimport { createCompoundContext } from '@/components/Base'\n\nexport type MODE = 'ADD' | 'LIST' | 'INITIAL' | 'EDIT'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(), //The number of times to apply the garnishment. Ignored if recurring is true.\n recurring: z.string().transform(val => val === 'true'),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.string().transform(val => val === 'true'),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ntype DeductionsContextType = {\n isPending: boolean\n deductions: Garnishment[]\n employeeId: string\n mode: MODE\n handleAdd: () => void\n handleCancel: () => void\n handleEdit: (deduction: Garnishment) => void\n handleDelete: (deduction: Garnishment) => void\n handlePassthrough: () => void\n}\nconst [useDeductions, DeductionsProvider] =\n createCompoundContext<DeductionsContextType>('DeductionsContext')\nexport { useDeductions, DeductionsProvider }\n"],"names":["DeductionSchema","z","val","useDeductions","DeductionsProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDeductions.js","sources":["../../../../src/components/Employee/Deductions/useDeductions.ts"],"sourcesContent":["import type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { z } from 'zod'\nimport { createCompoundContext } from '@/components/Base'\n\nexport type MODE = 'ADD' | 'LIST' | 'INITIAL' | 'EDIT'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(), //The number of times to apply the garnishment. Ignored if recurring is true.\n recurring: z.string().transform(val => val === 'true'),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.string().transform(val => val === 'true'),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ntype DeductionsContextType = {\n isPending: boolean\n deductions: Garnishment[]\n employeeId: string\n mode: MODE\n handleAdd: () => void\n handleCancel: () => void\n handleEdit: (deduction: Garnishment) => void\n handleDelete: (deduction: Garnishment) => void\n handlePassthrough: () => void\n}\nconst [useDeductions, DeductionsProvider] =\n createCompoundContext<DeductionsContextType>('DeductionsContext')\nexport { useDeductions, DeductionsProvider }\n"],"names":["DeductionSchema","z","val","useDeductions","DeductionsProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;AAMa,MAAAA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAQ;AAAA,EAClB,QAAQA,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,cAAcA,EAAE,QAAQ;AAAA,EACxB,OAAOA,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAC3B,WAAWA,EAAE,SAAS,UAAU,CAAAC,MAAOA,MAAQ,MAAM;AAAA,EACrD,eAAeD,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAQC,MAAAA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAS;AAAA,EACZ,kBAAkBD,EACf,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAQC,MAAAA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAS;AAAA,EACZ,oBAAoBD,EAAE,SAAS,UAAU,CAAAC,MAAOA,MAAQ,MAAM;AAChE,CAAC,GAgBK,CAACC,GAAeC,CAAkB,IACtCC,EAA6C,mBAAmB;"}
|
|
@@ -6,12 +6,13 @@ import "@gusto/embedded-api/models/errors/apierror";
|
|
|
6
6
|
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
7
7
|
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
8
8
|
import "../../../Base/useBase.js";
|
|
9
|
+
import "../../../../shared/constants.js";
|
|
9
10
|
import "dompurify";
|
|
10
11
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
12
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
12
|
-
const [
|
|
13
|
+
const [D, L] = t("DocumentListContext");
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
L as DocumentListProvider,
|
|
16
|
+
D as useDocumentList
|
|
16
17
|
};
|
|
17
18
|
//# sourceMappingURL=useDocumentList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;AAYA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DocumentList } from './DocumentList/DocumentList';
|
|
2
|
+
import { SignatureForm } from './SignatureForm/SignatureForm';
|
|
3
|
+
import { BaseComponentInterface } from '../../Base';
|
|
4
|
+
export interface DocumentSignerProps extends BaseComponentInterface<'Employee.DocumentSigner'> {
|
|
5
|
+
employeeId: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const DocumentSigner: {
|
|
8
|
+
({ employeeId, onEvent, dictionary }: DocumentSignerProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
DocumentList: typeof DocumentList;
|
|
10
|
+
SignatureForm: typeof SignatureForm;
|
|
11
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { createMachine as c } from "robot3";
|
|
3
|
+
import { DocumentListContextual as p } from "./documentSignerStateMachine.js";
|
|
4
|
+
import { documentSignerMachine as u } from "./stateMachine.js";
|
|
5
|
+
import { DocumentList as a } from "./DocumentList/DocumentList.js";
|
|
6
|
+
import { SignatureForm as f } from "./SignatureForm/SignatureForm.js";
|
|
7
|
+
import { Flow as s } from "../../Flow/Flow.js";
|
|
8
|
+
import { useComponentDictionary as g } from "../../../i18n/I18n.js";
|
|
9
|
+
const o = ({ employeeId: t, onEvent: m, dictionary: r }) => {
|
|
10
|
+
g("Employee.DocumentSigner", r);
|
|
11
|
+
const e = c(
|
|
12
|
+
"index",
|
|
13
|
+
u,
|
|
14
|
+
(n) => ({
|
|
15
|
+
...n,
|
|
16
|
+
component: p,
|
|
17
|
+
employeeId: t
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
return /* @__PURE__ */ i(s, { machine: e, onEvent: m });
|
|
21
|
+
};
|
|
22
|
+
o.DocumentList = a;
|
|
23
|
+
o.SignatureForm = f;
|
|
24
|
+
export {
|
|
25
|
+
o as DocumentSigner
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=DocumentSigner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentSigner.js","sources":["../../../../src/components/Employee/DocumentSigner/DocumentSigner.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport {\n DocumentListContextual,\n type DocumentSignerContextInterface,\n} from './documentSignerStateMachine'\nimport { documentSignerMachine } from './stateMachine'\nimport { DocumentList } from './DocumentList/DocumentList'\nimport { SignatureForm } from './SignatureForm/SignatureForm'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport interface DocumentSignerProps extends BaseComponentInterface<'Employee.DocumentSigner'> {\n employeeId: string\n}\n\nexport const DocumentSigner = ({ employeeId, onEvent, dictionary }: DocumentSignerProps) => {\n useComponentDictionary('Employee.DocumentSigner', dictionary)\n\n const documentSigner = createMachine(\n 'index',\n documentSignerMachine,\n (initialContext: DocumentSignerContextInterface) => ({\n ...initialContext,\n component: DocumentListContextual,\n employeeId,\n }),\n )\n return <Flow machine={documentSigner} onEvent={onEvent} />\n}\n\nDocumentSigner.DocumentList = DocumentList\nDocumentSigner.SignatureForm = SignatureForm\n"],"names":["DocumentSigner","employeeId","onEvent","dictionary","useComponentDictionary","documentSigner","createMachine","documentSignerMachine","initialContext","DocumentListContextual","jsx","Flow","DocumentList","SignatureForm"],"mappings":";;;;;;;;AAgBO,MAAMA,IAAiB,CAAC,EAAE,YAAAC,GAAY,SAAAC,GAAS,YAAAC,QAAsC;AAC1F,EAAAC,EAAuB,2BAA2BD,CAAU;AAE5D,QAAME,IAAiBC;AAAA,IACrB;AAAA,IACAC;AAAA,IACA,CAACC,OAAoD;AAAA,MACnD,GAAGA;AAAA,MACH,WAAWC;AAAA,MACX,YAAAR;AAAA,IACF;AAAA,EACF;AACA,SAAQ,gBAAAS,EAAAC,GAAA,EAAK,SAASN,GAAgB,SAAAH,EAAkB,CAAA;AAC1D;AAEAF,EAAe,eAAeY;AAC9BZ,EAAe,gBAAgBa;"}
|
|
@@ -6,12 +6,13 @@ import "@gusto/embedded-api/models/errors/apierror";
|
|
|
6
6
|
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
7
7
|
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
8
8
|
import "../../../Base/useBase.js";
|
|
9
|
+
import "../../../../shared/constants.js";
|
|
9
10
|
import "dompurify";
|
|
10
11
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
12
|
import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
|
|
12
|
-
const [
|
|
13
|
+
const [F, S] = o("SignatureFormContext");
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
S as SignatureFormProvider,
|
|
16
|
+
F as useSignatureForm
|
|
16
17
|
};
|
|
17
18
|
//# sourceMappingURL=useSignatureForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype SignatureFormContextType = {\n form: Form\n pdfUrl?: string | null\n handleBack: () => void\n isPending: boolean\n}\n\nconst [useSignatureForm, SignatureFormProvider] =\n createCompoundContext<SignatureFormContextType>('SignatureFormContext')\nexport { useSignatureForm, SignatureFormProvider }\n"],"names":["useSignatureForm","SignatureFormProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype SignatureFormContextType = {\n form: Form\n pdfUrl?: string | null\n handleBack: () => void\n isPending: boolean\n}\n\nconst [useSignatureForm, SignatureFormProvider] =\n createCompoundContext<SignatureFormContextType>('SignatureFormContext')\nexport { useSignatureForm, SignatureFormProvider }\n"],"names":["useSignatureForm","SignatureFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;AAUA,MAAM,CAACA,GAAkBC,CAAqB,IAC5CC,EAAgD,sBAAsB;"}
|