@gusto/embedded-react-sdk 0.8.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +91 -2
- package/dist/components/Common/DataView/DataCards/DataCards.js +21 -21
- package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
- package/dist/components/Common/OnboardingStatusBadge/index.d.ts +21 -0
- package/dist/components/Common/OnboardingStatusBadge/index.js +17 -0
- package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -0
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +8 -7
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +5 -4
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/TaxInputs/TaxInputs.js +42 -36
- package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBox.js +28 -27
- package/dist/components/Common/UI/ComboBox/ComboBox.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +6 -6
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +7 -6
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +9 -8
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +7 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +3 -2
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +7 -6
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +8 -7
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +6 -5
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +5 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +7 -6
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +13 -11
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +6 -5
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +8 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +11 -10
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +3 -2
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +3 -2
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +7 -6
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +5 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +11 -10
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +7 -5
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +10 -9
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +29 -29
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +7 -6
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +6 -5
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Actions.d.ts +1 -0
- package/dist/components/Contractor/Address/Actions.js +13 -0
- package/dist/components/Contractor/Address/Actions.js.map +1 -0
- package/dist/components/Contractor/Address/Address.d.ts +16 -0
- package/dist/components/Contractor/Address/Address.js +74 -0
- package/dist/components/Contractor/Address/Address.js.map +1 -0
- package/dist/components/Contractor/Address/Form.d.ts +1 -0
- package/dist/components/Contractor/Address/Form.js +57 -0
- package/dist/components/Contractor/Address/Form.js.map +1 -0
- package/dist/components/Contractor/Address/Head.d.ts +1 -0
- package/dist/components/Contractor/Address/Head.js +15 -0
- package/dist/components/Contractor/Address/Head.js.map +1 -0
- package/dist/components/Contractor/Address/index.d.ts +2 -0
- package/dist/components/Contractor/Address/useAddress.d.ts +33 -0
- package/dist/components/Contractor/Address/useAddress.js +28 -0
- package/dist/components/Contractor/Address/useAddress.js.map +1 -0
- package/dist/components/Contractor/List/index.d.ts +25 -0
- package/dist/components/Contractor/List/index.js +84 -0
- package/dist/components/Contractor/List/index.js.map +1 -0
- package/dist/components/Contractor/List/useContractorList.d.ts +20 -0
- package/dist/components/Contractor/List/useContractorList.js +31 -0
- package/dist/components/Contractor/List/useContractorList.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.d.ts +2 -0
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +53 -0
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +31 -0
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +108 -0
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.d.ts +11 -0
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +35 -0
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/types.d.ts +8 -0
- package/dist/components/Contractor/index.d.ts +4 -0
- package/dist/components/Contractor/index.js +9 -0
- package/dist/components/Contractor/index.js.map +1 -0
- package/dist/components/Employee/Compensation/Actions.js +1 -1
- package/dist/components/Employee/Compensation/Compensation.js +1 -1
- package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
- package/dist/components/Employee/Compensation/Edit.js +59 -56
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Compensation/List.js +6 -5
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Compensation/useCompensation.d.ts +2 -0
- package/dist/components/Employee/Compensation/useCompensation.js +16 -14
- package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
- package/dist/components/Employee/Deductions/Actions.js +9 -8
- package/dist/components/Employee/Deductions/Actions.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionForm.js +14 -5
- package/dist/components/Employee/Deductions/DeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/Deductions.js +25 -25
- package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsList.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductionsForm.js +3 -2
- package/dist/components/Employee/Deductions/IncludeDeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/useDeductions.js +8 -6
- package/dist/components/Employee/Deductions/useDeductions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +5 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +5 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +5 -4
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +56 -51
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +2 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +5 -3
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +48 -43
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Actions.js +6 -5
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +3 -2
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +3 -4
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +88 -76
- package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +2 -2
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +35 -29
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +7 -6
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +49 -20
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +27 -25
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +10 -9
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +124 -116
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +5 -3
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/Taxes/Actions.js +8 -7
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +5 -4
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/StateForm.d.ts +1 -1
- package/dist/components/Employee/Taxes/StateForm.js +27 -25
- package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.d.ts +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +90 -83
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.d.ts +2 -2
- package/dist/components/Employee/Taxes/useTaxes.js +5 -3
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +8 -7
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/i18n/I18n.js +5 -5
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.Address.json.js +35 -0
- package/dist/i18n/en/Contractor.Address.json.js.map +1 -0
- package/dist/i18n/en/Contractor.ContractorList.json.js +25 -0
- package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -0
- package/dist/i18n/en/Contractor.PaymentMethod.json.js +35 -0
- package/dist/i18n/en/Contractor.PaymentMethod.json.js.map +1 -0
- package/dist/i18n/en/Employee.Compensation.json.js +22 -20
- package/dist/i18n/en/Employee.Compensation.json.js.map +1 -1
- package/dist/i18n/en/Employee.PaymentMethod.json.js +18 -17
- package/dist/i18n/en/Employee.PaymentMethod.json.js.map +1 -1
- package/dist/i18n/en/common.json.d.ts +21 -9
- package/dist/i18n/en/common.json.js +35 -23
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/shared/constants.d.ts +20 -0
- package/dist/shared/constants.js +62 -45
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +71 -1
- package/package.json +7 -3
- package/dist/components/Employee/PaymentMethod/Constants.d.ts +0 -8
- package/dist/components/Employee/PaymentMethod/Constants.js +0 -6
- package/dist/components/Employee/PaymentMethod/Constants.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Form.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { Fragment } from 'react/jsx-runtime'\nimport { useStateTaxesForm } from './context'\nimport { QuestionInput } from '@/components/Common/TaxInputs/TaxInputs'\nimport { useLocaleDateFormatter } from '@/contexts/LocaleProvider/useLocale'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const StateFormSchema = z.record(z.string(), z.record(z.string(), z.unknown()))\n\nexport type StateFormInputs = z.infer<typeof StateFormSchema>\n\nexport function Form() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const dateFormatter = useLocaleDateFormatter()\n const { stateTaxRequirements } = useStateTaxesForm()\n const Components = useComponentContext()\n\n return stateTaxRequirements.requirementSets?.map(\n ({ requirements, label, effectiveFrom, key }) => (\n <Fragment key={key}>\n <div>\n <Components.Heading as=\"
|
|
1
|
+
{"version":3,"file":"Form.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Form.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { Fragment } from 'react/jsx-runtime'\nimport { useStateTaxesForm } from './context'\nimport { QuestionInput } from '@/components/Common/TaxInputs/TaxInputs'\nimport { useLocaleDateFormatter } from '@/contexts/LocaleProvider/useLocale'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const StateFormSchema = z.record(z.string(), z.record(z.string(), z.unknown()))\n\nexport type StateFormInputs = z.infer<typeof StateFormSchema>\n\nexport function Form() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const dateFormatter = useLocaleDateFormatter()\n const { stateTaxRequirements } = useStateTaxesForm()\n const Components = useComponentContext()\n\n return stateTaxRequirements.requirementSets?.map(\n ({ requirements, label, effectiveFrom, key }) => (\n <Fragment key={key}>\n <div>\n <Components.Heading as=\"h3\">{label}</Components.Heading>\n {effectiveFrom && (\n <Components.Text className=\"lightText\">\n {t('effectiveFromLabel', { date: dateFormatter.format(new Date(effectiveFrom)) })}\n </Components.Text>\n )}\n </div>\n {requirements?.map(requirement => {\n return (\n <QuestionInput\n requirement={{\n ...requirement,\n key: `${key}.${requirement.key as string}`,\n }}\n questionType={requirement.metadata?.type ?? 'Text'}\n key={requirement.key}\n />\n )\n })}\n </Fragment>\n ),\n )\n}\n"],"names":["z","Form","t","useTranslation","dateFormatter","useLocaleDateFormatter","stateTaxRequirements","useStateTaxesForm","Components","useComponentContext","requirements","label","effectiveFrom","key","Fragment","jsxs","jsx","requirement","QuestionInput"],"mappings":";;;;;;;AAQ+BA,EAAE,OAAOA,EAAE,UAAUA,EAAE,OAAOA,EAAE,OAAO,GAAGA,EAAE,QAAA,CAAS,CAAC;AAI9E,SAASC,IAAO;AACf,QAAA,EAAE,GAAAC,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClEC,IAAgBC,EAAuB,GACvC,EAAE,sBAAAC,EAAqB,IAAIC,EAAkB,GAC7CC,IAAaC,EAAoB;AAEvC,SAAOH,EAAqB,iBAAiB;AAAA,IAC3C,CAAC,EAAE,cAAAI,GAAc,OAAAC,GAAO,eAAAC,GAAe,KAAAC,EAAI,wBACxCC,GACC,EAAA,UAAA;AAAA,MAAA,gBAAAC,EAAC,OACC,EAAA,UAAA;AAAA,QAAA,gBAAAC,EAACR,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAMG,GAAA;AAAA,QAClCC,KACE,gBAAAI,EAAAR,EAAW,MAAX,EAAgB,WAAU,aACxB,UAAEN,EAAA,sBAAsB,EAAE,MAAME,EAAc,OAAO,IAAI,KAAKQ,CAAa,CAAC,EAAA,CAAG,EAClF,CAAA;AAAA,MAAA,GAEJ;AAAA,MACCF,GAAc,IAAI,CAAeO,MAE9B,gBAAAD;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,aAAa;AAAA,YACX,GAAGD;AAAA,YACH,KAAK,GAAGJ,CAAG,IAAII,EAAY,GAAa;AAAA,UAC1C;AAAA,UACA,cAAcA,EAAY,UAAU,QAAQ;AAAA,QAAA;AAAA,QACvCA,EAAY;AAAA,MACnB,CAEH;AAAA,IAAA,EAAA,GApBYJ,CAqBf;AAAA,EAEJ;AACF;"}
|
|
@@ -3,52 +3,52 @@ import { useForm as K, FormProvider as M } from "react-hook-form";
|
|
|
3
3
|
import { zodResolver as w } from "@hookform/resolvers/zod";
|
|
4
4
|
import { useTaxRequirementsUpdateStateMutation as z } from "@gusto/embedded-api/react-query/taxRequirementsUpdateState";
|
|
5
5
|
import { useTaxRequirementsGetSuspense as G } from "@gusto/embedded-api/react-query/taxRequirementsGet";
|
|
6
|
-
import { z as
|
|
6
|
+
import { z as n } from "zod";
|
|
7
7
|
import { useMemo as L } from "react";
|
|
8
8
|
import { useTranslation as X } from "react-i18next";
|
|
9
|
-
import { Head as
|
|
9
|
+
import { Head as A } from "./Head.js";
|
|
10
10
|
import { StateTaxesFormProvider as Y } from "./context.js";
|
|
11
|
-
import { Form as
|
|
12
|
-
import { Actions as
|
|
11
|
+
import { Form as P } from "./Form.js";
|
|
12
|
+
import { Actions as j } from "./Actions.js";
|
|
13
13
|
import { BaseComponent as $ } from "../../../Base/Base.js";
|
|
14
14
|
import { useI18n as I } from "../../../../i18n/I18n.js";
|
|
15
15
|
import { Flex as J } from "../../../Common/Flex/Flex.js";
|
|
16
16
|
import { Form as Q } from "../../../Common/Form/Form.js";
|
|
17
17
|
import { componentEvents as k } from "../../../../shared/constants.js";
|
|
18
18
|
import { useBase as W } from "../../../Base/useBase.js";
|
|
19
|
-
function x(
|
|
20
|
-
return /* @__PURE__ */ t($, { ...
|
|
19
|
+
function x(a) {
|
|
20
|
+
return /* @__PURE__ */ t($, { ...a, children: /* @__PURE__ */ t(Z, { ...a, children: a.children }) });
|
|
21
21
|
}
|
|
22
|
-
function Z({ companyId:
|
|
22
|
+
function Z({ companyId: a, state: S, className: q, children: v }) {
|
|
23
23
|
I("Company.StateTaxes");
|
|
24
|
-
const { onEvent: F, baseSubmitHandler: C } = W(), { t: l } = X("Company.StateTaxes", { keyPrefix: "form" }), { data: E } = G({ companyUuid:
|
|
24
|
+
const { onEvent: F, baseSubmitHandler: C } = W(), { t: l } = X("Company.StateTaxes", { keyPrefix: "form" }), { data: E } = G({ companyUuid: a, state: S }), f = E.taxRequirementsState, { mutateAsync: N, isPending: R } = z(), { dynamicSchema: V, defaultValues: O } = L(() => {
|
|
25
25
|
const d = {}, i = {};
|
|
26
26
|
return f.requirementSets?.forEach((e) => {
|
|
27
27
|
if (!e.key) return;
|
|
28
28
|
const m = e.key, s = {}, p = {};
|
|
29
29
|
e.requirements?.forEach((o) => {
|
|
30
30
|
if (!o.key) return;
|
|
31
|
-
const
|
|
32
|
-
p[
|
|
33
|
-
let y =
|
|
31
|
+
const g = o.key;
|
|
32
|
+
p[g] = String(o.value ?? "");
|
|
33
|
+
let y = n.string().min(1);
|
|
34
34
|
const c = o.metadata?.validation;
|
|
35
35
|
if (c && o.metadata?.type === "tax_rate")
|
|
36
36
|
if (c.type === "min_max") {
|
|
37
|
-
const
|
|
38
|
-
!isNaN(
|
|
37
|
+
const r = parseFloat(c.min), u = parseFloat(c.max);
|
|
38
|
+
!isNaN(r) && !isNaN(u) && (y = n.preprocess(
|
|
39
39
|
(h) => Number(h),
|
|
40
|
-
|
|
40
|
+
n.number().min(r, l("validations.minValue", { min: r })).max(u, l("validations.maxValue", { max: u })).transform((h) => String(h))
|
|
41
41
|
));
|
|
42
42
|
} else {
|
|
43
|
-
const
|
|
44
|
-
y =
|
|
45
|
-
message: l("validations.oneOf", { values:
|
|
43
|
+
const r = c.rates;
|
|
44
|
+
y = n.string().min(1).refine((u) => r.includes(u), {
|
|
45
|
+
message: l("validations.oneOf", { values: r.join(", ") })
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
s[
|
|
49
|
-
}), Object.keys(s).length > 0 && (d[m] =
|
|
48
|
+
o.metadata?.type === "radio" && (y = n.boolean()), s[g] = y;
|
|
49
|
+
}), Object.keys(s).length > 0 && (d[m] = n.object(s), i[m] = p);
|
|
50
50
|
}), {
|
|
51
|
-
dynamicSchema:
|
|
51
|
+
dynamicSchema: n.object(d),
|
|
52
52
|
defaultValues: i
|
|
53
53
|
};
|
|
54
54
|
}, [f, l]), { control: U, ...T } = K({
|
|
@@ -56,7 +56,7 @@ function Z({ companyId: n, state: S, className: j, children: v }) {
|
|
|
56
56
|
defaultValues: O
|
|
57
57
|
}), _ = async (d) => {
|
|
58
58
|
await C(d, async (i) => {
|
|
59
|
-
const
|
|
59
|
+
const b = f.requirementSets?.filter((e) => e.key && i[e.key]).map((e) => {
|
|
60
60
|
const m = e.key, s = i[m];
|
|
61
61
|
return {
|
|
62
62
|
state: e.state,
|
|
@@ -70,8 +70,8 @@ function Z({ companyId: n, state: S, className: j, children: v }) {
|
|
|
70
70
|
});
|
|
71
71
|
await N({
|
|
72
72
|
request: {
|
|
73
|
-
companyUuid:
|
|
74
|
-
requestBody: { requirementSets:
|
|
73
|
+
companyUuid: a,
|
|
74
|
+
requestBody: { requirementSets: b },
|
|
75
75
|
state: S
|
|
76
76
|
}
|
|
77
77
|
}), F(k.COMPANY_STATE_TAX_UPDATED);
|
|
@@ -79,21 +79,21 @@ function Z({ companyId: n, state: S, className: j, children: v }) {
|
|
|
79
79
|
}, B = () => {
|
|
80
80
|
F(k.CANCEL);
|
|
81
81
|
};
|
|
82
|
-
return /* @__PURE__ */ t("section", { className:
|
|
82
|
+
return /* @__PURE__ */ t("section", { className: q, children: /* @__PURE__ */ t(M, { ...T, control: U, children: /* @__PURE__ */ t(Q, { onSubmit: T.handleSubmit(_), children: /* @__PURE__ */ t(
|
|
83
83
|
Y,
|
|
84
84
|
{
|
|
85
85
|
value: { stateTaxRequirements: f, isPending: R, state: S, handleCancel: B },
|
|
86
86
|
children: /* @__PURE__ */ t(J, { flexDirection: "column", gap: 32, children: v || /* @__PURE__ */ D(H, { children: [
|
|
87
|
-
/* @__PURE__ */ t(q, {}),
|
|
88
87
|
/* @__PURE__ */ t(A, {}),
|
|
89
|
-
/* @__PURE__ */ t(P, {})
|
|
88
|
+
/* @__PURE__ */ t(P, {}),
|
|
89
|
+
/* @__PURE__ */ t(j, {})
|
|
90
90
|
] }) })
|
|
91
91
|
}
|
|
92
92
|
) }) }) });
|
|
93
93
|
}
|
|
94
|
-
x.Head =
|
|
95
|
-
x.Form =
|
|
96
|
-
x.Actions =
|
|
94
|
+
x.Head = A;
|
|
95
|
+
x.Form = P;
|
|
96
|
+
x.Actions = j;
|
|
97
97
|
export {
|
|
98
98
|
x as StateTaxesForm
|
|
99
99
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateTaxesForm.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTaxRequirementsUpdateStateMutation } from '@gusto/embedded-api/react-query/taxRequirementsUpdateState'\nimport { useTaxRequirementsGetSuspense } from '@gusto/embedded-api/react-query/taxRequirementsGet'\nimport { z } from 'zod'\nimport { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Head } from './Head'\nimport { StateTaxesFormProvider } from './context'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { componentEvents } from '@/shared/constants'\nimport { useBase } from '@/components/Base'\n\ninterface StateTaxesFormProps extends CommonComponentInterface {\n companyId: string\n state: string\n}\n\nexport function StateTaxesForm(props: StateTaxesFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, state, className, children }: StateTaxesFormProps) {\n useI18n('Company.StateTaxes')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { data } = useTaxRequirementsGetSuspense({ companyUuid: companyId, state })\n const stateTaxRequirements = data.taxRequirementsState!\n\n const { mutateAsync: updateStateTax, isPending: isPendingUpdate } =\n useTaxRequirementsUpdateStateMutation()\n\n // Schema and default value generation\n const { dynamicSchema, defaultValues } = useMemo(() => {\n const schemaShape: Record<string, z.ZodObject<Record<string, z.ZodTypeAny>>> = {}\n const values: Partial<Record<string, Record<string, string>>> = {}\n\n //Looping through each requirement set\n stateTaxRequirements.requirementSets?.forEach(requirementSet => {\n if (!requirementSet.key) return\n\n const requirementSetKey = requirementSet.key\n const requirementShape: Record<string, z.ZodTypeAny> = {}\n const requirementValues: Record<string, string> = {}\n\n requirementSet.requirements?.forEach(requirement => {\n if (!requirement.key) return\n\n const requirementKey = requirement.key\n\n // --- Default Value Logic ---\n requirementValues[requirementKey] = String(requirement.value ?? '')\n\n // --- Schema Logic ---\n // Start with a basic string schema\n let fieldSchema: z.ZodTypeAny = z.string().min(1)\n\n const validation = requirement.metadata?.validation\n // Not all requirements have validation\n if (validation) {\n if (requirement.metadata?.type === 'tax_rate') {\n if (validation.type === 'min_max') {\n const min = parseFloat(validation.min as string)\n const max = parseFloat(validation.max as string)\n\n if (!isNaN(min) && !isNaN(max)) {\n fieldSchema = z.preprocess(\n val => Number(val),\n z\n .number()\n .min(min, t('validations.minValue', { min }))\n .max(max, t('validations.maxValue', { max }))\n .transform(num => String(num)),\n )\n }\n } else {\n //Type is one_of\n const oneOfValues = validation.rates as string[]\n fieldSchema = z\n .string()\n .min(1)\n .refine(val => oneOfValues.includes(val), {\n message: t('validations.oneOf', { values: oneOfValues.join(', ') }),\n })\n }\n }\n }\n requirementShape[requirementKey] = fieldSchema\n // --- End Schema Logic ---\n })\n\n if (Object.keys(requirementShape).length > 0) {\n schemaShape[requirementSetKey] = z.object(requirementShape)\n values[requirementSetKey] = requirementValues\n }\n })\n\n const finalSchema = z.object(schemaShape)\n\n // Return both the schema and the default values\n return {\n dynamicSchema: finalSchema,\n defaultValues: values as z.infer<typeof finalSchema>,\n }\n }, [stateTaxRequirements, t])\n\n // Infer the type from the schema\n type InferredFormInputs = z.infer<typeof dynamicSchema>\n\n const { control, ...methods } = useForm<InferredFormInputs>({\n resolver: zodResolver(dynamicSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InferredFormInputs) => {\n await baseSubmitHandler(formData, async payload => {\n const requirementSets = stateTaxRequirements.requirementSets\n ?.filter(rs => rs.key && payload[rs.key])\n .map(requirementSet => {\n const requirementSetKey = requirementSet.key as string\n const payloadSet = payload[requirementSetKey] as Record<string, unknown>\n return {\n state: requirementSet.state,\n key: requirementSetKey,\n effectiveFrom: requirementSet.effectiveFrom,\n requirements: Object.entries(payloadSet).map(([key, value]) => ({\n key,\n value: String(value),\n })),\n }\n })\n await updateStateTax({\n request: {\n companyUuid: companyId,\n requestBody: { requirementSets },\n state,\n },\n })\n onEvent(componentEvents.COMPANY_STATE_TAX_UPDATED)\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods} control={control}>\n <HtmlForm onSubmit={methods.handleSubmit(onSubmit)}>\n <StateTaxesFormProvider\n value={{ stateTaxRequirements, isPending: isPendingUpdate, state, handleCancel }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </StateTaxesFormProvider>\n </HtmlForm>\n </FormProvider>\n </section>\n )\n}\n\nStateTaxesForm.Head = Head\nStateTaxesForm.Form = Form\nStateTaxesForm.Actions = Actions\n"],"names":["StateTaxesForm","props","jsx","BaseComponent","Root","companyId","state","className","children","useI18n","onEvent","baseSubmitHandler","useBase","t","useTranslation","data","useTaxRequirementsGetSuspense","stateTaxRequirements","updateStateTax","isPendingUpdate","useTaxRequirementsUpdateStateMutation","dynamicSchema","defaultValues","useMemo","schemaShape","values","requirementSet","requirementSetKey","requirementShape","requirementValues","requirement","requirementKey","fieldSchema","z","validation","min","max","val","num","oneOfValues","control","methods","useForm","zodResolver","onSubmit","formData","payload","requirementSets","rs","payloadSet","key","value","componentEvents","handleCancel","FormProvider","HtmlForm","StateTaxesFormProvider","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,SAASA,EAAeC,GAAqD;AAEhF,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,OAAAC,GAAO,WAAAC,GAAW,UAAAC,KAAiC;AAC5E,EAAAC,EAAQ,oBAAoB;AAC5B,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GACzC,EAAE,GAAAC,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClE,EAAE,MAAAC,MAASC,EAA8B,EAAE,aAAaX,GAAW,OAAAC,GAAO,GAC1EW,IAAuBF,EAAK,sBAE5B,EAAE,aAAaG,GAAgB,WAAWC,EAAA,IAC9CC,EAAsC,GAGlC,EAAE,eAAAC,GAAe,eAAAC,EAAc,IAAIC,EAAQ,MAAM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AAA,gBAAAL,EAACoD,KAAc,GAAGb,GAAS,SAAAD,GACzB,UAAA,gBAAAtC,EAACqD,GAAS,EAAA,UAAUd,EAAQ,aAAaG,CAAQ,GAC/C,UAAA,gBAAA1C;AAAA,IAACsD;AAAA,IAAA;AAAA,MACC,OAAO,EAAE,sBAAAvC,GAAsB,WAAWE,GAAiB,OAAAb,GAAO,cAAA+C,EAAa;AAAA,MAE/E,UAAA,gBAAAnD,EAACuD,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAAjD,KAIG,gBAAAkD,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAzD,EAAC0D,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,EAAA,CACX,EAEJ,CAAA;AAAA,IAAA;AAAA,EAAA,EAEJ,CAAA,EACF,CAAA,GACF;AAEJ;AAEA9D,EAAe,OAAO4D;AACtB5D,EAAe,OAAO6D;AACtB7D,EAAe,UAAU8D;"}
|
|
1
|
+
{"version":3,"file":"StateTaxesForm.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTaxRequirementsUpdateStateMutation } from '@gusto/embedded-api/react-query/taxRequirementsUpdateState'\nimport { useTaxRequirementsGetSuspense } from '@gusto/embedded-api/react-query/taxRequirementsGet'\nimport { z } from 'zod'\nimport { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Head } from './Head'\nimport { StateTaxesFormProvider } from './context'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { componentEvents } from '@/shared/constants'\nimport { useBase } from '@/components/Base'\n\ninterface StateTaxesFormProps extends CommonComponentInterface {\n companyId: string\n state: string\n}\n\nexport function StateTaxesForm(props: StateTaxesFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, state, className, children }: StateTaxesFormProps) {\n useI18n('Company.StateTaxes')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { data } = useTaxRequirementsGetSuspense({ companyUuid: companyId, state })\n const stateTaxRequirements = data.taxRequirementsState!\n\n const { mutateAsync: updateStateTax, isPending: isPendingUpdate } =\n useTaxRequirementsUpdateStateMutation()\n\n // Schema and default value generation\n const { dynamicSchema, defaultValues } = useMemo(() => {\n const schemaShape: Record<string, z.ZodObject<Record<string, z.ZodTypeAny>>> = {}\n const values: Partial<Record<string, Record<string, string>>> = {}\n\n //Looping through each requirement set\n stateTaxRequirements.requirementSets?.forEach(requirementSet => {\n if (!requirementSet.key) return\n\n const requirementSetKey = requirementSet.key\n const requirementShape: Record<string, z.ZodTypeAny> = {}\n const requirementValues: Record<string, string> = {}\n\n requirementSet.requirements?.forEach(requirement => {\n if (!requirement.key) return\n\n const requirementKey = requirement.key\n\n // --- Default Value Logic ---\n requirementValues[requirementKey] = String(requirement.value ?? '')\n\n // --- Schema Logic ---\n // Start with a basic string schema\n let fieldSchema: z.ZodTypeAny = z.string().min(1)\n\n const validation = requirement.metadata?.validation\n // Not all requirements have validation\n if (validation) {\n if (requirement.metadata?.type === 'tax_rate') {\n if (validation.type === 'min_max') {\n const min = parseFloat(validation.min as string)\n const max = parseFloat(validation.max as string)\n\n if (!isNaN(min) && !isNaN(max)) {\n fieldSchema = z.preprocess(\n val => Number(val),\n z\n .number()\n .min(min, t('validations.minValue', { min }))\n .max(max, t('validations.maxValue', { max }))\n .transform(num => String(num)),\n )\n }\n } else {\n //Type is one_of\n const oneOfValues = validation.rates as string[]\n fieldSchema = z\n .string()\n .min(1)\n .refine(val => oneOfValues.includes(val), {\n message: t('validations.oneOf', { values: oneOfValues.join(', ') }),\n })\n }\n }\n }\n if (requirement.metadata?.type === 'radio') {\n fieldSchema = z.boolean()\n }\n requirementShape[requirementKey] = fieldSchema\n // --- End Schema Logic ---\n })\n\n if (Object.keys(requirementShape).length > 0) {\n schemaShape[requirementSetKey] = z.object(requirementShape)\n values[requirementSetKey] = requirementValues\n }\n })\n\n const finalSchema = z.object(schemaShape)\n\n // Return both the schema and the default values\n return {\n dynamicSchema: finalSchema,\n defaultValues: values as z.infer<typeof finalSchema>,\n }\n }, [stateTaxRequirements, t])\n\n // Infer the type from the schema\n type InferredFormInputs = z.infer<typeof dynamicSchema>\n\n const { control, ...methods } = useForm<InferredFormInputs>({\n resolver: zodResolver(dynamicSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InferredFormInputs) => {\n await baseSubmitHandler(formData, async payload => {\n const requirementSets = stateTaxRequirements.requirementSets\n ?.filter(rs => rs.key && payload[rs.key])\n .map(requirementSet => {\n const requirementSetKey = requirementSet.key as string\n const payloadSet = payload[requirementSetKey] as Record<string, unknown>\n return {\n state: requirementSet.state,\n key: requirementSetKey,\n effectiveFrom: requirementSet.effectiveFrom,\n requirements: Object.entries(payloadSet).map(([key, value]) => ({\n key,\n value: String(value),\n })),\n }\n })\n await updateStateTax({\n request: {\n companyUuid: companyId,\n requestBody: { requirementSets },\n state,\n },\n })\n onEvent(componentEvents.COMPANY_STATE_TAX_UPDATED)\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods} control={control}>\n <HtmlForm onSubmit={methods.handleSubmit(onSubmit)}>\n <StateTaxesFormProvider\n value={{ stateTaxRequirements, isPending: isPendingUpdate, state, handleCancel }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </StateTaxesFormProvider>\n </HtmlForm>\n </FormProvider>\n </section>\n )\n}\n\nStateTaxesForm.Head = Head\nStateTaxesForm.Form = Form\nStateTaxesForm.Actions = Actions\n"],"names":["StateTaxesForm","props","jsx","BaseComponent","Root","companyId","state","className","children","useI18n","onEvent","baseSubmitHandler","useBase","t","useTranslation","data","useTaxRequirementsGetSuspense","stateTaxRequirements","updateStateTax","isPendingUpdate","useTaxRequirementsUpdateStateMutation","dynamicSchema","defaultValues","useMemo","schemaShape","values","requirementSet","requirementSetKey","requirementShape","requirementValues","requirement","requirementKey","fieldSchema","z","validation","min","max","val","num","oneOfValues","control","methods","useForm","zodResolver","onSubmit","formData","payload","requirementSets","rs","payloadSet","key","value","componentEvents","handleCancel","FormProvider","HtmlForm","StateTaxesFormProvider","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,SAASA,EAAeC,GAAqD;AAEhF,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,OAAAC,GAAO,WAAAC,GAAW,UAAAC,KAAiC;AAC5E,EAAAC,EAAQ,oBAAoB;AAC5B,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GACzC,EAAE,GAAAC,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClE,EAAE,MAAAC,MAASC,EAA8B,EAAE,aAAaX,GAAW,OAAAC,GAAO,GAC1EW,IAAuBF,EAAK,sBAE5B,EAAE,aAAaG,GAAgB,WAAWC,EAAA,IAC9CC,EAAsC,GAGlC,EAAE,eAAAC,GAAe,eAAAC,EAAc,IAAIC,EAAQ,MAAM;AACrD,UAAMC,IAAyE,CAAC,GAC1EC,IAA0D,CAAC;AAG5C,WAAAR,E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L,EAACoD,KAAc,GAAGb,GAAS,SAAAD,GACzB,UAAA,gBAAAtC,EAACqD,GAAS,EAAA,UAAUd,EAAQ,aAAaG,CAAQ,GAC/C,UAAA,gBAAA1C;AAAA,IAACsD;AAAA,IAAA;AAAA,MACC,OAAO,EAAE,sBAAAvC,GAAsB,WAAWE,GAAiB,OAAAb,GAAO,cAAA+C,EAAa;AAAA,MAE/E,UAAA,gBAAAnD,EAACuD,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAAjD,KAIG,gBAAAkD,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAzD,EAAC0D,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,EAAA,CACX,EAEJ,CAAA;AAAA,IAAA;AAAA,EAAA,EAEJ,CAAA,EACF,CAAA,GACF;AAEJ;AAEA9D,EAAe,OAAO4D;AACtB5D,EAAe,OAAO6D;AACtB7D,EAAe,UAAU8D;"}
|
|
@@ -6,11 +6,13 @@ import "@gusto/embedded-api/models/errors/apierror";
|
|
|
6
6
|
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
7
7
|
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
8
8
|
import "../../../Base/useBase.js";
|
|
9
|
+
import "../../../../shared/constants.js";
|
|
9
10
|
import "dompurify";
|
|
11
|
+
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
12
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
11
|
-
const [
|
|
13
|
+
const [S, T] = t("StateTaxesFormContext");
|
|
12
14
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
T as StateTaxesFormProvider,
|
|
16
|
+
S as useStateTaxesForm
|
|
15
17
|
};
|
|
16
18
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/context.ts"],"sourcesContent":["import type { TaxRequirementsState } from '@gusto/embedded-api/models/components/taxrequirementsstate'\nimport { createCompoundContext } from '@/components/Base'\n\ninterface StateTaxFormContext {\n isPending: boolean\n state: string\n stateTaxRequirements: TaxRequirementsState\n handleCancel: () => void\n}\n\nconst [useStateTaxesForm, StateTaxesFormProvider] =\n createCompoundContext<StateTaxFormContext>('StateTaxesFormContext')\n\nexport { useStateTaxesForm, StateTaxesFormProvider }\n"],"names":["useStateTaxesForm","StateTaxesFormProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/context.ts"],"sourcesContent":["import type { TaxRequirementsState } from '@gusto/embedded-api/models/components/taxrequirementsstate'\nimport { createCompoundContext } from '@/components/Base'\n\ninterface StateTaxFormContext {\n isPending: boolean\n state: string\n stateTaxRequirements: TaxRequirementsState\n handleCancel: () => void\n}\n\nconst [useStateTaxesForm, StateTaxesFormProvider] =\n createCompoundContext<StateTaxFormContext>('StateTaxesFormContext')\n\nexport { useStateTaxesForm, StateTaxesFormProvider }\n"],"names":["useStateTaxesForm","StateTaxesFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAA2C,uBAAuB;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as i } from "react-i18next";
|
|
3
3
|
import { useStateTaxesList as e } from "./context.js";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import "../../../../shared/constants.js";
|
|
5
|
+
import { ActionsLayout as m } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
6
|
+
import { useComponentContext as s } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
7
|
+
function l() {
|
|
8
|
+
const { t: o } = i("Company.StateTaxes"), n = s(), { handleContinue: r } = e();
|
|
9
|
+
return /* @__PURE__ */ t(m, { children: /* @__PURE__ */ t(n.Button, { variant: "primary", onClick: r, children: o("list.continueCta") }) });
|
|
9
10
|
}
|
|
10
11
|
export {
|
|
11
|
-
|
|
12
|
+
l as Actions
|
|
12
13
|
};
|
|
13
14
|
//# sourceMappingURL=Actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useStateTaxesList } from './context'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Company.StateTaxes')\n const Components = useComponentContext()\n const { handleContinue } = useStateTaxesList()\n return (\n <ActionsLayout>\n <Components.Button variant=\"primary\" onClick={handleContinue}>\n {t('list.continueCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","t","useTranslation","Components","useComponentContext","handleContinue","useStateTaxesList","jsx","ActionsLayout"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Actions.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useStateTaxesList } from './context'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Company.StateTaxes')\n const Components = useComponentContext()\n const { handleContinue } = useStateTaxesList()\n return (\n <ActionsLayout>\n <Components.Button variant=\"primary\" onClick={handleContinue}>\n {t('list.continueCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","t","useTranslation","Components","useComponentContext","handleContinue","useStateTaxesList","jsx","ActionsLayout"],"mappings":";;;;;;AAKO,SAASA,IAAU;AACxB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,oBAAoB,GAC3CC,IAAaC,EAAoB,GACjC,EAAE,gBAAAC,EAAe,IAAIC,EAAkB;AAC7C,SACG,gBAAAC,EAAAC,GAAA,EACC,UAAC,gBAAAD,EAAAJ,EAAW,QAAX,EAAkB,SAAQ,WAAU,SAASE,GAC3C,UAAEJ,EAAA,kBAAkB,EACvB,CAAA,GACF;AAEJ;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
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 "../../../../shared/constants.js";
|
|
4
5
|
import { EmptyData as c } from "../../../Common/EmptyData/EmptyData.js";
|
|
5
6
|
import { useComponentContext as u } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
6
7
|
import { useDataView as d } from "../../../Common/DataView/useDataView.js";
|
|
7
8
|
import { DataView as C } from "../../../Common/DataView/DataView.js";
|
|
8
|
-
const
|
|
9
|
-
const { stateTaxRequirements:
|
|
10
|
-
data:
|
|
9
|
+
const k = () => {
|
|
10
|
+
const { stateTaxRequirements: r, handleChange: n } = l(), a = u(), { t } = o("Company.StateTaxes", { keyPrefix: "list" }), { t: i } = o("common", { keyPrefix: "statesHash" }), { ...m } = d({
|
|
11
|
+
data: r,
|
|
11
12
|
columns: [
|
|
12
13
|
{
|
|
13
14
|
key: "state",
|
|
@@ -25,7 +26,7 @@ const S = () => {
|
|
|
25
26
|
{
|
|
26
27
|
variant: "secondary",
|
|
27
28
|
onClick: () => {
|
|
28
|
-
|
|
29
|
+
n(e.state);
|
|
29
30
|
},
|
|
30
31
|
children: e.setupComplete ? t("editStateTaxCta") : t("continueStateTaxSetupCta")
|
|
31
32
|
}
|
|
@@ -35,6 +36,6 @@ const S = () => {
|
|
|
35
36
|
return /* @__PURE__ */ s(C, { label: t("requirementsListLabel"), ...m });
|
|
36
37
|
};
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
+
k as List
|
|
39
40
|
};
|
|
40
41
|
//# 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;"}
|
|
@@ -6,11 +6,13 @@ import "@gusto/embedded-api/models/errors/apierror";
|
|
|
6
6
|
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
7
7
|
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
8
8
|
import "../../../Base/useBase.js";
|
|
9
|
+
import "../../../../shared/constants.js";
|
|
9
10
|
import "dompurify";
|
|
11
|
+
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
12
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
11
|
-
const [
|
|
13
|
+
const [S, T] = t("StateTaxesListContext");
|
|
12
14
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
T as StateTaxesListProvider,
|
|
16
|
+
S as useStateTaxesList
|
|
15
17
|
};
|
|
16
18
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/context.ts"],"sourcesContent":["import type { ResponseBody } from '@gusto/embedded-api/models/operations/getv1companiescompanyuuidtaxrequirements'\nimport { createCompoundContext } from '@/components/Base'\n\ntype StateTaxesListContextType = {\n isPending: boolean\n stateTaxRequirements: ResponseBody[]\n handleContinue: () => void\n handleChange: (state: string) => void\n}\n\nconst [useStateTaxesList, StateTaxesListProvider] =\n createCompoundContext<StateTaxesListContextType>('StateTaxesListContext')\n\nexport { useStateTaxesList, StateTaxesListProvider }\n"],"names":["useStateTaxesList","StateTaxesListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/context.ts"],"sourcesContent":["import type { ResponseBody } from '@gusto/embedded-api/models/operations/getv1companiescompanyuuidtaxrequirements'\nimport { createCompoundContext } from '@/components/Base'\n\ntype StateTaxesListContextType = {\n isPending: boolean\n stateTaxRequirements: ResponseBody[]\n handleContinue: () => void\n handleChange: (state: string) => void\n}\n\nconst [useStateTaxesList, StateTaxesListProvider] =\n createCompoundContext<StateTaxesListContextType>('StateTaxesListContext')\n\nexport { useStateTaxesList, StateTaxesListProvider }\n"],"names":["useStateTaxesList","StateTaxesListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAAiD,uBAAuB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Actions(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as s } from "react-i18next";
|
|
3
|
+
import { useAddress as i } from "./useAddress.js";
|
|
4
|
+
import { ActionsLayout as e } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
5
|
+
import { useComponentContext as m } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
6
|
+
function a() {
|
|
7
|
+
const { t } = s("Contractor.Address"), n = m(), { isPending: r } = i();
|
|
8
|
+
return /* @__PURE__ */ o(e, { children: /* @__PURE__ */ o(n.Button, { type: "submit", isLoading: r, children: t("submit") }) });
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
a as Actions
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=Actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Actions.js","sources":["../../../../src/components/Contractor/Address/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useAddress } from './useAddress'\nimport { ActionsLayout } from '@/components/Common/ActionsLayout/ActionsLayout'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Contractor.Address')\n const Components = useComponentContext()\n const { isPending } = useAddress()\n\n return (\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('submit')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","Components","useComponentContext","isPending","useAddress","jsx","ActionsLayout"],"mappings":";;;;;AAKO,SAASA,IAAU;AACxB,QAAM,EAAE,EAAA,IAAMC,EAAe,oBAAoB,GAC3CC,IAAaC,EAAoB,GACjC,EAAE,WAAAC,EAAU,IAAIC,EAAW;AAEjC,SACG,gBAAAC,EAAAC,GAAA,EACC,UAAC,gBAAAD,EAAAJ,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWE,GACzC,UAAE,EAAA,QAAQ,EACb,CAAA,GACF;AAEJ;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AddressDefaultValues } from './useAddress';
|
|
3
|
+
import { BaseComponentInterface } from '../../Base/Base';
|
|
4
|
+
export interface AddressProps extends BaseComponentInterface<'Contractor.Address'> {
|
|
5
|
+
contractorId: string;
|
|
6
|
+
defaultValues?: AddressDefaultValues;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function Address(props: AddressProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare namespace Address {
|
|
12
|
+
var Head: typeof import("./Head").Head;
|
|
13
|
+
var Form: typeof import("./Form").Form;
|
|
14
|
+
var Actions: typeof import("./Actions").Actions;
|
|
15
|
+
}
|
|
16
|
+
export default Address;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as t, jsxs as P, Fragment as T } from "react/jsx-runtime";
|
|
2
|
+
import { useContractorsGetSuspense as U } from "@gusto/embedded-api/react-query/contractorsGet";
|
|
3
|
+
import { useContractorsGetAddressSuspense as b, invalidateContractorsGetAddress as x } from "@gusto/embedded-api/react-query/contractorsGetAddress";
|
|
4
|
+
import { useContractorsUpdateAddressMutation as O } from "@gusto/embedded-api/react-query/contractorsUpdateAddress";
|
|
5
|
+
import { useQueryClient as _ } from "@tanstack/react-query";
|
|
6
|
+
import { useForm as q, FormProvider as w } from "react-hook-form";
|
|
7
|
+
import { zodResolver as B } from "@hookform/resolvers/zod";
|
|
8
|
+
import { AddressFormSchema as G, AddressProvider as H } from "./useAddress.js";
|
|
9
|
+
import { Head as u } from "./Head.js";
|
|
10
|
+
import { Form as p } from "./Form.js";
|
|
11
|
+
import { Actions as f } from "./Actions.js";
|
|
12
|
+
import { Form as N } from "../../Common/Form/Form.js";
|
|
13
|
+
import { useComponentDictionary as j, useI18n as M } from "../../../i18n/I18n.js";
|
|
14
|
+
import { Flex as Q } from "../../Common/Flex/Flex.js";
|
|
15
|
+
import { BaseComponent as $ } from "../../Base/Base.js";
|
|
16
|
+
import { useBase as k } from "../../Base/useBase.js";
|
|
17
|
+
import { contractorEvents as a } from "../../../shared/constants.js";
|
|
18
|
+
function n(r) {
|
|
19
|
+
return /* @__PURE__ */ t($, { ...r, children: /* @__PURE__ */ t(J, { ...r, children: r.children }) });
|
|
20
|
+
}
|
|
21
|
+
function J({ contractorId: r, defaultValues: o, children: i, className: A, dictionary: C }) {
|
|
22
|
+
j("Contractor.Address", C), M("Contractor.Address");
|
|
23
|
+
const l = _(), { onEvent: c, baseSubmitHandler: D } = k(), { data: m } = U({ contractorUuid: r }), { data: h } = b({ contractorUuid: r }), { mutateAsync: S, isPending: v } = O(), y = m.contractor, F = m.contractor?.type, e = h.contractorAddress, R = {
|
|
24
|
+
street1: e?.street1 || o?.street1 || "",
|
|
25
|
+
street2: e?.street2 || o?.street2 || "",
|
|
26
|
+
city: e?.city || o?.city || "",
|
|
27
|
+
state: e?.state || o?.state || "",
|
|
28
|
+
zip: e?.zip || o?.zip || ""
|
|
29
|
+
}, d = q({
|
|
30
|
+
resolver: B(G),
|
|
31
|
+
defaultValues: R
|
|
32
|
+
}), g = async (z) => {
|
|
33
|
+
await D(z, async (s) => {
|
|
34
|
+
const { contractorAddress: E } = await S({
|
|
35
|
+
request: {
|
|
36
|
+
contractorUuid: r,
|
|
37
|
+
requestBody: {
|
|
38
|
+
version: e?.version,
|
|
39
|
+
street1: s.street1,
|
|
40
|
+
street2: s.street2,
|
|
41
|
+
city: s.city,
|
|
42
|
+
state: s.state,
|
|
43
|
+
zip: s.zip
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
await x(l, [r]), c(a.CONTRACTOR_ADDRESS_UPDATED, E), c(a.CONTRACTOR_ADDRESS_DONE);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
return /* @__PURE__ */ t("section", { className: A, children: /* @__PURE__ */ t(
|
|
51
|
+
H,
|
|
52
|
+
{
|
|
53
|
+
value: {
|
|
54
|
+
contractor: y,
|
|
55
|
+
contractorType: F,
|
|
56
|
+
address: e,
|
|
57
|
+
isPending: v
|
|
58
|
+
},
|
|
59
|
+
children: /* @__PURE__ */ t(w, { ...d, children: /* @__PURE__ */ t(N, { onSubmit: d.handleSubmit(g), children: /* @__PURE__ */ t(Q, { flexDirection: "column", gap: 32, children: i || /* @__PURE__ */ P(T, { children: [
|
|
60
|
+
/* @__PURE__ */ t(u, {}),
|
|
61
|
+
/* @__PURE__ */ t(p, {}),
|
|
62
|
+
/* @__PURE__ */ t(f, {})
|
|
63
|
+
] }) }) }) })
|
|
64
|
+
}
|
|
65
|
+
) });
|
|
66
|
+
}
|
|
67
|
+
n.Head = u;
|
|
68
|
+
n.Form = p;
|
|
69
|
+
n.Actions = f;
|
|
70
|
+
export {
|
|
71
|
+
n as Address,
|
|
72
|
+
n as default
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=Address.js.map
|
|
@@ -0,0 +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 {\n useContractorsGetAddressSuspense,\n invalidateContractorsGetAddress,\n} from '@gusto/embedded-api/react-query/contractorsGetAddress'\nimport { useContractorsUpdateAddressMutation } from '@gusto/embedded-api/react-query/contractorsUpdateAddress'\nimport { useQueryClient } from '@tanstack/react-query'\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 const queryClient = useQueryClient()\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 await invalidateContractorsGetAddress(queryClient, [contractorId])\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\nAddress.Head = Head\nAddress.Form = Form\nAddress.Actions = Actions\n\nexport default Address\n"],"names":["Address","props","jsx","BaseComponent","Root","contractorId","defaultValues","children","className","dictionary","useComponentDictionary","useI18n","queryClient","useQueryClient","onEvent","baseSubmitHandler","useBase","contractorData","useContractorsGetSuspense","addressData","useContractorsGetAddressSuspense","updateAddress","isUpdatingAddressPending","useContractorsUpdateAddressMutation","contractor","contractorType","address","formDefaultValues","formMethods","useForm","zodResolver","AddressFormSchema","onSubmit","data","payload","contractorAddress","invalidateContractorsGetAddress","contractorEvents","AddressProvider","FormProvider","HtmlForm","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;;AA8BO,SAASA,EAAQC,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;AAC5B,QAAMC,IAAcC,EAAe,GAE7B,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GAEzC,EAAE,MAAMC,EAAe,IAAIC,EAA0B,EAAE,gBAAgBb,GAAc,GACrF,EAAE,MAAMc,EAAY,IAAIC,EAAiC,EAAE,gBAAgBf,GAAc,GAEzF,EAAE,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BAAA1B,EAAAsC,GAAA,EAAS,UAAUZ,EAAY,aAAaI,CAAQ,GACnD,UAAA,gBAAA9B,EAACuC,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAAlC,KAIG,gBAAAmC,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAzC,EAAC0C,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;AAEA9C,EAAQ,OAAO4C;AACf5C,EAAQ,OAAO6C;AACf7C,EAAQ,UAAU8C;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Form(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as i } from "react-i18next";
|
|
3
|
+
import { STATES_ABBR as o } from "../../../shared/constants.js";
|
|
4
|
+
import { Grid as l } from "../../Common/Grid/Grid.js";
|
|
5
|
+
import { TextInputField as t } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
6
|
+
import { SelectField as m } from "../../Common/Fields/SelectField/SelectField.js";
|
|
7
|
+
function g() {
|
|
8
|
+
const { t: e } = i("Contractor.Address");
|
|
9
|
+
return /* @__PURE__ */ s(l, { gridTemplateColumns: { base: "1fr", small: ["1fr", "1fr"] }, gap: 20, children: [
|
|
10
|
+
/* @__PURE__ */ r(
|
|
11
|
+
t,
|
|
12
|
+
{
|
|
13
|
+
name: "street1",
|
|
14
|
+
label: e("street1"),
|
|
15
|
+
isRequired: !0,
|
|
16
|
+
errorMessage: e("validations.street1")
|
|
17
|
+
}
|
|
18
|
+
),
|
|
19
|
+
/* @__PURE__ */ r(t, { name: "street2", label: e("street2", "Street 2") }),
|
|
20
|
+
/* @__PURE__ */ r(
|
|
21
|
+
t,
|
|
22
|
+
{
|
|
23
|
+
name: "city",
|
|
24
|
+
label: e("city", "City"),
|
|
25
|
+
isRequired: !0,
|
|
26
|
+
errorMessage: e("validations.city")
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ r(
|
|
30
|
+
m,
|
|
31
|
+
{
|
|
32
|
+
name: "state",
|
|
33
|
+
options: o.map((a) => ({
|
|
34
|
+
label: e(`statesHash.${a}`, { ns: "common", defaultValue: a }),
|
|
35
|
+
value: a
|
|
36
|
+
})),
|
|
37
|
+
label: e("state", "State"),
|
|
38
|
+
placeholder: e("statePlaceholder"),
|
|
39
|
+
errorMessage: e("validations.state"),
|
|
40
|
+
isRequired: !0
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ r(
|
|
44
|
+
t,
|
|
45
|
+
{
|
|
46
|
+
name: "zip",
|
|
47
|
+
label: e("zip", "Zip"),
|
|
48
|
+
isRequired: !0,
|
|
49
|
+
errorMessage: e("validations.zip")
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
g as Form
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=Form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.js","sources":["../../../../src/components/Contractor/Address/Form.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { TextInputField, SelectField, Grid } from '@/components/Common'\nimport { STATES_ABBR } from '@/shared/constants'\n\nexport function Form() {\n const { t } = useTranslation('Contractor.Address')\n\n return (\n <Grid gridTemplateColumns={{ base: '1fr', small: ['1fr', '1fr'] }} gap={20}>\n <TextInputField\n name=\"street1\"\n label={t('street1')}\n isRequired\n errorMessage={t('validations.street1')}\n />\n <TextInputField name=\"street2\" label={t('street2', 'Street 2')} />\n <TextInputField\n name=\"city\"\n label={t('city', 'City')}\n isRequired\n errorMessage={t('validations.city')}\n />\n <SelectField\n name=\"state\"\n options={STATES_ABBR.map(stateAbbr => ({\n label: t(`statesHash.${stateAbbr}`, { ns: 'common', defaultValue: stateAbbr }),\n value: stateAbbr,\n }))}\n label={t('state', 'State')}\n placeholder={t('statePlaceholder')}\n errorMessage={t('validations.state')}\n isRequired\n />\n <TextInputField\n name=\"zip\"\n label={t('zip', 'Zip')}\n isRequired\n errorMessage={t('validations.zip')}\n />\n </Grid>\n )\n}\n"],"names":["Form","t","useTranslation","jsxs","Grid","jsx","TextInputField","SelectField","STATES_ABBR","stateAbbr"],"mappings":";;;;;;AAIO,SAASA,IAAO;AACrB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,oBAAoB;AAEjD,SACG,gBAAAC,EAAAC,GAAA,EAAK,qBAAqB,EAAE,MAAM,OAAO,OAAO,CAAC,OAAO,KAAK,EAAE,GAAG,KAAK,IACtE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOL,EAAE,SAAS;AAAA,QAClB,YAAU;AAAA,QACV,cAAcA,EAAE,qBAAqB;AAAA,MAAA;AAAA,IACvC;AAAA,IACA,gBAAAI,EAACC,KAAe,MAAK,WAAU,OAAOL,EAAE,WAAW,UAAU,GAAG;AAAA,IAChE,gBAAAI;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOL,EAAE,QAAQ,MAAM;AAAA,QACvB,YAAU;AAAA,QACV,cAAcA,EAAE,kBAAkB;AAAA,MAAA;AAAA,IACpC;AAAA,IACA,gBAAAI;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,SAASC,EAAY,IAAI,CAAcC,OAAA;AAAA,UACrC,OAAOR,EAAE,cAAcQ,CAAS,IAAI,EAAE,IAAI,UAAU,cAAcA,GAAW;AAAA,UAC7E,OAAOA;AAAA,QAAA,EACP;AAAA,QACF,OAAOR,EAAE,SAAS,OAAO;AAAA,QACzB,aAAaA,EAAE,kBAAkB;AAAA,QACjC,cAAcA,EAAE,mBAAmB;AAAA,QACnC,YAAU;AAAA,MAAA;AAAA,IACZ;AAAA,IACA,gBAAAI;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOL,EAAE,OAAO,KAAK;AAAA,QACrB,YAAU;AAAA,QACV,cAAcA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,EACnC,GACF;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Head(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsxs as n, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as t } from "react-i18next";
|
|
3
|
+
import { useAddress as i } from "./useAddress.js";
|
|
4
|
+
import { useComponentContext as d } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
5
|
+
function a() {
|
|
6
|
+
const { t: s } = t("Contractor.Address"), { contractorType: e } = i(), r = d();
|
|
7
|
+
return /* @__PURE__ */ n("header", { children: [
|
|
8
|
+
/* @__PURE__ */ o(r.Heading, { as: "h2", children: s(e === "Business" ? "businessAddressTitle" : "homeAddressTitle") }),
|
|
9
|
+
/* @__PURE__ */ o(r.Text, { children: s(e === "Business" ? "businessAddressDescription" : "homeAddressDescription") })
|
|
10
|
+
] });
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
a as Head
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=Head.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Head.js","sources":["../../../../src/components/Contractor/Address/Head.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useAddress } from './useAddress'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Head() {\n const { t } = useTranslation('Contractor.Address')\n const { contractorType } = useAddress()\n const Components = useComponentContext()\n\n return (\n <header>\n <Components.Heading as=\"h2\">\n {contractorType === 'Business' ? t('businessAddressTitle') : t('homeAddressTitle')}\n </Components.Heading>\n <Components.Text>\n {contractorType === 'Business'\n ? t('businessAddressDescription')\n : t('homeAddressDescription')}\n </Components.Text>\n </header>\n )\n}\n"],"names":["Head","t","useTranslation","contractorType","useAddress","Components","useComponentContext","jsx"],"mappings":";;;;AAIO,SAASA,IAAO;AACrB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,oBAAoB,GAC3C,EAAE,gBAAAC,EAAe,IAAIC,EAAW,GAChCC,IAAaC,EAAoB;AAEvC,2BACG,UACC,EAAA,UAAA;AAAA,IAAA,gBAAAC,EAACF,EAAW,SAAX,EAAmB,IAAG,MACpB,UAAgCJ,EAAhCE,MAAmB,aAAe,yBAA4B,kBAAN,EAC3D,CAAA;AAAA,IACA,gBAAAI,EAACF,EAAW,MAAX,EACE,UACGJ,EADHE,MAAmB,aACd,+BACA,wBAD4B,EAEpC,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Contractor, ContractorType } from '@gusto/embedded-api/models/components/contractor';
|
|
2
|
+
import { ContractorAddress } from '@gusto/embedded-api/models/components/contractoraddress';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { RequireAtLeastOne } from '../../../types/Helpers';
|
|
5
|
+
export interface AddressContextType {
|
|
6
|
+
contractor?: Contractor;
|
|
7
|
+
contractorType?: ContractorType;
|
|
8
|
+
address?: ContractorAddress;
|
|
9
|
+
isPending: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type AddressDefaultValues = RequireAtLeastOne<Pick<ContractorAddress, 'street1' | 'street2' | 'city' | 'state' | 'zip'>>;
|
|
12
|
+
export declare const AddressFormSchema: z.ZodObject<{
|
|
13
|
+
street1: z.ZodString;
|
|
14
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
15
|
+
city: z.ZodString;
|
|
16
|
+
state: z.ZodString;
|
|
17
|
+
zip: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
street1: string;
|
|
20
|
+
city: string;
|
|
21
|
+
state: string;
|
|
22
|
+
zip: string;
|
|
23
|
+
street2?: string | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
street1: string;
|
|
26
|
+
city: string;
|
|
27
|
+
state: string;
|
|
28
|
+
zip: string;
|
|
29
|
+
street2?: string | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
export type AddressFormValues = z.infer<typeof AddressFormSchema>;
|
|
32
|
+
declare const useAddress: () => AddressContextType, AddressProvider: import('react').Provider<AddressContextType | null>;
|
|
33
|
+
export { useAddress, AddressProvider };
|