@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,14 +1,14 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { BankAccount as c } from "../BankAccount/BankAccount.js";
|
|
3
|
+
import { StateTaxes as u } from "../StateTaxes/StateTaxes.js";
|
|
4
4
|
import { OnboardingOverview as m } from "../OnboardingOverview/OnboardingOverview.js";
|
|
5
|
-
import {
|
|
5
|
+
import { Locations as d } from "../Locations/Locations.js";
|
|
6
6
|
import { useFlow as e } from "../../Flow/useFlow.js";
|
|
7
7
|
import { ensureRequired as r } from "../../../helpers/ensureRequired.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { Industry as
|
|
8
|
+
import { OnboardingFlow as p } from "../../Employee/OnboardingFlow/OnboardingFlow.js";
|
|
9
|
+
import { DocumentSigner as i } from "../DocumentSigner/DocumentSigner.js";
|
|
10
|
+
import { PaySchedule as f } from "../PaySchedule/PaySchedule.js";
|
|
11
|
+
import { Industry as l } from "../Industry/Industry.js";
|
|
12
12
|
import { FederalTaxes as s } from "../FederalTaxes/FederalTaxes.js";
|
|
13
13
|
function V() {
|
|
14
14
|
const { companyId: n, onEvent: o } = e();
|
|
@@ -27,7 +27,7 @@ function b() {
|
|
|
27
27
|
}
|
|
28
28
|
function h() {
|
|
29
29
|
const { companyId: n, onEvent: o } = e();
|
|
30
|
-
return /* @__PURE__ */ t(
|
|
30
|
+
return /* @__PURE__ */ t(l, { onEvent: o, companyId: r(n) });
|
|
31
31
|
}
|
|
32
32
|
function k() {
|
|
33
33
|
const { companyId: n, onEvent: o } = e();
|
|
@@ -35,12 +35,12 @@ function k() {
|
|
|
35
35
|
}
|
|
36
36
|
function A() {
|
|
37
37
|
const { companyId: n, onEvent: o } = e();
|
|
38
|
-
return /* @__PURE__ */ t(
|
|
38
|
+
return /* @__PURE__ */ t(p, { onEvent: o, companyId: r(n) });
|
|
39
39
|
}
|
|
40
40
|
function B() {
|
|
41
41
|
const { companyId: n, defaultValues: o, onEvent: a } = e();
|
|
42
42
|
return /* @__PURE__ */ t(
|
|
43
|
-
|
|
43
|
+
f,
|
|
44
44
|
{
|
|
45
45
|
onEvent: a,
|
|
46
46
|
companyId: r(n),
|
|
@@ -54,7 +54,7 @@ function D() {
|
|
|
54
54
|
}
|
|
55
55
|
function L() {
|
|
56
56
|
const { companyId: n, onEvent: o } = e();
|
|
57
|
-
return /* @__PURE__ */ t(
|
|
57
|
+
return /* @__PURE__ */ t(i, { onEvent: o, companyId: r(n) });
|
|
58
58
|
}
|
|
59
59
|
function P() {
|
|
60
60
|
const { companyId: n, onEvent: o } = e();
|
|
@@ -62,13 +62,13 @@ function P() {
|
|
|
62
62
|
}
|
|
63
63
|
export {
|
|
64
64
|
k as BankAccountContextual,
|
|
65
|
-
L as
|
|
65
|
+
L as DocumentSignerContextual,
|
|
66
66
|
A as EmployeesContextual,
|
|
67
67
|
b as FederalTaxesContextual,
|
|
68
68
|
h as IndustryContextual,
|
|
69
69
|
V as LocationsContextual,
|
|
70
70
|
P as OnboardingOverviewContextual,
|
|
71
71
|
B as PayScheduleContextual,
|
|
72
|
-
D as
|
|
72
|
+
D as StateTaxesContextual
|
|
73
73
|
};
|
|
74
74
|
//# sourceMappingURL=OnboardingFlowComponents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingFlowComponents.js","sources":["../../../../src/components/Company/OnboardingFlow/OnboardingFlowComponents.tsx"],"sourcesContent":["import { Industry } from '../Industry'\nimport {
|
|
1
|
+
{"version":3,"file":"OnboardingFlowComponents.js","sources":["../../../../src/components/Company/OnboardingFlow/OnboardingFlowComponents.tsx"],"sourcesContent":["import { Industry } from '../Industry'\nimport { BankAccount } from '../BankAccount/BankAccount'\nimport { PaySchedule } from '../PaySchedule'\nimport { StateTaxes } from '../StateTaxes/StateTaxes'\nimport { DocumentSigner } from '../DocumentSigner'\nimport { OnboardingOverview } from '../OnboardingOverview/OnboardingOverview'\nimport { FederalTaxes } from '../FederalTaxes'\nimport type { FederalTaxesDefaultValues } from '../FederalTaxes/useFederalTaxes'\nimport type { PayScheduleDefaultValues } from '../PaySchedule/usePaySchedule'\nimport { Locations } from '@/components/Company/Locations/Locations'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport { OnboardingFlow as EmployeeOnboardingFlow } from '@/components/Employee/OnboardingFlow/OnboardingFlow'\n\nexport type OnboardingFlowDefaultValues = RequireAtLeastOne<{\n federalTaxes?: FederalTaxesDefaultValues\n paySchedule?: PayScheduleDefaultValues\n}>\nexport interface OnboardingFlowProps extends BaseComponentInterface {\n companyId: string\n defaultValues?: RequireAtLeastOne<OnboardingFlowDefaultValues>\n}\nexport interface OnboardingFlowContextInterface extends FlowContextInterface {\n companyId: string\n defaultValues?: OnboardingFlowDefaultValues\n}\n\nexport function LocationsContextual() {\n const { companyId, onEvent } = useFlow<OnboardingFlowContextInterface>()\n return <Locations onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\nexport function FederalTaxesContextual() {\n const { companyId, defaultValues, onEvent } = useFlow<OnboardingFlowContextInterface>()\n return (\n <FederalTaxes\n onEvent={onEvent}\n companyId={ensureRequired(companyId)}\n defaultValues={defaultValues?.federalTaxes}\n />\n )\n}\n\nexport function IndustryContextual() {\n const { companyId, onEvent } = useFlow<OnboardingFlowContextInterface>()\n return <Industry onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\n\nexport function BankAccountContextual() {\n const { companyId, onEvent } = useFlow<OnboardingFlowContextInterface>()\n return <BankAccount onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\nexport function EmployeesContextual() {\n const { companyId, onEvent } = useFlow<OnboardingFlowContextInterface>()\n return <EmployeeOnboardingFlow onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\nexport function PayScheduleContextual() {\n const { companyId, defaultValues, onEvent } = useFlow<OnboardingFlowContextInterface>()\n return (\n <PaySchedule\n onEvent={onEvent}\n companyId={ensureRequired(companyId)}\n defaultValues={defaultValues?.paySchedule}\n />\n )\n}\nexport function StateTaxesContextual() {\n const { companyId, onEvent } = useFlow<OnboardingFlowContextInterface>()\n return <StateTaxes onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\nexport function DocumentSignerContextual() {\n const { companyId, onEvent } = useFlow<OnboardingFlowContextInterface>()\n return <DocumentSigner onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\nexport function OnboardingOverviewContextual() {\n const { companyId, onEvent } = useFlow<OnboardingFlowContextInterface>()\n return <OnboardingOverview companyId={ensureRequired(companyId)} onEvent={onEvent} />\n}\n"],"names":["LocationsContextual","companyId","onEvent","useFlow","Locations","ensureRequired","FederalTaxesContextual","defaultValues","jsx","FederalTaxes","IndustryContextual","Industry","BankAccountContextual","BankAccount","EmployeesContextual","EmployeeOnboardingFlow","PayScheduleContextual","PaySchedule","StateTaxesContextual","StateTaxes","DocumentSignerContextual","DocumentSigner","OnboardingOverviewContextual","OnboardingOverview"],"mappings":";;;;;;;;;;;;AA6BO,SAASA,IAAsB;AACpC,QAAM,EAAE,WAAAC,GAAW,SAAAC,EAAQ,IAAIC,EAAwC;AACvE,2BAAQC,GAAU,EAAA,SAAAF,GAAkB,WAAWG,EAAeJ,CAAS,GAAG;AAC5E;AACO,SAASK,IAAyB;AACvC,QAAM,EAAE,WAAAL,GAAW,eAAAM,GAAe,SAAAL,EAAA,IAAYC,EAAwC;AAEpF,SAAA,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAP;AAAA,MACA,WAAWG,EAAeJ,CAAS;AAAA,MACnC,eAAeM,GAAe;AAAA,IAAA;AAAA,EA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
|
import { state as e, transition as t, reduce as o } from "robot3";
|
|
2
|
-
import { OnboardingOverviewContextual as u,
|
|
2
|
+
import { OnboardingOverviewContextual as u, DocumentSignerContextual as s, StateTaxesContextual as p, PayScheduleContextual as O, EmployeesContextual as E, BankAccountContextual as N, IndustryContextual as l, FederalTaxesContextual as C, LocationsContextual as _ } from "./OnboardingFlowComponents.js";
|
|
3
3
|
import { componentEvents as n } from "../../../shared/constants.js";
|
|
4
4
|
const r = (c) => (a) => ({
|
|
5
5
|
...a,
|
|
@@ -24,14 +24,14 @@ const r = (c) => (a) => ({
|
|
|
24
24
|
t(
|
|
25
25
|
n.COMPANY_FEDERAL_TAXES_DONE,
|
|
26
26
|
"industry",
|
|
27
|
-
o(r({ component:
|
|
27
|
+
o(r({ component: l, currentStep: 3 }))
|
|
28
28
|
)
|
|
29
29
|
),
|
|
30
30
|
industry: e(
|
|
31
31
|
t(
|
|
32
32
|
n.COMPANY_INDUSTRY_SELECTED,
|
|
33
33
|
"bankAccount",
|
|
34
|
-
o(r({ component:
|
|
34
|
+
o(r({ component: N, currentStep: 4 }))
|
|
35
35
|
)
|
|
36
36
|
),
|
|
37
37
|
bankAccount: e(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboardingStateMachine.js","sources":["../../../../src/components/Company/OnboardingFlow/onboardingStateMachine.ts"],"sourcesContent":["import { transition, reduce, state } from 'robot3'\nimport {\n BankAccountContextual,\n
|
|
1
|
+
{"version":3,"file":"onboardingStateMachine.js","sources":["../../../../src/components/Company/OnboardingFlow/onboardingStateMachine.ts"],"sourcesContent":["import { transition, reduce, state } from 'robot3'\nimport {\n BankAccountContextual,\n DocumentSignerContextual,\n EmployeesContextual,\n FederalTaxesContextual,\n IndustryContextual,\n LocationsContextual,\n OnboardingOverviewContextual,\n PayScheduleContextual,\n StateTaxesContextual,\n type OnboardingFlowContextInterface,\n} from './OnboardingFlowComponents'\nimport { componentEvents } from '@/shared/constants'\n\nconst createReducer = (props: Partial<OnboardingFlowContextInterface>) => {\n return (ctx: OnboardingFlowContextInterface): OnboardingFlowContextInterface => ({\n ...ctx,\n ...props,\n })\n}\nexport const onboardingMachine = {\n overview: state(\n transition(\n componentEvents.COMPANY_OVERVIEW_CONTINUE,\n 'locations',\n reduce(createReducer({ component: LocationsContextual, currentStep: 1, showProgress: true })),\n ),\n transition(componentEvents.COMPANY_OVERVIEW_DONE, 'final'),\n ),\n locations: state(\n transition(\n componentEvents.COMPANY_LOCATION_DONE,\n 'federalTaxes',\n reduce(createReducer({ component: FederalTaxesContextual, currentStep: 2 })),\n ),\n ),\n federalTaxes: state(\n transition(\n componentEvents.COMPANY_FEDERAL_TAXES_DONE,\n 'industry',\n reduce(createReducer({ component: IndustryContextual, currentStep: 3 })),\n ),\n ),\n industry: state(\n transition(\n componentEvents.COMPANY_INDUSTRY_SELECTED,\n 'bankAccount',\n reduce(createReducer({ component: BankAccountContextual, currentStep: 4 })),\n ),\n ),\n bankAccount: state(\n transition(\n componentEvents.COMPANY_BANK_ACCOUNT_DONE,\n 'employees',\n reduce(createReducer({ component: EmployeesContextual, currentStep: 5 })),\n ),\n ),\n employees: state(\n transition(\n componentEvents.EMPLOYEE_ONBOARDING_DONE,\n 'payschedule',\n reduce(createReducer({ component: PayScheduleContextual, currentStep: 6 })),\n ),\n ),\n payschedule: state(\n transition(\n componentEvents.PAY_SCHEDULE_DONE,\n 'stateTaxes',\n reduce(createReducer({ component: StateTaxesContextual, currentStep: 7 })),\n ),\n ),\n stateTaxes: state(\n transition(\n componentEvents.COMPANY_STATE_TAX_DONE,\n 'documents',\n reduce(createReducer({ component: DocumentSignerContextual, currentStep: 8 })),\n ),\n ),\n documents: state(\n transition(\n componentEvents.COMPANY_FORMS_DONE,\n 'overview',\n reduce(\n createReducer({\n component: OnboardingOverviewContextual,\n currentStep: 1,\n showProgress: false,\n }),\n ),\n ),\n ),\n\n final: state(),\n}\n"],"names":["createReducer","props","ctx","onboardingMachine","state","transition","componentEvents","reduce","LocationsContextual","FederalTaxesContextual","IndustryContextual","BankAccountContextual","EmployeesContextual","PayScheduleContextual","StateTaxesContextual","DocumentSignerContextual","OnboardingOverviewContextual"],"mappings":";;;AAeA,MAAMA,IAAgB,CAACC,MACd,CAACC,OAAyE;AAAA,EAC/E,GAAGA;AAAA,EACH,GAAGD;AAAA,IAGME,IAAoB;AAAA,EAC/B,UAAUC;AAAA,IACRC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAC,EAAOP,EAAc,EAAE,WAAWQ,GAAqB,aAAa,GAAG,cAAc,IAAM,CAAC;AAAA,IAC9F;AAAA,IACAH,EAAWC,EAAgB,uBAAuB,OAAO;AAAA,EAC3D;AAAA,EACA,WAAWF;AAAA,IACTC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAC,EAAOP,EAAc,EAAE,WAAWS,GAAwB,aAAa,GAAG,CAAC;AAAA,IAAA;AAAA,EAE/E;AAAA,EACA,cAAcL;AAAA,IACZC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAC,EAAOP,EAAc,EAAE,WAAWU,GAAoB,aAAa,GAAG,CAAC;AAAA,IAAA;AAAA,EAE3E;AAAA,EACA,UAAUN;AAAA,IACRC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAC,EAAOP,EAAc,EAAE,WAAWW,GAAuB,aAAa,GAAG,CAAC;AAAA,IAAA;AAAA,EAE9E;AAAA,EACA,aAAaP;AAAA,IACXC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAC,EAAOP,EAAc,EAAE,WAAWY,GAAqB,aAAa,GAAG,CAAC;AAAA,IAAA;AAAA,EAE5E;AAAA,EACA,WAAWR;AAAA,IACTC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAC,EAAOP,EAAc,EAAE,WAAWa,GAAuB,aAAa,GAAG,CAAC;AAAA,IAAA;AAAA,EAE9E;AAAA,EACA,aAAaT;AAAA,IACXC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAC,EAAOP,EAAc,EAAE,WAAWc,GAAsB,aAAa,GAAG,CAAC;AAAA,IAAA;AAAA,EAE7E;AAAA,EACA,YAAYV;AAAA,IACVC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAC,EAAOP,EAAc,EAAE,WAAWe,GAA0B,aAAa,GAAG,CAAC;AAAA,IAAA;AAAA,EAEjF;AAAA,EACA,WAAWX;AAAA,IACTC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAC;AAAA,QACEP,EAAc;AAAA,UACZ,WAAWgB;AAAA,UACX,aAAa;AAAA,UACb,cAAc;AAAA,QACf,CAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAEJ;AAAA,EAEA,OAAOZ,EAAM;AACf;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseComponentInterface, CommonComponentInterface } from '../../Base';
|
|
2
|
-
interface OnboardingOverviewProps extends CommonComponentInterface {
|
|
2
|
+
interface OnboardingOverviewProps extends CommonComponentInterface<'Company.OnboardingOverview'> {
|
|
3
3
|
companyId: string;
|
|
4
4
|
}
|
|
5
5
|
export declare function OnboardingOverview(props: OnboardingOverviewProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
1
|
+
import { jsx as n, jsxs as s, Fragment as c } from "react/jsx-runtime";
|
|
2
2
|
import { useCompaniesGetOnboardingStatusSuspense as p } from "@gusto/embedded-api/react-query/companiesGetOnboardingStatus";
|
|
3
3
|
import { OnboardingOverviewProvider as l } from "./context.js";
|
|
4
4
|
import { MissingRequirements as u } from "./MissingRequirements.js";
|
|
5
5
|
import { Completed as O } from "./Completed.js";
|
|
6
6
|
import { BaseComponent as f } from "../../Base/Base.js";
|
|
7
|
-
import { useBase as
|
|
8
|
-
import { useI18n as
|
|
9
|
-
import { Flex as
|
|
10
|
-
import { componentEvents as
|
|
11
|
-
function
|
|
12
|
-
return
|
|
7
|
+
import { useBase as v } from "../../Base/useBase.js";
|
|
8
|
+
import { useI18n as C, useComponentDictionary as g } from "../../../i18n/I18n.js";
|
|
9
|
+
import { Flex as h } from "../../Common/Flex/Flex.js";
|
|
10
|
+
import { componentEvents as i } from "../../../shared/constants.js";
|
|
11
|
+
function P(o) {
|
|
12
|
+
return C("Company.OnboardingOverview"), g("Company.OnboardingOverview", o.dictionary), /* @__PURE__ */ n(f, { ...o, children: /* @__PURE__ */ n(b, { ...o, children: o.children }) });
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
const { onEvent: r } =
|
|
16
|
-
return /* @__PURE__ */ n("section", { className:
|
|
14
|
+
const b = ({ companyId: o, className: t, children: e }) => {
|
|
15
|
+
const { onEvent: r } = v(), { data: m } = p({ companyUuid: o }), { onboardingCompleted: a, onboardingSteps: d } = m.companyOnboardingStatus;
|
|
16
|
+
return /* @__PURE__ */ n("section", { className: t, children: /* @__PURE__ */ n(
|
|
17
17
|
l,
|
|
18
18
|
{
|
|
19
19
|
value: {
|
|
20
20
|
onboardingCompleted: a,
|
|
21
|
-
onboardingSteps:
|
|
21
|
+
onboardingSteps: d,
|
|
22
22
|
handleDone: () => {
|
|
23
|
-
r(
|
|
23
|
+
r(i.COMPANY_OVERVIEW_DONE);
|
|
24
24
|
},
|
|
25
25
|
handleContinue: () => {
|
|
26
|
-
r(
|
|
26
|
+
r(i.COMPANY_OVERVIEW_CONTINUE);
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
-
children: /* @__PURE__ */ n(
|
|
29
|
+
children: /* @__PURE__ */ n(h, { flexDirection: "column", gap: 32, children: e || /* @__PURE__ */ s(c, { children: [
|
|
30
30
|
/* @__PURE__ */ n(O, {}),
|
|
31
31
|
/* @__PURE__ */ n(u, {})
|
|
32
32
|
] }) })
|
|
@@ -34,6 +34,6 @@ const C = ({ companyId: o, className: i, children: e }) => {
|
|
|
34
34
|
) });
|
|
35
35
|
};
|
|
36
36
|
export {
|
|
37
|
-
|
|
37
|
+
P as OnboardingOverview
|
|
38
38
|
};
|
|
39
39
|
//# sourceMappingURL=OnboardingOverview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingOverview.js","sources":["../../../../src/components/Company/OnboardingOverview/OnboardingOverview.tsx"],"sourcesContent":["import { useCompaniesGetOnboardingStatusSuspense } from '@gusto/embedded-api/react-query/companiesGetOnboardingStatus'\nimport { OnboardingOverviewProvider } from './context'\nimport { MissingRequirements } from './MissingRequirements'\nimport { Completed } from './Completed'\nimport {\n BaseComponent,\n useBase,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport { Flex } from '@/components/Common'\nimport { componentEvents } from '@/shared/constants'\n\ninterface OnboardingOverviewProps extends CommonComponentInterface {\n companyId: string\n}\n\nexport function OnboardingOverview(props: OnboardingOverviewProps & BaseComponentInterface) {\n useI18n('Company.OnboardingOverview')\n\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ companyId, className, children }: OnboardingOverviewProps) => {\n const { onEvent } = useBase()\n\n const { data } = useCompaniesGetOnboardingStatusSuspense({ companyUuid: companyId })\n const { onboardingCompleted, onboardingSteps } = data.companyOnboardingStatus!\n\n const handleDone = () => {\n onEvent(componentEvents.COMPANY_OVERVIEW_DONE)\n }\n const handleContinue = () => {\n onEvent(componentEvents.COMPANY_OVERVIEW_CONTINUE)\n }\n\n return (\n <section className={className}>\n <OnboardingOverviewProvider\n value={{\n onboardingCompleted,\n onboardingSteps,\n handleDone,\n handleContinue,\n }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Completed />\n <MissingRequirements />\n </>\n )}\n </Flex>\n </OnboardingOverviewProvider>\n </section>\n )\n}\n"],"names":["OnboardingOverview","props","useI18n","jsx","BaseComponent","Root","companyId","className","children","onEvent","useBase","data","useCompaniesGetOnboardingStatusSuspense","onboardingCompleted","onboardingSteps","OnboardingOverviewProvider","componentEvents","Flex","jsxs","Fragment","Completed","MissingRequirements"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"OnboardingOverview.js","sources":["../../../../src/components/Company/OnboardingOverview/OnboardingOverview.tsx"],"sourcesContent":["import { useCompaniesGetOnboardingStatusSuspense } from '@gusto/embedded-api/react-query/companiesGetOnboardingStatus'\nimport { OnboardingOverviewProvider } from './context'\nimport { MissingRequirements } from './MissingRequirements'\nimport { Completed } from './Completed'\nimport {\n BaseComponent,\n useBase,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport { Flex } from '@/components/Common'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface OnboardingOverviewProps extends CommonComponentInterface<'Company.OnboardingOverview'> {\n companyId: string\n}\n\nexport function OnboardingOverview(props: OnboardingOverviewProps & BaseComponentInterface) {\n useI18n('Company.OnboardingOverview')\n useComponentDictionary('Company.OnboardingOverview', props.dictionary)\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ companyId, className, children }: OnboardingOverviewProps) => {\n const { onEvent } = useBase()\n\n const { data } = useCompaniesGetOnboardingStatusSuspense({ companyUuid: companyId })\n const { onboardingCompleted, onboardingSteps } = data.companyOnboardingStatus!\n\n const handleDone = () => {\n onEvent(componentEvents.COMPANY_OVERVIEW_DONE)\n }\n const handleContinue = () => {\n onEvent(componentEvents.COMPANY_OVERVIEW_CONTINUE)\n }\n\n return (\n <section className={className}>\n <OnboardingOverviewProvider\n value={{\n onboardingCompleted,\n onboardingSteps,\n handleDone,\n handleContinue,\n }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Completed />\n <MissingRequirements />\n </>\n )}\n </Flex>\n </OnboardingOverviewProvider>\n </section>\n )\n}\n"],"names":["OnboardingOverview","props","useI18n","useComponentDictionary","jsx","BaseComponent","Root","companyId","className","children","onEvent","useBase","data","useCompaniesGetOnboardingStatusSuspense","onboardingCompleted","onboardingSteps","OnboardingOverviewProvider","componentEvents","Flex","jsxs","Fragment","Completed","MissingRequirements"],"mappings":";;;;;;;;;;AAmBO,SAASA,EAAmBC,GAAyD;AAC1F,SAAAC,EAAQ,4BAA4B,GACbC,EAAA,8BAA8BF,EAAM,UAAU,GAEnE,gBAAAG,EAACC,GAAe,EAAA,GAAGJ,GACjB,UAAA,gBAAAG,EAACE,KAAM,GAAGL,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,MAAMK,IAAO,CAAC,EAAE,WAAAC,GAAW,WAAAC,GAAW,UAAAC,QAAwC;AACtE,QAAA,EAAE,SAAAC,EAAQ,IAAIC,EAAQ,GAEtB,EAAE,MAAAC,EAAK,IAAIC,EAAwC,EAAE,aAAaN,GAAW,GAC7E,EAAE,qBAAAO,GAAqB,iBAAAC,EAAgB,IAAIH,EAAK;AAUpD,SAAA,gBAAAR,EAAC,aAAQ,WAAAI,GACP,UAAA,gBAAAJ;AAAA,IAACY;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,qBAAAF;AAAA,QACA,iBAAAC;AAAA,QACA,YAbW,MAAM;AACvB,UAAAL,EAAQO,EAAgB,qBAAqB;AAAA,QAC/C;AAAA,QAYQ,gBAXe,MAAM;AAC3B,UAAAP,EAAQO,EAAgB,yBAAyB;AAAA,QACnD;AAAA,MAUM;AAAA,MAEA,UAAA,gBAAAb,EAACc,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAAT,KAIG,gBAAAU,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAhB,EAACiB,GAAU,EAAA;AAAA,0BACVC,GAAoB,CAAA,CAAA;AAAA,MAAA,EAAA,CACvB,EAEJ,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -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 [a, b] = o("OnboardingOverviewContext");
|
|
13
12
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
b as OnboardingOverviewProvider,
|
|
14
|
+
a as useOnboardingOverview
|
|
16
15
|
};
|
|
17
16
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../../src/components/Company/OnboardingOverview/context.ts"],"sourcesContent":["import type { OnboardingStep } from '@gusto/embedded-api/models/components/companyonboardingstatus'\nimport { createCompoundContext } from '@/components/Base'\n\ntype OnboardingOverviewContextType = {\n onboardingCompleted?: boolean\n onboardingSteps?: OnboardingStep[]\n handleDone: () => void\n handleContinue: () => void\n}\n\nconst [useOnboardingOverview, OnboardingOverviewProvider] =\n createCompoundContext<OnboardingOverviewContextType>('OnboardingOverviewContext')\n\nexport { useOnboardingOverview, OnboardingOverviewProvider }\n"],"names":["useOnboardingOverview","OnboardingOverviewProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../src/components/Company/OnboardingOverview/context.ts"],"sourcesContent":["import type { OnboardingStep } from '@gusto/embedded-api/models/components/companyonboardingstatus'\nimport { createCompoundContext } from '@/components/Base'\n\ntype OnboardingOverviewContextType = {\n onboardingCompleted?: boolean\n onboardingSteps?: OnboardingStep[]\n handleDone: () => void\n handleContinue: () => void\n}\n\nconst [useOnboardingOverview, OnboardingOverviewProvider] =\n createCompoundContext<OnboardingOverviewContextType>('OnboardingOverviewContext')\n\nexport { useOnboardingOverview, OnboardingOverviewProvider }\n"],"names":["useOnboardingOverview","OnboardingOverviewProvider","createCompoundContext"],"mappings":";;;;;;;;;;AAUA,MAAM,CAACA,GAAuBC,CAA0B,IACtDC,EAAqD,2BAA2B;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PayScheduleDefaultValues } from './usePaySchedule';
|
|
2
2
|
import { BaseComponentInterface, CommonComponentInterface } from '../../Base';
|
|
3
|
-
interface PayScheduleProps extends CommonComponentInterface {
|
|
3
|
+
interface PayScheduleProps extends CommonComponentInterface<'Company.PaySchedule'> {
|
|
4
4
|
companyId: string;
|
|
5
5
|
defaultValues?: PayScheduleDefaultValues;
|
|
6
6
|
}
|
|
7
7
|
export declare const PaySchedule: {
|
|
8
|
-
({ companyId, defaultValues, ...props }: PayScheduleProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
({ companyId, defaultValues, dictionary, ...props }: PayScheduleProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
Head: () => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
List: () => import("react/jsx-runtime").JSX.Element | null;
|
|
11
11
|
Edit: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import { jsx as t, jsxs as k } from "react/jsx-runtime";
|
|
2
2
|
import { useForm as z, FormProvider as Q } from "react-hook-form";
|
|
3
3
|
import { zodResolver as J } from "@hookform/resolvers/zod";
|
|
4
|
-
import { useState as
|
|
4
|
+
import { useState as p, useEffect as w } from "react";
|
|
5
5
|
import { usePaySchedulesGetPreview as K } from "@gusto/embedded-api/react-query/paySchedulesGetPreview";
|
|
6
6
|
import { usePaySchedulesUpdateMutation as W } from "@gusto/embedded-api/react-query/paySchedulesUpdate";
|
|
7
7
|
import { usePaySchedulesGetAllSuspense as X, invalidateAllPaySchedulesGetAll as Z } from "@gusto/embedded-api/react-query/paySchedulesGetAll";
|
|
8
8
|
import { usePaySchedulesCreateMutation as $ } from "@gusto/embedded-api/react-query/paySchedulesCreate";
|
|
9
9
|
import { useQueryClient as V } from "@tanstack/react-query";
|
|
10
10
|
import { PayScheduleSchema as ee, PayScheduleProvider as oe } from "./usePaySchedule.js";
|
|
11
|
-
import { Form as
|
|
12
|
-
import { BaseComponent as
|
|
11
|
+
import { Form as ae } from "../../Common/Form/Form.js";
|
|
12
|
+
import { BaseComponent as re } from "../../Base/Base.js";
|
|
13
13
|
import { useBase as te } from "../../Base/useBase.js";
|
|
14
14
|
import { Flex as ne } from "../../Common/Flex/Flex.js";
|
|
15
|
-
import { useI18n as ce } from "../../../i18n/I18n.js";
|
|
16
|
-
import { componentEvents as
|
|
17
|
-
import { formatDateToStringDate as
|
|
18
|
-
import { Head as
|
|
15
|
+
import { useI18n as ce, useComponentDictionary as ie } from "../../../i18n/I18n.js";
|
|
16
|
+
import { componentEvents as A } from "../../../shared/constants.js";
|
|
17
|
+
import { formatDateToStringDate as de } from "../../../helpers/dateFormatting.js";
|
|
18
|
+
import { Head as C } from "./_parts/Head.js";
|
|
19
19
|
import { List as _ } from "./_parts/List.js";
|
|
20
|
-
import { Edit as
|
|
21
|
-
import { Actions as
|
|
22
|
-
const
|
|
20
|
+
import { Edit as L } from "./_parts/Edit.js";
|
|
21
|
+
import { Actions as O } from "./_parts/Actions.js";
|
|
22
|
+
const f = ({
|
|
23
23
|
companyId: n,
|
|
24
24
|
defaultValues: P,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
dictionary: r,
|
|
26
|
+
...m
|
|
27
|
+
}) => (ce("Company.PaySchedule"), ie("Company.PaySchedule", r), /* @__PURE__ */ t(re, { ...m, children: /* @__PURE__ */ t(ye, { companyId: n, defaultValues: P, children: m.children }) })), ye = ({ companyId: n, children: P, defaultValues: r }) => {
|
|
28
|
+
const m = V(), { baseSubmitHandler: T, onEvent: E, fieldErrors: D } = te(), [S, u] = p("LIST_PAY_SCHEDULES"), [i, H] = p(null), M = {
|
|
29
|
+
frequency: r?.frequency ?? "Every week",
|
|
30
|
+
anchorPayDate: r?.anchorPayDate ? new Date(r.anchorPayDate) : void 0,
|
|
31
|
+
anchorEndOfPayPeriod: r?.anchorEndOfPayPeriod ? new Date(r.anchorEndOfPayPeriod) : void 0,
|
|
32
|
+
day1: r?.day1 ?? void 0,
|
|
33
|
+
day2: r?.day2 ?? void 0,
|
|
34
|
+
customName: r?.customName ?? "",
|
|
34
35
|
customTwicePerMonth: "false",
|
|
35
36
|
payPeriodPreviewRange: 0
|
|
36
|
-
}, [d, y] =
|
|
37
|
+
}, [d, y] = p(null), { data: U, isLoading: Y } = K(
|
|
37
38
|
{
|
|
38
39
|
companyId: n,
|
|
39
40
|
frequency: d?.frequency,
|
|
@@ -48,19 +49,19 @@ const h = ({
|
|
|
48
49
|
// Casting to non-null because we know it's not null from the enabled prop
|
|
49
50
|
), { data: N } = X({
|
|
50
51
|
companyId: n
|
|
51
|
-
}), g = $(), b = W(),
|
|
52
|
+
}), g = $(), b = W(), l = z({
|
|
52
53
|
resolver: J(ee),
|
|
53
54
|
defaultValues: M
|
|
54
|
-
}), { watch: R, setValue:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
}), { watch: R, setValue: v, reset: s, setError: q } = l;
|
|
56
|
+
w(() => {
|
|
57
|
+
D && D.forEach((o) => {
|
|
58
|
+
q(o.key, { message: o.message });
|
|
58
59
|
});
|
|
59
|
-
}, [
|
|
60
|
+
}, [q, D]);
|
|
60
61
|
const e = R();
|
|
61
|
-
|
|
62
|
-
e.frequency === "Twice per month" && e.day1 === 15 && e.day2 === 31 && e.customTwicePerMonth === void 0 ?
|
|
63
|
-
}, [e.frequency, e.day1, e.day2,
|
|
62
|
+
w(() => {
|
|
63
|
+
e.frequency === "Twice per month" && e.day1 === 15 && e.day2 === 31 && e.customTwicePerMonth === void 0 ? v("customTwicePerMonth", "1st15th") : e.frequency === "Twice per month" && e.customTwicePerMonth === void 0 && v("customTwicePerMonth", "custom");
|
|
64
|
+
}, [e.frequency, e.day1, e.day2, v, e.customTwicePerMonth]), w(() => {
|
|
64
65
|
!e.anchorPayDate || !e.anchorEndOfPayPeriod || y({
|
|
65
66
|
frequency: e.frequency,
|
|
66
67
|
anchorPayDate: e.anchorPayDate.toString(),
|
|
@@ -81,9 +82,9 @@ const h = ({
|
|
|
81
82
|
y
|
|
82
83
|
]);
|
|
83
84
|
const x = () => {
|
|
84
|
-
|
|
85
|
+
u("ADD_PAY_SCHEDULE"), s({});
|
|
85
86
|
}, B = () => {
|
|
86
|
-
|
|
87
|
+
u("LIST_PAY_SCHEDULES"), s({}), y(null);
|
|
87
88
|
}, F = (o) => {
|
|
88
89
|
s({
|
|
89
90
|
frequency: o.frequency,
|
|
@@ -92,46 +93,46 @@ const h = ({
|
|
|
92
93
|
day1: o.day1 ?? void 0,
|
|
93
94
|
day2: o.day2 ?? void 0,
|
|
94
95
|
customName: o.customName ?? ""
|
|
95
|
-
}), H(o),
|
|
96
|
+
}), H(o), u("EDIT_PAY_SCHEDULE");
|
|
96
97
|
}, j = () => {
|
|
97
|
-
|
|
98
|
+
E(A.PAY_SCHEDULE_DONE);
|
|
98
99
|
}, G = async (o) => {
|
|
99
|
-
await T(o, async (
|
|
100
|
-
const
|
|
101
|
-
if (
|
|
100
|
+
await T(o, async (a) => {
|
|
101
|
+
const h = (c) => c && de(c) || "";
|
|
102
|
+
if (S === "ADD_PAY_SCHEDULE") {
|
|
102
103
|
const c = await g.mutateAsync({
|
|
103
104
|
request: {
|
|
104
105
|
companyId: n,
|
|
105
106
|
requestBody: {
|
|
106
|
-
frequency:
|
|
107
|
-
anchorPayDate:
|
|
108
|
-
anchorEndOfPayPeriod:
|
|
109
|
-
customName:
|
|
110
|
-
day1:
|
|
111
|
-
day2:
|
|
107
|
+
frequency: a.frequency,
|
|
108
|
+
anchorPayDate: h(a.anchorPayDate),
|
|
109
|
+
anchorEndOfPayPeriod: h(a.anchorEndOfPayPeriod),
|
|
110
|
+
customName: a.customName,
|
|
111
|
+
day1: a.day1,
|
|
112
|
+
day2: a.day2
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
});
|
|
115
|
-
|
|
116
|
-
} else if (
|
|
116
|
+
E(A.PAY_SCHEDULE_CREATED, c), s(), y(null);
|
|
117
|
+
} else if (S === "EDIT_PAY_SCHEDULE") {
|
|
117
118
|
const c = i?.version, I = await b.mutateAsync({
|
|
118
119
|
request: {
|
|
119
120
|
payScheduleId: i?.uuid,
|
|
120
121
|
companyId: n,
|
|
121
122
|
requestBody: {
|
|
122
|
-
frequency:
|
|
123
|
-
anchorPayDate:
|
|
124
|
-
anchorEndOfPayPeriod:
|
|
125
|
-
customName:
|
|
126
|
-
day1:
|
|
127
|
-
day2:
|
|
123
|
+
frequency: a.frequency,
|
|
124
|
+
anchorPayDate: h(a.anchorPayDate),
|
|
125
|
+
anchorEndOfPayPeriod: h(a.anchorEndOfPayPeriod),
|
|
126
|
+
customName: a.customName,
|
|
127
|
+
day1: a.day1,
|
|
128
|
+
day2: a.day2,
|
|
128
129
|
version: c
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
});
|
|
132
|
-
|
|
133
|
+
E(A.PAY_SCHEDULE_UPDATED, I), s(), y(null);
|
|
133
134
|
}
|
|
134
|
-
await Z(
|
|
135
|
+
await Z(m), u("LIST_PAY_SCHEDULES");
|
|
135
136
|
});
|
|
136
137
|
};
|
|
137
138
|
return /* @__PURE__ */ t(
|
|
@@ -143,26 +144,26 @@ const h = ({
|
|
|
143
144
|
handleEdit: F,
|
|
144
145
|
handleCancel: B,
|
|
145
146
|
handleContinue: j,
|
|
146
|
-
mode:
|
|
147
|
+
mode: S,
|
|
147
148
|
paySchedules: N.payScheduleList,
|
|
148
149
|
payPeriodPreview: U?.object?.payPeriods,
|
|
149
150
|
payPreviewLoading: Y,
|
|
150
151
|
currentPaySchedule: i
|
|
151
152
|
},
|
|
152
|
-
children: /* @__PURE__ */ t("span", { "data-testid": "pay-schedule-edit-form", children: /* @__PURE__ */ t(Q, { ...
|
|
153
|
-
/* @__PURE__ */ t(q, {}),
|
|
154
|
-
/* @__PURE__ */ t(_, {}),
|
|
153
|
+
children: /* @__PURE__ */ t("span", { "data-testid": "pay-schedule-edit-form", children: /* @__PURE__ */ t(Q, { ...l, children: /* @__PURE__ */ t(ae, { onSubmit: l.handleSubmit(G), children: P || /* @__PURE__ */ k(ne, { flexDirection: "column", children: [
|
|
155
154
|
/* @__PURE__ */ t(C, {}),
|
|
156
|
-
/* @__PURE__ */ t(
|
|
155
|
+
/* @__PURE__ */ t(_, {}),
|
|
156
|
+
/* @__PURE__ */ t(L, {}),
|
|
157
|
+
/* @__PURE__ */ t(O, {})
|
|
157
158
|
] }) }) }) })
|
|
158
159
|
}
|
|
159
160
|
);
|
|
160
161
|
};
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
f.Head = C;
|
|
163
|
+
f.List = _;
|
|
164
|
+
f.Edit = L;
|
|
165
|
+
f.Actions = O;
|
|
165
166
|
export {
|
|
166
|
-
|
|
167
|
+
f as PaySchedule
|
|
167
168
|
};
|
|
168
169
|
//# sourceMappingURL=PaySchedule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/PaySchedule.tsx"],"sourcesContent":["import type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useEffect, useState } from 'react'\nimport { usePaySchedulesGetPreview } from '@gusto/embedded-api/react-query/paySchedulesGetPreview'\nimport { usePaySchedulesUpdateMutation } from '@gusto/embedded-api/react-query/paySchedulesUpdate'\nimport {\n usePaySchedulesGetAllSuspense,\n invalidateAllPaySchedulesGetAll,\n} from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport { usePaySchedulesCreateMutation } from '@gusto/embedded-api/react-query/paySchedulesCreate'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { useQueryClient } from '@tanstack/react-query'\nimport type { Frequency } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayschedules'\nimport type { MODE, PayScheduleInputs, PayScheduleOutputs } from './usePaySchedule'\nimport {\n PayScheduleProvider,\n PayScheduleSchema,\n type PayScheduleDefaultValues,\n} from './usePaySchedule'\nimport { Actions, Edit, Head, List } from './_parts'\nimport { Form } from '@/components/Common/Form'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\n\ninterface PayScheduleProps extends CommonComponentInterface {\n companyId: string\n defaultValues?: PayScheduleDefaultValues\n}\n\nexport const PaySchedule = ({\n companyId,\n defaultValues,\n ...props\n}: PayScheduleProps & BaseComponentInterface) => {\n useI18n('Company.PaySchedule')\n return (\n <BaseComponent {...props}>\n <Root companyId={companyId} defaultValues={defaultValues}>\n {props.children}\n </Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ companyId, children, defaultValues }: PayScheduleProps) => {\n const queryClient = useQueryClient()\n const { baseSubmitHandler, onEvent, fieldErrors } = useBase()\n const [mode, setMode] = useState<MODE>('LIST_PAY_SCHEDULES')\n const [currentPaySchedule, setCurrentPaySchedule] = useState<PayScheduleType | null>(null)\n const transformedDefaultValues: PayScheduleInputs = {\n frequency: defaultValues?.frequency ?? 'Every week',\n anchorPayDate: defaultValues?.anchorPayDate ? new Date(defaultValues.anchorPayDate) : undefined,\n anchorEndOfPayPeriod: defaultValues?.anchorEndOfPayPeriod\n ? new Date(defaultValues.anchorEndOfPayPeriod)\n : undefined,\n day1: defaultValues?.day1 ?? undefined,\n day2: defaultValues?.day2 ?? undefined,\n customName: defaultValues?.customName ?? '',\n customTwicePerMonth: 'false',\n payPeriodPreviewRange: 0,\n }\n\n const [payScheduleDraft, setPayScheduleDraft] = useState<PayScheduleType | null>(null)\n const { data: payPreviewData, isLoading } = usePaySchedulesGetPreview(\n {\n companyId,\n frequency: payScheduleDraft?.frequency as Frequency,\n anchorPayDate: payScheduleDraft?.anchorPayDate ?? '',\n anchorEndOfPayPeriod: payScheduleDraft?.anchorEndOfPayPeriod ?? '',\n day1: payScheduleDraft?.day1 ?? undefined,\n day2: payScheduleDraft?.day2 ?? undefined,\n },\n {\n enabled: true,\n }, // Casting to non-null because we know it's not null from the enabled prop\n )\n\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({\n companyId,\n })\n\n const createPayScheduleMutation = usePaySchedulesCreateMutation()\n const updatePayScheduleMutation = usePaySchedulesUpdateMutation()\n\n const formMethods = useForm<PayScheduleInputs, unknown, PayScheduleOutputs>({\n resolver: zodResolver(PayScheduleSchema),\n defaultValues: transformedDefaultValues,\n })\n const { watch, setValue, reset, setError } = formMethods\n\n useEffect(() => {\n if (fieldErrors) {\n // TODO: These error messages are not being localized correctly\n fieldErrors.forEach(error => {\n setError(error.key as keyof PayScheduleInputs, { message: error.message })\n })\n }\n }, [setError, fieldErrors])\n\n const allValues = watch()\n\n // Set the custom_twice_per_month value based on the frequency and day_1 and day_2 values as it is not set by the API call\n useEffect(() => {\n if (\n allValues.frequency === 'Twice per month' &&\n allValues.day1 === 15 &&\n allValues.day2 === 31 &&\n allValues.customTwicePerMonth === undefined\n ) {\n setValue('customTwicePerMonth', `1st15th`)\n } else if (\n allValues.frequency === 'Twice per month' &&\n allValues.customTwicePerMonth === undefined\n ) {\n setValue('customTwicePerMonth', `custom`)\n }\n }, [allValues.frequency, allValues.day1, allValues.day2, setValue, allValues.customTwicePerMonth])\n\n useEffect(() => {\n // Don't update if dates are not set\n if (!allValues.anchorPayDate || !allValues.anchorEndOfPayPeriod) {\n return\n }\n\n setPayScheduleDraft({\n frequency: allValues.frequency,\n anchorPayDate: allValues.anchorPayDate.toString(),\n anchorEndOfPayPeriod: allValues.anchorEndOfPayPeriod.toString(),\n day1: allValues.day1 || undefined,\n day2: allValues.day2 || undefined,\n uuid: '',\n version: currentPaySchedule?.version || '', //TODO: This needs to be set to something\n })\n }, [\n allValues.anchorEndOfPayPeriod,\n allValues.anchorPayDate,\n allValues.day1,\n allValues.day2,\n allValues.frequency,\n currentPaySchedule?.version,\n setPayScheduleDraft,\n ])\n\n // Custom effect to show/hide pay schedule preview errors\n\n const handleAdd = () => {\n setMode('ADD_PAY_SCHEDULE')\n reset({})\n }\n const handleCancel = () => {\n setMode('LIST_PAY_SCHEDULES')\n reset({})\n setPayScheduleDraft(null)\n }\n const handleEdit = (schedule: PayScheduleType) => {\n reset({\n frequency: schedule.frequency as Frequency,\n anchorPayDate: schedule.anchorPayDate ? new Date(schedule.anchorPayDate) : undefined,\n anchorEndOfPayPeriod: schedule.anchorEndOfPayPeriod\n ? new Date(schedule.anchorEndOfPayPeriod)\n : undefined,\n day1: schedule.day1 ?? undefined,\n day2: schedule.day2 ?? undefined,\n customName: schedule.customName ?? '',\n })\n setCurrentPaySchedule(schedule)\n setMode('EDIT_PAY_SCHEDULE')\n }\n const handleContinue = () => {\n onEvent(componentEvents.PAY_SCHEDULE_DONE)\n }\n const onSubmit: SubmitHandler<PayScheduleOutputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const formatPayloadDate = (date: Date | undefined): string => {\n return date ? formatDateToStringDate(date) || '' : ''\n }\n\n if (mode === 'ADD_PAY_SCHEDULE') {\n const createPayScheduleResponse = await createPayScheduleMutation.mutateAsync({\n request: {\n companyId: companyId,\n requestBody: {\n frequency: payload.frequency,\n anchorPayDate: formatPayloadDate(payload.anchorPayDate),\n anchorEndOfPayPeriod: formatPayloadDate(payload.anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1,\n day2: payload.day2,\n },\n },\n })\n onEvent(componentEvents.PAY_SCHEDULE_CREATED, createPayScheduleResponse)\n reset()\n setPayScheduleDraft(null)\n } else if (mode === 'EDIT_PAY_SCHEDULE') {\n const version = currentPaySchedule?.version\n const updatePayScheduleResponse = await updatePayScheduleMutation.mutateAsync({\n request: {\n payScheduleId: currentPaySchedule?.uuid as string,\n companyId: companyId,\n requestBody: {\n frequency: payload.frequency,\n anchorPayDate: formatPayloadDate(payload.anchorPayDate),\n anchorEndOfPayPeriod: formatPayloadDate(payload.anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1,\n day2: payload.day2,\n version: version as string,\n },\n },\n })\n onEvent(componentEvents.PAY_SCHEDULE_UPDATED, updatePayScheduleResponse)\n reset()\n setPayScheduleDraft(null)\n }\n await invalidateAllPaySchedulesGetAll(queryClient)\n setMode('LIST_PAY_SCHEDULES')\n })\n }\n\n return (\n <PayScheduleProvider\n value={{\n companyId,\n handleAdd,\n handleEdit,\n handleCancel,\n handleContinue,\n mode,\n paySchedules: paySchedules.payScheduleList,\n payPeriodPreview: payPreviewData?.object?.payPeriods,\n payPreviewLoading: isLoading,\n currentPaySchedule,\n }}\n >\n <span data-testid=\"pay-schedule-edit-form\">\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Edit />\n <Actions />\n </Flex>\n )}\n </Form>\n </FormProvider>\n </span>\n </PayScheduleProvider>\n )\n}\n\nPaySchedule.Head = Head\nPaySchedule.List = List\nPaySchedule.Edit = Edit\nPaySchedule.Actions = Actions\n"],"names":["PaySchedule","companyId","defaultValues","props","useI18n","jsx","BaseComponent","Root","children","queryClient","useQueryClient","baseSubmitHandler","onEvent","fieldErrors","useBase","mode","setMode","useState","currentPaySchedule","setCurrentPaySchedule","transformedDefaultValues","payScheduleDraft","setPayScheduleDraft","payPreviewData","isLoading","usePaySchedulesGetPreview","paySchedules","usePaySchedulesGetAllSuspense","createPayScheduleMutation","usePaySchedulesCreateMutation","updatePayScheduleMutation","usePaySchedulesUpdateMutation","formMethods","useForm","zodResolver","PayScheduleSchema","watch","setValue","reset","setError","useEffect","error","allValues","handleAdd","handleCancel","handleEdit","schedule","handleContinue","componentEvents","onSubmit","data","payload","formatPayloadDate","date","formatDateToStringDate","createPayScheduleResponse","version","updatePayScheduleResponse","invalidateAllPaySchedulesGetAll","PayScheduleProvider","FormProvider","Form","jsxs","Flex","Head","List","Edit","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkCO,MAAMA,IAAc,CAAC;AAAA,EAC1B,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,GAAGC;AACL,OACEC,GAAQ,qBAAqB,GAE3B,gBAAAC,EAACC,IAAe,EAAA,GAAGH,GACjB,UAAA,gBAAAE,EAACE,MAAK,WAAAN,GAAsB,eAAAC,GACzB,UAAMC,EAAA,SAAA,CACT,EACF,CAAA,IAIEI,KAAO,CAAC,EAAE,WAAAN,GAAW,UAAAO,GAAU,eAAAN,QAAsC;AACzE,QAAMO,IAAcC,EAAe,GAC7B,EAAE,mBAAAC,GAAmB,SAAAC,GAAS,aAAAC,EAAA,IAAgBC,GAAQ,GACtD,CAACC,GAAMC,CAAO,IAAIC,EAAe,oBAAoB,GACrD,CAACC,GAAoBC,CAAqB,IAAIF,EAAiC,IAAI,GACnFG,IAA8C;AAAA,IAClD,WAAWlB,GAAe,aAAa;AAAA,IACvC,eAAeA,GAAe,gBAAgB,IAAI,KAAKA,EAAc,aAAa,IAAI;AAAA,IACtF,sBAAsBA,GAAe,uBACjC,IAAI,KAAKA,EAAc,oBAAoB,IAC3C;AAAA,IACJ,MAAMA,GAAe,QAAQ;AAAA,IAC7B,MAAMA,GAAe,QAAQ;AAAA,IAC7B,YAAYA,GAAe,cAAc;AAAA,IACzC,qBAAqB;AAAA,IACrB,uBAAuB;AAAA,EACzB,GAEM,CAACmB,GAAkBC,CAAmB,IAAIL,EAAiC,IAAI,GAC/E,EAAE,MAAMM,GAAgB,WAAA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;AAAA,QACnB,oBAAAN;AAAA,MACF;AAAA,MAEA,UAAA,gBAAAb,EAAC,UAAK,eAAY,0BAChB,4BAACuD,GAAc,EAAA,GAAG5B,GAChB,UAAC,gBAAA3B,EAAAwD,IAAA,EAAK,UAAU7B,EAAY,aAAaiB,CAAQ,GAC9C,UAAAzC,KAGE,gBAAAsD,EAAAC,IAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAA1D,EAAC2D,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,GACX,EAAA,CAEJ,GACF,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEAnE,EAAY,OAAOgE;AACnBhE,EAAY,OAAOiE;AACnBjE,EAAY,OAAOkE;AACnBlE,EAAY,UAAUmE;"}
|
|
1
|
+
{"version":3,"file":"PaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/PaySchedule.tsx"],"sourcesContent":["import type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useEffect, useState } from 'react'\nimport { usePaySchedulesGetPreview } from '@gusto/embedded-api/react-query/paySchedulesGetPreview'\nimport { usePaySchedulesUpdateMutation } from '@gusto/embedded-api/react-query/paySchedulesUpdate'\nimport {\n usePaySchedulesGetAllSuspense,\n invalidateAllPaySchedulesGetAll,\n} from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport { usePaySchedulesCreateMutation } from '@gusto/embedded-api/react-query/paySchedulesCreate'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { useQueryClient } from '@tanstack/react-query'\nimport type { Frequency } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayschedules'\nimport type { MODE, PayScheduleInputs, PayScheduleOutputs } from './usePaySchedule'\nimport {\n PayScheduleProvider,\n PayScheduleSchema,\n type PayScheduleDefaultValues,\n} from './usePaySchedule'\nimport { Actions, Edit, Head, List } from './_parts'\nimport { Form } from '@/components/Common/Form'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface PayScheduleProps extends CommonComponentInterface<'Company.PaySchedule'> {\n companyId: string\n defaultValues?: PayScheduleDefaultValues\n}\n\nexport const PaySchedule = ({\n companyId,\n defaultValues,\n dictionary,\n ...props\n}: PayScheduleProps & BaseComponentInterface) => {\n useI18n('Company.PaySchedule')\n useComponentDictionary('Company.PaySchedule', dictionary)\n return (\n <BaseComponent {...props}>\n <Root companyId={companyId} defaultValues={defaultValues}>\n {props.children}\n </Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ companyId, children, defaultValues }: PayScheduleProps) => {\n const queryClient = useQueryClient()\n const { baseSubmitHandler, onEvent, fieldErrors } = useBase()\n const [mode, setMode] = useState<MODE>('LIST_PAY_SCHEDULES')\n const [currentPaySchedule, setCurrentPaySchedule] = useState<PayScheduleType | null>(null)\n const transformedDefaultValues: PayScheduleInputs = {\n frequency: defaultValues?.frequency ?? 'Every week',\n anchorPayDate: defaultValues?.anchorPayDate ? new Date(defaultValues.anchorPayDate) : undefined,\n anchorEndOfPayPeriod: defaultValues?.anchorEndOfPayPeriod\n ? new Date(defaultValues.anchorEndOfPayPeriod)\n : undefined,\n day1: defaultValues?.day1 ?? undefined,\n day2: defaultValues?.day2 ?? undefined,\n customName: defaultValues?.customName ?? '',\n customTwicePerMonth: 'false',\n payPeriodPreviewRange: 0,\n }\n\n const [payScheduleDraft, setPayScheduleDraft] = useState<PayScheduleType | null>(null)\n const { data: payPreviewData, isLoading } = usePaySchedulesGetPreview(\n {\n companyId,\n frequency: payScheduleDraft?.frequency as Frequency,\n anchorPayDate: payScheduleDraft?.anchorPayDate ?? '',\n anchorEndOfPayPeriod: payScheduleDraft?.anchorEndOfPayPeriod ?? '',\n day1: payScheduleDraft?.day1 ?? undefined,\n day2: payScheduleDraft?.day2 ?? undefined,\n },\n {\n enabled: true,\n }, // Casting to non-null because we know it's not null from the enabled prop\n )\n\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({\n companyId,\n })\n\n const createPayScheduleMutation = usePaySchedulesCreateMutation()\n const updatePayScheduleMutation = usePaySchedulesUpdateMutation()\n\n const formMethods = useForm<PayScheduleInputs, unknown, PayScheduleOutputs>({\n resolver: zodResolver(PayScheduleSchema),\n defaultValues: transformedDefaultValues,\n })\n const { watch, setValue, reset, setError } = formMethods\n\n useEffect(() => {\n if (fieldErrors) {\n // TODO: These error messages are not being localized correctly\n fieldErrors.forEach(error => {\n setError(error.key as keyof PayScheduleInputs, { message: error.message })\n })\n }\n }, [setError, fieldErrors])\n\n const allValues = watch()\n\n // Set the custom_twice_per_month value based on the frequency and day_1 and day_2 values as it is not set by the API call\n useEffect(() => {\n if (\n allValues.frequency === 'Twice per month' &&\n allValues.day1 === 15 &&\n allValues.day2 === 31 &&\n allValues.customTwicePerMonth === undefined\n ) {\n setValue('customTwicePerMonth', `1st15th`)\n } else if (\n allValues.frequency === 'Twice per month' &&\n allValues.customTwicePerMonth === undefined\n ) {\n setValue('customTwicePerMonth', `custom`)\n }\n }, [allValues.frequency, allValues.day1, allValues.day2, setValue, allValues.customTwicePerMonth])\n\n useEffect(() => {\n // Don't update if dates are not set\n if (!allValues.anchorPayDate || !allValues.anchorEndOfPayPeriod) {\n return\n }\n\n setPayScheduleDraft({\n frequency: allValues.frequency,\n anchorPayDate: allValues.anchorPayDate.toString(),\n anchorEndOfPayPeriod: allValues.anchorEndOfPayPeriod.toString(),\n day1: allValues.day1 || undefined,\n day2: allValues.day2 || undefined,\n uuid: '',\n version: currentPaySchedule?.version || '', //TODO: This needs to be set to something\n })\n }, [\n allValues.anchorEndOfPayPeriod,\n allValues.anchorPayDate,\n allValues.day1,\n allValues.day2,\n allValues.frequency,\n currentPaySchedule?.version,\n setPayScheduleDraft,\n ])\n\n // Custom effect to show/hide pay schedule preview errors\n\n const handleAdd = () => {\n setMode('ADD_PAY_SCHEDULE')\n reset({})\n }\n const handleCancel = () => {\n setMode('LIST_PAY_SCHEDULES')\n reset({})\n setPayScheduleDraft(null)\n }\n const handleEdit = (schedule: PayScheduleType) => {\n reset({\n frequency: schedule.frequency as Frequency,\n anchorPayDate: schedule.anchorPayDate ? new Date(schedule.anchorPayDate) : undefined,\n anchorEndOfPayPeriod: schedule.anchorEndOfPayPeriod\n ? new Date(schedule.anchorEndOfPayPeriod)\n : undefined,\n day1: schedule.day1 ?? undefined,\n day2: schedule.day2 ?? undefined,\n customName: schedule.customName ?? '',\n })\n setCurrentPaySchedule(schedule)\n setMode('EDIT_PAY_SCHEDULE')\n }\n const handleContinue = () => {\n onEvent(componentEvents.PAY_SCHEDULE_DONE)\n }\n const onSubmit: SubmitHandler<PayScheduleOutputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const formatPayloadDate = (date: Date | undefined): string => {\n return date ? formatDateToStringDate(date) || '' : ''\n }\n\n if (mode === 'ADD_PAY_SCHEDULE') {\n const createPayScheduleResponse = await createPayScheduleMutation.mutateAsync({\n request: {\n companyId: companyId,\n requestBody: {\n frequency: payload.frequency,\n anchorPayDate: formatPayloadDate(payload.anchorPayDate),\n anchorEndOfPayPeriod: formatPayloadDate(payload.anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1,\n day2: payload.day2,\n },\n },\n })\n onEvent(componentEvents.PAY_SCHEDULE_CREATED, createPayScheduleResponse)\n reset()\n setPayScheduleDraft(null)\n } else if (mode === 'EDIT_PAY_SCHEDULE') {\n const version = currentPaySchedule?.version\n const updatePayScheduleResponse = await updatePayScheduleMutation.mutateAsync({\n request: {\n payScheduleId: currentPaySchedule?.uuid as string,\n companyId: companyId,\n requestBody: {\n frequency: payload.frequency,\n anchorPayDate: formatPayloadDate(payload.anchorPayDate),\n anchorEndOfPayPeriod: formatPayloadDate(payload.anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1,\n day2: payload.day2,\n version: version as string,\n },\n },\n })\n onEvent(componentEvents.PAY_SCHEDULE_UPDATED, updatePayScheduleResponse)\n reset()\n setPayScheduleDraft(null)\n }\n await invalidateAllPaySchedulesGetAll(queryClient)\n setMode('LIST_PAY_SCHEDULES')\n })\n }\n\n return (\n <PayScheduleProvider\n value={{\n companyId,\n handleAdd,\n handleEdit,\n handleCancel,\n handleContinue,\n mode,\n paySchedules: paySchedules.payScheduleList,\n payPeriodPreview: payPreviewData?.object?.payPeriods,\n payPreviewLoading: isLoading,\n currentPaySchedule,\n }}\n >\n <span data-testid=\"pay-schedule-edit-form\">\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Edit />\n <Actions />\n </Flex>\n )}\n </Form>\n </FormProvider>\n </span>\n </PayScheduleProvider>\n )\n}\n\nPaySchedule.Head = Head\nPaySchedule.List = List\nPaySchedule.Edit = Edit\nPaySchedule.Actions = Actions\n"],"names":["PaySchedule","companyId","defaultValues","dictionary","props","useI18n","useComponentDictionary","jsx","BaseComponent","Root","children","queryClient","useQueryClient","baseSubmitHandler","onEvent","fieldErrors","useBase","mode","setMode","useState","currentPaySchedule","setCurrentPaySchedule","transformedDefaultValues","payScheduleDraft","setPayScheduleDraft","payPreviewData","isLoading","usePaySchedulesGetPreview","paySchedules","usePaySchedulesGetAllSuspense","createPayScheduleMutation","usePaySchedulesCreateMutation","updatePayScheduleMutation","usePaySchedulesUpdateMutation","formMethods","useForm","zodResolver","PayScheduleSchema","watch","setValue","reset","setError","useEffect","error","allValues","handleAdd","handleCancel","handleEdit","schedule","handleContinue","componentEvents","onSubmit","data","payload","formatPayloadDate","date","formatDateToStringDate","createPayScheduleResponse","version","updatePayScheduleResponse","invalidateAllPaySchedulesGetAll","PayScheduleProvider","FormProvider","Form","jsxs","Flex","Head","List","Edit","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmCO,MAAMA,IAAc,CAAC;AAAA,EAC1B,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,OACEC,GAAQ,qBAAqB,GAC7BC,GAAuB,uBAAuBH,CAAU,GAEtD,gBAAAI,EAACC,IAAe,EAAA,GAAGJ,GACjB,UAAA,gBAAAG,EAACE,MAAK,WAAAR,GAAsB,eAAAC,GACzB,UAAME,EAAA,SAAA,CACT,EACF,CAAA,IAIEK,KAAO,CAAC,EAAE,WAAAR,GAAW,UAAAS,GAAU,eAAAR,QAAsC;AACzE,QAAMS,IAAcC,EAAe,GAC7B,EAAE,mBAAAC,GAAmB,SAAAC,GAAS,aAAAC,EAAA,IAAgBC,GAAQ,GACtD,CAACC,GAAMC,CAAO,IAAIC,EAAe,oBAAoB,GACrD,CAACC,GAAoBC,CAAqB,IAAIF,EAAiC,IAAI,GACnFG,IAA8C;AAAA,IAClD,WAAWpB,GAAe,aAAa;AAAA,IACvC,eAAeA,GAAe,gBAAgB,IAAI,KAAKA,EAAc,aAAa,IAAI;AAAA,IACtF,sBAAsBA,GAAe,uBACjC,IAAI,KAAKA,EAAc,oBAAoB,IAC3C;AAAA,IACJ,MAAMA,GAAe,QAAQ;AAAA,IAC7B,MAAMA,GAAe,QAAQ;AAAA,IAC7B,YAAYA,GAAe,cAAc;AAAA,IACzC,qBAAqB;AAAA,IACrB,uBAAuB;AAAA,EACzB,GAEM,CAACqB,GAAkBC,CAAmB,IAAIL,EAAiC,IAAI,GAC/E,EAAE,MAAMM,GAAgB,WAAAC,EAAc,IAAAC;AAAA,IAC1C;AAAA,MACE,WAAA1B;AAAA,MACA,WAAWsB,GAAkB;AAAA,MAC7B,eAAeA,GAAkB,iBAAiB;AAAA,MAClD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AC,gBAAA3B,EAAAwD,IAAA,EAAK,UAAU7B,EAAY,aAAaiB,CAAQ,GAC9C,UAAAzC,KAGE,gBAAAsD,EAAAC,IAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAA1D,EAAC2D,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,GACX,EAAA,CAEJ,GACF,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEArE,EAAY,OAAOkE;AACnBlE,EAAY,OAAOmE;AACnBnE,EAAY,OAAOoE;AACnBpE,EAAY,UAAUqE;"}
|
|
@@ -8,9 +8,8 @@ import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
|
8
8
|
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
9
9
|
import "../../Base/useBase.js";
|
|
10
10
|
import "dompurify";
|
|
11
|
-
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
11
|
import { createCompoundContext as e } from "../../Base/createCompoundContext.js";
|
|
13
|
-
const
|
|
12
|
+
const l = o.object({
|
|
14
13
|
frequency: o.enum(["Every week", "Every other week", "Twice per month", "Monthly"]),
|
|
15
14
|
anchorPayDate: o.date().optional(),
|
|
16
15
|
anchorEndOfPayPeriod: o.date().optional(),
|
|
@@ -19,10 +18,10 @@ const h = o.object({
|
|
|
19
18
|
customName: o.string().optional(),
|
|
20
19
|
customTwicePerMonth: o.string().optional(),
|
|
21
20
|
payPeriodPreviewRange: o.number().optional()
|
|
22
|
-
}), [
|
|
21
|
+
}), [h, P] = e("PayScheduleContext");
|
|
23
22
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
P as PayScheduleProvider,
|
|
24
|
+
l as PayScheduleSchema,
|
|
25
|
+
h as usePaySchedule
|
|
27
26
|
};
|
|
28
27
|
//# sourceMappingURL=usePaySchedule.js.map
|