@gusto/embedded-react-sdk 0.40.0 → 0.42.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 +77 -42
- package/dist/assets/icons/house.svg.js +10 -0
- package/dist/assets/icons/house.svg.js.map +1 -0
- package/dist/components/Common/EmptyData/EmptyData.d.ts +3 -0
- package/dist/components/Common/EmptyData/EmptyData.js +11 -11
- package/dist/components/Common/EmptyData/EmptyData.js.map +1 -1
- package/dist/components/Common/EmptyData/EmptyData.module.scss.js +8 -6
- package/dist/components/Common/EmptyData/EmptyData.module.scss.js.map +1 -1
- package/dist/components/Common/Form/Form.d.ts +1 -1
- package/dist/components/Common/Form/Form.js +15 -5
- package/dist/components/Common/Form/Form.js.map +1 -1
- package/dist/components/Common/UI/Input/InputTypes.d.ts +1 -1
- package/dist/components/Common/UI/Input/InputTypes.js.map +1 -1
- package/dist/components/Common/UI/TextInput/TextInput.js +37 -35
- package/dist/components/Common/UI/TextInput/TextInput.js.map +1 -1
- package/dist/components/Common/UI/TextInput/TextInputTypes.d.ts +1 -1
- package/dist/components/Common/UI/TextInput/TextInputTypes.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.d.ts +0 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +78 -61
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/index.d.ts +1 -1
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/useSignCompanyForm.d.ts +7 -6
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/useSignCompanyForm.js +54 -54
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/useSignCompanyForm.js.map +1 -1
- package/dist/components/Company/OnboardingFlow/OnboardingFlow.js +11 -15
- package/dist/components/Company/OnboardingFlow/OnboardingFlow.js.map +1 -1
- package/dist/components/Company/OnboardingFlow/OnboardingFlowComponents.d.ts +1 -1
- package/dist/components/Company/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
- package/dist/components/Company/OnboardingFlow/onboardingStateMachine.js +37 -35
- package/dist/components/Company/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.d.ts +6 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +31 -148
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleComponents.d.ts +10 -0
- package/dist/components/Company/PaySchedule/PayScheduleComponents.js +26 -0
- package/dist/components/Company/PaySchedule/PayScheduleComponents.js.map +1 -0
- package/dist/components/Company/PaySchedule/PayScheduleForm.d.ts +8 -0
- package/dist/components/Company/PaySchedule/PayScheduleForm.js +186 -0
- package/dist/components/Company/PaySchedule/PayScheduleForm.js.map +1 -0
- package/dist/components/Company/PaySchedule/PayScheduleForm.module.scss.js +12 -0
- package/dist/components/Company/PaySchedule/PayScheduleForm.module.scss.js.map +1 -0
- package/dist/components/Company/PaySchedule/PayScheduleList.d.ts +8 -0
- package/dist/components/Company/PaySchedule/PayScheduleList.js +102 -0
- package/dist/components/Company/PaySchedule/PayScheduleList.js.map +1 -0
- package/dist/components/Company/PaySchedule/{_parts/List.module.scss.js → PayScheduleList.module.scss.js} +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleList.module.scss.js.map +1 -0
- package/dist/components/Company/PaySchedule/payScheduleStateMachine.d.ts +6 -0
- package/dist/components/Company/PaySchedule/payScheduleStateMachine.js +49 -0
- package/dist/components/Company/PaySchedule/payScheduleStateMachine.js.map +1 -0
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +11 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js +13 -16
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js +61 -63
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlow.js +11 -11
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlow.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +88 -111
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
- package/dist/components/Employee/Compensation/Edit.js +8 -8
- package/dist/components/Employee/Dashboard/DashboardComponents.d.ts +2 -0
- package/dist/components/Employee/Dashboard/DashboardComponents.js +18 -6
- package/dist/components/Employee/Dashboard/DashboardComponents.js.map +1 -1
- package/dist/components/Employee/Dashboard/dashboardStateMachine.d.ts +2 -0
- package/dist/components/Employee/Dashboard/dashboardStateMachine.js +55 -4
- package/dist/components/Employee/Dashboard/dashboardStateMachine.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.d.ts +0 -33
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +130 -214
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +79 -56
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/shared/useSignEmployeeForm/fields.d.ts +2 -3
- package/dist/components/Employee/DocumentSigner/shared/useSignEmployeeForm/fields.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/shared/useSignEmployeeForm/index.d.ts +2 -2
- package/dist/components/Employee/DocumentSigner/shared/useSignEmployeeForm/signEmployeeFormSchema.d.ts +0 -1
- package/dist/components/Employee/DocumentSigner/shared/useSignEmployeeForm/signEmployeeFormSchema.js +33 -49
- package/dist/components/Employee/DocumentSigner/shared/useSignEmployeeForm/signEmployeeFormSchema.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/shared/useSignEmployeeForm/useSignEmployeeForm.d.ts +12 -3
- package/dist/components/Employee/DocumentSigner/shared/useSignEmployeeForm/useSignEmployeeForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js.map +1 -0
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js.map +1 -0
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeList.js.map +1 -0
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js.map +1 -0
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js.map +1 -0
- package/dist/components/Employee/HomeAddress/management/HomeAddress.d.ts +6 -0
- package/dist/components/Employee/HomeAddress/management/HomeAddress.js +48 -0
- package/dist/components/Employee/HomeAddress/management/HomeAddress.js.map +1 -0
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.d.ts +18 -0
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +476 -0
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -0
- package/dist/components/Employee/HomeAddress/management/getPendingFutureHomeAddress.d.ts +8 -0
- package/dist/components/Employee/HomeAddress/management/getPendingFutureHomeAddress.js +36 -0
- package/dist/components/Employee/HomeAddress/management/getPendingFutureHomeAddress.js.map +1 -0
- package/dist/components/Employee/HomeAddress/management/getPendingFutureHomeAddress.test.d.ts +1 -0
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.d.ts +45 -0
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js +112 -0
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js.map +1 -0
- package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.js +1 -1
- package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +22 -21
- package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/AdminProfile.js +144 -146
- package/dist/components/Employee/Profile/AdminProfile.js.map +1 -1
- package/dist/components/Employee/Profile/EmployeeProfile.js +34 -30
- package/dist/components/Employee/Profile/EmployeeProfile.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js +37 -36
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/index.d.ts +2 -0
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.d.ts +3 -0
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.js +24 -0
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.js.map +1 -0
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.d.ts +9 -3
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.js +97 -97
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/index.d.ts +2 -0
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.d.ts +3 -0
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.js +24 -0
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.js.map +1 -0
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.d.ts +10 -4
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.js +95 -84
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlow.js +11 -9
- package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlow.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.js +71 -89
- package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddress.d.ts +6 -0
- package/dist/components/Employee/WorkAddress/management/WorkAddress.js +48 -0
- package/dist/components/Employee/WorkAddress/management/WorkAddress.js.map +1 -0
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.d.ts +16 -0
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +367 -0
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -0
- package/dist/components/Employee/WorkAddress/management/getPendingFutureWorkAddress.d.ts +4 -0
- package/dist/components/Employee/WorkAddress/management/getPendingFutureWorkAddress.js +35 -0
- package/dist/components/Employee/WorkAddress/management/getPendingFutureWorkAddress.js.map +1 -0
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.d.ts +45 -0
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js +143 -0
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js.map +1 -0
- package/dist/components/Employee/exports/employeeManagement.d.ts +3 -1
- package/dist/components/Employee/exports/employeeManagement.js +12 -10
- package/dist/components/Employee/exports/employeeManagement.js.map +1 -1
- package/dist/components/Employee/exports/employeeOnboarding.d.ts +1 -1
- package/dist/components/Employee/exports/employeeOnboarding.js +1 -1
- package/dist/components/Employee/index.d.ts +5 -1
- package/dist/components/Employee/index.js +37 -33
- package/dist/components/Employee/index.js.map +1 -1
- package/dist/components/Flow/Flow.js +23 -50
- package/dist/components/Flow/Flow.js.map +1 -1
- package/dist/components/Flow/FlowHeader.d.ts +16 -0
- package/dist/components/Flow/FlowHeader.js +89 -0
- package/dist/components/Flow/FlowHeader.js.map +1 -0
- package/dist/components/Flow/useFlow.d.ts +33 -6
- package/dist/components/Flow/useFlow.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalFlow.js +20 -18
- package/dist/components/Payroll/Dismissal/DismissalFlow.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js +10 -10
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js.map +1 -1
- package/dist/components/Payroll/Dismissal/dismissalStateMachine.js +17 -19
- package/dist/components/Payroll/Dismissal/dismissalStateMachine.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlow.js +13 -11
- package/dist/components/Payroll/OffCycle/OffCycleFlow.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +9 -9
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.js +25 -29
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js +43 -42
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +38 -42
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js +18 -17
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +69 -78
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js +13 -12
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js +51 -82
- package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +45 -43
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlow.js +17 -15
- package/dist/components/Payroll/Transition/TransitionFlow.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js +24 -24
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js.map +1 -1
- package/dist/components/Payroll/Transition/transitionStateMachine.js +25 -29
- package/dist/components/Payroll/Transition/transitionStateMachine.js.map +1 -1
- package/dist/components/UNSTABLE_TimeOff/shared/EmployeeTable/EmployeeTableTypes.d.ts +1 -0
- package/dist/helpers/breadcrumbHelpers.d.ts +35 -22
- package/dist/helpers/breadcrumbHelpers.js +45 -35
- package/dist/helpers/breadcrumbHelpers.js.map +1 -1
- package/dist/helpers/dateFormatting.d.ts +12 -0
- package/dist/helpers/dateFormatting.js +72 -65
- package/dist/helpers/dateFormatting.js.map +1 -1
- package/dist/helpers/formattedStrings.d.ts +2 -0
- package/dist/helpers/formattedStrings.js +30 -27
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/i18n/I18n.js +130 -35
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Company.PaySchedule.json.js +15 -13
- package/dist/i18n/en/Company.PaySchedule.json.js.map +1 -1
- package/dist/i18n/en/Employee.HomeAddress.Management.json.js +60 -0
- package/dist/i18n/en/Employee.HomeAddress.Management.json.js.map +1 -0
- package/dist/i18n/en/Employee.HomeAddress.json.js +22 -20
- package/dist/i18n/en/Employee.HomeAddress.json.js.map +1 -1
- package/dist/i18n/en/Employee.I9SignatureForm.json.js +79 -75
- package/dist/i18n/en/Employee.I9SignatureForm.json.js.map +1 -1
- package/dist/i18n/en/Employee.PaymentMethod.json.js +13 -13
- package/dist/i18n/en/Employee.WorkAddress.Management.json.js +62 -0
- package/dist/i18n/en/Employee.WorkAddress.Management.json.js.map +1 -0
- package/dist/i18n/en/Payroll.RecoveryCasesList.json.js +14 -10
- package/dist/i18n/en/Payroll.RecoveryCasesList.json.js.map +1 -1
- package/dist/i18n/en/common.json.d.ts +1 -0
- package/dist/i18n/en/common.json.js +28 -26
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +72 -68
- package/dist/index.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/DatePickerHookField.d.ts +4 -2
- package/dist/partner-hook-utils/form/fields/DatePickerHookField.js +19 -13
- package/dist/partner-hook-utils/form/fields/DatePickerHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SelectHookField.d.ts +5 -2
- package/dist/partner-hook-utils/form/fields/SelectHookField.js +21 -17
- package/dist/partner-hook-utils/form/fields/SelectHookField.js.map +1 -1
- package/dist/shared/constants.d.ts +4 -0
- package/dist/shared/constants.js +14 -12
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +98 -1
- package/docs/reference/endpoint-inventory.json +88 -43
- package/package.json +10 -10
- package/dist/_virtual/dynamic-import-helper.js +0 -17
- package/dist/_virtual/dynamic-import-helper.js.map +0 -1
- package/dist/components/Common/SignatureForm/SignatureForm.d.ts +0 -14
- package/dist/components/Common/SignatureForm/SignatureForm.js +0 -26
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +0 -1
- package/dist/components/Common/SignatureForm/SignatureForm.module.scss.js +0 -10
- package/dist/components/Common/SignatureForm/SignatureForm.module.scss.js.map +0 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.d.ts +0 -8
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +0 -19
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +0 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.d.ts +0 -9
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +0 -36
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +0 -1
- package/dist/components/Common/SignatureForm/index.d.ts +0 -5
- package/dist/components/Company/DocumentSigner/SignatureForm/Actions.d.ts +0 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/Actions.js +0 -20
- package/dist/components/Company/DocumentSigner/SignatureForm/Actions.js.map +0 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/Form.d.ts +0 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/Form.js +0 -20
- package/dist/components/Company/DocumentSigner/SignatureForm/Form.js.map +0 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/Head.d.ts +0 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/Head.js +0 -35
- package/dist/components/Company/DocumentSigner/SignatureForm/Head.js.map +0 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/Preview.d.ts +0 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/Preview.js +0 -20
- package/dist/components/Company/DocumentSigner/SignatureForm/Preview.js.map +0 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.d.ts +0 -9
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +0 -22
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +0 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.d.ts +0 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +0 -62
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +0 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.d.ts +0 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +0 -134
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +0 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.module.scss.js +0 -14
- package/dist/components/Company/PaySchedule/_parts/Edit.module.scss.js.map +0 -1
- package/dist/components/Company/PaySchedule/_parts/Head.d.ts +0 -1
- package/dist/components/Company/PaySchedule/_parts/Head.js +0 -47
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +0 -1
- package/dist/components/Company/PaySchedule/_parts/List.d.ts +0 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +0 -57
- package/dist/components/Company/PaySchedule/_parts/List.js.map +0 -1
- package/dist/components/Company/PaySchedule/_parts/List.module.scss.js.map +0 -1
- package/dist/components/Company/PaySchedule/_parts/index.d.ts +0 -5
- package/dist/components/Company/PaySchedule/usePaySchedule.d.ts +0 -39
- package/dist/components/Company/PaySchedule/usePaySchedule.js +0 -30
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/Actions.d.ts +0 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/Actions.js +0 -20
- package/dist/components/Employee/DocumentSigner/SignatureForm/Actions.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/Form.d.ts +0 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/Form.js +0 -20
- package/dist/components/Employee/DocumentSigner/SignatureForm/Form.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/Head.d.ts +0 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/Head.js +0 -35
- package/dist/components/Employee/DocumentSigner/SignatureForm/Head.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/Preview.d.ts +0 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/Preview.js +0 -20
- package/dist/components/Employee/DocumentSigner/SignatureForm/Preview.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.d.ts +0 -9
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +0 -20
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +0 -1
- package/dist/components/Employee/employee-list/management/ManagementEmployeeList.js.map +0 -1
- package/dist/components/Employee/employee-list/management/ManagementEmployeeListView.js.map +0 -1
- package/dist/components/Employee/employee-list/onboarding/EmployeeList.js.map +0 -1
- package/dist/components/Employee/employee-list/onboarding/EmployeeListView.js.map +0 -1
- package/dist/components/Employee/employee-list/shared/useEmployeeList.js.map +0 -1
- /package/dist/components/Employee/{employee-list → EmployeeList}/management/ManagementEmployeeList.d.ts +0 -0
- /package/dist/components/Employee/{employee-list → EmployeeList}/management/ManagementEmployeeList.js +0 -0
- /package/dist/components/Employee/{employee-list → EmployeeList}/management/ManagementEmployeeListView.d.ts +0 -0
- /package/dist/components/Employee/{employee-list → EmployeeList}/management/ManagementEmployeeListView.js +0 -0
- /package/dist/components/Employee/{employee-list → EmployeeList}/onboarding/EmployeeList.d.ts +0 -0
- /package/dist/components/Employee/{employee-list → EmployeeList}/onboarding/EmployeeList.js +0 -0
- /package/dist/components/Employee/{employee-list → EmployeeList}/onboarding/EmployeeListView.d.ts +0 -0
- /package/dist/components/Employee/{employee-list → EmployeeList}/onboarding/EmployeeListView.js +0 -0
- /package/dist/components/Employee/{employee-list → EmployeeList}/shared/index.d.ts +0 -0
- /package/dist/components/Employee/{employee-list → EmployeeList}/shared/useEmployeeList.d.ts +0 -0
- /package/dist/components/Employee/{employee-list → EmployeeList}/shared/useEmployeeList.js +0 -0
|
@@ -1,82 +1,84 @@
|
|
|
1
|
-
import { state as e, transition as t, reduce as
|
|
2
|
-
import { OnboardingOverviewContextual as
|
|
3
|
-
import { componentEvents as
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { state as e, transition as t, reduce as n } from "robot3";
|
|
2
|
+
import { OnboardingOverviewContextual as O, DocumentSignerContextual as E, StateTaxesContextual as d, PayScheduleContextual as l, EmployeesContextual as u, BankAccountContextual as N, IndustryContextual as _, FederalTaxesContextual as p, LocationsContextual as C } from "./OnboardingFlowComponents.js";
|
|
3
|
+
import { componentEvents as o } from "../../../shared/constants.js";
|
|
4
|
+
const m = 8, r = (c) => ({
|
|
5
|
+
type: "progress",
|
|
6
|
+
currentStep: c,
|
|
7
|
+
totalSteps: m
|
|
8
|
+
}), a = (c) => (s) => ({
|
|
9
|
+
...s,
|
|
10
|
+
...c
|
|
11
|
+
}), x = {
|
|
8
12
|
overview: e(
|
|
9
13
|
t(
|
|
10
|
-
|
|
14
|
+
o.COMPANY_OVERVIEW_CONTINUE,
|
|
11
15
|
"locations",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
component:
|
|
15
|
-
|
|
16
|
-
progressBarType: "progress"
|
|
16
|
+
n(
|
|
17
|
+
a({
|
|
18
|
+
component: C,
|
|
19
|
+
header: r(1)
|
|
17
20
|
})
|
|
18
21
|
)
|
|
19
22
|
),
|
|
20
|
-
t(
|
|
23
|
+
t(o.COMPANY_OVERVIEW_DONE, "final")
|
|
21
24
|
),
|
|
22
25
|
locations: e(
|
|
23
26
|
t(
|
|
24
|
-
|
|
27
|
+
o.COMPANY_LOCATION_DONE,
|
|
25
28
|
"federalTaxes",
|
|
26
|
-
|
|
29
|
+
n(a({ component: p, header: r(2) }))
|
|
27
30
|
)
|
|
28
31
|
),
|
|
29
32
|
federalTaxes: e(
|
|
30
33
|
t(
|
|
31
|
-
|
|
34
|
+
o.COMPANY_FEDERAL_TAXES_DONE,
|
|
32
35
|
"industry",
|
|
33
|
-
|
|
36
|
+
n(a({ component: _, header: r(3) }))
|
|
34
37
|
)
|
|
35
38
|
),
|
|
36
39
|
industry: e(
|
|
37
40
|
t(
|
|
38
|
-
|
|
41
|
+
o.COMPANY_INDUSTRY_SELECTED,
|
|
39
42
|
"bankAccount",
|
|
40
|
-
|
|
43
|
+
n(a({ component: N, header: r(4) }))
|
|
41
44
|
)
|
|
42
45
|
),
|
|
43
46
|
bankAccount: e(
|
|
44
47
|
t(
|
|
45
|
-
|
|
48
|
+
o.COMPANY_BANK_ACCOUNT_DONE,
|
|
46
49
|
"employees",
|
|
47
|
-
|
|
50
|
+
n(a({ component: u, header: r(5) }))
|
|
48
51
|
)
|
|
49
52
|
),
|
|
50
53
|
employees: e(
|
|
51
54
|
t(
|
|
52
|
-
|
|
55
|
+
o.EMPLOYEE_ONBOARDING_DONE,
|
|
53
56
|
"payschedule",
|
|
54
|
-
|
|
57
|
+
n(a({ component: l, header: r(6) }))
|
|
55
58
|
)
|
|
56
59
|
),
|
|
57
60
|
payschedule: e(
|
|
58
61
|
t(
|
|
59
|
-
|
|
62
|
+
o.PAY_SCHEDULE_DONE,
|
|
60
63
|
"stateTaxes",
|
|
61
|
-
|
|
64
|
+
n(a({ component: d, header: r(7) }))
|
|
62
65
|
)
|
|
63
66
|
),
|
|
64
67
|
stateTaxes: e(
|
|
65
68
|
t(
|
|
66
|
-
|
|
69
|
+
o.COMPANY_STATE_TAX_DONE,
|
|
67
70
|
"documents",
|
|
68
|
-
|
|
71
|
+
n(a({ component: E, header: r(8) }))
|
|
69
72
|
)
|
|
70
73
|
),
|
|
71
74
|
documents: e(
|
|
72
75
|
t(
|
|
73
|
-
|
|
76
|
+
o.COMPANY_FORMS_DONE,
|
|
74
77
|
"overview",
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
component:
|
|
78
|
-
|
|
79
|
-
progressBarType: null
|
|
78
|
+
n(
|
|
79
|
+
a({
|
|
80
|
+
component: O,
|
|
81
|
+
header: null
|
|
80
82
|
})
|
|
81
83
|
)
|
|
82
84
|
)
|
|
@@ -84,6 +86,6 @@ const r = (a) => (c) => ({
|
|
|
84
86
|
final: e()
|
|
85
87
|
};
|
|
86
88
|
export {
|
|
87
|
-
|
|
89
|
+
x as onboardingMachine
|
|
88
90
|
};
|
|
89
91
|
//# sourceMappingURL=onboardingStateMachine.js.map
|
|
@@ -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 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'\nimport type { MachineTransition } from '@/types/Helpers'\n\nconst createReducer = (props: Partial<OnboardingFlowContextInterface>) => {\n return (ctx: OnboardingFlowContextInterface): OnboardingFlowContextInterface => ({\n ...ctx,\n ...props,\n })\n}\nexport const onboardingMachine = {\n overview: state<MachineTransition>(\n transition(\n componentEvents.COMPANY_OVERVIEW_CONTINUE,\n 'locations',\n reduce(\n createReducer({\n component: LocationsContextual,\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'\nimport type { MachineTransition } from '@/types/Helpers'\nimport type { FlowHeaderConfig } from '@/components/Flow/useFlow'\n\nconst TOTAL_STEPS = 8\n\nconst progressHeader = (currentStep: number): FlowHeaderConfig => ({\n type: 'progress',\n currentStep,\n totalSteps: TOTAL_STEPS,\n})\n\nconst createReducer = (props: Partial<OnboardingFlowContextInterface>) => {\n return (ctx: OnboardingFlowContextInterface): OnboardingFlowContextInterface => ({\n ...ctx,\n ...props,\n })\n}\n\nexport const onboardingMachine = {\n overview: state<MachineTransition>(\n transition(\n componentEvents.COMPANY_OVERVIEW_CONTINUE,\n 'locations',\n reduce(\n createReducer({\n component: LocationsContextual,\n header: progressHeader(1),\n }),\n ),\n ),\n transition(componentEvents.COMPANY_OVERVIEW_DONE, 'final'),\n ),\n locations: state<MachineTransition>(\n transition(\n componentEvents.COMPANY_LOCATION_DONE,\n 'federalTaxes',\n reduce(createReducer({ component: FederalTaxesContextual, header: progressHeader(2) })),\n ),\n ),\n federalTaxes: state<MachineTransition>(\n transition(\n componentEvents.COMPANY_FEDERAL_TAXES_DONE,\n 'industry',\n reduce(createReducer({ component: IndustryContextual, header: progressHeader(3) })),\n ),\n ),\n industry: state<MachineTransition>(\n transition(\n componentEvents.COMPANY_INDUSTRY_SELECTED,\n 'bankAccount',\n reduce(createReducer({ component: BankAccountContextual, header: progressHeader(4) })),\n ),\n ),\n bankAccount: state<MachineTransition>(\n transition(\n componentEvents.COMPANY_BANK_ACCOUNT_DONE,\n 'employees',\n reduce(createReducer({ component: EmployeesContextual, header: progressHeader(5) })),\n ),\n ),\n employees: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_ONBOARDING_DONE,\n 'payschedule',\n reduce(createReducer({ component: PayScheduleContextual, header: progressHeader(6) })),\n ),\n ),\n payschedule: state<MachineTransition>(\n transition(\n componentEvents.PAY_SCHEDULE_DONE,\n 'stateTaxes',\n reduce(createReducer({ component: StateTaxesContextual, header: progressHeader(7) })),\n ),\n ),\n stateTaxes: state<MachineTransition>(\n transition(\n componentEvents.COMPANY_STATE_TAX_DONE,\n 'documents',\n reduce(createReducer({ component: DocumentSignerContextual, header: progressHeader(8) })),\n ),\n ),\n documents: state<MachineTransition>(\n transition(\n componentEvents.COMPANY_FORMS_DONE,\n 'overview',\n reduce(\n createReducer({\n component: OnboardingOverviewContextual,\n header: null,\n }),\n ),\n ),\n ),\n\n final: state<MachineTransition>(),\n}\n"],"names":["TOTAL_STEPS","progressHeader","currentStep","createReducer","props","ctx","onboardingMachine","state","transition","componentEvents","reduce","LocationsContextual","FederalTaxesContextual","IndustryContextual","BankAccountContextual","EmployeesContextual","PayScheduleContextual","StateTaxesContextual","DocumentSignerContextual","OnboardingOverviewContextual"],"mappings":";;;AAiBA,MAAMA,IAAc,GAEdC,IAAiB,CAACC,OAA2C;AAAA,EACjE,MAAM;AAAA,EACN,aAAAA;AAAA,EACA,YAAYF;AACd,IAEMG,IAAgB,CAACC,MACd,CAACC,OAAyE;AAAA,EAC/E,GAAGA;AAAA,EACH,GAAGD;AAAA,IAIME,IAAoB;AAAA,EAC/B,UAAUC;AAAA,IACRC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAC;AAAA,QACEP,EAAc;AAAA,UACZ,WAAWQ;AAAA,UACX,QAAQV,EAAe,CAAC;AAAA,QAAA,CACzB;AAAA,MAAA;AAAA,IACH;AAAA,IAEFO,EAAWC,EAAgB,uBAAuB,OAA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A,MACAC;AAAA,QACEP,EAAc;AAAA,UACZ,WAAWgB;AAAA,UACX,QAAQ;AAAA,QAAA,CACT;AAAA,MAAA;AAAA,IACH;AAAA,EACF;AAAA,EAGF,OAAOZ,EAAA;AACT;"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PayScheduleCreateUpdate } from '@gusto/embedded-api/models/components/payschedulecreateupdate';
|
|
2
2
|
import { BaseComponentInterface, CommonComponentInterface } from '../../Base';
|
|
3
|
+
import { RequireAtLeastOne } from '../../../types/Helpers';
|
|
4
|
+
type PayScheduleDefaultFields = {
|
|
5
|
+
[K in keyof Pick<PayScheduleCreateUpdate, 'anchorPayDate' | 'anchorEndOfPayPeriod' | 'day1' | 'day2' | 'customName' | 'frequency'>]: NonNullable<PayScheduleCreateUpdate[K]>;
|
|
6
|
+
};
|
|
7
|
+
export type PayScheduleDefaultValues = RequireAtLeastOne<Partial<PayScheduleDefaultFields>>;
|
|
3
8
|
interface PayScheduleProps extends CommonComponentInterface<'Company.PaySchedule'> {
|
|
4
9
|
companyId: string;
|
|
5
10
|
defaultValues?: PayScheduleDefaultValues;
|
|
@@ -1,153 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import { useBase as te } from "../../Base/useBase.js";
|
|
15
|
-
import { Flex as ae } from "../../Common/Flex/Flex.js";
|
|
16
|
-
import { useI18n as ne, useComponentDictionary as ce } from "../../../i18n/I18n.js";
|
|
17
|
-
import { componentEvents as p } from "../../../shared/constants.js";
|
|
18
|
-
import { formatDateToStringDate as l } from "../../../helpers/dateFormatting.js";
|
|
19
|
-
import { normalizeErrorKeyForForm as ie } from "../../../helpers/formattedStrings.js";
|
|
20
|
-
import { Head as de } from "./_parts/Head.js";
|
|
21
|
-
import { List as se } from "./_parts/List.js";
|
|
22
|
-
import { Edit as me } from "./_parts/Edit.js";
|
|
23
|
-
import { Actions as ye } from "./_parts/Actions.js";
|
|
24
|
-
const Re = ({
|
|
25
|
-
companyId: n,
|
|
26
|
-
defaultValues: m,
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as u } from "react";
|
|
3
|
+
import { createMachine as l } from "robot3";
|
|
4
|
+
import { usePaySchedulesGetAllSuspense as p } from "@gusto/embedded-api/react-query/paySchedulesGetAll";
|
|
5
|
+
import { payScheduleStateMachine as h } from "./payScheduleStateMachine.js";
|
|
6
|
+
import { PayScheduleListContextual as S, PayScheduleFormContextual as d } from "./PayScheduleComponents.js";
|
|
7
|
+
import { BaseComponent as f } from "../../Base/Base.js";
|
|
8
|
+
import { useBase as y } from "../../Base/useBase.js";
|
|
9
|
+
import { useI18n as C, useComponentDictionary as P } from "../../../i18n/I18n.js";
|
|
10
|
+
import { Flow as x } from "../../Flow/Flow.js";
|
|
11
|
+
const L = ({
|
|
12
|
+
companyId: e,
|
|
13
|
+
defaultValues: o,
|
|
27
14
|
dictionary: t,
|
|
28
|
-
...
|
|
29
|
-
}) => (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
resolver: J($),
|
|
44
|
-
defaultValues: g
|
|
45
|
-
}), { watch: M, setValue: S, reset: s, clearErrors: N, setError: _ } = D, u = O?.fieldErrors;
|
|
46
|
-
T(() => {
|
|
47
|
-
u && u.length > 0 && u.forEach((o) => {
|
|
48
|
-
const r = ie(o.field);
|
|
49
|
-
_(r, { message: o.message });
|
|
50
|
-
});
|
|
51
|
-
}, [_, u]);
|
|
52
|
-
const e = M(), C = e.anchorPayDate && l(e.anchorPayDate) || "", L = e.anchorEndOfPayPeriod && l(e.anchorEndOfPayPeriod) || "", { data: R, isLoading: F } = Q(
|
|
53
|
-
{
|
|
54
|
-
companyId: n,
|
|
55
|
-
frequency: e.frequency,
|
|
56
|
-
...C && { anchorPayDate: new i(C) },
|
|
57
|
-
...L && {
|
|
58
|
-
anchorEndOfPayPeriod: new i(L)
|
|
59
|
-
},
|
|
60
|
-
day1: e.day1 ?? void 0,
|
|
61
|
-
day2: e.day2 ?? void 0
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
enabled: !!(e.anchorPayDate && e.anchorEndOfPayPeriod && (d === "ADD_PAY_SCHEDULE" || d === "EDIT_PAY_SCHEDULE"))
|
|
65
|
-
}
|
|
15
|
+
...n
|
|
16
|
+
}) => (C("Company.PaySchedule"), P("Company.PaySchedule", t), /* @__PURE__ */ r(f, { ...n, children: /* @__PURE__ */ r(M, { companyId: e, defaultValues: o }) }));
|
|
17
|
+
function M({ companyId: e, defaultValues: o }) {
|
|
18
|
+
const { onEvent: t } = y(), { data: n } = p({ companyId: e }), m = (n.paySchedules?.length ?? 0) > 0, c = m ? "listSchedules" : "addSchedule", i = m ? S : d, a = u(
|
|
19
|
+
() => l(
|
|
20
|
+
c,
|
|
21
|
+
h,
|
|
22
|
+
(s) => ({
|
|
23
|
+
...s,
|
|
24
|
+
component: i,
|
|
25
|
+
companyId: e,
|
|
26
|
+
defaultValues: o
|
|
27
|
+
})
|
|
28
|
+
),
|
|
29
|
+
[e, o, c, i]
|
|
66
30
|
);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, [e.frequency, e.day1, e.day2, S, e.customTwicePerMonth]);
|
|
70
|
-
const b = () => {
|
|
71
|
-
P("ADD_PAY_SCHEDULE"), s({});
|
|
72
|
-
}, x = () => {
|
|
73
|
-
P("LIST_PAY_SCHEDULES"), s({}), N(), U(null);
|
|
74
|
-
}, B = (o) => {
|
|
75
|
-
s({
|
|
76
|
-
frequency: o.frequency,
|
|
77
|
-
anchorPayDate: o.anchorPayDate ? new Date(o.anchorPayDate.toString()) : void 0,
|
|
78
|
-
anchorEndOfPayPeriod: o.anchorEndOfPayPeriod ? new Date(o.anchorEndOfPayPeriod.toString()) : void 0,
|
|
79
|
-
day1: o.day1 ?? void 0,
|
|
80
|
-
day2: o.day2 ?? void 0,
|
|
81
|
-
customName: o.customName ?? ""
|
|
82
|
-
}), Y(o), P("EDIT_PAY_SCHEDULE");
|
|
83
|
-
}, I = () => {
|
|
84
|
-
f(p.PAY_SCHEDULE_DONE);
|
|
85
|
-
}, j = async (o) => {
|
|
86
|
-
await y(o, async (r) => {
|
|
87
|
-
const h = (c) => c && l(c) || "";
|
|
88
|
-
if (d === "ADD_PAY_SCHEDULE") {
|
|
89
|
-
const c = await v.mutateAsync({
|
|
90
|
-
request: {
|
|
91
|
-
companyId: n,
|
|
92
|
-
payScheduleCreateRequest: {
|
|
93
|
-
frequency: r.frequency,
|
|
94
|
-
anchorPayDate: new i(h(r.anchorPayDate)),
|
|
95
|
-
anchorEndOfPayPeriod: new i(h(r.anchorEndOfPayPeriod)),
|
|
96
|
-
customName: r.customName,
|
|
97
|
-
day1: r.day1,
|
|
98
|
-
day2: r.day2
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
f(p.PAY_SCHEDULE_CREATED, c), s();
|
|
103
|
-
} else if (d === "EDIT_PAY_SCHEDULE") {
|
|
104
|
-
const c = E?.version, k = await A.mutateAsync({
|
|
105
|
-
request: {
|
|
106
|
-
payScheduleId: E?.uuid,
|
|
107
|
-
companyId: n,
|
|
108
|
-
payScheduleUpdateRequest: {
|
|
109
|
-
frequency: r.frequency,
|
|
110
|
-
anchorPayDate: new i(h(r.anchorPayDate)),
|
|
111
|
-
anchorEndOfPayPeriod: new i(h(r.anchorEndOfPayPeriod)),
|
|
112
|
-
customName: r.customName,
|
|
113
|
-
day1: r.day1,
|
|
114
|
-
day2: r.day2,
|
|
115
|
-
version: c
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
f(p.PAY_SCHEDULE_UPDATED, k), s();
|
|
120
|
-
}
|
|
121
|
-
P("LIST_PAY_SCHEDULES");
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
return /* @__PURE__ */ a(
|
|
125
|
-
V,
|
|
126
|
-
{
|
|
127
|
-
value: {
|
|
128
|
-
companyId: n,
|
|
129
|
-
handleAdd: b,
|
|
130
|
-
handleEdit: B,
|
|
131
|
-
handleCancel: x,
|
|
132
|
-
handleContinue: I,
|
|
133
|
-
mode: d,
|
|
134
|
-
isPending: v.isPending || A.isPending,
|
|
135
|
-
paySchedules: w.paySchedules,
|
|
136
|
-
payPeriodPreview: R?.paySchedulePreview?.payPeriods,
|
|
137
|
-
payPreviewLoading: F,
|
|
138
|
-
currentPaySchedule: E,
|
|
139
|
-
paymentSpeedDays: H
|
|
140
|
-
},
|
|
141
|
-
children: /* @__PURE__ */ a("span", { "data-testid": "pay-schedule-edit-form", children: /* @__PURE__ */ a(K, { ...D, children: /* @__PURE__ */ a(oe, { onSubmit: D.handleSubmit(j), children: m || /* @__PURE__ */ z(ae, { flexDirection: "column", children: [
|
|
142
|
-
/* @__PURE__ */ a(de, {}),
|
|
143
|
-
/* @__PURE__ */ a(se, {}),
|
|
144
|
-
/* @__PURE__ */ a(me, {}),
|
|
145
|
-
/* @__PURE__ */ a(ye, {})
|
|
146
|
-
] }) }) }) })
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
};
|
|
31
|
+
return /* @__PURE__ */ r(x, { machine: a, onEvent: t });
|
|
32
|
+
}
|
|
150
33
|
export {
|
|
151
|
-
|
|
34
|
+
L as PaySchedule
|
|
152
35
|
};
|
|
153
36
|
//# 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 { usePaySchedulesGetAllSuspense } from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport { usePaySchedulesCreateMutation } from '@gusto/embedded-api/react-query/paySchedulesCreate'\nimport type { PaySchedule as PayScheduleType } from '@gusto/embedded-api/models/components/payschedule'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\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 { useCompanyPaymentSpeed } from '@/hooks/useCompanyPaymentSpeed'\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 { normalizeErrorKeyForForm } from '@/helpers/formattedStrings'\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 { baseSubmitHandler, onEvent, error, setError: setBaseError } = useBase()\n\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({\n companyId,\n })\n\n const { paymentSpeedDays } = useCompanyPaymentSpeed(companyId)\n\n const [mode, setMode] = useState<MODE>(\n paySchedules.paySchedules?.length === 0 ? 'ADD_PAY_SCHEDULE' : 'LIST_PAY_SCHEDULES',\n )\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 }\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, clearErrors, setError } = formMethods\n\n const fieldErrors = error?.fieldErrors\n useEffect(() => {\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(fieldError => {\n const key = normalizeErrorKeyForForm(fieldError.field)\n setError(key as keyof PayScheduleInputs, { message: fieldError.message })\n })\n }\n }, [setError, fieldErrors])\n\n const allValues = watch()\n\n const formattedAnchorPayDate = allValues.anchorPayDate\n ? formatDateToStringDate(allValues.anchorPayDate) || ''\n : ''\n const formattedAnchorEndOfPayPeriod = allValues.anchorEndOfPayPeriod\n ? formatDateToStringDate(allValues.anchorEndOfPayPeriod) || ''\n : ''\n\n const { data: payPreviewData, isLoading } = usePaySchedulesGetPreview(\n {\n companyId,\n frequency: allValues.frequency,\n ...(formattedAnchorPayDate && { anchorPayDate: new RFCDate(formattedAnchorPayDate) }),\n ...(formattedAnchorEndOfPayPeriod && {\n anchorEndOfPayPeriod: new RFCDate(formattedAnchorEndOfPayPeriod),\n }),\n day1: allValues.day1 ?? undefined,\n day2: allValues.day2 ?? undefined,\n } as Parameters<typeof usePaySchedulesGetPreview>[0],\n {\n enabled: Boolean(\n allValues.anchorPayDate &&\n allValues.anchorEndOfPayPeriod &&\n (mode === 'ADD_PAY_SCHEDULE' || mode === 'EDIT_PAY_SCHEDULE'),\n ),\n },\n )\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 const handleAdd = () => {\n setMode('ADD_PAY_SCHEDULE')\n reset({})\n }\n const handleCancel = () => {\n setMode('LIST_PAY_SCHEDULES')\n reset({})\n clearErrors()\n setBaseError(null)\n }\n const handleEdit = (schedule: PayScheduleType) => {\n reset({\n frequency: schedule.frequency as PayScheduleInputs['frequency'],\n anchorPayDate: schedule.anchorPayDate\n ? new Date(schedule.anchorPayDate.toString())\n : undefined,\n anchorEndOfPayPeriod: schedule.anchorEndOfPayPeriod\n ? new Date(schedule.anchorEndOfPayPeriod.toString())\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,\n payScheduleCreateRequest: {\n frequency: payload.frequency,\n anchorPayDate: new RFCDate(formatPayloadDate(payload.anchorPayDate)),\n anchorEndOfPayPeriod: new RFCDate(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 } 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,\n payScheduleUpdateRequest: {\n frequency: payload.frequency,\n anchorPayDate: new RFCDate(formatPayloadDate(payload.anchorPayDate)),\n anchorEndOfPayPeriod: new RFCDate(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 }\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 isPending: createPayScheduleMutation.isPending || updatePayScheduleMutation.isPending,\n paySchedules: paySchedules.paySchedules,\n payPeriodPreview: payPreviewData?.paySchedulePreview?.payPeriods,\n payPreviewLoading: isLoading,\n currentPaySchedule,\n paymentSpeedDays,\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"],"names":["PaySchedule","companyId","defaultValues","dictionary","props","useI18n","useComponentDictionary","jsx","BaseComponent","Root","children","baseSubmitHandler","onEvent","error","setBaseError","useBase","paySchedules","usePaySchedulesGetAllSuspense","paymentSpeedDays","useCompanyPaymentSpeed","mode","setMode","useState","currentPaySchedule","setCurrentPaySchedule","transformedDefaultValues","createPayScheduleMutation","usePaySchedulesCreateMutation","updatePayScheduleMutation","usePaySchedulesUpdateMutation","formMethods","useForm","zodResolver","PayScheduleSchema","watch","setValue","reset","clearErrors","setError","fieldErrors","useEffect","fieldError","key","normalizeErrorKeyForForm","allValues","formattedAnchorPayDate","formatDateToStringDate","formattedAnchorEndOfPayPeriod","payPreviewData","isLoading","usePaySchedulesGetPreview","RFCDate","handleAdd","handleCancel","handleEdit","schedule","handleContinue","componentEvents","onSubmit","data","payload","formatPayloadDate","date","createPayScheduleResponse","version","updatePayScheduleResponse","PayScheduleProvider","FormProvider","Form","jsxs","Flex","Head","List","Edit","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiCO,MAAMA,KAAc,CAAC;AAAA,EAC1B,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,OACEC,GAAQ,qBAAqB,GAC7BC,GAAuB,uBAAuBH,CAAU,GAEtD,gBAAAI,EAACC,IAAA,EAAe,GAAGJ,GACjB,UAAA,gBAAAG,EAACE,MAAK,WAAAR,GAAsB,eAAAC,GACzB,UAAAE,EAAM,SAAA,CACT,EAAA,CACF,IAIEK,KAAO,CAAC,EAAE,WAAAR,GAAW,UAAAS,GAAU,eAAAR,QAAsC;AACzE,QAAM,EAAE,mBAAAS,GAAmB,SAAAC,GAAS,OAAAC,GAAO,UAAUC,EAAA,IAAiBC,GAAA,GAEhE,EAAE,MAAMC,EAAA,IAAiBC,EAA8B;AA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,QAAApD,EAAQ6C,EAAgB,sBAAsBQ,CAAyB,GACvE7B,EAAA;AAAA,MACF;AACA,MAAAf,EAAQ,oBAAoB;AAAA,IAC9B,CAAC;AAAA,EACH;AAEA,SACE,gBAAAd;AAAA,IAAC2D;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,WAAAjE;AAAA,QACA,WAAAmD;AAAA,QACA,YAAAE;AAAA,QACA,cAAAD;AAAA,QACA,gBAAAG;AAAA,QACA,MAAApC;AAAA,QACA,WAAWM,EAA0B,aAAaE,EAA0B;AAAA,QAC5E,cAAcZ,EAAa;AAAA,QAC3B,kBAAkBgC,GAAgB,oBAAoB;AAAA,QACtD,mBAAmBC;AAAA,QACnB,oBAAA1B;AAAA,QACA,kBAAAL;AAAA,MAAA;AAAA,MAGF,UAAA,gBAAAX,EAAC,UAAK,eAAY,0BAChB,4BAAC4D,GAAA,EAAc,GAAGrC,GAChB,UAAA,gBAAAvB,EAAC6D,IAAA,EAAK,UAAUtC,EAAY,aAAa4B,CAAQ,GAC9C,UAAAhD,KAGC,gBAAA2D,EAACC,IAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAA/D,EAACgE,IAAA,EAAK;AAAA,0BACLC,IAAA,EAAK;AAAA,0BACLC,IAAA,EAAK;AAAA,0BACLC,IAAA,CAAA,CAAQ;AAAA,MAAA,GACX,EAAA,CAEJ,GACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"PaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/PaySchedule.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { createMachine } from 'robot3'\nimport { usePaySchedulesGetAllSuspense } from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport type { PayScheduleCreateUpdate } from '@gusto/embedded-api/models/components/payschedulecreateupdate'\nimport { payScheduleStateMachine } from './payScheduleStateMachine'\nimport type { PayScheduleContextInterface } from './PayScheduleComponents'\nimport { PayScheduleFormContextual, PayScheduleListContextual } from './PayScheduleComponents'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\ntype PayScheduleDefaultFields = {\n [K in keyof Pick<\n PayScheduleCreateUpdate,\n 'anchorPayDate' | 'anchorEndOfPayPeriod' | 'day1' | 'day2' | 'customName' | 'frequency'\n >]: NonNullable<PayScheduleCreateUpdate[K]>\n}\n\nexport type PayScheduleDefaultValues = RequireAtLeastOne<Partial<PayScheduleDefaultFields>>\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 </BaseComponent>\n )\n}\n\nfunction Root({ companyId, defaultValues }: PayScheduleProps) {\n const { onEvent } = useBase()\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({ companyId })\n\n const hasSchedules = (paySchedules.paySchedules?.length ?? 0) > 0\n const initialState = hasSchedules ? 'listSchedules' : 'addSchedule'\n const initialComponent = hasSchedules ? PayScheduleListContextual : PayScheduleFormContextual\n\n const machine = useMemo(\n () =>\n createMachine(\n initialState,\n payScheduleStateMachine,\n (initialContext: PayScheduleContextInterface) => ({\n ...initialContext,\n component: initialComponent,\n companyId,\n defaultValues,\n }),\n ),\n [companyId, defaultValues, initialState, initialComponent],\n )\n\n return <Flow machine={machine} onEvent={onEvent} />\n}\n"],"names":["PaySchedule","companyId","defaultValues","dictionary","props","useI18n","useComponentDictionary","jsx","BaseComponent","Root","onEvent","useBase","paySchedules","usePaySchedulesGetAllSuspense","hasSchedules","initialState","initialComponent","PayScheduleListContextual","PayScheduleFormContextual","machine","useMemo","createMachine","payScheduleStateMachine","initialContext","Flow"],"mappings":";;;;;;;;;;AA4BO,MAAMA,IAAc,CAAC;AAAA,EAC1B,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,OACEC,EAAQ,qBAAqB,GAC7BC,EAAuB,uBAAuBH,CAAU,GAEtD,gBAAAI,EAACC,KAAe,GAAGJ,GACjB,4BAACK,GAAA,EAAK,WAAAR,GAAsB,eAAAC,GAA8B,EAAA,CAC5D;AAIJ,SAASO,EAAK,EAAE,WAAAR,GAAW,eAAAC,KAAmC;AAC5D,QAAM,EAAE,SAAAQ,EAAA,IAAYC,EAAA,GACd,EAAE,MAAMC,EAAA,IAAiBC,EAA8B,EAAE,WAAAZ,GAAW,GAEpEa,KAAgBF,EAAa,cAAc,UAAU,KAAK,GAC1DG,IAAeD,IAAe,kBAAkB,eAChDE,IAAmBF,IAAeG,IAA4BC,GAE9DC,IAAUC;AAAA,IACd,MACEC;AAAA,MACEN;AAAA,MACAO;AAAA,MACA,CAACC,OAAiD;AAAA,QAChD,GAAGA;AAAA,QACH,WAAWP;AAAA,QACX,WAAAf;AAAA,QACA,eAAAC;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACD,GAAWC,GAAea,GAAcC,CAAgB;AAAA,EAAA;AAG3D,SAAO,gBAAAT,EAACiB,GAAA,EAAK,SAAAL,GAAkB,SAAAT,EAAA,CAAkB;AACnD;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PayScheduleDefaultValues } from './PaySchedule';
|
|
2
|
+
import { FlowContextInterface } from '../../Flow/useFlow';
|
|
3
|
+
export interface PayScheduleContextInterface extends FlowContextInterface {
|
|
4
|
+
companyId: string;
|
|
5
|
+
payScheduleId?: string;
|
|
6
|
+
defaultValues?: PayScheduleDefaultValues;
|
|
7
|
+
component: React.ComponentType | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function PayScheduleListContextual(): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function PayScheduleFormContextual(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { PayScheduleList as a } from "./PayScheduleList.js";
|
|
3
|
+
import { PayScheduleForm as c } from "./PayScheduleForm.js";
|
|
4
|
+
import { useFlow as n } from "../../Flow/useFlow.js";
|
|
5
|
+
import { ensureRequired as r } from "../../../helpers/ensureRequired.js";
|
|
6
|
+
function f() {
|
|
7
|
+
const { companyId: o, onEvent: e } = n();
|
|
8
|
+
return /* @__PURE__ */ t(a, { onEvent: e, companyId: r(o) });
|
|
9
|
+
}
|
|
10
|
+
function s() {
|
|
11
|
+
const { companyId: o, payScheduleId: e, defaultValues: m, onEvent: u } = n();
|
|
12
|
+
return /* @__PURE__ */ t(
|
|
13
|
+
c,
|
|
14
|
+
{
|
|
15
|
+
companyId: r(o),
|
|
16
|
+
payScheduleId: e,
|
|
17
|
+
defaultValues: m,
|
|
18
|
+
onEvent: u
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
s as PayScheduleFormContextual,
|
|
24
|
+
f as PayScheduleListContextual
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=PayScheduleComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayScheduleComponents.js","sources":["../../../../src/components/Company/PaySchedule/PayScheduleComponents.tsx"],"sourcesContent":["import type { PayScheduleDefaultValues } from './PaySchedule'\nimport { PayScheduleList } from './PayScheduleList'\nimport { PayScheduleForm } from './PayScheduleForm'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\nexport interface PayScheduleContextInterface extends FlowContextInterface {\n companyId: string\n payScheduleId?: string\n defaultValues?: PayScheduleDefaultValues\n component: React.ComponentType | null\n}\n\nexport function PayScheduleListContextual() {\n const { companyId, onEvent } = useFlow<PayScheduleContextInterface>()\n return <PayScheduleList onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\n\nexport function PayScheduleFormContextual() {\n const { companyId, payScheduleId, defaultValues, onEvent } =\n useFlow<PayScheduleContextInterface>()\n\n return (\n <PayScheduleForm\n companyId={ensureRequired(companyId)}\n payScheduleId={payScheduleId}\n defaultValues={defaultValues}\n onEvent={onEvent}\n />\n )\n}\n"],"names":["PayScheduleListContextual","companyId","onEvent","useFlow","PayScheduleList","ensureRequired","PayScheduleFormContextual","payScheduleId","defaultValues","jsx","PayScheduleForm"],"mappings":";;;;;AAaO,SAASA,IAA4B;AAC1C,QAAM,EAAE,WAAAC,GAAW,SAAAC,EAAA,IAAYC,EAAA;AAC/B,2BAAQC,GAAA,EAAgB,SAAAF,GAAkB,WAAWG,EAAeJ,CAAS,GAAG;AAClF;AAEO,SAASK,IAA4B;AAC1C,QAAM,EAAE,WAAAL,GAAW,eAAAM,GAAe,eAAAC,GAAe,SAAAN,EAAA,IAC/CC,EAAA;AAEF,SACE,gBAAAM;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWL,EAAeJ,CAAS;AAAA,MACnC,eAAAM;AAAA,MACA,eAAAC;AAAA,MACA,SAAAN;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UsePayScheduleFormProps } from './shared/usePayScheduleForm';
|
|
2
|
+
import { EventType } from '../../../shared/constants';
|
|
3
|
+
import { OnEventType } from '../../Base/useBase';
|
|
4
|
+
interface PayScheduleFormProps extends UsePayScheduleFormProps {
|
|
5
|
+
onEvent: OnEventType<EventType, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export declare function PayScheduleForm({ onEvent, ...hookProps }: PayScheduleFormProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx as a, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { useState as E } from "react";
|
|
3
|
+
import { useTranslation as w } from "react-i18next";
|
|
4
|
+
import { usePayScheduleForm as C } from "./shared/usePayScheduleForm/usePayScheduleForm.js";
|
|
5
|
+
import m from "./PayScheduleForm.module.scss.js";
|
|
6
|
+
import { BaseBoundaries as R, BaseLayout as p } from "../../Base/Base.js";
|
|
7
|
+
import "../../Base/useBase.js";
|
|
8
|
+
import { SDKFormProvider as A } from "../../../partner-hook-utils/form/SDKFormProvider.js";
|
|
9
|
+
import { Form as M } from "../../Common/Form/Form.js";
|
|
10
|
+
import { Flex as y } from "../../Common/Flex/Flex.js";
|
|
11
|
+
import { Grid as q } from "../../Common/Grid/Grid.js";
|
|
12
|
+
import { ActionsLayout as L } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
13
|
+
import { useComponentContext as O } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
+
import { useDateFormatter as x } from "../../../hooks/useDateFormatter.js";
|
|
15
|
+
import { componentEvents as u } from "../../../shared/constants.js";
|
|
16
|
+
function z({ onEvent: d, ...h }) {
|
|
17
|
+
return /* @__PURE__ */ a(R, { componentName: "Company.PayScheduleForm", children: /* @__PURE__ */ a(F, { onEvent: d, ...h }) });
|
|
18
|
+
}
|
|
19
|
+
function F({ onEvent: d, ...h }) {
|
|
20
|
+
const { t: e } = w("Company.PaySchedule"), n = O(), f = x(), r = C(h), [o, P] = E(0);
|
|
21
|
+
if (r.isLoading)
|
|
22
|
+
return /* @__PURE__ */ a(p, { isLoading: !0, error: r.errorHandling.errors });
|
|
23
|
+
const D = async () => {
|
|
24
|
+
const t = await r.actions.onSubmit();
|
|
25
|
+
t && d(
|
|
26
|
+
t.mode === "create" ? u.PAY_SCHEDULE_CREATED : u.PAY_SCHEDULE_UPDATED,
|
|
27
|
+
{ paySchedule: t.data }
|
|
28
|
+
);
|
|
29
|
+
}, { Fields: i } = r.form, { paymentSpeedDays: g, payPreviewLoading: v } = r.data, l = r.data.payPeriodPreview, b = {
|
|
30
|
+
"Every week": e("frequencies.everyWeek"),
|
|
31
|
+
"Every other week": e("frequencies.everyOtherWeek"),
|
|
32
|
+
"Twice per month": e("frequencies.twicePerMonth"),
|
|
33
|
+
Monthly: e("frequencies.monthly")
|
|
34
|
+
}, S = {
|
|
35
|
+
"1st15th": e("frequencyOptions.15thAndLast"),
|
|
36
|
+
custom: e("frequencyOptions.custom")
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ a(p, { error: r.errorHandling.errors, children: /* @__PURE__ */ a(A, { formHookResult: r, children: /* @__PURE__ */ a(M, { onSubmit: () => void D(), children: /* @__PURE__ */ s(y, { flexDirection: "column", children: [
|
|
39
|
+
/* @__PURE__ */ a(y, { justifyContent: "space-between", flexDirection: "column", gap: 4, children: /* @__PURE__ */ a("header", { children: /* @__PURE__ */ a(n.Heading, { as: "h2", children: r.status.mode === "create" ? e("headings.addPaySchedule") : e("headings.editPaySchedule") }) }) }),
|
|
40
|
+
/* @__PURE__ */ a("div", { className: m.payScheduleContainer, children: /* @__PURE__ */ s(q, { gap: 32, gridTemplateColumns: { base: "1fr", small: "1fr 1fr" }, children: [
|
|
41
|
+
/* @__PURE__ */ a("div", { className: m.payScheduleForm, children: /* @__PURE__ */ s(y, { flexDirection: "column", children: [
|
|
42
|
+
/* @__PURE__ */ a(
|
|
43
|
+
i.CustomName,
|
|
44
|
+
{
|
|
45
|
+
label: e("labels.name"),
|
|
46
|
+
validationMessages: { REQUIRED: e("validations.name") }
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ a(
|
|
50
|
+
i.Frequency,
|
|
51
|
+
{
|
|
52
|
+
label: e("labels.frequency"),
|
|
53
|
+
getOptionLabel: (t) => b[t],
|
|
54
|
+
validationMessages: { REQUIRED: e("validations.frequency") }
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
i.CustomTwicePerMonth && /* @__PURE__ */ a(
|
|
58
|
+
i.CustomTwicePerMonth,
|
|
59
|
+
{
|
|
60
|
+
label: e("labels.frequencyOptions"),
|
|
61
|
+
description: e("descriptions.frequencyOptionsDescription"),
|
|
62
|
+
getOptionLabel: (t) => S[t] ?? t
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ a(
|
|
66
|
+
i.AnchorPayDate,
|
|
67
|
+
{
|
|
68
|
+
label: e("labels.firstPayDate"),
|
|
69
|
+
description: e("descriptions.anchorPayDateDescription", {
|
|
70
|
+
count: g
|
|
71
|
+
}),
|
|
72
|
+
validationMessages: { REQUIRED: e("validations.firstPayDate") },
|
|
73
|
+
minDate: /* @__PURE__ */ new Date()
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ a(
|
|
77
|
+
i.AnchorEndOfPayPeriod,
|
|
78
|
+
{
|
|
79
|
+
label: e("labels.firstPayPeriodEndDate"),
|
|
80
|
+
description: e("descriptions.anchorEndOfPayPeriodDescription"),
|
|
81
|
+
validationMessages: { REQUIRED: e("validations.firstPayPeriodEndDate") }
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
i.Day1 && /* @__PURE__ */ a(
|
|
85
|
+
i.Day1,
|
|
86
|
+
{
|
|
87
|
+
label: e("labels.firstPayDayOfTheMonth"),
|
|
88
|
+
validationMessages: {
|
|
89
|
+
REQUIRED: e("validations.firstPayDayOfTheMonth"),
|
|
90
|
+
DAY_RANGE: e("validations.dayRange")
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
i.Day2 && /* @__PURE__ */ a(
|
|
95
|
+
i.Day2,
|
|
96
|
+
{
|
|
97
|
+
label: e("labels.lastPayDayOfTheMonth"),
|
|
98
|
+
validationMessages: {
|
|
99
|
+
REQUIRED: e("validations.lastPayDayOfTheMonth"),
|
|
100
|
+
DAY_RANGE: e("validations.dayRange")
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] }) }),
|
|
105
|
+
/* @__PURE__ */ a(y, { flexDirection: "column", gap: 4, justifyContent: "center", alignItems: "center", children: l && l[o] ? /* @__PURE__ */ s("div", { className: m.calendarContainer, children: [
|
|
106
|
+
!v && /* @__PURE__ */ a(
|
|
107
|
+
n.Select,
|
|
108
|
+
{
|
|
109
|
+
label: e("labels.preview"),
|
|
110
|
+
isRequired: !0,
|
|
111
|
+
options: l.map((t, c) => ({
|
|
112
|
+
value: String(c),
|
|
113
|
+
label: f.formatPayPeriodRange(
|
|
114
|
+
t.startDate.toString(),
|
|
115
|
+
t.endDate.toString()
|
|
116
|
+
)
|
|
117
|
+
})),
|
|
118
|
+
value: String(o),
|
|
119
|
+
onChange: (t) => {
|
|
120
|
+
const c = Number(t);
|
|
121
|
+
isNaN(c) || P(c);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ a(
|
|
126
|
+
n.CalendarPreview,
|
|
127
|
+
{
|
|
128
|
+
dateRange: {
|
|
129
|
+
start: new Date(
|
|
130
|
+
l[o].startDate.toString()
|
|
131
|
+
),
|
|
132
|
+
end: new Date(
|
|
133
|
+
l[o].endDate.toString()
|
|
134
|
+
),
|
|
135
|
+
label: e("payPreview.payPeriod") || "Pay Period"
|
|
136
|
+
},
|
|
137
|
+
highlightDates: [
|
|
138
|
+
{
|
|
139
|
+
date: new Date(
|
|
140
|
+
l[o].checkDate.toString()
|
|
141
|
+
),
|
|
142
|
+
highlightColor: "primary",
|
|
143
|
+
label: e("payPreview.payday") || "Payday"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
date: new Date(
|
|
147
|
+
l[o].runPayrollBy.toString()
|
|
148
|
+
),
|
|
149
|
+
highlightColor: "secondary",
|
|
150
|
+
label: e("payPreview.payrollDeadline") || "Payroll Deadline"
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
o
|
|
155
|
+
)
|
|
156
|
+
] }) : /* @__PURE__ */ a("div", { className: m.calendarContainer, children: /* @__PURE__ */ a(
|
|
157
|
+
n.Alert,
|
|
158
|
+
{
|
|
159
|
+
status: "info",
|
|
160
|
+
label: e("previewAlert.title", "Pay Schedule Preview"),
|
|
161
|
+
children: /* @__PURE__ */ a(n.Text, { children: e(
|
|
162
|
+
"previewAlert.description",
|
|
163
|
+
"Complete all the required fields on the left to see a preview of your pay schedule."
|
|
164
|
+
) })
|
|
165
|
+
}
|
|
166
|
+
) }) })
|
|
167
|
+
] }) }),
|
|
168
|
+
/* @__PURE__ */ s(L, { children: [
|
|
169
|
+
/* @__PURE__ */ a(
|
|
170
|
+
n.Button,
|
|
171
|
+
{
|
|
172
|
+
variant: "secondary",
|
|
173
|
+
onClick: () => {
|
|
174
|
+
d(u.CANCEL);
|
|
175
|
+
},
|
|
176
|
+
children: e("actions.cancel")
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
/* @__PURE__ */ a(n.Button, { type: "submit", isLoading: r.status.isPending, children: e("actions.save") })
|
|
180
|
+
] })
|
|
181
|
+
] }) }) }) });
|
|
182
|
+
}
|
|
183
|
+
export {
|
|
184
|
+
z as PayScheduleForm
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=PayScheduleForm.js.map
|