@gusto/embedded-react-sdk 0.10.6-rc.2 → 0.10.7
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 +7 -0
- package/dist/components/Base/Base.js +19 -18
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureForm.js +6 -4
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +7 -6
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +8 -7
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/TaxInputs/TaxInputs.d.ts +5 -1
- package/dist/components/Common/TaxInputs/TaxInputs.js +64 -56
- package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +13 -11
- package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -0
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +3 -2
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +10 -9
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +8 -7
- package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +9 -8
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +8 -7
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -4
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +17 -15
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +9 -7
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +17 -15
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Form.js +3 -2
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +1 -1
- package/dist/components/Company/Industry/Actions.js +1 -1
- package/dist/components/Company/Industry/Context.js +1 -1
- package/dist/components/Company/Industry/Edit.js +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +5 -4
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +9 -7
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +11 -9
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +1 -1
- package/dist/components/Company/OnboardingOverview/Completed.js +6 -5
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +3 -2
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +4 -2
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +18 -16
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +26 -25
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Head.js +3 -2
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +6 -5
- package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxes.js +23 -44
- package/dist/components/Company/StateTaxes/StateTaxes.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesComponents.d.ts +6 -8
- package/dist/components/Company/StateTaxes/StateTaxesComponents.js +15 -16
- package/dist/components/Company/StateTaxes/StateTaxesComponents.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +65 -59
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +1 -1
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.d.ts +5 -0
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js +48 -0
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +1 -0
- package/dist/components/Contractor/Address/Address.js +2 -0
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +7 -6
- package/dist/components/Contractor/Address/Form.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +1 -1
- package/dist/components/Contractor/List/index.js +3 -2
- package/dist/components/Contractor/List/index.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +17 -16
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +3 -2
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +3 -2
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Employee/Compensation/Actions.js +6 -5
- package/dist/components/Employee/Compensation/Actions.js.map +1 -1
- package/dist/components/Employee/Compensation/Edit.js +3 -2
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Compensation/List.js +1 -1
- package/dist/components/Employee/Deductions/Actions.js +1 -1
- package/dist/components/Employee/Deductions/DeductionForm.js +1 -1
- package/dist/components/Employee/Deductions/DeductionsList.js +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductionsForm.js +1 -1
- package/dist/components/Employee/Deductions/useDeductions.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +12 -10
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js +3 -2
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +10 -8
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +4 -2
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Head.js +3 -2
- package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +15 -14
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +1 -1
- package/dist/components/Employee/Landing/Landing.js +7 -6
- package/dist/components/Employee/Landing/Landing.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Actions.js +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +3 -2
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +3 -2
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +4 -3
- package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +1 -1
- package/dist/components/Employee/Profile/Actions.js +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +10 -9
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.js +5 -4
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +1 -1
- package/dist/components/Employee/Profile/useProfile.js +1 -1
- package/dist/components/Employee/Taxes/Actions.js +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +1 -1
- package/dist/i18n/en/Company.StateTaxes.json.js +2 -1
- package/dist/i18n/en/Company.StateTaxes.json.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +1 -0
- package/package.json +2 -2
- package/dist/components/Company/StateTaxes/stateTaxesReducer.d.ts +0 -20
- package/dist/components/Company/StateTaxes/stateTaxesReducer.js +0 -40
- package/dist/components/Company/StateTaxes/stateTaxesReducer.js.map +0 -1
|
@@ -8,9 +8,9 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
8
8
|
import "@tanstack/react-query";
|
|
9
9
|
import "../../../Base/useBase.js";
|
|
10
10
|
import "../../../../shared/constants.js";
|
|
11
|
+
import "classnames";
|
|
11
12
|
import "dompurify";
|
|
12
13
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
|
-
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
14
14
|
import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
|
|
15
15
|
const [c, d] = o("SignatureFormContext");
|
|
16
16
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as r } from "react-i18next";
|
|
3
3
|
import { useEmployeeList as m } from "./useEmployeeList.js";
|
|
4
|
-
import "
|
|
4
|
+
import "classnames";
|
|
5
5
|
import { ActionsLayout as s } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
6
6
|
import { useComponentContext as p } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
7
7
|
function C() {
|
|
@@ -8,6 +8,8 @@ import { Actions as h } from "./Actions.js";
|
|
|
8
8
|
import { BaseComponent as H } from "../../Base/Base.js";
|
|
9
9
|
import { useBase as j } from "../../Base/useBase.js";
|
|
10
10
|
import { Flex as k } from "../../Common/Flex/Flex.js";
|
|
11
|
+
import "react-i18next";
|
|
12
|
+
import "classnames";
|
|
11
13
|
import { useI18n as V, useComponentDictionary as z } from "../../../i18n/I18n.js";
|
|
12
14
|
import { componentEvents as s, EmployeeOnboardingStatus as l } from "../../../shared/constants.js";
|
|
13
15
|
import { Head as P } from "./Head.js";
|
|
@@ -95,12 +97,12 @@ function K({ companyId: n, className: E, children: p, dictionary: g }) {
|
|
|
95
97
|
m.Head = P;
|
|
96
98
|
m.List = O;
|
|
97
99
|
m.Actions = h;
|
|
98
|
-
const
|
|
100
|
+
const he = () => {
|
|
99
101
|
const { companyId: n, onEvent: E } = J();
|
|
100
102
|
return /* @__PURE__ */ o(m, { companyId: n, onEvent: E });
|
|
101
103
|
};
|
|
102
104
|
export {
|
|
103
105
|
m as EmployeeList,
|
|
104
|
-
|
|
106
|
+
he as EmployeeListContextual
|
|
105
107
|
};
|
|
106
108
|
//# sourceMappingURL=EmployeeList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmployeeList.js","sources":["../../../../src/components/Employee/EmployeeList/EmployeeList.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'\nimport type { OnboardingStatus } from '@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus'\nimport { useEmployeesDeleteMutation } from '@gusto/embedded-api/react-query/employeesDelete'\nimport { useEmployeesUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport { EmployeeListProvider } from './useEmployeeList'\nimport { Actions } from './Actions'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { Flex } from '@/components/Common'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { componentEvents, EmployeeOnboardingStatus } from '@/shared/constants'\nimport { Head } from '@/components/Employee/EmployeeList/Head'\nimport { List } from '@/components/Employee/EmployeeList/List'\nimport { useFlow } from '@/components/Flow/useFlow'\n\n//Interface for component specific props\ninterface EmployeeListProps extends CommonComponentInterface<'Employee.EmployeeList'> {\n companyId: string\n}\n\nexport function EmployeeList(props: EmployeeListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\nfunction Root({ companyId, className, children, dictionary }: EmployeeListProps) {\n //Using i18n hook to directly load necessary namespace\n useI18n('Employee.EmployeeList')\n useComponentDictionary('Employee.EmployeeList', dictionary)\n //Getting props from base context\n const { onEvent, baseSubmitHandler } = useBase()\n const [currentPage, setCurrentPage] = useState(1)\n const [itemsPerPage, setItemsPerPage] = useState(5)\n\n const { data } = useEmployeesListSuspense({ companyId, page: currentPage, per: itemsPerPage })\n const { httpMeta, showEmployees: employeeList } = data\n const employees = employeeList!\n\n const { mutateAsync: deleteEmployeeMutation } = useEmployeesDeleteMutation()\n const { mutateAsync: updateEmployeeOnboardingStatusMutation } =\n useEmployeesUpdateOnboardingStatusMutation()\n\n const totalPages = Number(httpMeta.response.headers.get('x-total-pages') ?? 1)\n\n const handleItemsPerPageChange = (newCount: number) => {\n setItemsPerPage(newCount)\n }\n const handleFirstPage = () => {\n setCurrentPage(1)\n }\n const handlePreviousPage = () => {\n setCurrentPage(prevPage => Math.max(prevPage - 1, 1))\n }\n const handleNextPage = () => {\n setCurrentPage(prevPage => Math.min(prevPage + 1, totalPages))\n }\n const handleLastPage = () => {\n setCurrentPage(totalPages)\n }\n const handleDelete = async (uuid: string) => {\n await baseSubmitHandler(uuid, async payload => {\n await deleteEmployeeMutation({\n request: { employeeId: payload },\n })\n\n onEvent(componentEvents.EMPLOYEE_DELETED, { employeeId: payload })\n })\n }\n /**Set onboarding status to self_onboarding_awaiting_admin_review and proceed to edit */\n const handleReview = async (data: string) => {\n await baseSubmitHandler(data, async employeeId => {\n await updateOnboardingStatus({\n employeeId,\n status: EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW,\n })\n onEvent(componentEvents.EMPLOYEE_UPDATE, {\n employeeId,\n onboardingStatus: EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW,\n })\n })\n }\n /**Update employee onboarding status reverting it back to admin_onboarding_incomplete */\n const handleCancelSelfOnboarding = async (data: string) => {\n await baseSubmitHandler(data, async employeeId => {\n await updateOnboardingStatus({\n employeeId,\n status: EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE,\n })\n })\n }\n const updateOnboardingStatus = async (data: { employeeId: string; status: OnboardingStatus }) => {\n await baseSubmitHandler(data, async ({ employeeId, status }) => {\n const { employeeOnboardingStatus: responseData } =\n await updateEmployeeOnboardingStatusMutation({\n request: { employeeId, requestBody: { onboardingStatus: status } },\n })\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_STATUS_UPDATED, responseData)\n })\n }\n const handleNew = () => {\n onEvent(componentEvents.EMPLOYEE_CREATE)\n }\n const handleSkip = () => {\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_DONE)\n }\n\n const handleEdit = (uuid: string, onboardingStatus?: OnboardingStatus) => {\n onEvent(componentEvents.EMPLOYEE_UPDATE, { employeeId: uuid, onboardingStatus })\n }\n return (\n <section className={className}>\n <EmployeeListProvider\n value={{\n handleEdit,\n handleNew,\n handleReview,\n handleDelete,\n employees,\n currentPage,\n totalPages,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleCancelSelfOnboarding,\n handleItemsPerPageChange,\n handleSkip,\n }}\n >\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Actions />\n </Flex>\n )}\n </EmployeeListProvider>\n </section>\n )\n}\n\nEmployeeList.Head = Head\nEmployeeList.List = List\nEmployeeList.Actions = Actions\n\n/**\n * Wrapper used inside Flows -> exposes flow context for required parameters\n */\nexport const EmployeeListContextual = () => {\n const { companyId, onEvent } = useFlow<OnboardingContextInterface>()\n return <EmployeeList companyId={companyId} onEvent={onEvent} />\n}\n"],"names":["EmployeeList","props","jsx","BaseComponent","Root","companyId","className","children","dictionary","useI18n","useComponentDictionary","onEvent","baseSubmitHandler","useBase","currentPage","setCurrentPage","useState","itemsPerPage","setItemsPerPage","data","useEmployeesListSuspense","httpMeta","employeeList","employees","deleteEmployeeMutation","useEmployeesDeleteMutation","updateEmployeeOnboardingStatusMutation","useEmployeesUpdateOnboardingStatusMutation","totalPages","handleItemsPerPageChange","newCount","handleFirstPage","handlePreviousPage","prevPage","handleNextPage","handleLastPage","handleDelete","uuid","payload","componentEvents","handleReview","employeeId","updateOnboardingStatus","EmployeeOnboardingStatus","handleCancelSelfOnboarding","status","responseData","EmployeeListProvider","onboardingStatus","jsxs","Flex","Head","List","Actions","EmployeeListContextual","useFlow"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmployeeList.js","sources":["../../../../src/components/Employee/EmployeeList/EmployeeList.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'\nimport type { OnboardingStatus } from '@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus'\nimport { useEmployeesDeleteMutation } from '@gusto/embedded-api/react-query/employeesDelete'\nimport { useEmployeesUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport { EmployeeListProvider } from './useEmployeeList'\nimport { Actions } from './Actions'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { Flex } from '@/components/Common'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { componentEvents, EmployeeOnboardingStatus } from '@/shared/constants'\nimport { Head } from '@/components/Employee/EmployeeList/Head'\nimport { List } from '@/components/Employee/EmployeeList/List'\nimport { useFlow } from '@/components/Flow/useFlow'\n\n//Interface for component specific props\ninterface EmployeeListProps extends CommonComponentInterface<'Employee.EmployeeList'> {\n companyId: string\n}\n\nexport function EmployeeList(props: EmployeeListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\nfunction Root({ companyId, className, children, dictionary }: EmployeeListProps) {\n //Using i18n hook to directly load necessary namespace\n useI18n('Employee.EmployeeList')\n useComponentDictionary('Employee.EmployeeList', dictionary)\n //Getting props from base context\n const { onEvent, baseSubmitHandler } = useBase()\n const [currentPage, setCurrentPage] = useState(1)\n const [itemsPerPage, setItemsPerPage] = useState(5)\n\n const { data } = useEmployeesListSuspense({ companyId, page: currentPage, per: itemsPerPage })\n const { httpMeta, showEmployees: employeeList } = data\n const employees = employeeList!\n\n const { mutateAsync: deleteEmployeeMutation } = useEmployeesDeleteMutation()\n const { mutateAsync: updateEmployeeOnboardingStatusMutation } =\n useEmployeesUpdateOnboardingStatusMutation()\n\n const totalPages = Number(httpMeta.response.headers.get('x-total-pages') ?? 1)\n\n const handleItemsPerPageChange = (newCount: number) => {\n setItemsPerPage(newCount)\n }\n const handleFirstPage = () => {\n setCurrentPage(1)\n }\n const handlePreviousPage = () => {\n setCurrentPage(prevPage => Math.max(prevPage - 1, 1))\n }\n const handleNextPage = () => {\n setCurrentPage(prevPage => Math.min(prevPage + 1, totalPages))\n }\n const handleLastPage = () => {\n setCurrentPage(totalPages)\n }\n const handleDelete = async (uuid: string) => {\n await baseSubmitHandler(uuid, async payload => {\n await deleteEmployeeMutation({\n request: { employeeId: payload },\n })\n\n onEvent(componentEvents.EMPLOYEE_DELETED, { employeeId: payload })\n })\n }\n /**Set onboarding status to self_onboarding_awaiting_admin_review and proceed to edit */\n const handleReview = async (data: string) => {\n await baseSubmitHandler(data, async employeeId => {\n await updateOnboardingStatus({\n employeeId,\n status: EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW,\n })\n onEvent(componentEvents.EMPLOYEE_UPDATE, {\n employeeId,\n onboardingStatus: EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW,\n })\n })\n }\n /**Update employee onboarding status reverting it back to admin_onboarding_incomplete */\n const handleCancelSelfOnboarding = async (data: string) => {\n await baseSubmitHandler(data, async employeeId => {\n await updateOnboardingStatus({\n employeeId,\n status: EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE,\n })\n })\n }\n const updateOnboardingStatus = async (data: { employeeId: string; status: OnboardingStatus }) => {\n await baseSubmitHandler(data, async ({ employeeId, status }) => {\n const { employeeOnboardingStatus: responseData } =\n await updateEmployeeOnboardingStatusMutation({\n request: { employeeId, requestBody: { onboardingStatus: status } },\n })\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_STATUS_UPDATED, responseData)\n })\n }\n const handleNew = () => {\n onEvent(componentEvents.EMPLOYEE_CREATE)\n }\n const handleSkip = () => {\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_DONE)\n }\n\n const handleEdit = (uuid: string, onboardingStatus?: OnboardingStatus) => {\n onEvent(componentEvents.EMPLOYEE_UPDATE, { employeeId: uuid, onboardingStatus })\n }\n return (\n <section className={className}>\n <EmployeeListProvider\n value={{\n handleEdit,\n handleNew,\n handleReview,\n handleDelete,\n employees,\n currentPage,\n totalPages,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleCancelSelfOnboarding,\n handleItemsPerPageChange,\n handleSkip,\n }}\n >\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Actions />\n </Flex>\n )}\n </EmployeeListProvider>\n </section>\n )\n}\n\nEmployeeList.Head = Head\nEmployeeList.List = List\nEmployeeList.Actions = Actions\n\n/**\n * Wrapper used inside Flows -> exposes flow context for required parameters\n */\nexport const EmployeeListContextual = () => {\n const { companyId, onEvent } = useFlow<OnboardingContextInterface>()\n return <EmployeeList companyId={companyId} onEvent={onEvent} />\n}\n"],"names":["EmployeeList","props","jsx","BaseComponent","Root","companyId","className","children","dictionary","useI18n","useComponentDictionary","onEvent","baseSubmitHandler","useBase","currentPage","setCurrentPage","useState","itemsPerPage","setItemsPerPage","data","useEmployeesListSuspense","httpMeta","employeeList","employees","deleteEmployeeMutation","useEmployeesDeleteMutation","updateEmployeeOnboardingStatusMutation","useEmployeesUpdateOnboardingStatusMutation","totalPages","handleItemsPerPageChange","newCount","handleFirstPage","handlePreviousPage","prevPage","handleNextPage","handleLastPage","handleDelete","uuid","payload","componentEvents","handleReview","employeeId","updateOnboardingStatus","EmployeeOnboardingStatus","handleCancelSelfOnboarding","status","responseData","EmployeeListProvider","onboardingStatus","jsxs","Flex","Head","List","Actions","EmployeeListContextual","useFlow"],"mappings":";;;;;;;;;;;;;;;;;AA0BO,SAASA,EAAaC,GAAmD;AAE5E,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AACA,SAASG,EAAK,EAAE,WA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BAAAf;AAAA,QACA,YAxBW,MAAM;AACvB,UAAAlB,EAAQ4B,EAAgB,wBAAwB;AAAA,QAClD;AAAA,MAuBM;AAAA,MAEC,UACChC,KAEC,gBAAA0C,EAAAC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAAhD,EAACiD,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,EACX,CAAA;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;AAEArD,EAAa,OAAOmD;AACpBnD,EAAa,OAAOoD;AACpBpD,EAAa,UAAUqD;AAKhB,MAAMC,KAAyB,MAAM;AAC1C,QAAM,EAAE,WAAAjD,GAAW,SAAAM,EAAQ,IAAI4C,EAAoC;AAC5D,SAAA,gBAAArD,EAACF,GAAa,EAAA,WAAAK,GAAsB,SAAAM,EAAkB,CAAA;AAC/D;"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as n } from "react-i18next";
|
|
3
3
|
import { Flex as r } from "../../Common/Flex/Flex.js";
|
|
4
|
+
import "classnames";
|
|
4
5
|
import { useComponentContext as m } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
5
|
-
const
|
|
6
|
+
const c = () => {
|
|
6
7
|
const { t } = n("Employee.EmployeeList"), o = m();
|
|
7
8
|
return /* @__PURE__ */ e(r, { justifyContent: "space-between", alignItems: "center", children: /* @__PURE__ */ e(o.Heading, { as: "h2", children: t("title") }) });
|
|
8
9
|
};
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
+
c as Head
|
|
11
12
|
};
|
|
12
13
|
//# sourceMappingURL=Head.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Head.js","sources":["../../../../src/components/Employee/EmployeeList/Head.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n// Head slot for EmployeeList component\nexport const Head = () => {\n const { t } = useTranslation('Employee.EmployeeList')\n const Components = useComponentContext()\n\n return (\n <Flex justifyContent=\"space-between\" alignItems=\"center\">\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n </Flex>\n )\n}\n"],"names":["Head","useTranslation","Components","useComponentContext","jsx","Flex"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Head.js","sources":["../../../../src/components/Employee/EmployeeList/Head.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n// Head slot for EmployeeList component\nexport const Head = () => {\n const { t } = useTranslation('Employee.EmployeeList')\n const Components = useComponentContext()\n\n return (\n <Flex justifyContent=\"space-between\" alignItems=\"center\">\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n </Flex>\n )\n}\n"],"names":["Head","useTranslation","Components","useComponentContext","jsx","Flex"],"mappings":";;;;;AAKO,MAAMA,IAAO,MAAM;AACxB,QAAM,EAAE,EAAA,IAAMC,EAAe,uBAAuB,GAC9CC,IAAaC,EAAoB;AAEvC,SACG,gBAAAC,EAAAC,GAAA,EAAK,gBAAe,iBAAgB,YAAW,UAC9C,UAAA,gBAAAD,EAACF,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAE,EAAA,OAAO,EAAE,CAAA,GAC1C;AAEJ;"}
|
|
@@ -3,18 +3,19 @@ import { useTranslation as A } from "react-i18next";
|
|
|
3
3
|
import { useState as T } from "react";
|
|
4
4
|
import k from "./List.module.scss.js";
|
|
5
5
|
import { useEmployeeList as w } from "./useEmployeeList.js";
|
|
6
|
-
import
|
|
7
|
-
import { EmptyData as
|
|
6
|
+
import "classnames";
|
|
7
|
+
import { EmptyData as B } from "../../Common/EmptyData/EmptyData.js";
|
|
8
8
|
import { ActionsLayout as h } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
9
|
-
import { useComponentContext as
|
|
10
|
-
import { HamburgerMenu as
|
|
11
|
-
import { EmployeeOnboardingStatusBadge as
|
|
9
|
+
import { useComponentContext as M } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
|
+
import { HamburgerMenu as y } from "../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
11
|
+
import { EmployeeOnboardingStatusBadge as G } from "../../Common/OnboardingStatusBadge/index.js";
|
|
12
12
|
import s from "../../../assets/icons/pencil.svg.js";
|
|
13
|
-
import
|
|
13
|
+
import R from "../../../assets/icons/trashcan.svg.js";
|
|
14
|
+
import { EmployeeOnboardingStatus as i, EmployeeSelfOnboardingStatuses as x } from "../../../shared/constants.js";
|
|
14
15
|
import { firstLastName as F } from "../../../helpers/formattedStrings.js";
|
|
15
16
|
import { useDataView as V } from "../../Common/DataView/useDataView.js";
|
|
16
17
|
import { DataView as j } from "../../Common/DataView/DataView.js";
|
|
17
|
-
const
|
|
18
|
+
const rt = () => {
|
|
18
19
|
const {
|
|
19
20
|
handleDelete: g,
|
|
20
21
|
employees: d,
|
|
@@ -30,7 +31,7 @@ const it = () => {
|
|
|
30
31
|
currentPage: O,
|
|
31
32
|
totalPages: _,
|
|
32
33
|
handleSkip: D
|
|
33
|
-
} = w(), r =
|
|
34
|
+
} = w(), r = M(), { t: a } = A("Employee.EmployeeList"), [I, u] = T(/* @__PURE__ */ new Set()), { ...P } = V({
|
|
34
35
|
data: d,
|
|
35
36
|
columns: [
|
|
36
37
|
{
|
|
@@ -45,7 +46,7 @@ const it = () => {
|
|
|
45
46
|
key: "status",
|
|
46
47
|
title: a("statusLabel"),
|
|
47
48
|
render: ({ onboarded: t, onboardingStatus: n }) => /* @__PURE__ */ e(
|
|
48
|
-
|
|
49
|
+
G,
|
|
49
50
|
{
|
|
50
51
|
onboarded: t,
|
|
51
52
|
onboardingStatus: n
|
|
@@ -61,7 +62,7 @@ const it = () => {
|
|
|
61
62
|
p(t.uuid, t.onboardingStatus ?? void 0);
|
|
62
63
|
},
|
|
63
64
|
icon: /* @__PURE__ */ e(s, { "aria-hidden": !0 })
|
|
64
|
-
}),
|
|
65
|
+
}), x.has(t.onboarding_status ?? "") && n.push({
|
|
65
66
|
label: a("cancelSelfOnboardingCta"),
|
|
66
67
|
onClick: async () => {
|
|
67
68
|
await b(t.uuid);
|
|
@@ -83,9 +84,9 @@ const it = () => {
|
|
|
83
84
|
});
|
|
84
85
|
});
|
|
85
86
|
},
|
|
86
|
-
icon: /* @__PURE__ */ e(
|
|
87
|
+
icon: /* @__PURE__ */ e(R, { "aria-hidden": !0 })
|
|
87
88
|
}), /* @__PURE__ */ e(
|
|
88
|
-
|
|
89
|
+
y,
|
|
89
90
|
{
|
|
90
91
|
items: n,
|
|
91
92
|
triggerLabel: a("hamburgerTitle"),
|
|
@@ -102,7 +103,7 @@ const it = () => {
|
|
|
102
103
|
currentPage: O,
|
|
103
104
|
totalPages: _
|
|
104
105
|
},
|
|
105
|
-
emptyState: () => /* @__PURE__ */ e(
|
|
106
|
+
emptyState: () => /* @__PURE__ */ e(B, { title: a("emptyTableTitle"), description: a("emptyTableDescription"), children: /* @__PURE__ */ c(h, { justifyContent: "center", children: [
|
|
106
107
|
/* @__PURE__ */ e(r.Button, { variant: "secondary", onClick: D, children: a("skipCta") }),
|
|
107
108
|
/* @__PURE__ */ e(r.Button, { variant: "primary", onClick: l, children: a("addEmployeeCTA") })
|
|
108
109
|
] }) })
|
|
@@ -113,6 +114,6 @@ const it = () => {
|
|
|
113
114
|
] });
|
|
114
115
|
};
|
|
115
116
|
export {
|
|
116
|
-
|
|
117
|
+
rt as List
|
|
117
118
|
};
|
|
118
119
|
//# sourceMappingURL=List.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sources":["../../../../src/components/Employee/EmployeeList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useState } from 'react'\nimport style from './List.module.scss'\nimport { useEmployeeList } from './useEmployeeList'\nimport { DataView, EmptyData, ActionsLayout, useDataView } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { EmployeeOnboardingStatusBadge } from '@/components/Common/OnboardingStatusBadge'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { EmployeeOnboardingStatus, EmployeeSelfOnboardingStatuses } from '@/shared/constants'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\n/**List of employees slot for EmployeeList component */\nexport const List = () => {\n const {\n handleDelete,\n employees,\n handleEdit,\n handleReview,\n handleNew,\n handleCancelSelfOnboarding,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n handleSkip,\n } = useEmployeeList()\n const Components = useComponentContext()\n\n const { t } = useTranslation('Employee.EmployeeList')\n const [deleting, setDeleting] = useState<Set<string>>(new Set())\n const { ...dataViewProps } = useDataView({\n data: employees,\n columns: [\n {\n key: 'name',\n title: t('nameLabel'),\n render: employee => {\n return firstLastName({\n first_name: employee.firstName,\n last_name: employee.lastName,\n })\n },\n },\n {\n key: 'status',\n title: t('statusLabel'),\n render: ({ onboarded, onboardingStatus }) => (\n <EmployeeOnboardingStatusBadge\n onboarded={onboarded}\n onboardingStatus={onboardingStatus}\n />\n ),\n },\n ],\n itemMenu: employee => {\n const menuItems = []\n\n // Edit item\n if (\n employee.onboardingStatus === EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE ||\n employee.onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE ||\n employee.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW ||\n employee.onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED\n ) {\n menuItems.push({\n label: t('editCta'),\n onClick: () => {\n handleEdit(employee.uuid, employee.onboardingStatus ?? undefined)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Cancel self onboarding item\n /* @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses */\n if (EmployeeSelfOnboardingStatuses.has(employee.onboarding_status ?? '')) {\n menuItems.push({\n label: t('cancelSelfOnboardingCta'),\n onClick: async () => {\n await handleCancelSelfOnboarding(employee.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Review item\n if (\n employee.onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_COMPLETED_BY_EMPLOYEE\n ) {\n menuItems.push({\n label: t('reviewCta'),\n onClick: () => {\n void handleReview(employee.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Delete item\n if (!employee.onboarded) {\n menuItems.push({\n label: t('deleteCta'),\n onClick: () => {\n setDeleting(prev => new Set(prev).add(employee.uuid))\n void handleDelete(employee.uuid).then(() => {\n setDeleting(prev => {\n const newSet = new Set(prev)\n newSet.delete(employee.uuid)\n return newSet\n })\n })\n },\n icon: <TrashCanSvg aria-hidden />,\n })\n }\n\n return (\n <HamburgerMenu\n items={menuItems}\n triggerLabel={t('hamburgerTitle')}\n isLoading={deleting.has(employee.uuid)}\n />\n )\n },\n pagination: {\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n },\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <ActionsLayout justifyContent=\"center\">\n <Components.Button variant=\"secondary\" onClick={handleSkip}>\n {t('skipCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" onClick={handleNew}>\n {t('addEmployeeCTA')}\n </Components.Button>\n </ActionsLayout>\n </EmptyData>\n ),\n })\n return (\n <>\n {employees.length > 0 && (\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleNew}>\n {t('addAnotherCta')}\n </Components.Button>\n </ActionsLayout>\n )}\n <div className={style.container}>\n <DataView label={t('employeeListLabel')} {...dataViewProps} />\n </div>\n </>\n )\n}\n"],"names":["List","handleDelete","employees","handleEdit","handleReview","handleNew","handleCancelSelfOnboarding","handleFirstPage","handlePreviousPage","handleNextPage","handleLastPage","handleItemsPerPageChange","currentPage","totalPages","handleSkip","useEmployeeList","Components","useComponentContext","t","useTranslation","deleting","setDeleting","useState","dataViewProps","useDataView","employee","firstLastName","onboarded","onboardingStatus","jsx","EmployeeOnboardingStatusBadge","menuItems","EmployeeOnboardingStatus","PencilSvg","EmployeeSelfOnboardingStatuses","prev","newSet","TrashCanSvg","HamburgerMenu","EmptyData","jsxs","ActionsLayout","Fragment","style","DataView"],"mappings":"
|
|
1
|
+
{"version":3,"file":"List.js","sources":["../../../../src/components/Employee/EmployeeList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useState } from 'react'\nimport style from './List.module.scss'\nimport { useEmployeeList } from './useEmployeeList'\nimport { DataView, EmptyData, ActionsLayout, useDataView } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { EmployeeOnboardingStatusBadge } from '@/components/Common/OnboardingStatusBadge'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { EmployeeOnboardingStatus, EmployeeSelfOnboardingStatuses } from '@/shared/constants'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\n/**List of employees slot for EmployeeList component */\nexport const List = () => {\n const {\n handleDelete,\n employees,\n handleEdit,\n handleReview,\n handleNew,\n handleCancelSelfOnboarding,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n handleSkip,\n } = useEmployeeList()\n const Components = useComponentContext()\n\n const { t } = useTranslation('Employee.EmployeeList')\n const [deleting, setDeleting] = useState<Set<string>>(new Set())\n const { ...dataViewProps } = useDataView({\n data: employees,\n columns: [\n {\n key: 'name',\n title: t('nameLabel'),\n render: employee => {\n return firstLastName({\n first_name: employee.firstName,\n last_name: employee.lastName,\n })\n },\n },\n {\n key: 'status',\n title: t('statusLabel'),\n render: ({ onboarded, onboardingStatus }) => (\n <EmployeeOnboardingStatusBadge\n onboarded={onboarded}\n onboardingStatus={onboardingStatus}\n />\n ),\n },\n ],\n itemMenu: employee => {\n const menuItems = []\n\n // Edit item\n if (\n employee.onboardingStatus === EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE ||\n employee.onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE ||\n employee.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW ||\n employee.onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED\n ) {\n menuItems.push({\n label: t('editCta'),\n onClick: () => {\n handleEdit(employee.uuid, employee.onboardingStatus ?? undefined)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Cancel self onboarding item\n /* @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses */\n if (EmployeeSelfOnboardingStatuses.has(employee.onboarding_status ?? '')) {\n menuItems.push({\n label: t('cancelSelfOnboardingCta'),\n onClick: async () => {\n await handleCancelSelfOnboarding(employee.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Review item\n if (\n employee.onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_COMPLETED_BY_EMPLOYEE\n ) {\n menuItems.push({\n label: t('reviewCta'),\n onClick: () => {\n void handleReview(employee.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Delete item\n if (!employee.onboarded) {\n menuItems.push({\n label: t('deleteCta'),\n onClick: () => {\n setDeleting(prev => new Set(prev).add(employee.uuid))\n void handleDelete(employee.uuid).then(() => {\n setDeleting(prev => {\n const newSet = new Set(prev)\n newSet.delete(employee.uuid)\n return newSet\n })\n })\n },\n icon: <TrashCanSvg aria-hidden />,\n })\n }\n\n return (\n <HamburgerMenu\n items={menuItems}\n triggerLabel={t('hamburgerTitle')}\n isLoading={deleting.has(employee.uuid)}\n />\n )\n },\n pagination: {\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n },\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <ActionsLayout justifyContent=\"center\">\n <Components.Button variant=\"secondary\" onClick={handleSkip}>\n {t('skipCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" onClick={handleNew}>\n {t('addEmployeeCTA')}\n </Components.Button>\n </ActionsLayout>\n </EmptyData>\n ),\n })\n return (\n <>\n {employees.length > 0 && (\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleNew}>\n {t('addAnotherCta')}\n </Components.Button>\n </ActionsLayout>\n )}\n <div className={style.container}>\n <DataView label={t('employeeListLabel')} {...dataViewProps} />\n </div>\n </>\n )\n}\n"],"names":["List","handleDelete","employees","handleEdit","handleReview","handleNew","handleCancelSelfOnboarding","handleFirstPage","handlePreviousPage","handleNextPage","handleLastPage","handleItemsPerPageChange","currentPage","totalPages","handleSkip","useEmployeeList","Components","useComponentContext","t","useTranslation","deleting","setDeleting","useState","dataViewProps","useDataView","employee","firstLastName","onboarded","onboardingStatus","jsx","EmployeeOnboardingStatusBadge","menuItems","EmployeeOnboardingStatus","PencilSvg","EmployeeSelfOnboardingStatuses","prev","newSet","TrashCanSvg","HamburgerMenu","EmptyData","jsxs","ActionsLayout","Fragment","style","DataView"],"mappings":";;;;;;;;;;;;;;;;;AAcO,MAAMA,KAAO,MAAM;AAClB,QAAA;AAAA,IACJ,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,4BAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,gBAAAC;AAAA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BAAiB,GAAG,aAAaA,EAAE,uBAAuB,GAC5E,UAAC,gBAAAsB,EAAAC,GAAA,EAAc,gBAAe,UAC5B,UAAA;AAAA,MAAC,gBAAAZ,EAAAb,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASF,GAC7C,UAAEI,EAAA,SAAS,EACd,CAAA;AAAA,MACA,gBAAAW,EAACb,EAAW,QAAX,EAAkB,SAAQ,WAAU,SAASX,GAC3C,UAAEa,EAAA,gBAAgB,EACrB,CAAA;AAAA,IAAA,EAAA,CACF,EACF,CAAA;AAAA,EAAA,CAEH;AACD,SAEK,gBAAAsB,EAAAE,GAAA,EAAA,UAAA;AAAA,IAAAxC,EAAU,SAAS,KACjB,gBAAA2B,EAAAY,GAAA,EACC,4BAACzB,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASX,GAC7C,UAAEa,EAAA,eAAe,EACpB,CAAA,GACF;AAAA,IAED,gBAAAW,EAAA,OAAA,EAAI,WAAWc,EAAM,WACpB,UAAA,gBAAAd,EAACe,GAAS,EAAA,OAAO1B,EAAE,mBAAmB,GAAI,GAAGK,GAAe,EAC9D,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -8,9 +8,9 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
8
8
|
import "@tanstack/react-query";
|
|
9
9
|
import "../../Base/useBase.js";
|
|
10
10
|
import "../../../shared/constants.js";
|
|
11
|
+
import "classnames";
|
|
11
12
|
import "dompurify";
|
|
12
13
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
|
-
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
14
14
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
15
15
|
const [c, d] = o("EmployeeListContext");
|
|
16
16
|
export {
|
|
@@ -6,20 +6,21 @@ import s from "./Landing.module.scss.js";
|
|
|
6
6
|
import { BaseComponent as x } from "../../Base/Base.js";
|
|
7
7
|
import { useBase as y } from "../../Base/useBase.js";
|
|
8
8
|
import { Flex as r } from "../../Common/Flex/Flex.js";
|
|
9
|
+
import "classnames";
|
|
9
10
|
import { ActionsLayout as E } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
10
11
|
import { useComponentContext as C } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
12
|
import { useI18n as D, useComponentDictionary as I } from "../../../i18n/I18n.js";
|
|
12
13
|
import { componentEvents as S } from "../../../shared/constants.js";
|
|
13
|
-
function
|
|
14
|
+
function H(t) {
|
|
14
15
|
return D("Employee.Landing"), I("Employee.Landing", t.dictionary), /* @__PURE__ */ e(x, { ...t, children: /* @__PURE__ */ e(L, { ...t, children: t.children }) });
|
|
15
16
|
}
|
|
16
|
-
const L = ({ employeeId: t, companyId: c, className:
|
|
17
|
-
const { onEvent:
|
|
17
|
+
const L = ({ employeeId: t, companyId: c, className: m }) => {
|
|
18
|
+
const { onEvent: l } = y(), o = C(), {
|
|
18
19
|
data: { employee: a }
|
|
19
20
|
} = h({ employeeId: t }), p = a.firstName, {
|
|
20
21
|
data: { company: d }
|
|
21
22
|
} = g({ companyId: c }), f = d?.name, { t: n } = u("Employee.Landing");
|
|
22
|
-
return /* @__PURE__ */ e("section", { className:
|
|
23
|
+
return /* @__PURE__ */ e("section", { className: m, children: /* @__PURE__ */ i(r, { alignItems: "center", flexDirection: "column", gap: 32, children: [
|
|
23
24
|
/* @__PURE__ */ i(r, { alignItems: "center", flexDirection: "column", gap: 8, children: [
|
|
24
25
|
/* @__PURE__ */ e(o.Heading, { as: "h2", textAlign: "center", children: n("landingSubtitle", { firstName: p, companyName: f }) }),
|
|
25
26
|
/* @__PURE__ */ e(o.Text, { className: s.description, children: n("landingDescription") })
|
|
@@ -38,7 +39,7 @@ const L = ({ employeeId: t, companyId: c, className: l }) => {
|
|
|
38
39
|
{
|
|
39
40
|
variant: "secondary",
|
|
40
41
|
onClick: () => {
|
|
41
|
-
|
|
42
|
+
l(S.EMPLOYEE_SELF_ONBOARDING_START);
|
|
42
43
|
},
|
|
43
44
|
children: n("getStartedCta")
|
|
44
45
|
}
|
|
@@ -48,6 +49,6 @@ const L = ({ employeeId: t, companyId: c, className: l }) => {
|
|
|
48
49
|
] }) });
|
|
49
50
|
};
|
|
50
51
|
export {
|
|
51
|
-
|
|
52
|
+
H as Landing
|
|
52
53
|
};
|
|
53
54
|
//# sourceMappingURL=Landing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Landing.js","sources":["../../../../src/components/Employee/Landing/Landing.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useCompaniesGetSuspense } from '@gusto/embedded-api/react-query/companiesGet'\nimport styles from './Landing.module.scss'\nimport {\n BaseComponent,\n useBase,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { Flex, ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface SummaryProps extends CommonComponentInterface<'Employee.Landing'> {\n employeeId: string\n companyId: string\n}\n\nexport function Landing(props: SummaryProps & BaseComponentInterface) {\n useI18n('Employee.Landing')\n useComponentDictionary('Employee.Landing', props.dictionary)\n\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ employeeId, companyId, className }: SummaryProps) => {\n const { onEvent } = useBase()\n const Components = useComponentContext()\n\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n const firstName = employee!.firstName\n\n const {\n data: { company },\n } = useCompaniesGetSuspense({ companyId })\n const companyName = company?.name\n\n const { t } = useTranslation('Employee.Landing')\n\n return (\n <section className={className}>\n <Flex alignItems=\"center\" flexDirection=\"column\" gap={32}>\n <Flex alignItems=\"center\" flexDirection=\"column\" gap={8}>\n <Components.Heading as=\"h2\" textAlign=\"center\">\n {t('landingSubtitle', { firstName, companyName })}\n </Components.Heading>\n <Components.Text className={styles.description}>\n {t('landingDescription')}\n </Components.Text>\n </Flex>\n <Flex flexDirection=\"column\" gap={8}>\n <Components.Heading as=\"h3\">{t('stepsSubtitle')}</Components.Heading>\n <ul>\n <li>{t('steps.personalInfo')}</li>\n <li>{t('steps.taxInfo')}</li>\n <li>{t('steps.bankInfo')}</li>\n </ul>\n </Flex>\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={8}>\n <ActionsLayout justifyContent=\"center\">\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(componentEvents.EMPLOYEE_SELF_ONBOARDING_START)\n }}\n >\n {t('getStartedCta')}\n </Components.Button>\n </ActionsLayout>\n <Components.Text className={styles.description}>\n {t('getStartedDescription')}\n </Components.Text>\n </Flex>\n </Flex>\n </section>\n )\n}\n"],"names":["Landing","props","useI18n","useComponentDictionary","jsx","BaseComponent","Root","employeeId","companyId","className","onEvent","useBase","Components","useComponentContext","employee","useEmployeesGetSuspense","firstName","company","useCompaniesGetSuspense","companyName","t","useTranslation","jsxs","Flex","styles","ActionsLayout","componentEvents"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Landing.js","sources":["../../../../src/components/Employee/Landing/Landing.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useCompaniesGetSuspense } from '@gusto/embedded-api/react-query/companiesGet'\nimport styles from './Landing.module.scss'\nimport {\n BaseComponent,\n useBase,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { Flex, ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface SummaryProps extends CommonComponentInterface<'Employee.Landing'> {\n employeeId: string\n companyId: string\n}\n\nexport function Landing(props: SummaryProps & BaseComponentInterface) {\n useI18n('Employee.Landing')\n useComponentDictionary('Employee.Landing', props.dictionary)\n\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ employeeId, companyId, className }: SummaryProps) => {\n const { onEvent } = useBase()\n const Components = useComponentContext()\n\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n const firstName = employee!.firstName\n\n const {\n data: { company },\n } = useCompaniesGetSuspense({ companyId })\n const companyName = company?.name\n\n const { t } = useTranslation('Employee.Landing')\n\n return (\n <section className={className}>\n <Flex alignItems=\"center\" flexDirection=\"column\" gap={32}>\n <Flex alignItems=\"center\" flexDirection=\"column\" gap={8}>\n <Components.Heading as=\"h2\" textAlign=\"center\">\n {t('landingSubtitle', { firstName, companyName })}\n </Components.Heading>\n <Components.Text className={styles.description}>\n {t('landingDescription')}\n </Components.Text>\n </Flex>\n <Flex flexDirection=\"column\" gap={8}>\n <Components.Heading as=\"h3\">{t('stepsSubtitle')}</Components.Heading>\n <ul>\n <li>{t('steps.personalInfo')}</li>\n <li>{t('steps.taxInfo')}</li>\n <li>{t('steps.bankInfo')}</li>\n </ul>\n </Flex>\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={8}>\n <ActionsLayout justifyContent=\"center\">\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(componentEvents.EMPLOYEE_SELF_ONBOARDING_START)\n }}\n >\n {t('getStartedCta')}\n </Components.Button>\n </ActionsLayout>\n <Components.Text className={styles.description}>\n {t('getStartedDescription')}\n </Components.Text>\n </Flex>\n </Flex>\n </section>\n )\n}\n"],"names":["Landing","props","useI18n","useComponentDictionary","jsx","BaseComponent","Root","employeeId","companyId","className","onEvent","useBase","Components","useComponentContext","employee","useEmployeesGetSuspense","firstName","company","useCompaniesGetSuspense","companyName","t","useTranslation","jsxs","Flex","styles","ActionsLayout","compon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W,SAAX,EAAmB,IAAG,MAAM,UAAAQ,EAAE,eAAe,GAAE;AAAA,wBAC/C,MACC,EAAA,UAAA;AAAA,QAAC,gBAAAhB,EAAA,MAAA,EAAI,UAAEgB,EAAA,oBAAoB,EAAE,CAAA;AAAA,QAC5B,gBAAAhB,EAAA,MAAA,EAAI,UAAEgB,EAAA,eAAe,EAAE,CAAA;AAAA,QACvB,gBAAAhB,EAAA,MAAA,EAAI,UAAEgB,EAAA,gBAAgB,EAAE,CAAA;AAAA,MAAA,EAC3B,CAAA;AAAA,IAAA,GACF;AAAA,sBACCG,GAAK,EAAA,eAAc,UAAS,YAAW,UAAS,KAAK,GACpD,UAAA;AAAA,MAAC,gBAAAnB,EAAAqB,GAAA,EAAc,gBAAe,UAC5B,UAAA,gBAAArB;AAAA,QAACQ,EAAW;AAAA,QAAX;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,MAAM;AACb,YAAAF,EAAQgB,EAAgB,8BAA8B;AAAA,UACxD;AAAA,UAEC,YAAE,eAAe;AAAA,QAAA;AAAA,MAAA,GAEtB;AAAA,MACA,gBAAAtB,EAACQ,EAAW,MAAX,EAAgB,WAAWY,EAAO,aAChC,UAAEJ,EAAA,uBAAuB,EAC5B,CAAA;AAAA,IAAA,EACF,CAAA;AAAA,EAAA,EAAA,CACF,EACF,CAAA;AAEJ;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as m } from "react-i18next";
|
|
3
3
|
import { usePaymentMethod as l } from "./usePaymentMethod.js";
|
|
4
|
-
import "
|
|
4
|
+
import "classnames";
|
|
5
5
|
import { ActionsLayout as p } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
6
6
|
import { useComponentContext as u } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
7
7
|
const f = () => {
|
|
@@ -2,10 +2,11 @@ import { jsxs as i, Fragment as u, jsx as r } from "react/jsx-runtime";
|
|
|
2
2
|
import { useFormContext as m } from "react-hook-form";
|
|
3
3
|
import { useTranslation as c } from "react-i18next";
|
|
4
4
|
import { usePaymentMethod as s } from "./usePaymentMethod.js";
|
|
5
|
+
import "classnames";
|
|
5
6
|
import { PAYMENT_METHODS as l } from "../../../shared/constants.js";
|
|
6
7
|
import { TextInputField as o } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
7
8
|
import { RadioGroupField as p } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
8
|
-
const
|
|
9
|
+
const v = () => {
|
|
9
10
|
const { mode: a, watchedType: t } = s(), { t: e } = c("Employee.PaymentMethod"), { setValue: n } = m();
|
|
10
11
|
if (!(a !== "ADD" && a !== "INITIAL" || t === l.check))
|
|
11
12
|
return n("hasBankPayload", !0), /* @__PURE__ */ i(u, { children: [
|
|
@@ -51,6 +52,6 @@ const h = () => {
|
|
|
51
52
|
] });
|
|
52
53
|
};
|
|
53
54
|
export {
|
|
54
|
-
|
|
55
|
+
v as BankAccountForm
|
|
55
56
|
};
|
|
56
57
|
//# sourceMappingURL=BankAccountEdit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BankAccountEdit.js","sources":["../../../../src/components/Employee/PaymentMethod/BankAccountEdit.tsx"],"sourcesContent":["import { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport type { BankAccountInputs } from './BankAccount'\nimport { usePaymentMethod } from './usePaymentMethod'\nimport { RadioGroupField, TextInputField } from '@/components/Common'\nimport { PAYMENT_METHODS } from '@/shared/constants'\n\nexport const BankAccountForm = () => {\n const { mode, watchedType } = usePaymentMethod()\n const { t } = useTranslation('Employee.PaymentMethod')\n const { setValue } = useFormContext<BankAccountInputs>()\n\n if ((mode !== 'ADD' && mode !== 'INITIAL') || watchedType === PAYMENT_METHODS.check) {\n return\n }\n //Used by form schema to determine variant\n setValue('hasBankPayload', true)\n\n return (\n <>\n <TextInputField\n name=\"name\"\n isRequired\n label={t('nameLabel')}\n errorMessage={t('validations.accountName')}\n />\n\n <TextInputField\n name=\"routingNumber\"\n label={t('routingNumberLabel')}\n isRequired\n description={t('routingNumberDescription')}\n errorMessage={t('validations.routingNumber')}\n />\n\n <TextInputField\n name=\"accountNumber\"\n label={t('accountNumberLabel')}\n errorMessage={t('validations.accountNumber')}\n isRequired\n />\n\n <RadioGroupField\n name=\"accountType\"\n label={t('accountTypeLabel')}\n options={[\n { value: 'Checking', label: t('accountTypeChecking') },\n { value: 'Savings', label: t('accountTypeSavings') },\n ]}\n />\n </>\n )\n}\n"],"names":["BankAccountForm","mode","watchedType","usePaymentMethod","t","useTranslation","setValue","useFormContext","PAYMENT_METHODS","jsxs","Fragment","jsx","TextInputField","RadioGroupField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BankAccountEdit.js","sources":["../../../../src/components/Employee/PaymentMethod/BankAccountEdit.tsx"],"sourcesContent":["import { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport type { BankAccountInputs } from './BankAccount'\nimport { usePaymentMethod } from './usePaymentMethod'\nimport { RadioGroupField, TextInputField } from '@/components/Common'\nimport { PAYMENT_METHODS } from '@/shared/constants'\n\nexport const BankAccountForm = () => {\n const { mode, watchedType } = usePaymentMethod()\n const { t } = useTranslation('Employee.PaymentMethod')\n const { setValue } = useFormContext<BankAccountInputs>()\n\n if ((mode !== 'ADD' && mode !== 'INITIAL') || watchedType === PAYMENT_METHODS.check) {\n return\n }\n //Used by form schema to determine variant\n setValue('hasBankPayload', true)\n\n return (\n <>\n <TextInputField\n name=\"name\"\n isRequired\n label={t('nameLabel')}\n errorMessage={t('validations.accountName')}\n />\n\n <TextInputField\n name=\"routingNumber\"\n label={t('routingNumberLabel')}\n isRequired\n description={t('routingNumberDescription')}\n errorMessage={t('validations.routingNumber')}\n />\n\n <TextInputField\n name=\"accountNumber\"\n label={t('accountNumberLabel')}\n errorMessage={t('validations.accountNumber')}\n isRequired\n />\n\n <RadioGroupField\n name=\"accountType\"\n label={t('accountTypeLabel')}\n options={[\n { value: 'Checking', label: t('accountTypeChecking') },\n { value: 'Savings', label: t('accountTypeSavings') },\n ]}\n />\n </>\n )\n}\n"],"names":["BankAccountForm","mode","watchedType","usePaymentMethod","t","useTranslation","setValue","useFormContext","PAYMENT_METHODS","jsxs","Fragment","jsx","TextInputField","RadioGroupField"],"mappings":";;;;;;;;AAOO,MAAMA,IAAkB,MAAM;AACnC,QAAM,EAAE,MAAAC,GAAM,aAAAC,EAAY,IAAIC,EAAiB,GACzC,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB,GAC/C,EAAE,UAAAC,EAAS,IAAIC,EAAkC;AAEvD,MAAK,EAAAN,MAAS,SAASA,MAAS,aAAcC,MAAgBM,EAAgB;AAI9E,WAAAF,EAAS,kBAAkB,EAAI,GAI3B,gBAAAG,EAAAC,GAAA,EAAA,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,YAAU;AAAA,UACV,OAAOR,EAAE,WAAW;AAAA,UACpB,cAAcA,EAAE,yBAAyB;AAAA,QAAA;AAAA,MAC3C;AAAA,MAEA,gBAAAO;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOR,EAAE,oBAAoB;AAAA,UAC7B,YAAU;AAAA,UACV,aAAaA,EAAE,0BAA0B;AAAA,UACzC,cAAcA,EAAE,2BAA2B;AAAA,QAAA;AAAA,MAC7C;AAAA,MAEA,gBAAAO;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOR,EAAE,oBAAoB;AAAA,UAC7B,cAAcA,EAAE,2BAA2B;AAAA,UAC3C,YAAU;AAAA,QAAA;AAAA,MACZ;AAAA,MAEA,gBAAAO;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOT,EAAE,kBAAkB;AAAA,UAC3B,SAAS;AAAA,YACP,EAAE,OAAO,YAAY,OAAOA,EAAE,qBAAqB,EAAE;AAAA,YACrD,EAAE,OAAO,WAAW,OAAOA,EAAE,oBAAoB,EAAE;AAAA,UAAA;AAAA,QACrD;AAAA,MAAA;AAAA,IACF,GACF;AAEJ;"}
|
|
@@ -2,7 +2,7 @@ import { jsx as n } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTranslation as s } from "react-i18next";
|
|
3
3
|
import { usePaymentMethod as p } from "./usePaymentMethod.js";
|
|
4
4
|
import d from "../../../assets/icons/trashcan.svg.js";
|
|
5
|
-
import "
|
|
5
|
+
import "classnames";
|
|
6
6
|
import f from "../../Common/hooks/useNumberFormatter.js";
|
|
7
7
|
import { HamburgerMenu as y } from "../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
8
8
|
import { useDataView as b } from "../../Common/DataView/useDataView.js";
|
|
@@ -2,12 +2,13 @@ import { jsx as r } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTranslation as p } from "react-i18next";
|
|
3
3
|
import { z as o } from "zod";
|
|
4
4
|
import { usePaymentMethod as m } from "./usePaymentMethod.js";
|
|
5
|
+
import "classnames";
|
|
5
6
|
import { PAYMENT_METHODS as i } from "../../../shared/constants.js";
|
|
6
7
|
import { RadioGroupField as n } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
7
8
|
o.object({
|
|
8
9
|
type: o.enum(["Check", "Direct Deposit"])
|
|
9
10
|
});
|
|
10
|
-
function
|
|
11
|
+
function f() {
|
|
11
12
|
const { mode: t } = m(), { t: e } = p("Employee.PaymentMethod");
|
|
12
13
|
if (!(t !== "INITIAL" && t !== "LIST"))
|
|
13
14
|
return /* @__PURE__ */ r(
|
|
@@ -32,6 +33,6 @@ function y() {
|
|
|
32
33
|
);
|
|
33
34
|
}
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
f as PaymentTypeForm
|
|
36
37
|
};
|
|
37
38
|
//# sourceMappingURL=PaymentTypeForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentTypeForm.js","sources":["../../../../src/components/Employee/PaymentMethod/PaymentTypeForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { usePaymentMethod } from './usePaymentMethod'\nimport { RadioGroupField } from '@/components/Common'\nimport { PAYMENT_METHODS } from '@/shared/constants'\n\nexport const PaymentTypeSchema = z.object({\n type: z.enum(['Check', 'Direct Deposit']),\n})\nexport type PaymentTypeInputs = z.input<typeof PaymentTypeSchema>\nexport type PaymentTypePayload = z.output<typeof PaymentTypeSchema>\n\nexport function PaymentTypeForm() {\n const { mode } = usePaymentMethod()\n const { t } = useTranslation('Employee.PaymentMethod')\n if (mode !== 'INITIAL' && mode !== 'LIST') return\n return (\n <RadioGroupField\n name=\"type\"\n label={t('paymentFieldsetLegend')}\n shouldVisuallyHideLabel\n options={[\n {\n value: PAYMENT_METHODS.directDeposit,\n label: t('directDepositLabel'),\n description: t('directDepositDescription'),\n },\n {\n value: PAYMENT_METHODS.check,\n label: t('checkLabel'),\n description: t('checkDescription'),\n },\n ]}\n />\n )\n}\n"],"names":["z","PaymentTypeForm","mode","usePaymentMethod","t","useTranslation","jsx","RadioGroupField","PAYMENT_METHODS"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PaymentTypeForm.js","sources":["../../../../src/components/Employee/PaymentMethod/PaymentTypeForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { usePaymentMethod } from './usePaymentMethod'\nimport { RadioGroupField } from '@/components/Common'\nimport { PAYMENT_METHODS } from '@/shared/constants'\n\nexport const PaymentTypeSchema = z.object({\n type: z.enum(['Check', 'Direct Deposit']),\n})\nexport type PaymentTypeInputs = z.input<typeof PaymentTypeSchema>\nexport type PaymentTypePayload = z.output<typeof PaymentTypeSchema>\n\nexport function PaymentTypeForm() {\n const { mode } = usePaymentMethod()\n const { t } = useTranslation('Employee.PaymentMethod')\n if (mode !== 'INITIAL' && mode !== 'LIST') return\n return (\n <RadioGroupField\n name=\"type\"\n label={t('paymentFieldsetLegend')}\n shouldVisuallyHideLabel\n options={[\n {\n value: PAYMENT_METHODS.directDeposit,\n label: t('directDepositLabel'),\n description: t('directDepositDescription'),\n },\n {\n value: PAYMENT_METHODS.check,\n label: t('checkLabel'),\n description: t('checkDescription'),\n },\n ]}\n />\n )\n}\n"],"names":["z","PaymentTypeForm","mode","usePaymentMethod","t","useTranslation","jsx","RadioGroupField","PAYMENT_METHODS"],"mappings":";;;;;;;AAMiCA,EAAE,OAAO;AAAA,EACxC,MAAMA,EAAE,KAAK,CAAC,SAAS,gBAAgB,CAAC;AAC1C,CAAC;AAIM,SAASC,IAAkB;AAC1B,QAAA,EAAE,MAAAC,EAAK,IAAIC,EAAiB,GAC5B,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB;AACjD,MAAA,EAAAH,MAAS,aAAaA,MAAS;AAEjC,WAAA,gBAAAI;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOH,EAAE,uBAAuB;AAAA,QAChC,yBAAuB;AAAA,QACvB,SAAS;AAAA,UACP;AAAA,YACE,OAAOI,EAAgB;AAAA,YACvB,OAAOJ,EAAE,oBAAoB;AAAA,YAC7B,aAAaA,EAAE,0BAA0B;AAAA,UAC3C;AAAA,UACA;AAAA,YACE,OAAOI,EAAgB;AAAA,YACvB,OAAOJ,EAAE,YAAY;AAAA,YACrB,aAAaA,EAAE,kBAAkB;AAAA,UAAA;AAAA,QACnC;AAAA,MACF;AAAA,IACF;AAEJ;"}
|
|
@@ -5,13 +5,14 @@ import { ErrorMessage as z } from "@hookform/error-message";
|
|
|
5
5
|
import y from "dompurify";
|
|
6
6
|
import { useMemo as j, useEffect as D } from "react";
|
|
7
7
|
import { usePaymentMethod as N } from "./usePaymentMethod.js";
|
|
8
|
-
import
|
|
8
|
+
import "classnames";
|
|
9
9
|
import { useLocale as q } from "../../../contexts/LocaleProvider/useLocale.js";
|
|
10
10
|
import { useComponentContext as w } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
11
|
import { ReorderableList as I } from "../../Common/ReorderableList/ReorderableList.js";
|
|
12
|
+
import { SPLIT_BY as h } from "../../../shared/constants.js";
|
|
12
13
|
import { RadioGroupField as W } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
13
14
|
import { NumberInputField as F } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
14
|
-
function
|
|
15
|
+
function ie() {
|
|
15
16
|
const { paymentMethod: r, bankAccounts: m, mode: c } = N(), {
|
|
16
17
|
control: s,
|
|
17
18
|
setValue: o,
|
|
@@ -168,6 +169,6 @@ function G({
|
|
|
168
169
|
) }, r.uuid);
|
|
169
170
|
}
|
|
170
171
|
export {
|
|
171
|
-
|
|
172
|
+
ie as Split
|
|
172
173
|
};
|
|
173
174
|
//# sourceMappingURL=Split.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Split.js","sources":["../../../../src/components/Employee/PaymentMethod/Split.tsx"],"sourcesContent":["import type { Control } from 'react-hook-form'\nimport { useFormContext } from 'react-hook-form'\nimport { Trans, useTranslation } from 'react-i18next'\nimport { type EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod'\nimport { ErrorMessage } from '@hookform/error-message'\nimport { Fragment } from 'react/jsx-runtime'\nimport DOMPurify from 'dompurify'\nimport { useEffect, useMemo } from 'react'\nimport { usePaymentMethod, type CombinedSchemaInputs } from './usePaymentMethod'\nimport { NumberInputField, RadioGroupField } from '@/components/Common'\nimport { useLocale } from '@/contexts/LocaleProvider'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { ReorderableList } from '@/components/Common/ReorderableList'\nimport { SPLIT_BY } from '@/shared/constants'\n\ntype Split = NonNullable<EmployeePaymentMethod['splits']>[number]\n\nexport function Split() {\n const { paymentMethod, bankAccounts, mode } = usePaymentMethod()\n const {\n control,\n setValue,\n resetField,\n watch,\n formState: { errors },\n } = useFormContext<CombinedSchemaInputs>()\n const { t } = useTranslation('Employee.PaymentMethod')\n const splitBy = watch('splitBy')\n const priorities = watch('priority')\n\n const splits = useMemo(() => paymentMethod.splits ?? [], [paymentMethod.splits])\n\n const remainderId = Object.entries(priorities).reduce(\n (maxId, [uuid, priority]) => (!maxId || (priorities[maxId] ?? 0) < priority ? uuid : maxId),\n '',\n )\n\n const { currency } = useLocale()\n\n // Handle splitBy value changes\n useEffect(() => {\n // Only run cleanup if splits exist\n if (!splits.length) return\n\n // Clean up when switching modes\n if (splitBy === SPLIT_BY.amount) {\n // When switching to amount mode, set the last item as remainder (null) and others to 0\n const newAmountValues = splits.reduce<Record<string, number | null>>((acc, curr) => {\n acc[curr.uuid] = curr.uuid === remainderId ? null : 0\n return acc\n }, {})\n setValue('splitAmount', newAmountValues)\n } else {\n // When switching to percentage mode, set the first item to 100% and others to 0\n const newPercentageValues = splits.reduce<Record<string, number>>((acc, curr, index) => {\n acc[curr.uuid] = index === 0 ? 100 : 0\n return acc\n }, {})\n setValue('splitAmount', newPercentageValues)\n }\n }, [splitBy, splits, remainderId, setValue])\n\n const Components = useComponentContext()\n\n if (mode !== 'SPLIT' || bankAccounts.length < 2 || paymentMethod.splits === null) return null\n //Used by form schema to determine variant\n setValue('isSplit', true)\n\n const updateSplitAmount = (uuid: string, value: number | null) => {\n setValue(`splitAmount.${uuid}`, value)\n }\n\n const handleReorder = (newOrder: number[]) => {\n // Calculate new priorities based on new order\n const newPriorities = newOrder.reduce(\n (acc: Record<string, number>, curr: number, currIndex: number) => {\n const split = splits[curr]\n return split ? { ...acc, [split.uuid]: currIndex + 1 } : acc\n },\n {},\n )\n\n // Get the last split in the new order\n const lastSplitIndex = newOrder[newOrder.length - 1]\n if (lastSplitIndex === undefined) return\n\n const lastSplit = splits[lastSplitIndex]\n if (!lastSplit) return\n\n // Update priorities\n setValue('priority', newPriorities)\n\n // Clear the previous remainder if different from the new one\n if (remainderId && remainderId !== lastSplit.uuid) {\n resetField(`splitAmount.${remainderId}`)\n updateSplitAmount(remainderId, 0)\n }\n\n // Set the new last item to null (remainder)\n updateSplitAmount(lastSplit.uuid, null)\n }\n\n const renderFieldsList = () => {\n if (splitBy === SPLIT_BY.amount) {\n return (\n <ReorderableList\n key={`reorderable-amount-list-${splitBy}`}\n label={t('draggableListLabel')}\n items={splits.map(split => ({\n label: split.name as string,\n content: (\n <AmountField\n key={`amount-${split.uuid}`}\n split={split}\n onChange={value => {\n updateSplitAmount(split.uuid, value)\n }}\n remainderId={remainderId}\n />\n ),\n }))}\n onReorder={handleReorder}\n />\n )\n }\n\n return splits.map(split => (\n <PercentageField\n key={`percentage-${split.uuid}`}\n split={split}\n control={control}\n onChange={value => {\n updateSplitAmount(split.uuid, value)\n }}\n currency={currency}\n />\n ))\n }\n\n return (\n <>\n <ErrorMessage\n errors={errors}\n name=\"splitAmount.root\"\n render={({ message }) => {\n // Handle enhanced error messages with current total\n if (message && message.startsWith('percentage_split_total_error:')) {\n const total = message.split(':')[1] || '0'\n return (\n <Components.Alert\n status=\"error\"\n label={t('validations.percentageErrorWithTotal', { total })}\n />\n )\n }\n // Fallback to original error message\n return <Components.Alert status=\"error\" label={t('validations.percentageError')} />\n }}\n />\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Trans t={t} i18nKey=\"splitDescription\" components={{ p: <Components.Text /> }} />\n <RadioGroupField\n name=\"splitBy\"\n label={t('splitByLabel')}\n options={[\n { value: SPLIT_BY.percentage, label: t('percentageLabel') },\n { value: SPLIT_BY.amount, label: t('amountLabel') },\n ]}\n />\n {paymentMethod.splits && renderFieldsList()}\n </>\n )\n}\n\nfunction AmountField({\n split,\n remainderId,\n onChange,\n}: {\n split: Split\n remainderId: string\n onChange: (value: number | null) => void\n}) {\n const { t } = useTranslation('Employee.PaymentMethod')\n return (\n <NumberInputField\n name={`splitAmount.${split.uuid}`}\n label={t('splitAmountLabel', {\n name: DOMPurify.sanitize(split.name ?? ''),\n account_number: DOMPurify.sanitize(split.hiddenAccountNumber ?? ''),\n interpolation: { escapeValue: false },\n })}\n format=\"currency\"\n min={0}\n isRequired\n errorMessage={t('validations.amountError')}\n placeholder={remainderId === split.uuid ? t('remainderLabel') : ''}\n isDisabled={remainderId === split.uuid}\n onChange={onChange}\n />\n )\n}\n\nfunction PercentageField({\n split,\n control,\n onChange,\n currency,\n}: {\n split: Split\n control: Control<CombinedSchemaInputs>\n onChange: (value: number) => void\n currency: string\n}) {\n const { t } = useTranslation('Employee.PaymentMethod')\n return (\n <Fragment key={split.uuid}>\n <NumberInputField\n name={`splitAmount.${split.uuid}`}\n label={t('splitAmountLabel', {\n name: DOMPurify.sanitize(split.name ?? ''),\n account_number: DOMPurify.sanitize(split.hiddenAccountNumber ?? ''),\n interpolation: { escapeValue: false },\n })}\n format=\"percent\"\n min={0}\n isRequired\n errorMessage={t('validations.amountError')}\n onChange={onChange}\n />\n </Fragment>\n )\n}\n"],"names":["Split","paymentMethod","bankAccounts","mode","usePaymentMethod","control","setValue","resetField","watch","errors","useFormContext","t","useTranslation","splitBy","priorities","splits","useMemo","remainderId","maxId","uuid","priority","currency","useLocale","useEffect","SPLIT_BY","newAmountValues","acc","curr","newPercentageValues","index","Components","useComponentContext","updateSplitAmount","value","handleReorder","newOrder","newPriorities","currIndex","split","lastSplitIndex","lastSplit","renderFieldsList","jsx","ReorderableList","AmountField","PercentageField","jsxs","Fragment","ErrorMessage","message","total","Trans","RadioGroupField","onChange","NumberInputField","DOMPurify"],"mappings":";;;;;;;;;;;;;AAiBO,SAASA,KAAQ;AACtB,QAAM,EAAE,eAAAC,GAAe,cAAAC,GAAc,MAAAC,EAAA,IAASC,EAAiB,GACzD;AAAA,IACJ,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAW,EAAE,QAAAC,EAAO;AAAA,MAClBC,EAAqC,GACnC,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB,GAC/CC,IAAUL,EAAM,SAAS,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AAAA,MAC/B,OAAO3B,EAAE,oBAAoB;AAAA,QAC3B,MAAM4C,EAAU,SAASjB,EAAM,QAAQ,EAAE;AAAA,QACzC,gBAAgBiB,EAAU,SAASjB,EAAM,uBAAuB,EAAE;AAAA,QAClE,eAAe,EAAE,aAAa,GAAM;AAAA,MAAA,CACrC;AAAA,MACD,QAAO;AAAA,MACP,KAAK;AAAA,MACL,YAAU;AAAA,MACV,cAAc3B,EAAE,yBAAyB;AAAA,MACzC,aAAaM,MAAgBqB,EAAM,OAAO3B,EAAE,gBAAgB,IAAI;AAAA,MAChE,YAAYM,MAAgBqB,EAAM;AAAA,MAClC,UAAAe;AAAA,IAAA;AAAA,EACF;AAEJ;AAEA,SAASR,EAAgB;AAAA,EACvB,OAAAP;AAAA,EACA,SAAAjC;AAAA,EACA,UAAAgD;AAAA,EACA,UAAAhC;AACF,GAKG;AACD,QAAM,EAAE,GAAAV,EAAA,IAAMC,EAAe,wBAAwB;AAEnD,SAAA,gBAAA8B,EAACK,GAAA,EACC,UAAA,gBAAAL;AAAA,IAACY;AAAA,IAAA;AAAA,MACC,MAAM,eAAehB,EAAM,IAAI;AAAA,MAC/B,OAAO3B,EAAE,oBAAoB;AAAA,QAC3B,MAAM4C,EAAU,SAASjB,EAAM,QAAQ,EAAE;AAAA,QACzC,gBAAgBiB,EAAU,SAASjB,EAAM,uBAAuB,EAAE;AAAA,QAClE,eAAe,EAAE,aAAa,GAAM;AAAA,MAAA,CACrC;AAAA,MACD,QAAO;AAAA,MACP,KAAK;AAAA,MACL,YAAU;AAAA,MACV,cAAc3B,EAAE,yBAAyB;AAAA,MACzC,UAAA0C;AAAA,IAAA;AAAA,EAAA,EACF,GAbaf,EAAM,IAcrB;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"Split.js","sources":["../../../../src/components/Employee/PaymentMethod/Split.tsx"],"sourcesContent":["import type { Control } from 'react-hook-form'\nimport { useFormContext } from 'react-hook-form'\nimport { Trans, useTranslation } from 'react-i18next'\nimport { type EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod'\nimport { ErrorMessage } from '@hookform/error-message'\nimport { Fragment } from 'react/jsx-runtime'\nimport DOMPurify from 'dompurify'\nimport { useEffect, useMemo } from 'react'\nimport { usePaymentMethod, type CombinedSchemaInputs } from './usePaymentMethod'\nimport { NumberInputField, RadioGroupField } from '@/components/Common'\nimport { useLocale } from '@/contexts/LocaleProvider'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { ReorderableList } from '@/components/Common/ReorderableList'\nimport { SPLIT_BY } from '@/shared/constants'\n\ntype Split = NonNullable<EmployeePaymentMethod['splits']>[number]\n\nexport function Split() {\n const { paymentMethod, bankAccounts, mode } = usePaymentMethod()\n const {\n control,\n setValue,\n resetField,\n watch,\n formState: { errors },\n } = useFormContext<CombinedSchemaInputs>()\n const { t } = useTranslation('Employee.PaymentMethod')\n const splitBy = watch('splitBy')\n const priorities = watch('priority')\n\n const splits = useMemo(() => paymentMethod.splits ?? [], [paymentMethod.splits])\n\n const remainderId = Object.entries(priorities).reduce(\n (maxId, [uuid, priority]) => (!maxId || (priorities[maxId] ?? 0) < priority ? uuid : maxId),\n '',\n )\n\n const { currency } = useLocale()\n\n // Handle splitBy value changes\n useEffect(() => {\n // Only run cleanup if splits exist\n if (!splits.length) return\n\n // Clean up when switching modes\n if (splitBy === SPLIT_BY.amount) {\n // When switching to amount mode, set the last item as remainder (null) and others to 0\n const newAmountValues = splits.reduce<Record<string, number | null>>((acc, curr) => {\n acc[curr.uuid] = curr.uuid === remainderId ? null : 0\n return acc\n }, {})\n setValue('splitAmount', newAmountValues)\n } else {\n // When switching to percentage mode, set the first item to 100% and others to 0\n const newPercentageValues = splits.reduce<Record<string, number>>((acc, curr, index) => {\n acc[curr.uuid] = index === 0 ? 100 : 0\n return acc\n }, {})\n setValue('splitAmount', newPercentageValues)\n }\n }, [splitBy, splits, remainderId, setValue])\n\n const Components = useComponentContext()\n\n if (mode !== 'SPLIT' || bankAccounts.length < 2 || paymentMethod.splits === null) return null\n //Used by form schema to determine variant\n setValue('isSplit', true)\n\n const updateSplitAmount = (uuid: string, value: number | null) => {\n setValue(`splitAmount.${uuid}`, value)\n }\n\n const handleReorder = (newOrder: number[]) => {\n // Calculate new priorities based on new order\n const newPriorities = newOrder.reduce(\n (acc: Record<string, number>, curr: number, currIndex: number) => {\n const split = splits[curr]\n return split ? { ...acc, [split.uuid]: currIndex + 1 } : acc\n },\n {},\n )\n\n // Get the last split in the new order\n const lastSplitIndex = newOrder[newOrder.length - 1]\n if (lastSplitIndex === undefined) return\n\n const lastSplit = splits[lastSplitIndex]\n if (!lastSplit) return\n\n // Update priorities\n setValue('priority', newPriorities)\n\n // Clear the previous remainder if different from the new one\n if (remainderId && remainderId !== lastSplit.uuid) {\n resetField(`splitAmount.${remainderId}`)\n updateSplitAmount(remainderId, 0)\n }\n\n // Set the new last item to null (remainder)\n updateSplitAmount(lastSplit.uuid, null)\n }\n\n const renderFieldsList = () => {\n if (splitBy === SPLIT_BY.amount) {\n return (\n <ReorderableList\n key={`reorderable-amount-list-${splitBy}`}\n label={t('draggableListLabel')}\n items={splits.map(split => ({\n label: split.name as string,\n content: (\n <AmountField\n key={`amount-${split.uuid}`}\n split={split}\n onChange={value => {\n updateSplitAmount(split.uuid, value)\n }}\n remainderId={remainderId}\n />\n ),\n }))}\n onReorder={handleReorder}\n />\n )\n }\n\n return splits.map(split => (\n <PercentageField\n key={`percentage-${split.uuid}`}\n split={split}\n control={control}\n onChange={value => {\n updateSplitAmount(split.uuid, value)\n }}\n currency={currency}\n />\n ))\n }\n\n return (\n <>\n <ErrorMessage\n errors={errors}\n name=\"splitAmount.root\"\n render={({ message }) => {\n // Handle enhanced error messages with current total\n if (message && message.startsWith('percentage_split_total_error:')) {\n const total = message.split(':')[1] || '0'\n return (\n <Components.Alert\n status=\"error\"\n label={t('validations.percentageErrorWithTotal', { total })}\n />\n )\n }\n // Fallback to original error message\n return <Components.Alert status=\"error\" label={t('validations.percentageError')} />\n }}\n />\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Trans t={t} i18nKey=\"splitDescription\" components={{ p: <Components.Text /> }} />\n <RadioGroupField\n name=\"splitBy\"\n label={t('splitByLabel')}\n options={[\n { value: SPLIT_BY.percentage, label: t('percentageLabel') },\n { value: SPLIT_BY.amount, label: t('amountLabel') },\n ]}\n />\n {paymentMethod.splits && renderFieldsList()}\n </>\n )\n}\n\nfunction AmountField({\n split,\n remainderId,\n onChange,\n}: {\n split: Split\n remainderId: string\n onChange: (value: number | null) => void\n}) {\n const { t } = useTranslation('Employee.PaymentMethod')\n return (\n <NumberInputField\n name={`splitAmount.${split.uuid}`}\n label={t('splitAmountLabel', {\n name: DOMPurify.sanitize(split.name ?? ''),\n account_number: DOMPurify.sanitize(split.hiddenAccountNumber ?? ''),\n interpolation: { escapeValue: false },\n })}\n format=\"currency\"\n min={0}\n isRequired\n errorMessage={t('validations.amountError')}\n placeholder={remainderId === split.uuid ? t('remainderLabel') : ''}\n isDisabled={remainderId === split.uuid}\n onChange={onChange}\n />\n )\n}\n\nfunction PercentageField({\n split,\n control,\n onChange,\n currency,\n}: {\n split: Split\n control: Control<CombinedSchemaInputs>\n onChange: (value: number) => void\n currency: string\n}) {\n const { t } = useTranslation('Employee.PaymentMethod')\n return (\n <Fragment key={split.uuid}>\n <NumberInputField\n name={`splitAmount.${split.uuid}`}\n label={t('splitAmountLabel', {\n name: DOMPurify.sanitize(split.name ?? ''),\n account_number: DOMPurify.sanitize(split.hiddenAccountNumber ?? ''),\n interpolation: { escapeValue: false },\n })}\n format=\"percent\"\n min={0}\n isRequired\n errorMessage={t('validations.amountError')}\n onChange={onChange}\n />\n </Fragment>\n )\n}\n"],"names":["Split","paymentMethod","bankAccounts","mode","usePaymentMethod","control","setValue","resetField","watch","errors","useFormContext","t","useTranslation","splitBy","priorities","splits","useMemo","remainderId","maxId","uuid","priority","currency","useLocale","useEffect","SPLIT_BY","newAmountValues","acc","curr","newPercentageValues","index","Components","useComponentContext","updateSplitAmount","value","handleReorder","newOrder","newPriorities","currIndex","split","lastSplitIndex","lastSplit","renderFieldsList","jsx","ReorderableList","AmountField","PercentageField","jsxs","Fragment","ErrorMessage","message","total","Trans","RadioGroupField","onChange","NumberInputField","DOMPurify"],"mappings":";;;;;;;;;;;;;;AAiBO,SAASA,KAAQ;AACtB,QAAM,EAAE,eAAAC,GAAe,cAAAC,GAAc,MAAAC,EAAA,IAASC,EAAiB,GACzD;AAAA,IACJ,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAW,EAAE,QAAAC,EAAO;AAAA,MAClBC,EAAqC,GACnC,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB,GAC/CC,IAAUL,EAAM,SAAS,GACzBM,IAAaN,EAAM,UAAU,GAE7BO,IAASC,EAAQ,MAAMf,EAAc,UAAU,IAAI,CAACA,EAAc,MAAM,CAAC,GAEzEgB,IAAc,OAAO,QAAQH,CAAU,EAAE;AAAA,IAC7C,CAACI,GAAO,CAACC,GAAMC,CAAQ,MAAO,CAACF,MAAUJ,EAAWI,CAAK,KAAK,KAAKE,IAAWD,IAAOD;AAAA,IACrF;AAAA,EACF,GAEM,EAAE,UAAAG,EAAS,IAAIC,EAAU;AAG/B,EAAAC,EAAU,MAAM;AAEV,QAACR,EAAO;AAGR,UAAAF,MAAYW,EAAS,QAAQ;AAE/B,cAAMC,IAAkBV,EAAO,OAAsC,CAACW,GAAKC,OACzED,EAAIC,EAAK,IAAI,IAAIA,EAAK,SAASV,IAAc,OAAO,GAC7CS,IACN,EAAE;AACL,QAAApB,EAAS,eAAemB,CAAe;AAAA,MAAA,OAClC;AAEL,cAAMG,IAAsBb,EAAO,OAA+B,CAACW,GAAKC,GAAME,OAC5EH,EAAIC,EAAK,IAAI,IAAIE,MAAU,IAAI,MAAM,GAC9BH,IACN,EAAE;AACL,QAAApB,EAAS,eAAesB,CAAmB;AAAA,M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B,EAAE,oBAAoB;AAAA,QAC3B,MAAM4C,EAAU,SAASjB,EAAM,QAAQ,EAAE;AAAA,QACzC,gBAAgBiB,EAAU,SAASjB,EAAM,uBAAuB,EAAE;AAAA,QAClE,eAAe,EAAE,aAAa,GAAM;AAAA,MAAA,CACrC;AAAA,MACD,QAAO;AAAA,MACP,KAAK;AAAA,MACL,YAAU;AAAA,MACV,cAAc3B,EAAE,yBAAyB;AAAA,MACzC,UAAA0C;AAAA,IAAA;AAAA,EAAA,EACF,GAbaf,EAAM,IAcrB;AAEJ;"}
|
|
@@ -10,9 +10,9 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
10
10
|
import "@tanstack/react-query";
|
|
11
11
|
import "../../Base/useBase.js";
|
|
12
12
|
import "../../../shared/constants.js";
|
|
13
|
+
import "classnames";
|
|
13
14
|
import "dompurify";
|
|
14
15
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
15
|
-
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
16
16
|
import { createCompoundContext as a } from "../../Base/createCompoundContext.js";
|
|
17
17
|
const x = t.union([
|
|
18
18
|
l.extend({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as r } from "react-i18next";
|
|
3
3
|
import { useProfile as e } from "./useProfile.js";
|
|
4
|
-
import "
|
|
4
|
+
import "classnames";
|
|
5
5
|
import { ActionsLayout as m } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
6
6
|
import { useComponentContext as s } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
7
7
|
const d = () => {
|