@gusto/embedded-react-sdk 0.45.0 → 0.46.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/dist/components/Common/DataView/DataCards/DataCards.d.ts +2 -1
- package/dist/components/Common/DataView/DataCards/DataCards.js +14 -13
- package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
- package/dist/components/Common/DataView/DataTable/DataTable.d.ts +2 -1
- package/dist/components/Common/DataView/DataTable/DataTable.js +51 -50
- package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
- package/dist/components/Common/DataView/DataView.d.ts +1 -0
- package/dist/components/Common/DataView/DataView.js.map +1 -1
- package/dist/components/Common/DataView/useDataView.d.ts +8 -1
- package/dist/components/Common/DataView/useDataView.js +20 -17
- package/dist/components/Common/DataView/useDataView.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +20 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +20 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +22 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +20 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +20 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/fields.js +4 -4
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +28 -12
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +23 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +20 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +20 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +20 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js +5 -5
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +20 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +20 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +22 -6
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/Profile/useContractorProfile.js +52 -42
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.d.ts +9 -0
- package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.js +76 -0
- package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.js.map +1 -0
- package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.module.scss.js +8 -0
- package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.module.scss.js.map +1 -0
- package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.d.ts +11 -0
- package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js +85 -0
- package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js.map +1 -0
- package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.module.scss.js +8 -0
- package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.module.scss.js.map +1 -0
- package/dist/components/Employee/Compensation/management/EditCompensation/index.d.ts +3 -0
- package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.d.ts +25 -0
- package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.js +81 -0
- package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.js.map +1 -0
- package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.module.scss.js +8 -0
- package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.module.scss.js.map +1 -0
- package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.d.ts +18 -0
- package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js +171 -0
- package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js.map +1 -0
- package/dist/components/Employee/Compensation/management/index.d.ts +6 -0
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.d.ts +6 -1
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js +67 -209
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.d.ts +18 -0
- package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.js +169 -0
- package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.js.map +1 -0
- package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.d.ts +16 -0
- package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.js +36 -30
- package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.d.ts +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js +4 -4
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +212 -187
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useJobForm/fields.js +6 -6
- package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.d.ts +8 -0
- package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.js +22 -17
- package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.d.ts +12 -2
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +115 -110
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
- package/dist/components/Employee/Dashboard/BasicDetailsView.d.ts +8 -3
- package/dist/components/Employee/Dashboard/BasicDetailsView.js +108 -84
- package/dist/components/Employee/Dashboard/BasicDetailsView.js.map +1 -1
- package/dist/components/Employee/Dashboard/Dashboard.d.ts +2 -0
- package/dist/components/Employee/Dashboard/Dashboard.js +86 -68
- package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Employee/Dashboard/DashboardComponents.d.ts +8 -4
- package/dist/components/Employee/Dashboard/DashboardComponents.js +147 -93
- package/dist/components/Employee/Dashboard/DashboardComponents.js.map +1 -1
- package/dist/components/Employee/Dashboard/DocumentsView.js +18 -11
- package/dist/components/Employee/Dashboard/DocumentsView.js.map +1 -1
- package/dist/components/Employee/Dashboard/JobAndPayView.js +304 -264
- package/dist/components/Employee/Dashboard/JobAndPayView.js.map +1 -1
- package/dist/components/Employee/Dashboard/JobAndPayView.module.scss.js +10 -0
- package/dist/components/Employee/Dashboard/JobAndPayView.module.scss.js.map +1 -0
- package/dist/components/Employee/Dashboard/TaxesView.d.ts +7 -2
- package/dist/components/Employee/Dashboard/TaxesView.js +68 -54
- package/dist/components/Employee/Dashboard/TaxesView.js.map +1 -1
- package/dist/components/Employee/Dashboard/dashboardStateMachine.js +152 -142
- package/dist/components/Employee/Dashboard/dashboardStateMachine.js.map +1 -1
- package/dist/components/Employee/Dashboard/getPendingCompensationChanges.d.ts +6 -0
- package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js +13 -12
- package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js.map +1 -1
- package/dist/components/Employee/Dashboard/hooks/useEmployeeBasicDetails.d.ts +12 -5
- package/dist/components/Employee/Dashboard/hooks/useEmployeeBasicDetails.js +21 -21
- package/dist/components/Employee/Dashboard/hooks/useEmployeeBasicDetails.js.map +1 -1
- package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.d.ts +13 -3
- package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js +53 -55
- package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js.map +1 -1
- package/dist/components/Employee/Dashboard/hooks/useEmployeeForms.d.ts +10 -4
- package/dist/components/Employee/Dashboard/hooks/useEmployeeForms.js +10 -12
- package/dist/components/Employee/Dashboard/hooks/useEmployeeForms.js.map +1 -1
- package/dist/components/Employee/Dashboard/hooks/useEmployeeTaxes.d.ts +10 -3
- package/dist/components/Employee/Dashboard/hooks/useEmployeeTaxes.js +19 -14
- package/dist/components/Employee/Dashboard/hooks/useEmployeeTaxes.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js +8 -8
- package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js +4 -4
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +20 -4
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/fields.js +1 -1
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js +37 -40
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.d.ts +1 -2
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js +64 -71
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.d.ts +2 -0
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js +25 -0
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js.map +1 -0
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.d.ts +13 -0
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js +37 -0
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js.map +1 -0
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.d.ts +6 -0
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js +69 -0
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js.map +1 -0
- package/dist/components/Employee/EmployeeListFlow/index.d.ts +3 -0
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/fields.js +4 -4
- package/dist/components/Employee/HomeAddress/management/HomeAddress.js +15 -12
- package/dist/components/Employee/HomeAddress/management/HomeAddress.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.d.ts +2 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +86 -83
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/fields.js +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js +4 -4
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/fields.js +8 -8
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/fields.js +5 -5
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.js +4 -4
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldComponents.js +8 -8
- package/dist/components/Employee/Taxes/useTaxes.js +20 -4
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddress.js +14 -11
- package/dist/components/Employee/WorkAddress/management/WorkAddress.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.d.ts +2 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +92 -89
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
- package/dist/components/Employee/exports/employeeManagement.d.ts +2 -0
- package/dist/components/Employee/exports/employeeManagement.js +18 -16
- package/dist/components/Employee/exports/employeeManagement.js.map +1 -1
- package/dist/components/Employee/index.d.ts +2 -0
- package/dist/components/Employee/index.js +32 -30
- package/dist/components/Employee/index.js.map +1 -1
- package/dist/components/Flow/FlowHeader.js +34 -31
- package/dist/components/Flow/FlowHeader.js.map +1 -1
- package/dist/components/Flow/useFlow.d.ts +12 -0
- package/dist/components/Flow/useFlow.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +34 -26
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +36 -22
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyList.js +92 -69
- package/dist/components/TimeOff/PolicyList/PolicyList.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js +23 -23
- package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js +52 -40
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.js.map +1 -1
- package/dist/components/TimeOff/TimeOffFlow/timeOffStateMachine.js +73 -56
- package/dist/components/TimeOff/TimeOffFlow/timeOffStateMachine.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js +58 -58
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js +91 -87
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormTypes.d.ts +2 -0
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js +91 -124
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js +72 -87
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentationTypes.d.ts +1 -6
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +160 -220
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.d.ts +7 -3
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js +77 -54
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.test.d.ts +1 -0
- package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.js +12 -11
- package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js +177 -147
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js.map +1 -1
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.d.ts +1 -1
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +38 -36
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js.map +1 -1
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTableTypes.d.ts +2 -0
- package/dist/i18n/en/Company.TimeOff.SelectEmployees.json.js +10 -10
- package/dist/i18n/en/Company.TimeOff.TimeOffPolicies.json.js +17 -15
- package/dist/i18n/en/Company.TimeOff.TimeOffPolicies.json.js.map +1 -1
- package/dist/i18n/en/Company.TimeOff.TimeOffPolicyDetails.json.js +9 -9
- package/dist/i18n/en/Employee.Compensation.json.js +68 -56
- package/dist/i18n/en/Employee.Compensation.json.js.map +1 -1
- package/dist/i18n/en/Employee.Dashboard.json.js +26 -24
- package/dist/i18n/en/Employee.Dashboard.json.js.map +1 -1
- package/dist/i18n/en/Employee.DocumentManager.json.js +1 -1
- package/dist/i18n/en/Employee.HomeAddress.Management.json.js +12 -10
- package/dist/i18n/en/Employee.HomeAddress.Management.json.js.map +1 -1
- package/dist/i18n/en/Employee.ManagementEmployeeList.json.js +32 -30
- package/dist/i18n/en/Employee.ManagementEmployeeList.json.js.map +1 -1
- package/dist/i18n/en/Employee.WorkAddress.Management.json.js +16 -14
- package/dist/i18n/en/Employee.WorkAddress.Management.json.js.map +1 -1
- package/dist/i18n/en/common.json.d.ts +21 -0
- package/dist/partner-hook-utils/form/fields/DatePickerHookField.js +33 -32
- package/dist/partner-hook-utils/form/fields/DatePickerHookField.js.map +1 -1
- package/dist/partner-hook-utils/types.d.ts +4 -0
- package/dist/shared/constants.d.ts +4 -0
- package/dist/shared/constants.js +20 -18
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +45 -11
- package/docs/reference/endpoint-inventory.json +24 -8
- package/package.json +1 -1
|
@@ -1,131 +1,155 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation as
|
|
3
|
-
import { Flex as
|
|
4
|
-
import { useComponentContext as
|
|
5
|
-
import { formatDateLongWithYear as
|
|
6
|
-
import { firstLastName as
|
|
2
|
+
import { useTranslation as b } from "react-i18next";
|
|
3
|
+
import { Flex as a } from "../../Common/Flex/Flex.js";
|
|
4
|
+
import { useComponentContext as v } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
5
|
+
import { formatDateLongWithYear as f } from "../../../helpers/dateFormatting.js";
|
|
6
|
+
import { firstLastName as A, getStreet as C, getCityStateZip as X } from "../../../helpers/formattedStrings.js";
|
|
7
7
|
import "classnames";
|
|
8
8
|
import "../../../shared/constants.js";
|
|
9
|
-
import { Loading as
|
|
10
|
-
import { BaseLayout as
|
|
11
|
-
import { useEmployeeBasicDetails as
|
|
12
|
-
function
|
|
13
|
-
employeeId:
|
|
14
|
-
onEditBasicDetails:
|
|
15
|
-
onManageHomeAddress:
|
|
16
|
-
onManageWorkAddress:
|
|
9
|
+
import { Loading as d } from "../../Common/Loading/Loading.js";
|
|
10
|
+
import { BaseLayout as w } from "../../Base/Base.js";
|
|
11
|
+
import { useEmployeeBasicDetails as N } from "./hooks/useEmployeeBasicDetails.js";
|
|
12
|
+
function Y({
|
|
13
|
+
employeeId: r,
|
|
14
|
+
onEditBasicDetails: l,
|
|
15
|
+
onManageHomeAddress: s,
|
|
16
|
+
onManageWorkAddress: c
|
|
17
17
|
}) {
|
|
18
|
-
const
|
|
19
|
-
return
|
|
20
|
-
|
|
18
|
+
const o = N({ employeeId: r });
|
|
19
|
+
return /* @__PURE__ */ e(w, { error: o.errorHandling.errors, children: /* @__PURE__ */ e(
|
|
20
|
+
k,
|
|
21
21
|
{
|
|
22
|
-
employee:
|
|
23
|
-
currentHomeAddress:
|
|
24
|
-
currentWorkAddress:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
employee: o.data.employee,
|
|
23
|
+
currentHomeAddress: o.data.currentHomeAddress,
|
|
24
|
+
currentWorkAddress: o.data.currentWorkAddress,
|
|
25
|
+
isEmployeeLoading: o.status.isEmployeeLoading,
|
|
26
|
+
isHomeAddressLoading: o.status.isHomeAddressLoading,
|
|
27
|
+
isWorkAddressLoading: o.status.isWorkAddressLoading,
|
|
28
|
+
onEditBasicDetails: l,
|
|
29
|
+
onManageHomeAddress: s,
|
|
30
|
+
onManageWorkAddress: c
|
|
28
31
|
}
|
|
29
32
|
) });
|
|
30
33
|
}
|
|
31
|
-
function
|
|
32
|
-
employee:
|
|
33
|
-
currentHomeAddress:
|
|
34
|
-
currentWorkAddress:
|
|
35
|
-
isLoading:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
function k({
|
|
35
|
+
employee: r,
|
|
36
|
+
currentHomeAddress: l,
|
|
37
|
+
currentWorkAddress: s,
|
|
38
|
+
isLoading: c = !1,
|
|
39
|
+
isEmployeeLoading: o = c,
|
|
40
|
+
isHomeAddressLoading: h = c,
|
|
41
|
+
isWorkAddressLoading: m = c,
|
|
42
|
+
onEditBasicDetails: g,
|
|
43
|
+
onManageHomeAddress: T,
|
|
44
|
+
onManageWorkAddress: B
|
|
39
45
|
}) {
|
|
40
|
-
const { t
|
|
41
|
-
|
|
42
|
-
return /* @__PURE__ */ e(C, {});
|
|
43
|
-
const d = B({
|
|
44
|
-
first_name: a.firstName,
|
|
45
|
-
last_name: a.lastName
|
|
46
|
-
}), h = x(a.jobs?.[0]?.hireDate), m = x(a.dateOfBirth), p = a.hasSsn ? "XXX-XX-XXXX" : void 0;
|
|
47
|
-
return /* @__PURE__ */ n(r, { flexDirection: "column", gap: 24, children: [
|
|
46
|
+
const { t } = b("Employee.Dashboard"), i = v(), x = r ? A({ first_name: r.firstName, last_name: r.lastName }) : void 0, p = r ? f(r.jobs?.[0]?.hireDate) : void 0, u = r ? f(r.dateOfBirth) : void 0, D = r?.hasSsn ? "XXX-XX-XXXX" : void 0;
|
|
47
|
+
return /* @__PURE__ */ n(a, { flexDirection: "column", gap: 24, children: [
|
|
48
48
|
/* @__PURE__ */ e(
|
|
49
|
-
|
|
49
|
+
i.Box,
|
|
50
50
|
{
|
|
51
51
|
header: /* @__PURE__ */ e(
|
|
52
|
-
|
|
52
|
+
i.BoxHeader,
|
|
53
53
|
{
|
|
54
|
-
title:
|
|
55
|
-
action: /* @__PURE__ */ e(
|
|
54
|
+
title: t("basicDetails.title"),
|
|
55
|
+
action: /* @__PURE__ */ e(
|
|
56
|
+
i.Button,
|
|
57
|
+
{
|
|
58
|
+
variant: "secondary",
|
|
59
|
+
onClick: g,
|
|
60
|
+
isDisabled: o,
|
|
61
|
+
children: t("basicDetails.editCta")
|
|
62
|
+
}
|
|
63
|
+
)
|
|
56
64
|
}
|
|
57
65
|
),
|
|
58
|
-
children: /* @__PURE__ */ e(
|
|
59
|
-
|
|
60
|
-
/* @__PURE__ */ e(
|
|
61
|
-
/* @__PURE__ */ e(
|
|
66
|
+
children: /* @__PURE__ */ e(a, { flexDirection: "column", gap: 16, children: o ? /* @__PURE__ */ e(d, {}) : r ? /* @__PURE__ */ n(a, { flexDirection: "column", gap: 12, children: [
|
|
67
|
+
x && /* @__PURE__ */ n(a, { flexDirection: "column", gap: 0, children: [
|
|
68
|
+
/* @__PURE__ */ e(i.Text, { variant: "supporting", children: t("basicDetails.legalName") }),
|
|
69
|
+
/* @__PURE__ */ e(i.Text, { children: x })
|
|
62
70
|
] }),
|
|
63
|
-
|
|
64
|
-
/* @__PURE__ */ e(
|
|
65
|
-
/* @__PURE__ */ e(
|
|
71
|
+
p && /* @__PURE__ */ n(a, { flexDirection: "column", gap: 0, children: [
|
|
72
|
+
/* @__PURE__ */ e(i.Text, { variant: "supporting", children: t("basicDetails.startDate") }),
|
|
73
|
+
/* @__PURE__ */ e(i.Text, { children: p })
|
|
66
74
|
] }),
|
|
67
|
-
|
|
68
|
-
/* @__PURE__ */ e(
|
|
69
|
-
/* @__PURE__ */ e(
|
|
75
|
+
D && /* @__PURE__ */ n(a, { flexDirection: "column", gap: 0, children: [
|
|
76
|
+
/* @__PURE__ */ e(i.Text, { variant: "supporting", children: t("basicDetails.socialSecurityNumber") }),
|
|
77
|
+
/* @__PURE__ */ e(i.Text, { children: D })
|
|
70
78
|
] }),
|
|
71
|
-
|
|
72
|
-
/* @__PURE__ */ e(
|
|
73
|
-
/* @__PURE__ */ e(
|
|
79
|
+
u && /* @__PURE__ */ n(a, { flexDirection: "column", gap: 0, children: [
|
|
80
|
+
/* @__PURE__ */ e(i.Text, { variant: "supporting", children: t("basicDetails.dateOfBirth") }),
|
|
81
|
+
/* @__PURE__ */ e(i.Text, { children: u })
|
|
74
82
|
] }),
|
|
75
|
-
|
|
76
|
-
/* @__PURE__ */ e(
|
|
77
|
-
/* @__PURE__ */ e(
|
|
83
|
+
r.email && /* @__PURE__ */ n(a, { flexDirection: "column", gap: 0, children: [
|
|
84
|
+
/* @__PURE__ */ e(i.Text, { variant: "supporting", children: t("basicDetails.personalEmail") }),
|
|
85
|
+
/* @__PURE__ */ e(i.Text, { children: r.email })
|
|
78
86
|
] })
|
|
79
|
-
] }) })
|
|
87
|
+
] }) : null })
|
|
80
88
|
}
|
|
81
89
|
),
|
|
82
90
|
/* @__PURE__ */ e(
|
|
83
|
-
|
|
91
|
+
i.Box,
|
|
84
92
|
{
|
|
85
93
|
header: /* @__PURE__ */ e(
|
|
86
|
-
|
|
94
|
+
i.BoxHeader,
|
|
87
95
|
{
|
|
88
|
-
title:
|
|
89
|
-
action: /* @__PURE__ */ e(
|
|
96
|
+
title: t("homeAddress.title"),
|
|
97
|
+
action: /* @__PURE__ */ e(
|
|
98
|
+
i.Button,
|
|
99
|
+
{
|
|
100
|
+
variant: "secondary",
|
|
101
|
+
onClick: T,
|
|
102
|
+
isDisabled: h,
|
|
103
|
+
children: t("homeAddress.manageCta")
|
|
104
|
+
}
|
|
105
|
+
)
|
|
90
106
|
}
|
|
91
107
|
),
|
|
92
|
-
children: /* @__PURE__ */ e(
|
|
93
|
-
/* @__PURE__ */ e(
|
|
94
|
-
/* @__PURE__ */ e(
|
|
95
|
-
/* @__PURE__ */ e(
|
|
96
|
-
] }) : /* @__PURE__ */ e(
|
|
108
|
+
children: /* @__PURE__ */ e(a, { flexDirection: "column", gap: 16, children: h ? /* @__PURE__ */ e(d, {}) : l ? /* @__PURE__ */ n(a, { flexDirection: "column", gap: 0, children: [
|
|
109
|
+
/* @__PURE__ */ e(i.Text, { variant: "supporting", children: t("homeAddress.currentAddress") }),
|
|
110
|
+
/* @__PURE__ */ e(i.Text, { children: C(l).replace(",", "") }),
|
|
111
|
+
/* @__PURE__ */ e(i.Text, { children: X(l) })
|
|
112
|
+
] }) : /* @__PURE__ */ e(i.Text, { children: t("homeAddress.noAddress") }) })
|
|
97
113
|
}
|
|
98
114
|
),
|
|
99
115
|
/* @__PURE__ */ e(
|
|
100
|
-
|
|
116
|
+
i.Box,
|
|
101
117
|
{
|
|
102
118
|
header: /* @__PURE__ */ e(
|
|
103
|
-
|
|
119
|
+
i.BoxHeader,
|
|
104
120
|
{
|
|
105
|
-
title:
|
|
106
|
-
action: /* @__PURE__ */ e(
|
|
121
|
+
title: t("workAddress.title"),
|
|
122
|
+
action: /* @__PURE__ */ e(
|
|
123
|
+
i.Button,
|
|
124
|
+
{
|
|
125
|
+
variant: "secondary",
|
|
126
|
+
onClick: B,
|
|
127
|
+
isDisabled: m,
|
|
128
|
+
children: t("workAddress.manageCta")
|
|
129
|
+
}
|
|
130
|
+
)
|
|
107
131
|
}
|
|
108
132
|
),
|
|
109
|
-
children: /* @__PURE__ */ e(
|
|
110
|
-
/* @__PURE__ */ e(
|
|
111
|
-
/* @__PURE__ */ n(
|
|
112
|
-
|
|
113
|
-
|
|
133
|
+
children: /* @__PURE__ */ e(a, { flexDirection: "column", gap: 16, children: m ? /* @__PURE__ */ e(d, {}) : s ? /* @__PURE__ */ n(a, { flexDirection: "column", gap: 0, children: [
|
|
134
|
+
/* @__PURE__ */ e(i.Text, { variant: "supporting", children: t("workAddress.currentAddress") }),
|
|
135
|
+
/* @__PURE__ */ n(i.Text, { children: [
|
|
136
|
+
s.street1,
|
|
137
|
+
s.street2 ? `, ${s.street2}` : ""
|
|
114
138
|
] }),
|
|
115
|
-
/* @__PURE__ */ n(
|
|
116
|
-
|
|
139
|
+
/* @__PURE__ */ n(i.Text, { children: [
|
|
140
|
+
s.city,
|
|
117
141
|
", ",
|
|
118
|
-
|
|
142
|
+
s.state,
|
|
119
143
|
" ",
|
|
120
|
-
|
|
144
|
+
s.zip
|
|
121
145
|
] })
|
|
122
|
-
] }) : /* @__PURE__ */ e(
|
|
146
|
+
] }) : /* @__PURE__ */ e(i.Text, { children: t("workAddress.noAddress") }) })
|
|
123
147
|
}
|
|
124
148
|
)
|
|
125
149
|
] });
|
|
126
150
|
}
|
|
127
151
|
export {
|
|
128
|
-
|
|
129
|
-
|
|
152
|
+
k as BasicDetailsView,
|
|
153
|
+
Y as BasicDetailsViewWithData
|
|
130
154
|
};
|
|
131
155
|
//# sourceMappingURL=BasicDetailsView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicDetailsView.js","sources":["../../../../src/components/Employee/Dashboard/BasicDetailsView.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { useEmployeeBasicDetails } from './hooks'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { formatDateLongWithYear } from '@/helpers/dateFormatting'\nimport { firstLastName, getStreet, getCityStateZip } from '@/helpers/formattedStrings'\nimport { Loading } from '@/components/Common'\nimport { BaseLayout } from '@/components/Base/Base'\n\nexport interface BasicDetailsViewProps {\n employee?: Employee\n currentHomeAddress?: EmployeeAddress\n currentWorkAddress?: EmployeeWorkAddress\n isLoading?: boolean\n onEditBasicDetails?: () => void\n onManageHomeAddress?: () => void\n onManageWorkAddress?: () => void\n}\n\nexport interface BasicDetailsViewWithDataProps {\n employeeId: string\n onEditBasicDetails?: () => void\n onManageHomeAddress?: () => void\n onManageWorkAddress?: () => void\n}\n\n/**\n * Tab-mounted container for the Basic details tab. Owns the\n * `useEmployeeBasicDetails` fetch (employee + home address + work address)\n * so the requests only fire when the tab is mounted. The presentational\n * `BasicDetailsView` stays pure for testing/stories.\n */\nexport function BasicDetailsViewWithData({\n employeeId,\n onEditBasicDetails,\n onManageHomeAddress,\n onManageWorkAddress,\n}: BasicDetailsViewWithDataProps) {\n const basicDetails = useEmployeeBasicDetails({ employeeId })\n\n if (basicDetails.isLoading) {\n return <BaseLayout isLoading error={basicDetails.errorHandling.errors} />\n }\n\n return (\n <BaseLayout error={basicDetails.errorHandling.errors}>\n <BasicDetailsView\n employee={basicDetails.data.employee}\n currentHomeAddress={basicDetails.data.currentHomeAddress}\n currentWorkAddress={basicDetails.data.currentWorkAddress}\n onEditBasicDetails={onEditBasicDetails}\n onManageHomeAddress={onManageHomeAddress}\n onManageWorkAddress={onManageWorkAddress}\n />\n </BaseLayout>\n )\n}\n\nexport function BasicDetailsView({\n employee,\n currentHomeAddress,\n currentWorkAddress,\n isLoading = false,\n onEditBasicDetails,\n onManageHomeAddress,\n onManageWorkAddress,\n}: BasicDetailsViewProps) {\n const { t } = useTranslation('Employee.Dashboard')\n const Components = useComponentContext()\n\n if (isLoading || !employee) {\n return <Loading />\n }\n\n const legalName = firstLastName({\n first_name: employee.firstName,\n last_name: employee.lastName,\n })\n const startDate = formatDateLongWithYear(employee.jobs?.[0]?.hireDate)\n const dateOfBirth = formatDateLongWithYear(employee.dateOfBirth)\n const maskedSsn = employee.hasSsn ? 'XXX-XX-XXXX' : undefined\n\n return (\n <Flex flexDirection=\"column\" gap={24}>\n <Components.Box\n header={\n <Components.BoxHeader\n title={t('basicDetails.title')}\n action={\n <Components.Button variant=\"secondary\" onClick={onEditBasicDetails}>\n {t('basicDetails.editCta')}\n </Components.Button>\n }\n />\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n <Flex flexDirection=\"column\" gap={12}>\n {legalName && (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('basicDetails.legalName')}\n </Components.Text>\n <Components.Text>{legalName}</Components.Text>\n </Flex>\n )}\n\n {startDate && (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('basicDetails.startDate')}\n </Components.Text>\n <Components.Text>{startDate}</Components.Text>\n </Flex>\n )}\n\n {maskedSsn && (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('basicDetails.socialSecurityNumber')}\n </Components.Text>\n <Components.Text>{maskedSsn}</Components.Text>\n </Flex>\n )}\n\n {dateOfBirth && (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('basicDetails.dateOfBirth')}\n </Components.Text>\n <Components.Text>{dateOfBirth}</Components.Text>\n </Flex>\n )}\n\n {employee.email && (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('basicDetails.personalEmail')}\n </Components.Text>\n <Components.Text>{employee.email}</Components.Text>\n </Flex>\n )}\n </Flex>\n </Flex>\n </Components.Box>\n\n <Components.Box\n header={\n <Components.BoxHeader\n title={t('homeAddress.title')}\n action={\n <Components.Button variant=\"secondary\" onClick={onManageHomeAddress}>\n {t('homeAddress.manageCta')}\n </Components.Button>\n }\n />\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n {currentHomeAddress ? (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('homeAddress.currentAddress')}\n </Components.Text>\n <Components.Text>{getStreet(currentHomeAddress).replace(',', '')}</Components.Text>\n <Components.Text>{getCityStateZip(currentHomeAddress)}</Components.Text>\n </Flex>\n ) : (\n <Components.Text>{t('homeAddress.noAddress')}</Components.Text>\n )}\n </Flex>\n </Components.Box>\n\n <Components.Box\n header={\n <Components.BoxHeader\n title={t('workAddress.title')}\n action={\n <Components.Button variant=\"secondary\" onClick={onManageWorkAddress}>\n {t('workAddress.manageCta')}\n </Components.Button>\n }\n />\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n {currentWorkAddress ? (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('workAddress.currentAddress')}\n </Components.Text>\n <Components.Text>\n {currentWorkAddress.street1}\n {currentWorkAddress.street2 ? `, ${currentWorkAddress.street2}` : ''}\n </Components.Text>\n <Components.Text>\n {currentWorkAddress.city}, {currentWorkAddress.state} {currentWorkAddress.zip}\n </Components.Text>\n </Flex>\n ) : (\n <Components.Text>{t('workAddress.noAddress')}</Components.Text>\n )}\n </Flex>\n </Components.Box>\n </Flex>\n )\n}\n"],"names":["BasicDetailsViewWithData","employeeId","onEditBasicDetails","onManageHomeAddress","onManageWorkAddress","basicDetails","useEmployeeBasicDetails","BaseLayout","jsx","BasicDetailsView","employee","currentHomeAddress","currentWorkAddress","isLoading","t","useTranslation","Components","useComponentContext","Loading","legalName","firstLastName","startDate","formatDateLongWithYear","dateOfBirth","maskedSsn","jsxs","Flex","getStreet","getCityStateZip"],"mappings":";;;;;;;;;;;AAmCO,SAASA,EAAyB;AAAA,EACvC,YAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,qBAAAC;AACF,GAAkC;AAChC,QAAMC,IAAeC,EAAwB,EAAE,YAAAL,GAAY;AAE3D,SAAII,EAAa,8BACPE,GAAA,EAAW,WAAS,IAAC,OAAOF,EAAa,cAAc,QAAQ,IAIvE,gBAAAG,EAACD,GAAA,EAAW,OAAOF,EAAa,cAAc,QAC5C,UAAA,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,UAAUJ,EAAa,KAAK;AAAA,MAC5B,oBAAoBA,EAAa,KAAK;AAAA,MACtC,oBAAoBA,EAAa,KAAK;AAAA,MACtC,oBAAAH;AAAA,MACA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AAAW,EAACT,EAAW,MAAX,EACE,UAAA;AAAA,YAAAJ,EAAmB;AAAA,YACnBA,EAAmB,UAAU,KAAKA,EAAmB,OAAO,KAAK;AAAA,UAAA,GACpE;AAAA,UACA,gBAAAa,EAACT,EAAW,MAAX,EACE,UAAA;AAAA,YAAAJ,EAAmB;AAAA,YAAK;AAAA,YAAGA,EAAmB;AAAA,YAAM;AAAA,YAAEA,EAAmB;AAAA,UAAA,EAAA,CAC5E;AAAA,QAAA,GACF,sBAECI,EAAW,MAAX,EAAiB,UAAAF,EAAE,uBAAuB,GAAE,EAAA,CAEjD;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"BasicDetailsView.js","sources":["../../../../src/components/Employee/Dashboard/BasicDetailsView.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { useEmployeeBasicDetails } from './hooks'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { formatDateLongWithYear } from '@/helpers/dateFormatting'\nimport { firstLastName, getStreet, getCityStateZip } from '@/helpers/formattedStrings'\nimport { Loading } from '@/components/Common'\nimport { BaseLayout } from '@/components/Base/Base'\n\nexport interface BasicDetailsViewProps {\n employee?: Employee\n currentHomeAddress?: EmployeeAddress\n currentWorkAddress?: EmployeeWorkAddress\n /** Loads all three cards. Per-section flags below take precedence\n * when each query resolves independently. */\n isLoading?: boolean\n isEmployeeLoading?: boolean\n isHomeAddressLoading?: boolean\n isWorkAddressLoading?: boolean\n onEditBasicDetails?: () => void\n onManageHomeAddress?: () => void\n onManageWorkAddress?: () => void\n}\n\nexport interface BasicDetailsViewWithDataProps {\n employeeId: string\n onEditBasicDetails?: () => void\n onManageHomeAddress?: () => void\n onManageWorkAddress?: () => void\n}\n\n/**\n * Tab-mounted container for the Basic details tab. Owns the\n * `useEmployeeBasicDetails` fetch (employee + home address + work address)\n * so the requests only fire when the tab is mounted. Each card paints\n * its own skeleton + content as the underlying query resolves.\n */\nexport function BasicDetailsViewWithData({\n employeeId,\n onEditBasicDetails,\n onManageHomeAddress,\n onManageWorkAddress,\n}: BasicDetailsViewWithDataProps) {\n const basicDetails = useEmployeeBasicDetails({ employeeId })\n\n return (\n <BaseLayout error={basicDetails.errorHandling.errors}>\n <BasicDetailsView\n employee={basicDetails.data.employee}\n currentHomeAddress={basicDetails.data.currentHomeAddress}\n currentWorkAddress={basicDetails.data.currentWorkAddress}\n isEmployeeLoading={basicDetails.status.isEmployeeLoading}\n isHomeAddressLoading={basicDetails.status.isHomeAddressLoading}\n isWorkAddressLoading={basicDetails.status.isWorkAddressLoading}\n onEditBasicDetails={onEditBasicDetails}\n onManageHomeAddress={onManageHomeAddress}\n onManageWorkAddress={onManageWorkAddress}\n />\n </BaseLayout>\n )\n}\n\nexport function BasicDetailsView({\n employee,\n currentHomeAddress,\n currentWorkAddress,\n isLoading = false,\n isEmployeeLoading = isLoading,\n isHomeAddressLoading = isLoading,\n isWorkAddressLoading = isLoading,\n onEditBasicDetails,\n onManageHomeAddress,\n onManageWorkAddress,\n}: BasicDetailsViewProps) {\n const { t } = useTranslation('Employee.Dashboard')\n const Components = useComponentContext()\n\n const legalName = employee\n ? firstLastName({ first_name: employee.firstName, last_name: employee.lastName })\n : undefined\n const startDate = employee ? formatDateLongWithYear(employee.jobs?.[0]?.hireDate) : undefined\n const dateOfBirth = employee ? formatDateLongWithYear(employee.dateOfBirth) : undefined\n const maskedSsn = employee?.hasSsn ? 'XXX-XX-XXXX' : undefined\n\n return (\n <Flex flexDirection=\"column\" gap={24}>\n <Components.Box\n header={\n <Components.BoxHeader\n title={t('basicDetails.title')}\n action={\n <Components.Button\n variant=\"secondary\"\n onClick={onEditBasicDetails}\n isDisabled={isEmployeeLoading}\n >\n {t('basicDetails.editCta')}\n </Components.Button>\n }\n />\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n {isEmployeeLoading ? (\n <Loading />\n ) : employee ? (\n <Flex flexDirection=\"column\" gap={12}>\n {legalName && (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('basicDetails.legalName')}\n </Components.Text>\n <Components.Text>{legalName}</Components.Text>\n </Flex>\n )}\n\n {startDate && (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('basicDetails.startDate')}\n </Components.Text>\n <Components.Text>{startDate}</Components.Text>\n </Flex>\n )}\n\n {maskedSsn && (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('basicDetails.socialSecurityNumber')}\n </Components.Text>\n <Components.Text>{maskedSsn}</Components.Text>\n </Flex>\n )}\n\n {dateOfBirth && (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('basicDetails.dateOfBirth')}\n </Components.Text>\n <Components.Text>{dateOfBirth}</Components.Text>\n </Flex>\n )}\n\n {employee.email && (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('basicDetails.personalEmail')}\n </Components.Text>\n <Components.Text>{employee.email}</Components.Text>\n </Flex>\n )}\n </Flex>\n ) : null}\n </Flex>\n </Components.Box>\n\n <Components.Box\n header={\n <Components.BoxHeader\n title={t('homeAddress.title')}\n action={\n <Components.Button\n variant=\"secondary\"\n onClick={onManageHomeAddress}\n isDisabled={isHomeAddressLoading}\n >\n {t('homeAddress.manageCta')}\n </Components.Button>\n }\n />\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n {isHomeAddressLoading ? (\n <Loading />\n ) : currentHomeAddress ? (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('homeAddress.currentAddress')}\n </Components.Text>\n <Components.Text>{getStreet(currentHomeAddress).replace(',', '')}</Components.Text>\n <Components.Text>{getCityStateZip(currentHomeAddress)}</Components.Text>\n </Flex>\n ) : (\n <Components.Text>{t('homeAddress.noAddress')}</Components.Text>\n )}\n </Flex>\n </Components.Box>\n\n <Components.Box\n header={\n <Components.BoxHeader\n title={t('workAddress.title')}\n action={\n <Components.Button\n variant=\"secondary\"\n onClick={onManageWorkAddress}\n isDisabled={isWorkAddressLoading}\n >\n {t('workAddress.manageCta')}\n </Components.Button>\n }\n />\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n {isWorkAddressLoading ? (\n <Loading />\n ) : currentWorkAddress ? (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text variant=\"supporting\">\n {t('workAddress.currentAddress')}\n </Components.Text>\n <Components.Text>\n {currentWorkAddress.street1}\n {currentWorkAddress.street2 ? `, ${currentWorkAddress.street2}` : ''}\n </Components.Text>\n <Components.Text>\n {currentWorkAddress.city}, {currentWorkAddress.state} {currentWorkAddress.zip}\n </Components.Text>\n </Flex>\n ) : (\n <Components.Text>{t('workAddress.noAddress')}</Components.Text>\n )}\n </Flex>\n </Components.Box>\n </Flex>\n )\n}\n"],"names":["BasicDetailsViewWithData","employeeId","onEditBasicDetails","onManageHomeAddress","onManageWorkAddress","basicDetails","useEmployeeBasicDetails","jsx","BaseLayout","BasicDetailsView","employee","currentHomeAddress","currentWorkAddress","isLoading","isEmployeeLoading","isHomeAddressLoading","isWorkAddressLoading","useTranslation","Components","useComponentContext","legalName","firstLastName","startDate","formatDateLongWithYear","dateOfBirth","maskedSsn","jsxs","Flex","Loading","getStreet","getCityStateZip"],"mappings":";;;;;;;;;;;AAwCO,SAASA,EAAyB;AAAA,EACvC,YAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,qBAAAC;AACF,GAAkC;AAChC,QAAMC,IAAeC,EAAwB,EAAE,YAAAL,GAAY;AAE3D,SACE,gBAAAM,EAACC,GAAA,EAAW,OAAOH,EAAa,cAAc,QAC5C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A,UAACW,EAAW;AAAA,UAAX;AAAA,YACC,OAAO,EAAE,mBAAmB;AAAA,YAC5B,QACE,gBAAAX;AAAA,cAACW,EAAW;AAAA,cAAX;AAAA,gBACC,SAAQ;AAAA,gBACR,SAASd;AAAA,gBACT,YAAYY;AAAA,gBAEX,YAAE,uBAAuB;AAAA,cAAA;AAAA,YAAA;AAAA,UAC5B;AAAA,QAAA;AAAA,QAKN,4BAACW,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,UAAAX,IACC,gBAAAT,EAACqB,GAAA,EAAQ,IACPhB,IACF,gBAAAc,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,UAAA,gBAAApB,EAACW,EAAW,MAAX,EAAgB,SAAQ,cACtB,UAAA,EAAE,4BAA4B,GACjC;AAAA,UACA,gBAAAQ,EAACR,EAAW,MAAX,EACE,UAAA;AAAA,YAAAN,EAAmB;AAAA,YACnBA,EAAmB,UAAU,KAAKA,EAAmB,OAAO,KAAK;AAAA,UAAA,GACpE;AAAA,UACA,gBAAAc,EAACR,EAAW,MAAX,EACE,UAAA;AAAA,YAAAN,EAAmB;AAAA,YAAK;AAAA,YAAGA,EAAmB;AAAA,YAAM;AAAA,YAAEA,EAAmB;AAAA,UAAA,EAAA,CAC5E;AAAA,QAAA,GACF,sBAECM,EAAW,MAAX,EAAiB,UAAA,EAAE,uBAAuB,GAAE,EAAA,CAEjD;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { BaseComponentInterface } from '../../Base/Base';
|
|
2
|
+
export type DashboardTab = 'basicDetails' | 'jobAndPay' | 'taxes' | 'documents';
|
|
2
3
|
export interface DashboardProps extends BaseComponentInterface<'Employee.Dashboard'> {
|
|
3
4
|
employeeId: string;
|
|
5
|
+
selectedTab?: DashboardTab;
|
|
4
6
|
}
|
|
5
7
|
export declare function Dashboard({ FallbackComponent, ...props }: DashboardProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,126 +1,144 @@
|
|
|
1
1
|
import { jsx as s, jsxs as D } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
import { useState as B, useCallback as o, Suspense as l } from "react";
|
|
3
|
+
import { useTranslation as m } from "react-i18next";
|
|
4
|
+
import { useEmployeesGetSuspense as R } from "@gusto/embedded-api/react-query/employeesGet";
|
|
5
|
+
import { BasicDetailsViewWithData as k } from "./BasicDetailsView.js";
|
|
6
|
+
import { JobAndPayView as H } from "./JobAndPayView.js";
|
|
7
|
+
import { TaxesViewWithData as F } from "./TaxesView.js";
|
|
8
|
+
import { DocumentsViewWithData as J } from "./DocumentsView.js";
|
|
9
|
+
import { Flex as b } from "../../Common/Flex/Flex.js";
|
|
10
|
+
import { useComponentContext as u } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
|
+
import { BaseBoundaries as V, BaseLayout as E } from "../../Base/Base.js";
|
|
12
|
+
import { useI18n as W, useComponentDictionary as w } from "../../../i18n/I18n.js";
|
|
13
|
+
import { componentEvents as i } from "../../../shared/constants.js";
|
|
14
|
+
import { firstLastName as j } from "../../../helpers/formattedStrings.js";
|
|
15
|
+
function G({
|
|
16
|
+
employeeId: a,
|
|
17
|
+
dictionary: r,
|
|
18
|
+
onEvent: t,
|
|
19
|
+
selectedTab: d
|
|
20
|
+
}) {
|
|
21
|
+
W("Employee.Dashboard"), w("Employee.Dashboard", r);
|
|
22
|
+
const { t: c } = m("Employee.Dashboard"), A = u(), [_, f] = B("basicDetails"), e = d ?? _, T = o(() => {
|
|
23
|
+
t(i.EMPLOYEE_UPDATE, { employeeId: a });
|
|
24
|
+
}, [t, a]), O = o(() => {
|
|
25
|
+
t(i.EMPLOYEE_HOME_ADDRESS, { employeeId: a });
|
|
26
|
+
}, [t, a]), L = o(() => {
|
|
27
|
+
t(i.EMPLOYEE_WORK_ADDRESS, { employeeId: a });
|
|
28
|
+
}, [t, a]), M = o(
|
|
22
29
|
(n) => {
|
|
23
|
-
t(
|
|
30
|
+
t(i.EMPLOYEE_COMPENSATION_CREATE, { employeeId: a, job: n });
|
|
24
31
|
},
|
|
25
32
|
[t, a]
|
|
26
|
-
),
|
|
27
|
-
t(
|
|
28
|
-
}, [t, a]),
|
|
29
|
-
t(
|
|
30
|
-
}, [t, a]),
|
|
31
|
-
t(
|
|
32
|
-
}, [t, a]),
|
|
33
|
+
), x = o(() => {
|
|
34
|
+
t(i.EMPLOYEE_JOB_ADD, { employeeId: a });
|
|
35
|
+
}, [t, a]), P = o(() => {
|
|
36
|
+
t(i.EMPLOYEE_JOB_ADD_ANOTHER, { employeeId: a });
|
|
37
|
+
}, [t, a]), S = o(() => {
|
|
38
|
+
t(i.EMPLOYEE_DEDUCTION_ADD, { employeeId: a });
|
|
39
|
+
}, [t, a]), C = o(
|
|
33
40
|
(n) => {
|
|
34
|
-
t(
|
|
41
|
+
t(i.EMPLOYEE_DEDUCTION_EDIT, n);
|
|
35
42
|
},
|
|
36
43
|
[t]
|
|
37
|
-
),
|
|
44
|
+
), g = o(
|
|
38
45
|
(n) => {
|
|
39
|
-
t(
|
|
46
|
+
t(i.EMPLOYEE_FEDERAL_TAXES_EDIT, { employeeId: a, federalTaxes: n });
|
|
40
47
|
},
|
|
41
48
|
[t, a]
|
|
42
|
-
),
|
|
43
|
-
t(
|
|
44
|
-
}, [t, a]),
|
|
49
|
+
), p = o(() => {
|
|
50
|
+
t(i.EMPLOYEE_STATE_TAXES_EDIT, { employeeId: a });
|
|
51
|
+
}, [t, a]), Y = o(
|
|
45
52
|
(n) => {
|
|
46
|
-
t(
|
|
53
|
+
t(i.EMPLOYEE_VIEW_FORM_TO_SIGN, { employeeId: a, formId: n });
|
|
47
54
|
},
|
|
48
55
|
[t, a]
|
|
49
|
-
),
|
|
56
|
+
), N = [
|
|
50
57
|
{
|
|
51
58
|
id: "basicDetails",
|
|
52
|
-
label:
|
|
59
|
+
label: c("tabs.basicDetails"),
|
|
53
60
|
content: null
|
|
54
61
|
},
|
|
55
62
|
{
|
|
56
63
|
id: "jobAndPay",
|
|
57
|
-
label:
|
|
64
|
+
label: c("tabs.jobAndPay"),
|
|
58
65
|
content: null
|
|
59
66
|
},
|
|
60
67
|
{
|
|
61
68
|
id: "taxes",
|
|
62
|
-
label:
|
|
69
|
+
label: c("tabs.taxes"),
|
|
63
70
|
content: null
|
|
64
71
|
},
|
|
65
72
|
{
|
|
66
73
|
id: "documents",
|
|
67
|
-
label:
|
|
74
|
+
label: c("tabs.documents"),
|
|
68
75
|
content: null
|
|
69
76
|
}
|
|
70
77
|
];
|
|
71
|
-
return /* @__PURE__ */ D(
|
|
78
|
+
return /* @__PURE__ */ D(b, { flexDirection: "column", gap: 32, children: [
|
|
79
|
+
/* @__PURE__ */ s(l, { fallback: null, children: /* @__PURE__ */ s(U, { employeeId: a }) }),
|
|
72
80
|
/* @__PURE__ */ s(
|
|
73
|
-
|
|
81
|
+
A.Tabs,
|
|
74
82
|
{
|
|
75
|
-
tabs:
|
|
76
|
-
selectedId:
|
|
83
|
+
tabs: N,
|
|
84
|
+
selectedId: e,
|
|
77
85
|
onSelectionChange: (n) => {
|
|
78
|
-
|
|
86
|
+
const h = n;
|
|
87
|
+
f(h), t(i.EMPLOYEE_DASHBOARD_TAB_CHANGE, { tab: h });
|
|
79
88
|
},
|
|
80
|
-
"aria-label":
|
|
89
|
+
"aria-label": c("tabsLabel")
|
|
81
90
|
}
|
|
82
91
|
),
|
|
83
|
-
/* @__PURE__ */ D(
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
/* @__PURE__ */ D(b, { flexDirection: "column", gap: 24, children: [
|
|
93
|
+
e === "basicDetails" && /* @__PURE__ */ s(l, { fallback: /* @__PURE__ */ s(E, { isLoading: !0 }), children: /* @__PURE__ */ s(
|
|
94
|
+
k,
|
|
86
95
|
{
|
|
87
96
|
employeeId: a,
|
|
88
|
-
onEditBasicDetails:
|
|
89
|
-
onManageHomeAddress:
|
|
90
|
-
onManageWorkAddress:
|
|
97
|
+
onEditBasicDetails: T,
|
|
98
|
+
onManageHomeAddress: O,
|
|
99
|
+
onManageWorkAddress: L
|
|
91
100
|
}
|
|
92
101
|
) }),
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
e === "jobAndPay" && /* @__PURE__ */ s(l, { fallback: /* @__PURE__ */ s(E, { isLoading: !0 }), children: /* @__PURE__ */ s(
|
|
103
|
+
H,
|
|
95
104
|
{
|
|
96
105
|
employeeId: a,
|
|
97
106
|
onEvent: t,
|
|
98
|
-
onEditCompensation:
|
|
99
|
-
onAddJob:
|
|
100
|
-
onAddAnotherJob:
|
|
101
|
-
onAddDeduction:
|
|
102
|
-
onEditDeduction:
|
|
107
|
+
onEditCompensation: M,
|
|
108
|
+
onAddJob: x,
|
|
109
|
+
onAddAnotherJob: P,
|
|
110
|
+
onAddDeduction: S,
|
|
111
|
+
onEditDeduction: C
|
|
103
112
|
}
|
|
104
113
|
) }),
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
e === "taxes" && /* @__PURE__ */ s(l, { fallback: /* @__PURE__ */ s(E, { isLoading: !0 }), children: /* @__PURE__ */ s(
|
|
115
|
+
F,
|
|
107
116
|
{
|
|
108
117
|
employeeId: a,
|
|
109
|
-
onEditFederalTaxes:
|
|
110
|
-
onEditStateTaxes:
|
|
118
|
+
onEditFederalTaxes: g,
|
|
119
|
+
onEditStateTaxes: p
|
|
111
120
|
}
|
|
112
121
|
) }),
|
|
113
|
-
|
|
122
|
+
e === "documents" && /* @__PURE__ */ s(l, { fallback: /* @__PURE__ */ s(E, { isLoading: !0 }), children: /* @__PURE__ */ s(J, { employeeId: a, onViewForm: Y }) })
|
|
114
123
|
] })
|
|
115
124
|
] });
|
|
116
125
|
}
|
|
117
|
-
function
|
|
126
|
+
function U({ employeeId: a }) {
|
|
127
|
+
const { t: r } = m("Employee.Dashboard"), t = u(), {
|
|
128
|
+
data: { employee: d }
|
|
129
|
+
} = R({ employeeId: a });
|
|
130
|
+
return /* @__PURE__ */ D(b, { flexDirection: "column", gap: 4, children: [
|
|
131
|
+
/* @__PURE__ */ s(t.Heading, { as: "h2", children: j({ first_name: d?.firstName, last_name: d?.lastName }) }),
|
|
132
|
+
/* @__PURE__ */ s(t.Text, { children: r("employeeRoleLabel") })
|
|
133
|
+
] });
|
|
134
|
+
}
|
|
135
|
+
function oa({
|
|
118
136
|
FallbackComponent: a,
|
|
119
|
-
...
|
|
137
|
+
...r
|
|
120
138
|
}) {
|
|
121
|
-
return /* @__PURE__ */ s(
|
|
139
|
+
return /* @__PURE__ */ s(V, { componentName: "Employee.Dashboard", FallbackComponent: a, children: /* @__PURE__ */ s(G, { ...r }) });
|
|
122
140
|
}
|
|
123
141
|
export {
|
|
124
|
-
|
|
142
|
+
oa as Dashboard
|
|
125
143
|
};
|
|
126
144
|
//# sourceMappingURL=Dashboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dashboard.js","sources":["../../../../src/components/Employee/Dashboard/Dashboard.tsx"],"sourcesContent":["import { Suspense, useState, useCallback } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { Job } from '@gusto/embedded-api/models/components/job'\nimport type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport type { GetV1EmployeesEmployeeIdFederalTaxesResponse } from '@gusto/embedded-api/models/operations/getv1employeesemployeeidfederaltaxes'\nimport { BasicDetailsViewWithData } from './BasicDetailsView'\nimport { JobAndPayView } from './JobAndPayView'\nimport { TaxesViewWithData } from './TaxesView'\nimport { DocumentsViewWithData } from './DocumentsView'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { BaseBoundaries, BaseLayout, type BaseComponentInterface } from '@/components/Base/Base'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\n\ntype EmployeeFederalTax = NonNullable<\n GetV1EmployeesEmployeeIdFederalTaxesResponse['employeeFederalTax']\n>\n\ntype DashboardTab = 'basicDetails' | 'jobAndPay' | 'taxes' | 'documents'\n\nexport interface DashboardProps extends BaseComponentInterface<'Employee.Dashboard'> {\n employeeId: string\n}\n\nfunction DashboardRoot({ employeeId, dictionary, onEvent }: DashboardProps) {\n useI18n('Employee.Dashboard')\n useComponentDictionary('Employee.Dashboard', dictionary)\n const { t } = useTranslation('Employee.Dashboard')\n const Components = useComponentContext()\n const [selectedTab, setSelectedTab] = useState<DashboardTab>('basicDetails')\n\n const handleEditBasicDetails = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_UPDATE, { employeeId })\n }, [onEvent, employeeId])\n\n const handleManageHomeAddress = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS, { employeeId })\n }, [onEvent, employeeId])\n\n const handleManageWorkAddress = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS, { employeeId })\n }, [onEvent, employeeId])\n\n const handleEditCompensation = useCallback(\n (job: Job) => {\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_CREATE, { employeeId, job })\n },\n [onEvent, employeeId],\n )\n\n const handleAddJob = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_JOB_ADD, { employeeId })\n }, [onEvent, employeeId])\n\n const handleAddAnotherJob = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_JOB_ADD_ANOTHER, { employeeId })\n }, [onEvent, employeeId])\n\n const handleAddDeduction = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD, { employeeId })\n }, [onEvent, employeeId])\n\n const handleEditDeduction = useCallback(\n (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n },\n [onEvent],\n )\n\n const handleEditFederalTaxes = useCallback(\n (federalTaxes: EmployeeFederalTax | undefined) => {\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_EDIT, { employeeId, federalTaxes })\n },\n [onEvent, employeeId],\n )\n\n const handleEditStateTaxes = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_EDIT, { employeeId })\n }, [onEvent, employeeId])\n\n const handleViewForm = useCallback(\n (formId: string) => {\n onEvent(componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN, { employeeId, formId })\n },\n [onEvent, employeeId],\n )\n\n const tabs = [\n {\n id: 'basicDetails' as const,\n label: t('tabs.basicDetails'),\n content: null,\n },\n {\n id: 'jobAndPay' as const,\n label: t('tabs.jobAndPay'),\n content: null,\n },\n {\n id: 'taxes' as const,\n label: t('tabs.taxes'),\n content: null,\n },\n {\n id: 'documents' as const,\n label: t('tabs.documents'),\n content: null,\n },\n ]\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Tabs\n tabs={tabs}\n selectedId={selectedTab}\n onSelectionChange={id => {\n setSelectedTab(id as DashboardTab)\n }}\n aria-label={t('tabsLabel')}\n />\n\n <Flex flexDirection=\"column\" gap={24}>\n {selectedTab === 'basicDetails' && (\n <Suspense fallback={<BaseLayout isLoading />}>\n <BasicDetailsViewWithData\n employeeId={employeeId}\n onEditBasicDetails={handleEditBasicDetails}\n onManageHomeAddress={handleManageHomeAddress}\n onManageWorkAddress={handleManageWorkAddress}\n />\n </Suspense>\n )}\n\n {selectedTab === 'jobAndPay' && (\n <Suspense fallback={<BaseLayout isLoading />}>\n <JobAndPayView\n employeeId={employeeId}\n onEvent={onEvent}\n onEditCompensation={handleEditCompensation}\n onAddJob={handleAddJob}\n onAddAnotherJob={handleAddAnotherJob}\n onAddDeduction={handleAddDeduction}\n onEditDeduction={handleEditDeduction}\n />\n </Suspense>\n )}\n\n {selectedTab === 'taxes' && (\n <Suspense fallback={<BaseLayout isLoading />}>\n <TaxesViewWithData\n employeeId={employeeId}\n onEditFederalTaxes={handleEditFederalTaxes}\n onEditStateTaxes={handleEditStateTaxes}\n />\n </Suspense>\n )}\n\n {selectedTab === 'documents' && (\n <Suspense fallback={<BaseLayout isLoading />}>\n <DocumentsViewWithData employeeId={employeeId} onViewForm={handleViewForm} />\n </Suspense>\n )}\n </Flex>\n </Flex>\n )\n}\n\nexport function Dashboard({\n FallbackComponent,\n ...props\n}: DashboardProps & BaseComponentInterface) {\n return (\n <BaseBoundaries componentName=\"Employee.Dashboard\" FallbackComponent={FallbackComponent}>\n <DashboardRoot {...props} />\n </BaseBoundaries>\n )\n}\n"],"names":["DashboardRoot","employeeId","dictionary","onEvent","useI18n","useComponentDictionary","t","useTranslation","Components","useComponentContext","selectedTab","setSelectedTab","useState","handleEditBasicDetails","useCallback","componentEvents","handleManageHomeAddress","handleManageWorkAddress","handleEditCompensation","job","handleAddJob","handleAddAnotherJob","handleAddDeduction","handleEditDeduction","deduction","handleEditFederalTaxes","federalTaxes","handleEditStateTaxes","handleViewForm","formId","tabs","jsxs","Flex","jsx","id","Suspense","BaseLayout","BasicDetailsViewWithData","JobAndPayView","TaxesViewWithData","DocumentsViewWithData","Dashboard","FallbackComponent","props","BaseBoundaries"],"mappings":";;;;;;;;;;;;AAyBA,SAASA,EAAc,EAAE,YAAAC,GAAY,YAAAC,GAAY,SAAAC,KAA2B;AAC1E,EAAAC,EAAQ,oBAAoB,GAC5BC,EAAuB,sBAAsBH,CAAU;AACvD,QAAM,EAAE,GAAAI,EAAA,IAAMC,EAAe,oBAAoB,GAC3CC,IAAaC,EAAA,GACb,CAACC,GAAaC,CAAc,IAAIC,EAAuB,cAAc,GAErEC,IAAyBC,EAAY,MAAM;AAC/C,IAAAX,EAAQY,EAAgB,iBAAiB,EAAE,YAAAd,EAAA,CAAY;AAAA,E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A,GAEzB;AAAA,MAGDP,MAAgB,eACf,gBAAAuB,EAACE,GAAA,EAAS,UAAU,gBAAAF,EAACG,GAAA,EAAW,WAAS,IAAC,GACxC,UAAA,gBAAAH;AAAA,QAACK;AAAA,QAAA;AAAA,UACC,YAAArC;AAAA,UACA,SAAAE;AAAA,UACA,oBAAoBe;AAAA,UACpB,UAAUE;AAAA,UACV,iBAAiBC;AAAA,UACjB,gBAAgBC;AAAA,UAChB,iBAAiBC;AAAA,QAAA;AAAA,MAAA,GAErB;AAAA,MAGDb,MAAgB,WACf,gBAAAuB,EAACE,GAAA,EAAS,UAAU,gBAAAF,EAACG,GAAA,EAAW,WAAS,IAAC,GACxC,UAAA,gBAAAH;AAAA,QAACM;AAAA,QAAA;AAAA,UACC,YAAAtC;AAAA,UACA,oBAAoBwB;AAAA,UACpB,kBAAkBE;AAAA,QAAA;AAAA,MAAA,GAEtB;AAAA,MAGDjB,MAAgB,eACf,gBAAAuB,EAACE,GAAA,EAAS,UAAU,gBAAAF,EAACG,GAAA,EAAW,WAAS,GAAA,CAAC,GACxC,UAAA,gBAAAH,EAACO,GAAA,EAAsB,YAAAvC,GAAwB,YAAY2B,GAAgB,EAAA,CAC7E;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,GACF;AAEJ;AAEO,SAASa,EAAU;AAAA,EACxB,mBAAAC;AAAA,EACA,GAAGC;AACL,GAA4C;AAC1C,SACE,gBAAAV,EAACW,KAAe,eAAc,sBAAqB,mBAAAF,GACjD,UAAA,gBAAAT,EAACjC,GAAA,EAAe,GAAG2C,EAAA,CAAO,EAAA,CAC5B;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"Dashboard.js","sources":["../../../../src/components/Employee/Dashboard/Dashboard.tsx"],"sourcesContent":["import { Suspense, useState, useCallback } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport type { Job } from '@gusto/embedded-api/models/components/job'\nimport type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport type { GetV1EmployeesEmployeeIdFederalTaxesResponse } from '@gusto/embedded-api/models/operations/getv1employeesemployeeidfederaltaxes'\nimport { BasicDetailsViewWithData } from './BasicDetailsView'\nimport { JobAndPayView } from './JobAndPayView'\nimport { TaxesViewWithData } from './TaxesView'\nimport { DocumentsViewWithData } from './DocumentsView'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { BaseBoundaries, BaseLayout, type BaseComponentInterface } from '@/components/Base/Base'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\ntype EmployeeFederalTax = NonNullable<\n GetV1EmployeesEmployeeIdFederalTaxesResponse['employeeFederalTax']\n>\n\nexport type DashboardTab = 'basicDetails' | 'jobAndPay' | 'taxes' | 'documents'\n\nexport interface DashboardProps extends BaseComponentInterface<'Employee.Dashboard'> {\n employeeId: string\n selectedTab?: DashboardTab\n}\n\nfunction DashboardRoot({\n employeeId,\n dictionary,\n onEvent,\n selectedTab: controlledTab,\n}: DashboardProps) {\n useI18n('Employee.Dashboard')\n useComponentDictionary('Employee.Dashboard', dictionary)\n const { t } = useTranslation('Employee.Dashboard')\n const Components = useComponentContext()\n const [internalTab, setInternalTab] = useState<DashboardTab>('basicDetails')\n const selectedTab = controlledTab ?? internalTab\n\n const handleEditBasicDetails = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_UPDATE, { employeeId })\n }, [onEvent, employeeId])\n\n const handleManageHomeAddress = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS, { employeeId })\n }, [onEvent, employeeId])\n\n const handleManageWorkAddress = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS, { employeeId })\n }, [onEvent, employeeId])\n\n const handleEditCompensation = useCallback(\n (job: Job) => {\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_CREATE, { employeeId, job })\n },\n [onEvent, employeeId],\n )\n\n const handleAddJob = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_JOB_ADD, { employeeId })\n }, [onEvent, employeeId])\n\n const handleAddAnotherJob = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_JOB_ADD_ANOTHER, { employeeId })\n }, [onEvent, employeeId])\n\n const handleAddDeduction = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD, { employeeId })\n }, [onEvent, employeeId])\n\n const handleEditDeduction = useCallback(\n (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n },\n [onEvent],\n )\n\n const handleEditFederalTaxes = useCallback(\n (federalTaxes: EmployeeFederalTax | undefined) => {\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_EDIT, { employeeId, federalTaxes })\n },\n [onEvent, employeeId],\n )\n\n const handleEditStateTaxes = useCallback(() => {\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_EDIT, { employeeId })\n }, [onEvent, employeeId])\n\n const handleViewForm = useCallback(\n (formId: string) => {\n onEvent(componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN, { employeeId, formId })\n },\n [onEvent, employeeId],\n )\n\n const tabs = [\n {\n id: 'basicDetails' as const,\n label: t('tabs.basicDetails'),\n content: null,\n },\n {\n id: 'jobAndPay' as const,\n label: t('tabs.jobAndPay'),\n content: null,\n },\n {\n id: 'taxes' as const,\n label: t('tabs.taxes'),\n content: null,\n },\n {\n id: 'documents' as const,\n label: t('tabs.documents'),\n content: null,\n },\n ]\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Suspense fallback={null}>\n <DashboardHeader employeeId={employeeId} />\n </Suspense>\n <Components.Tabs\n tabs={tabs}\n selectedId={selectedTab}\n onSelectionChange={id => {\n const next = id as DashboardTab\n setInternalTab(next)\n onEvent(componentEvents.EMPLOYEE_DASHBOARD_TAB_CHANGE, { tab: next })\n }}\n aria-label={t('tabsLabel')}\n />\n\n <Flex flexDirection=\"column\" gap={24}>\n {selectedTab === 'basicDetails' && (\n <Suspense fallback={<BaseLayout isLoading />}>\n <BasicDetailsViewWithData\n employeeId={employeeId}\n onEditBasicDetails={handleEditBasicDetails}\n onManageHomeAddress={handleManageHomeAddress}\n onManageWorkAddress={handleManageWorkAddress}\n />\n </Suspense>\n )}\n\n {selectedTab === 'jobAndPay' && (\n <Suspense fallback={<BaseLayout isLoading />}>\n <JobAndPayView\n employeeId={employeeId}\n onEvent={onEvent}\n onEditCompensation={handleEditCompensation}\n onAddJob={handleAddJob}\n onAddAnotherJob={handleAddAnotherJob}\n onAddDeduction={handleAddDeduction}\n onEditDeduction={handleEditDeduction}\n />\n </Suspense>\n )}\n\n {selectedTab === 'taxes' && (\n <Suspense fallback={<BaseLayout isLoading />}>\n <TaxesViewWithData\n employeeId={employeeId}\n onEditFederalTaxes={handleEditFederalTaxes}\n onEditStateTaxes={handleEditStateTaxes}\n />\n </Suspense>\n )}\n\n {selectedTab === 'documents' && (\n <Suspense fallback={<BaseLayout isLoading />}>\n <DocumentsViewWithData employeeId={employeeId} onViewForm={handleViewForm} />\n </Suspense>\n )}\n </Flex>\n </Flex>\n )\n}\n\nfunction DashboardHeader({ employeeId }: { employeeId: string }) {\n const { t } = useTranslation('Employee.Dashboard')\n const Components = useComponentContext()\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n\n return (\n <Flex flexDirection=\"column\" gap={4}>\n <Components.Heading as=\"h2\">\n {firstLastName({ first_name: employee?.firstName, last_name: employee?.lastName })}\n </Components.Heading>\n <Components.Text>{t('employeeRoleLabel')}</Components.Text>\n </Flex>\n )\n}\n\nexport function Dashboard({\n FallbackComponent,\n ...props\n}: DashboardProps & BaseComponentInterface) {\n return (\n <BaseBoundaries componentName=\"Employee.Dashboard\" FallbackComponent={FallbackComponent}>\n <DashboardRoot {...props} />\n </BaseBoundaries>\n )\n}\n"],"names":["DashboardRoot","employeeId","dictionary","onEvent","controlledTab","useI18n","useComponentDictionary","t","useTranslation","Components","useComponentContext","internalTab","setInternalTab","useState","selectedTab","handleEditBasicDetails","useCallback","componentEvents","handleManageHomeAddress","handleManageWorkAddress","handleEditCompensation","job","handleAddJob","handleAddAnotherJob","handleAddDeduction","handleEditDeduction","deduction","handleEditFederalTaxes","federalTaxes","handleEditStateTaxes","handleViewForm","formId","tabs","jsxs","Flex","jsx","Suspense","DashboardHeader","id","next","BaseLayout","BasicDetailsViewWithData","JobAndPayView","TaxesViewWithData","DocumentsViewWithData","employee","useEmployeesGetSuspense","firstLastName","Dashboard","FallbackComponent","props","BaseBoundaries"],"mappings":";;;;;;;;;;;;;;AA4BA,SAASA,EAAc;AAAA,EACrB,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAaC;AACf,GAAmB;AACjB,EAAAC,EAAQ,oBAAoB,GAC5BC,EAAuB,sBAAsBJ,CAAU;AACvD,QAAM,EAAE,GAAAK,EAAA,IAAMC,EAAe,oBAAoB,GAC3CC,IAAaC,EAAA,GACb,CAACC,GAAaC,CAAc,IAAIC,EAAuB,cAAc,GACrEC,IAAcV,KAAiBO,GAE/BI,IAAyBC,EAAY,MAAM;AAC/C,IAAAb,EAAQc,EAAgB,iBAAiB,EAAE,YAAAhB,EAAA,CAAY;AAAA,EACzD,GAAG,CAACE,GAASF,CAAU,CAAC,GAElBiB,IAA0BF,EAAY,MAAM;AAChD,IAAAb,EAAQc,EAAgB,uBAAuB,EAAE,YAAAhB,EAAA,CAAY;AAAA,EAC/D,GAAG,CAACE,GAASF,CAAU,CAAC,GAElBkB,IAA0BH,EAAY,MAAM;AAChD,IAAAb,EAAQc,EAAgB,uBAAuB,EAAE,YAAAhB,EAAA,CAAY;AAAA,EAC/D,GAAG,CAACE,GAASF,CAAU,CAAC,GAElBmB,IAAyBJ;AAAA,IAC7B,CAACK,MAAa;AACZ,MAAAlB,EAAQc,EAAgB,8BAA8B,EAAE,YAAAh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EAACnC,GAAA,EAAe,GAAGkD,EAAA,CAAO,EAAA,CAC5B;AAEJ;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Job } from '@gusto/embedded-api/models/components/job';
|
|
2
|
+
import { DashboardTab } from './Dashboard';
|
|
2
3
|
import { FlowContextInterface } from '../../Flow/useFlow';
|
|
3
|
-
export type DashboardSuccessAlert = 'bankAccountAdded' | 'bankAccountDeleted' | 'splitUpdated' | 'deductionAdded' | 'deductionUpdated' | 'deductionDeleted';
|
|
4
|
+
export type DashboardSuccessAlert = 'bankAccountAdded' | 'bankAccountDeleted' | 'splitUpdated' | 'deductionAdded' | 'deductionUpdated' | 'deductionDeleted' | 'jobAdded';
|
|
4
5
|
export interface DashboardContextInterface extends FlowContextInterface {
|
|
5
6
|
employeeId: string;
|
|
6
7
|
formId?: string;
|
|
@@ -9,6 +10,9 @@ export interface DashboardContextInterface extends FlowContextInterface {
|
|
|
9
10
|
/** Set by the EMPLOYEE_DEDUCTION_EDIT transition; consumed by
|
|
10
11
|
* DeductionFormContextual to pre-populate the form. */
|
|
11
12
|
editingDeductionId?: string;
|
|
13
|
+
/** Persists the active Dashboard tab across sub-flows so Cancel/Back
|
|
14
|
+
* returns to the originating tab instead of resetting to basic details. */
|
|
15
|
+
selectedTab?: DashboardTab;
|
|
12
16
|
}
|
|
13
17
|
export declare function DashboardViewContextual(): import("react/jsx-runtime").JSX.Element;
|
|
14
18
|
export declare function HomeAddressContextual(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,6 +24,6 @@ export declare function PaymentBankFormContextual(): import("react/jsx-runtime")
|
|
|
20
24
|
export declare function PaymentSplitViewContextual(): import("react/jsx-runtime").JSX.Element;
|
|
21
25
|
export declare function DocumentManagerContextual(): import("react/jsx-runtime").JSX.Element;
|
|
22
26
|
export declare function DeductionFormContextual(): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export declare function
|
|
24
|
-
export declare function
|
|
25
|
-
export declare function
|
|
27
|
+
export declare function AddJobContextual(): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function EditCompensationContextual(): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare function AddAnotherJobContextual(): import("react/jsx-runtime").JSX.Element;
|