@gusto/embedded-react-sdk 0.45.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- 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/EditCompensation/EditCompensation.d.ts +11 -0
- package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js +230 -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/index.d.ts +3 -0
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js +6 -6
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js +4 -4
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +114 -111
- 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 +64 -58
- package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Employee/Dashboard/DashboardComponents.d.ts +5 -1
- package/dist/components/Employee/Dashboard/DashboardComponents.js +82 -65
- 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 +358 -338
- package/dist/components/Employee/Dashboard/JobAndPayView.js.map +1 -1
- package/dist/components/Employee/Dashboard/JobAndPayView.module.scss.js +8 -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 +16 -5
- package/dist/components/Employee/Dashboard/dashboardStateMachine.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 +55 -56
- 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/FederalTaxes/shared/useFederalTaxesForm/fields.js +4 -4
- 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/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/PolicySettings/PolicySettingsPresentation.js +52 -40
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js.map +1 -1
- package/dist/i18n/en/Employee.Compensation.json.js +48 -44
- package/dist/i18n/en/Employee.Compensation.json.js.map +1 -1
- package/dist/i18n/en/Employee.Dashboard.json.js +1 -1
- package/dist/i18n/en/Employee.DocumentManager.json.js +1 -1
- package/dist/i18n/en/common.json.d.ts +7 -0
- package/dist/shared/constants.d.ts +2 -0
- package/dist/shared/constants.js +19 -18
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +22 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { state as d, transition as n, reduce as E } from "robot3";
|
|
2
|
-
import { ProfileContextual as s, HomeAddressContextual as c, WorkAddressContextual as
|
|
2
|
+
import { ProfileContextual as s, HomeAddressContextual as c, WorkAddressContextual as A, FederalTaxesContextual as u, StateTaxesContextual as m, PaymentBankFormContextual as C, PaymentSplitViewContextual as _, DocumentManagerContextual as p, AddJobPlaceholderContextual as D, EditCompensationContextual as O, AddAnotherJobPlaceholderContextual as x, DeductionFormContextual as r, DashboardViewContextual as i } from "./DashboardComponents.js";
|
|
3
3
|
import { componentEvents as t } from "../../../shared/constants.js";
|
|
4
4
|
const o = E(
|
|
5
5
|
(e) => ({
|
|
@@ -49,7 +49,7 @@ const o = E(
|
|
|
49
49
|
E(
|
|
50
50
|
(e) => ({
|
|
51
51
|
...e,
|
|
52
|
-
component:
|
|
52
|
+
component: A,
|
|
53
53
|
header: { type: "minimal" },
|
|
54
54
|
successAlert: null
|
|
55
55
|
})
|
|
@@ -61,7 +61,7 @@ const o = E(
|
|
|
61
61
|
E(
|
|
62
62
|
(e) => ({
|
|
63
63
|
...e,
|
|
64
|
-
component:
|
|
64
|
+
component: u,
|
|
65
65
|
header: { type: "minimal" },
|
|
66
66
|
successAlert: null
|
|
67
67
|
})
|
|
@@ -135,7 +135,7 @@ const o = E(
|
|
|
135
135
|
E(
|
|
136
136
|
(e, l) => ({
|
|
137
137
|
...e,
|
|
138
|
-
component:
|
|
138
|
+
component: O,
|
|
139
139
|
header: { type: "minimal" },
|
|
140
140
|
currentJob: l.payload.job,
|
|
141
141
|
successAlert: null
|
|
@@ -148,7 +148,7 @@ const o = E(
|
|
|
148
148
|
E(
|
|
149
149
|
(e) => ({
|
|
150
150
|
...e,
|
|
151
|
-
component:
|
|
151
|
+
component: x,
|
|
152
152
|
header: { type: "minimal" },
|
|
153
153
|
currentJob: null,
|
|
154
154
|
successAlert: null
|
|
@@ -210,6 +210,16 @@ const o = E(
|
|
|
210
210
|
successAlert: null
|
|
211
211
|
})
|
|
212
212
|
)
|
|
213
|
+
),
|
|
214
|
+
n(
|
|
215
|
+
t.EMPLOYEE_DASHBOARD_TAB_CHANGE,
|
|
216
|
+
"index",
|
|
217
|
+
E(
|
|
218
|
+
(e, l) => ({
|
|
219
|
+
...e,
|
|
220
|
+
selectedTab: l.payload.tab
|
|
221
|
+
})
|
|
222
|
+
)
|
|
213
223
|
)
|
|
214
224
|
),
|
|
215
225
|
homeAddress: d(n(t.CANCEL, "index", o)),
|
|
@@ -255,6 +265,7 @@ const o = E(
|
|
|
255
265
|
),
|
|
256
266
|
addJob: d(n(t.CANCEL, "index", o)),
|
|
257
267
|
editCompensation: d(
|
|
268
|
+
n(t.EMPLOYEE_COMPENSATION_DONE, "index", o),
|
|
258
269
|
n(t.CANCEL, "index", o)
|
|
259
270
|
),
|
|
260
271
|
addAnotherJob: d(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboardStateMachine.js","sources":["../../../../src/components/Employee/Dashboard/dashboardStateMachine.ts"],"sourcesContent":["import { transition, reduce, state } from 'robot3'\nimport type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport type { Job } from '@gusto/embedded-api/models/components/job'\nimport {\n DashboardViewContextual,\n HomeAddressContextual,\n WorkAddressContextual,\n FederalTaxesContextual,\n StateTaxesContextual,\n ProfileContextual,\n PaymentBankFormContextual,\n PaymentSplitViewContextual,\n DocumentManagerContextual,\n DeductionFormContextual,\n AddJobPlaceholderContextual,\n EditCompensationPlaceholderContextual,\n AddAnotherJobPlaceholderContextual,\n type DashboardContextInterface,\n} from './DashboardComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\n\ntype EventPayloads = {\n [componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN]: { employeeId: string; formId: string }\n [componentEvents.EMPLOYEE_DEDUCTION_EDIT]: Garnishment\n [componentEvents.EMPLOYEE_COMPENSATION_CREATE]: { employeeId: string; job: Job }\n}\n\nconst returnToIndex = reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: DashboardViewContextual,\n header: null,\n currentJob: null,\n successAlert: null,\n }),\n)\n\nconst returnToIndexWithAlert = (alert: DashboardContextInterface['successAlert']) =>\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: DashboardViewContextual,\n header: null,\n currentJob: null,\n successAlert: alert,\n }),\n )\n\nexport const dashboardStateMachine = {\n index: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_UPDATE,\n 'profile',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: ProfileContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_HOME_ADDRESS,\n 'homeAddress',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: HomeAddressContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_WORK_ADDRESS,\n 'workAddress',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: WorkAddressContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_FEDERAL_TAXES_EDIT,\n 'federalTaxes',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: FederalTaxesContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_STATE_TAXES_EDIT,\n 'stateTaxes',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: StateTaxesContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_BANK_ACCOUNT_CREATE,\n 'paymentBankForm',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: PaymentBankFormContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_SPLIT_PAYCHECK,\n 'paymentSplitView',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: PaymentSplitViewContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN,\n 'documentManager',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN>,\n ): DashboardContextInterface => ({\n ...ctx,\n component: DocumentManagerContextual,\n header: { type: 'minimal' },\n formId: ev.payload.formId,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_JOB_ADD,\n 'addJob',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: AddJobPlaceholderContextual,\n header: { type: 'minimal' },\n currentJob: null,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_COMPENSATION_CREATE,\n 'editCompensation',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.EMPLOYEE_COMPENSATION_CREATE>,\n ): DashboardContextInterface => ({\n ...ctx,\n component: EditCompensationPlaceholderContextual,\n header: { type: 'minimal' },\n currentJob: ev.payload.job,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_JOB_ADD_ANOTHER,\n 'addAnotherJob',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: AddAnotherJobPlaceholderContextual,\n header: { type: 'minimal' },\n currentJob: null,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_BANK_ACCOUNT_DELETED,\n 'index',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n successAlert: 'bankAccountDeleted',\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_ADD,\n 'deductionForm',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: DeductionFormContextual,\n header: { type: 'minimal' },\n successAlert: null,\n editingDeductionId: undefined,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_EDIT,\n 'deductionForm',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.EMPLOYEE_DEDUCTION_EDIT>,\n ): DashboardContextInterface => ({\n ...ctx,\n component: DeductionFormContextual,\n header: { type: 'minimal' },\n successAlert: null,\n editingDeductionId: ev.payload.uuid,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_DELETED,\n 'index',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n successAlert: 'deductionDeleted',\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DISMISS,\n 'index',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n successAlert: null,\n }),\n ),\n ),\n ),\n homeAddress: state<MachineTransition>(transition(componentEvents.CANCEL, 'index', returnToIndex)),\n workAddress: state<MachineTransition>(transition(componentEvents.CANCEL, 'index', returnToIndex)),\n federalTaxes: state<MachineTransition>(\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n transition(componentEvents.EMPLOYEE_FEDERAL_TAXES_DONE, 'index', returnToIndex),\n ),\n stateTaxes: state<MachineTransition>(transition(componentEvents.CANCEL, 'index', returnToIndex)),\n profile: state<MachineTransition>(transition(componentEvents.CANCEL, 'index', returnToIndex)),\n paymentBankForm: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_BANK_ACCOUNT_CREATED,\n 'index',\n returnToIndexWithAlert('bankAccountAdded'),\n ),\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n paymentSplitView: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_PAYMENT_METHOD_UPDATED,\n 'index',\n returnToIndexWithAlert('splitUpdated'),\n ),\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n documentManager: state<MachineTransition>(\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n deductionForm: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_CREATED,\n 'index',\n returnToIndexWithAlert('deductionAdded'),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_UPDATED,\n 'index',\n returnToIndexWithAlert('deductionUpdated'),\n ),\n transition(componentEvents.EMPLOYEE_DEDUCTION_CANCEL, 'index', returnToIndex),\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n addJob: state<MachineTransition>(transition(componentEvents.CANCEL, 'index', returnToIndex)),\n editCompensation: state<MachineTransition>(\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n addAnotherJob: state<MachineTransition>(\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n}\n"],"names":["returnToIndex","reduce","ctx","DashboardViewContextual","returnToIndexWithAlert","alert","dashboardStateMachine","state","transition","componentEvents","ProfileContextual","HomeAddressContextual","WorkAddressContextual","FederalTaxesContextual","StateTaxesContextual","PaymentBankFormContextual","PaymentSplitViewContextual","ev","DocumentManagerContextual","AddJobPlaceholderContextual","EditCompensationPlaceholderContextual","AddAnotherJobPlaceholderContextual","DeductionFormContextual"],"mappings":";;;AA4BA,MAAMA,IAAgBC;AAAA,EACpB,CAACC,OAA+D;AAAA,IAC9D,GAAGA;AAAA,IACH,WAAWC;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,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"}
|
|
1
|
+
{"version":3,"file":"dashboardStateMachine.js","sources":["../../../../src/components/Employee/Dashboard/dashboardStateMachine.ts"],"sourcesContent":["import { transition, reduce, state } from 'robot3'\nimport type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport type { Job } from '@gusto/embedded-api/models/components/job'\nimport type { DashboardTab } from './Dashboard'\nimport {\n DashboardViewContextual,\n HomeAddressContextual,\n WorkAddressContextual,\n FederalTaxesContextual,\n StateTaxesContextual,\n ProfileContextual,\n PaymentBankFormContextual,\n PaymentSplitViewContextual,\n DocumentManagerContextual,\n DeductionFormContextual,\n AddJobPlaceholderContextual,\n EditCompensationContextual,\n AddAnotherJobPlaceholderContextual,\n type DashboardContextInterface,\n} from './DashboardComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\n\ntype EventPayloads = {\n [componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN]: { employeeId: string; formId: string }\n [componentEvents.EMPLOYEE_DEDUCTION_EDIT]: Garnishment\n [componentEvents.EMPLOYEE_COMPENSATION_CREATE]: { employeeId: string; job: Job }\n [componentEvents.EMPLOYEE_DASHBOARD_TAB_CHANGE]: { tab: DashboardTab }\n}\n\nconst returnToIndex = reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: DashboardViewContextual,\n header: null,\n currentJob: null,\n successAlert: null,\n }),\n)\n\nconst returnToIndexWithAlert = (alert: DashboardContextInterface['successAlert']) =>\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: DashboardViewContextual,\n header: null,\n currentJob: null,\n successAlert: alert,\n }),\n )\n\nexport const dashboardStateMachine = {\n index: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_UPDATE,\n 'profile',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: ProfileContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_HOME_ADDRESS,\n 'homeAddress',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: HomeAddressContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_WORK_ADDRESS,\n 'workAddress',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: WorkAddressContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_FEDERAL_TAXES_EDIT,\n 'federalTaxes',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: FederalTaxesContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_STATE_TAXES_EDIT,\n 'stateTaxes',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: StateTaxesContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_BANK_ACCOUNT_CREATE,\n 'paymentBankForm',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: PaymentBankFormContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_SPLIT_PAYCHECK,\n 'paymentSplitView',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: PaymentSplitViewContextual,\n header: { type: 'minimal' },\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN,\n 'documentManager',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN>,\n ): DashboardContextInterface => ({\n ...ctx,\n component: DocumentManagerContextual,\n header: { type: 'minimal' },\n formId: ev.payload.formId,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_JOB_ADD,\n 'addJob',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: AddJobPlaceholderContextual,\n header: { type: 'minimal' },\n currentJob: null,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_COMPENSATION_CREATE,\n 'editCompensation',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.EMPLOYEE_COMPENSATION_CREATE>,\n ): DashboardContextInterface => ({\n ...ctx,\n component: EditCompensationContextual,\n header: { type: 'minimal' },\n currentJob: ev.payload.job,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_JOB_ADD_ANOTHER,\n 'addAnotherJob',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: AddAnotherJobPlaceholderContextual,\n header: { type: 'minimal' },\n currentJob: null,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_BANK_ACCOUNT_DELETED,\n 'index',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n successAlert: 'bankAccountDeleted',\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_ADD,\n 'deductionForm',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: DeductionFormContextual,\n header: { type: 'minimal' },\n successAlert: null,\n editingDeductionId: undefined,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_EDIT,\n 'deductionForm',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.EMPLOYEE_DEDUCTION_EDIT>,\n ): DashboardContextInterface => ({\n ...ctx,\n component: DeductionFormContextual,\n header: { type: 'minimal' },\n successAlert: null,\n editingDeductionId: ev.payload.uuid,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_DELETED,\n 'index',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n successAlert: 'deductionDeleted',\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DISMISS,\n 'index',\n reduce(\n (ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DASHBOARD_TAB_CHANGE,\n 'index',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.EMPLOYEE_DASHBOARD_TAB_CHANGE>,\n ): DashboardContextInterface => ({\n ...ctx,\n selectedTab: ev.payload.tab,\n }),\n ),\n ),\n ),\n homeAddress: state<MachineTransition>(transition(componentEvents.CANCEL, 'index', returnToIndex)),\n workAddress: state<MachineTransition>(transition(componentEvents.CANCEL, 'index', returnToIndex)),\n federalTaxes: state<MachineTransition>(\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n transition(componentEvents.EMPLOYEE_FEDERAL_TAXES_DONE, 'index', returnToIndex),\n ),\n stateTaxes: state<MachineTransition>(transition(componentEvents.CANCEL, 'index', returnToIndex)),\n profile: state<MachineTransition>(transition(componentEvents.CANCEL, 'index', returnToIndex)),\n paymentBankForm: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_BANK_ACCOUNT_CREATED,\n 'index',\n returnToIndexWithAlert('bankAccountAdded'),\n ),\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n paymentSplitView: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_PAYMENT_METHOD_UPDATED,\n 'index',\n returnToIndexWithAlert('splitUpdated'),\n ),\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n documentManager: state<MachineTransition>(\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n deductionForm: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_CREATED,\n 'index',\n returnToIndexWithAlert('deductionAdded'),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_UPDATED,\n 'index',\n returnToIndexWithAlert('deductionUpdated'),\n ),\n transition(componentEvents.EMPLOYEE_DEDUCTION_CANCEL, 'index', returnToIndex),\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n addJob: state<MachineTransition>(transition(componentEvents.CANCEL, 'index', returnToIndex)),\n editCompensation: state<MachineTransition>(\n transition(componentEvents.EMPLOYEE_COMPENSATION_DONE, 'index', returnToIndex),\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n addAnotherJob: state<MachineTransition>(\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n}\n"],"names":["returnToIndex","reduce","ctx","DashboardViewContextual","returnToIndexWithAlert","alert","dashboardStateMachine","state","transition","componentEvents","ProfileContextual","HomeAddressContextual","WorkAddressContextual","FederalTaxesContextual","StateTaxesContextual","PaymentBankFormContextual","PaymentSplitViewContextual","ev","DocumentManagerContextual","AddJobPlaceholderContextual","EditCompensationContextual","AddAnotherJobPlaceholderContextual","DeductionFormContextual"],"mappings":";;;AA8BA,MAAMA,IAAgBC;AAAA,EACpB,CAACC,OAA+D;AAAA,IAC9D,GAAGA;AAAA,IACH,WAAWC;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,cAAc;AAAA,EAAA;AAElB,GAEMC,IAAyB,CAACC,MAC9BJ;AAAA,EACE,CAACC,OAA+D;AAAA,IAC9D,GAAGA;AAAA,IACH,WAAWC;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,cAAcE;AAAA,EAAA;AAElB,GAEWC,IAAwB;AAAA,EACnC,OAAOC;AAAA,IACLC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAR;AAAA,QACE,CAACC,OAA+D;AAAA,UAC9D,GAAGA;AAAA,UACH,WAAWQ;AAAA,UACX,QAAQ,EAAE,MAAM,UAAA;AAAA,UAChB,cAAc;AAAA,Q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,EAAyBC,EAAWC,EAAgB,QAAQ,SAAST,CAAa,CAAC;AAAA,EAC5F,iBAAiBO;AAAA,IACfC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAL,EAAuB,kBAAkB;AAAA,IAAA;AAAA,IAE3CI,EAAWC,EAAgB,QAAQ,SAAST,CAAa;AAAA,EAAA;AAAA,EAE3D,kBAAkBO;AAAA,IAChBC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAL,EAAuB,cAAc;AAAA,IAAA;AAAA,IAEvCI,EAAWC,EAAgB,QAAQ,SAAST,CAAa;AAAA,EAAA;AAAA,EAE3D,iBAAiBO;AAAA,IACfC,EAAWC,EAAgB,QAAQ,SAAST,CAAa;AAAA,EAAA;AAAA,EAE3D,eAAeO;AAAA,IACbC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAL,EAAuB,gBAAgB;AAAA,IAAA;AAAA,IAEzCI;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAL,EAAuB,kBAAkB;AAAA,IAAA;AAAA,IAE3CI,EAAWC,EAAgB,2BAA2B,SAAST,CAAa;AAAA,IAC5EQ,EAAWC,EAAgB,QAAQ,SAAST,CAAa;AAAA,EAAA;AAAA,EAE3D,QAAQO,EAAyBC,EAAWC,EAAgB,QAAQ,SAAST,CAAa,CAAC;AAAA,EAC3F,kBAAkBO;AAAA,IAChBC,EAAWC,EAAgB,4BAA4B,SAAST,CAAa;AAAA,IAC7EQ,EAAWC,EAAgB,QAAQ,SAAST,CAAa;AAAA,EAAA;AAAA,EAE3D,eAAeO;AAAA,IACbC,EAAWC,EAAgB,QAAQ,SAAST,CAAa;AAAA,EAAA;AAE7D;"}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { Employee } from '@gusto/embedded-api/models/components/employee';
|
|
2
2
|
import { EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress';
|
|
3
3
|
import { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress';
|
|
4
|
-
import {
|
|
4
|
+
import { BaseHookReady } from '../../../../partner-hook-utils/types';
|
|
5
5
|
export interface UseEmployeeBasicDetailsProps {
|
|
6
6
|
employeeId: string;
|
|
7
7
|
}
|
|
8
|
-
type
|
|
9
|
-
employee
|
|
8
|
+
export type UseEmployeeBasicDetailsResult = BaseHookReady<{
|
|
9
|
+
employee?: Employee;
|
|
10
10
|
currentHomeAddress?: EmployeeAddress;
|
|
11
11
|
currentWorkAddress?: EmployeeWorkAddress;
|
|
12
12
|
}, {
|
|
13
13
|
isPending: boolean;
|
|
14
|
+
isEmployeeLoading: boolean;
|
|
15
|
+
isHomeAddressLoading: boolean;
|
|
16
|
+
isWorkAddressLoading: boolean;
|
|
14
17
|
}>;
|
|
15
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Phase B: each query runs non-Suspense so the three cards (employee
|
|
20
|
+
* info, home address, work address) can paint independently. The
|
|
21
|
+
* consuming view branches on the per-query loading flags to render
|
|
22
|
+
* skeletons inside the box bodies.
|
|
23
|
+
*/
|
|
16
24
|
export declare function useEmployeeBasicDetails({ employeeId, }: UseEmployeeBasicDetailsProps): UseEmployeeBasicDetailsResult;
|
|
17
|
-
export {};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { useMemo as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { composeErrorHandler as
|
|
6
|
-
function
|
|
7
|
-
employeeId:
|
|
1
|
+
import { useMemo as n } from "react";
|
|
2
|
+
import { useEmployeesGet as l } from "@gusto/embedded-api/react-query/employeesGet";
|
|
3
|
+
import { useEmployeeAddressesGet as p } from "@gusto/embedded-api/react-query/employeeAddressesGet";
|
|
4
|
+
import { useEmployeeAddressesGetWorkAddresses as y } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
|
|
5
|
+
import { composeErrorHandler as u } from "../../../../partner-hook-utils/composeErrorHandler.js";
|
|
6
|
+
function E({
|
|
7
|
+
employeeId: r
|
|
8
8
|
}) {
|
|
9
|
-
const s = y(
|
|
10
|
-
employeeId:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return
|
|
14
|
-
isLoading: !0,
|
|
15
|
-
errorHandling: m
|
|
16
|
-
} : {
|
|
9
|
+
const e = l({ employeeId: r }, { staleTime: 1 / 0 }), s = p({ employeeId: r }, { staleTime: 1 / 0 }), o = y(
|
|
10
|
+
{ employeeId: r },
|
|
11
|
+
{ staleTime: 1 / 0 }
|
|
12
|
+
), a = e.data?.employee, t = s.data?.employeeAddressList, d = o.data?.employeeWorkAddressesList, m = n(() => t?.find((i) => i.active), [t]), c = n(() => d?.find((i) => i.active), [d]);
|
|
13
|
+
return {
|
|
17
14
|
isLoading: !1,
|
|
18
15
|
data: {
|
|
19
|
-
employee:
|
|
20
|
-
currentHomeAddress:
|
|
21
|
-
currentWorkAddress:
|
|
16
|
+
employee: a,
|
|
17
|
+
currentHomeAddress: m,
|
|
18
|
+
currentWorkAddress: c
|
|
22
19
|
},
|
|
23
20
|
status: {
|
|
24
|
-
isPending:
|
|
21
|
+
isPending: e.isFetching || s.isFetching || o.isFetching,
|
|
22
|
+
isEmployeeLoading: e.isLoading,
|
|
23
|
+
isHomeAddressLoading: s.isLoading,
|
|
24
|
+
isWorkAddressLoading: o.isLoading
|
|
25
25
|
},
|
|
26
|
-
errorHandling:
|
|
26
|
+
errorHandling: u([e, s, o])
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
export {
|
|
30
|
-
|
|
30
|
+
E as useEmployeeBasicDetails
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=useEmployeeBasicDetails.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEmployeeBasicDetails.js","sources":["../../../../../src/components/Employee/Dashboard/hooks/useEmployeeBasicDetails.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport {
|
|
1
|
+
{"version":3,"file":"useEmployeeBasicDetails.js","sources":["../../../../../src/components/Employee/Dashboard/hooks/useEmployeeBasicDetails.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useEmployeesGet } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useEmployeeAddressesGet } from '@gusto/embedded-api/react-query/employeeAddressesGet'\nimport { useEmployeeAddressesGetWorkAddresses } from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\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 { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport type { BaseHookReady } from '@/partner-hook-utils/types'\n\nexport interface UseEmployeeBasicDetailsProps {\n employeeId: string\n}\n\nexport type UseEmployeeBasicDetailsResult = BaseHookReady<\n {\n employee?: Employee\n currentHomeAddress?: EmployeeAddress\n currentWorkAddress?: EmployeeWorkAddress\n },\n {\n isPending: boolean\n isEmployeeLoading: boolean\n isHomeAddressLoading: boolean\n isWorkAddressLoading: boolean\n }\n>\n\n/**\n * Phase B: each query runs non-Suspense so the three cards (employee\n * info, home address, work address) can paint independently. The\n * consuming view branches on the per-query loading flags to render\n * skeletons inside the box bodies.\n */\nexport function useEmployeeBasicDetails({\n employeeId,\n}: UseEmployeeBasicDetailsProps): UseEmployeeBasicDetailsResult {\n // staleTime: Infinity — see useEmployeeCompensation for rationale (SDK\n // QueryClient invalidates on any mutation success).\n //\n // No `include: ['all_compensations']` here: BasicDetails only reads\n // `firstName/lastName/dateOfBirth/email/hasSsn` and the first job's\n // `hireDate` — the historical compensations are dead weight in this\n // payload. `useEmployeeCompensation` keeps the include since the\n // JobAndPay tab actually consumes it. The two hooks intentionally use\n // different query keys; mount-time payload shrinks on the active tab.\n const employeeQuery = useEmployeesGet({ employeeId }, { staleTime: Infinity })\n const addressesQuery = useEmployeeAddressesGet({ employeeId }, { staleTime: Infinity })\n const workAddressesQuery = useEmployeeAddressesGetWorkAddresses(\n { employeeId },\n { staleTime: Infinity },\n )\n\n const employee = employeeQuery.data?.employee\n const employeeAddressList = addressesQuery.data?.employeeAddressList\n const employeeWorkAddressesList = workAddressesQuery.data?.employeeWorkAddressesList\n\n const currentHomeAddress = useMemo(() => {\n return employeeAddressList?.find(address => address.active)\n }, [employeeAddressList])\n\n const currentWorkAddress = useMemo(() => {\n return employeeWorkAddressesList?.find(address => address.active)\n }, [employeeWorkAddressesList])\n\n return {\n isLoading: false,\n data: {\n employee,\n currentHomeAddress,\n currentWorkAddress,\n },\n status: {\n isPending:\n employeeQuery.isFetching || addressesQuery.isFetching || workAddressesQuery.isFetching,\n isEmployeeLoading: employeeQuery.isLoading,\n isHomeAddressLoading: addressesQuery.isLoading,\n isWorkAddressLoading: workAddressesQuery.isLoading,\n },\n errorHandling: composeErrorHandler([employeeQuery, addressesQuery, workAddressesQuery]),\n }\n}\n"],"names":["useEmployeeBasicDetails","employeeId","employeeQuery","useEmployeesGet","addressesQuery","useEmployeeAddressesGet","workAddressesQuery","useEmployeeAddressesGetWorkAddresses","employee","employeeAddressList","employeeWorkAddressesList","currentHomeAddress","useMemo","address","currentWorkAddress","composeErrorHandler"],"mappings":";;;;;AAkCO,SAASA,EAAwB;AAAA,EACtC,YAAAC;AACF,GAAgE;AAU9D,QAAMC,IAAgBC,EAAgB,EAAE,YAAAF,EAAA,GAAc,EAAE,WAAW,OAAU,GACvEG,IAAiBC,EAAwB,EAAE,YAAAJ,EAAA,GAAc,EAAE,WAAW,OAAU,GAChFK,IAAqBC;AAAA,IACzB,EAAE,YAAAN,EAAA;AAAA,IACF,EAAE,WAAW,MAAA;AAAA,EAAS,GAGlBO,IAAWN,EAAc,MAAM,UAC/BO,IAAsBL,EAAe,MAAM,qBAC3CM,IAA4BJ,EAAmB,MAAM,2BAErDK,IAAqBC,EAAQ,MAC1BH,GAAqB,KAAK,CAAAI,MAAWA,EAAQ,MAAM,GACzD,CAACJ,CAAmB,CAAC,GAElBK,IAAqBF,EAAQ,MAC1BF,GAA2B,KAAK,CAAAG,MAAWA,EAAQ,MAAM,GAC/D,CAACH,CAAyB,CAAC;AAE9B,SAAO;AAAA,IACL,WAAW;AAAA,IACX,MAAM;AAAA,MACJ,UAAAF;AAAA,MACA,oBAAAG;AAAA,MACA,oBAAAG;AAAA,IAAA;AAAA,IAEF,QAAQ;AAAA,MACN,WACEZ,EAAc,cAAcE,EAAe,cAAcE,EAAmB;AAAA,MAC9E,mBAAmBJ,EAAc;AAAA,MACjC,sBAAsBE,EAAe;AAAA,MACrC,sBAAsBE,EAAmB;AAAA,IAAA;AAAA,IAE3C,eAAeS,EAAoB,CAACb,GAAeE,GAAgBE,CAAkB,CAAC;AAAA,EAAA;AAE1F;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Job } from '@gusto/embedded-api/models/components/job';
|
|
2
2
|
import { GetV1EmployeesEmployeeUuidPayStubsResponse } from '@gusto/embedded-api/models/operations/getv1employeesemployeeuuidpaystubs';
|
|
3
3
|
import { PendingCompensationChange } from '../getPendingCompensationChanges';
|
|
4
|
-
import { BaseHookReady,
|
|
4
|
+
import { BaseHookReady, HookSubmitResult } from '../../../../partner-hook-utils/types';
|
|
5
5
|
import { PaginationControlProps } from '../../../Common/PaginationControl/PaginationControlTypes';
|
|
6
6
|
type EmployeePayStub = NonNullable<GetV1EmployeesEmployeeUuidPayStubsResponse['employeePayStubsList']>[number];
|
|
7
7
|
export interface UseEmployeeCompensationProps {
|
|
8
8
|
employeeId: string;
|
|
9
9
|
}
|
|
10
|
-
interface
|
|
10
|
+
export interface UseEmployeeCompensationResult extends BaseHookReady<{
|
|
11
11
|
jobs: Job[];
|
|
12
12
|
primaryJob?: Job;
|
|
13
13
|
primaryFlsaStatus?: string;
|
|
@@ -21,6 +21,11 @@ interface UseEmployeeCompensationReady extends BaseHookReady<{
|
|
|
21
21
|
}, {
|
|
22
22
|
isPending: boolean;
|
|
23
23
|
cancellingCompensationUuid: string | null;
|
|
24
|
+
/** Compensation card depends on the employee fetch (jobs, pending
|
|
25
|
+
* changes, FLSA status). */
|
|
26
|
+
isEmployeeLoading: boolean;
|
|
27
|
+
/** Paystubs card depends on a separate paginated endpoint. */
|
|
28
|
+
isPayStubsLoading: boolean;
|
|
24
29
|
}> {
|
|
25
30
|
pagination: {
|
|
26
31
|
payStubs?: PaginationControlProps;
|
|
@@ -29,6 +34,11 @@ interface UseEmployeeCompensationReady extends BaseHookReady<{
|
|
|
29
34
|
cancelPendingChange: (pendingChange: PendingCompensationChange) => Promise<HookSubmitResult<unknown> | undefined>;
|
|
30
35
|
};
|
|
31
36
|
}
|
|
32
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Phase B: non-Suspense queries so the Compensation and Paystubs cards
|
|
39
|
+
* can paint independently within the Job and pay tab. JobAndPayView
|
|
40
|
+
* already gets the Payment and Deductions cards as separate non-Suspense
|
|
41
|
+
* hooks, so this completes the four-section incremental render.
|
|
42
|
+
*/
|
|
33
43
|
export declare function useEmployeeCompensation({ employeeId, }: UseEmployeeCompensationProps): UseEmployeeCompensationResult;
|
|
34
44
|
export {};
|
|
@@ -1,76 +1,75 @@
|
|
|
1
|
-
import { useMemo as a, useCallback as
|
|
2
|
-
import {
|
|
3
|
-
import { useJobsAndCompensationsDeleteCompensationMutation as
|
|
4
|
-
import {
|
|
5
|
-
import { getPendingCompensationChanges as
|
|
6
|
-
import { derivePrimaryFlsaStatus as
|
|
7
|
-
import { useBaseSubmit as
|
|
8
|
-
import { composeErrorHandler as
|
|
9
|
-
import { usePagination as
|
|
10
|
-
function
|
|
11
|
-
employeeId:
|
|
1
|
+
import { useMemo as a, useCallback as j } from "react";
|
|
2
|
+
import { useEmployeesGet as v } from "@gusto/embedded-api/react-query/employeesGet";
|
|
3
|
+
import { useJobsAndCompensationsDeleteCompensationMutation as I } from "@gusto/embedded-api/react-query/jobsAndCompensationsDeleteCompensation";
|
|
4
|
+
import { usePayrollsGetPayStubs as J } from "@gusto/embedded-api/react-query/payrollsGetPayStubs";
|
|
5
|
+
import { getPendingCompensationChanges as A } from "../getPendingCompensationChanges.js";
|
|
6
|
+
import { derivePrimaryFlsaStatus as H } from "../../Compensation/shared/derivePrimaryFlsaStatus.js";
|
|
7
|
+
import { useBaseSubmit as q } from "../../../Base/useBaseSubmit.js";
|
|
8
|
+
import { composeErrorHandler as w } from "../../../../partner-hook-utils/composeErrorHandler.js";
|
|
9
|
+
import { usePagination as D } from "../../../../hooks/usePagination/usePagination.js";
|
|
10
|
+
function z({
|
|
11
|
+
employeeId: r
|
|
12
12
|
}) {
|
|
13
|
-
const { currentPage:
|
|
13
|
+
const { currentPage: c, itemsPerPage: d, getPaginationProps: m } = D({
|
|
14
14
|
defaultItemsPerPage: 10
|
|
15
|
-
}), i =
|
|
16
|
-
employeeId:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
employeeId:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
async (
|
|
34
|
-
let
|
|
35
|
-
return await
|
|
36
|
-
|
|
37
|
-
request: { compensationId:
|
|
15
|
+
}), i = v(
|
|
16
|
+
{ employeeId: r, include: ["all_compensations"] },
|
|
17
|
+
{ staleTime: 1 / 0 }
|
|
18
|
+
), e = J(
|
|
19
|
+
{ employeeId: r, page: c, per: d },
|
|
20
|
+
{ staleTime: 1 / 0 }
|
|
21
|
+
), o = I(), {
|
|
22
|
+
baseSubmitHandler: p,
|
|
23
|
+
error: l,
|
|
24
|
+
setError: g
|
|
25
|
+
} = q("Employee.Dashboard.JobAndPay.Compensation"), n = i.data?.employee, t = a(() => n?.jobs ?? [], [n?.jobs]), y = a(() => t.find((s) => s.primary === !0), [t]), b = a(() => H(t), [t]), P = t.length > 1, f = a(
|
|
26
|
+
() => A(n?.jobs),
|
|
27
|
+
[n?.jobs]
|
|
28
|
+
), h = e.data?.employeePayStubsList ?? [], S = a(() => {
|
|
29
|
+
const s = e.data?.httpMeta.response.headers;
|
|
30
|
+
if (s)
|
|
31
|
+
return m(s, e.isFetching);
|
|
32
|
+
}, [e.data?.httpMeta.response.headers, e.isFetching, m]), C = o.isPending ? o.variables.request.compensationId : null, E = j(
|
|
33
|
+
async (s) => {
|
|
34
|
+
let u;
|
|
35
|
+
return await p(s, async ({ compensationUuid: M }) => {
|
|
36
|
+
u = { mode: "update", data: await o.mutateAsync({
|
|
37
|
+
request: { compensationId: M }
|
|
38
38
|
}) };
|
|
39
|
-
}),
|
|
39
|
+
}), u;
|
|
40
40
|
},
|
|
41
|
-
[
|
|
42
|
-
),
|
|
43
|
-
submitError:
|
|
44
|
-
setSubmitError:
|
|
41
|
+
[p, o]
|
|
42
|
+
), F = i.isFetching || e.isFetching || o.isPending, L = w([i, e], {
|
|
43
|
+
submitError: l,
|
|
44
|
+
setSubmitError: g
|
|
45
45
|
});
|
|
46
|
-
return
|
|
47
|
-
isLoading: !0,
|
|
48
|
-
errorHandling: l
|
|
49
|
-
} : {
|
|
46
|
+
return {
|
|
50
47
|
isLoading: !1,
|
|
51
48
|
data: {
|
|
52
49
|
jobs: t,
|
|
53
|
-
primaryJob:
|
|
54
|
-
primaryFlsaStatus:
|
|
55
|
-
hasMultipleJobs:
|
|
56
|
-
pendingChanges:
|
|
57
|
-
payStubs:
|
|
58
|
-
employeeFirstName:
|
|
50
|
+
primaryJob: y,
|
|
51
|
+
primaryFlsaStatus: b,
|
|
52
|
+
hasMultipleJobs: P,
|
|
53
|
+
pendingChanges: f,
|
|
54
|
+
payStubs: h,
|
|
55
|
+
employeeFirstName: n?.firstName ?? void 0
|
|
59
56
|
},
|
|
60
57
|
status: {
|
|
61
|
-
isPending:
|
|
62
|
-
cancellingCompensationUuid:
|
|
58
|
+
isPending: F,
|
|
59
|
+
cancellingCompensationUuid: C,
|
|
60
|
+
isEmployeeLoading: i.isLoading,
|
|
61
|
+
isPayStubsLoading: e.isLoading
|
|
63
62
|
},
|
|
64
63
|
pagination: {
|
|
65
|
-
payStubs:
|
|
64
|
+
payStubs: S
|
|
66
65
|
},
|
|
67
66
|
actions: {
|
|
68
|
-
cancelPendingChange:
|
|
67
|
+
cancelPendingChange: E
|
|
69
68
|
},
|
|
70
|
-
errorHandling:
|
|
69
|
+
errorHandling: L
|
|
71
70
|
};
|
|
72
71
|
}
|
|
73
72
|
export {
|
|
74
|
-
|
|
73
|
+
z as useEmployeeCompensation
|
|
75
74
|
};
|
|
76
75
|
//# sourceMappingURL=useEmployeeCompensation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEmployeeCompensation.js","sources":["../../../../../src/components/Employee/Dashboard/hooks/useEmployeeCompensation.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react'\nimport {
|
|
1
|
+
{"version":3,"file":"useEmployeeCompensation.js","sources":["../../../../../src/components/Employee/Dashboard/hooks/useEmployeeCompensation.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { useEmployeesGet } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useJobsAndCompensationsDeleteCompensationMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsDeleteCompensation'\nimport { usePayrollsGetPayStubs } from '@gusto/embedded-api/react-query/payrollsGetPayStubs'\nimport type { Job } from '@gusto/embedded-api/models/components/job'\nimport type { GetV1EmployeesEmployeeUuidPayStubsResponse } from '@gusto/embedded-api/models/operations/getv1employeesemployeeuuidpaystubs'\nimport {\n getPendingCompensationChanges,\n type PendingCompensationChange,\n} from '../getPendingCompensationChanges'\nimport { derivePrimaryFlsaStatus } from '@/components/Employee/Compensation/shared/derivePrimaryFlsaStatus'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport { usePagination } from '@/hooks/usePagination/usePagination'\nimport type { BaseHookReady, HookSubmitResult } from '@/partner-hook-utils/types'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ntype EmployeePayStub = NonNullable<\n GetV1EmployeesEmployeeUuidPayStubsResponse['employeePayStubsList']\n>[number]\n\nexport interface UseEmployeeCompensationProps {\n employeeId: string\n}\n\nexport interface UseEmployeeCompensationResult extends BaseHookReady<\n {\n jobs: Job[]\n primaryJob?: Job\n primaryFlsaStatus?: string\n hasMultipleJobs: boolean\n pendingChanges: PendingCompensationChange[]\n payStubs: EmployeePayStub[]\n /** First name from the shared employee fetch; useful for cosmetic copy\n * in alerts (e.g. \"Heads up, Jane has pending changes\"). Optional\n * because the employee record can omit it. */\n employeeFirstName?: string\n },\n {\n isPending: boolean\n cancellingCompensationUuid: string | null\n /** Compensation card depends on the employee fetch (jobs, pending\n * changes, FLSA status). */\n isEmployeeLoading: boolean\n /** Paystubs card depends on a separate paginated endpoint. */\n isPayStubsLoading: boolean\n }\n> {\n pagination: {\n payStubs?: PaginationControlProps\n }\n actions: {\n cancelPendingChange: (\n pendingChange: PendingCompensationChange,\n ) => Promise<HookSubmitResult<unknown> | undefined>\n }\n}\n\n/**\n * Phase B: non-Suspense queries so the Compensation and Paystubs cards\n * can paint independently within the Job and pay tab. JobAndPayView\n * already gets the Payment and Deductions cards as separate non-Suspense\n * hooks, so this completes the four-section incremental render.\n */\nexport function useEmployeeCompensation({\n employeeId,\n}: UseEmployeeCompensationProps): UseEmployeeCompensationResult {\n const { currentPage, itemsPerPage, getPaginationProps } = usePagination({\n defaultItemsPerPage: 10,\n })\n\n // staleTime: Infinity on dashboard reads — the SDK QueryClient already\n // invalidates all queries on any mutation success, so post-write\n // freshness is preserved. Without this, every subscriber re-mount\n // (e.g. tab navigation) would fire a redundant background refetch.\n const employeeQuery = useEmployeesGet(\n { employeeId, include: ['all_compensations'] },\n { staleTime: Infinity },\n )\n const payStubsQuery = usePayrollsGetPayStubs(\n { employeeId, page: currentPage, per: itemsPerPage },\n { staleTime: Infinity },\n )\n const cancelCompensationMutation = useJobsAndCompensationsDeleteCompensationMutation()\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('Employee.Dashboard.JobAndPay.Compensation')\n\n const employee = employeeQuery.data?.employee\n\n const jobs = useMemo(() => employee?.jobs ?? [], [employee?.jobs])\n const primaryJob = useMemo(() => jobs.find(job => job.primary === true), [jobs])\n const primaryFlsaStatus = useMemo(() => derivePrimaryFlsaStatus(jobs), [jobs])\n const hasMultipleJobs = jobs.length > 1\n\n const pendingChanges = useMemo(\n () => getPendingCompensationChanges(employee?.jobs),\n [employee?.jobs],\n )\n\n const payStubs = payStubsQuery.data?.employeePayStubsList ?? []\n\n const payStubsPagination = useMemo(() => {\n const headers = payStubsQuery.data?.httpMeta.response.headers\n if (!headers) return undefined\n return getPaginationProps(headers, payStubsQuery.isFetching)\n }, [payStubsQuery.data?.httpMeta.response.headers, payStubsQuery.isFetching, getPaginationProps])\n\n const cancellingCompensationUuid = cancelCompensationMutation.isPending\n ? cancelCompensationMutation.variables.request.compensationId\n : null\n\n const cancelPendingChange = useCallback(\n async (\n pendingChange: PendingCompensationChange,\n ): Promise<HookSubmitResult<unknown> | undefined> => {\n let submitResult: HookSubmitResult<unknown> | undefined\n await baseSubmitHandler(pendingChange, async ({ compensationUuid }) => {\n const data = await cancelCompensationMutation.mutateAsync({\n request: { compensationId: compensationUuid },\n })\n submitResult = { mode: 'update', data }\n })\n return submitResult\n },\n [baseSubmitHandler, cancelCompensationMutation],\n )\n\n const isPending =\n employeeQuery.isFetching || payStubsQuery.isFetching || cancelCompensationMutation.isPending\n\n const errorHandling = composeErrorHandler([employeeQuery, payStubsQuery], {\n submitError,\n setSubmitError,\n })\n\n return {\n isLoading: false,\n data: {\n jobs,\n primaryJob,\n primaryFlsaStatus,\n hasMultipleJobs,\n pendingChanges,\n payStubs,\n employeeFirstName: employee?.firstName ?? undefined,\n },\n status: {\n isPending,\n cancellingCompensationUuid,\n isEmployeeLoading: employeeQuery.isLoading,\n isPayStubsLoading: payStubsQuery.isLoading,\n },\n pagination: {\n payStubs: payStubsPagination,\n },\n actions: {\n cancelPendingChange,\n },\n errorHandling,\n }\n}\n"],"names":["useEmployeeCompensation","employeeId","currentPage","itemsPerPage","getPaginationProps","usePagination","employeeQuery","useEmployeesGet","payStubsQuery","usePayrollsGetPayStubs","cancelCompensationMutation","useJobsAndCompensationsDeleteCompensationMutation","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","employee","jobs","useMemo","primaryJob","job","primaryFlsaStatus","derivePrimaryFlsaStatus","hasMultipleJobs","pendingChanges","getPendingCompensationChanges","payStubs","payStubsPagination","headers","cancellingCompensationUuid","cancelPendingChange","useCallback","pendingChange","submitResult","compensationUuid","isPending","errorHandling","composeErrorHandler"],"mappings":";;;;;;;;;AAgEO,SAASA,EAAwB;AAAA,EACtC,YAAAC;AACF,GAAgE;AAC9D,QAAM,EAAE,aAAAC,GAAa,cAAAC,GAAc,oBAAAC,EAAA,IAAuBC,EAAc;AAAA,IACtE,qBAAqB;AAAA,EAAA,CACtB,GAMKC,IAAgBC;AAAA,IACpB,EAAE,YAAAN,GAAY,SAAS,CAAC,mBAAmB,EAAA;AAAA,IAC3C,EAAE,WAAW,MAAA;AAAA,EAAS,GAElBO,IAAgBC;AAAA,IACpB,EAAE,YAAAR,GAAY,MAAMC,GAAa,KAAKC,EAAA;AAAA,IACtC,EAAE,WAAW,MAAA;AAAA,EAAS,GAElBO,IAA6BC,EAAA,GAC7B;AAAA,IACJ,mBAAAC;AAAA,IACA,OAAOC;AAAA,IACP,UAAUC;AAAA,EAAA,IACRC,EAAc,2CAA2C,GAEvDC,IAAWV,EAAc,MAAM,UAE/BW,IAAOC,EAAQ,MAAMF,GAAU,QAAQ,IAAI,CAACA,GAAU,IAAI,CAAC,GAC3DG,IAAaD,EAAQ,MAAMD,EAAK,KAAK,CAAAG,MAAOA,EAAI,YAAY,EAAI,GAAG,CAACH,CAAI,CAAC,GACzEI,IAAoBH,EAAQ,MAA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,4BAAAN;AAAA,MACA,mBAAmBvB,EAAc;AAAA,MACjC,mBAAmBE,EAAc;AAAA,IAAA;AAAA,IAEnC,YAAY;AAAA,MACV,UAAUmB;AAAA,IAAA;AAAA,IAEZ,SAAS;AAAA,MACP,qBAAAG;AAAA,IAAA;AAAA,IAEF,eAAAM;AAAA,EAAA;AAEJ;"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { Form } from '@gusto/embedded-api/models/components/form';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseHookReady } from '../../../../partner-hook-utils/types';
|
|
3
3
|
export interface UseEmployeeFormsProps {
|
|
4
4
|
employeeId: string;
|
|
5
5
|
}
|
|
6
|
-
type
|
|
6
|
+
export type UseEmployeeFormsResult = BaseHookReady<{
|
|
7
7
|
formList: Form[];
|
|
8
8
|
}, {
|
|
9
9
|
isPending: boolean;
|
|
10
|
+
isFormsLoading: boolean;
|
|
10
11
|
}>;
|
|
11
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Phase B: non-Suspense query so the consuming view can paint its frame
|
|
14
|
+
* (box header, tab structure) before the data arrives. The `formList`
|
|
15
|
+
* defaults to `[]` while the query is loading — consumers branch on
|
|
16
|
+
* `status.isFormsLoading` to distinguish "still loading" from "loaded
|
|
17
|
+
* empty" and render a skeleton accordingly.
|
|
18
|
+
*/
|
|
12
19
|
export declare function useEmployeeForms({ employeeId }: UseEmployeeFormsProps): UseEmployeeFormsResult;
|
|
13
|
-
export {};
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { composeErrorHandler as
|
|
3
|
-
function
|
|
4
|
-
const o =
|
|
5
|
-
return
|
|
6
|
-
isLoading: !0,
|
|
7
|
-
errorHandling: t
|
|
8
|
-
} : {
|
|
1
|
+
import { useEmployeeFormsList as s } from "@gusto/embedded-api/react-query/employeeFormsList";
|
|
2
|
+
import { composeErrorHandler as i } from "../../../../partner-hook-utils/composeErrorHandler.js";
|
|
3
|
+
function t({ employeeId: r }) {
|
|
4
|
+
const o = s({ employeeId: r }, { staleTime: 1 / 0 });
|
|
5
|
+
return {
|
|
9
6
|
isLoading: !1,
|
|
10
7
|
data: {
|
|
11
|
-
formList:
|
|
8
|
+
formList: o.data?.forms ?? []
|
|
12
9
|
},
|
|
13
10
|
status: {
|
|
14
|
-
isPending:
|
|
11
|
+
isPending: o.isFetching,
|
|
12
|
+
isFormsLoading: o.isLoading
|
|
15
13
|
},
|
|
16
|
-
errorHandling:
|
|
14
|
+
errorHandling: i([o])
|
|
17
15
|
};
|
|
18
16
|
}
|
|
19
17
|
export {
|
|
20
|
-
|
|
18
|
+
t as useEmployeeForms
|
|
21
19
|
};
|
|
22
20
|
//# sourceMappingURL=useEmployeeForms.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEmployeeForms.js","sources":["../../../../../src/components/Employee/Dashboard/hooks/useEmployeeForms.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useEmployeeForms.js","sources":["../../../../../src/components/Employee/Dashboard/hooks/useEmployeeForms.tsx"],"sourcesContent":["import { useEmployeeFormsList } from '@gusto/embedded-api/react-query/employeeFormsList'\nimport type { Form } from '@gusto/embedded-api/models/components/form'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport type { BaseHookReady } from '@/partner-hook-utils/types'\n\nexport interface UseEmployeeFormsProps {\n employeeId: string\n}\n\nexport type UseEmployeeFormsResult = BaseHookReady<\n { formList: Form[] },\n { isPending: boolean; isFormsLoading: boolean }\n>\n\n/**\n * Phase B: non-Suspense query so the consuming view can paint its frame\n * (box header, tab structure) before the data arrives. The `formList`\n * defaults to `[]` while the query is loading — consumers branch on\n * `status.isFormsLoading` to distinguish \"still loading\" from \"loaded\n * empty\" and render a skeleton accordingly.\n */\nexport function useEmployeeForms({ employeeId }: UseEmployeeFormsProps): UseEmployeeFormsResult {\n // staleTime: Infinity — see useEmployeeCompensation for rationale (SDK\n // QueryClient invalidates on any mutation success).\n const formsQuery = useEmployeeFormsList({ employeeId }, { staleTime: Infinity })\n\n return {\n isLoading: false,\n data: {\n formList: formsQuery.data?.forms ?? [],\n },\n status: {\n isPending: formsQuery.isFetching,\n isFormsLoading: formsQuery.isLoading,\n },\n errorHandling: composeErrorHandler([formsQuery]),\n }\n}\n"],"names":["useEmployeeForms","employeeId","formsQuery","useEmployeeFormsList","composeErrorHandler"],"mappings":";;AAqBO,SAASA,EAAiB,EAAE,YAAAC,KAA6D;AAG9F,QAAMC,IAAaC,EAAqB,EAAE,YAAAF,EAAA,GAAc,EAAE,WAAW,OAAU;AAE/E,SAAO;AAAA,IACL,WAAW;AAAA,IACX,MAAM;AAAA,MACJ,UAAUC,EAAW,MAAM,SAAS,CAAA;AAAA,IAAC;AAAA,IAEvC,QAAQ;AAAA,MACN,WAAWA,EAAW;AAAA,MACtB,gBAAgBA,EAAW;AAAA,IAAA;AAAA,IAE7B,eAAeE,EAAoB,CAACF,CAAU,CAAC;AAAA,EAAA;AAEnD;"}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { GetV1EmployeesEmployeeIdFederalTaxesResponse } from '@gusto/embedded-api/models/operations/getv1employeesemployeeidfederaltaxes';
|
|
2
2
|
import { GetV1EmployeesEmployeeIdStateTaxesResponse } from '@gusto/embedded-api/models/operations/getv1employeesemployeeidstatetaxes';
|
|
3
|
-
import {
|
|
3
|
+
import { BaseHookReady } from '../../../../partner-hook-utils/types';
|
|
4
4
|
type EmployeeFederalTax = NonNullable<GetV1EmployeesEmployeeIdFederalTaxesResponse['employeeFederalTax']>;
|
|
5
5
|
type EmployeeStateTax = NonNullable<GetV1EmployeesEmployeeIdStateTaxesResponse['employeeStateTaxesList']>[number];
|
|
6
6
|
export interface UseEmployeeTaxesProps {
|
|
7
7
|
employeeId: string;
|
|
8
8
|
}
|
|
9
|
-
type
|
|
9
|
+
export type UseEmployeeTaxesResult = BaseHookReady<{
|
|
10
10
|
employeeFederalTax?: EmployeeFederalTax;
|
|
11
11
|
employeeStateTaxesList: EmployeeStateTax[];
|
|
12
12
|
}, {
|
|
13
13
|
isPending: boolean;
|
|
14
|
+
isFederalTaxesLoading: boolean;
|
|
15
|
+
isStateTaxesLoading: boolean;
|
|
14
16
|
}>;
|
|
15
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Phase B: non-Suspense queries so the federal and state tax cards
|
|
19
|
+
* paint independently. `isFederalTaxesLoading` and `isStateTaxesLoading`
|
|
20
|
+
* let TaxesView render a per-card skeleton while the box header stays
|
|
21
|
+
* visible.
|
|
22
|
+
*/
|
|
16
23
|
export declare function useEmployeeTaxes({ employeeId }: UseEmployeeTaxesProps): UseEmployeeTaxesResult;
|
|
17
24
|
export {};
|