@gusto/embedded-react-sdk 0.11.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/components/Base/Base.js +18 -19
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Common/DataView/DataView.js +20 -20
- package/dist/components/Common/DataView/DataView.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureForm.js +4 -6
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +10 -12
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +6 -8
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +2 -3
- package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -8
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -10
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +11 -11
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -8
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +7 -8
- package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +8 -9
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +9 -11
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +10 -12
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +11 -13
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +4 -6
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -7
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +6 -7
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +2 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +7 -9
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +6 -7
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Form.js +3 -5
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +1 -1
- package/dist/components/Company/Industry/Actions.js +5 -7
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +1 -1
- package/dist/components/Company/Industry/Edit.js +10 -12
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +6 -8
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +6 -8
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +2 -4
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +8 -9
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +1 -1
- package/dist/components/Company/OnboardingOverview/Completed.js +12 -14
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +6 -8
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -3
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +3 -4
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +10 -12
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +15 -15
- package/dist/components/Company/PaySchedule/_parts/Head.js +6 -8
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +13 -15
- package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -7
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -8
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +5 -7
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +1 -1
- package/dist/components/Contractor/Address/Address.js +4 -5
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +1 -1
- package/dist/components/Contractor/Address/useAddress.js +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +16 -17
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +6 -7
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +2 -3
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +20 -18
- package/dist/components/Contractor/Profile/ContractorProfileForm.js.map +1 -1
- package/dist/components/Contractor/Profile/useContractorProfile.js +1 -1
- package/dist/components/Contractor/Submit/index.js +9 -11
- package/dist/components/Contractor/Submit/index.js.map +1 -1
- package/dist/components/Employee/Compensation/Actions.js +5 -6
- package/dist/components/Employee/Compensation/Actions.js.map +1 -1
- package/dist/components/Employee/Compensation/Edit.js +29 -29
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Compensation/List.js +23 -25
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Deductions/Actions.js +10 -12
- package/dist/components/Employee/Deductions/Actions.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionForm.js +10 -12
- package/dist/components/Employee/Deductions/DeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsList.js +5 -7
- package/dist/components/Employee/Deductions/DeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductionsForm.js +11 -12
- package/dist/components/Employee/Deductions/IncludeDeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/useDeductions.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +6 -8
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +6 -7
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +7 -8
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +4 -6
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +3 -4
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Head.js +5 -7
- package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +14 -15
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +1 -1
- package/dist/components/Employee/Landing/Landing.js +12 -13
- package/dist/components/Employee/Landing/Landing.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
- package/dist/components/Employee/PaymentMethod/Actions.js +7 -9
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +7 -7
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +8 -10
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +2 -3
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +10 -11
- package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +1 -1
- package/dist/components/Employee/Profile/Actions.js +7 -9
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +9 -10
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.js +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +51 -49
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +1 -1
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +1 -1
- package/dist/components/Employee/Taxes/Actions.js +8 -10
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +13 -14
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -4
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/hooks/useContainerBreakpoints/useContainerBreakpoints.js +34 -23
- package/dist/hooks/useContainerBreakpoints/useContainerBreakpoints.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -6
- package/dist/hooks/useDebounce/useDebounce.js +0 -19
- package/dist/hooks/useDebounce/useDebounce.js.map +0 -1
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { jsx as s, Fragment as p } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as o } from "react-i18next";
|
|
3
3
|
import { useStateTaxesList as l } from "./context.js";
|
|
4
|
-
import "classnames";
|
|
5
|
-
import "../../../../shared/constants.js";
|
|
6
4
|
import { EmptyData as c } from "../../../Common/EmptyData/EmptyData.js";
|
|
7
5
|
import { useComponentContext as u } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
8
6
|
import { useDataView as d } from "../../../Common/DataView/useDataView.js";
|
|
9
7
|
import { DataView as C } from "../../../Common/DataView/DataView.js";
|
|
10
|
-
const
|
|
11
|
-
const { stateTaxRequirements:
|
|
12
|
-
data:
|
|
8
|
+
const S = () => {
|
|
9
|
+
const { stateTaxRequirements: n, handleChange: r } = l(), a = u(), { t } = o("Company.StateTaxes", { keyPrefix: "list" }), { t: i } = o("common", { keyPrefix: "statesHash" }), { ...m } = d({
|
|
10
|
+
data: n,
|
|
13
11
|
columns: [
|
|
14
12
|
{
|
|
15
13
|
key: "state",
|
|
@@ -27,7 +25,7 @@ const b = () => {
|
|
|
27
25
|
{
|
|
28
26
|
variant: "secondary",
|
|
29
27
|
onClick: () => {
|
|
30
|
-
|
|
28
|
+
r(e.state);
|
|
31
29
|
},
|
|
32
30
|
children: e.setupComplete ? t("editStateTaxCta") : t("continueStateTaxSetupCta")
|
|
33
31
|
}
|
|
@@ -37,6 +35,6 @@ const b = () => {
|
|
|
37
35
|
return /* @__PURE__ */ s(C, { label: t("requirementsListLabel"), ...m });
|
|
38
36
|
};
|
|
39
37
|
export {
|
|
40
|
-
|
|
38
|
+
S as List
|
|
41
39
|
};
|
|
42
40
|
//# sourceMappingURL=List.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useStateTaxesList } from './context'\nimport { DataView, EmptyData, useDataView } from '@/components/Common'\nimport type { STATES_ABBR } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const List = () => {\n const { stateTaxRequirements, handleChange } = useStateTaxesList()\n const Components = useComponentContext()\n\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'list' })\n const { t: statesHash } = useTranslation('common', { keyPrefix: 'statesHash' })\n\n const { ...dataViewProps } = useDataView({\n data: stateTaxRequirements,\n columns: [\n {\n key: 'state',\n title: t('requirementsListCol1'),\n render: requirement => {\n return <span>{statesHash(requirement.state as (typeof STATES_ABBR)[number])}</span>\n },\n },\n {\n key: 'status',\n title: t('requirementsListCol2'),\n render: requirement => {\n return (\n <>\n <Components.Badge status={requirement.setupComplete ? 'success' : 'warning'}>\n {requirement.setupComplete ? t('completeBadge') : t('incompleteBadge')}\n </Components.Badge>\n </>\n )\n },\n },\n ],\n itemMenu: requirement => {\n return (\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n handleChange(requirement.state)\n }}\n >\n {requirement.setupComplete ? t('editStateTaxCta') : t('continueStateTaxSetupCta')}\n </Components.Button>\n )\n },\n\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')} />\n ),\n })\n return <DataView label={t('requirementsListLabel')} {...dataViewProps} />\n}\n"],"names":["List","stateTaxRequirements","handleChange","useStateTaxesList","Components","useComponentContext","useTranslation","statesHash","dataViewProps","useDataView","requirement","jsx","EmptyData","DataView"],"mappings":"
|
|
1
|
+
{"version":3,"file":"List.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useStateTaxesList } from './context'\nimport { DataView, EmptyData, useDataView } from '@/components/Common'\nimport type { STATES_ABBR } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const List = () => {\n const { stateTaxRequirements, handleChange } = useStateTaxesList()\n const Components = useComponentContext()\n\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'list' })\n const { t: statesHash } = useTranslation('common', { keyPrefix: 'statesHash' })\n\n const { ...dataViewProps } = useDataView({\n data: stateTaxRequirements,\n columns: [\n {\n key: 'state',\n title: t('requirementsListCol1'),\n render: requirement => {\n return <span>{statesHash(requirement.state as (typeof STATES_ABBR)[number])}</span>\n },\n },\n {\n key: 'status',\n title: t('requirementsListCol2'),\n render: requirement => {\n return (\n <>\n <Components.Badge status={requirement.setupComplete ? 'success' : 'warning'}>\n {requirement.setupComplete ? t('completeBadge') : t('incompleteBadge')}\n </Components.Badge>\n </>\n )\n },\n },\n ],\n itemMenu: requirement => {\n return (\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n handleChange(requirement.state)\n }}\n >\n {requirement.setupComplete ? t('editStateTaxCta') : t('continueStateTaxSetupCta')}\n </Components.Button>\n )\n },\n\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')} />\n ),\n })\n return <DataView label={t('requirementsListLabel')} {...dataViewProps} />\n}\n"],"names":["List","stateTaxRequirements","handleChange","useStateTaxesList","Components","useComponentContext","useTranslation","statesHash","dataViewProps","useDataView","requirement","jsx","EmptyData","DataView"],"mappings":";;;;;;;AAMO,MAAMA,IAAO,MAAM;AACxB,QAAM,EAAE,sBAAAC,GAAsB,cAAAC,EAAa,IAAIC,EAAkB,GAC3DC,IAAaC,EAAoB,GAEjC,EAAE,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClE,EAAE,GAAGC,MAAeD,EAAe,UAAU,EAAE,WAAW,cAAc,GAExE,EAAE,GAAGE,EAAc,IAAIC,EAAY;AAAA,IACvC,MAAMR;AAAA,IACN,SAAS;AAAA,MACP;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,sBAAsB;AAAA,QAC/B,QAAQ,CAAeS,MACb,gBAAAC,EAAA,QAAA,EAAM,UAAWJ,EAAAG,EAAY,KAAqC,GAAE;AAAA,MAEhF;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,sBAAsB;AAAA,QAC/B,QAAQ,CAAeA,6BAGjB,UAAC,gBAAAC,EAAAP,EAAW,OAAX,EAAiB,QAAQM,EAAY,gBAAgB,YAAY,WAC/D,UAAAA,EAAY,gBAAgB,EAAE,eAAe,IAAI,EAAE,iBAAiB,EACvE,CAAA,GACF;AAAA,MAEJ;AAAA,IAEJ;AAAA,IACA,UAAU,CAAeA,MAErB,gBAAAC;AAAA,MAACP,EAAW;AAAA,MAAX;AAAA,QACC,SAAQ;AAAA,QACR,SAAS,MAAM;AACb,UAAAF,EAAaQ,EAAY,KAAK;AAAA,QAChC;AAAA,QAEC,YAAY,gBAAgB,EAAE,iBAAiB,IAAI,EAAE,0BAA0B;AAAA,MAAA;AAAA,IAClF;AAAA,IAIJ,YAAY,MACV,gBAAAC,EAACC,GAAU,EAAA,OAAO,EAAE,iBAAiB,GAAG,aAAa,EAAE,uBAAuB,EAAG,CAAA;AAAA,EAAA,CAEpF;AACD,2BAAQC,GAAS,EAAA,OAAO,EAAE,uBAAuB,GAAI,GAAGL,GAAe;AACzE;"}
|
|
@@ -8,9 +8,9 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
8
8
|
import "@tanstack/react-query";
|
|
9
9
|
import "../../../Base/useBase.js";
|
|
10
10
|
import "../../../../shared/constants.js";
|
|
11
|
-
import "classnames";
|
|
12
11
|
import "dompurify";
|
|
13
12
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
|
+
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
14
14
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
15
15
|
const [c, d] = t("StateTaxesListContext");
|
|
16
16
|
export {
|
|
@@ -11,11 +11,10 @@ import { Actions as B } from "./Actions.js";
|
|
|
11
11
|
import { Form as N } from "../../Common/Form/Form.js";
|
|
12
12
|
import { useComponentDictionary as j, useI18n as q } from "../../../i18n/I18n.js";
|
|
13
13
|
import { Flex as w } from "../../Common/Flex/Flex.js";
|
|
14
|
-
import "classnames";
|
|
15
|
-
import { contractorEvents as d } from "../../../shared/constants.js";
|
|
16
14
|
import { BaseComponent as G } from "../../Base/Base.js";
|
|
17
15
|
import { useBase as H } from "../../Base/useBase.js";
|
|
18
|
-
|
|
16
|
+
import { contractorEvents as d } from "../../../shared/constants.js";
|
|
17
|
+
function st(r) {
|
|
19
18
|
return /* @__PURE__ */ t(G, { ...r, children: /* @__PURE__ */ t(M, { ...r, children: r.children }) });
|
|
20
19
|
}
|
|
21
20
|
function M({ contractorId: r, defaultValues: e, children: n, className: a, dictionary: p }) {
|
|
@@ -65,7 +64,7 @@ function M({ contractorId: r, defaultValues: e, children: n, className: a, dicti
|
|
|
65
64
|
) });
|
|
66
65
|
}
|
|
67
66
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
st as Address,
|
|
68
|
+
st as default
|
|
70
69
|
};
|
|
71
70
|
//# sourceMappingURL=Address.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Address.js","sources":["../../../../src/components/Contractor/Address/Address.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useContractorsGetSuspense } from '@gusto/embedded-api/react-query/contractorsGet'\nimport { useContractorsGetAddressSuspense } from '@gusto/embedded-api/react-query/contractorsGetAddress'\nimport { useContractorsUpdateAddressMutation } from '@gusto/embedded-api/react-query/contractorsUpdateAddress'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { AddressFormSchema, AddressProvider } from './useAddress'\nimport { Head } from './Head'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { AddressDefaultValues, AddressFormValues } from './useAddress'\nimport { Form as HtmlForm } from '@/components/Common/Form/Form'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { Flex } from '@/components/Common'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { contractorEvents } from '@/shared/constants'\n\nexport interface AddressProps extends BaseComponentInterface<'Contractor.Address'> {\n contractorId: string\n defaultValues?: AddressDefaultValues\n children?: ReactNode\n className?: string\n}\n\nexport function Address(props: AddressProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ contractorId, defaultValues, children, className, dictionary }: AddressProps) {\n useComponentDictionary('Contractor.Address', dictionary)\n useI18n('Contractor.Address')\n\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data: contractorData } = useContractorsGetSuspense({ contractorUuid: contractorId })\n const { data: addressData } = useContractorsGetAddressSuspense({ contractorUuid: contractorId })\n\n const { mutateAsync: updateAddress, isPending: isUpdatingAddressPending } =\n useContractorsUpdateAddressMutation()\n\n const contractor = contractorData.contractor\n const contractorType = contractorData.contractor?.type\n const address = addressData.contractorAddress\n\n const formDefaultValues = {\n street1: address?.street1 || defaultValues?.street1 || '',\n street2: address?.street2 || defaultValues?.street2 || '',\n city: address?.city || defaultValues?.city || '',\n state: address?.state || defaultValues?.state || '',\n zip: address?.zip || defaultValues?.zip || '',\n }\n\n const formMethods = useForm<AddressFormValues>({\n resolver: zodResolver(AddressFormSchema),\n defaultValues: formDefaultValues,\n })\n\n const onSubmit = async (data: AddressFormValues) => {\n await baseSubmitHandler(data, async payload => {\n const { contractorAddress } = await updateAddress({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n version: address?.version as string,\n street1: payload.street1,\n street2: payload.street2,\n city: payload.city,\n state: payload.state,\n zip: payload.zip,\n },\n },\n })\n\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_UPDATED, contractorAddress)\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_DONE)\n })\n }\n\n return (\n <section className={className}>\n <AddressProvider\n value={{\n contractor,\n contractorType,\n address,\n isPending: isUpdatingAddressPending,\n }}\n >\n <FormProvider {...formMethods}>\n <HtmlForm onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </HtmlForm>\n </FormProvider>\n </AddressProvider>\n </section>\n )\n}\n\nexport default Address\n"],"names":["Address","props","jsx","BaseComponent","Root","contractorId","defaultValues","children","className","dictionary","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","useBase","contractorData","useContractorsGetSuspense","addressData","useContractorsGetAddressSuspense","updateAddress","isUpdatingAddressPending","useContractorsUpdateAddressMutation","contractor","contractorType","address","formDefaultValues","formMethods","useForm","zodResolver","AddressFormSchema","onSubmit","data","payload","contractorAddress","contractorEvents","AddressProvider","FormProvider","HtmlForm","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Address.js","sources":["../../../../src/components/Contractor/Address/Address.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useContractorsGetSuspense } from '@gusto/embedded-api/react-query/contractorsGet'\nimport { useContractorsGetAddressSuspense } from '@gusto/embedded-api/react-query/contractorsGetAddress'\nimport { useContractorsUpdateAddressMutation } from '@gusto/embedded-api/react-query/contractorsUpdateAddress'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { AddressFormSchema, AddressProvider } from './useAddress'\nimport { Head } from './Head'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { AddressDefaultValues, AddressFormValues } from './useAddress'\nimport { Form as HtmlForm } from '@/components/Common/Form/Form'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { Flex } from '@/components/Common'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { contractorEvents } from '@/shared/constants'\n\nexport interface AddressProps extends BaseComponentInterface<'Contractor.Address'> {\n contractorId: string\n defaultValues?: AddressDefaultValues\n children?: ReactNode\n className?: string\n}\n\nexport function Address(props: AddressProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ contractorId, defaultValues, children, className, dictionary }: AddressProps) {\n useComponentDictionary('Contractor.Address', dictionary)\n useI18n('Contractor.Address')\n\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data: contractorData } = useContractorsGetSuspense({ contractorUuid: contractorId })\n const { data: addressData } = useContractorsGetAddressSuspense({ contractorUuid: contractorId })\n\n const { mutateAsync: updateAddress, isPending: isUpdatingAddressPending } =\n useContractorsUpdateAddressMutation()\n\n const contractor = contractorData.contractor\n const contractorType = contractorData.contractor?.type\n const address = addressData.contractorAddress\n\n const formDefaultValues = {\n street1: address?.street1 || defaultValues?.street1 || '',\n street2: address?.street2 || defaultValues?.street2 || '',\n city: address?.city || defaultValues?.city || '',\n state: address?.state || defaultValues?.state || '',\n zip: address?.zip || defaultValues?.zip || '',\n }\n\n const formMethods = useForm<AddressFormValues>({\n resolver: zodResolver(AddressFormSchema),\n defaultValues: formDefaultValues,\n })\n\n const onSubmit = async (data: AddressFormValues) => {\n await baseSubmitHandler(data, async payload => {\n const { contractorAddress } = await updateAddress({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n version: address?.version as string,\n street1: payload.street1,\n street2: payload.street2,\n city: payload.city,\n state: payload.state,\n zip: payload.zip,\n },\n },\n })\n\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_UPDATED, contractorAddress)\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_DONE)\n })\n }\n\n return (\n <section className={className}>\n <AddressProvider\n value={{\n contractor,\n contractorType,\n address,\n isPending: isUpdatingAddressPending,\n }}\n >\n <FormProvider {...formMethods}>\n <HtmlForm onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </HtmlForm>\n </FormProvider>\n </AddressProvider>\n </section>\n )\n}\n\nexport default Address\n"],"names":["Address","props","jsx","BaseComponent","Root","contractorId","defaultValues","children","className","dictionary","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","useBase","contractorData","useContractorsGetSuspense","addressData","useContractorsGetAddressSuspense","updateAddress","isUpdatingAddressPending","useContractorsUpdateAddressMutation","contractor","contractorType","address","formDefaultValues","formMethods","useForm","zodResolver","AddressFormSchema","onSubmit","data","payload","contractorAddress","contractorEvents","AddressProvider","FormProvider","HtmlForm","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;AA0BO,SAASA,GAAQC,GAAqB;AAEzC,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,cAAAC,GAAc,eAAAC,GAAe,UAAAC,GAAU,WAAAC,GAAW,YAAAC,KAA4B;AAC5F,EAAAC,EAAuB,sBAAsBD,CAAU,GACvDE,EAAQ,oBAAoB;AAE5B,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GAEzC,EAAE,MAAMC,EAAe,IAAIC,EAA0B,EAAE,gBAAgBX,GAAc,GACrF,EAAE,MAAMY,EAAY,IAAIC,EAAiC,EAAE,gBAAgBb,GAAc,GAEzF,EAAE,aAAac,GAAe,WAAWC,EAAA,IAC7CC,EAAoC,GAEhCC,IAAaP,EAAe,YAC5BQ,IAAiBR,EAAe,YAAY,MAC5CS,IAAUP,EAAY,mBAEtBQ,IAAoB;AAAA,IACxB,SAASD,G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,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,GACX,EAAA,CAEJ,GACF,EACF,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as i } from "react-i18next";
|
|
3
3
|
import { Grid as o } from "../../Common/Grid/Grid.js";
|
|
4
|
-
import { TextInputField as t } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
5
4
|
import { STATES_ABBR as l } from "../../../shared/constants.js";
|
|
5
|
+
import { TextInputField as t } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
6
6
|
import { SelectField as m } from "../../Common/Fields/SelectField/SelectField.js";
|
|
7
7
|
function g() {
|
|
8
8
|
const { t: e } = i("Contractor.Address");
|
|
@@ -9,9 +9,9 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
9
9
|
import "@tanstack/react-query";
|
|
10
10
|
import "../../Base/useBase.js";
|
|
11
11
|
import "../../../shared/constants.js";
|
|
12
|
-
import "classnames";
|
|
13
12
|
import "dompurify";
|
|
14
13
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
+
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
15
|
import { createCompoundContext as r } from "../../Base/createCompoundContext.js";
|
|
16
16
|
const u = t.object({
|
|
17
17
|
street1: t.string().min(1),
|
|
@@ -11,10 +11,9 @@ import { BaseComponent as g } from "../../Base/Base.js";
|
|
|
11
11
|
import { useBase as A } from "../../Base/useBase.js";
|
|
12
12
|
import { useComponentContext as B } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
13
|
import { Form as P } from "../../Common/Form/Form.js";
|
|
14
|
-
import { STATES_ABBR as j, componentEvents as
|
|
14
|
+
import { STATES_ABBR as j, componentEvents as u } from "../../../shared/constants.js";
|
|
15
15
|
import { ActionsLayout as L } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
16
16
|
import { Flex as M } from "../../Common/Flex/Flex.js";
|
|
17
|
-
import "classnames";
|
|
18
17
|
import { RadioGroupField as U } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
19
18
|
import { SelectField as q } from "../../Common/Fields/SelectField/SelectField.js";
|
|
20
19
|
const W = r.union([
|
|
@@ -26,38 +25,38 @@ const W = r.union([
|
|
|
26
25
|
fileNewHireReport: r.boolean().refine((o) => !o)
|
|
27
26
|
})
|
|
28
27
|
]);
|
|
29
|
-
function
|
|
28
|
+
function ae(o) {
|
|
30
29
|
return /* @__PURE__ */ e(g, { ...o, children: /* @__PURE__ */ e(k, { ...o, children: o.children }) });
|
|
31
30
|
}
|
|
32
|
-
function k({ contractorId: o, className:
|
|
31
|
+
function k({ contractorId: o, className: p, dictionary: d }) {
|
|
33
32
|
F("Contractor.NewHireReport", d), x("Contractor.NewHireReport");
|
|
34
33
|
const { t } = v("Contractor.NewHireReport"), { onEvent: m, baseSubmitHandler: f } = A(), s = B(), {
|
|
35
34
|
data: { contractor: R }
|
|
36
|
-
} = y({ contractorUuid: o }),
|
|
35
|
+
} = y({ contractorUuid: o }), n = R, { mutateAsync: h, isPending: H } = D(), w = O(
|
|
37
36
|
() => ({
|
|
38
|
-
fileNewHireReport:
|
|
39
|
-
state:
|
|
37
|
+
fileNewHireReport: n.fileNewHireReport || !1,
|
|
38
|
+
state: n.workState || null
|
|
40
39
|
}),
|
|
41
|
-
[
|
|
40
|
+
[n]
|
|
42
41
|
), a = S({
|
|
43
42
|
resolver: _(W),
|
|
44
43
|
defaultValues: w
|
|
45
|
-
}), N = E({ control: a.control, name: "fileNewHireReport" }), b = async (
|
|
46
|
-
await f(
|
|
44
|
+
}), N = E({ control: a.control, name: "fileNewHireReport" }), b = async (i) => {
|
|
45
|
+
await f(i, async (l) => {
|
|
47
46
|
const C = await h({
|
|
48
47
|
request: {
|
|
49
48
|
contractorUuid: o,
|
|
50
49
|
requestBody: {
|
|
51
50
|
fileNewHireReport: l.fileNewHireReport,
|
|
52
51
|
workState: "state" in l ? l.state : null,
|
|
53
|
-
version:
|
|
52
|
+
version: n.version
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
});
|
|
57
|
-
m(
|
|
56
|
+
m(u.CONTRACTOR_NEW_HIRE_REPORT_UPDATED, C), m(u.CONTRACTOR_NEW_HIRE_REPORT_DONE);
|
|
58
57
|
});
|
|
59
58
|
};
|
|
60
|
-
return /* @__PURE__ */ e("section", { className:
|
|
59
|
+
return /* @__PURE__ */ e("section", { className: p, children: /* @__PURE__ */ e(T, { ...a, children: /* @__PURE__ */ e(P, { onSubmit: a.handleSubmit(b), children: /* @__PURE__ */ c(M, { flexDirection: "column", children: [
|
|
61
60
|
/* @__PURE__ */ c("header", { children: [
|
|
62
61
|
/* @__PURE__ */ e(s.Heading, { as: "h2", children: t("title") }),
|
|
63
62
|
/* @__PURE__ */ e(s.Text, { children: t("description") })
|
|
@@ -84,9 +83,9 @@ function k({ contractorId: o, className: u, dictionary: d }) {
|
|
|
84
83
|
q,
|
|
85
84
|
{
|
|
86
85
|
name: "state",
|
|
87
|
-
options: j.map((
|
|
88
|
-
label: t(`statesHash.${
|
|
89
|
-
value:
|
|
86
|
+
options: j.map((i) => ({
|
|
87
|
+
label: t(`statesHash.${i}`, { ns: "common" }),
|
|
88
|
+
value: i
|
|
90
89
|
})),
|
|
91
90
|
label: t("stateSelectionLabel"),
|
|
92
91
|
placeholder: "",
|
|
@@ -106,6 +105,6 @@ function k({ contractorId: o, className: u, dictionary: d }) {
|
|
|
106
105
|
] }) }) }) });
|
|
107
106
|
}
|
|
108
107
|
export {
|
|
109
|
-
|
|
108
|
+
ae as NewHireReport
|
|
110
109
|
};
|
|
111
110
|
//# sourceMappingURL=NewHireReport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewHireReport.js","sources":["../../../../src/components/Contractor/NewHireReport/NewHireReport.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport z from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useContractorsGetSuspense } from '@gusto/embedded-api/react-query/contractorsGet'\nimport { useContractorsUpdateMutation } from '@gusto/embedded-api/react-query/contractorsUpdate'\nimport type { NewHireReportProps } from './types'\nimport { useI18n } from '@/i18n'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { componentEvents, STATES_ABBR } from '@/shared/constants'\nimport { ActionsLayout } from '@/components/Common/ActionsLayout'\nimport { Flex, RadioGroupField, SelectField } from '@/components/Common'\n\nconst NewHireReportSchema = z.union([\n z.object({\n fileNewHireReport: z.boolean().refine(v => v),\n state: z.string().min(1),\n }),\n z.object({\n fileNewHireReport: z.boolean().refine(v => !v),\n }),\n])\n\nexport type NewHireReportSchemaInputs = z.input<typeof NewHireReportSchema>\n\nexport function NewHireReport(props: NewHireReportProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ contractorId, className, dictionary }: NewHireReportProps) {\n useComponentDictionary('Contractor.NewHireReport', dictionary)\n useI18n('Contractor.NewHireReport')\n const { t } = useTranslation('Contractor.NewHireReport')\n const { onEvent, baseSubmitHandler } = useBase()\n const Components = useComponentContext()\n\n const {\n data: { contractor },\n } = useContractorsGetSuspense({ contractorUuid: contractorId })\n const contractorDetails = contractor!\n\n const { mutateAsync: updateContractor, isPending: updateContractorPending } =\n useContractorsUpdateMutation()\n\n const defaultValues = useMemo(\n () => ({\n fileNewHireReport: contractorDetails.fileNewHireReport || false,\n state: contractorDetails.workState || null,\n }),\n [contractorDetails],\n )\n\n const formMethods = useForm({\n resolver: zodResolver(NewHireReportSchema),\n defaultValues: defaultValues,\n })\n\n const watchedDoFile = useWatch({ control: formMethods.control, name: 'fileNewHireReport' })\n const onSubmit: SubmitHandler<NewHireReportSchemaInputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const contractorResponse = await updateContractor({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n fileNewHireReport: payload.fileNewHireReport,\n workState: 'state' in payload ? payload.state : null,\n version: contractorDetails.version!,\n },\n },\n })\n onEvent(componentEvents.CONTRACTOR_NEW_HIRE_REPORT_UPDATED, contractorResponse)\n onEvent(componentEvents.CONTRACTOR_NEW_HIRE_REPORT_DONE)\n })\n }\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection={'column'}>\n <header>\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Components.Text>{t('description')}</Components.Text>\n </header>\n <RadioGroupField\n name=\"fileNewHireReport\"\n label={t('doFileLegend')}\n shouldVisuallyHideLabel\n options={[\n {\n value: true,\n label: t('yesOption'),\n },\n {\n value: false,\n label: t('noOption'),\n },\n ]}\n />\n {watchedDoFile && (\n <SelectField\n name=\"state\"\n options={STATES_ABBR.map((stateAbbr: (typeof STATES_ABBR)[number]) => ({\n label: t(`statesHash.${stateAbbr}`, { ns: 'common' }),\n value: stateAbbr,\n }))}\n label={t('stateSelectionLabel')}\n placeholder={''}\n errorMessage={t('validations.state')}\n isRequired\n />\n )}\n <ActionsLayout>\n <Components.Button\n type=\"submit\"\n variant=\"primary\"\n isDisabled={updateContractorPending}\n >\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["NewHireReportSchema","z","v","NewHireReport","props","jsx","BaseComponent","Root","contractorId","className","dictionary","useComponentDictionary","useI18n","useTranslation","onEvent","baseSubmitHandler","useBase","Components","useComponentContext","contractor","useContractorsGetSuspense","contractorDetails","updateContractor","updateContractorPending","useContractorsUpdateMutation","defaultValues","useMemo","formMethods","useForm","zodResolver","watchedDoFile","useWatch","onSubmit","data","payload","contractorResponse","componentEvents","FormProvider","Form","jsxs","Flex","RadioGroupField","SelectField","STATES_ABBR","stateAbbr","ActionsLayout"],"mappings":"
|
|
1
|
+
{"version":3,"file":"NewHireReport.js","sources":["../../../../src/components/Contractor/NewHireReport/NewHireReport.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport z from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useContractorsGetSuspense } from '@gusto/embedded-api/react-query/contractorsGet'\nimport { useContractorsUpdateMutation } from '@gusto/embedded-api/react-query/contractorsUpdate'\nimport type { NewHireReportProps } from './types'\nimport { useI18n } from '@/i18n'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { componentEvents, STATES_ABBR } from '@/shared/constants'\nimport { ActionsLayout } from '@/components/Common/ActionsLayout'\nimport { Flex, RadioGroupField, SelectField } from '@/components/Common'\n\nconst NewHireReportSchema = z.union([\n z.object({\n fileNewHireReport: z.boolean().refine(v => v),\n state: z.string().min(1),\n }),\n z.object({\n fileNewHireReport: z.boolean().refine(v => !v),\n }),\n])\n\nexport type NewHireReportSchemaInputs = z.input<typeof NewHireReportSchema>\n\nexport function NewHireReport(props: NewHireReportProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ contractorId, className, dictionary }: NewHireReportProps) {\n useComponentDictionary('Contractor.NewHireReport', dictionary)\n useI18n('Contractor.NewHireReport')\n const { t } = useTranslation('Contractor.NewHireReport')\n const { onEvent, baseSubmitHandler } = useBase()\n const Components = useComponentContext()\n\n const {\n data: { contractor },\n } = useContractorsGetSuspense({ contractorUuid: contractorId })\n const contractorDetails = contractor!\n\n const { mutateAsync: updateContractor, isPending: updateContractorPending } =\n useContractorsUpdateMutation()\n\n const defaultValues = useMemo(\n () => ({\n fileNewHireReport: contractorDetails.fileNewHireReport || false,\n state: contractorDetails.workState || null,\n }),\n [contractorDetails],\n )\n\n const formMethods = useForm({\n resolver: zodResolver(NewHireReportSchema),\n defaultValues: defaultValues,\n })\n\n const watchedDoFile = useWatch({ control: formMethods.control, name: 'fileNewHireReport' })\n const onSubmit: SubmitHandler<NewHireReportSchemaInputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const contractorResponse = await updateContractor({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n fileNewHireReport: payload.fileNewHireReport,\n workState: 'state' in payload ? payload.state : null,\n version: contractorDetails.version!,\n },\n },\n })\n onEvent(componentEvents.CONTRACTOR_NEW_HIRE_REPORT_UPDATED, contractorResponse)\n onEvent(componentEvents.CONTRACTOR_NEW_HIRE_REPORT_DONE)\n })\n }\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection={'column'}>\n <header>\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Components.Text>{t('description')}</Components.Text>\n </header>\n <RadioGroupField\n name=\"fileNewHireReport\"\n label={t('doFileLegend')}\n shouldVisuallyHideLabel\n options={[\n {\n value: true,\n label: t('yesOption'),\n },\n {\n value: false,\n label: t('noOption'),\n },\n ]}\n />\n {watchedDoFile && (\n <SelectField\n name=\"state\"\n options={STATES_ABBR.map((stateAbbr: (typeof STATES_ABBR)[number]) => ({\n label: t(`statesHash.${stateAbbr}`, { ns: 'common' }),\n value: stateAbbr,\n }))}\n label={t('stateSelectionLabel')}\n placeholder={''}\n errorMessage={t('validations.state')}\n isRequired\n />\n )}\n <ActionsLayout>\n <Components.Button\n type=\"submit\"\n variant=\"primary\"\n isDisabled={updateContractorPending}\n >\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["NewHireReportSchema","z","v","NewHireReport","props","jsx","BaseComponent","Root","contractorId","className","dictionary","useComponentDictionary","useI18n","useTranslation","onEvent","baseSubmitHandler","useBase","Components","useComponentContext","contractor","useContractorsGetSuspense","contractorDetails","updateContractor","updateContractorPending","useContractorsUpdateMutation","defaultValues","useMemo","formMethods","useForm","zodResolver","watchedDoFile","useWatch","onSubmit","data","payload","contractorResponse","componentEvents","FormProvider","Form","jsxs","Flex","RadioGroupField","SelectField","STATES_ABBR","stateAbbr","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAMA,IAAsBC,EAAE,MAAM;AAAA,EAClCA,EAAE,OAAO;AAAA,IACP,mBAAmBA,EAAE,QAAA,EAAU,OAAO,OAAKC,CAAC;AAAA,IAC5C,OAAOD,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAAA,CACxB;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,mBAAmBA,EAAE,QAAA,EAAU,OAAO,CAAAC,MAAK,CAACA,CAAC;AAAA,EAC9C,CAAA;AACH,CAAC;AAIM,SAASC,GAAcC,GAA2B;AAErD,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,cAAAC,GAAc,WAAAC,GAAW,YAAAC,KAAkC;AACzE,EAAAC,EAAuB,4BAA4BD,CAAU,GAC7DE,EAAQ,0BAA0B;AAClC,QAAM,EAAE,EAAA,IAAMC,EAAe,0BAA0B,GACjD,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GACzCC,IAAaC,EAAoB,GAEjC;AAAA,IACJ,MAA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iB,UAAA,EAAE,aAAa,EAAE,CAAA;AAAA,IAAA,GACrC;AAAA,IACA,gBAAAZ;AAAA,MAACoC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAO,EAAE,cAAc;AAAA,QACvB,yBAAuB;AAAA,QACvB,SAAS;AAAA,UACP;AAAA,YACE,OAAO;AAAA,YACP,OAAO,EAAE,WAAW;AAAA,UACtB;AAAA,UACA;AAAA,YACE,OAAO;AAAA,YACP,OAAO,EAAE,UAAU;AAAA,UAAA;AAAA,QACrB;AAAA,MACF;AAAA,IACF;AAAA,IACCX,KACC,gBAAAzB;AAAA,MAACqC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,SAASC,EAAY,IAAI,CAACC,OAA6C;AAAA,UACrE,OAAO,EAAE,cAAcA,CAAS,IAAI,EAAE,IAAI,UAAU;AAAA,UACpD,OAAOA;AAAA,QAAA,EACP;AAAA,QACF,OAAO,EAAE,qBAAqB;AAAA,QAC9B,aAAa;AAAA,QACb,cAAc,EAAE,mBAAmB;AAAA,QACnC,YAAU;AAAA,MAAA;AAAA,IACZ;AAAA,sBAEDC,GACC,EAAA,UAAA,gBAAAxC;AAAA,MAACY,EAAW;AAAA,MAAX;AAAA,QACC,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,YAAYM;AAAA,QAEX,YAAE,WAAW;AAAA,MAAA;AAAA,IAAA,EAElB,CAAA;AAAA,EAAA,GACF,EAAA,CACF,EACF,CAAA,GACF;AAEJ;"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as n, Fragment as o, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as t } from "react-i18next";
|
|
3
|
-
import "classnames";
|
|
4
|
-
import "../../../shared/constants.js";
|
|
5
|
-
import { RadioGroupField as i } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
6
3
|
import { TextInputField as a } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
7
|
-
|
|
4
|
+
import { RadioGroupField as i } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
5
|
+
function b({ bankAccount: u }) {
|
|
8
6
|
const { t: e } = t("Contractor.PaymentMethod", { keyPrefix: "bankAccountForm" });
|
|
9
|
-
return /* @__PURE__ */ o
|
|
7
|
+
return /* @__PURE__ */ n(o, { children: [
|
|
10
8
|
/* @__PURE__ */ r(
|
|
11
9
|
a,
|
|
12
10
|
{
|
|
@@ -39,6 +37,7 @@ function d({ bankAccount: u }) {
|
|
|
39
37
|
i,
|
|
40
38
|
{
|
|
41
39
|
name: "accountType",
|
|
40
|
+
isRequired: !0,
|
|
42
41
|
label: e("accountTypeLabel"),
|
|
43
42
|
options: [
|
|
44
43
|
{ value: "Checking", label: e("accountTypeChecking") },
|
|
@@ -49,6 +48,6 @@ function d({ bankAccount: u }) {
|
|
|
49
48
|
] });
|
|
50
49
|
}
|
|
51
50
|
export {
|
|
52
|
-
|
|
51
|
+
b as BankAccountForm
|
|
53
52
|
};
|
|
54
53
|
//# sourceMappingURL=BankAccountForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BankAccountForm.js","sources":["../../../../src/components/Contractor/PaymentMethod/BankAccountForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { BankAccountFormProps } from './types'\nimport { RadioGroupField, TextInputField } from '@/components/Common'\n\nexport function BankAccountForm({ bankAccount }: BankAccountFormProps) {\n const { t } = useTranslation('Contractor.PaymentMethod', { keyPrefix: 'bankAccountForm' })\n\n return (\n <>\n <TextInputField\n name=\"name\"\n isRequired\n label={t('nameLabel')}\n errorMessage={t('validations.accountName')}\n />\n\n <TextInputField\n name=\"routingNumber\"\n label={t('routingNumberLabel')}\n isRequired\n description={t('routingNumberDescription')}\n errorMessage={t('validations.routingNumber')}\n />\n\n <TextInputField\n name=\"accountNumber\"\n label={t('accountNumberLabel')}\n errorMessage={t('validations.accountNumber')}\n isRequired\n />\n\n <RadioGroupField\n name=\"accountType\"\n label={t('accountTypeLabel')}\n options={[\n { value: 'Checking', label: t('accountTypeChecking') },\n { value: 'Savings', label: t('accountTypeSavings') },\n ]}\n />\n </>\n )\n}\n"],"names":["BankAccountForm","bankAccount","t","useTranslation","jsxs","Fragment","jsx","TextInputField","RadioGroupField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BankAccountForm.js","sources":["../../../../src/components/Contractor/PaymentMethod/BankAccountForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { BankAccountFormProps } from './types'\nimport { RadioGroupField, TextInputField } from '@/components/Common'\n\nexport function BankAccountForm({ bankAccount }: BankAccountFormProps) {\n const { t } = useTranslation('Contractor.PaymentMethod', { keyPrefix: 'bankAccountForm' })\n\n return (\n <>\n <TextInputField\n name=\"name\"\n isRequired\n label={t('nameLabel')}\n errorMessage={t('validations.accountName')}\n />\n\n <TextInputField\n name=\"routingNumber\"\n label={t('routingNumberLabel')}\n isRequired\n description={t('routingNumberDescription')}\n errorMessage={t('validations.routingNumber')}\n />\n\n <TextInputField\n name=\"accountNumber\"\n label={t('accountNumberLabel')}\n errorMessage={t('validations.accountNumber')}\n isRequired\n />\n\n <RadioGroupField\n name=\"accountType\"\n isRequired\n label={t('accountTypeLabel')}\n options={[\n { value: 'Checking', label: t('accountTypeChecking') },\n { value: 'Savings', label: t('accountTypeSavings') },\n ]}\n />\n </>\n )\n}\n"],"names":["BankAccountForm","bankAccount","t","useTranslation","jsxs","Fragment","jsx","TextInputField","RadioGroupField"],"mappings":";;;;AAIgB,SAAAA,EAAgB,EAAE,aAAAC,KAAqC;AAC/D,QAAA,EAAE,GAAAC,MAAMC,EAAe,4BAA4B,EAAE,WAAW,mBAAmB;AAEzF,SAEI,gBAAAC,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOL,EAAE,WAAW;AAAA,QACpB,cAAcA,EAAE,yBAAyB;AAAA,MAAA;AAAA,IAC3C;AAAA,IAEA,gBAAAI;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOL,EAAE,oBAAoB;AAAA,QAC7B,YAAU;AAAA,QACV,aAAaA,EAAE,0BAA0B;AAAA,QACzC,cAAcA,EAAE,2BAA2B;AAAA,MAAA;AAAA,IAC7C;AAAA,IAEA,gBAAAI;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOL,EAAE,oBAAoB;AAAA,QAC7B,cAAcA,EAAE,2BAA2B;AAAA,QAC3C,YAAU;AAAA,MAAA;AAAA,IACZ;AAAA,IAEA,gBAAAI;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAON,EAAE,kBAAkB;AAAA,QAC3B,SAAS;AAAA,UACP,EAAE,OAAO,YAAY,OAAOA,EAAE,qBAAqB,EAAE;AAAA,UACrD,EAAE,OAAO,WAAW,OAAOA,EAAE,oBAAoB,EAAE;AAAA,QAAA;AAAA,MACrD;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -18,7 +18,6 @@ import { Form as X } from "../../Common/Form/Form.js";
|
|
|
18
18
|
import { PAYMENT_METHODS as i, componentEvents as s } from "../../../shared/constants.js";
|
|
19
19
|
import { ActionsLayout as Z } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
20
20
|
import { Flex as $ } from "../../Common/Flex/Flex.js";
|
|
21
|
-
import "classnames";
|
|
22
21
|
import { routingNumberValidation as I, accountNumberValidation as tt } from "../../../helpers/validations.js";
|
|
23
22
|
const et = r.discriminatedUnion("type", [
|
|
24
23
|
r.object({
|
|
@@ -33,7 +32,7 @@ const et = r.discriminatedUnion("type", [
|
|
|
33
32
|
type: r.literal("Check")
|
|
34
33
|
})
|
|
35
34
|
]);
|
|
36
|
-
function
|
|
35
|
+
function Dt(n) {
|
|
37
36
|
return /* @__PURE__ */ t(W, { ...n, children: /* @__PURE__ */ t(ot, { ...n, children: n.children }) });
|
|
38
37
|
}
|
|
39
38
|
function ot({ contractorId: n, className: y, dictionary: f }) {
|
|
@@ -112,6 +111,6 @@ function ot({ contractorId: n, className: y, dictionary: f }) {
|
|
|
112
111
|
] }) }) }) });
|
|
113
112
|
}
|
|
114
113
|
export {
|
|
115
|
-
|
|
114
|
+
Dt as PaymentMethod
|
|
116
115
|
};
|
|
117
116
|
//# sourceMappingURL=PaymentMethod.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentMethod.js","sources":["../../../../src/components/Contractor/PaymentMethod/PaymentMethod.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useContractorPaymentMethodGetSuspense } from '@gusto/embedded-api/react-query/contractorPaymentMethodGet'\nimport { useContractorPaymentMethodGetBankAccountsSuspense } from '@gusto/embedded-api/react-query/contractorPaymentMethodGetBankAccounts'\nimport { useContractorPaymentMethodsCreateBankAccountMutation } from '@gusto/embedded-api/react-query/contractorPaymentMethodsCreateBankAccount'\nimport { useMemo } from 'react'\nimport z from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useContractorPaymentMethodUpdateMutation } from '@gusto/embedded-api/react-query/contractorPaymentMethodUpdate'\nimport type { PaymentMethodProps } from './types'\nimport { BankAccountForm } from './BankAccountForm'\nimport { PaymentTypeForm } from './PaymentTypeForm'\nimport { useI18n } from '@/i18n'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { componentEvents, PAYMENT_METHODS } from '@/shared/constants'\nimport { ActionsLayout } from '@/components/Common/ActionsLayout'\nimport { Flex } from '@/components/Common'\nimport { accountNumberValidation, routingNumberValidation } from '@/helpers/validations'\n\nconst PaymentMethodSchema = z.discriminatedUnion('type', [\n z.object({\n type: z.literal('Direct Deposit'),\n name: z.string().min(1),\n routingNumber: routingNumberValidation,\n accountNumber: z.any(), //Explicitely setting account number as most permissive\n accountType: z.enum(['Checking', 'Savings']),\n }),\n z.object({\n type: z.literal('Check'),\n }),\n])\n\nexport type PaymentMethodSchemaInputs = z.input<typeof PaymentMethodSchema>\nexport type PaymentMethodSchemaOutputs = z.output<typeof PaymentMethodSchema>\n\nexport function PaymentMethod(props: PaymentMethodProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ contractorId, className, dictionary }: PaymentMethodProps) {\n useComponentDictionary('Contractor.PaymentMethod', dictionary)\n useI18n('Contractor.PaymentMethod')\n const { t } = useTranslation('Contractor.PaymentMethod')\n const { onEvent, baseSubmitHandler } = useBase()\n const Components = useComponentContext()\n\n const {\n data: { contractorPaymentMethod },\n } = useContractorPaymentMethodGetSuspense({ contractorUuid: contractorId })\n const paymentMethod = contractorPaymentMethod!\n\n const {\n data: { contractorBankAccountList },\n } = useContractorPaymentMethodGetBankAccountsSuspense({\n contractorUuid: contractorId,\n })\n const bankAccount = contractorBankAccountList?.[0] || undefined\n\n const { mutateAsync: updatePaymentMethod, isPending: paymentMethodPending } =\n useContractorPaymentMethodUpdateMutation()\n const { mutateAsync: createBankAccount, isPending: bankAccountPending } =\n useContractorPaymentMethodsCreateBankAccountMutation()\n\n const defaultValues = useMemo(\n () => ({\n type: paymentMethod.type || PAYMENT_METHODS.check,\n name: bankAccount?.name || '',\n routingNumber: bankAccount?.routingNumber || '',\n accountNumber: bankAccount?.hiddenAccountNumber || '',\n accountType: bankAccount?.accountType || 'Checking',\n }),\n [paymentMethod, bankAccount],\n )\n\n const formMethods = useForm({\n resolver: zodResolver(PaymentMethodSchema),\n defaultValues: defaultValues,\n })\n\n const watchedType = useWatch({ control: formMethods.control, name: 'type' })\n const onSubmit: SubmitHandler<PaymentMethodSchemaInputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n let permitBankSubmission = true\n\n if (payload.type === PAYMENT_METHODS.directDeposit) {\n /** Custom validation logic for accountNumber - because masked account value is used as default value, it is only validated when any of the bank-related fields are modified*/\n const { name, accountNumber, routingNumber, accountType } = payload\n if (\n name !== bankAccount?.name ||\n routingNumber !== bankAccount.routingNumber ||\n accountType !== bankAccount.accountType ||\n accountNumber !== bankAccount.hiddenAccountNumber\n ) {\n const res = accountNumberValidation.safeParse(payload.accountNumber)\n if (!res.success) {\n formMethods.setError('accountNumber', { type: 'validate' })\n return\n }\n } else {\n //Edgecase: bank fields are untouched, but we don't want to resubmit with masked account number\n permitBankSubmission = false\n }\n }\n const paymentMethodResponse = await updatePaymentMethod({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n type: payload.type,\n\n version: paymentMethod.version as string,\n },\n },\n })\n onEvent(componentEvents.CONTRACTOR_PAYMENT_METHOD_UPDATED, paymentMethodResponse)\n\n //This update has to follow payment method update because it changes version of paymentMethod\n if (payload.type === PAYMENT_METHODS.directDeposit && permitBankSubmission) {\n const bankAccountResponse = await createBankAccount({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n name: payload.name,\n routingNumber: payload.routingNumber,\n accountNumber: payload.accountNumber,\n accountType: payload.accountType,\n },\n },\n })\n onEvent(componentEvents.CONTRACTOR_BANK_ACCOUNT_CREATED, bankAccountResponse)\n }\n onEvent(componentEvents.CONTRACTOR_PAYMENT_METHOD_DONE)\n })\n }\n\n const showBankAccountForm = watchedType === PAYMENT_METHODS.directDeposit\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex gap={32} flexDirection={'column'}>\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <PaymentTypeForm />\n <hr />\n {showBankAccountForm && <BankAccountForm bankAccount={bankAccount} />}\n <ActionsLayout>\n <Components.Button\n type=\"submit\"\n variant=\"primary\"\n isDisabled={paymentMethodPending || bankAccountPending}\n >\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["PaymentMethodSchema","z","routingNumberValidation","PaymentMethod","props","jsx","BaseComponent","Root","contractorId","className","dictionary","useComponentDictionary","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","Components","useComponentContext","contractorPaymentMethod","useContractorPaymentMethodGetSuspense","paymentMethod","contractorBankAccountList","useContractorPaymentMethodGetBankAccountsSuspense","bankAccount","updatePaymentMethod","paymentMethodPending","useContractorPaymentMethodUpdateMutation","createBankAccount","bankAccountPending","useContractorPaymentMethodsCreateBankAccountMutation","defaultValues","useMemo","PAYMENT_METHODS","formMethods","useForm","zodResolver","watchedType","useWatch","onSubmit","data","payload","permitBankSubmission","name","accountNumber","routingNumber","accountType","accountNumberValidation","paymentMethodResponse","componentEvents","bankAccountResponse","showBankAccountForm","FormProvider","Form","jsxs","Flex","PaymentTypeForm","BankAccountForm","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAMA,KAAsBC,EAAE,mBAAmB,QAAQ;AAAA,EACvDA,EAAE,OAAO;AAAA,IACP,MAAMA,EAAE,QAAQ,gBAAgB;AAAA,IAChC,MAAMA,EAAE,SAAS,IAAI,CAAC;AAAA,IACtB,eAAeC;AAAA,IACf,eAAeD,EAAE,IAAI;AAAA;AAAA,IACrB,aAAaA,EAAE,KAAK,CAAC,YAAY,SAAS,CAAC;AAAA,EAAA,CAC5C;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,MAAMA,EAAE,QAAQ,OAAO;AAAA,EACxB,CAAA;AACH,CAAC;AAKM,SAASE,GAAcC,GAA2B;AAErD,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AA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AL,EAAE,OAAO,GAAE;AAAA,sBACvC4C,GAAgB,EAAA;AAAA,sBAChB,MAAG,EAAA;AAAA,IACHL,KAAwB,gBAAA/C,EAAAqD,GAAA,EAAgB,aAAAjC,EAA0B,CAAA;AAAA,sBAClEkC,GACC,EAAA,UAAA,gBAAAtD;AAAA,MAACa,EAAW;AAAA,MAAX;AAAA,QACC,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,YAAYS,KAAwBG;AAAA,QAEnC,YAAE,aAAa;AAAA,MAAA;AAAA,IAAA,EAEpB,CAAA;AAAA,EAAA,GACF,EAAA,CACF,EACF,CAAA,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PaymentMethod.js","sources":["../../../../src/components/Contractor/PaymentMethod/PaymentMethod.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useContractorPaymentMethodGetSuspense } from '@gusto/embedded-api/react-query/contractorPaymentMethodGet'\nimport { useContractorPaymentMethodGetBankAccountsSuspense } from '@gusto/embedded-api/react-query/contractorPaymentMethodGetBankAccounts'\nimport { useContractorPaymentMethodsCreateBankAccountMutation } from '@gusto/embedded-api/react-query/contractorPaymentMethodsCreateBankAccount'\nimport { useMemo } from 'react'\nimport z from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useContractorPaymentMethodUpdateMutation } from '@gusto/embedded-api/react-query/contractorPaymentMethodUpdate'\nimport type { PaymentMethodProps } from './types'\nimport { BankAccountForm } from './BankAccountForm'\nimport { PaymentTypeForm } from './PaymentTypeForm'\nimport { useI18n } from '@/i18n'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { componentEvents, PAYMENT_METHODS } from '@/shared/constants'\nimport { ActionsLayout } from '@/components/Common/ActionsLayout'\nimport { Flex } from '@/components/Common'\nimport { accountNumberValidation, routingNumberValidation } from '@/helpers/validations'\n\nconst PaymentMethodSchema = z.discriminatedUnion('type', [\n z.object({\n type: z.literal('Direct Deposit'),\n name: z.string().min(1),\n routingNumber: routingNumberValidation,\n accountNumber: z.any(), //Explicitely setting account number as most permissive\n accountType: z.enum(['Checking', 'Savings']),\n }),\n z.object({\n type: z.literal('Check'),\n }),\n])\n\nexport type PaymentMethodSchemaInputs = z.input<typeof PaymentMethodSchema>\nexport type PaymentMethodSchemaOutputs = z.output<typeof PaymentMethodSchema>\n\nexport function PaymentMethod(props: PaymentMethodProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ contractorId, className, dictionary }: PaymentMethodProps) {\n useComponentDictionary('Contractor.PaymentMethod', dictionary)\n useI18n('Contractor.PaymentMethod')\n const { t } = useTranslation('Contractor.PaymentMethod')\n const { onEvent, baseSubmitHandler } = useBase()\n const Components = useComponentContext()\n\n const {\n data: { contractorPaymentMethod },\n } = useContractorPaymentMethodGetSuspense({ contractorUuid: contractorId })\n const paymentMethod = contractorPaymentMethod!\n\n const {\n data: { contractorBankAccountList },\n } = useContractorPaymentMethodGetBankAccountsSuspense({\n contractorUuid: contractorId,\n })\n const bankAccount = contractorBankAccountList?.[0] || undefined\n\n const { mutateAsync: updatePaymentMethod, isPending: paymentMethodPending } =\n useContractorPaymentMethodUpdateMutation()\n const { mutateAsync: createBankAccount, isPending: bankAccountPending } =\n useContractorPaymentMethodsCreateBankAccountMutation()\n\n const defaultValues = useMemo(\n () => ({\n type: paymentMethod.type || PAYMENT_METHODS.check,\n name: bankAccount?.name || '',\n routingNumber: bankAccount?.routingNumber || '',\n accountNumber: bankAccount?.hiddenAccountNumber || '',\n accountType: bankAccount?.accountType || 'Checking',\n }),\n [paymentMethod, bankAccount],\n )\n\n const formMethods = useForm({\n resolver: zodResolver(PaymentMethodSchema),\n defaultValues: defaultValues,\n })\n\n const watchedType = useWatch({ control: formMethods.control, name: 'type' })\n const onSubmit: SubmitHandler<PaymentMethodSchemaInputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n let permitBankSubmission = true\n\n if (payload.type === PAYMENT_METHODS.directDeposit) {\n /** Custom validation logic for accountNumber - because masked account value is used as default value, it is only validated when any of the bank-related fields are modified*/\n const { name, accountNumber, routingNumber, accountType } = payload\n if (\n name !== bankAccount?.name ||\n routingNumber !== bankAccount.routingNumber ||\n accountType !== bankAccount.accountType ||\n accountNumber !== bankAccount.hiddenAccountNumber\n ) {\n const res = accountNumberValidation.safeParse(payload.accountNumber)\n if (!res.success) {\n formMethods.setError('accountNumber', { type: 'validate' })\n return\n }\n } else {\n //Edgecase: bank fields are untouched, but we don't want to resubmit with masked account number\n permitBankSubmission = false\n }\n }\n const paymentMethodResponse = await updatePaymentMethod({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n type: payload.type,\n\n version: paymentMethod.version as string,\n },\n },\n })\n onEvent(componentEvents.CONTRACTOR_PAYMENT_METHOD_UPDATED, paymentMethodResponse)\n\n //This update has to follow payment method update because it changes version of paymentMethod\n if (payload.type === PAYMENT_METHODS.directDeposit && permitBankSubmission) {\n const bankAccountResponse = await createBankAccount({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n name: payload.name,\n routingNumber: payload.routingNumber,\n accountNumber: payload.accountNumber,\n accountType: payload.accountType,\n },\n },\n })\n onEvent(componentEvents.CONTRACTOR_BANK_ACCOUNT_CREATED, bankAccountResponse)\n }\n onEvent(componentEvents.CONTRACTOR_PAYMENT_METHOD_DONE)\n })\n }\n\n const showBankAccountForm = watchedType === PAYMENT_METHODS.directDeposit\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex gap={32} flexDirection={'column'}>\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <PaymentTypeForm />\n <hr />\n {showBankAccountForm && <BankAccountForm bankAccount={bankAccount} />}\n <ActionsLayout>\n <Components.Button\n type=\"submit\"\n variant=\"primary\"\n isDisabled={paymentMethodPending || bankAccountPending}\n >\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["PaymentMethodSchema","z","routingNumberValidation","PaymentMethod","props","jsx","BaseComponent","Root","contractorId","className","dictionary","useComponentDictionary","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","Components","useComponentContext","contractorPaymentMethod","useContractorPaymentMethodGetSuspense","paymentMethod","contractorBankAccountList","useContractorPaymentMethodGetBankAccountsSuspense","bankAccount","updatePaymentMethod","paymentMethodPending","useContractorPaymentMethodUpdateMutation","createBankAccount","bankAccountPending","useContractorPaymentMethodsCreateBankAccountMutation","defaultValues","useMemo","PAYMENT_METHODS","formMethods","useForm","zodResolver","watchedType","useWatch","onSubmit","data","payload","permitBankSubmission","name","accountNumber","routingNumber","accountType","accountNumberValidation","paymentMethodResponse","componentEvents","bankAccountResponse","showBankAccountForm","FormProvider","Form","jsxs","Flex","PaymentTypeForm","BankAccountForm","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA,MAAMA,KAAsBC,EAAE,mBAAmB,QAAQ;AAAA,EACvDA,EAAE,OAAO;AAAA,IACP,MAAMA,EAAE,QAAQ,gBAAgB;AAAA,IAChC,MAAMA,EAAE,SAAS,IAAI,CAAC;AAAA,IACtB,eAAeC;AAAA,IACf,eAAeD,EAAE,IAAI;AAAA;AAAA,IACrB,aAAaA,EAAE,KAAK,CAAC,YAAY,SAAS,CAAC;AAAA,EAAA,CAC5C;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,MAAMA,EAAE,QAAQ,OAAO;AAAA,EACxB,CAAA;AACH,CAAC;AAKM,SAASE,GAAcC,GAA2B;AAErD,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,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AAnD,EAACa,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAL,EAAE,OAAO,GAAE;AAAA,sBACvC4C,GAAgB,EAAA;AAAA,sBAChB,MAAG,EAAA;AAAA,IACHL,KAAwB,gBAAA/C,EAAAqD,GAAA,EAAgB,aAAAjC,EAA0B,CAAA;AAAA,sBAClEkC,GACC,EAAA,UAAA,gBAAAtD;AAAA,MAACa,EAAW;AAAA,MAAX;AAAA,QACC,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,YAAYS,KAAwBG;AAAA,QAEnC,YAAE,aAAa;AAAA,MAAA;AAAA,IAAA,EAEpB,CAAA;AAAA,EAAA,GACF,EAAA,CACF,EACF,CAAA,GACF;AAEJ;"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as r } from "react-i18next";
|
|
3
3
|
import { z as t } from "zod";
|
|
4
|
-
import "classnames";
|
|
5
4
|
import { PAYMENT_METHODS as o } from "../../../shared/constants.js";
|
|
6
5
|
import { RadioGroupField as p } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
7
6
|
t.object({
|
|
8
7
|
type: t.enum(["Check", "Direct Deposit"])
|
|
9
8
|
});
|
|
10
|
-
function
|
|
9
|
+
function s() {
|
|
11
10
|
const { t: e } = r("Contractor.PaymentMethod");
|
|
12
11
|
return /* @__PURE__ */ i(
|
|
13
12
|
p,
|
|
@@ -31,6 +30,6 @@ function d() {
|
|
|
31
30
|
);
|
|
32
31
|
}
|
|
33
32
|
export {
|
|
34
|
-
|
|
33
|
+
s as PaymentTypeForm
|
|
35
34
|
};
|
|
36
35
|
//# sourceMappingURL=PaymentTypeForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentTypeForm.js","sources":["../../../../src/components/Contractor/PaymentMethod/PaymentTypeForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { RadioGroupField } from '@/components/Common'\nimport { PAYMENT_METHODS } from '@/shared/constants'\n\nexport const PaymentTypeSchema = z.object({\n type: z.enum(['Check', 'Direct Deposit']),\n})\nexport type PaymentTypeInputs = z.input<typeof PaymentTypeSchema>\nexport type PaymentTypePayload = z.output<typeof PaymentTypeSchema>\n\nexport function PaymentTypeForm() {\n const { t } = useTranslation('Contractor.PaymentMethod')\n return (\n <RadioGroupField\n name=\"type\"\n label={t('paymentFieldsetLegend')}\n shouldVisuallyHideLabel\n options={[\n {\n value: PAYMENT_METHODS.directDeposit,\n label: t('directDepositLabel'),\n description: t('directDepositDescription'),\n },\n {\n value: PAYMENT_METHODS.check,\n label: t('checkLabel'),\n description: t('checkDescription'),\n },\n ]}\n />\n )\n}\n"],"names":["z","PaymentTypeForm","t","useTranslation","jsx","RadioGroupField","PAYMENT_METHODS"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PaymentTypeForm.js","sources":["../../../../src/components/Contractor/PaymentMethod/PaymentTypeForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { RadioGroupField } from '@/components/Common'\nimport { PAYMENT_METHODS } from '@/shared/constants'\n\nexport const PaymentTypeSchema = z.object({\n type: z.enum(['Check', 'Direct Deposit']),\n})\nexport type PaymentTypeInputs = z.input<typeof PaymentTypeSchema>\nexport type PaymentTypePayload = z.output<typeof PaymentTypeSchema>\n\nexport function PaymentTypeForm() {\n const { t } = useTranslation('Contractor.PaymentMethod')\n return (\n <RadioGroupField\n name=\"type\"\n label={t('paymentFieldsetLegend')}\n shouldVisuallyHideLabel\n options={[\n {\n value: PAYMENT_METHODS.directDeposit,\n label: t('directDepositLabel'),\n description: t('directDepositDescription'),\n },\n {\n value: PAYMENT_METHODS.check,\n label: t('checkLabel'),\n description: t('checkDescription'),\n },\n ]}\n />\n )\n}\n"],"names":["z","PaymentTypeForm","t","useTranslation","jsx","RadioGroupField","PAYMENT_METHODS"],"mappings":";;;;;AAKiCA,EAAE,OAAO;AAAA,EACxC,MAAMA,EAAE,KAAK,CAAC,SAAS,gBAAgB,CAAC;AAC1C,CAAC;AAIM,SAASC,IAAkB;AAChC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,0BAA0B;AAErD,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,OAAOH,EAAE,uBAAuB;AAAA,MAChC,yBAAuB;AAAA,MACvB,SAAS;AAAA,QACP;AAAA,UACE,OAAOI,EAAgB;AAAA,UACvB,OAAOJ,EAAE,oBAAoB;AAAA,UAC7B,aAAaA,EAAE,0BAA0B;AAAA,QAC3C;AAAA,QACA;AAAA,UACE,OAAOI,EAAgB;AAAA,UACvB,OAAOJ,EAAE,YAAY;AAAA,UACrB,aAAaA,EAAE,kBAAkB;AAAA,QAAA;AAAA,MACnC;AAAA,IACF;AAAA,EACF;AAEJ;"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as i, jsxs as r, Fragment as s } from "react/jsx-runtime";
|
|
2
2
|
import { FormProvider as R } from "react-hook-form";
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { useComponentContext as
|
|
5
|
-
import { useI18n as
|
|
6
|
-
import { Form as
|
|
3
|
+
import { useTranslation as q } from "react-i18next";
|
|
4
|
+
import { useComponentContext as F } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
5
|
+
import { useI18n as N } from "../../../i18n/I18n.js";
|
|
6
|
+
import { Form as T } from "../../Common/Form/Form.js";
|
|
7
7
|
import { Grid as a } from "../../Common/Grid/Grid.js";
|
|
8
8
|
import { Flex as x } from "../../Common/Flex/Flex.js";
|
|
9
|
+
import { normalizeSSN as v } from "../../../helpers/ssn.js";
|
|
10
|
+
import { normalizeEin as D } from "../../../helpers/federalEin.js";
|
|
9
11
|
import { TextInputField as t } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
10
|
-
import { NumberInputField as v } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
11
12
|
import { RadioGroupField as m } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { normalizeEin as S } from "../../../helpers/federalEin.js";
|
|
13
|
+
import { NumberInputField as I } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
14
|
+
import { SwitchField as P } from "../../Common/Fields/SwitchField/SwitchField.js";
|
|
15
|
+
import { DatePickerField as S } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
16
16
|
function U({
|
|
17
17
|
formMethods: d,
|
|
18
18
|
handleSubmit: u,
|
|
@@ -27,10 +27,10 @@ function U({
|
|
|
27
27
|
isEditing: o,
|
|
28
28
|
className: y
|
|
29
29
|
}) {
|
|
30
|
-
const l =
|
|
31
|
-
|
|
32
|
-
const { t: e } =
|
|
33
|
-
return /* @__PURE__ */ i("section", { className: y, children: /* @__PURE__ */ i(R, { ...d, children: /* @__PURE__ */ r(
|
|
30
|
+
const l = F();
|
|
31
|
+
N("Contractor.Profile");
|
|
32
|
+
const { t: e } = q("Contractor.Profile");
|
|
33
|
+
return /* @__PURE__ */ i("section", { className: y, children: /* @__PURE__ */ i(R, { ...d, children: /* @__PURE__ */ r(T, { onSubmit: u, children: [
|
|
34
34
|
/* @__PURE__ */ r(a, { gridTemplateColumns: "1fr", gap: 24, className: "mb-8", children: [
|
|
35
35
|
/* @__PURE__ */ r("header", { children: [
|
|
36
36
|
/* @__PURE__ */ i(l.Heading, { as: "h2", children: e("title") }),
|
|
@@ -38,7 +38,7 @@ function U({
|
|
|
38
38
|
] }),
|
|
39
39
|
/* @__PURE__ */ i(l.Card, { children: /* @__PURE__ */ r(a, { gap: 16, children: [
|
|
40
40
|
/* @__PURE__ */ i(
|
|
41
|
-
|
|
41
|
+
P,
|
|
42
42
|
{
|
|
43
43
|
name: "inviteContractor",
|
|
44
44
|
label: e("fields.inviteContractor.label"),
|
|
@@ -59,6 +59,7 @@ function U({
|
|
|
59
59
|
m,
|
|
60
60
|
{
|
|
61
61
|
name: "contractorType",
|
|
62
|
+
isRequired: !0,
|
|
62
63
|
label: e("fields.contractorType.label"),
|
|
63
64
|
options: C
|
|
64
65
|
}
|
|
@@ -75,7 +76,7 @@ function U({
|
|
|
75
76
|
name: "ssn",
|
|
76
77
|
label: e("fields.ssn.label"),
|
|
77
78
|
placeholder: e("fields.ssn.placeholder"),
|
|
78
|
-
transform:
|
|
79
|
+
transform: v,
|
|
79
80
|
isRequired: !0
|
|
80
81
|
}
|
|
81
82
|
)
|
|
@@ -95,7 +96,7 @@ function U({
|
|
|
95
96
|
name: "ein",
|
|
96
97
|
label: e("fields.ein.label"),
|
|
97
98
|
placeholder: e("fields.ein.placeholder"),
|
|
98
|
-
transform:
|
|
99
|
+
transform: D,
|
|
99
100
|
isRequired: !0
|
|
100
101
|
}
|
|
101
102
|
)
|
|
@@ -104,12 +105,13 @@ function U({
|
|
|
104
105
|
m,
|
|
105
106
|
{
|
|
106
107
|
name: "wageType",
|
|
108
|
+
isRequired: !0,
|
|
107
109
|
label: e("fields.wageType.label"),
|
|
108
110
|
options: g
|
|
109
111
|
}
|
|
110
112
|
),
|
|
111
113
|
h && /* @__PURE__ */ i(
|
|
112
|
-
|
|
114
|
+
I,
|
|
113
115
|
{
|
|
114
116
|
name: "hourlyRate",
|
|
115
117
|
label: e("fields.hourlyRate.label"),
|
|
@@ -119,7 +121,7 @@ function U({
|
|
|
119
121
|
}
|
|
120
122
|
),
|
|
121
123
|
/* @__PURE__ */ i(
|
|
122
|
-
|
|
124
|
+
S,
|
|
123
125
|
{
|
|
124
126
|
name: "startDate",
|
|
125
127
|
label: e("fields.startDate.label"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractorProfileForm.js","sources":["../../../../src/components/Contractor/Profile/ContractorProfileForm.tsx"],"sourcesContent":["import { FormProvider } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport type { useContractorProfile } from './useContractorProfile'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { Form } from '@/components/Common/Form'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { Flex } from '@/components/Common/Flex'\nimport { TextInputField } from '@/components/Common/Fields/TextInputField'\nimport { NumberInputField } from '@/components/Common/Fields/NumberInputField'\nimport { RadioGroupField } from '@/components/Common/Fields/RadioGroupField'\nimport { SwitchField } from '@/components/Common/Fields/SwitchField'\nimport { DatePickerField } from '@/components/Common/Fields/DatePickerField'\nimport { normalizeSSN } from '@/helpers/ssn'\nimport { normalizeEin } from '@/helpers/federalEin'\n\n// Pure presentation component - takes all data as props\nexport type ContractorProfileFormProps = ReturnType<typeof useContractorProfile> & {\n className?: string\n}\n\nexport function ContractorProfileForm({\n formMethods,\n handleSubmit,\n formState,\n handleCancel,\n shouldShowEmailField,\n shouldShowBusinessFields,\n shouldShowIndividualFields,\n shouldShowHourlyRate,\n contractorTypeOptions,\n wageTypeOptions,\n isEditing,\n className,\n}: ContractorProfileFormProps) {\n const Components = useComponentContext()\n useI18n('Contractor.Profile')\n const { t } = useTranslation('Contractor.Profile')\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit}>\n <Grid gridTemplateColumns=\"1fr\" gap={24} className=\"mb-8\">\n <header>\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Components.Text>{t('subtitle')}</Components.Text>\n </header>\n\n {/* Invite Contractor Card */}\n <Components.Card>\n <Grid gap={16}>\n {/* Invite Contractor Toggle */}\n <SwitchField\n name=\"inviteContractor\"\n label={t('fields.inviteContractor.label')}\n description={t('fields.inviteContractor.description')}\n />\n\n {/* Email Field - shown when inviting contractor */}\n {shouldShowEmailField && (\n <TextInputField\n name=\"email\"\n label={t('fields.email.label')}\n isRequired\n type=\"email\"\n />\n )}\n </Grid>\n </Components.Card>\n\n {/* Contractor Type */}\n <RadioGroupField\n name=\"contractorType\"\n label={t('fields.contractorType.label')}\n options={contractorTypeOptions}\n />\n\n {/* Individual Contractor Fields */}\n {shouldShowIndividualFields && (\n <>\n <Grid gridTemplateColumns={{ base: '1fr', medium: '1fr 1fr' }} gap={16}>\n <TextInputField name=\"firstName\" label={t('fields.firstName.label')} isRequired />\n <TextInputField name=\"middleInitial\" label={t('fields.middleInitial.label')} />\n </Grid>\n <TextInputField name=\"lastName\" label={t('fields.lastName.label')} isRequired />\n <TextInputField\n name=\"ssn\"\n label={t('fields.ssn.label')}\n placeholder={t('fields.ssn.placeholder')}\n transform={normalizeSSN}\n isRequired\n />\n </>\n )}\n\n {/* Business Contractor Fields */}\n {shouldShowBusinessFields && (\n <>\n <TextInputField\n name=\"businessName\"\n label={t('fields.businessName.label')}\n isRequired\n />\n <TextInputField\n name=\"ein\"\n label={t('fields.ein.label')}\n placeholder={t('fields.ein.placeholder')}\n transform={normalizeEin}\n isRequired\n />\n </>\n )}\n\n {/* Wage Type */}\n <RadioGroupField\n name=\"wageType\"\n label={t('fields.wageType.label')}\n options={wageTypeOptions}\n />\n\n {/* Hourly Rate - shown for hourly contractors */}\n {shouldShowHourlyRate && (\n <NumberInputField\n name=\"hourlyRate\"\n label={t('fields.hourlyRate.label')}\n min={0}\n isRequired\n format=\"currency\"\n />\n )}\n\n {/* Start Date */}\n <DatePickerField\n name=\"startDate\"\n label={t('fields.startDate.label')}\n description={t('fields.startDate.description')}\n isRequired\n />\n </Grid>\n\n {/* Actions */}\n <Flex gap={12} justifyContent=\"flex-end\">\n <Components.Button type=\"button\" variant=\"secondary\" onClick={handleCancel}>\n {t('buttons.cancel')}\n </Components.Button>\n <Components.Button type=\"submit\" variant=\"primary\" isDisabled={formState.isSubmitting}>\n {formState.isSubmitting\n ? isEditing\n ? t('buttons.updating')\n : t('buttons.creating')\n : isEditing\n ? t('buttons.update')\n : t('buttons.create')}\n </Components.Button>\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["ContractorProfileForm","formMethods","handleSubmit","formState","handleCancel","shouldShowEmailField","shouldShowBusinessFields","shouldShowIndividualFields","shouldShowHourlyRate","contractorTypeOptions","wageTypeOptions","isEditing","className","Components","useComponentContext","useI18n","t","useTranslation","jsx","FormProvider","jsxs","Form","Grid","SwitchField","TextInputField","RadioGroupField","Fragment","normalizeSSN","normalizeEin","NumberInputField","DatePickerField","Flex"],"mappings":";;;;;;;;;;;;;;;AAqBO,SAASA,EAAsB;AAAA,EACpC,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,0BAAAC;AAAA,EACA,4BAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AACF,GAA+B;AAC7B,QAAMC,IAAaC,EAAoB;AACvC,EAAAC,EAAQ,oBAAoB;AAC5B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,oBAAoB;AAG/C,SAAA,gBAAAC,EAAC,WAAQ,EAAA,WAAAN,GACP,UAAC,gBAAAM,EAAAC,GAAA,EAAc,GAAGlB,GAChB,UAAA,gBAAAmB,EAACC,GAAK,EAAA,UAAUnB,GACd,UAAA;AAAA,IAAA,gBAAAkB,EAACE,KAAK,qBAAoB,OAAM,KAAK,IAAI,WAAU,QACjD,UAAA;AAAA,MAAA,gBAAAF,EAAC,UACC,EAAA,UAAA;AAAA,QAAA,gBAAAF,EAACL,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAG,EAAE,OAAO,GAAE;AAAA,0BACvCH,EAAW,MAAX,EAAiB,UAAAG,EAAE,UAAU,EAAE,CAAA;AAAA,MAAA,GAClC;AAAA,wBAGCH,EAAW,MAAX,EACC,UAAC,gBAAAO,EAAAE,GAAA,EAAK,KAAK,IAET,UAAA;AAAA,QAAA,gBAAAJ;AAAA,UAACK;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,OAAOP,EAAE,+BAA+B;AAAA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,UAACM;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,OAAOR,EAAE,kBAAkB;AAAA,YAC3B,aAAaA,EAAE,wBAAwB;AAAA,YACvC,WAAWY;AAAA,YACX,YAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACZ,GACF;AAAA,MAIF,gBAAAV;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOT,EAAE,uBAAuB;AAAA,UAChC,SAASN;AAAA,QAAA;AAAA,MACX;AAAA,MAGCF,KACC,gBAAAU;AAAA,QAACW;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOb,EAAE,yBAAyB;AAAA,UAClC,KAAK;AAAA,UACL,YAAU;AAAA,UACV,QAAO;AAAA,QAAA;AAAA,MACT;AAAA,MAIF,gBAAAE;AAAA,QAACY;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOd,EAAE,wBAAwB;AAAA,UACjC,aAAaA,EAAE,8BAA8B;AAAA,UAC7C,YAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ,GACF;AAAA,IAGC,gBAAAI,EAAAW,GAAA,EAAK,KAAK,IAAI,gBAAe,YAC5B,UAAA;AAAA,MAAC,gBAAAb,EAAAL,EAAW,QAAX,EAAkB,MAAK,UAAS,SAAQ,aAAY,SAAST,GAC3D,UAAEY,EAAA,gBAAgB,EACrB,CAAA;AAAA,MACA,gBAAAE,EAACL,EAAW,QAAX,EAAkB,MAAK,UAAS,SAAQ,WAAU,YAAYV,EAAU,cACtE,UAAUA,EAAA,eAELa,EADFL,IACI,qBACA,kBADkB,IAGpBK,EADFL,IACI,mBACA,gBADgB,EAE1B,CAAA;AAAA,IAAA,EACF,CAAA;AAAA,EAAA,EACF,CAAA,EACF,CAAA,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ContractorProfileForm.js","sources":["../../../../src/components/Contractor/Profile/ContractorProfileForm.tsx"],"sourcesContent":["import { FormProvider } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport type { useContractorProfile } from './useContractorProfile'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { Form } from '@/components/Common/Form'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { Flex } from '@/components/Common/Flex'\nimport { TextInputField } from '@/components/Common/Fields/TextInputField'\nimport { NumberInputField } from '@/components/Common/Fields/NumberInputField'\nimport { RadioGroupField } from '@/components/Common/Fields/RadioGroupField'\nimport { SwitchField } from '@/components/Common/Fields/SwitchField'\nimport { DatePickerField } from '@/components/Common/Fields/DatePickerField'\nimport { normalizeSSN } from '@/helpers/ssn'\nimport { normalizeEin } from '@/helpers/federalEin'\n\n// Pure presentation component - takes all data as props\nexport type ContractorProfileFormProps = ReturnType<typeof useContractorProfile> & {\n className?: string\n}\n\nexport function ContractorProfileForm({\n formMethods,\n handleSubmit,\n formState,\n handleCancel,\n shouldShowEmailField,\n shouldShowBusinessFields,\n shouldShowIndividualFields,\n shouldShowHourlyRate,\n contractorTypeOptions,\n wageTypeOptions,\n isEditing,\n className,\n}: ContractorProfileFormProps) {\n const Components = useComponentContext()\n useI18n('Contractor.Profile')\n const { t } = useTranslation('Contractor.Profile')\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit}>\n <Grid gridTemplateColumns=\"1fr\" gap={24} className=\"mb-8\">\n <header>\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Components.Text>{t('subtitle')}</Components.Text>\n </header>\n\n {/* Invite Contractor Card */}\n <Components.Card>\n <Grid gap={16}>\n {/* Invite Contractor Toggle */}\n <SwitchField\n name=\"inviteContractor\"\n label={t('fields.inviteContractor.label')}\n description={t('fields.inviteContractor.description')}\n />\n\n {/* Email Field - shown when inviting contractor */}\n {shouldShowEmailField && (\n <TextInputField\n name=\"email\"\n label={t('fields.email.label')}\n isRequired\n type=\"email\"\n />\n )}\n </Grid>\n </Components.Card>\n\n {/* Contractor Type */}\n <RadioGroupField\n name=\"contractorType\"\n isRequired\n label={t('fields.contractorType.label')}\n options={contractorTypeOptions}\n />\n\n {/* Individual Contractor Fields */}\n {shouldShowIndividualFields && (\n <>\n <Grid gridTemplateColumns={{ base: '1fr', medium: '1fr 1fr' }} gap={16}>\n <TextInputField name=\"firstName\" label={t('fields.firstName.label')} isRequired />\n <TextInputField name=\"middleInitial\" label={t('fields.middleInitial.label')} />\n </Grid>\n <TextInputField name=\"lastName\" label={t('fields.lastName.label')} isRequired />\n <TextInputField\n name=\"ssn\"\n label={t('fields.ssn.label')}\n placeholder={t('fields.ssn.placeholder')}\n transform={normalizeSSN}\n isRequired\n />\n </>\n )}\n\n {/* Business Contractor Fields */}\n {shouldShowBusinessFields && (\n <>\n <TextInputField\n name=\"businessName\"\n label={t('fields.businessName.label')}\n isRequired\n />\n <TextInputField\n name=\"ein\"\n label={t('fields.ein.label')}\n placeholder={t('fields.ein.placeholder')}\n transform={normalizeEin}\n isRequired\n />\n </>\n )}\n\n {/* Wage Type */}\n <RadioGroupField\n name=\"wageType\"\n isRequired\n label={t('fields.wageType.label')}\n options={wageTypeOptions}\n />\n\n {/* Hourly Rate - shown for hourly contractors */}\n {shouldShowHourlyRate && (\n <NumberInputField\n name=\"hourlyRate\"\n label={t('fields.hourlyRate.label')}\n min={0}\n isRequired\n format=\"currency\"\n />\n )}\n\n {/* Start Date */}\n <DatePickerField\n name=\"startDate\"\n label={t('fields.startDate.label')}\n description={t('fields.startDate.description')}\n isRequired\n />\n </Grid>\n\n {/* Actions */}\n <Flex gap={12} justifyContent=\"flex-end\">\n <Components.Button type=\"button\" variant=\"secondary\" onClick={handleCancel}>\n {t('buttons.cancel')}\n </Components.Button>\n <Components.Button type=\"submit\" variant=\"primary\" isDisabled={formState.isSubmitting}>\n {formState.isSubmitting\n ? isEditing\n ? t('buttons.updating')\n : t('buttons.creating')\n : isEditing\n ? t('buttons.update')\n : t('buttons.create')}\n </Components.Button>\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["ContractorProfileForm","formMethods","handleSubmit","formState","handleCancel","shouldShowEmailField","shouldShowBusinessFields","shouldShowIndividualFields","shouldShowHourlyRate","contractorTypeOptions","wageTypeOptions","isEditing","className","Components","useComponentContext","useI18n","t","useTranslation","jsx","FormProvider","jsxs","Form","Grid","SwitchField","TextInputField","RadioGroupField","Fragment","normalizeSSN","normalizeEin","NumberInputField","DatePickerField","Flex"],"mappings":";;;;;;;;;;;;;;;AAqBO,SAASA,EAAsB;AAAA,EACpC,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,0BAAAC;AAAA,EACA,4BAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AACF,GAA+B;AAC7B,QAAMC,IAAaC,EAAoB;AACvC,EAAAC,EAAQ,oBAAoB;AAC5B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,oBAAoB;AAG/C,SAAA,gBAAAC,EAAC,WAAQ,EAAA,WAAAN,GACP,UAAC,gBAAAM,EAAAC,GAAA,EAAc,GAAGlB,GAChB,UAAA,gBAAAmB,EAACC,GAAK,EAAA,UAAUnB,GACd,UAAA;AAAA,IAAA,gBAAAkB,EAACE,KAAK,qBAAoB,OAAM,KAAK,IAAI,WAAU,QACjD,UAAA;AAAA,MAAA,gBAAAF,EAAC,UACC,EAAA,UAAA;AAAA,QAAA,gBAAAF,EAACL,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAG,EAAE,OAAO,GAAE;AAAA,0BACvCH,EAAW,MAAX,EAAiB,UAAAG,EAAE,UAAU,EAAE,CAAA;AAAA,MAAA,GAClC;AAAA,wBAGCH,EAAW,MAAX,EACC,UAAC,gBAAAO,EAAAE,GAAA,EAAK,KAAK,IAET,UAAA;AAAA,QAAA,gBAAAJ;AAAA,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