@gusto/embedded-react-sdk 0.56.2 → 0.56.4
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 +31 -0
- package/dist/components/Common/FieldCaption/FieldCaption.js +19 -22
- package/dist/components/Common/FieldCaption/FieldCaption.js.map +1 -1
- package/dist/components/Common/FieldCaption/FieldCaption.module.scss.js +6 -6
- package/dist/components/Common/PaginationControl/PaginationControl.js +66 -62
- package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Company/PaySchedule/management/PaySchedule.js +60 -0
- package/dist/components/Company/PaySchedule/management/PaySchedule.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentReviewStepPresentation.js +67 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentReviewStepPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js +59 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js +57 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js +46 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js +101 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js +81 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/stripNullAssignmentPreviewFields.js +18 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/stripNullAssignmentPreviewFields.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js +56 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js +34 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.js +77 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.module.scss.js +10 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.module.scss.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js +66 -0
- package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js.map +1 -0
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +75 -57
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/shared/requirementSetError.js +15 -0
- package/dist/components/Company/StateTaxes/shared/requirementSetError.js.map +1 -0
- package/dist/components/Company/exports/companyManagement.js +7 -0
- package/dist/components/Company/exports/companyManagement.js.map +1 -0
- package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
- package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js +4 -4
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +4 -4
- package/dist/components/Flow/Flow.js +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +28 -28
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +51 -58
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +12 -7
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +87 -85
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +55 -54
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +66 -62
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +129 -125
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +30 -27
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js +41 -30
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js +159 -152
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +61 -59
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +32 -31
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +16 -16
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +61 -61
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +192 -193
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlow.js +27 -22
- package/dist/components/Payroll/Transition/TransitionFlow.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +55 -53
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js +44 -41
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
- package/dist/components/Payroll/helpers.js +72 -67
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +34 -25
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +23 -22
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/informationRequestEnumHook.js +30 -0
- package/dist/contexts/ApiProvider/informationRequestEnumHook.js.map +1 -0
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js.map +1 -1
- package/dist/helpers/dateFormatting.js.map +1 -1
- package/dist/helpers/formattedStrings.js +9 -8
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/i18n/I18n.js +2 -0
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Company.Management.PaySchedule.json.js +24 -0
- package/dist/i18n/en/Company.Management.PaySchedule.json.js.map +1 -0
- package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js +18 -0
- package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js.map +1 -0
- package/dist/i18n/en/Company.StateTaxes.json.js +1 -1
- package/dist/i18n/en/Payroll.GrossUpModal.json.js +12 -14
- package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +1 -1
- package/dist/i18n/en/common.json.js +36 -38
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/index.js +137 -135
- package/dist/index.js.map +1 -1
- package/dist/package.json.js +1 -1
- package/dist/shared/constants.js +39 -31
- package/dist/shared/constants.js.map +1 -1
- package/dist/src/components/Company/PaySchedule/management/PaySchedule.d.ts +24 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentReviewStepPresentation.d.ts +10 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.d.ts +11 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.d.ts +9 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.d.ts +35 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.d.ts +29 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/index.d.ts +1 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.d.ts +7 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/stripNullAssignmentPreviewFields.d.ts +12 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/usePayScheduleAssignment.d.ts +9 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleManagementComponents.d.ts +20 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleOverview.d.ts +11 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.d.ts +18 -0
- package/dist/src/components/Company/PaySchedule/management/index.d.ts +1 -0
- package/dist/src/components/Company/PaySchedule/management/payScheduleManagementStateMachine.d.ts +12 -0
- package/dist/src/components/Company/StateTaxes/shared/requirementSetError.d.ts +18 -0
- package/dist/src/components/Company/StateTaxes/shared/requirementSetError.test.d.ts +1 -0
- package/dist/src/components/Company/exports/companyManagement.d.ts +2 -0
- package/dist/src/components/Payroll/PayrollBlocker/payrollHelpers.d.ts +12 -0
- package/dist/src/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +6 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.d.ts +2 -2
- package/dist/src/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.d.ts +6 -1
- package/dist/src/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +7 -1
- package/dist/src/components/Payroll/helpers.d.ts +34 -0
- package/dist/src/components/Payroll/usePreparedPayrollData.d.ts +6 -1
- package/dist/src/components/index.d.ts +12 -0
- package/dist/src/contexts/ApiProvider/informationRequestEnumHook.d.ts +14 -0
- package/dist/src/contexts/ApiProvider/informationRequestEnumHook.test.d.ts +1 -0
- package/dist/src/contexts/UnstableFeaturesProvider/useUnstableFeature.d.ts +2 -0
- package/dist/src/helpers/dateFormatting.d.ts +2 -2
- package/dist/src/helpers/formattedStrings.d.ts +15 -0
- package/dist/src/i18n/en/common.json.d.ts +0 -1
- package/dist/src/i18n/types.d.ts +96 -6
- package/dist/src/models/external.d.ts +12 -0
- package/dist/src/shared/constants.d.ts +16 -0
- package/dist/style.css +1 -1
- package/dist/types/sdkError.js +32 -21
- package/dist/types/sdkError.js.map +1 -1
- package/docs/guides/endpoint-inventory.json +59 -10
- package/package.json +7 -7
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { state as E, transition as e, reduce as c } from "robot3";
|
|
2
|
+
import { PayScheduleEditFormContextual as S, PayScheduleAssignmentContextual as a, PayScheduleOverviewContextual as A } from "./PayScheduleManagementComponents.js";
|
|
3
|
+
import { componentEvents as t } from "../../../../shared/constants.js";
|
|
4
|
+
const n = c(
|
|
5
|
+
(o) => ({
|
|
6
|
+
...o,
|
|
7
|
+
component: A,
|
|
8
|
+
payScheduleId: void 0,
|
|
9
|
+
successAlert: null
|
|
10
|
+
})
|
|
11
|
+
), r = (o) => c((i) => ({
|
|
12
|
+
...i,
|
|
13
|
+
component: A,
|
|
14
|
+
payScheduleId: void 0,
|
|
15
|
+
successAlert: o
|
|
16
|
+
})), l = {
|
|
17
|
+
overview: E(
|
|
18
|
+
e(
|
|
19
|
+
t.PAY_SCHEDULE_UPDATE,
|
|
20
|
+
"editSchedule",
|
|
21
|
+
c(
|
|
22
|
+
(o, i) => ({
|
|
23
|
+
...o,
|
|
24
|
+
component: S,
|
|
25
|
+
payScheduleId: i.payload.uuid
|
|
26
|
+
})
|
|
27
|
+
)
|
|
28
|
+
),
|
|
29
|
+
e(
|
|
30
|
+
t.PAY_SCHEDULE_MANAGE_ASSIGNMENT,
|
|
31
|
+
"manageAssignment",
|
|
32
|
+
c(
|
|
33
|
+
(o) => ({
|
|
34
|
+
...o,
|
|
35
|
+
component: a,
|
|
36
|
+
successAlert: null
|
|
37
|
+
})
|
|
38
|
+
)
|
|
39
|
+
),
|
|
40
|
+
e(t.PAY_SCHEDULE_MANAGEMENT_ALERT_DISMISSED, "overview", n)
|
|
41
|
+
),
|
|
42
|
+
editSchedule: E(
|
|
43
|
+
e(t.PAY_SCHEDULE_UPDATED, "overview", n),
|
|
44
|
+
e(t.CANCEL, "overview", n)
|
|
45
|
+
),
|
|
46
|
+
/**
|
|
47
|
+
* Entered directly from PaySchedule.tsx's initial routing when the company has no pay
|
|
48
|
+
* schedules yet — there's no overview to fall back to, so CANCEL isn't handled here; it
|
|
49
|
+
* still bubbles to the host via Flow's onEvent re-emit.
|
|
50
|
+
*/
|
|
51
|
+
createSchedule: E(
|
|
52
|
+
e(t.PAY_SCHEDULE_CREATED, "overview", n)
|
|
53
|
+
),
|
|
54
|
+
manageAssignment: E(
|
|
55
|
+
e(t.PAY_SCHEDULE_ASSIGNMENT_CANCEL, "overview", n),
|
|
56
|
+
e(
|
|
57
|
+
t.PAY_SCHEDULE_ASSIGNED,
|
|
58
|
+
"overview",
|
|
59
|
+
r("assignmentUpdated")
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
l as payScheduleManagementStateMachine
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=payScheduleManagementStateMachine.js.map
|
package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payScheduleManagementStateMachine.js","sources":["../../../../../src/components/Company/PaySchedule/management/payScheduleManagementStateMachine.ts"],"sourcesContent":["import { reduce, state, transition } from 'robot3'\nimport type { ComponentType } from 'react'\nimport type { PayScheduleManagementContextInterface } from './PayScheduleManagementComponents'\nimport {\n PayScheduleOverviewContextual,\n PayScheduleEditFormContextual,\n PayScheduleAssignmentContextual,\n} from './PayScheduleManagementComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\n\ntype EventPayloads = {\n [componentEvents.PAY_SCHEDULE_UPDATE]: { uuid: string }\n [componentEvents.PAY_SCHEDULE_CREATED]: undefined\n}\n\nconst toOverview = reduce(\n (ctx: PayScheduleManagementContextInterface): PayScheduleManagementContextInterface => ({\n ...ctx,\n component: PayScheduleOverviewContextual as ComponentType,\n payScheduleId: undefined,\n successAlert: null,\n }),\n)\n\nconst toOverviewWithAlert = (alert: PayScheduleManagementContextInterface['successAlert']) =>\n reduce((ctx: PayScheduleManagementContextInterface): PayScheduleManagementContextInterface => ({\n ...ctx,\n component: PayScheduleOverviewContextual as ComponentType,\n payScheduleId: undefined,\n successAlert: alert,\n }))\n\n/** @internal */\nexport const payScheduleManagementStateMachine = {\n overview: state<MachineTransition>(\n transition(\n componentEvents.PAY_SCHEDULE_UPDATE,\n 'editSchedule',\n reduce(\n (\n ctx: PayScheduleManagementContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.PAY_SCHEDULE_UPDATE>,\n ): PayScheduleManagementContextInterface => ({\n ...ctx,\n component: PayScheduleEditFormContextual as ComponentType,\n payScheduleId: ev.payload.uuid,\n }),\n ),\n ),\n transition(\n componentEvents.PAY_SCHEDULE_MANAGE_ASSIGNMENT,\n 'manageAssignment',\n reduce(\n (ctx: PayScheduleManagementContextInterface): PayScheduleManagementContextInterface => ({\n ...ctx,\n component: PayScheduleAssignmentContextual as ComponentType,\n successAlert: null,\n }),\n ),\n ),\n transition(componentEvents.PAY_SCHEDULE_MANAGEMENT_ALERT_DISMISSED, 'overview', toOverview),\n ),\n editSchedule: state<MachineTransition>(\n transition(componentEvents.PAY_SCHEDULE_UPDATED, 'overview', toOverview),\n transition(componentEvents.CANCEL, 'overview', toOverview),\n ),\n /**\n * Entered directly from PaySchedule.tsx's initial routing when the company has no pay\n * schedules yet — there's no overview to fall back to, so CANCEL isn't handled here; it\n * still bubbles to the host via Flow's onEvent re-emit.\n */\n createSchedule: state<MachineTransition>(\n transition(componentEvents.PAY_SCHEDULE_CREATED, 'overview', toOverview),\n ),\n manageAssignment: state<MachineTransition>(\n transition(componentEvents.PAY_SCHEDULE_ASSIGNMENT_CANCEL, 'overview', toOverview),\n transition(\n componentEvents.PAY_SCHEDULE_ASSIGNED,\n 'overview',\n toOverviewWithAlert('assignmentUpdated'),\n ),\n ),\n}\n"],"names":["toOverview","reduce","ctx","PayScheduleOverviewContextual","toOverviewWithAlert","alert","payScheduleManagementStateMachine","state","transition","componentEvents","ev","PayScheduleEditFormContextual","PayScheduleA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|
2
|
-
import { useForm as
|
|
3
|
-
import { zodResolver as
|
|
4
|
-
import { useTaxRequirementsUpdateStateMutation as
|
|
1
|
+
import { jsx as t, jsxs as V, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { useForm as K, FormProvider as M } from "react-hook-form";
|
|
3
|
+
import { zodResolver as z } from "@hookform/resolvers/zod";
|
|
4
|
+
import { useTaxRequirementsUpdateStateMutation as H } from "@gusto/embedded-api/react-query/taxRequirementsUpdateState";
|
|
5
5
|
import { useTaxRequirementsGetSuspense as N } from "@gusto/embedded-api/react-query/taxRequirementsGet";
|
|
6
6
|
import { z as b } from "zod";
|
|
7
7
|
import { useMemo as O } from "react";
|
|
8
8
|
import { useTranslation as G } from "react-i18next";
|
|
9
9
|
import { getUniqueRhfKey as d } from "../shared/rhfKey.js";
|
|
10
|
-
import { isRequirementApplicable as
|
|
11
|
-
import { prepareRequirements as
|
|
12
|
-
import { buildRequirementSchema as
|
|
13
|
-
import { stringifyRequirementValue as
|
|
10
|
+
import { isRequirementApplicable as I } from "../shared/applicableIf.js";
|
|
11
|
+
import { prepareRequirements as k } from "../shared/prepareRequirements.js";
|
|
12
|
+
import { buildRequirementSchema as L } from "../shared/buildRequirementSchema.js";
|
|
13
|
+
import { stringifyRequirementValue as X } from "../shared/requirementValue.js";
|
|
14
|
+
import { parseRequirementSetError as Y } from "../shared/requirementSetError.js";
|
|
14
15
|
import { Head as $ } from "./Head.js";
|
|
15
|
-
import { StateTaxesFormProvider as
|
|
16
|
-
import { Form as
|
|
17
|
-
import { Actions as
|
|
18
|
-
import { BaseComponent as
|
|
19
|
-
import { useI18n as
|
|
20
|
-
import { Flex as
|
|
16
|
+
import { StateTaxesFormProvider as J } from "./context.js";
|
|
17
|
+
import { Form as Q } from "./Form.js";
|
|
18
|
+
import { Actions as W } from "./Actions.js";
|
|
19
|
+
import { BaseComponent as Z } from "../../../Base/Base.js";
|
|
20
|
+
import { useI18n as ee } from "../../../../i18n/I18n.js";
|
|
21
|
+
import { Flex as re } from "../../../Common/Flex/Flex.js";
|
|
21
22
|
import { Form as te } from "../../../Common/Form/Form.js";
|
|
22
|
-
import { componentEvents as
|
|
23
|
-
import { useBase as
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
import { componentEvents as v } from "../../../../shared/constants.js";
|
|
24
|
+
import { useBase as oe } from "../../../Base/useBase.js";
|
|
25
|
+
import { SDKInternalError as ne } from "../../../../types/sdkError.js";
|
|
26
|
+
function Ue(m) {
|
|
27
|
+
return /* @__PURE__ */ t(Z, { ...m, children: /* @__PURE__ */ t(me, { ...m, children: m.children }) });
|
|
26
28
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
const { onEvent:
|
|
30
|
-
const f = {},
|
|
31
|
-
return p.forEach((
|
|
32
|
-
if (!
|
|
33
|
-
const r = d(
|
|
34
|
-
Object.keys(
|
|
29
|
+
function me({ companyId: m, state: a, className: F, children: y }) {
|
|
30
|
+
ee("Company.StateTaxes");
|
|
31
|
+
const { onEvent: R, baseSubmitHandler: P } = oe(), { t: h } = G("Company.StateTaxes", { keyPrefix: "form" }), { data: E } = N({ companyUuid: m, state: a }), c = E.taxRequirementsState, { mutateAsync: g, isPending: A } = H(), { dynamicSchema: C, defaultValues: U } = O(() => {
|
|
32
|
+
const f = {}, i = {}, p = c.requirementSets ?? [];
|
|
33
|
+
return p.forEach((u, e) => {
|
|
34
|
+
if (!u.key) return;
|
|
35
|
+
const r = d(u, e, p), o = k(u.requirements ?? []), { shape: n, defaults: S } = L(o, h);
|
|
36
|
+
Object.keys(n).length > 0 && (f[r] = b.object(n), i[r] = S);
|
|
35
37
|
}), {
|
|
36
38
|
dynamicSchema: b.object(f),
|
|
37
|
-
defaultValues:
|
|
39
|
+
defaultValues: i
|
|
38
40
|
};
|
|
39
|
-
}, [
|
|
40
|
-
resolver:
|
|
41
|
+
}, [c, h]), { control: j, ...x } = K({
|
|
42
|
+
resolver: z(C),
|
|
41
43
|
defaultValues: U
|
|
42
|
-
}),
|
|
43
|
-
await
|
|
44
|
-
const p =
|
|
44
|
+
}), w = async (f) => {
|
|
45
|
+
await P(f, async (i) => {
|
|
46
|
+
const p = i, l = c.requirementSets ?? [], u = l.map((e, r) => ({ requirementSet: e, setIndex: r })).filter(({ requirementSet: e, setIndex: r }) => {
|
|
45
47
|
if (!e.key) return !1;
|
|
46
|
-
const
|
|
47
|
-
return !!
|
|
48
|
+
const o = d(e, r, l);
|
|
49
|
+
return !!i[o];
|
|
48
50
|
}).map(({ requirementSet: e, setIndex: r }) => {
|
|
49
|
-
const
|
|
51
|
+
const o = e.key, n = d(e, r, l), S = i[n], T = k(e.requirements ?? []), D = T.map((s, q) => ({ req: s, index: q })).filter(({ req: s }) => I(s, n, p));
|
|
50
52
|
return {
|
|
51
|
-
state:
|
|
52
|
-
key:
|
|
53
|
+
state: a,
|
|
54
|
+
key: o,
|
|
53
55
|
effectiveFrom: e.effectiveFrom,
|
|
54
|
-
requirements: D.map(({ req:
|
|
55
|
-
key:
|
|
56
|
-
value:
|
|
57
|
-
|
|
56
|
+
requirements: D.map(({ req: s, index: q }) => ({
|
|
57
|
+
key: s.key,
|
|
58
|
+
value: X(
|
|
59
|
+
S[d(s, q, T)]
|
|
58
60
|
)
|
|
59
61
|
}))
|
|
60
62
|
};
|
|
61
63
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
try {
|
|
65
|
+
await g({
|
|
66
|
+
request: {
|
|
67
|
+
companyUuid: m,
|
|
68
|
+
requestBody: { requirementSets: u },
|
|
69
|
+
state: a
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
} catch (e) {
|
|
73
|
+
const r = Y(e);
|
|
74
|
+
if (!r) throw e;
|
|
75
|
+
const o = c.requirementSets?.find(
|
|
76
|
+
(n) => n.key === r.key
|
|
77
|
+
)?.label ?? r.key;
|
|
78
|
+
throw new ne(
|
|
79
|
+
h("errors.incompleteRequirementSet", {
|
|
80
|
+
section: o,
|
|
81
|
+
state: r.state ?? a
|
|
82
|
+
}),
|
|
83
|
+
"api_error"
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
R(v.COMPANY_STATE_TAX_UPDATED);
|
|
69
87
|
});
|
|
70
|
-
},
|
|
71
|
-
|
|
88
|
+
}, B = () => {
|
|
89
|
+
R(v.CANCEL);
|
|
72
90
|
};
|
|
73
|
-
return /* @__PURE__ */ t("section", { className:
|
|
74
|
-
|
|
91
|
+
return /* @__PURE__ */ t("section", { className: F, children: /* @__PURE__ */ t(M, { ...x, control: j, children: /* @__PURE__ */ t(te, { onSubmit: x.handleSubmit(w), children: /* @__PURE__ */ t(
|
|
92
|
+
J,
|
|
75
93
|
{
|
|
76
|
-
value: { stateTaxRequirements:
|
|
77
|
-
children: /* @__PURE__ */ t(
|
|
94
|
+
value: { stateTaxRequirements: c, isPending: A, state: a, handleCancel: B },
|
|
95
|
+
children: /* @__PURE__ */ t(re, { flexDirection: "column", gap: 32, children: y || /* @__PURE__ */ V(_, { children: [
|
|
78
96
|
/* @__PURE__ */ t($, {}),
|
|
79
|
-
/* @__PURE__ */ t(
|
|
80
|
-
/* @__PURE__ */ t(
|
|
97
|
+
/* @__PURE__ */ t(Q, {}),
|
|
98
|
+
/* @__PURE__ */ t(W, {})
|
|
81
99
|
] }) })
|
|
82
100
|
}
|
|
83
101
|
) }) }) });
|
|
84
102
|
}
|
|
85
103
|
export {
|
|
86
|
-
|
|
104
|
+
Ue as StateTaxesForm
|
|
87
105
|
};
|
|
88
106
|
//# sourceMappingURL=StateTaxesForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateTaxesForm.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTaxRequirementsUpdateStateMutation } from '@gusto/embedded-api/react-query/taxRequirementsUpdateState'\nimport { useTaxRequirementsGetSuspense } from '@gusto/embedded-api/react-query/taxRequirementsGet'\nimport { z } from 'zod'\nimport { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { getUniqueRhfKey } from '../shared/rhfKey'\nimport { isRequirementApplicable, type StateTaxesFormValues } from '../shared/applicableIf'\nimport { prepareRequirements } from '../shared/prepareRequirements'\nimport { buildRequirementSchema } from '../shared/buildRequirementSchema'\nimport { stringifyRequirementValue } from '../shared/requirementValue'\nimport { Head } from './Head'\nimport { StateTaxesFormProvider } from './context'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { componentEvents } from '@/shared/constants'\nimport { useBase } from '@/components/Base'\n\n/**\n * Props for {@link StateTaxesForm}.\n *\n * @public\n */\nexport interface StateTaxesFormProps extends BaseComponentInterface<'Company.StateTaxes'> {\n /** The associated company identifier. */\n companyId: string\n /** Two-letter code of the state whose tax requirements are edited. */\n state: string\n}\n\n/**\n * Standalone form for editing a company's state tax requirements for a single state.\n *\n * @remarks\n * Lower-level building block used by {@link StateTaxes} for its edit view. Use directly when\n * you need full control over navigation between the list and edit views.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `company/stateTaxes/updated` | State tax requirements were saved successfully | Response from the update state tax requirements API |\n * | `CANCEL` | The user cancelled editing | — |\n *\n * @param props - {@link StateTaxesFormProps}\n * @returns The rendered state taxes edit form.\n * @public\n *\n * @example\n * ```tsx\n * import { CompanyOnboarding } from '@gusto/embedded-react-sdk'\n *\n * function MyComponent() {\n * return (\n * <CompanyOnboarding.StateTaxesForm\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * state=\"CA\"\n * onEvent={() => {}}\n * />\n * )\n * }\n * ```\n */\nexport function StateTaxesForm(props: StateTaxesFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, state, className, children }: StateTaxesFormProps) {\n useI18n('Company.StateTaxes')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { data } = useTaxRequirementsGetSuspense({ companyUuid: companyId, state })\n const stateTaxRequirements = data.taxRequirementsState!\n\n const { mutateAsync: updateStateTax, isPending: isPendingUpdate } =\n useTaxRequirementsUpdateStateMutation()\n\n // Schema and default value generation\n const { dynamicSchema, defaultValues } = useMemo(() => {\n const schemaShape: Record<string, z.ZodObject> = {}\n const values: Partial<Record<string, Record<string, string | boolean | number | undefined>>> =\n {}\n const requirementSets = stateTaxRequirements.requirementSets ?? []\n\n //Looping through each requirement set. A single key (e.g. \"taxrates\") can appear more than\n //once when a future-dated set is already scheduled alongside the current one, so each set\n //needs its own disambiguated path — otherwise two visually distinct sections would silently\n //share one underlying form field.\n requirementSets.forEach((requirementSet, index) => {\n if (!requirementSet.key) return\n\n const requirementSetPath = getUniqueRhfKey(requirementSet, index, requirementSets)\n const preparedRequirements = prepareRequirements(requirementSet.requirements ?? [])\n const { shape, defaults } = buildRequirementSchema(preparedRequirements, t)\n\n if (Object.keys(shape).length > 0) {\n schemaShape[requirementSetPath] = z.object(shape)\n values[requirementSetPath] = defaults\n }\n })\n\n const finalSchema = z.object(schemaShape)\n\n // Return both the schema and the default values\n return {\n dynamicSchema: finalSchema,\n defaultValues: values as z.infer<typeof finalSchema>,\n }\n }, [stateTaxRequirements, t])\n\n // Infer the type from the schema\n type InferredFormInputs = z.infer<typeof dynamicSchema>\n\n const { control, ...methods } = useForm({\n resolver: zodResolver(dynamicSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InferredFormInputs) => {\n await baseSubmitHandler(formData, async payload => {\n const formValues = payload as StateTaxesFormValues\n const allRequirementSets = stateTaxRequirements.requirementSets ?? []\n const requirementSets = allRequirementSets\n .map((requirementSet, setIndex) => ({ requirementSet, setIndex }))\n .filter(({ requirementSet, setIndex }) => {\n if (!requirementSet.key) return false\n const requirementSetPath = getUniqueRhfKey(requirementSet, setIndex, allRequirementSets)\n return Boolean(payload[requirementSetPath])\n })\n .map(({ requirementSet, setIndex }) => {\n const requirementSetKey = requirementSet.key as string\n const requirementSetPath = getUniqueRhfKey(requirementSet, setIndex, allRequirementSets)\n const payloadSet = payload[requirementSetPath] as Record<string, unknown>\n const preparedRequirements = prepareRequirements(requirementSet.requirements ?? [])\n\n const applicableRequirements = preparedRequirements\n .map((req, index) => ({ req, index }))\n .filter(({ req }) => isRequirementApplicable(req, requirementSetPath, formValues))\n\n return {\n state,\n key: requirementSetKey,\n effectiveFrom: requirementSet.effectiveFrom,\n requirements: applicableRequirements.map(({ req, index }) => ({\n key: req.key as string,\n value: stringifyRequirementValue(\n payloadSet[getUniqueRhfKey(req, index, preparedRequirements)],\n ),\n })),\n }\n })\n await updateStateTax({\n request: {\n companyUuid: companyId,\n requestBody: { requirementSets },\n state,\n },\n })\n onEvent(componentEvents.COMPANY_STATE_TAX_UPDATED)\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods} control={control}>\n <HtmlForm onSubmit={methods.handleSubmit(onSubmit)}>\n <StateTaxesFormProvider\n value={{ stateTaxRequirements, isPending: isPendingUpdate, state, handleCancel }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </StateTaxesFormProvider>\n </HtmlForm>\n </FormProvider>\n </section>\n )\n}\n"],"names":["StateTaxesForm","props","jsx","BaseComponent","Root","companyId","state","className","children","useI18n","onEvent","baseSubmitHandler","useBase","t","useTranslation","data","useTaxRequirementsGetSuspense","stateTaxRequirements","updateStateTax","isPendingUpdate","useTaxRequirementsUpdateStateMutation","dynamicSchema","defaultValues","useMemo","schemaShape","values","requirementSets","requirementSet","index","requirementSetPath","getUniqueRhfKey","preparedRequirements","prepareRequirements","shape","defaults","buildRequirementSchema","z","control","methods","useForm","zodResolver","onSubmit","formData","payload","formValues","allRequirementSets","setIndex","requirementSetKey","payloadSet","applicableRequirements","req","isRequirementApplicable","stringifyRequirementValue","componentEvents","handleCancel","FormProvider","HtmlForm","StateTaxesFormProvider","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoEO,SAASA,GAAeC,GAA4B;AACzD,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,GAAK,EAAE,WAAAC,GAAW,OAAAC,GAAO,WAAAC,GAAW,UAAAC,KAAiC;AAC5E,EAAAC,EAAQ,oBAAoB;AAC5B,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,GAAA,GACjC,EAAE,GAAAC,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClE,EAAE,MAAAC,MAASC,EAA8B,EAAE,aAAaX,GAAW,OAAAC,GAAO,GAC1EW,IAAuBF,EAAK,sBAE5B,EAAE,aAAaG,GAAgB,WAAWC,EAAA,IAC9CC,EAAA,GAGI,EAAE,eAAAC,GAAe,eAAAC,EAAA,IAAkBC,EAAQ,MAAM;AACrD,UAAMC,IAA2C,CAAA,GAC3CC,IACJ,CAAA,GACIC,IAAkBT,EAAqB,mBAAmB,CAAA;AAMhE,WAAAS,EAAgB,QAAQ,CAACC,GAAgBC,MAAU;AACjD,UAAI,CAACD,EAAe,IAAK;AAEzB,YAAME,IAAqBC,EAAgBH,GAAgBC,GAAOF,CAAe,GAC3EK,IAAuBC,EAAoBL,EAAe,gBAAgB,CAAA,CAAE,GAC5E,EAAE,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
{"version":3,"file":"StateTaxesForm.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTaxRequirementsUpdateStateMutation } from '@gusto/embedded-api/react-query/taxRequirementsUpdateState'\nimport { useTaxRequirementsGetSuspense } from '@gusto/embedded-api/react-query/taxRequirementsGet'\nimport { z } from 'zod'\nimport { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { getUniqueRhfKey } from '../shared/rhfKey'\nimport { isRequirementApplicable, type StateTaxesFormValues } from '../shared/applicableIf'\nimport { prepareRequirements } from '../shared/prepareRequirements'\nimport { buildRequirementSchema } from '../shared/buildRequirementSchema'\nimport { stringifyRequirementValue } from '../shared/requirementValue'\nimport { parseRequirementSetError } from '../shared/requirementSetError'\nimport { Head } from './Head'\nimport { StateTaxesFormProvider } from './context'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { componentEvents } from '@/shared/constants'\nimport { useBase } from '@/components/Base'\nimport { SDKInternalError } from '@/types/sdkError'\n\n/**\n * Props for {@link StateTaxesForm}.\n *\n * @public\n */\nexport interface StateTaxesFormProps extends BaseComponentInterface<'Company.StateTaxes'> {\n /** The associated company identifier. */\n companyId: string\n /** Two-letter code of the state whose tax requirements are edited. */\n state: string\n}\n\n/**\n * Standalone form for editing a company's state tax requirements for a single state.\n *\n * @remarks\n * Lower-level building block used by {@link StateTaxes} for its edit view. Use directly when\n * you need full control over navigation between the list and edit views.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `company/stateTaxes/updated` | State tax requirements were saved successfully | Response from the update state tax requirements API |\n * | `CANCEL` | The user cancelled editing | — |\n *\n * @param props - {@link StateTaxesFormProps}\n * @returns The rendered state taxes edit form.\n * @public\n *\n * @example\n * ```tsx\n * import { CompanyOnboarding } from '@gusto/embedded-react-sdk'\n *\n * function MyComponent() {\n * return (\n * <CompanyOnboarding.StateTaxesForm\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * state=\"CA\"\n * onEvent={() => {}}\n * />\n * )\n * }\n * ```\n */\nexport function StateTaxesForm(props: StateTaxesFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, state, className, children }: StateTaxesFormProps) {\n useI18n('Company.StateTaxes')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { data } = useTaxRequirementsGetSuspense({ companyUuid: companyId, state })\n const stateTaxRequirements = data.taxRequirementsState!\n\n const { mutateAsync: updateStateTax, isPending: isPendingUpdate } =\n useTaxRequirementsUpdateStateMutation()\n\n // Schema and default value generation\n const { dynamicSchema, defaultValues } = useMemo(() => {\n const schemaShape: Record<string, z.ZodObject> = {}\n const values: Partial<Record<string, Record<string, string | boolean | number | undefined>>> =\n {}\n const requirementSets = stateTaxRequirements.requirementSets ?? []\n\n //Looping through each requirement set. A single key (e.g. \"taxrates\") can appear more than\n //once when a future-dated set is already scheduled alongside the current one, so each set\n //needs its own disambiguated path — otherwise two visually distinct sections would silently\n //share one underlying form field.\n requirementSets.forEach((requirementSet, index) => {\n if (!requirementSet.key) return\n\n const requirementSetPath = getUniqueRhfKey(requirementSet, index, requirementSets)\n const preparedRequirements = prepareRequirements(requirementSet.requirements ?? [])\n const { shape, defaults } = buildRequirementSchema(preparedRequirements, t)\n\n if (Object.keys(shape).length > 0) {\n schemaShape[requirementSetPath] = z.object(shape)\n values[requirementSetPath] = defaults\n }\n })\n\n const finalSchema = z.object(schemaShape)\n\n // Return both the schema and the default values\n return {\n dynamicSchema: finalSchema,\n defaultValues: values as z.infer<typeof finalSchema>,\n }\n }, [stateTaxRequirements, t])\n\n // Infer the type from the schema\n type InferredFormInputs = z.infer<typeof dynamicSchema>\n\n const { control, ...methods } = useForm({\n resolver: zodResolver(dynamicSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InferredFormInputs) => {\n await baseSubmitHandler(formData, async payload => {\n const formValues = payload as StateTaxesFormValues\n const allRequirementSets = stateTaxRequirements.requirementSets ?? []\n const requirementSets = allRequirementSets\n .map((requirementSet, setIndex) => ({ requirementSet, setIndex }))\n .filter(({ requirementSet, setIndex }) => {\n if (!requirementSet.key) return false\n const requirementSetPath = getUniqueRhfKey(requirementSet, setIndex, allRequirementSets)\n return Boolean(payload[requirementSetPath])\n })\n .map(({ requirementSet, setIndex }) => {\n const requirementSetKey = requirementSet.key as string\n const requirementSetPath = getUniqueRhfKey(requirementSet, setIndex, allRequirementSets)\n const payloadSet = payload[requirementSetPath] as Record<string, unknown>\n const preparedRequirements = prepareRequirements(requirementSet.requirements ?? [])\n\n const applicableRequirements = preparedRequirements\n .map((req, index) => ({ req, index }))\n .filter(({ req }) => isRequirementApplicable(req, requirementSetPath, formValues))\n\n return {\n state,\n key: requirementSetKey,\n effectiveFrom: requirementSet.effectiveFrom,\n requirements: applicableRequirements.map(({ req, index }) => ({\n key: req.key as string,\n value: stringifyRequirementValue(\n payloadSet[getUniqueRhfKey(req, index, preparedRequirements)],\n ),\n })),\n }\n })\n try {\n await updateStateTax({\n request: {\n companyUuid: companyId,\n requestBody: { requirementSets },\n state,\n },\n })\n } catch (error) {\n const requirementSetError = parseRequirementSetError(error)\n if (!requirementSetError) throw error\n\n const section =\n stateTaxRequirements.requirementSets?.find(\n requirementSet => requirementSet.key === requirementSetError.key,\n )?.label ?? requirementSetError.key\n throw new SDKInternalError(\n t('errors.incompleteRequirementSet', {\n section,\n state: requirementSetError.state ?? state,\n }),\n 'api_error',\n )\n }\n onEvent(componentEvents.COMPANY_STATE_TAX_UPDATED)\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods} control={control}>\n <HtmlForm onSubmit={methods.handleSubmit(onSubmit)}>\n <StateTaxesFormProvider\n value={{ stateTaxRequirements, isPending: isPendingUpdate, state, handleCancel }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </StateTaxesFormProvider>\n </HtmlForm>\n </FormProvider>\n </section>\n )\n}\n"],"names":["StateTaxesForm","props","jsx","BaseComponent","Root","companyId","state","className","children","useI18n","onEvent","baseSubmitHandler","useBase","t","useTranslation","data","useTaxRequirementsGetSuspense","stateTaxRequirements","updateStateTax","isPendingUpdate","useTaxRequirementsUpdateStateMutation","dynamicSchema","defaultValues","useMemo","schemaShape","values","requirementSets","requirementSet","index","requirementSetPath","getUniqueRhfKey","preparedRequirements","prepareRequirements","shape","defaults","buildRequirementSchema","z","control","methods","useForm","zodResolver","onSubmit","formData","payload","formValues","allRequirementSets","setIndex","requirementSetKey","payloadSet","applicableRequirements","req","isRequirementApplicable","stringifyRequirementValue","error","requirementSetError","parseRequirementSetError","section","SDKInternalError","componentEvents","handleCancel","FormProvider","HtmlForm","StateTaxesFormProvider","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsEO,SAASA,GAAeC,GAA4B;AACzD,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,GAAK,EAAE,WAAAC,GAAW,OAAAC,GAAO,WAAAC,GAAW,UAAAC,KAAiC;AAC5E,EAAAC,GAAQ,oBAAoB;AAC5B,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,GAAA,GACjC,EAAE,GAAAC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AAoB;AAClC,cAAM,IAAIG;AAAA,UACR5C,EAAE,mCAAmC;AAAA,YACnC,SAAA2C;AAAA,YACA,OAAOF,EAAoB,SAAShD;AAAA,UAAA,CACrC;AAAA,UACD;AAAA,QAAA;AAAA,MAEJ;AACA,MAAAI,EAAQgD,EAAgB,yBAAyB;AAAA,IACnD,CAAC;AAAA,EACH,GAEMC,IAAe,MAAM;AACzB,IAAAjD,EAAQgD,EAAgB,MAAM;AAAA,EAChC;AAEA,SACE,gBAAAxD,EAAC,WAAA,EAAQ,WAAAK,GACP,UAAA,gBAAAL,EAAC0D,KAAc,GAAGtB,GAAS,SAAAD,GACzB,UAAA,gBAAAnC,EAAC2D,IAAA,EAAS,UAAUvB,EAAQ,aAAaG,CAAQ,GAC/C,UAAA,gBAAAvC;AAAA,IAAC4D;AAAA,IAAA;AAAA,MACC,OAAO,EAAE,sBAAA7C,GAAsB,WAAWE,GAAiB,OAAAb,GAAO,cAAAqD,EAAA;AAAA,MAElE,UAAA,gBAAAzD,EAAC6D,MAAK,eAAc,UAAS,KAAK,IAC/B,UAAAvD,KAGC,gBAAAwD,EAAAC,GAAA,EACE,UAAA;AAAA,QAAA,gBAAA/D,EAACgE,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX,EAAA,CAEJ;AAAA,IAAA;AAAA,EAAA,EACF,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UnprocessableEntityError as n } from "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
2
|
+
function o(e) {
|
|
3
|
+
return typeof e == "object" && e !== null && "key" in e && typeof e.key == "string";
|
|
4
|
+
}
|
|
5
|
+
function i(e) {
|
|
6
|
+
if (!(e instanceof n)) return null;
|
|
7
|
+
const t = e.errors.find(
|
|
8
|
+
(r) => r.errorKey === "requirement_sets" && r.category === "nested_errors"
|
|
9
|
+
);
|
|
10
|
+
return !t || !o(t.metadata) ? null : { key: t.metadata.key, state: t.metadata.state };
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
i as parseRequirementSetError
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=requirementSetError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requirementSetError.js","sources":["../../../../../src/components/Company/StateTaxes/shared/requirementSetError.ts"],"sourcesContent":["import { UnprocessableEntityError } from '@gusto/embedded-api/models/errors/unprocessableentityerror'\n\nfunction hasMetadataKey(metadata: unknown): metadata is { key: string; state?: string } {\n return (\n typeof metadata === 'object' &&\n metadata !== null &&\n 'key' in metadata &&\n typeof (metadata as { key: unknown }).key === 'string'\n )\n}\n\n/**\n * `{ key, state }` identifying which requirement set an incomplete-requirement-set error targets.\n *\n * @internal\n */\nexport interface RequirementSetError {\n key: string\n state?: string\n}\n\n/**\n * Extracts `{ key, state }` from a tax-requirements-update error shaped as\n * `{ errorKey: \"requirement_sets\", category: \"nested_errors\", metadata: { key, state } }` —\n * the update endpoint's response when a requirement set (e.g. \"registrations\") was submitted\n * incomplete. Returns `null` for any other error shape.\n *\n * @internal\n */\nexport function parseRequirementSetError(error: unknown): RequirementSetError | null {\n if (!(error instanceof UnprocessableEntityError)) return null\n\n const match = error.errors.find(\n err => err.errorKey === 'requirement_sets' && err.category === 'nested_errors',\n )\n if (!match || !hasMetadataKey(match.metadata)) return null\n\n return { key: match.metadata.key, state: match.metadata.state }\n}\n"],"names":["hasMetadataKey","metadata","parseRequirementSetError","error","UnprocessableEntityError","match","err"],"mappings":";AAEA,SAASA,EAAeC,GAAgE;AACtF,SACE,OAAOA,KAAa,YACpBA,MAAa,QACb,SAASA,KACT,OAAQA,EAA8B,OAAQ;AAElD;AAoBO,SAASC,EAAyBC,GAA4C;AACnF,MAAI,EAAEA,aAAiBC,GAA2B,QAAO;AAEzD,QAAMC,IAAQF,EAAM,OAAO;AAAA,IACzB,CAAAG,MAAOA,EAAI,aAAa,sBAAsBA,EAAI,aAAa;AAAA,EAAA;AAEjE,SAAI,CAACD,KAAS,CAACL,EAAeK,EAAM,QAAQ,IAAU,OAE/C,EAAE,KAAKA,EAAM,SAAS,KAAK,OAAOA,EAAM,SAAS,MAAA;AAC1D;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PaySchedule as r } from "../PaySchedule/management/PaySchedule.js";
|
|
2
|
+
import { PayScheduleAssignment as t } from "../PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js";
|
|
3
|
+
export {
|
|
4
|
+
r as PaySchedule,
|
|
5
|
+
t as PayScheduleAssignment
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=companyManagement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companyManagement.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -3,10 +3,10 @@ import { useTranslation as x, Trans as s } from "react-i18next";
|
|
|
3
3
|
import { BaseLayout as b } from "../../../Base/Base.js";
|
|
4
4
|
import "../../../Base/useBase.js";
|
|
5
5
|
import { Form as I } from "../../../Common/Form/Form.js";
|
|
6
|
-
import { Flex as l } from "../../../Common/Flex/Flex.js";
|
|
7
6
|
import { SDKFormProvider as R } from "../../../../partner-hook-utils/form/SDKFormProvider.js";
|
|
8
7
|
import { useComponentContext as D } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
9
8
|
import { useI18n as F, useComponentDictionary as S } from "../../../../i18n/I18n.js";
|
|
9
|
+
import { Flex as l } from "../../../Common/Flex/Flex.js";
|
|
10
10
|
function Q({
|
|
11
11
|
federalTaxes: r,
|
|
12
12
|
onSubmit: d,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsxs as M, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as s } from "react-i18next";
|
|
3
3
|
import { useManagementBankFormDictionary as p } from "./useFormDictionary.js";
|
|
4
|
-
import {
|
|
5
|
-
import { useComponentContext as _ } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
4
|
+
import { useComponentContext as c } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
6
5
|
import { componentEvents as t } from "../../../../shared/constants.js";
|
|
6
|
+
import { Flex as _ } from "../../../Common/Flex/Flex.js";
|
|
7
7
|
import { BankFormBody as l } from "../shared/BankFormBody/BankFormBody.js";
|
|
8
8
|
function F({
|
|
9
9
|
employeeId: e,
|
|
10
10
|
onEvent: o,
|
|
11
11
|
...m
|
|
12
12
|
}) {
|
|
13
|
-
const r = p(), { t: a } = s("Employee.Management.PaymentMethodBankForm"), i =
|
|
14
|
-
return /* @__PURE__ */ M(
|
|
13
|
+
const r = p(), { t: a } = s("Employee.Management.PaymentMethodBankForm"), i = c();
|
|
14
|
+
return /* @__PURE__ */ M(_, { flexDirection: "column", gap: 32, children: [
|
|
15
15
|
/* @__PURE__ */ n(i.Heading, { as: "h1", styledAs: "h2", children: a("title") }),
|
|
16
16
|
/* @__PURE__ */ n(
|
|
17
17
|
l,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as p } from "react-i18next";
|
|
3
3
|
import { useOnboardingBankFormDictionary as d } from "./useFormDictionary.js";
|
|
4
|
-
import {
|
|
5
|
-
import { useComponentContext as f } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
4
|
+
import { useComponentContext as l } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
6
5
|
import { componentEvents as r } from "../../../../shared/constants.js";
|
|
6
|
+
import { Flex as f } from "../../../Common/Flex/Flex.js";
|
|
7
7
|
import { BankFormBody as C } from "../shared/BankFormBody/BankFormBody.js";
|
|
8
8
|
function F({ employeeId: t, onEvent: o, ...m }) {
|
|
9
|
-
const e = d(), { t: i } = p("Employee.PaymentMethod"), a =
|
|
10
|
-
return /* @__PURE__ */ c(
|
|
9
|
+
const e = d(), { t: i } = p("Employee.PaymentMethod"), a = l();
|
|
10
|
+
return /* @__PURE__ */ c(f, { flexDirection: "column", gap: 32, children: [
|
|
11
11
|
/* @__PURE__ */ n(a.Heading, { as: "h1", styledAs: "h2", children: i("addBankAccountFormTitle") }),
|
|
12
12
|
/* @__PURE__ */ n(
|
|
13
13
|
C,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as n, jsxs as x } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense as d } from "react";
|
|
3
3
|
import { useMachine as F } from "react-robot";
|
|
4
|
-
import { Flex as s } from "../Common/Flex/Flex.js";
|
|
5
4
|
import { FlowContext as v } from "./useFlow.js";
|
|
6
5
|
import { FlowHeader as E } from "./FlowHeader.js";
|
|
7
6
|
import { useLoadingIndicator as a } from "../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
7
|
+
import { Flex as s } from "../Common/Flex/Flex.js";
|
|
8
8
|
const g = 40;
|
|
9
9
|
function H() {
|
|
10
10
|
const { LoadingIndicator: o } = a();
|
|
@@ -2,30 +2,30 @@ import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRef as F, useState as o, useEffect as G } from "react";
|
|
3
3
|
import { useForm as R, FormProvider as U } from "react-hook-form";
|
|
4
4
|
import { useTranslation as z } from "react-i18next";
|
|
5
|
-
import { z as
|
|
5
|
+
import { z as C } from "zod";
|
|
6
6
|
import { zodResolver as H } from "@hookform/resolvers/zod";
|
|
7
7
|
import a from "./GrossUpModal.module.scss.js";
|
|
8
|
-
import { Flex as
|
|
9
|
-
import { ActionsLayout as
|
|
8
|
+
import { Flex as L } from "../../Common/Flex/Flex.js";
|
|
9
|
+
import { ActionsLayout as j } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
10
10
|
import "react-error-boundary";
|
|
11
11
|
import "@tanstack/react-query";
|
|
12
|
-
import { useBase as
|
|
12
|
+
import { useBase as k } from "../../Base/useBase.js";
|
|
13
13
|
import "@gusto/embedded-api/models/errors/apierror";
|
|
14
14
|
import "@gusto/embedded-api/models/errors/gustoembeddederror";
|
|
15
15
|
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
16
16
|
import "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
17
17
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
18
|
-
import { formatNumberAsCurrency as
|
|
18
|
+
import { formatNumberAsCurrency as B } from "../../../helpers/formattedStrings.js";
|
|
19
19
|
import "../../../shared/constants.js";
|
|
20
|
-
import { useComponentContext as
|
|
21
|
-
import { useI18n as
|
|
20
|
+
import { useComponentContext as V } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
21
|
+
import { useI18n as D } from "../../../i18n/I18n.js";
|
|
22
22
|
import { NumberInputField as E } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
23
|
-
const T =
|
|
24
|
-
netPay:
|
|
23
|
+
const T = C.object({
|
|
24
|
+
netPay: C.number().positive()
|
|
25
25
|
});
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
const { t: r } = z("Payroll.GrossUpModal"), { Modal:
|
|
26
|
+
function pe({ isOpen: n, onCalculateGrossUp: w, onApply: P, onCancel: p }) {
|
|
27
|
+
D("Payroll.GrossUpModal");
|
|
28
|
+
const { t: r } = z("Payroll.GrossUpModal"), { Modal: x, Heading: u, Text: i, Button: c, Alert: f } = V(), { baseSubmitHandler: y } = k(), A = F(null), [l, m] = o(null), [h, d] = o(null), [M, g] = o(!1), [N, v] = o(!1), s = R({
|
|
29
29
|
resolver: H(T),
|
|
30
30
|
// Start blank rather than 0: 0 is not a valid net amount, and a leading 0
|
|
31
31
|
// in the field means typing an amount produces values like "0350".
|
|
@@ -35,22 +35,22 @@ function ue({ isOpen: n, onCalculateGrossUp: P, onApply: x, onCancel: u }) {
|
|
|
35
35
|
n || (s.reset(), m(null), d(null));
|
|
36
36
|
}, [n, s.reset]);
|
|
37
37
|
const I = async (S) => {
|
|
38
|
-
d(null), m(null),
|
|
38
|
+
d(null), m(null), g(!0), await y(null, async () => {
|
|
39
39
|
try {
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
const b = await w(S.netPay);
|
|
41
|
+
b ? m(b) : d(r("errorMessage"));
|
|
42
42
|
} finally {
|
|
43
|
-
|
|
43
|
+
g(!1);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
47
|
return /* @__PURE__ */ e(
|
|
48
|
-
|
|
48
|
+
x,
|
|
49
49
|
{
|
|
50
50
|
isOpen: n,
|
|
51
|
-
onClose:
|
|
52
|
-
containerRef:
|
|
53
|
-
footer: /* @__PURE__ */ t(
|
|
51
|
+
onClose: p,
|
|
52
|
+
containerRef: A,
|
|
53
|
+
footer: /* @__PURE__ */ t(j, { children: [
|
|
54
54
|
/* @__PURE__ */ e(
|
|
55
55
|
c,
|
|
56
56
|
{
|
|
@@ -59,7 +59,7 @@ function ue({ isOpen: n, onCalculateGrossUp: P, onApply: x, onCancel: u }) {
|
|
|
59
59
|
onClick: async () => {
|
|
60
60
|
l && (v(!0), await y(null, async () => {
|
|
61
61
|
try {
|
|
62
|
-
await
|
|
62
|
+
await P(l);
|
|
63
63
|
} finally {
|
|
64
64
|
v(!1);
|
|
65
65
|
}
|
|
@@ -69,17 +69,17 @@ function ue({ isOpen: n, onCalculateGrossUp: P, onApply: x, onCancel: u }) {
|
|
|
69
69
|
children: r("applyCta")
|
|
70
70
|
}
|
|
71
71
|
),
|
|
72
|
-
/* @__PURE__ */ e(c, { variant: "secondary", onClick:
|
|
72
|
+
/* @__PURE__ */ e(c, { variant: "secondary", onClick: p, children: r("cancelCta") })
|
|
73
73
|
] }),
|
|
74
74
|
children: /* @__PURE__ */ t(U, { ...s, children: [
|
|
75
75
|
/* @__PURE__ */ t("div", { className: a.header, children: [
|
|
76
|
-
/* @__PURE__ */ e(
|
|
76
|
+
/* @__PURE__ */ e(u, { as: "h2", styledAs: "h3", children: r("title") }),
|
|
77
77
|
/* @__PURE__ */ e(i, { variant: "supporting", as: "p", children: r("description") })
|
|
78
78
|
] }),
|
|
79
79
|
/* @__PURE__ */ t("div", { className: a.content, children: [
|
|
80
80
|
h && /* @__PURE__ */ e("div", { className: a.alert, children: /* @__PURE__ */ e(f, { label: h, status: "error", disableScrollIntoView: !0 }) }),
|
|
81
81
|
/* @__PURE__ */ e("div", { className: a.alert, children: /* @__PURE__ */ e(f, { label: r("warning"), status: "warning", disableScrollIntoView: !0 }) }),
|
|
82
|
-
/* @__PURE__ */ t(
|
|
82
|
+
/* @__PURE__ */ t(L, { flexDirection: "row", gap: 8, alignItems: "flex-end", children: [
|
|
83
83
|
/* @__PURE__ */ e(
|
|
84
84
|
E,
|
|
85
85
|
{
|
|
@@ -97,15 +97,15 @@ function ue({ isOpen: n, onCalculateGrossUp: P, onApply: x, onCancel: u }) {
|
|
|
97
97
|
{
|
|
98
98
|
variant: "secondary",
|
|
99
99
|
className: a.calculateButton,
|
|
100
|
-
|
|
100
|
+
isLoading: M,
|
|
101
101
|
onClick: s.handleSubmit(I),
|
|
102
|
-
children: r(
|
|
102
|
+
children: r("calculateCta")
|
|
103
103
|
}
|
|
104
104
|
)
|
|
105
105
|
] }),
|
|
106
106
|
l ? /* @__PURE__ */ t("div", { className: a.result, children: [
|
|
107
107
|
/* @__PURE__ */ e(i, { size: "sm", variant: "supporting", weight: "semibold", children: r("grossPayResult") }),
|
|
108
|
-
/* @__PURE__ */ e(
|
|
108
|
+
/* @__PURE__ */ e(u, { as: "h3", children: B(parseFloat(l)) })
|
|
109
109
|
] }) : /* @__PURE__ */ e(i, { size: "sm", variant: "supporting", children: r("applyHint") })
|
|
110
110
|
] })
|
|
111
111
|
] })
|
|
@@ -113,6 +113,6 @@ function ue({ isOpen: n, onCalculateGrossUp: P, onApply: x, onCancel: u }) {
|
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
export {
|
|
116
|
-
|
|
116
|
+
pe as GrossUpModal
|
|
117
117
|
};
|
|
118
118
|
//# sourceMappingURL=GrossUpModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrossUpModal.js","sources":["../../../../src/components/Payroll/GrossUpModal/GrossUpModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { GrossUpModalProps } from './GrossUpModalTypes'\nimport styles from './GrossUpModal.module.scss'\nimport { ActionsLayout, Flex, NumberInputField } from '@/components/Common'\nimport { useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\n\nconst GrossUpFormSchema = z.object({\n netPay: z.number().positive(),\n})\n\ntype GrossUpFormValues = z.infer<typeof GrossUpFormSchema>\n\n/** @internal */\nexport function GrossUpModal({ isOpen, onCalculateGrossUp, onApply, onCancel }: GrossUpModalProps) {\n useI18n('Payroll.GrossUpModal')\n const { t } = useTranslation('Payroll.GrossUpModal')\n const { Modal, Heading, Text, Button, Alert } = useComponentContext()\n const { baseSubmitHandler } = useBase()\n const modalContainerRef = useRef<HTMLDivElement>(null)\n\n const [calculatedGrossUp, setCalculatedGrossUp] = useState<string | null>(null)\n const [errorMessage, setErrorMessage] = useState<string | null>(null)\n const [isCalculating, setIsCalculating] = useState(false)\n const [isApplying, setIsApplying] = useState(false)\n\n const formHandlers = useForm<GrossUpFormValues>({\n resolver: zodResolver(GrossUpFormSchema),\n // Start blank rather than 0: 0 is not a valid net amount, and a leading 0\n // in the field means typing an amount produces values like \"0350\".\n defaultValues: {},\n })\n\n useEffect(() => {\n if (!isOpen) {\n formHandlers.reset()\n setCalculatedGrossUp(null)\n setErrorMessage(null)\n }\n }, [isOpen, formHandlers.reset])\n\n const handleCalculate = async (data: GrossUpFormValues) => {\n setErrorMessage(null)\n setCalculatedGrossUp(null)\n setIsCalculating(true)\n\n await baseSubmitHandler(null, async () => {\n try {\n const result = await onCalculateGrossUp(data.netPay)\n\n if (result) {\n setCalculatedGrossUp(result)\n } else {\n setErrorMessage(t('errorMessage'))\n }\n } finally {\n setIsCalculating(false)\n }\n })\n }\n\n const handleApply = async () => {\n if (calculatedGrossUp) {\n setIsApplying(true)\n await baseSubmitHandler(null, async () => {\n try {\n await onApply(calculatedGrossUp)\n } finally {\n setIsApplying(false)\n }\n })\n }\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onCancel}\n containerRef={modalContainerRef}\n footer={\n <ActionsLayout>\n <Button\n variant=\"primary\"\n isDisabled={!calculatedGrossUp}\n onClick={handleApply}\n isLoading={isApplying}\n >\n {t('applyCta')}\n </Button>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('cancelCta')}\n </Button>\n </ActionsLayout>\n }\n >\n <FormProvider {...formHandlers}>\n <div className={styles.header}>\n <Heading as=\"h2\" styledAs=\"h3\">\n {t('title')}\n </Heading>\n <Text variant=\"supporting\" as=\"p\">\n {t('description')}\n </Text>\n </div>\n\n <div className={styles.content}>\n {errorMessage && (\n <div className={styles.alert}>\n <Alert label={errorMessage} status=\"error\" disableScrollIntoView />\n </div>\n )}\n\n <div className={styles.alert}>\n <Alert label={t('warning')} status=\"warning\" disableScrollIntoView />\n </div>\n\n {/* Bottom-align on the row itself: the .calculateButton align-self\n rule below only targets the default (react-aria) adapter, so in\n other adapters the button otherwise falls back to flex-start. */}\n <Flex flexDirection=\"row\" gap={8} alignItems=\"flex-end\">\n <NumberInputField\n name=\"netPay\"\n label={t('netPayLabel')}\n format=\"currency\"\n adornmentStart=\"$\"\n errorMessage={t('validations.netPay')}\n min={0}\n isRequired\n />\n <Button\n variant=\"secondary\"\n className={styles.calculateButton}\n
|
|
1
|
+
{"version":3,"file":"GrossUpModal.js","sources":["../../../../src/components/Payroll/GrossUpModal/GrossUpModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { GrossUpModalProps } from './GrossUpModalTypes'\nimport styles from './GrossUpModal.module.scss'\nimport { ActionsLayout, Flex, NumberInputField } from '@/components/Common'\nimport { useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\n\nconst GrossUpFormSchema = z.object({\n netPay: z.number().positive(),\n})\n\ntype GrossUpFormValues = z.infer<typeof GrossUpFormSchema>\n\n/** @internal */\nexport function GrossUpModal({ isOpen, onCalculateGrossUp, onApply, onCancel }: GrossUpModalProps) {\n useI18n('Payroll.GrossUpModal')\n const { t } = useTranslation('Payroll.GrossUpModal')\n const { Modal, Heading, Text, Button, Alert } = useComponentContext()\n const { baseSubmitHandler } = useBase()\n const modalContainerRef = useRef<HTMLDivElement>(null)\n\n const [calculatedGrossUp, setCalculatedGrossUp] = useState<string | null>(null)\n const [errorMessage, setErrorMessage] = useState<string | null>(null)\n const [isCalculating, setIsCalculating] = useState(false)\n const [isApplying, setIsApplying] = useState(false)\n\n const formHandlers = useForm<GrossUpFormValues>({\n resolver: zodResolver(GrossUpFormSchema),\n // Start blank rather than 0: 0 is not a valid net amount, and a leading 0\n // in the field means typing an amount produces values like \"0350\".\n defaultValues: {},\n })\n\n useEffect(() => {\n if (!isOpen) {\n formHandlers.reset()\n setCalculatedGrossUp(null)\n setErrorMessage(null)\n }\n }, [isOpen, formHandlers.reset])\n\n const handleCalculate = async (data: GrossUpFormValues) => {\n setErrorMessage(null)\n setCalculatedGrossUp(null)\n setIsCalculating(true)\n\n await baseSubmitHandler(null, async () => {\n try {\n const result = await onCalculateGrossUp(data.netPay)\n\n if (result) {\n setCalculatedGrossUp(result)\n } else {\n setErrorMessage(t('errorMessage'))\n }\n } finally {\n setIsCalculating(false)\n }\n })\n }\n\n const handleApply = async () => {\n if (calculatedGrossUp) {\n setIsApplying(true)\n await baseSubmitHandler(null, async () => {\n try {\n await onApply(calculatedGrossUp)\n } finally {\n setIsApplying(false)\n }\n })\n }\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onCancel}\n containerRef={modalContainerRef}\n footer={\n <ActionsLayout>\n <Button\n variant=\"primary\"\n isDisabled={!calculatedGrossUp}\n onClick={handleApply}\n isLoading={isApplying}\n >\n {t('applyCta')}\n </Button>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('cancelCta')}\n </Button>\n </ActionsLayout>\n }\n >\n <FormProvider {...formHandlers}>\n <div className={styles.header}>\n <Heading as=\"h2\" styledAs=\"h3\">\n {t('title')}\n </Heading>\n <Text variant=\"supporting\" as=\"p\">\n {t('description')}\n </Text>\n </div>\n\n <div className={styles.content}>\n {errorMessage && (\n <div className={styles.alert}>\n <Alert label={errorMessage} status=\"error\" disableScrollIntoView />\n </div>\n )}\n\n <div className={styles.alert}>\n <Alert label={t('warning')} status=\"warning\" disableScrollIntoView />\n </div>\n\n {/* Bottom-align on the row itself: the .calculateButton align-self\n rule below only targets the default (react-aria) adapter, so in\n other adapters the button otherwise falls back to flex-start. */}\n <Flex flexDirection=\"row\" gap={8} alignItems=\"flex-end\">\n <NumberInputField\n name=\"netPay\"\n label={t('netPayLabel')}\n format=\"currency\"\n adornmentStart=\"$\"\n errorMessage={t('validations.netPay')}\n min={0}\n isRequired\n />\n <Button\n variant=\"secondary\"\n className={styles.calculateButton}\n isLoading={isCalculating}\n onClick={formHandlers.handleSubmit(handleCalculate)}\n >\n {t('calculateCta')}\n </Button>\n </Flex>\n\n {calculatedGrossUp ? (\n <div className={styles.result}>\n <Text size=\"sm\" variant=\"supporting\" weight=\"semibold\">\n {t('grossPayResult')}\n </Text>\n <Heading as=\"h3\">{formatNumberAsCurrency(parseFloat(calculatedGrossUp))}</Heading>\n </div>\n ) : (\n <Text size=\"sm\" variant=\"supporting\">\n {t('applyHint')}\n </Text>\n )}\n </div>\n </FormProvider>\n </Modal>\n )\n}\n"],"names":["GrossUpFormSchema","z","GrossUpModal","isOpen","onCalculateGrossUp","onApply","onCancel","useI18n","t","useTranslation","Modal","Heading","Text","Button","Alert","useComponentContext","baseSubmitHandler","useBase","modalContainerRef","useRef","calculatedGrossUp","setCalculatedGrossUp","useState","errorMessage","setErrorMessage","isCalculating","setIsCalculating","isApplying","setIsApplying","formHandlers","useForm","zodResolver","useEffect","handleCalculate","data","result","jsx","ActionsLayout","jsxs","FormProvider","styles","Flex","NumberInputField"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAaA,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACjC,QAAQA,EAAE,OAAA,EAAS,SAAA;AACrB,CAAC;AAKM,SAASC,GAAa,EAAE,QAAAC,GAAQ,oBAAAC,GAAoB,SAAAC,GAAS,UAAAC,KAA+B;AACjG,EAAAC,EAAQ,sBAAsB;AAC9B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,sBAAsB,GAC7C,EAAE,OAAAC,GAAO,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAAQ,OAAAC,EAAA,IAAUC,EAAA,GAC1C,EAAE,mBAAAC,EAAA,IAAsBC,EAAA,GACxBC,IAAoBC,EAAuB,IAAI,GAE/C,CAACC,GAAmBC,CAAoB,IAAIC,EAAwB,IAAI,GACxE,CAACC,GAAcC,CAAe,IAAIF,EAAwB,IAAI,GAC9D,CAACG,GAAeC,CAAgB,IAAIJ,EAAS,EAAK,GAClD,CAACK,GAAYC,CAAa,IAAIN,EAAS,EAAK,GAE5CO,IAAeC,EAA2B;AAAA,IAC9C,UAAUC,EAAY/B,CAAiB;AAAA;AAAA;AAAA,IAGvC,eAAe,CAAA;AAAA,EAAC,CACjB;AAED,EAAAgC,EAAU,MAAM;AACd,IAAK7B,MACH0B,EAAa,MAAA,GACbR,EAAqB,IAAI,GACzBG,EAAgB,IAAI;AAAA,EAExB,GAAG,CAACrB,GAAQ0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