@gusto/embedded-react-sdk 0.10.1 → 0.10.3
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 +21 -0
- package/dist/components/Base/Base.d.ts +3 -2
- package/dist/components/Base/Base.js +56 -50
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Common/InternalError/InternalError.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBox.js +31 -33
- package/dist/components/Common/UI/ComboBox/ComboBox.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +1 -1
- package/dist/components/Common/UI/Text/TextTypes.d.ts +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccount.d.ts +2 -2
- package/dist/components/Company/BankAccount/BankAccount.js +25 -20
- package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountComponents.js +16 -9
- package/dist/components/Company/BankAccount/BankAccountComponents.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +22 -8
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.d.ts +1 -0
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +30 -30
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.d.ts +4 -0
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/AccountView.js +14 -13
- package/dist/components/Company/BankAccount/BankAccountList/AccountView.js.map +1 -1
- package/dist/components/Company/BankAccount/stateMachine.d.ts +1 -1
- package/dist/components/Company/BankAccount/stateMachine.js +13 -5
- package/dist/components/Company/BankAccount/stateMachine.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentSigner.d.ts +5 -7
- package/dist/components/Company/DocumentSigner/DocumentSigner.js +24 -24
- package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +41 -42
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +7 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Industry.js +30 -31
- package/dist/components/Company/Industry/Industry.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +34 -37
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +4 -1
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +4 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +70 -71
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +37 -38
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +6 -5
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +57 -58
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/Compensation/Compensation.js +123 -132
- package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
- package/dist/components/Employee/Deductions/Deductions.js +74 -79
- package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
- package/dist/components/Employee/Deductions/useDeductions.js +6 -5
- package/dist/components/Employee/Deductions/useDeductions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +36 -42
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +57 -58
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +95 -97
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +118 -124
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +4 -3
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +4 -4
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +59 -60
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +4 -3
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +16 -14
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +5 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +2 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +19 -17
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.d.ts +7 -0
- package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.js +10 -0
- package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.js.map +1 -0
- package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.d.ts +6 -0
- package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js +11 -0
- package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js.map +1 -0
- package/dist/shared/constants.d.ts +2 -0
- package/dist/shared/constants.js +10 -9
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -1
|
@@ -5,7 +5,7 @@ import { useComponentContext as u } from "../../../contexts/ComponentAdapter/use
|
|
|
5
5
|
import { SelectField as d } from "../../Common/Fields/SelectField/SelectField.js";
|
|
6
6
|
import { RadioGroupField as f } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
7
7
|
import { NumberInputField as i } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
8
|
-
const
|
|
8
|
+
const F = t.object({
|
|
9
9
|
filingStatus: t.string().min(1),
|
|
10
10
|
twoJobs: t.string().min(1),
|
|
11
11
|
dependentsAmount: t.number().transform(String),
|
|
@@ -39,7 +39,7 @@ function R() {
|
|
|
39
39
|
name: "twoJobs",
|
|
40
40
|
label: e("multipleJobs2c"),
|
|
41
41
|
errorMessage: e("validations.federalTwoJobs"),
|
|
42
|
-
description: /* @__PURE__ */ r(
|
|
42
|
+
description: /* @__PURE__ */ r(o.Text, { children: /* @__PURE__ */ r(
|
|
43
43
|
m,
|
|
44
44
|
{
|
|
45
45
|
i18nKey: "includesSpouseExplanation",
|
|
@@ -48,7 +48,7 @@ function R() {
|
|
|
48
48
|
irs_link: /* @__PURE__ */ r(o.Link, {})
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
),
|
|
51
|
+
) }),
|
|
52
52
|
options: [
|
|
53
53
|
{ value: "true", label: e("twoJobYesLabel") },
|
|
54
54
|
{ value: "false", label: e("twoJobNoLabel") }
|
|
@@ -101,6 +101,6 @@ function R() {
|
|
|
101
101
|
}
|
|
102
102
|
export {
|
|
103
103
|
R as FederalForm,
|
|
104
|
-
|
|
104
|
+
F as FederalFormSchema
|
|
105
105
|
};
|
|
106
106
|
//# sourceMappingURL=FederalForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FederalForm.js","sources":["../../../../src/components/Employee/Taxes/FederalForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { NumberInputField, RadioGroupField, SelectField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const FederalFormSchema = z.object({\n filingStatus: z.string().min(1),\n twoJobs: z.string().min(1),\n dependentsAmount: z.number().transform(String),\n otherIncome: z.number().transform(String),\n deductions: z.number().transform(String),\n extraWithholding: z.number().transform(String),\n w4DataType: z.enum(['pre_2020_w4', 'rev_2020_w4']),\n})\n\nexport type FederalFormInputs = z.input<typeof FederalFormSchema>\nexport type FederalFormPayload = z.output<typeof FederalFormSchema>\n\nexport function FederalForm() {\n const { t } = useTranslation('Employee.Taxes')\n const Components = useComponentContext()\n\n const filingStatusCategories = [\n { value: 'Single', label: t('filingStatusSingle') },\n { value: 'Married', label: t('filingStatusMarried') },\n { value: 'Head of Household', label: t('filingStatusHeadOfHousehold') },\n { value: 'Exempt from withholding', label: t('filingStatusExemptFromWithholding') },\n ]\n\n return (\n <>\n <SelectField\n name=\"filingStatus\"\n label={t('federalFilingStatus1c')}\n placeholder={t('federalFillingStatusPlaceholder')}\n options={filingStatusCategories}\n isRequired\n errorMessage={t('validations.federalFilingStatus')}\n />\n <RadioGroupField\n name=\"twoJobs\"\n label={t('multipleJobs2c')}\n errorMessage={t('validations.federalTwoJobs')}\n description={\n <Trans\n
|
|
1
|
+
{"version":3,"file":"FederalForm.js","sources":["../../../../src/components/Employee/Taxes/FederalForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { NumberInputField, RadioGroupField, SelectField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const FederalFormSchema = z.object({\n filingStatus: z.string().min(1),\n twoJobs: z.string().min(1),\n dependentsAmount: z.number().transform(String),\n otherIncome: z.number().transform(String),\n deductions: z.number().transform(String),\n extraWithholding: z.number().transform(String),\n w4DataType: z.enum(['pre_2020_w4', 'rev_2020_w4']),\n})\n\nexport type FederalFormInputs = z.input<typeof FederalFormSchema>\nexport type FederalFormPayload = z.output<typeof FederalFormSchema>\n\nexport function FederalForm() {\n const { t } = useTranslation('Employee.Taxes')\n const Components = useComponentContext()\n\n const filingStatusCategories = [\n { value: 'Single', label: t('filingStatusSingle') },\n { value: 'Married', label: t('filingStatusMarried') },\n { value: 'Head of Household', label: t('filingStatusHeadOfHousehold') },\n { value: 'Exempt from withholding', label: t('filingStatusExemptFromWithholding') },\n ]\n\n return (\n <>\n <SelectField\n name=\"filingStatus\"\n label={t('federalFilingStatus1c')}\n placeholder={t('federalFillingStatusPlaceholder')}\n options={filingStatusCategories}\n isRequired\n errorMessage={t('validations.federalFilingStatus')}\n />\n <RadioGroupField\n name=\"twoJobs\"\n label={t('multipleJobs2c')}\n errorMessage={t('validations.federalTwoJobs')}\n description={\n <Components.Text>\n <Trans\n i18nKey={'includesSpouseExplanation'}\n t={t}\n components={{\n irs_link: <Components.Link />,\n }}\n />\n </Components.Text>\n }\n options={[\n { value: 'true', label: t('twoJobYesLabel') },\n { value: 'false', label: t('twoJobNoLabel') },\n ]}\n />\n <NumberInputField\n name=\"dependentsAmount\"\n isRequired\n label={t('dependentsTotalIfApplicable')}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"otherIncome\"\n isRequired\n label={t('otherIncome')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"deductions\"\n isRequired\n label={t('deductions')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"extraWithholding\"\n isRequired\n label={t('extraWithholding')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n </>\n )\n}\n"],"names":["FederalFormSchema","z","FederalForm","t","useTranslation","Components","useComponentContext","filingStatusCategories","jsxs","Fragment","jsx","SelectField","RadioGroupField","Tr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
import { useForm as
|
|
2
|
+
import { zodResolver as q } from "@hookform/resolvers/zod";
|
|
3
|
+
import { useForm as B, FormProvider as V } from "react-hook-form";
|
|
4
4
|
import { useTranslation as W } from "react-i18next";
|
|
5
5
|
import { useEffect as Y } from "react";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { FederalFormSchema as ee, FederalForm as P } from "./FederalForm.js";
|
|
6
|
+
import { useEmployeeTaxSetupGetFederalTaxesSuspense as j } from "@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes";
|
|
7
|
+
import { useEmployeeTaxSetupUpdateFederalTaxesMutation as G } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes";
|
|
8
|
+
import { useEmployeeTaxSetupGetStateTaxesSuspense as z } from "@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes";
|
|
9
|
+
import { useEmployeeTaxSetupUpdateStateTaxesMutation as Q } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes";
|
|
10
|
+
import { Actions as w } from "./Actions.js";
|
|
11
|
+
import { FederalFormSchema as K, FederalForm as P } from "./FederalForm.js";
|
|
13
12
|
import { FederalHead as b } from "./FederalHead.js";
|
|
14
|
-
import { StateFormSchema as
|
|
15
|
-
import { TaxesProvider as
|
|
16
|
-
import { BaseComponent as
|
|
17
|
-
import { useBase as
|
|
18
|
-
import { useFlow as
|
|
19
|
-
import { useI18n as
|
|
13
|
+
import { StateFormSchema as Z, StateForm as _ } from "./StateForm.js";
|
|
14
|
+
import { TaxesProvider as $ } from "./useTaxes.js";
|
|
15
|
+
import { BaseComponent as ee } from "../../Base/Base.js";
|
|
16
|
+
import { useBase as te } from "../../Base/useBase.js";
|
|
17
|
+
import { useFlow as oe } from "../../Flow/useFlow.js";
|
|
18
|
+
import { useI18n as se, useComponentDictionary as re } from "../../../i18n/I18n.js";
|
|
20
19
|
import { componentEvents as S } from "../../../shared/constants.js";
|
|
21
|
-
import { snakeCaseToCamelCase as
|
|
22
|
-
import { Form as
|
|
23
|
-
const
|
|
20
|
+
import { snakeCaseToCamelCase as g } from "../../../helpers/formattedStrings.js";
|
|
21
|
+
import { Form as ae } from "../../Common/Form/Form.js";
|
|
22
|
+
const ne = "2010-01-01";
|
|
24
23
|
function u(o) {
|
|
25
|
-
return /* @__PURE__ */ t(
|
|
24
|
+
return /* @__PURE__ */ t(ee, { ...o, children: /* @__PURE__ */ t(me, { ...o, children: o.children }) });
|
|
26
25
|
}
|
|
27
|
-
const
|
|
28
|
-
const { employeeId:
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
employeeUuid:
|
|
32
|
-
}), e =
|
|
33
|
-
employeeUuid:
|
|
34
|
-
}), E = R.employeeStateTaxesList, { mutateAsync:
|
|
26
|
+
const me = (o) => {
|
|
27
|
+
const { employeeId: m, className: y, children: p, isAdmin: h = !1, dictionary: D } = o, { onEvent: T, fieldErrors: c, baseSubmitHandler: U } = te();
|
|
28
|
+
se("Employee.Taxes"), re("Employee.Taxes", D);
|
|
29
|
+
const { data: N } = j({
|
|
30
|
+
employeeUuid: m
|
|
31
|
+
}), e = N.employeeFederalTax, { mutateAsync: k, isPending: I } = G(), { data: R } = z({
|
|
32
|
+
employeeUuid: m
|
|
33
|
+
}), E = R.employeeStateTaxesList, { mutateAsync: C, isPending: L } = Q(), M = {
|
|
35
34
|
...e,
|
|
36
35
|
filingStatus: e.filingStatus ?? void 0,
|
|
37
36
|
twoJobs: e.twoJobs ? "true" : "false",
|
|
@@ -39,32 +38,32 @@ const de = (o) => {
|
|
|
39
38
|
dependentsAmount: e.dependentsAmount ? Number(e.dependentsAmount) : 0,
|
|
40
39
|
otherIncome: e.otherIncome ? Number(e.otherIncome) : 0,
|
|
41
40
|
extraWithholding: e.extraWithholding ? Number(e.extraWithholding) : 0,
|
|
42
|
-
states: E.reduce((s,
|
|
43
|
-
const d = l.answers[0]?.value,
|
|
44
|
-
return
|
|
41
|
+
states: E.reduce((s, r) => (r.state && (s[r.state] = r.questions?.reduce((a, l) => {
|
|
42
|
+
const d = l.answers[0]?.value, i = g(l.key);
|
|
43
|
+
return i === "fileNewHireReport" ? a[i] = typeof d > "u" ? !0 : d : a[i] = d, a;
|
|
45
44
|
}, {})), s), {})
|
|
46
|
-
}, v =
|
|
47
|
-
resolver:
|
|
48
|
-
defaultValues:
|
|
49
|
-
}), { handleSubmit:
|
|
45
|
+
}, v = B({
|
|
46
|
+
resolver: q(K.merge(Z)),
|
|
47
|
+
defaultValues: M
|
|
48
|
+
}), { handleSubmit: O, setError: A } = v;
|
|
50
49
|
return Y(() => {
|
|
51
50
|
c && c.length > 0 && c.forEach((s) => {
|
|
52
|
-
const
|
|
53
|
-
A(
|
|
51
|
+
const r = s.key.replace(".value", "");
|
|
52
|
+
A(r, { type: "custom", message: s.message });
|
|
54
53
|
});
|
|
55
54
|
}, [c, A]), /* @__PURE__ */ t("section", { className: y, children: /* @__PURE__ */ t(
|
|
56
|
-
|
|
55
|
+
$,
|
|
57
56
|
{
|
|
58
57
|
value: {
|
|
59
58
|
employeeStateTaxes: E,
|
|
60
59
|
isAdmin: h,
|
|
61
|
-
isPending: I ||
|
|
60
|
+
isPending: I || L
|
|
62
61
|
},
|
|
63
|
-
children: /* @__PURE__ */ t(V, { ...v, children: /* @__PURE__ */ t(
|
|
64
|
-
await U(s, async (
|
|
65
|
-
const { states:
|
|
62
|
+
children: /* @__PURE__ */ t(V, { ...v, children: /* @__PURE__ */ t(ae, { onSubmit: O(async (s) => {
|
|
63
|
+
await U(s, async (r) => {
|
|
64
|
+
const { states: a, ...l } = r, d = await k({
|
|
66
65
|
request: {
|
|
67
|
-
employeeUuid:
|
|
66
|
+
employeeUuid: m,
|
|
68
67
|
requestBody: {
|
|
69
68
|
...l,
|
|
70
69
|
twoJobs: l.twoJobs === "true",
|
|
@@ -72,32 +71,32 @@ const de = (o) => {
|
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
});
|
|
75
|
-
if (
|
|
76
|
-
const
|
|
74
|
+
if (T(S.EMPLOYEE_FEDERAL_TAXES_UPDATED, d), a && Object.keys(a).length > 0) {
|
|
75
|
+
const i = [];
|
|
77
76
|
for (const x of E) {
|
|
78
77
|
const F = x.state;
|
|
79
|
-
F && x.questions !== void 0 &&
|
|
78
|
+
F && x.questions !== void 0 && i.push({
|
|
80
79
|
state: F,
|
|
81
|
-
questions: x.questions.map((
|
|
82
|
-
if (
|
|
80
|
+
questions: x.questions.map((n) => {
|
|
81
|
+
if (n.isQuestionForAdminOnly && !h)
|
|
83
82
|
return null;
|
|
84
|
-
const f =
|
|
83
|
+
const f = a[F]?.[g(n.key)];
|
|
85
84
|
return {
|
|
86
|
-
key:
|
|
85
|
+
key: n.key,
|
|
87
86
|
answers: [
|
|
88
87
|
{
|
|
89
|
-
validFrom:
|
|
90
|
-
validUpTo:
|
|
88
|
+
validFrom: n.answers[0]?.validFrom ?? ne,
|
|
89
|
+
validUpTo: n.answers[0]?.validUpTo ?? null,
|
|
91
90
|
value: f == null || typeof f == "number" && isNaN(f) ? "" : f
|
|
92
91
|
}
|
|
93
92
|
]
|
|
94
93
|
};
|
|
95
|
-
}).filter((
|
|
94
|
+
}).filter((n) => n !== null)
|
|
96
95
|
//Filtering out questions in non-admin setup
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
|
-
const H = await
|
|
100
|
-
request: { employeeUuid:
|
|
98
|
+
const H = await C({
|
|
99
|
+
request: { employeeUuid: m, employeeStateTaxesRequest: { states: i } }
|
|
101
100
|
});
|
|
102
101
|
T(S.EMPLOYEE_STATE_TAXES_UPDATED, H);
|
|
103
102
|
}
|
|
@@ -107,7 +106,7 @@ const de = (o) => {
|
|
|
107
106
|
/* @__PURE__ */ t(b, {}),
|
|
108
107
|
/* @__PURE__ */ t(P, {}),
|
|
109
108
|
/* @__PURE__ */ t(_, {}),
|
|
110
|
-
/* @__PURE__ */ t(
|
|
109
|
+
/* @__PURE__ */ t(w, {})
|
|
111
110
|
] }) }) })
|
|
112
111
|
}
|
|
113
112
|
) });
|
|
@@ -115,9 +114,9 @@ const de = (o) => {
|
|
|
115
114
|
u.FederalHead = b;
|
|
116
115
|
u.FederalForm = P;
|
|
117
116
|
u.StateForm = _;
|
|
118
|
-
u.Actions =
|
|
119
|
-
const
|
|
120
|
-
const { employeeId: o, onEvent:
|
|
117
|
+
u.Actions = w;
|
|
118
|
+
const Ue = () => {
|
|
119
|
+
const { employeeId: o, onEvent: m, isAdmin: y } = oe(), { t: p } = W();
|
|
121
120
|
if (!o)
|
|
122
121
|
throw new Error(
|
|
123
122
|
p("errors.missingParamsOrContext", {
|
|
@@ -126,10 +125,10 @@ const Ie = () => {
|
|
|
126
125
|
provider: "FlowProvider"
|
|
127
126
|
})
|
|
128
127
|
);
|
|
129
|
-
return /* @__PURE__ */ t(u, { employeeId: o, onEvent:
|
|
128
|
+
return /* @__PURE__ */ t(u, { employeeId: o, onEvent: m, isAdmin: y ?? !1 });
|
|
130
129
|
};
|
|
131
130
|
export {
|
|
132
131
|
u as Taxes,
|
|
133
|
-
|
|
132
|
+
Ue as TaxesContextual
|
|
134
133
|
};
|
|
135
134
|
//# sourceMappingURL=Taxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Taxes.js","sources":["../../../../src/components/Employee/Taxes/Taxes.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { useEffect } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport {\n useEmployeeTaxSetupGetFederalTaxesSuspense,\n invalidateEmployeeTaxSetupGetFederalTaxes,\n} from '@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes'\nimport { useEmployeeTaxSetupUpdateFederalTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes'\nimport { useEmployeeTaxSetupGetStateTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport { useEmployeeTaxSetupUpdateStateTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport { Actions } from './Actions'\nimport {\n FederalForm,\n FederalFormSchema,\n type FederalFormInputs,\n type FederalFormPayload,\n} from './FederalForm'\nimport { FederalHead } from './FederalHead'\nimport { StateForm, StateFormSchema, type StateFormPayload } from './StateForm'\nimport { TaxesProvider } from './useTaxes'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst DEFAULT_TAX_VALID_FROM = '2010-01-01'\n\ninterface TaxesProps extends CommonComponentInterface<'Employee.Taxes'> {\n employeeId: string\n isAdmin?: boolean\n}\n\nexport function Taxes(props: TaxesProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = (props: TaxesProps) => {\n const { employeeId, className, children, isAdmin = false, dictionary } = props\n const { onEvent, fieldErrors, baseSubmitHandler } = useBase()\n useI18n('Employee.Taxes')\n useComponentDictionary('Employee.Taxes', dictionary)\n const queryClient = useQueryClient()\n\n const { data: fedData } = useEmployeeTaxSetupGetFederalTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeFederalTax = fedData.employeeFederalTax!\n\n const { mutateAsync: updateFederalTaxes, isPending: isPendingFederalTaxes } =\n useEmployeeTaxSetupUpdateFederalTaxesMutation()\n\n const { data: stateData } = useEmployeeTaxSetupGetStateTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeStateTaxes = stateData.employeeStateTaxesList!\n const { mutateAsync: updateStateTaxes, isPending: isPendingStateTaxes } =\n useEmployeeTaxSetupUpdateStateTaxesMutation()\n\n const defaultValues = {\n ...employeeFederalTax,\n filingStatus: employeeFederalTax.filingStatus ?? undefined,\n twoJobs: employeeFederalTax.twoJobs ? 'true' : 'false',\n deductions: employeeFederalTax.deductions ? Number(employeeFederalTax.deductions) : 0,\n dependentsAmount: employeeFederalTax.dependentsAmount\n ? Number(employeeFederalTax.dependentsAmount)\n : 0,\n otherIncome: employeeFederalTax.otherIncome ? Number(employeeFederalTax.otherIncome) : 0,\n extraWithholding: employeeFederalTax.extraWithholding\n ? Number(employeeFederalTax.extraWithholding)\n : 0,\n states: employeeStateTaxes.reduce((acc: Record<string, unknown>, state) => {\n if (state.state) {\n acc[state.state] = state.questions?.reduce((acc: Record<string, unknown>, question) => {\n const value = question.answers[0]?.value\n const key = snakeCaseToCamelCase(question.key)\n // Default new hire report to true if not specified\n if (key === 'fileNewHireReport') {\n acc[key] = typeof value === 'undefined' ? true : value\n } else {\n acc[key] = value\n }\n return acc\n }, {})\n }\n return acc\n }, {}),\n }\n\n const formMethods = useForm<FederalFormInputs, unknown, FederalFormPayload & StateFormPayload>({\n resolver: zodResolver(FederalFormSchema.merge(StateFormSchema)),\n defaultValues,\n })\n const { handleSubmit, setError: _setError } = formMethods\n\n useEffect(() => {\n //If list of field specific errors from API is present, mark corresponding fields as invalid\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(msgObject => {\n const key = msgObject.key.replace('.value', '')\n _setError(key as keyof FederalFormInputs, { type: 'custom', message: msgObject.message })\n })\n }\n }, [fieldErrors, _setError])\n\n const onSubmit: SubmitHandler<FederalFormPayload & StateFormPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { states: statesPayload, ...federalPayload } = payload\n\n const federalTaxesResponse = await updateFederalTaxes({\n request: {\n employeeUuid: employeeId,\n requestBody: {\n ...federalPayload,\n twoJobs: federalPayload.twoJobs === 'true',\n version: employeeFederalTax.version,\n },\n },\n })\n await invalidateEmployeeTaxSetupGetFederalTaxes(queryClient, [employeeId])\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_UPDATED, federalTaxesResponse)\n\n //State Taxes - only process if statesPayload exists\n if (statesPayload && Object.keys(statesPayload).length > 0) {\n const states = []\n\n for (const state of employeeStateTaxes) {\n const stateName = state.state\n\n if (stateName && state.questions !== undefined) {\n states.push({\n state: stateName,\n questions: state.questions\n .map(question => {\n if (question.isQuestionForAdminOnly && !isAdmin) {\n return null\n }\n const formValue = statesPayload[stateName]?.[snakeCaseToCamelCase(question.key)]\n return {\n key: question.key,\n answers: [\n {\n validFrom: question.answers[0]?.validFrom ?? DEFAULT_TAX_VALID_FROM,\n validUpTo: question.answers[0]?.validUpTo ?? null,\n value:\n formValue == null || (typeof formValue === 'number' && isNaN(formValue))\n ? ''\n : (formValue as string | number | boolean),\n },\n ],\n }\n })\n .filter(q => q !== null), //Filtering out questions in non-admin setup\n })\n }\n }\n\n const stateTaxesResponse = await updateStateTaxes({\n request: { employeeUuid: employeeId, employeeStateTaxesRequest: { states } },\n })\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_UPDATED, stateTaxesResponse)\n }\n\n onEvent(componentEvents.EMPLOYEE_TAXES_DONE)\n })\n }\n\n return (\n <section className={className}>\n <TaxesProvider\n value={{\n employeeStateTaxes,\n isAdmin: isAdmin,\n isPending: isPendingFederalTaxes || isPendingStateTaxes,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <FederalHead />\n <FederalForm />\n <StateForm />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </TaxesProvider>\n </section>\n )\n}\nTaxes.FederalHead = FederalHead\nTaxes.FederalForm = FederalForm\nTaxes.StateForm = StateForm\nTaxes.Actions = Actions\n\nexport const TaxesContextual = () => {\n const { employeeId, onEvent, isAdmin } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation()\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'EmployeeTaxes',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Taxes employeeId={employeeId} onEvent={onEvent} isAdmin={isAdmin ?? false} />\n}\n"],"names":["DEFAULT_TAX_VALID_FROM","Taxes","props","jsx","BaseComponent","Root","employeeId","className","children","isAdmin","dictionary","onEvent","fieldErrors","baseSubmitHandler","useBase","useI18n","useComponentDictionary","queryClient","useQueryClient","fedData","useEmployeeTaxSetupGetFederalTaxesSuspense","employeeFederalTax","updateFederalTaxes","isPendingFederalTaxes","useEmployeeTaxSetupUpdateFederalTaxesMutation","stateData","useEmployeeTaxSetupGetStateTaxesSuspense","employeeStateTaxes","updateStateTaxes","isPendingStateTaxes","useEmployeeTaxSetupUpdateStateTaxesMutation","defaultValues","acc","state","question","value","key","snakeCaseToCamelCase","formMethods","useForm","zodResolver","FederalFormSchema","StateFormSchema","handleSubmit","_setError","useEffect","msgObject","TaxesProvider","FormProvider","Form","data","payload","statesPayload","federalPayload","federalTaxesResponse","invalidateEmployeeTaxSetupGetFederalTaxes","componentEvents","states","stateName","formValue","q","stateTaxesResponse","jsxs","Fragment","FederalHead","FederalForm","StateForm","Actions","TaxesContextual","useFlow","t","useTranslation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAMA,KAAyB;AAOxB,SAASC,EAAMC,GAA4C;AAE9D,SAAA,gBAAAC,EAACC,IAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,MAAMG,KAAO,CAACH,MAAsB;AAClC,QAAM,EAAE,YAAAI,GAAY,WAAAC,GAAW,UAAAC,GAAU,SAAAC,IAAU,IAAO,YAAAC,MAAeR,GACnE,EAAE,SAAAS,GAAS,aAAAC,GAAa,mBAAAC,EAAA,IAA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,QAAM,EAAE,YAAA9D,GAAY,SAAAK,GAAS,SAAAF,EAAA,IAAY4D,GAAoC,GACvE,EAAE,GAAAC,EAAE,IAAIC,EAAe;AAC7B,MAAI,CAACjE;AACH,UAAM,IAAI;AAAA,MACRgE,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEF,2BAAQrE,GAAM,EAAA,YAAAK,GAAwB,SAAAK,GAAkB,SAASF,KAAW,IAAO;AACrF;"}
|
|
1
|
+
{"version":3,"file":"Taxes.js","sources":["../../../../src/components/Employee/Taxes/Taxes.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { useEffect } from 'react'\nimport { useEmployeeTaxSetupGetFederalTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes'\nimport { useEmployeeTaxSetupUpdateFederalTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes'\nimport { useEmployeeTaxSetupGetStateTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport { useEmployeeTaxSetupUpdateStateTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport { Actions } from './Actions'\nimport {\n FederalForm,\n FederalFormSchema,\n type FederalFormInputs,\n type FederalFormPayload,\n} from './FederalForm'\nimport { FederalHead } from './FederalHead'\nimport { StateForm, StateFormSchema, type StateFormPayload } from './StateForm'\nimport { TaxesProvider } from './useTaxes'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst DEFAULT_TAX_VALID_FROM = '2010-01-01'\n\ninterface TaxesProps extends CommonComponentInterface<'Employee.Taxes'> {\n employeeId: string\n isAdmin?: boolean\n}\n\nexport function Taxes(props: TaxesProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = (props: TaxesProps) => {\n const { employeeId, className, children, isAdmin = false, dictionary } = props\n const { onEvent, fieldErrors, baseSubmitHandler } = useBase()\n useI18n('Employee.Taxes')\n useComponentDictionary('Employee.Taxes', dictionary)\n\n const { data: fedData } = useEmployeeTaxSetupGetFederalTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeFederalTax = fedData.employeeFederalTax!\n\n const { mutateAsync: updateFederalTaxes, isPending: isPendingFederalTaxes } =\n useEmployeeTaxSetupUpdateFederalTaxesMutation()\n\n const { data: stateData } = useEmployeeTaxSetupGetStateTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeStateTaxes = stateData.employeeStateTaxesList!\n const { mutateAsync: updateStateTaxes, isPending: isPendingStateTaxes } =\n useEmployeeTaxSetupUpdateStateTaxesMutation()\n\n const defaultValues = {\n ...employeeFederalTax,\n filingStatus: employeeFederalTax.filingStatus ?? undefined,\n twoJobs: employeeFederalTax.twoJobs ? 'true' : 'false',\n deductions: employeeFederalTax.deductions ? Number(employeeFederalTax.deductions) : 0,\n dependentsAmount: employeeFederalTax.dependentsAmount\n ? Number(employeeFederalTax.dependentsAmount)\n : 0,\n otherIncome: employeeFederalTax.otherIncome ? Number(employeeFederalTax.otherIncome) : 0,\n extraWithholding: employeeFederalTax.extraWithholding\n ? Number(employeeFederalTax.extraWithholding)\n : 0,\n states: employeeStateTaxes.reduce((acc: Record<string, unknown>, state) => {\n if (state.state) {\n acc[state.state] = state.questions?.reduce((acc: Record<string, unknown>, question) => {\n const value = question.answers[0]?.value\n const key = snakeCaseToCamelCase(question.key)\n // Default new hire report to true if not specified\n if (key === 'fileNewHireReport') {\n acc[key] = typeof value === 'undefined' ? true : value\n } else {\n acc[key] = value\n }\n return acc\n }, {})\n }\n return acc\n }, {}),\n }\n\n const formMethods = useForm<FederalFormInputs, unknown, FederalFormPayload & StateFormPayload>({\n resolver: zodResolver(FederalFormSchema.merge(StateFormSchema)),\n defaultValues,\n })\n const { handleSubmit, setError: _setError } = formMethods\n\n useEffect(() => {\n //If list of field specific errors from API is present, mark corresponding fields as invalid\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(msgObject => {\n const key = msgObject.key.replace('.value', '')\n _setError(key as keyof FederalFormInputs, { type: 'custom', message: msgObject.message })\n })\n }\n }, [fieldErrors, _setError])\n\n const onSubmit: SubmitHandler<FederalFormPayload & StateFormPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { states: statesPayload, ...federalPayload } = payload\n\n const federalTaxesResponse = await updateFederalTaxes({\n request: {\n employeeUuid: employeeId,\n requestBody: {\n ...federalPayload,\n twoJobs: federalPayload.twoJobs === 'true',\n version: employeeFederalTax.version,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_UPDATED, federalTaxesResponse)\n\n //State Taxes - only process if statesPayload exists\n if (statesPayload && Object.keys(statesPayload).length > 0) {\n const states = []\n\n for (const state of employeeStateTaxes) {\n const stateName = state.state\n\n if (stateName && state.questions !== undefined) {\n states.push({\n state: stateName,\n questions: state.questions\n .map(question => {\n if (question.isQuestionForAdminOnly && !isAdmin) {\n return null\n }\n const formValue = statesPayload[stateName]?.[snakeCaseToCamelCase(question.key)]\n return {\n key: question.key,\n answers: [\n {\n validFrom: question.answers[0]?.validFrom ?? DEFAULT_TAX_VALID_FROM,\n validUpTo: question.answers[0]?.validUpTo ?? null,\n value:\n formValue == null || (typeof formValue === 'number' && isNaN(formValue))\n ? ''\n : (formValue as string | number | boolean),\n },\n ],\n }\n })\n .filter(q => q !== null), //Filtering out questions in non-admin setup\n })\n }\n }\n\n const stateTaxesResponse = await updateStateTaxes({\n request: { employeeUuid: employeeId, employeeStateTaxesRequest: { states } },\n })\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_UPDATED, stateTaxesResponse)\n }\n\n onEvent(componentEvents.EMPLOYEE_TAXES_DONE)\n })\n }\n\n return (\n <section className={className}>\n <TaxesProvider\n value={{\n employeeStateTaxes,\n isAdmin: isAdmin,\n isPending: isPendingFederalTaxes || isPendingStateTaxes,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <FederalHead />\n <FederalForm />\n <StateForm />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </TaxesProvider>\n </section>\n )\n}\nTaxes.FederalHead = FederalHead\nTaxes.FederalForm = FederalForm\nTaxes.StateForm = StateForm\nTaxes.Actions = Actions\n\nexport const TaxesContextual = () => {\n const { employeeId, onEvent, isAdmin } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation()\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'EmployeeTaxes',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Taxes employeeId={employeeId} onEvent={onEvent} isAdmin={isAdmin ?? false} />\n}\n"],"names":["DEFAULT_TAX_VALID_FROM","Taxes","props","jsx","BaseComponent","Root","employeeId","className","children","isAdmin","dictionary","onEvent","fieldErrors","baseSubmitHandler","useBase","useI18n","useComponentDictionary","fedData","useEmployeeTaxSetupGetFederalTaxesSuspense","employeeFederalTax","updateFederalTaxes","isPendingFederalTaxes","useEmployeeTaxSetupUpdateFederalTaxesMutation","stateData","useEmployeeTaxSetupGetStateTaxesSuspense","employeeStateTaxes","updateStateTaxes","isPendingStateTaxes","useEmployeeTaxSetupUpdateStateTaxesMutation","defaultValues","acc","state","question","value","key","snakeCaseToCamelCase","formMethods","useForm","zodResolver","FederalFormSchema","StateFormSchema","handleSubmit","_setError","useEffect","msgObject","TaxesProvider","FormProvider","Form","data","payload","statesPayload","federalPayload","federalTaxesResponse","componentEvents","states","stateName","formValue","q","stateTaxesResponse","jsxs","Fragment","FederalHead","FederalForm","StateForm","Actions","TaxesContextual","useFlow","t","useTranslation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgCA,MAAMA,KAAyB;AAOxB,SAASC,EAAMC,GAA4C;AAE9D,SAAA,gBAAAC,EAACC,IAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,MAAMG,KAAO,CAACH,MAAsB;AAClC,QAAM,EAAE,YAAAI,GAAY,WAAAC,GAAW,UAAAC,GAAU,SAAAC,IAAU,IAAO,YAAAC,MAAeR,GACnE,EAAE,SAAAS,GAAS,aAAAC,GAAa,mBAAAC,EAAA,IAAsBC,GAAQ;AAC5D,EAAAC,GAAQ,gBAAgB,GACxBC,GAAuB,kBAAkBN,CAAU;AAEnD,QAAM,EAAE,MAAMO,EAAQ,IAAIC,EAA2C;AAAA,IACnE,cAAcZ;AAAA,EAAA,CACf,GACKa,IAAqBF,EAAQ,oBAE7B,EAAE,aAAaG,GAAoB,WAAWC,EAAA,IAClDC,EAA8C,GAE1C,EAAE,MAAMC,EAAU,IAAIC,EAAyC;AAAA,IACnE,cAAclB;AAAA,EAAA,CACf,GACKmB,IAAqBF,EAAU,wBAC/B,EAAE,aAAaG,GAAkB,WAAWC,EAAA,IAChDC,EAA4C,GAExCC,IAAgB;AAAA,IACpB,GAAGV;AAAA,IACH,cAAcA,EAAmB,gBAAgB;AAAA,IACjD,SAASA,EAAmB,UAAU,SAAS;AAAA,IAC/C,YAAYA,EAAmB,aAAa,OAAOA,EAAmB,UAAU,IAAI;AAAA,IACpF,kBAAkBA,EAAmB,mBACjC,OAAOA,EAAmB,gBAAgB,IAC1C;AAAA,IACJ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A,YAAA,CAC5E;AACO,YAAA3C,EAAA0C,EAAgB,8BAA8BK,CAAkB;AAAA,UAAA;AAG1E,UAAA/C,EAAQ0C,EAAgB,mBAAmB;AAAA,QAAA,CAC5C;AAAA,MACH,CAY6C,GAClC,UACC7C,KAGE,gBAAAmD,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAzD,EAAC0D,GAAY,EAAA;AAAA,0BACZC,GAAY,EAAA;AAAA,0BACZC,GAAU,EAAA;AAAA,0BACVC,GAAQ,CAAA,CAAA;AAAA,MAAA,EACX,CAAA,EAEJ,CAAA,EACF,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AACA/D,EAAM,cAAc4D;AACpB5D,EAAM,cAAc6D;AACpB7D,EAAM,YAAY8D;AAClB9D,EAAM,UAAU+D;AAET,MAAMC,KAAkB,MAAM;AACnC,QAAM,EAAE,YAAA3D,GAAY,SAAAK,GAAS,SAAAF,EAAA,IAAYyD,GAAoC,GACvE,EAAE,GAAAC,EAAE,IAAIC,EAAe;AAC7B,MAAI,CAAC9D;AACH,UAAM,IAAI;AAAA,MACR6D,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEF,2BAAQlE,GAAM,EAAA,YAAAK,GAAwB,SAAAK,GAAkB,SAASF,KAAW,IAAO;AACrF;"}
|
|
@@ -5,14 +5,15 @@ import "react-i18next";
|
|
|
5
5
|
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
|
+
import "@tanstack/react-query";
|
|
8
9
|
import "../../Base/useBase.js";
|
|
9
10
|
import "../../../shared/constants.js";
|
|
10
11
|
import "dompurify";
|
|
11
12
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
13
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
13
|
-
const [
|
|
14
|
+
const [d, u] = o("TaxesContext");
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
u as TaxesProvider,
|
|
17
|
+
d as useTaxes
|
|
17
18
|
};
|
|
18
19
|
//# sourceMappingURL=useTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTaxes.js","sources":["../../../../src/components/Employee/Taxes/useTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype TaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useTaxes, TaxesProvider] = createCompoundContext<TaxesContextType>('TaxesContext')\nexport { useTaxes, TaxesProvider }\n"],"names":["useTaxes","TaxesProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTaxes.js","sources":["../../../../src/components/Employee/Taxes/useTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype TaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useTaxes, TaxesProvider] = createCompoundContext<TaxesContextType>('TaxesContext')\nexport { useTaxes, TaxesProvider }\n"],"names":["useTaxes","TaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;AASA,MAAM,CAACA,GAAUC,CAAa,IAAIC,EAAwC,cAAc;"}
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { QueryClient as
|
|
3
|
-
import { GustoEmbeddedProvider as
|
|
4
|
-
import { GustoEmbeddedCore as
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { QueryClient as l, QueryClientProvider as u } from "@tanstack/react-query";
|
|
3
|
+
import { GustoEmbeddedProvider as p } from "@gusto/embedded-api/react-query/_context";
|
|
4
|
+
import { GustoEmbeddedCore as y } from "@gusto/embedded-api/core";
|
|
5
5
|
import { HTTPClient as C } from "@gusto/embedded-api/lib/http";
|
|
6
6
|
import { useMemo as r } from "react";
|
|
7
|
-
function
|
|
7
|
+
function g({
|
|
8
8
|
url: n,
|
|
9
9
|
headers: t,
|
|
10
|
-
children:
|
|
10
|
+
children: c
|
|
11
11
|
}) {
|
|
12
12
|
const o = r(
|
|
13
13
|
() => new C({
|
|
14
|
-
fetcher: async (e) => (e instanceof Request && t && new Headers(t).forEach((
|
|
15
|
-
|
|
14
|
+
fetcher: async (e) => (e instanceof Request && t && new Headers(t).forEach((s, m) => {
|
|
15
|
+
s && e.headers.set(m, s);
|
|
16
16
|
}), fetch(e))
|
|
17
17
|
}),
|
|
18
18
|
[t]
|
|
19
|
-
),
|
|
20
|
-
() => new
|
|
19
|
+
), a = r(
|
|
20
|
+
() => new y({
|
|
21
21
|
serverURL: n,
|
|
22
22
|
httpClient: o
|
|
23
23
|
}),
|
|
24
24
|
[o, n]
|
|
25
25
|
), f = r(() => {
|
|
26
|
-
const e = new
|
|
27
|
-
|
|
26
|
+
const e = new l(), i = async () => {
|
|
27
|
+
await e.invalidateQueries();
|
|
28
|
+
};
|
|
29
|
+
return e.setQueryDefaults(["@gusto/embedded-api"], { retry: !1 }), e.setMutationDefaults(["@gusto/embedded-api"], { onSettled: i, retry: !1 }), e;
|
|
28
30
|
}, []);
|
|
29
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ d(u, { client: f, children: /* @__PURE__ */ d(p, { client: a, children: c }) });
|
|
30
32
|
}
|
|
31
33
|
export {
|
|
32
|
-
|
|
34
|
+
g as ApiProvider
|
|
33
35
|
};
|
|
34
36
|
//# sourceMappingURL=ApiProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiProvider.js","sources":["../../../src/contexts/ApiProvider/ApiProvider.tsx"],"sourcesContent":["import { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { GustoEmbeddedProvider } from '@gusto/embedded-api/react-query/_context'\nimport { GustoEmbeddedCore } from '@gusto/embedded-api/core'\nimport { HTTPClient } from '@gusto/embedded-api/lib/http'\nimport { useMemo } from 'react'\n\nexport function ApiProvider({\n url,\n headers,\n children,\n}: {\n url: string\n headers?: HeadersInit\n children: React.ReactNode\n}) {\n const httpClientWithHeaders = useMemo(\n () =>\n new HTTPClient({\n fetcher: async request => {\n if (request instanceof Request && headers) {\n const headersInstance = new Headers(headers)\n headersInstance.forEach((headerValue, headerName) => {\n if (headerValue) {\n request.headers.set(headerName, headerValue)\n }\n })\n }\n\n return fetch(request)\n },\n }),\n [headers],\n )\n\n const gustoClient = useMemo(\n () =>\n new GustoEmbeddedCore({\n serverURL: url,\n httpClient: httpClientWithHeaders,\n }),\n [httpClientWithHeaders, url],\n )\n\n const queryClient = useMemo(() => {\n const client = new QueryClient()\n client.setQueryDefaults(['@gusto/embedded-api'], { retry: false })\n client.setMutationDefaults(['@gusto/embedded-api'], { retry: false })\n\n return client\n }, [])\n\n return (\n <QueryClientProvider client={queryClient}>\n <GustoEmbeddedProvider client={gustoClient}>{children}</GustoEmbeddedProvider>\n </QueryClientProvider>\n )\n}\n"],"names":["ApiProvider","url","headers","children","httpClientWithHeaders","useMemo","HTTPClient","request","headerValue","headerName","gustoClient","GustoEmbeddedCore","queryClient","client","QueryClient","jsx","QueryClientProvider","GustoEmbeddedProvider"],"mappings":";;;;;;AAMO,SAASA,EAAY;AAAA,EAC1B,KAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,GAIG;AACD,QAAMC,IAAwBC;AAAA,IAC5B,MACE,IAAIC,EAAW;AAAA,MACb,SAAS,OAAMC,OACTA,aAAmB,WAAWL,KACR,IAAI,QAAQA,CAAO,EAC3B,QAAQ,CAACM,GAAaC,MAAe;AACnD,QAAID,KACMD,EAAA,QAAQ,IAAIE,GAAYD,CAAW;AAAA,MAC7C,CACD,GAGI,MAAMD,CAAO;AAAA,IACtB,CACD;AAAA,IACH,CAACL,CAAO;AAAA,EACV,GAEMQ,IAAcL;AAAA,IAClB,MACE,IAAIM,EAAkB;AAAA,MACpB,WAAWV;AAAA,MACX,YAAYG;AAAA,IAAA,CACb;AAAA,IACH,CAACA,GAAuBH,CAAG;AAAA,EAC7B,GAEMW,IAAcP,EAAQ,MAAM;AAC1B,UAAAQ,IAAS,IAAIC,EAAY;
|
|
1
|
+
{"version":3,"file":"ApiProvider.js","sources":["../../../src/contexts/ApiProvider/ApiProvider.tsx"],"sourcesContent":["import { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { GustoEmbeddedProvider } from '@gusto/embedded-api/react-query/_context'\nimport { GustoEmbeddedCore } from '@gusto/embedded-api/core'\nimport { HTTPClient } from '@gusto/embedded-api/lib/http'\nimport { useMemo } from 'react'\n\nexport function ApiProvider({\n url,\n headers,\n children,\n}: {\n url: string\n headers?: HeadersInit\n children: React.ReactNode\n}) {\n const httpClientWithHeaders = useMemo(\n () =>\n new HTTPClient({\n fetcher: async request => {\n if (request instanceof Request && headers) {\n const headersInstance = new Headers(headers)\n headersInstance.forEach((headerValue, headerName) => {\n if (headerValue) {\n request.headers.set(headerName, headerValue)\n }\n })\n }\n\n return fetch(request)\n },\n }),\n [headers],\n )\n\n const gustoClient = useMemo(\n () =>\n new GustoEmbeddedCore({\n serverURL: url,\n httpClient: httpClientWithHeaders,\n }),\n [httpClientWithHeaders, url],\n )\n\n const queryClient = useMemo(() => {\n const client = new QueryClient()\n\n const onSettled = async () => {\n await client.invalidateQueries()\n }\n client.setQueryDefaults(['@gusto/embedded-api'], { retry: false })\n client.setMutationDefaults(['@gusto/embedded-api'], { onSettled, retry: false })\n\n return client\n }, [])\n\n return (\n <QueryClientProvider client={queryClient}>\n <GustoEmbeddedProvider client={gustoClient}>{children}</GustoEmbeddedProvider>\n </QueryClientProvider>\n )\n}\n"],"names":["ApiProvider","url","headers","children","httpClientWithHeaders","useMemo","HTTPClient","request","headerValue","headerName","gustoClient","GustoEmbeddedCore","queryClient","client","QueryClient","onSettled","jsx","QueryClientProvider","GustoEmbeddedProvider"],"mappings":";;;;;;AAMO,SAASA,EAAY;AAAA,EAC1B,KAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,GAIG;AACD,QAAMC,IAAwBC;AAAA,IAC5B,MACE,IAAIC,EAAW;AAAA,MACb,SAAS,OAAMC,OACTA,aAAmB,WAAWL,KACR,IAAI,QAAQA,CAAO,EAC3B,QAAQ,CAACM,GAAaC,MAAe;AACnD,QAAID,KACMD,EAAA,QAAQ,IAAIE,GAAYD,CAAW;AAAA,MAC7C,CACD,GAGI,MAAMD,CAAO;AAAA,IACtB,CACD;AAAA,IACH,CAACL,CAAO;AAAA,EACV,GAEMQ,IAAcL;AAAA,IAClB,MACE,IAAIM,EAAkB;AAAA,MACpB,WAAWV;AAAA,MACX,YAAYG;AAAA,IAAA,CACb;AAAA,IACH,CAACA,GAAuBH,CAAG;AAAA,EAC7B,GAEMW,IAAcP,EAAQ,MAAM;AAC1B,UAAAQ,IAAS,IAAIC,EAAY,GAEzBC,IAAY,YAAY;AAC5B,YAAMF,EAAO,kBAAkB;AAAA,IACjC;AACA,WAAAA,EAAO,iBAAiB,CAAC,qBAAqB,GAAG,EAAE,OAAO,IAAO,GAC1DA,EAAA,oBAAoB,CAAC,qBAAqB,GAAG,EAAE,WAAAE,GAAW,OAAO,IAAO,GAExEF;AAAA,EACT,GAAG,EAAE;AAGH,SAAA,gBAAAG,EAACC,KAAoB,QAAQL,GAC3B,4BAACM,GAAsB,EAAA,QAAQR,GAAc,UAAAP,EAAA,CAAS,EACxD,CAAA;AAEJ;"}
|
|
@@ -16,3 +16,8 @@ export type { TableProps, TableData, TableRow } from '../../components/Common/UI
|
|
|
16
16
|
export type { TextInputProps } from '../../components/Common/UI/TextInput/TextInputTypes';
|
|
17
17
|
export type { AlertProps } from '../../components/Common/UI/Alert/AlertTypes';
|
|
18
18
|
export type { BadgeProps } from '../../components/Common/UI/Badge/BadgeTypes';
|
|
19
|
+
export type { OrderedListProps, UnorderedListProps } from '../../components/Common/UI/List/ListTypes';
|
|
20
|
+
export type { HeadingProps } from '../../components/Common/UI/Heading/HeadingTypes';
|
|
21
|
+
export type { PaginationControlProps } from '../../components/Common/PaginationControl/PaginationControlTypes';
|
|
22
|
+
export type { TextProps } from '../../components/Common/UI/Text/TextTypes';
|
|
23
|
+
export type { CalendarPreviewProps } from '../../components/Common/UI/CalendarPreview/CalendarPreviewTypes';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { ComponentsContextType } from '../ComponentAdapter/useComponentContext';
|
|
4
|
+
import { LoadingIndicatorContextProps } from '../LoadingIndicatorProvider/useLoadingIndicator';
|
|
4
5
|
import { GTheme } from '../../types/GTheme';
|
|
5
6
|
import { DeepPartial, ResourceDictionary } from '../../types/Helpers';
|
|
6
7
|
interface APIConfig {
|
|
@@ -16,6 +17,7 @@ export interface GustoProviderProps {
|
|
|
16
17
|
theme?: DeepPartial<GTheme>;
|
|
17
18
|
queryClient?: QueryClient;
|
|
18
19
|
components: ComponentsContextType;
|
|
20
|
+
LoaderComponent?: LoadingIndicatorContextProps['LoadingIndicator'];
|
|
19
21
|
}
|
|
20
22
|
export interface GustoProviderCustomUIAdapterProps extends GustoProviderProps {
|
|
21
23
|
children?: React.ReactNode;
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { ErrorBoundary as
|
|
3
|
-
import { I18nextProvider as
|
|
2
|
+
import { ErrorBoundary as h } from "react-error-boundary";
|
|
3
|
+
import { I18nextProvider as v } from "react-i18next";
|
|
4
4
|
import { useEffect as g } from "react";
|
|
5
|
-
import { ComponentsProvider as
|
|
6
|
-
import { ApiProvider as
|
|
5
|
+
import { ComponentsProvider as P } from "../ComponentAdapter/ComponentsProvider.js";
|
|
6
|
+
import { ApiProvider as I } from "../ApiProvider/ApiProvider.js";
|
|
7
|
+
import { LoadingIndicatorProvider as x } from "../LoadingIndicatorProvider/LoadingIndicatorProvider.js";
|
|
7
8
|
import { SDKI18next as i } from "./SDKI18next.js";
|
|
8
|
-
import { InternalError as
|
|
9
|
-
import { LocaleProvider as
|
|
10
|
-
import { ThemeProvider as
|
|
11
|
-
const
|
|
9
|
+
import { InternalError as y } from "../../components/Common/InternalError/InternalError.js";
|
|
10
|
+
import { LocaleProvider as C } from "../LocaleProvider/LocaleProvider.js";
|
|
11
|
+
import { ThemeProvider as L } from "../ThemeProvider/ThemeProvider.js";
|
|
12
|
+
const G = (a) => {
|
|
12
13
|
const {
|
|
13
|
-
children:
|
|
14
|
+
children: d,
|
|
14
15
|
config: t,
|
|
15
16
|
dictionary: o,
|
|
16
17
|
lng: e = "en",
|
|
17
|
-
locale:
|
|
18
|
+
locale: c = "en-US",
|
|
18
19
|
currency: l = "USD",
|
|
19
|
-
theme:
|
|
20
|
-
components: f
|
|
21
|
-
|
|
20
|
+
theme: p,
|
|
21
|
+
components: f,
|
|
22
|
+
LoaderComponent: s
|
|
23
|
+
} = a;
|
|
22
24
|
if (o)
|
|
23
|
-
for (const
|
|
24
|
-
const n =
|
|
25
|
+
for (const u in o) {
|
|
26
|
+
const n = u;
|
|
25
27
|
for (const m in o[n])
|
|
26
28
|
i.addResourceBundle(
|
|
27
29
|
n,
|
|
@@ -33,9 +35,9 @@ const k = (c) => {
|
|
|
33
35
|
}
|
|
34
36
|
return g(() => {
|
|
35
37
|
(async () => await i.changeLanguage(e))();
|
|
36
|
-
}, [e]), /* @__PURE__ */ r(
|
|
38
|
+
}, [e]), /* @__PURE__ */ r(P, { value: f, children: /* @__PURE__ */ r(x, { value: s, children: /* @__PURE__ */ r(h, { FallbackComponent: y, children: /* @__PURE__ */ r(L, { theme: p, children: /* @__PURE__ */ r(C, { locale: c, currency: l, children: /* @__PURE__ */ r(v, { i18n: i, children: /* @__PURE__ */ r(I, { url: t.baseUrl, headers: t.headers, children: d }) }, e) }) }) }) }) });
|
|
37
39
|
};
|
|
38
40
|
export {
|
|
39
|
-
|
|
41
|
+
G as GustoProviderCustomUIAdapter
|
|
40
42
|
};
|
|
41
43
|
//# sourceMappingURL=GustoProviderCustomUIAdapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GustoProviderCustomUIAdapter.js","sources":["../../../src/contexts/GustoProvider/GustoProviderCustomUIAdapter.tsx"],"sourcesContent":["import type React from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { I18nextProvider } from 'react-i18next'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useEffect } from 'react'\nimport { ComponentsProvider } from '../ComponentAdapter/ComponentsProvider'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport { ApiProvider } from '../ApiProvider/ApiProvider'\nimport { SDKI18next } from './SDKI18next'\nimport { InternalError } from '@/components/Common'\nimport { LocaleProvider } from '@/contexts/LocaleProvider'\nimport { ThemeProvider } from '@/contexts/ThemeProvider'\nimport type { GTheme } from '@/types/GTheme'\nimport type { DeepPartial, ResourceDictionary, SupportedLanguages } from '@/types/Helpers'\n\ninterface APIConfig {\n baseUrl: string\n headers?: HeadersInit\n}\n\nexport interface GustoProviderProps {\n config: APIConfig\n dictionary?: ResourceDictionary\n lng?: string\n locale?: string\n currency?: string\n theme?: DeepPartial<GTheme>\n queryClient?: QueryClient\n components: ComponentsContextType\n}\n\nexport interface GustoProviderCustomUIAdapterProps extends GustoProviderProps {\n children?: React.ReactNode\n}\n\n/**\n * A provider that accepts UI component adapters through the components prop\n */\nconst GustoProviderCustomUIAdapter: React.FC<GustoProviderCustomUIAdapterProps> = props => {\n const {\n children,\n config,\n dictionary,\n lng = 'en',\n locale = 'en-US',\n currency = 'USD',\n theme,\n components,\n } = props\n\n // Handle dictionary resources\n if (dictionary) {\n for (const language in dictionary) {\n const lang = language as SupportedLanguages\n for (const ns in dictionary[lang]) {\n // Adding resources overrides to i18next instance - initial load will override common namespace and add component specific dictionaries provided by partners\n SDKI18next.addResourceBundle(\n lang,\n ns,\n (dictionary[lang] as Record<string, unknown>)[ns],\n true,\n true,\n )\n }\n }\n }\n\n // Handle language change\n useEffect(() => {\n void (async () => {\n await SDKI18next.changeLanguage(lng)\n })()\n }, [lng])\n\n return (\n <ComponentsProvider value={components}>\n <ErrorBoundary FallbackComponent={InternalError}>\n
|
|
1
|
+
{"version":3,"file":"GustoProviderCustomUIAdapter.js","sources":["../../../src/contexts/GustoProvider/GustoProviderCustomUIAdapter.tsx"],"sourcesContent":["import type React from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { I18nextProvider } from 'react-i18next'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useEffect } from 'react'\nimport { ComponentsProvider } from '../ComponentAdapter/ComponentsProvider'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport { ApiProvider } from '../ApiProvider/ApiProvider'\nimport { LoadingIndicatorProvider } from '../LoadingIndicatorProvider/LoadingIndicatorProvider'\nimport type { LoadingIndicatorContextProps } from '../LoadingIndicatorProvider/useLoadingIndicator'\nimport { SDKI18next } from './SDKI18next'\nimport { InternalError } from '@/components/Common'\nimport { LocaleProvider } from '@/contexts/LocaleProvider'\nimport { ThemeProvider } from '@/contexts/ThemeProvider'\nimport type { GTheme } from '@/types/GTheme'\nimport type { DeepPartial, ResourceDictionary, SupportedLanguages } from '@/types/Helpers'\n\ninterface APIConfig {\n baseUrl: string\n headers?: HeadersInit\n}\n\nexport interface GustoProviderProps {\n config: APIConfig\n dictionary?: ResourceDictionary\n lng?: string\n locale?: string\n currency?: string\n theme?: DeepPartial<GTheme>\n queryClient?: QueryClient\n components: ComponentsContextType\n LoaderComponent?: LoadingIndicatorContextProps['LoadingIndicator']\n}\n\nexport interface GustoProviderCustomUIAdapterProps extends GustoProviderProps {\n children?: React.ReactNode\n}\n\n/**\n * A provider that accepts UI component adapters through the components prop\n */\nconst GustoProviderCustomUIAdapter: React.FC<GustoProviderCustomUIAdapterProps> = props => {\n const {\n children,\n config,\n dictionary,\n lng = 'en',\n locale = 'en-US',\n currency = 'USD',\n theme,\n components,\n LoaderComponent,\n } = props\n\n // Handle dictionary resources\n if (dictionary) {\n for (const language in dictionary) {\n const lang = language as SupportedLanguages\n for (const ns in dictionary[lang]) {\n // Adding resources overrides to i18next instance - initial load will override common namespace and add component specific dictionaries provided by partners\n SDKI18next.addResourceBundle(\n lang,\n ns,\n (dictionary[lang] as Record<string, unknown>)[ns],\n true,\n true,\n )\n }\n }\n }\n\n // Handle language change\n useEffect(() => {\n void (async () => {\n await SDKI18next.changeLanguage(lng)\n })()\n }, [lng])\n\n return (\n <ComponentsProvider value={components}>\n <LoadingIndicatorProvider value={LoaderComponent}>\n <ErrorBoundary FallbackComponent={InternalError}>\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={locale} currency={currency}>\n <I18nextProvider i18n={SDKI18next} key={lng}>\n <ApiProvider url={config.baseUrl} headers={config.headers}>\n {children}\n </ApiProvider>\n </I18nextProvider>\n </LocaleProvider>\n </ThemeProvider>\n </ErrorBoundary>\n </LoadingIndicatorProvider>\n </ComponentsProvider>\n )\n}\n\nexport { GustoProviderCustomUIAdapter }\n"],"names":["GustoProviderCustomUIAdapter","props","children","config","dictionary","lng","locale","currency","theme","components","LoaderComponent","language","lang","ns","SDKI18next","useEffect","ComponentsProvider","jsx","LoadingIndicatorProvider","ErrorBoundary","InternalError","ThemeProvider","LocaleProvider","I18nextProvider","ApiProvider"],"mappings":";;;;;;;;;;;AAyCA,MAAMA,IAA4E,CAASC,MAAA;AACnF,QAAA;AAAA,IACJ,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,QAAAC,IAAS;AAAA,IACT,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,EAAA,IACET;AAGJ,MAAIG;AACF,eAAWO,KAAYP,GAAY;AACjC,YAAMQ,IAAOD;AACF,iBAAAE,KAAMT,EAAWQ,CAAI;AAEnB,QAAAE,EAAA;AAAA,UACTF;AAAA,UACAC;AAAA,UACCT,EAAWQ,CAAI,EAA8BC,CAAE;AAAA,UAChD;AAAA,UACA;AAAA,QACF;AAAA,IACF;AAKJ,SAAAE,EAAU,MAAM;AACd,KAAM,YACE,MAAAD,EAAW,eAAeT,CAAG;AAAA,EAClC,GACF,CAACA,CAAG,CAAC,qBAGLW,GAAmB,EAAA,OAAOP,GACzB,UAAA,gBAAAQ,EAACC,KAAyB,OAAOR,GAC/B,UAAC,gBAAAO,EAAAE,GAAA,EAAc,mBAAmBC,GAChC,UAAA,gBAAAH,EAACI,KAAc,OAAAb,GACb,UAAA,gBAAAS,EAACK,KAAe,QAAAhB,GAAgB,UAAAC,GAC9B,UAAC,gBAAAU,EAAAM,GAAA,EAAgB,MAAMT,GACrB,UAAA,gBAAAG,EAACO,GAAY,EAAA,KAAKrB,EAAO,SAAS,SAASA,EAAO,SAC/C,UAAAD,EACH,CAAA,EAHsC,GAAAG,CAIxC,GACF,EACF,CAAA,GACF,GACF,EACF,CAAA;AAEJ;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { LoadingIndicatorContextProps } from './useLoadingIndicator';
|
|
3
|
+
export interface LoadingIndicatorProviderProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
value?: LoadingIndicatorContextProps['LoadingIndicator'];
|
|
6
|
+
}
|
|
7
|
+
export declare function LoadingIndicatorProvider({ children, value }: LoadingIndicatorProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { LoadingIndicatorContext as n } from "./useLoadingIndicator.js";
|
|
3
|
+
import { Loading as t } from "../../components/Common/Loading/Loading.js";
|
|
4
|
+
function m({ children: o, value: r }) {
|
|
5
|
+
return /* @__PURE__ */ i(n.Provider, { value: { LoadingIndicator: r ?? t }, children: o });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
m as LoadingIndicatorProvider
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=LoadingIndicatorProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingIndicatorProvider.js","sources":["../../../src/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { LoadingIndicatorContext, type LoadingIndicatorContextProps } from './useLoadingIndicator'\nimport { Loading } from '@/components/Common/Loading/Loading'\n\nexport interface LoadingIndicatorProviderProps {\n children: ReactNode\n value?: LoadingIndicatorContextProps['LoadingIndicator']\n}\n\nexport function LoadingIndicatorProvider({ children, value }: LoadingIndicatorProviderProps) {\n return (\n <LoadingIndicatorContext.Provider value={{ LoadingIndicator: value ?? Loading }}>\n {children}\n </LoadingIndicatorContext.Provider>\n )\n}\n"],"names":["LoadingIndicatorProvider","children","value","jsx","LoadingIndicatorContext","Loading"],"mappings":";;;AASO,SAASA,EAAyB,EAAE,UAAAC,GAAU,OAAAC,KAAwC;AAEzF,SAAA,gBAAAC,EAACC,EAAwB,UAAxB,EAAiC,OAAO,EAAE,kBAAkBF,KAASG,KACnE,UAAAJ,GACH;AAEJ;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
export interface LoadingIndicatorContextProps {
|
|
3
|
+
LoadingIndicator: () => JSX.Element;
|
|
4
|
+
}
|
|
5
|
+
export declare const LoadingIndicatorContext: import('react').Context<LoadingIndicatorContextProps>;
|
|
6
|
+
export declare const useLoadingIndicator: () => LoadingIndicatorContextProps;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as t, createContext as n } from "react";
|
|
3
|
+
import { Loading as r } from "../../components/Common/Loading/Loading.js";
|
|
4
|
+
const i = n({
|
|
5
|
+
LoadingIndicator: () => /* @__PURE__ */ o(r, {})
|
|
6
|
+
}), c = () => t(i);
|
|
7
|
+
export {
|
|
8
|
+
i as LoadingIndicatorContext,
|
|
9
|
+
c as useLoadingIndicator
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useLoadingIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLoadingIndicator.js","sources":["../../../src/contexts/LoadingIndicatorProvider/useLoadingIndicator.tsx"],"sourcesContent":["import type { JSX } from 'react'\nimport { createContext, useContext } from 'react'\nimport { Loading } from '@/components/Common/Loading/Loading'\n\nexport interface LoadingIndicatorContextProps {\n LoadingIndicator: () => JSX.Element\n}\nexport const LoadingIndicatorContext = createContext<LoadingIndicatorContextProps>({\n LoadingIndicator: () => <Loading />,\n})\n\nexport const useLoadingIndicator = () => useContext(LoadingIndicatorContext)\n"],"names":["LoadingIndicatorContext","createContext","jsx","Loading","useLoadingIndicator","useContext"],"mappings":";;;AAOO,MAAMA,IAA0BC,EAA4C;AAAA,EACjF,kBAAkB,MAAM,gBAAAC,EAACC,GAAQ,CAAA,CAAA;AACnC,CAAC,GAEYC,IAAsB,MAAMC,EAAWL,CAAuB;"}
|
|
@@ -67,6 +67,7 @@ export declare const companyEvents: {
|
|
|
67
67
|
readonly COMPANY_LOCATION_UPDATED: "company/location/edit/done";
|
|
68
68
|
readonly COMPANY_LOCATION_DONE: "company/location/done";
|
|
69
69
|
readonly COMPANY_BANK_ACCOUNT_CHANGE: "company/bankAccount/change";
|
|
70
|
+
readonly COMPANY_BANK_ACCOUNT_CANCEL: "company/bankAccount/cancel";
|
|
70
71
|
readonly COMPANY_BANK_ACCOUNT_CREATED: "company/bankAccount/created";
|
|
71
72
|
readonly COMPANY_BANK_ACCOUNT_VERIFY: "company/bankAccount/verify";
|
|
72
73
|
readonly COMPANY_BANK_ACCOUNT_DONE: "company/bankAccount/done";
|
|
@@ -133,6 +134,7 @@ export declare const componentEvents: {
|
|
|
133
134
|
readonly COMPANY_LOCATION_UPDATED: "company/location/edit/done";
|
|
134
135
|
readonly COMPANY_LOCATION_DONE: "company/location/done";
|
|
135
136
|
readonly COMPANY_BANK_ACCOUNT_CHANGE: "company/bankAccount/change";
|
|
137
|
+
readonly COMPANY_BANK_ACCOUNT_CANCEL: "company/bankAccount/cancel";
|
|
136
138
|
readonly COMPANY_BANK_ACCOUNT_CREATED: "company/bankAccount/created";
|
|
137
139
|
readonly COMPANY_BANK_ACCOUNT_VERIFY: "company/bankAccount/verify";
|
|
138
140
|
readonly COMPANY_BANK_ACCOUNT_DONE: "company/bankAccount/done";
|