@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,24 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { composeErrorHandler as
|
|
4
|
-
function
|
|
5
|
-
const e =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { useEmployeeTaxSetupGetFederalTaxes as i } from "@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes";
|
|
2
|
+
import { useEmployeeTaxSetupGetStateTaxes as s } from "@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes";
|
|
3
|
+
import { composeErrorHandler as o } from "../../../../partner-hook-utils/composeErrorHandler.js";
|
|
4
|
+
function d({ employeeId: t }) {
|
|
5
|
+
const e = i(
|
|
6
|
+
{ employeeUuid: t },
|
|
7
|
+
{ staleTime: 1 / 0 }
|
|
8
|
+
), a = s(
|
|
9
|
+
{ employeeUuid: t },
|
|
10
|
+
{ staleTime: 1 / 0 }
|
|
11
|
+
);
|
|
12
|
+
return {
|
|
10
13
|
isLoading: !1,
|
|
11
14
|
data: {
|
|
12
|
-
employeeFederalTax:
|
|
13
|
-
employeeStateTaxesList:
|
|
15
|
+
employeeFederalTax: e.data?.employeeFederalTax,
|
|
16
|
+
employeeStateTaxesList: a.data?.employeeStateTaxesList ?? []
|
|
14
17
|
},
|
|
15
18
|
status: {
|
|
16
|
-
isPending:
|
|
19
|
+
isPending: e.isFetching || a.isFetching,
|
|
20
|
+
isFederalTaxesLoading: e.isLoading,
|
|
21
|
+
isStateTaxesLoading: a.isLoading
|
|
17
22
|
},
|
|
18
|
-
errorHandling:
|
|
23
|
+
errorHandling: o([e, a])
|
|
19
24
|
};
|
|
20
25
|
}
|
|
21
26
|
export {
|
|
22
|
-
|
|
27
|
+
d as useEmployeeTaxes
|
|
23
28
|
};
|
|
24
29
|
//# sourceMappingURL=useEmployeeTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEmployeeTaxes.js","sources":["../../../../../src/components/Employee/Dashboard/hooks/useEmployeeTaxes.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useEmployeeTaxes.js","sources":["../../../../../src/components/Employee/Dashboard/hooks/useEmployeeTaxes.tsx"],"sourcesContent":["import { useEmployeeTaxSetupGetFederalTaxes } from '@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes'\nimport { useEmployeeTaxSetupGetStateTaxes } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport type { GetV1EmployeesEmployeeIdFederalTaxesResponse } from '@gusto/embedded-api/models/operations/getv1employeesemployeeidfederaltaxes'\nimport type { GetV1EmployeesEmployeeIdStateTaxesResponse } from '@gusto/embedded-api/models/operations/getv1employeesemployeeidstatetaxes'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport type { BaseHookReady } from '@/partner-hook-utils/types'\n\ntype EmployeeFederalTax = NonNullable<\n GetV1EmployeesEmployeeIdFederalTaxesResponse['employeeFederalTax']\n>\ntype EmployeeStateTax = NonNullable<\n GetV1EmployeesEmployeeIdStateTaxesResponse['employeeStateTaxesList']\n>[number]\n\nexport interface UseEmployeeTaxesProps {\n employeeId: string\n}\n\nexport type UseEmployeeTaxesResult = BaseHookReady<\n {\n employeeFederalTax?: EmployeeFederalTax\n employeeStateTaxesList: EmployeeStateTax[]\n },\n {\n isPending: boolean\n isFederalTaxesLoading: boolean\n isStateTaxesLoading: boolean\n }\n>\n\n/**\n * Phase B: non-Suspense queries so the federal and state tax cards\n * paint independently. `isFederalTaxesLoading` and `isStateTaxesLoading`\n * let TaxesView render a per-card skeleton while the box header stays\n * visible.\n */\nexport function useEmployeeTaxes({ employeeId }: UseEmployeeTaxesProps): UseEmployeeTaxesResult {\n // staleTime: Infinity — see useEmployeeCompensation for rationale (SDK\n // QueryClient invalidates on any mutation success).\n const federalTaxesQuery = useEmployeeTaxSetupGetFederalTaxes(\n { employeeUuid: employeeId },\n { staleTime: Infinity },\n )\n const stateTaxesQuery = useEmployeeTaxSetupGetStateTaxes(\n { employeeUuid: employeeId },\n { staleTime: Infinity },\n )\n\n return {\n isLoading: false,\n data: {\n employeeFederalTax: federalTaxesQuery.data?.employeeFederalTax,\n employeeStateTaxesList: stateTaxesQuery.data?.employeeStateTaxesList ?? [],\n },\n status: {\n isPending: federalTaxesQuery.isFetching || stateTaxesQuery.isFetching,\n isFederalTaxesLoading: federalTaxesQuery.isLoading,\n isStateTaxesLoading: stateTaxesQuery.isLoading,\n },\n errorHandling: composeErrorHandler([federalTaxesQuery, stateTaxesQuery]),\n }\n}\n"],"names":["useEmployeeTaxes","employeeId","federalTaxesQuery","useEmployeeTaxSetupGetFederalTaxes","stateTaxesQuery","useEmployeeTaxSetupGetStateTaxes","composeErrorHandler"],"mappings":";;;AAoCO,SAASA,EAAiB,EAAE,YAAAC,KAA6D;AAG9F,QAAMC,IAAoBC;AAAA,IACxB,EAAE,cAAcF,EAAA;AAAA,IAChB,EAAE,WAAW,MAAA;AAAA,EAAS,GAElBG,IAAkBC;AAAA,IACtB,EAAE,cAAcJ,EAAA;AAAA,IAChB,EAAE,WAAW,MAAA;AAAA,EAAS;AAGxB,SAAO;AAAA,IACL,WAAW;AAAA,IACX,MAAM;AAAA,MACJ,oBAAoBC,EAAkB,MAAM;AAAA,MAC5C,wBAAwBE,EAAgB,MAAM,0BAA0B,CAAA;AAAA,IAAC;AAAA,IAE3E,QAAQ;AAAA,MACN,WAAWF,EAAkB,cAAcE,EAAgB;AAAA,MAC3D,uBAAuBF,EAAkB;AAAA,MACzC,qBAAqBE,EAAgB;AAAA,IAAA;AAAA,IAEvC,eAAeE,EAAoB,CAACJ,GAAmBE,CAAe,CAAC;AAAA,EAAA;AAE3E;"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { TextInputHookField as n } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
3
|
+
import { SelectHookField as t } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
3
4
|
import { NumberInputHookField as i } from "../../../../../partner-hook-utils/form/fields/NumberInputHookField.js";
|
|
4
|
-
import { TextInputHookField as t } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
5
5
|
function d(e) {
|
|
6
|
-
return /* @__PURE__ */ r(
|
|
6
|
+
return /* @__PURE__ */ r(t, { ...e, name: "state" });
|
|
7
7
|
}
|
|
8
8
|
function f(e) {
|
|
9
|
-
return /* @__PURE__ */ r(
|
|
9
|
+
return /* @__PURE__ */ r(t, { ...e, name: "fipsCode" });
|
|
10
10
|
}
|
|
11
11
|
function c(e) {
|
|
12
|
-
return /* @__PURE__ */ r(
|
|
12
|
+
return /* @__PURE__ */ r(n, { ...e, name: "caseNumber" });
|
|
13
13
|
}
|
|
14
14
|
function l(e) {
|
|
15
|
-
return /* @__PURE__ */ r(
|
|
15
|
+
return /* @__PURE__ */ r(n, { ...e, name: "orderNumber" });
|
|
16
16
|
}
|
|
17
17
|
function F(e) {
|
|
18
|
-
return /* @__PURE__ */ r(
|
|
18
|
+
return /* @__PURE__ */ r(n, { ...e, name: "remittanceNumber" });
|
|
19
19
|
}
|
|
20
20
|
function p(e) {
|
|
21
21
|
return /* @__PURE__ */ r(i, { ...e, name: "payPeriodMaximum" });
|
|
@@ -24,7 +24,7 @@ function b(e) {
|
|
|
24
24
|
return /* @__PURE__ */ r(i, { ...e, name: "amount" });
|
|
25
25
|
}
|
|
26
26
|
function N(e) {
|
|
27
|
-
return /* @__PURE__ */ r(
|
|
27
|
+
return /* @__PURE__ */ r(t, { ...e, name: "paymentPeriod" });
|
|
28
28
|
}
|
|
29
29
|
export {
|
|
30
30
|
b as AmountField,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { TextInputHookField as o } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
3
|
+
import { SelectHookField as i } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
3
4
|
import { NumberInputHookField as t } from "../../../../../partner-hook-utils/form/fields/NumberInputHookField.js";
|
|
4
5
|
import { RadioGroupHookField as r } from "../../../../../partner-hook-utils/form/fields/RadioGroupHookField.js";
|
|
5
|
-
import { TextInputHookField as i } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
6
6
|
function l(n) {
|
|
7
|
-
return /* @__PURE__ */ e(
|
|
7
|
+
return /* @__PURE__ */ e(o, { ...n, name: "description" });
|
|
8
8
|
}
|
|
9
9
|
function p(n) {
|
|
10
10
|
return /* @__PURE__ */ e(r, { ...n, name: "recurring" });
|
|
@@ -22,7 +22,7 @@ function A(n) {
|
|
|
22
22
|
return /* @__PURE__ */ e(t, { ...n, name: "annualMaximum" });
|
|
23
23
|
}
|
|
24
24
|
function g(n) {
|
|
25
|
-
return /* @__PURE__ */ e(
|
|
25
|
+
return /* @__PURE__ */ e(i, { ...n, name: "garnishmentType" });
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
28
|
F as AmountField,
|
package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-error-boundary";
|
|
4
|
+
import "react-i18next";
|
|
5
|
+
import "@tanstack/react-query";
|
|
2
6
|
import "../../../../../Base/useBase.js";
|
|
3
|
-
|
|
7
|
+
import "@gusto/embedded-api/models/errors/apierror";
|
|
8
|
+
import "@gusto/embedded-api/models/errors/gustoembeddederror";
|
|
9
|
+
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
10
|
+
import "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
11
|
+
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
|
+
import "dompurify";
|
|
13
|
+
import "../../../../../../contexts/LocaleProvider/useLocale.js";
|
|
14
|
+
import "../../../../../../shared/constants.js";
|
|
15
|
+
import "classnames";
|
|
16
|
+
import "../../../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
17
|
+
import "../../../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
18
|
+
import { createCompoundContext as t } from "../../../../../Base/createCompoundContext.js";
|
|
19
|
+
const [P, b] = t("DocumentListContext");
|
|
4
20
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
21
|
+
b as DocumentListProvider,
|
|
22
|
+
P as useDocumentList
|
|
7
23
|
};
|
|
8
24
|
//# sourceMappingURL=useDocumentList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentList.js","sources":["../../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDocumentList.js","sources":["../../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;;AAYA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { CheckboxHookField as t } from "../../../../../partner-hook-utils/form/fields/CheckboxHookField.js";
|
|
3
2
|
import { TextInputHookField as n } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
4
3
|
import { SelectHookField as a } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
4
|
+
import { CheckboxHookField as t } from "../../../../../partner-hook-utils/form/fields/CheckboxHookField.js";
|
|
5
5
|
import { RadioGroupHookField as p } from "../../../../../partner-hook-utils/form/fields/RadioGroupHookField.js";
|
|
6
6
|
function c(r) {
|
|
7
7
|
return /* @__PURE__ */ e(n, { ...r, name: "signature" });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { SelectHookField as t } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
2
3
|
import { NumberInputHookField as o } from "../../../../../partner-hook-utils/form/fields/NumberInputHookField.js";
|
|
3
|
-
import { RadioGroupHookField as
|
|
4
|
-
import { SelectHookField as r } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
4
|
+
import { RadioGroupHookField as r } from "../../../../../partner-hook-utils/form/fields/RadioGroupHookField.js";
|
|
5
5
|
function d(n) {
|
|
6
|
-
return /* @__PURE__ */ e(
|
|
6
|
+
return /* @__PURE__ */ e(t, { ...n, name: "filingStatus" });
|
|
7
7
|
}
|
|
8
8
|
function a(n) {
|
|
9
|
-
return /* @__PURE__ */ e(
|
|
9
|
+
return /* @__PURE__ */ e(r, { ...n, name: "twoJobs" });
|
|
10
10
|
}
|
|
11
11
|
function f(n) {
|
|
12
12
|
return /* @__PURE__ */ e(o, { ...n, name: "dependentsAmount", format: "currency", min: 0 });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { RadioGroupHookField as r } from "../../../../../partner-hook-utils/form/fields/RadioGroupHookField.js";
|
|
3
2
|
import { TextInputHookField as o } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
3
|
+
import { RadioGroupHookField as r } from "../../../../../partner-hook-utils/form/fields/RadioGroupHookField.js";
|
|
4
4
|
function m(e) {
|
|
5
5
|
return /* @__PURE__ */ n(o, { ...e, name: "name" });
|
|
6
6
|
}
|
package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { useWatch as f } from "react-hook-form";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { NumberInputHookField as s } from "../../../../../partner-hook-utils/form/fields/NumberInputHookField.js";
|
|
4
|
+
import { SPLIT_BY as F } from "../../../../../shared/constants.js";
|
|
5
5
|
function B(t) {
|
|
6
6
|
function n({
|
|
7
7
|
label: r,
|
|
@@ -13,9 +13,9 @@ function B(t) {
|
|
|
13
13
|
placeholder: c,
|
|
14
14
|
FieldComponent: d
|
|
15
15
|
}) {
|
|
16
|
-
const l = o?.form.hookFormInternals.formMethods.control, p = f({ control: l, name: "splitBy" }) ===
|
|
16
|
+
const l = o?.form.hookFormInternals.formMethods.control, p = f({ control: l, name: "splitBy" }) === F.amount ? "currency" : "percent";
|
|
17
17
|
return /* @__PURE__ */ a(
|
|
18
|
-
|
|
18
|
+
s,
|
|
19
19
|
{
|
|
20
20
|
name: `splitAmount.${t}`,
|
|
21
21
|
formHookResult: o,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useFormFieldsMetadataContext as r } from "../../../../../partner-hook-utils/form/FormFieldsMetadataContext.js";
|
|
3
|
-
import { usePlaceholderSSN as m, normalizeSSN as l } from "../../../../../helpers/ssn.js";
|
|
4
|
-
import { SwitchHookField as d } from "../../../../../partner-hook-utils/form/fields/SwitchHookField.js";
|
|
5
2
|
import { TextInputHookField as a } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
6
|
-
import { DatePickerHookField as
|
|
3
|
+
import { DatePickerHookField as r } from "../../../../../partner-hook-utils/form/fields/DatePickerHookField.js";
|
|
4
|
+
import { SwitchHookField as m } from "../../../../../partner-hook-utils/form/fields/SwitchHookField.js";
|
|
5
|
+
import { useFormFieldsMetadataContext as l } from "../../../../../partner-hook-utils/form/FormFieldsMetadataContext.js";
|
|
6
|
+
import { usePlaceholderSSN as d, normalizeSSN as f } from "../../../../../helpers/ssn.js";
|
|
7
7
|
function h(e) {
|
|
8
8
|
return /* @__PURE__ */ t(a, { ...e, name: "firstName" });
|
|
9
9
|
}
|
|
@@ -17,22 +17,22 @@ function x(e) {
|
|
|
17
17
|
return /* @__PURE__ */ t(a, { ...e, name: "email" });
|
|
18
18
|
}
|
|
19
19
|
function H(e) {
|
|
20
|
-
return /* @__PURE__ */ t(
|
|
20
|
+
return /* @__PURE__ */ t(r, { ...e, name: "dateOfBirth" });
|
|
21
21
|
}
|
|
22
22
|
function O(e) {
|
|
23
|
-
const n =
|
|
23
|
+
const n = l(), i = e.formHookResult?.form.fieldsMetadata ?? n?.metadata ?? {}, o = d(i.ssn?.hasRedactedValue);
|
|
24
24
|
return /* @__PURE__ */ t(
|
|
25
25
|
a,
|
|
26
26
|
{
|
|
27
27
|
...e,
|
|
28
28
|
name: "ssn",
|
|
29
|
-
transform:
|
|
29
|
+
transform: f,
|
|
30
30
|
placeholder: o
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
function I(e) {
|
|
35
|
-
return /* @__PURE__ */ t(
|
|
35
|
+
return /* @__PURE__ */ t(m, { ...e, name: "selfOnboarding" });
|
|
36
36
|
}
|
|
37
37
|
export {
|
|
38
38
|
H as DateOfBirthField,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { DatePickerHookField as r } from "../../../../../partner-hook-utils/form/fields/DatePickerHookField.js";
|
|
3
|
-
import { CheckboxHookField as n } from "../../../../../partner-hook-utils/form/fields/CheckboxHookField.js";
|
|
4
2
|
import { TextInputHookField as i } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
5
|
-
import { SelectHookField as
|
|
3
|
+
import { SelectHookField as r } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
4
|
+
import { CheckboxHookField as n } from "../../../../../partner-hook-utils/form/fields/CheckboxHookField.js";
|
|
5
|
+
import { DatePickerHookField as o } from "../../../../../partner-hook-utils/form/fields/DatePickerHookField.js";
|
|
6
6
|
function d(e) {
|
|
7
7
|
return /* @__PURE__ */ t(i, { ...e, name: "street1" });
|
|
8
8
|
}
|
|
@@ -13,7 +13,7 @@ function F(e) {
|
|
|
13
13
|
return /* @__PURE__ */ t(i, { ...e, name: "city" });
|
|
14
14
|
}
|
|
15
15
|
function p(e) {
|
|
16
|
-
return /* @__PURE__ */ t(
|
|
16
|
+
return /* @__PURE__ */ t(r, { ...e, name: "state" });
|
|
17
17
|
}
|
|
18
18
|
function k(e) {
|
|
19
19
|
return /* @__PURE__ */ t(i, { ...e, name: "zip" });
|
|
@@ -22,7 +22,7 @@ function s(e) {
|
|
|
22
22
|
return /* @__PURE__ */ t(n, { ...e, name: "courtesyWithholding" });
|
|
23
23
|
}
|
|
24
24
|
function h(e) {
|
|
25
|
-
return /* @__PURE__ */ t(
|
|
25
|
+
return /* @__PURE__ */ t(o, { ...e, name: "effectiveDate" });
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
28
|
F as CityField,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { SelectHookField as t } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
3
|
+
import { DatePickerHookField as i } from "../../../../../partner-hook-utils/form/fields/DatePickerHookField.js";
|
|
4
4
|
function c(e) {
|
|
5
|
-
return /* @__PURE__ */ o(
|
|
5
|
+
return /* @__PURE__ */ o(t, { ...e, name: "locationUuid" });
|
|
6
6
|
}
|
|
7
7
|
function m(e) {
|
|
8
|
-
return /* @__PURE__ */ o(
|
|
8
|
+
return /* @__PURE__ */ o(i, { ...e, name: "effectiveDate" });
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
11
11
|
m as EffectiveDateField,
|
package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldComponents.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as l } from "react-i18next";
|
|
3
3
|
import { EmployeeStateTaxesErrorCodes as s } from "./employeeStateTaxesSchema.js";
|
|
4
|
-
import {
|
|
4
|
+
import { TextInputHookField as d } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
5
|
+
import { SelectHookField as c } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
5
6
|
import { NumberInputHookField as r } from "../../../../../partner-hook-utils/form/fields/NumberInputHookField.js";
|
|
6
|
-
import {
|
|
7
|
-
import { RadioGroupHookField as
|
|
8
|
-
import { SelectHookField as u } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
7
|
+
import { DatePickerHookField as m } from "../../../../../partner-hook-utils/form/fields/DatePickerHookField.js";
|
|
8
|
+
import { RadioGroupHookField as u } from "../../../../../partner-hook-utils/form/fields/RadioGroupHookField.js";
|
|
9
9
|
function f() {
|
|
10
10
|
const { t: o } = l("Employee.StateTaxes");
|
|
11
11
|
return { [s.REQUIRED]: o("validations.required") };
|
|
@@ -26,21 +26,21 @@ function h({ meta: o, ...e }) {
|
|
|
26
26
|
placeholder: e.placeholder,
|
|
27
27
|
FieldComponent: e.FieldComponent
|
|
28
28
|
};
|
|
29
|
-
return /* @__PURE__ */ i(
|
|
29
|
+
return /* @__PURE__ */ i(c, { ...t });
|
|
30
30
|
}
|
|
31
31
|
function P({ meta: o, ...e }) {
|
|
32
32
|
const t = {
|
|
33
33
|
...a(o, e),
|
|
34
34
|
FieldComponent: e.FieldComponent
|
|
35
35
|
};
|
|
36
|
-
return /* @__PURE__ */ i(
|
|
36
|
+
return /* @__PURE__ */ i(u, { ...t });
|
|
37
37
|
}
|
|
38
38
|
function H({ meta: o, ...e }) {
|
|
39
39
|
const t = {
|
|
40
40
|
...a(o, e),
|
|
41
41
|
placeholder: e.placeholder
|
|
42
42
|
};
|
|
43
|
-
return /* @__PURE__ */ i(
|
|
43
|
+
return /* @__PURE__ */ i(d, { ...t });
|
|
44
44
|
}
|
|
45
45
|
function R({ meta: o, ...e }) {
|
|
46
46
|
const t = {
|
|
@@ -63,7 +63,7 @@ function D({ meta: o, ...e }) {
|
|
|
63
63
|
...a(o, e),
|
|
64
64
|
FieldComponent: e.FieldComponent
|
|
65
65
|
};
|
|
66
|
-
return /* @__PURE__ */ i(
|
|
66
|
+
return /* @__PURE__ */ i(m, { ...t });
|
|
67
67
|
}
|
|
68
68
|
export {
|
|
69
69
|
v as CurrencyStateTaxField,
|
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-error-boundary";
|
|
4
|
+
import "react-i18next";
|
|
5
|
+
import "@tanstack/react-query";
|
|
2
6
|
import "../../Base/useBase.js";
|
|
3
|
-
|
|
7
|
+
import "@gusto/embedded-api/models/errors/apierror";
|
|
8
|
+
import "@gusto/embedded-api/models/errors/gustoembeddederror";
|
|
9
|
+
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
10
|
+
import "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
11
|
+
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
|
+
import "dompurify";
|
|
13
|
+
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
14
|
+
import "../../../shared/constants.js";
|
|
15
|
+
import "classnames";
|
|
16
|
+
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
17
|
+
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
18
|
+
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
19
|
+
const [b, g] = o("TaxesContext");
|
|
4
20
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
21
|
+
g as TaxesProvider,
|
|
22
|
+
b as useTaxes
|
|
7
23
|
};
|
|
8
24
|
//# sourceMappingURL=useTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTaxes.js","sources":["../../../../src/components/Employee/Taxes/useTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype TaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useTaxes, TaxesProvider] = createCompoundContext<TaxesContextType>('TaxesContext')\nexport { useTaxes, TaxesProvider }\n"],"names":["useTaxes","TaxesProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTaxes.js","sources":["../../../../src/components/Employee/Taxes/useTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype TaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useTaxes, TaxesProvider] = createCompoundContext<TaxesContextType>('TaxesContext')\nexport { useTaxes, TaxesProvider }\n"],"names":["useTaxes","TaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;;AASA,MAAM,CAACA,GAAUC,CAAa,IAAIC,EAAwC,cAAc;"}
|
|
@@ -1,31 +1,39 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useRef as R, useState as
|
|
1
|
+
import { jsx as e, jsxs as t, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as R, useState as o, useEffect as S } from "react";
|
|
3
3
|
import { useForm as U, FormProvider as j } from "react-hook-form";
|
|
4
4
|
import { useTranslation as k } from "react-i18next";
|
|
5
5
|
import { z as P } from "zod";
|
|
6
6
|
import { zodResolver as z } from "@hookform/resolvers/zod";
|
|
7
|
-
import
|
|
7
|
+
import a from "./GrossUpModal.module.scss.js";
|
|
8
8
|
import { Flex as B } from "../../Common/Flex/Flex.js";
|
|
9
9
|
import "classnames";
|
|
10
10
|
import "../../../shared/constants.js";
|
|
11
11
|
import { ActionsLayout as D } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
12
|
+
import "react-error-boundary";
|
|
13
|
+
import "@tanstack/react-query";
|
|
12
14
|
import { useBase as H } from "../../Base/useBase.js";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
15
|
+
import "@gusto/embedded-api/models/errors/apierror";
|
|
16
|
+
import "@gusto/embedded-api/models/errors/gustoembeddederror";
|
|
17
|
+
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
18
|
+
import "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
19
|
+
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
20
|
+
import { formatNumberAsCurrency as L } from "../../../helpers/formattedStrings.js";
|
|
21
|
+
import { useComponentContext as V } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
22
|
+
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
23
|
+
import { useI18n as E } from "../../../i18n/I18n.js";
|
|
16
24
|
import { NumberInputField as T } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
17
25
|
const q = P.object({
|
|
18
26
|
netPay: P.number().positive()
|
|
19
27
|
});
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
const { t: r } = k("Payroll.GrossUpModal"), { Modal: M, Heading: u, Text: p, Button: i, Alert: f } =
|
|
28
|
+
function ye({ isOpen: n, onCalculateGrossUp: w, onApply: A, onCancel: d }) {
|
|
29
|
+
E("Payroll.GrossUpModal");
|
|
30
|
+
const { t: r } = k("Payroll.GrossUpModal"), { Modal: M, Heading: u, Text: p, Button: i, Alert: f } = V(), { baseSubmitHandler: y } = H(), N = R(null), [l, c] = o(null), [h, m] = o(null), [g, b] = o(!1), [x, v] = o(!1), s = U({
|
|
23
31
|
resolver: z(q),
|
|
24
32
|
defaultValues: { netPay: 0 }
|
|
25
33
|
});
|
|
26
34
|
S(() => {
|
|
27
|
-
|
|
28
|
-
}, [
|
|
35
|
+
n || (s.reset({ netPay: 0 }), c(null), m(null));
|
|
36
|
+
}, [n, s.reset]);
|
|
29
37
|
const F = async (G) => {
|
|
30
38
|
m(null), c(null), b(!0), await y(null, async () => {
|
|
31
39
|
try {
|
|
@@ -39,19 +47,19 @@ function oe({ isOpen: o, onCalculateGrossUp: w, onApply: A, onCancel: d }) {
|
|
|
39
47
|
return /* @__PURE__ */ e(
|
|
40
48
|
M,
|
|
41
49
|
{
|
|
42
|
-
isOpen:
|
|
50
|
+
isOpen: n,
|
|
43
51
|
onClose: d,
|
|
44
52
|
containerRef: N,
|
|
45
|
-
footer: /* @__PURE__ */
|
|
53
|
+
footer: /* @__PURE__ */ t(D, { children: [
|
|
46
54
|
/* @__PURE__ */ e(
|
|
47
55
|
i,
|
|
48
56
|
{
|
|
49
57
|
variant: "primary",
|
|
50
|
-
isDisabled: !
|
|
58
|
+
isDisabled: !l,
|
|
51
59
|
onClick: async () => {
|
|
52
|
-
|
|
60
|
+
l && (v(!0), await y(null, async () => {
|
|
53
61
|
try {
|
|
54
|
-
await A(
|
|
62
|
+
await A(l);
|
|
55
63
|
} finally {
|
|
56
64
|
v(!1);
|
|
57
65
|
}
|
|
@@ -63,15 +71,15 @@ function oe({ isOpen: o, onCalculateGrossUp: w, onApply: A, onCancel: d }) {
|
|
|
63
71
|
),
|
|
64
72
|
/* @__PURE__ */ e(i, { variant: "secondary", onClick: d, children: r("cancelCta") })
|
|
65
73
|
] }),
|
|
66
|
-
children: /* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */
|
|
74
|
+
children: /* @__PURE__ */ t(j, { ...s, children: [
|
|
75
|
+
/* @__PURE__ */ t("div", { className: a.header, children: [
|
|
68
76
|
/* @__PURE__ */ e(u, { as: "h2", styledAs: "h3", children: r("title") }),
|
|
69
77
|
/* @__PURE__ */ e(p, { variant: "supporting", as: "p", children: r("description") })
|
|
70
78
|
] }),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
h && /* @__PURE__ */ e("div", { className:
|
|
73
|
-
/* @__PURE__ */ e("div", { className:
|
|
74
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ t("div", { className: a.content, children: [
|
|
80
|
+
h && /* @__PURE__ */ e("div", { className: a.alert, children: /* @__PURE__ */ e(f, { label: h, status: "error", disableScrollIntoView: !0 }) }),
|
|
81
|
+
/* @__PURE__ */ e("div", { className: a.alert, children: /* @__PURE__ */ e(f, { label: r("warning"), status: "warning", disableScrollIntoView: !0 }) }),
|
|
82
|
+
/* @__PURE__ */ t(B, { flexDirection: "row", gap: 8, children: [
|
|
75
83
|
/* @__PURE__ */ e(
|
|
76
84
|
T,
|
|
77
85
|
{
|
|
@@ -87,16 +95,16 @@ function oe({ isOpen: o, onCalculateGrossUp: w, onApply: A, onCancel: d }) {
|
|
|
87
95
|
i,
|
|
88
96
|
{
|
|
89
97
|
variant: "secondary",
|
|
90
|
-
className:
|
|
98
|
+
className: a.calculateButton,
|
|
91
99
|
isDisabled: g,
|
|
92
100
|
onClick: s.handleSubmit(F),
|
|
93
101
|
children: r(g ? "calculatingCta" : "calculateCta")
|
|
94
102
|
}
|
|
95
103
|
)
|
|
96
104
|
] }),
|
|
97
|
-
|
|
105
|
+
l && /* @__PURE__ */ e(I, { children: /* @__PURE__ */ t("div", { className: a.result, children: [
|
|
98
106
|
/* @__PURE__ */ e(p, { size: "sm", variant: "supporting", weight: "semibold", children: r("grossPayResult") }),
|
|
99
|
-
/* @__PURE__ */ e(u, { as: "h3", children:
|
|
107
|
+
/* @__PURE__ */ e(u, { as: "h3", children: L(parseFloat(l)) })
|
|
100
108
|
] }) })
|
|
101
109
|
] })
|
|
102
110
|
] })
|
|
@@ -104,6 +112,6 @@ function oe({ isOpen: o, onCalculateGrossUp: w, onApply: A, onCancel: d }) {
|
|
|
104
112
|
);
|
|
105
113
|
}
|
|
106
114
|
export {
|
|
107
|
-
|
|
115
|
+
ye as GrossUpModal
|
|
108
116
|
};
|
|
109
117
|
//# 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\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 defaultValues: { netPay: 0 },\n })\n\n useEffect(() => {\n if (!isOpen) {\n formHandlers.reset({ netPay: 0 })\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 <Flex flexDirection=\"row\" gap={8}>\n <NumberInputField\n name=\"netPay\"\n label={t('netPayLabel')}\n format=\"currency\"\n errorMessage={t('validations.netPay')}\n min={0}\n isRequired\n />\n <Button\n variant=\"secondary\"\n className={styles.calculateButton}\n isDisabled={isCalculating}\n onClick={formHandlers.handleSubmit(handleCalculate)}\n >\n {isCalculating ? t('calculatingCta') : t('calculateCta')}\n </Button>\n </Flex>\n\n {calculatedGrossUp && (\n <>\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 )}\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","Fragment"],"mappings":"
|
|
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\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 defaultValues: { netPay: 0 },\n })\n\n useEffect(() => {\n if (!isOpen) {\n formHandlers.reset({ netPay: 0 })\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 <Flex flexDirection=\"row\" gap={8}>\n <NumberInputField\n name=\"netPay\"\n label={t('netPayLabel')}\n format=\"currency\"\n errorMessage={t('validations.netPay')}\n min={0}\n isRequired\n />\n <Button\n variant=\"secondary\"\n className={styles.calculateButton}\n isDisabled={isCalculating}\n onClick={formHandlers.handleSubmit(handleCalculate)}\n >\n {isCalculating ? t('calculatingCta') : t('calculateCta')}\n </Button>\n </Flex>\n\n {calculatedGrossUp && (\n <>\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 )}\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","j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