@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,16 +5,17 @@ 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 [x, d] = o(
|
|
14
15
|
"CompanyDocumentListContext"
|
|
15
16
|
);
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
d as LocationsListProvider,
|
|
19
|
+
x as useLocationsList
|
|
19
20
|
};
|
|
20
21
|
//# sourceMappingURL=useLocationsList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocationsList.js","sources":["../../../../../src/components/Company/Locations/LocationsList/useLocationsList.ts"],"sourcesContent":["import { type Location } from '@gusto/embedded-api/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\n\ntype LocationsListContextType = {\n locationList: Location[]\n totalPages: number\n currentPage: number\n handleItemsPerPageChange: (n: number) => void\n handleFirstPage: () => void\n handlePreviousPage: () => void\n handleNextPage: () => void\n handleLastPage: () => void\n handleEditLocation: (uuid: string) => void\n handleAddLocation: () => void\n handleContinue: () => void\n}\n\nconst [useLocationsList, LocationsListProvider] = createCompoundContext<LocationsListContextType>(\n 'CompanyDocumentListContext',\n)\n\nexport { useLocationsList, LocationsListProvider }\n"],"names":["useLocationsList","LocationsListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLocationsList.js","sources":["../../../../../src/components/Company/Locations/LocationsList/useLocationsList.ts"],"sourcesContent":["import { type Location } from '@gusto/embedded-api/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\n\ntype LocationsListContextType = {\n locationList: Location[]\n totalPages: number\n currentPage: number\n handleItemsPerPageChange: (n: number) => void\n handleFirstPage: () => void\n handlePreviousPage: () => void\n handleNextPage: () => void\n handleLastPage: () => void\n handleEditLocation: (uuid: string) => void\n handleAddLocation: () => void\n handleContinue: () => void\n}\n\nconst [useLocationsList, LocationsListProvider] = createCompoundContext<LocationsListContextType>(\n 'CompanyDocumentListContext',\n)\n\nexport { useLocationsList, LocationsListProvider }\n"],"names":["useLocationsList","LocationsListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;AAiBM,MAAA,CAACA,GAAkBC,CAAqB,IAAIC;AAAA,EAChD;AACF;"}
|
|
@@ -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 [w, x] = o("OnboardingOverviewContext");
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
x as OnboardingOverviewProvider,
|
|
17
|
+
w as useOnboardingOverview
|
|
17
18
|
};
|
|
18
19
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../../src/components/Company/OnboardingOverview/context.ts"],"sourcesContent":["import type { OnboardingStep } from '@gusto/embedded-api/models/components/companyonboardingstatus'\nimport { createCompoundContext } from '@/components/Base'\n\ntype OnboardingOverviewContextType = {\n onboardingCompleted?: boolean\n onboardingSteps?: OnboardingStep[]\n handleDone: () => void\n handleContinue: () => void\n}\n\nconst [useOnboardingOverview, OnboardingOverviewProvider] =\n createCompoundContext<OnboardingOverviewContextType>('OnboardingOverviewContext')\n\nexport { useOnboardingOverview, OnboardingOverviewProvider }\n"],"names":["useOnboardingOverview","OnboardingOverviewProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../src/components/Company/OnboardingOverview/context.ts"],"sourcesContent":["import type { OnboardingStep } from '@gusto/embedded-api/models/components/companyonboardingstatus'\nimport { createCompoundContext } from '@/components/Base'\n\ntype OnboardingOverviewContextType = {\n onboardingCompleted?: boolean\n onboardingSteps?: OnboardingStep[]\n handleDone: () => void\n handleContinue: () => void\n}\n\nconst [useOnboardingOverview, OnboardingOverviewProvider] =\n createCompoundContext<OnboardingOverviewContextType>('OnboardingOverviewContext')\n\nexport { useOnboardingOverview, OnboardingOverviewProvider }\n"],"names":["useOnboardingOverview","OnboardingOverviewProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAuBC,CAA0B,IACtDC,EAAqD,2BAA2B;"}
|
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
import { jsx as t, jsxs as k } from "react/jsx-runtime";
|
|
2
|
-
import { useForm as
|
|
2
|
+
import { useForm as G, FormProvider as z } from "react-hook-form";
|
|
3
3
|
import { zodResolver as J } from "@hookform/resolvers/zod";
|
|
4
4
|
import { useState as p, useEffect as w } from "react";
|
|
5
5
|
import { usePaySchedulesGetPreview as K } from "@gusto/embedded-api/react-query/paySchedulesGetPreview";
|
|
6
|
-
import { usePaySchedulesUpdateMutation as
|
|
7
|
-
import { usePaySchedulesGetAllSuspense as
|
|
8
|
-
import { usePaySchedulesCreateMutation as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { List as _ } from "./_parts/List.js";
|
|
6
|
+
import { usePaySchedulesUpdateMutation as Q } from "@gusto/embedded-api/react-query/paySchedulesUpdate";
|
|
7
|
+
import { usePaySchedulesGetAllSuspense as W } from "@gusto/embedded-api/react-query/paySchedulesGetAll";
|
|
8
|
+
import { usePaySchedulesCreateMutation as X } from "@gusto/embedded-api/react-query/paySchedulesCreate";
|
|
9
|
+
import { PayScheduleSchema as Z, PayScheduleProvider as $ } from "./usePaySchedule.js";
|
|
10
|
+
import { Form as V } from "../../Common/Form/Form.js";
|
|
11
|
+
import { BaseComponent as ee } from "../../Base/Base.js";
|
|
12
|
+
import { useBase as oe } from "../../Base/useBase.js";
|
|
13
|
+
import { Flex as re } from "../../Common/Flex/Flex.js";
|
|
14
|
+
import { useI18n as ae, useComponentDictionary as te } from "../../../i18n/I18n.js";
|
|
15
|
+
import { componentEvents as q } from "../../../shared/constants.js";
|
|
16
|
+
import { formatDateToStringDate as ne } from "../../../helpers/dateFormatting.js";
|
|
17
|
+
import { Head as _ } from "./_parts/Head.js";
|
|
18
|
+
import { List as C } from "./_parts/List.js";
|
|
20
19
|
import { Edit as L } from "./_parts/Edit.js";
|
|
21
20
|
import { Actions as O } from "./_parts/Actions.js";
|
|
22
21
|
const f = ({
|
|
23
22
|
companyId: n,
|
|
24
23
|
defaultValues: P,
|
|
25
|
-
dictionary:
|
|
24
|
+
dictionary: a,
|
|
26
25
|
...m
|
|
27
|
-
}) => (
|
|
28
|
-
const
|
|
29
|
-
frequency:
|
|
30
|
-
anchorPayDate:
|
|
31
|
-
anchorEndOfPayPeriod:
|
|
32
|
-
day1:
|
|
33
|
-
day2:
|
|
34
|
-
customName:
|
|
26
|
+
}) => (ae("Company.PaySchedule"), te("Company.PaySchedule", a), /* @__PURE__ */ t(ee, { ...m, children: /* @__PURE__ */ t(ce, { companyId: n, defaultValues: P, children: m.children }) })), ce = ({ companyId: n, children: P, defaultValues: a }) => {
|
|
27
|
+
const { baseSubmitHandler: m, onEvent: E, fieldErrors: D } = oe(), [S, u] = p("LIST_PAY_SCHEDULES"), [i, T] = p(null), H = {
|
|
28
|
+
frequency: a?.frequency ?? "Every week",
|
|
29
|
+
anchorPayDate: a?.anchorPayDate ? new Date(a.anchorPayDate) : void 0,
|
|
30
|
+
anchorEndOfPayPeriod: a?.anchorEndOfPayPeriod ? new Date(a.anchorEndOfPayPeriod) : void 0,
|
|
31
|
+
day1: a?.day1 ?? void 0,
|
|
32
|
+
day2: a?.day2 ?? void 0,
|
|
33
|
+
customName: a?.customName ?? "",
|
|
35
34
|
customTwicePerMonth: "false",
|
|
36
35
|
payPeriodPreviewRange: 0
|
|
37
|
-
}, [d, y] = p(null), { data:
|
|
36
|
+
}, [d, y] = p(null), { data: M, isLoading: U } = K(
|
|
38
37
|
{
|
|
39
38
|
companyId: n,
|
|
40
39
|
frequency: d?.frequency,
|
|
@@ -47,18 +46,18 @@ const f = ({
|
|
|
47
46
|
enabled: !0
|
|
48
47
|
}
|
|
49
48
|
// Casting to non-null because we know it's not null from the enabled prop
|
|
50
|
-
), { data:
|
|
49
|
+
), { data: Y } = W({
|
|
51
50
|
companyId: n
|
|
52
|
-
}),
|
|
53
|
-
resolver: J(
|
|
54
|
-
defaultValues:
|
|
55
|
-
}), { watch:
|
|
51
|
+
}), N = X(), g = Q(), l = G({
|
|
52
|
+
resolver: J(Z),
|
|
53
|
+
defaultValues: H
|
|
54
|
+
}), { watch: b, setValue: v, reset: s, setError: A } = l;
|
|
56
55
|
w(() => {
|
|
57
56
|
D && D.forEach((o) => {
|
|
58
|
-
|
|
57
|
+
A(o.key, { message: o.message });
|
|
59
58
|
});
|
|
60
|
-
}, [
|
|
61
|
-
const e =
|
|
59
|
+
}, [A, D]);
|
|
60
|
+
const e = b();
|
|
62
61
|
w(() => {
|
|
63
62
|
e.frequency === "Twice per month" && e.day1 === 15 && e.day2 === 31 && e.customTwicePerMonth === void 0 ? v("customTwicePerMonth", "1st15th") : e.frequency === "Twice per month" && e.customTwicePerMonth === void 0 && v("customTwicePerMonth", "custom");
|
|
64
63
|
}, [e.frequency, e.day1, e.day2, v, e.customTwicePerMonth]), w(() => {
|
|
@@ -81,11 +80,11 @@ const f = ({
|
|
|
81
80
|
i?.version,
|
|
82
81
|
y
|
|
83
82
|
]);
|
|
84
|
-
const
|
|
83
|
+
const R = () => {
|
|
85
84
|
u("ADD_PAY_SCHEDULE"), s({});
|
|
86
|
-
},
|
|
85
|
+
}, x = () => {
|
|
87
86
|
u("LIST_PAY_SCHEDULES"), s({}), y(null);
|
|
88
|
-
},
|
|
87
|
+
}, B = (o) => {
|
|
89
88
|
s({
|
|
90
89
|
frequency: o.frequency,
|
|
91
90
|
anchorPayDate: o.anchorPayDate ? new Date(o.anchorPayDate) : void 0,
|
|
@@ -93,74 +92,74 @@ const f = ({
|
|
|
93
92
|
day1: o.day1 ?? void 0,
|
|
94
93
|
day2: o.day2 ?? void 0,
|
|
95
94
|
customName: o.customName ?? ""
|
|
96
|
-
}),
|
|
97
|
-
},
|
|
98
|
-
E(
|
|
99
|
-
},
|
|
100
|
-
await
|
|
101
|
-
const h = (c) => c &&
|
|
95
|
+
}), T(o), u("EDIT_PAY_SCHEDULE");
|
|
96
|
+
}, F = () => {
|
|
97
|
+
E(q.PAY_SCHEDULE_DONE);
|
|
98
|
+
}, j = async (o) => {
|
|
99
|
+
await m(o, async (r) => {
|
|
100
|
+
const h = (c) => c && ne(c) || "";
|
|
102
101
|
if (S === "ADD_PAY_SCHEDULE") {
|
|
103
|
-
const c = await
|
|
102
|
+
const c = await N.mutateAsync({
|
|
104
103
|
request: {
|
|
105
104
|
companyId: n,
|
|
106
105
|
requestBody: {
|
|
107
|
-
frequency:
|
|
108
|
-
anchorPayDate: h(
|
|
109
|
-
anchorEndOfPayPeriod: h(
|
|
110
|
-
customName:
|
|
111
|
-
day1:
|
|
112
|
-
day2:
|
|
106
|
+
frequency: r.frequency,
|
|
107
|
+
anchorPayDate: h(r.anchorPayDate),
|
|
108
|
+
anchorEndOfPayPeriod: h(r.anchorEndOfPayPeriod),
|
|
109
|
+
customName: r.customName,
|
|
110
|
+
day1: r.day1,
|
|
111
|
+
day2: r.day2
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
});
|
|
116
|
-
E(
|
|
115
|
+
E(q.PAY_SCHEDULE_CREATED, c), s(), y(null);
|
|
117
116
|
} else if (S === "EDIT_PAY_SCHEDULE") {
|
|
118
|
-
const c = i?.version, I = await
|
|
117
|
+
const c = i?.version, I = await g.mutateAsync({
|
|
119
118
|
request: {
|
|
120
119
|
payScheduleId: i?.uuid,
|
|
121
120
|
companyId: n,
|
|
122
121
|
requestBody: {
|
|
123
|
-
frequency:
|
|
124
|
-
anchorPayDate: h(
|
|
125
|
-
anchorEndOfPayPeriod: h(
|
|
126
|
-
customName:
|
|
127
|
-
day1:
|
|
128
|
-
day2:
|
|
122
|
+
frequency: r.frequency,
|
|
123
|
+
anchorPayDate: h(r.anchorPayDate),
|
|
124
|
+
anchorEndOfPayPeriod: h(r.anchorEndOfPayPeriod),
|
|
125
|
+
customName: r.customName,
|
|
126
|
+
day1: r.day1,
|
|
127
|
+
day2: r.day2,
|
|
129
128
|
version: c
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
131
|
});
|
|
133
|
-
E(
|
|
132
|
+
E(q.PAY_SCHEDULE_UPDATED, I), s(), y(null);
|
|
134
133
|
}
|
|
135
|
-
|
|
134
|
+
u("LIST_PAY_SCHEDULES");
|
|
136
135
|
});
|
|
137
136
|
};
|
|
138
137
|
return /* @__PURE__ */ t(
|
|
139
|
-
|
|
138
|
+
$,
|
|
140
139
|
{
|
|
141
140
|
value: {
|
|
142
141
|
companyId: n,
|
|
143
|
-
handleAdd:
|
|
144
|
-
handleEdit:
|
|
145
|
-
handleCancel:
|
|
146
|
-
handleContinue:
|
|
142
|
+
handleAdd: R,
|
|
143
|
+
handleEdit: B,
|
|
144
|
+
handleCancel: x,
|
|
145
|
+
handleContinue: F,
|
|
147
146
|
mode: S,
|
|
148
|
-
paySchedules:
|
|
149
|
-
payPeriodPreview:
|
|
150
|
-
payPreviewLoading:
|
|
147
|
+
paySchedules: Y.payScheduleList,
|
|
148
|
+
payPeriodPreview: M?.object?.payPeriods,
|
|
149
|
+
payPreviewLoading: U,
|
|
151
150
|
currentPaySchedule: i
|
|
152
151
|
},
|
|
153
|
-
children: /* @__PURE__ */ t("span", { "data-testid": "pay-schedule-edit-form", children: /* @__PURE__ */ t(
|
|
154
|
-
/* @__PURE__ */ t(C, {}),
|
|
152
|
+
children: /* @__PURE__ */ t("span", { "data-testid": "pay-schedule-edit-form", children: /* @__PURE__ */ t(z, { ...l, children: /* @__PURE__ */ t(V, { onSubmit: l.handleSubmit(j), children: P || /* @__PURE__ */ k(re, { flexDirection: "column", children: [
|
|
155
153
|
/* @__PURE__ */ t(_, {}),
|
|
154
|
+
/* @__PURE__ */ t(C, {}),
|
|
156
155
|
/* @__PURE__ */ t(L, {}),
|
|
157
156
|
/* @__PURE__ */ t(O, {})
|
|
158
157
|
] }) }) }) })
|
|
159
158
|
}
|
|
160
159
|
);
|
|
161
160
|
};
|
|
162
|
-
f.Head =
|
|
163
|
-
f.List =
|
|
161
|
+
f.Head = _;
|
|
162
|
+
f.List = C;
|
|
164
163
|
f.Edit = L;
|
|
165
164
|
f.Actions = O;
|
|
166
165
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/PaySchedule.tsx"],"sourcesContent":["import type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useEffect, useState } from 'react'\nimport { usePaySchedulesGetPreview } from '@gusto/embedded-api/react-query/paySchedulesGetPreview'\nimport { usePaySchedulesUpdateMutation } from '@gusto/embedded-api/react-query/paySchedulesUpdate'\nimport {\n usePaySchedulesGetAllSuspense,\n invalidateAllPaySchedulesGetAll,\n} from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport { usePaySchedulesCreateMutation } from '@gusto/embedded-api/react-query/paySchedulesCreate'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { useQueryClient } from '@tanstack/react-query'\nimport type { Frequency } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayschedules'\nimport type { MODE, PayScheduleInputs, PayScheduleOutputs } from './usePaySchedule'\nimport {\n PayScheduleProvider,\n PayScheduleSchema,\n type PayScheduleDefaultValues,\n} from './usePaySchedule'\nimport { Actions, Edit, Head, List } from './_parts'\nimport { Form } from '@/components/Common/Form'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface PayScheduleProps extends CommonComponentInterface<'Company.PaySchedule'> {\n companyId: string\n defaultValues?: PayScheduleDefaultValues\n}\n\nexport const PaySchedule = ({\n companyId,\n defaultValues,\n dictionary,\n ...props\n}: PayScheduleProps & BaseComponentInterface) => {\n useI18n('Company.PaySchedule')\n useComponentDictionary('Company.PaySchedule', dictionary)\n return (\n <BaseComponent {...props}>\n <Root companyId={companyId} defaultValues={defaultValues}>\n {props.children}\n </Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ companyId, children, defaultValues }: PayScheduleProps) => {\n const queryClient = useQueryClient()\n const { baseSubmitHandler, onEvent, fieldErrors } = useBase()\n const [mode, setMode] = useState<MODE>('LIST_PAY_SCHEDULES')\n const [currentPaySchedule, setCurrentPaySchedule] = useState<PayScheduleType | null>(null)\n const transformedDefaultValues: PayScheduleInputs = {\n frequency: defaultValues?.frequency ?? 'Every week',\n anchorPayDate: defaultValues?.anchorPayDate ? new Date(defaultValues.anchorPayDate) : undefined,\n anchorEndOfPayPeriod: defaultValues?.anchorEndOfPayPeriod\n ? new Date(defaultValues.anchorEndOfPayPeriod)\n : undefined,\n day1: defaultValues?.day1 ?? undefined,\n day2: defaultValues?.day2 ?? undefined,\n customName: defaultValues?.customName ?? '',\n customTwicePerMonth: 'false',\n payPeriodPreviewRange: 0,\n }\n\n const [payScheduleDraft, setPayScheduleDraft] = useState<PayScheduleType | null>(null)\n const { data: payPreviewData, isLoading } = usePaySchedulesGetPreview(\n {\n companyId,\n frequency: payScheduleDraft?.frequency as Frequency,\n anchorPayDate: payScheduleDraft?.anchorPayDate ?? '',\n anchorEndOfPayPeriod: payScheduleDraft?.anchorEndOfPayPeriod ?? '',\n day1: payScheduleDraft?.day1 ?? undefined,\n day2: payScheduleDraft?.day2 ?? undefined,\n },\n {\n enabled: true,\n }, // Casting to non-null because we know it's not null from the enabled prop\n )\n\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({\n companyId,\n })\n\n const createPayScheduleMutation = usePaySchedulesCreateMutation()\n const updatePayScheduleMutation = usePaySchedulesUpdateMutation()\n\n const formMethods = useForm<PayScheduleInputs, unknown, PayScheduleOutputs>({\n resolver: zodResolver(PayScheduleSchema),\n defaultValues: transformedDefaultValues,\n })\n const { watch, setValue, reset, setError } = formMethods\n\n useEffect(() => {\n if (fieldErrors) {\n // TODO: These error messages are not being localized correctly\n fieldErrors.forEach(error => {\n setError(error.key as keyof PayScheduleInputs, { message: error.message })\n })\n }\n }, [setError, fieldErrors])\n\n const allValues = watch()\n\n // Set the custom_twice_per_month value based on the frequency and day_1 and day_2 values as it is not set by the API call\n useEffect(() => {\n if (\n allValues.frequency === 'Twice per month' &&\n allValues.day1 === 15 &&\n allValues.day2 === 31 &&\n allValues.customTwicePerMonth === undefined\n ) {\n setValue('customTwicePerMonth', `1st15th`)\n } else if (\n allValues.frequency === 'Twice per month' &&\n allValues.customTwicePerMonth === undefined\n ) {\n setValue('customTwicePerMonth', `custom`)\n }\n }, [allValues.frequency, allValues.day1, allValues.day2, setValue, allValues.customTwicePerMonth])\n\n useEffect(() => {\n // Don't update if dates are not set\n if (!allValues.anchorPayDate || !allValues.anchorEndOfPayPeriod) {\n return\n }\n\n setPayScheduleDraft({\n frequency: allValues.frequency,\n anchorPayDate: allValues.anchorPayDate.toString(),\n anchorEndOfPayPeriod: allValues.anchorEndOfPayPeriod.toString(),\n day1: allValues.day1 || undefined,\n day2: allValues.day2 || undefined,\n uuid: '',\n version: currentPaySchedule?.version || '', //TODO: This needs to be set to something\n })\n }, [\n allValues.anchorEndOfPayPeriod,\n allValues.anchorPayDate,\n allValues.day1,\n allValues.day2,\n allValues.frequency,\n currentPaySchedule?.version,\n setPayScheduleDraft,\n ])\n\n // Custom effect to show/hide pay schedule preview errors\n\n const handleAdd = () => {\n setMode('ADD_PAY_SCHEDULE')\n reset({})\n }\n const handleCancel = () => {\n setMode('LIST_PAY_SCHEDULES')\n reset({})\n setPayScheduleDraft(null)\n }\n const handleEdit = (schedule: PayScheduleType) => {\n reset({\n frequency: schedule.frequency as Frequency,\n anchorPayDate: schedule.anchorPayDate ? new Date(schedule.anchorPayDate) : undefined,\n anchorEndOfPayPeriod: schedule.anchorEndOfPayPeriod\n ? new Date(schedule.anchorEndOfPayPeriod)\n : undefined,\n day1: schedule.day1 ?? undefined,\n day2: schedule.day2 ?? undefined,\n customName: schedule.customName ?? '',\n })\n setCurrentPaySchedule(schedule)\n setMode('EDIT_PAY_SCHEDULE')\n }\n const handleContinue = () => {\n onEvent(componentEvents.PAY_SCHEDULE_DONE)\n }\n const onSubmit: SubmitHandler<PayScheduleOutputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const formatPayloadDate = (date: Date | undefined): string => {\n return date ? formatDateToStringDate(date) || '' : ''\n }\n\n if (mode === 'ADD_PAY_SCHEDULE') {\n const createPayScheduleResponse = await createPayScheduleMutation.mutateAsync({\n request: {\n companyId: companyId,\n requestBody: {\n frequency: payload.frequency,\n anchorPayDate: formatPayloadDate(payload.anchorPayDate),\n anchorEndOfPayPeriod: formatPayloadDate(payload.anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1,\n day2: payload.day2,\n },\n },\n })\n onEvent(componentEvents.PAY_SCHEDULE_CREATED, createPayScheduleResponse)\n reset()\n setPayScheduleDraft(null)\n } else if (mode === 'EDIT_PAY_SCHEDULE') {\n const version = currentPaySchedule?.version\n const updatePayScheduleResponse = await updatePayScheduleMutation.mutateAsync({\n request: {\n payScheduleId: currentPaySchedule?.uuid as string,\n companyId: companyId,\n requestBody: {\n frequency: payload.frequency,\n anchorPayDate: formatPayloadDate(payload.anchorPayDate),\n anchorEndOfPayPeriod: formatPayloadDate(payload.anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1,\n day2: payload.day2,\n version: version as string,\n },\n },\n })\n onEvent(componentEvents.PAY_SCHEDULE_UPDATED, updatePayScheduleResponse)\n reset()\n setPayScheduleDraft(null)\n }\n await invalidateAllPaySchedulesGetAll(queryClient)\n setMode('LIST_PAY_SCHEDULES')\n })\n }\n\n return (\n <PayScheduleProvider\n value={{\n companyId,\n handleAdd,\n handleEdit,\n handleCancel,\n handleContinue,\n mode,\n paySchedules: paySchedules.payScheduleList,\n payPeriodPreview: payPreviewData?.object?.payPeriods,\n payPreviewLoading: isLoading,\n currentPaySchedule,\n }}\n >\n <span data-testid=\"pay-schedule-edit-form\">\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Edit />\n <Actions />\n </Flex>\n )}\n </Form>\n </FormProvider>\n </span>\n </PayScheduleProvider>\n )\n}\n\nPaySchedule.Head = Head\nPaySchedule.List = List\nPaySchedule.Edit = Edit\nPaySchedule.Actions = Actions\n"],"names":["PaySchedule","companyId","defaultValues","dictionary","props","useI18n","useComponentDictionary","jsx","BaseComponent","Root","children","queryClient","useQueryClient","baseSubmitHandler","onEvent","fieldErrors","useBase","mode","setMode","useState","currentPaySchedule","setCurrentPaySchedule","transformedDefaultValues","payScheduleDraft","setPayScheduleDraft","payPreviewData","isLoading","usePaySchedulesGetPreview","paySchedules","usePaySchedulesGetAllSuspense","createPayScheduleMutation","usePaySchedulesCreateMutation","updatePayScheduleMutation","usePaySchedulesUpdateMutation","formMethods","useForm","zodResolver","PayScheduleSchema","watch","setValue","reset","setError","useEffect","error","allValues","handleAdd","handleCancel","handleEdit","schedule","handleContinue","componentEvents","onSubmit","data","payload","formatPayloadDate","date","formatDateToStringDate","createPayScheduleResponse","version","updatePayScheduleResponse","invalidateAllPaySchedulesGetAll","PayScheduleProvider","FormProvider","Form","jsxs","Flex","Head","List","Edit","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmCO,MAAMA,IAAc,CAAC;AAAA,EAC1B,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,OACEC,GAAQ,qBAAqB,GAC7BC,GAAuB,uBAAuBH,CAAU,GAEtD,gBAAAI,EAACC,IAAe,EAAA,GAAGJ,GACjB,UAAA,gBAAAG,EAACE,MAAK,WAAAR,GAAsB,eAAAC,GACzB,UAAME,EAAA,SAAA,CACT,EACF,CAAA,IAIEK,KAAO,CAAC,EAAE,WAAAR,GAAW,UAAAS,GAAU,eAAAR,QAAsC;AACzE,QAAMS,IAAcC,EAAe,GAC7B,EAAE,mBAAAC,GAAmB,SAAAC,GAAS,aAAAC,EAAA,IAAgBC,GAAQ,GACtD,CAACC,GAAMC,CAAO,IAAIC,EAAe,oBAAoB,GACrD,CAACC,GAAoBC,CAAqB,IAAIF,EAAiC,IAAI,GACnFG,IAA8C;AAAA,IAClD,WAAWpB,GAAe,aAAa;AAAA,IACvC,eAAeA,GAAe,gBAAgB,I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AMoC,EAAgCjD,CAAW,GACjDO,EAAQ,oBAAoB;AAAA,IAAA,CAC7B;AAAA,EACH;AAGE,SAAA,gBAAAX;AAAA,IAACsD;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,WAAA5D;AAAA,QACA,WAAA4C;AAAA,QACA,YAAAE;AAAA,QACA,cAAAD;AAAA,QACA,gBAAAG;AAAA,QACA,MAAAhC;AAAA,QACA,cAAcW,EAAa;AAAA,QAC3B,kBAAkBH,GAAgB,QAAQ;AAAA,QAC1C,mBAAmBC;AAAA,QACnB,oBAAAN;AAAA,MACF;AAAA,MAEA,UAAA,gBAAAb,EAAC,UAAK,eAAY,0BAChB,4BAACuD,GAAc,EAAA,GAAG5B,GAChB,UAAC,gBAAA3B,EAAAwD,IAAA,EAAK,UAAU7B,EAAY,aAAaiB,CAAQ,GAC9C,UAAAzC,KAGE,gBAAAsD,EAAAC,IAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAA1D,EAAC2D,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,GACX,EAAA,CAEJ,GACF,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEArE,EAAY,OAAOkE;AACnBlE,EAAY,OAAOmE;AACnBnE,EAAY,OAAOoE;AACnBpE,EAAY,UAAUqE;"}
|
|
1
|
+
{"version":3,"file":"PaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/PaySchedule.tsx"],"sourcesContent":["import type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useEffect, useState } from 'react'\nimport { usePaySchedulesGetPreview } from '@gusto/embedded-api/react-query/paySchedulesGetPreview'\nimport { usePaySchedulesUpdateMutation } from '@gusto/embedded-api/react-query/paySchedulesUpdate'\nimport { usePaySchedulesGetAllSuspense } from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport { usePaySchedulesCreateMutation } from '@gusto/embedded-api/react-query/paySchedulesCreate'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { Frequency } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayschedules'\nimport type { MODE, PayScheduleInputs, PayScheduleOutputs } from './usePaySchedule'\nimport {\n PayScheduleProvider,\n PayScheduleSchema,\n type PayScheduleDefaultValues,\n} from './usePaySchedule'\nimport { Actions, Edit, Head, List } from './_parts'\nimport { Form } from '@/components/Common/Form'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface PayScheduleProps extends CommonComponentInterface<'Company.PaySchedule'> {\n companyId: string\n defaultValues?: PayScheduleDefaultValues\n}\n\nexport const PaySchedule = ({\n companyId,\n defaultValues,\n dictionary,\n ...props\n}: PayScheduleProps & BaseComponentInterface) => {\n useI18n('Company.PaySchedule')\n useComponentDictionary('Company.PaySchedule', dictionary)\n return (\n <BaseComponent {...props}>\n <Root companyId={companyId} defaultValues={defaultValues}>\n {props.children}\n </Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ companyId, children, defaultValues }: PayScheduleProps) => {\n const { baseSubmitHandler, onEvent, fieldErrors } = useBase()\n const [mode, setMode] = useState<MODE>('LIST_PAY_SCHEDULES')\n const [currentPaySchedule, setCurrentPaySchedule] = useState<PayScheduleType | null>(null)\n const transformedDefaultValues: PayScheduleInputs = {\n frequency: defaultValues?.frequency ?? 'Every week',\n anchorPayDate: defaultValues?.anchorPayDate ? new Date(defaultValues.anchorPayDate) : undefined,\n anchorEndOfPayPeriod: defaultValues?.anchorEndOfPayPeriod\n ? new Date(defaultValues.anchorEndOfPayPeriod)\n : undefined,\n day1: defaultValues?.day1 ?? undefined,\n day2: defaultValues?.day2 ?? undefined,\n customName: defaultValues?.customName ?? '',\n customTwicePerMonth: 'false',\n payPeriodPreviewRange: 0,\n }\n\n const [payScheduleDraft, setPayScheduleDraft] = useState<PayScheduleType | null>(null)\n const { data: payPreviewData, isLoading } = usePaySchedulesGetPreview(\n {\n companyId,\n frequency: payScheduleDraft?.frequency as Frequency,\n anchorPayDate: payScheduleDraft?.anchorPayDate ?? '',\n anchorEndOfPayPeriod: payScheduleDraft?.anchorEndOfPayPeriod ?? '',\n day1: payScheduleDraft?.day1 ?? undefined,\n day2: payScheduleDraft?.day2 ?? undefined,\n },\n {\n enabled: true,\n }, // Casting to non-null because we know it's not null from the enabled prop\n )\n\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({\n companyId,\n })\n\n const createPayScheduleMutation = usePaySchedulesCreateMutation()\n const updatePayScheduleMutation = usePaySchedulesUpdateMutation()\n\n const formMethods = useForm<PayScheduleInputs, unknown, PayScheduleOutputs>({\n resolver: zodResolver(PayScheduleSchema),\n defaultValues: transformedDefaultValues,\n })\n const { watch, setValue, reset, setError } = formMethods\n\n useEffect(() => {\n if (fieldErrors) {\n // TODO: These error messages are not being localized correctly\n fieldErrors.forEach(error => {\n setError(error.key as keyof PayScheduleInputs, { message: error.message })\n })\n }\n }, [setError, fieldErrors])\n\n const allValues = watch()\n\n // Set the custom_twice_per_month value based on the frequency and day_1 and day_2 values as it is not set by the API call\n useEffect(() => {\n if (\n allValues.frequency === 'Twice per month' &&\n allValues.day1 === 15 &&\n allValues.day2 === 31 &&\n allValues.customTwicePerMonth === undefined\n ) {\n setValue('customTwicePerMonth', `1st15th`)\n } else if (\n allValues.frequency === 'Twice per month' &&\n allValues.customTwicePerMonth === undefined\n ) {\n setValue('customTwicePerMonth', `custom`)\n }\n }, [allValues.frequency, allValues.day1, allValues.day2, setValue, allValues.customTwicePerMonth])\n\n useEffect(() => {\n // Don't update if dates are not set\n if (!allValues.anchorPayDate || !allValues.anchorEndOfPayPeriod) {\n return\n }\n\n setPayScheduleDraft({\n frequency: allValues.frequency,\n anchorPayDate: allValues.anchorPayDate.toString(),\n anchorEndOfPayPeriod: allValues.anchorEndOfPayPeriod.toString(),\n day1: allValues.day1 || undefined,\n day2: allValues.day2 || undefined,\n uuid: '',\n version: currentPaySchedule?.version || '', //TODO: This needs to be set to something\n })\n }, [\n allValues.anchorEndOfPayPeriod,\n allValues.anchorPayDate,\n allValues.day1,\n allValues.day2,\n allValues.frequency,\n currentPaySchedule?.version,\n setPayScheduleDraft,\n ])\n\n // Custom effect to show/hide pay schedule preview errors\n\n const handleAdd = () => {\n setMode('ADD_PAY_SCHEDULE')\n reset({})\n }\n const handleCancel = () => {\n setMode('LIST_PAY_SCHEDULES')\n reset({})\n setPayScheduleDraft(null)\n }\n const handleEdit = (schedule: PayScheduleType) => {\n reset({\n frequency: schedule.frequency as Frequency,\n anchorPayDate: schedule.anchorPayDate ? new Date(schedule.anchorPayDate) : undefined,\n anchorEndOfPayPeriod: schedule.anchorEndOfPayPeriod\n ? new Date(schedule.anchorEndOfPayPeriod)\n : undefined,\n day1: schedule.day1 ?? undefined,\n day2: schedule.day2 ?? undefined,\n customName: schedule.customName ?? '',\n })\n setCurrentPaySchedule(schedule)\n setMode('EDIT_PAY_SCHEDULE')\n }\n const handleContinue = () => {\n onEvent(componentEvents.PAY_SCHEDULE_DONE)\n }\n const onSubmit: SubmitHandler<PayScheduleOutputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const formatPayloadDate = (date: Date | undefined): string => {\n return date ? formatDateToStringDate(date) || '' : ''\n }\n\n if (mode === 'ADD_PAY_SCHEDULE') {\n const createPayScheduleResponse = await createPayScheduleMutation.mutateAsync({\n request: {\n companyId: companyId,\n requestBody: {\n frequency: payload.frequency,\n anchorPayDate: formatPayloadDate(payload.anchorPayDate),\n anchorEndOfPayPeriod: formatPayloadDate(payload.anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1,\n day2: payload.day2,\n },\n },\n })\n onEvent(componentEvents.PAY_SCHEDULE_CREATED, createPayScheduleResponse)\n reset()\n setPayScheduleDraft(null)\n } else if (mode === 'EDIT_PAY_SCHEDULE') {\n const version = currentPaySchedule?.version\n const updatePayScheduleResponse = await updatePayScheduleMutation.mutateAsync({\n request: {\n payScheduleId: currentPaySchedule?.uuid as string,\n companyId: companyId,\n requestBody: {\n frequency: payload.frequency,\n anchorPayDate: formatPayloadDate(payload.anchorPayDate),\n anchorEndOfPayPeriod: formatPayloadDate(payload.anchorEndOfPayPeriod),\n customName: payload.customName,\n day1: payload.day1,\n day2: payload.day2,\n version: version as string,\n },\n },\n })\n onEvent(componentEvents.PAY_SCHEDULE_UPDATED, updatePayScheduleResponse)\n reset()\n setPayScheduleDraft(null)\n }\n setMode('LIST_PAY_SCHEDULES')\n })\n }\n\n return (\n <PayScheduleProvider\n value={{\n companyId,\n handleAdd,\n handleEdit,\n handleCancel,\n handleContinue,\n mode,\n paySchedules: paySchedules.payScheduleList,\n payPeriodPreview: payPreviewData?.object?.payPeriods,\n payPreviewLoading: isLoading,\n currentPaySchedule,\n }}\n >\n <span data-testid=\"pay-schedule-edit-form\">\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Edit />\n <Actions />\n </Flex>\n )}\n </Form>\n </FormProvider>\n </span>\n </PayScheduleProvider>\n )\n}\n\nPaySchedule.Head = Head\nPaySchedule.List = List\nPaySchedule.Edit = Edit\nPaySchedule.Actions = Actions\n"],"names":["PaySchedule","companyId","defaultValues","dictionary","props","useI18n","useComponentDictionary","jsx","BaseComponent","Root","children","baseSubmitHandler","onEvent","fieldErrors","useBase","mode","setMode","useState","currentPaySchedule","setCurrentPaySchedule","transformedDefaultValues","payScheduleDraft","setPayScheduleDraft","payPreviewData","isLoading","usePaySchedulesGetPreview","paySchedules","usePaySchedulesGetAllSuspense","createPayScheduleMutation","usePaySchedulesCreateMutation","updatePayScheduleMutation","usePaySchedulesUpdateMutation","formMethods","useForm","zodResolver","PayScheduleSchema","watch","setValue","reset","setError","useEffect","error","allValues","handleAdd","handleCancel","handleEdit","schedule","handleContinue","componentEvents","onSubmit","data","payload","formatPayloadDate","date","formatDateToStringDate","createPayScheduleResponse","version","updatePayScheduleResponse","PayScheduleProvider","FormProvider","Form","jsxs","Flex","Head","List","Edit","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+BO,MAAMA,IAAc,CAAC;AAAA,EAC1B,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,OACEC,GAAQ,qBAAqB,GAC7BC,GAAuB,uBAAuBH,CAAU,GAEtD,gBAAAI,EAACC,IAAe,EAAA,GAAGJ,GACjB,UAAA,gBAAAG,EAACE,MAAK,WAAAR,GAAsB,eAAAC,GACzB,UAAME,EAAA,SAAA,CACT,EACF,CAAA,IAIEK,KAAO,CAAC,EAAE,WAAAR,GAAW,UAAAS,GAAU,eAAAR,QAAsC;AACzE,QAAM,EAAE,mBAAAS,GAAmB,SAAAC,GAAS,aAAAC,EAAA,IAAgBC,GAAQ,GACtD,CAACC,GAAMC,CAAO,IAAIC,EAAe,oBAAoB,GACrD,CAACC,GAAoBC,CAAqB,IAAIF,EAAiC,IAAI,GACnFG,IAA8C;AAAA,IAClD,WAAWlB,GAAe,aAAa;AAAA,IACvC,eAAeA,GAAe,gBAAgB,IAAI,KAAKA,EAAc,aAAa,IAAI;AAAA,IACtF,sBAAsBA,GAAe,uBACjC,IAAI,KAAKA,EAAc,oBAAoB,IAC3C;AAAA,IACJ,MAAMA,GAAe,QAAQ;AAAA,IAC7B,MAAMA,GAAe,QAAQ;AAAA,IAC7B,YAAYA,GAAe,cAAc;AAAA,IACzC,qBAAqB;AAAA,IACrB,uBAAuB;AAAA,EACzB,GAEM,CAACmB,GAAkBC,CAAmB,IAAIL,EA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AA,QAC1C,mBAAmBC;AAAA,QACnB,oBAAAN;AAAA,MACF;AAAA,MAEA,UAAA,gBAAAX,EAAC,UAAK,eAAY,0BAChB,4BAACoD,GAAc,EAAA,GAAG3B,GAChB,UAAC,gBAAAzB,EAAAqD,GAAA,EAAK,UAAU5B,EAAY,aAAaiB,CAAQ,GAC9C,UAAAvC,KAGE,gBAAAmD,EAAAC,IAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAAvD,EAACwD,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,GACX,EAAA,CAEJ,GACF,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEAlE,EAAY,OAAO+D;AACnB/D,EAAY,OAAOgE;AACnBhE,EAAY,OAAOiE;AACnBjE,EAAY,UAAUkE;"}
|
|
@@ -6,12 +6,13 @@ import "react-i18next";
|
|
|
6
6
|
import "@gusto/embedded-api/models/errors/apierror";
|
|
7
7
|
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
8
8
|
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
9
|
+
import "@tanstack/react-query";
|
|
9
10
|
import "../../Base/useBase.js";
|
|
10
11
|
import "../../../shared/constants.js";
|
|
11
12
|
import "dompurify";
|
|
12
13
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
14
|
import { createCompoundContext as e } from "../../Base/createCompoundContext.js";
|
|
14
|
-
const
|
|
15
|
+
const s = o.object({
|
|
15
16
|
frequency: o.enum(["Every week", "Every other week", "Twice per month", "Monthly"]),
|
|
16
17
|
anchorPayDate: o.date().optional(),
|
|
17
18
|
anchorEndOfPayPeriod: o.date().optional(),
|
|
@@ -20,10 +21,10 @@ const P = o.object({
|
|
|
20
21
|
customName: o.string().optional(),
|
|
21
22
|
customTwicePerMonth: o.string().optional(),
|
|
22
23
|
payPeriodPreviewRange: o.number().optional()
|
|
23
|
-
}), [
|
|
24
|
+
}), [w, x] = e("PayScheduleContext");
|
|
24
25
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
x as PayScheduleProvider,
|
|
27
|
+
s as PayScheduleSchema,
|
|
28
|
+
w as usePaySchedule
|
|
28
29
|
};
|
|
29
30
|
//# sourceMappingURL=usePaySchedule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/usePaySchedule.ts"],"sourcesContent":["import type { PayScheduleCreateUpdate } from '@gusto/embedded-api/models/components/payschedulecreateupdate'\nimport type { PayScheduleList } from '@gusto/embedded-api/models/components/payschedulelist'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { PayPeriods } from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayschedulespreview'\nimport { z } from 'zod'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport { createCompoundContext } from '@/components/Base'\n\nexport type MODE =\n | 'LIST_PAY_SCHEDULES'\n | 'ADD_PAY_SCHEDULE'\n | 'EDIT_PAY_SCHEDULE'\n | 'PREVIEW_PAY_SCHEDULE'\n\ntype PayScheduleContextType = {\n companyId: string\n handleAdd: () => void\n handleEdit: (schedule: PayScheduleType) => void\n handleCancel: () => void\n handleContinue: () => void\n mode: MODE\n paySchedules: PayScheduleList[] | undefined | null\n currentPaySchedule: PayScheduleType | undefined | null\n payPeriodPreview?: PayPeriods[]\n payPreviewLoading?: boolean\n}\n\nexport const PayScheduleSchema = z.object({\n frequency: z.enum(['Every week', 'Every other week', 'Twice per month', 'Monthly']),\n anchorPayDate: z.date().optional(),\n anchorEndOfPayPeriod: z.date().optional(),\n day1: z.number().min(1).max(31).optional(),\n day2: z.number().min(1).max(31).optional(),\n customName: z.string().optional(),\n customTwicePerMonth: z.string().optional(),\n payPeriodPreviewRange: z.number().optional(),\n})\n\nexport type PayScheduleInputs = z.input<typeof PayScheduleSchema>\nexport type PayScheduleOutputs = z.output<typeof PayScheduleSchema>\n\nexport type PayScheduleDefaultValues = RequireAtLeastOne<\n Partial<\n Pick<\n PayScheduleCreateUpdate,\n 'anchorPayDate' | 'anchorEndOfPayPeriod' | 'day1' | 'day2' | 'customName' | 'frequency'\n >\n >\n>\n\nconst [usePaySchedule, PayScheduleProvider] =\n createCompoundContext<PayScheduleContextType>('PayScheduleContext')\nexport { usePaySchedule, PayScheduleProvider }\n"],"names":["PayScheduleSchema","z","usePaySchedule","PayScheduleProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/usePaySchedule.ts"],"sourcesContent":["import type { PayScheduleCreateUpdate } from '@gusto/embedded-api/models/components/payschedulecreateupdate'\nimport type { PayScheduleList } from '@gusto/embedded-api/models/components/payschedulelist'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { PayPeriods } from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayschedulespreview'\nimport { z } from 'zod'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport { createCompoundContext } from '@/components/Base'\n\nexport type MODE =\n | 'LIST_PAY_SCHEDULES'\n | 'ADD_PAY_SCHEDULE'\n | 'EDIT_PAY_SCHEDULE'\n | 'PREVIEW_PAY_SCHEDULE'\n\ntype PayScheduleContextType = {\n companyId: string\n handleAdd: () => void\n handleEdit: (schedule: PayScheduleType) => void\n handleCancel: () => void\n handleContinue: () => void\n mode: MODE\n paySchedules: PayScheduleList[] | undefined | null\n currentPaySchedule: PayScheduleType | undefined | null\n payPeriodPreview?: PayPeriods[]\n payPreviewLoading?: boolean\n}\n\nexport const PayScheduleSchema = z.object({\n frequency: z.enum(['Every week', 'Every other week', 'Twice per month', 'Monthly']),\n anchorPayDate: z.date().optional(),\n anchorEndOfPayPeriod: z.date().optional(),\n day1: z.number().min(1).max(31).optional(),\n day2: z.number().min(1).max(31).optional(),\n customName: z.string().optional(),\n customTwicePerMonth: z.string().optional(),\n payPeriodPreviewRange: z.number().optional(),\n})\n\nexport type PayScheduleInputs = z.input<typeof PayScheduleSchema>\nexport type PayScheduleOutputs = z.output<typeof PayScheduleSchema>\n\nexport type PayScheduleDefaultValues = RequireAtLeastOne<\n Partial<\n Pick<\n PayScheduleCreateUpdate,\n 'anchorPayDate' | 'anchorEndOfPayPeriod' | 'day1' | 'day2' | 'customName' | 'frequency'\n >\n >\n>\n\nconst [usePaySchedule, PayScheduleProvider] =\n createCompoundContext<PayScheduleContextType>('PayScheduleContext')\nexport { usePaySchedule, PayScheduleProvider }\n"],"names":["PayScheduleSchema","z","usePaySchedule","PayScheduleProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AA2Ba,MAAAA,IAAoBC,EAAE,OAAO;AAAA,EACxC,WAAWA,EAAE,KAAK,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,CAAC;AAAA,EAClF,eAAeA,EAAE,KAAK,EAAE,SAAS;AAAA,EACjC,sBAAsBA,EAAE,KAAK,EAAE,SAAS;AAAA,EACxC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EACzC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EACzC,YAAYA,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,qBAAqBA,EAAE,OAAO,EAAE,SAAS;AAAA,EACzC,uBAAuBA,EAAE,OAAO,EAAE,SAAS;AAC7C,CAAC,GAcK,CAACC,GAAgBC,CAAmB,IACxCC,EAA8C,oBAAoB;"}
|
|
@@ -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 t } from "../../../Base/createCompoundContext.js";
|
|
13
|
-
const [
|
|
14
|
+
const [T, c] = t("StateTaxesFormContext");
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
c as StateTaxesFormProvider,
|
|
17
|
+
T as useStateTaxesForm
|
|
17
18
|
};
|
|
18
19
|
//# 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;"}
|
|
@@ -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 t } from "../../../Base/createCompoundContext.js";
|
|
13
|
-
const [
|
|
14
|
+
const [T, c] = t("StateTaxesListContext");
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
c as StateTaxesListProvider,
|
|
17
|
+
T as useStateTaxesList
|
|
17
18
|
};
|
|
18
19
|
//# 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;"}
|
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useContractorsGetSuspense as
|
|
3
|
-
import { useContractorsGetAddressSuspense as
|
|
4
|
-
import { useContractorsUpdateAddressMutation as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Form as p } from "./Form.js";
|
|
1
|
+
import { jsx as t, jsxs as E, Fragment as P } from "react/jsx-runtime";
|
|
2
|
+
import { useContractorsGetSuspense as T } from "@gusto/embedded-api/react-query/contractorsGet";
|
|
3
|
+
import { useContractorsGetAddressSuspense as U } from "@gusto/embedded-api/react-query/contractorsGetAddress";
|
|
4
|
+
import { useContractorsUpdateAddressMutation as b } from "@gusto/embedded-api/react-query/contractorsUpdateAddress";
|
|
5
|
+
import { useForm as x, FormProvider as O } from "react-hook-form";
|
|
6
|
+
import { zodResolver as _ } from "@hookform/resolvers/zod";
|
|
7
|
+
import { AddressFormSchema as B, AddressProvider as H } from "./useAddress.js";
|
|
8
|
+
import { Head as p } from "./Head.js";
|
|
9
|
+
import { Form as u } from "./Form.js";
|
|
11
10
|
import { Actions as f } from "./Actions.js";
|
|
12
11
|
import { Form as N } from "../../Common/Form/Form.js";
|
|
13
|
-
import { useComponentDictionary as j, useI18n as
|
|
14
|
-
import { Flex as
|
|
15
|
-
import { BaseComponent as
|
|
16
|
-
import { useBase as
|
|
12
|
+
import { useComponentDictionary as j, useI18n as q } from "../../../i18n/I18n.js";
|
|
13
|
+
import { Flex as w } from "../../Common/Flex/Flex.js";
|
|
14
|
+
import { BaseComponent as G } from "../../Base/Base.js";
|
|
15
|
+
import { useBase as M } from "../../Base/useBase.js";
|
|
17
16
|
import { contractorEvents as a } from "../../../shared/constants.js";
|
|
18
17
|
function n(r) {
|
|
19
|
-
return /* @__PURE__ */ t(
|
|
18
|
+
return /* @__PURE__ */ t(G, { ...r, children: /* @__PURE__ */ t($, { ...r, children: r.children }) });
|
|
20
19
|
}
|
|
21
|
-
function
|
|
22
|
-
j("Contractor.Address",
|
|
23
|
-
const
|
|
24
|
-
street1:
|
|
25
|
-
street2:
|
|
26
|
-
city:
|
|
27
|
-
state:
|
|
28
|
-
zip:
|
|
29
|
-
}, d =
|
|
30
|
-
resolver: B
|
|
31
|
-
defaultValues:
|
|
32
|
-
}),
|
|
33
|
-
await
|
|
34
|
-
const { contractorAddress:
|
|
20
|
+
function $({ contractorId: r, defaultValues: e, children: i, className: A, dictionary: D }) {
|
|
21
|
+
j("Contractor.Address", D), q("Contractor.Address");
|
|
22
|
+
const { onEvent: c, baseSubmitHandler: h } = M(), { data: m } = T({ contractorUuid: r }), { data: C } = U({ contractorUuid: r }), { mutateAsync: S, isPending: l } = b(), v = m.contractor, F = m.contractor?.type, o = C.contractorAddress, y = {
|
|
23
|
+
street1: o?.street1 || e?.street1 || "",
|
|
24
|
+
street2: o?.street2 || e?.street2 || "",
|
|
25
|
+
city: o?.city || e?.city || "",
|
|
26
|
+
state: o?.state || e?.state || "",
|
|
27
|
+
zip: o?.zip || e?.zip || ""
|
|
28
|
+
}, d = x({
|
|
29
|
+
resolver: _(B),
|
|
30
|
+
defaultValues: y
|
|
31
|
+
}), R = async (g) => {
|
|
32
|
+
await h(g, async (s) => {
|
|
33
|
+
const { contractorAddress: z } = await S({
|
|
35
34
|
request: {
|
|
36
35
|
contractorUuid: r,
|
|
37
36
|
requestBody: {
|
|
38
|
-
version:
|
|
37
|
+
version: o?.version,
|
|
39
38
|
street1: s.street1,
|
|
40
39
|
street2: s.street2,
|
|
41
40
|
city: s.city,
|
|
@@ -44,28 +43,28 @@ function J({ contractorId: r, defaultValues: o, children: i, className: A, dicti
|
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
});
|
|
47
|
-
|
|
46
|
+
c(a.CONTRACTOR_ADDRESS_UPDATED, z), c(a.CONTRACTOR_ADDRESS_DONE);
|
|
48
47
|
});
|
|
49
48
|
};
|
|
50
49
|
return /* @__PURE__ */ t("section", { className: A, children: /* @__PURE__ */ t(
|
|
51
50
|
H,
|
|
52
51
|
{
|
|
53
52
|
value: {
|
|
54
|
-
contractor:
|
|
53
|
+
contractor: v,
|
|
55
54
|
contractorType: F,
|
|
56
|
-
address:
|
|
57
|
-
isPending:
|
|
55
|
+
address: o,
|
|
56
|
+
isPending: l
|
|
58
57
|
},
|
|
59
|
-
children: /* @__PURE__ */ t(
|
|
60
|
-
/* @__PURE__ */ t(u, {}),
|
|
58
|
+
children: /* @__PURE__ */ t(O, { ...d, children: /* @__PURE__ */ t(N, { onSubmit: d.handleSubmit(R), children: /* @__PURE__ */ t(w, { flexDirection: "column", gap: 32, children: i || /* @__PURE__ */ E(P, { children: [
|
|
61
59
|
/* @__PURE__ */ t(p, {}),
|
|
60
|
+
/* @__PURE__ */ t(u, {}),
|
|
62
61
|
/* @__PURE__ */ t(f, {})
|
|
63
62
|
] }) }) }) })
|
|
64
63
|
}
|
|
65
64
|
) });
|
|
66
65
|
}
|
|
67
|
-
n.Head =
|
|
68
|
-
n.Form =
|
|
66
|
+
n.Head = p;
|
|
67
|
+
n.Form = u;
|
|
69
68
|
n.Actions = f;
|
|
70
69
|
export {
|
|
71
70
|
n as Address,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Address.js","sources":["../../../../src/components/Contractor/Address/Address.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useContractorsGetSuspense } from '@gusto/embedded-api/react-query/contractorsGet'\nimport {
|
|
1
|
+
{"version":3,"file":"Address.js","sources":["../../../../src/components/Contractor/Address/Address.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useContractorsGetSuspense } from '@gusto/embedded-api/react-query/contractorsGet'\nimport { useContractorsGetAddressSuspense } from '@gusto/embedded-api/react-query/contractorsGetAddress'\nimport { useContractorsUpdateAddressMutation } from '@gusto/embedded-api/react-query/contractorsUpdateAddress'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { AddressFormSchema, AddressProvider } from './useAddress'\nimport { Head } from './Head'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { AddressDefaultValues, AddressFormValues } from './useAddress'\nimport { Form as HtmlForm } from '@/components/Common/Form/Form'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { Flex } from '@/components/Common'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { contractorEvents } from '@/shared/constants'\n\nexport interface AddressProps extends BaseComponentInterface<'Contractor.Address'> {\n contractorId: string\n defaultValues?: AddressDefaultValues\n children?: ReactNode\n className?: string\n}\n\nexport function Address(props: AddressProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ contractorId, defaultValues, children, className, dictionary }: AddressProps) {\n useComponentDictionary('Contractor.Address', dictionary)\n useI18n('Contractor.Address')\n\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data: contractorData } = useContractorsGetSuspense({ contractorUuid: contractorId })\n const { data: addressData } = useContractorsGetAddressSuspense({ contractorUuid: contractorId })\n\n const { mutateAsync: updateAddress, isPending: isUpdatingAddressPending } =\n useContractorsUpdateAddressMutation()\n\n const contractor = contractorData.contractor\n const contractorType = contractorData.contractor?.type\n const address = addressData.contractorAddress\n\n const formDefaultValues = {\n street1: address?.street1 || defaultValues?.street1 || '',\n street2: address?.street2 || defaultValues?.street2 || '',\n city: address?.city || defaultValues?.city || '',\n state: address?.state || defaultValues?.state || '',\n zip: address?.zip || defaultValues?.zip || '',\n }\n\n const formMethods = useForm<AddressFormValues>({\n resolver: zodResolver(AddressFormSchema),\n defaultValues: formDefaultValues,\n })\n\n const onSubmit = async (data: AddressFormValues) => {\n await baseSubmitHandler(data, async payload => {\n const { contractorAddress } = await updateAddress({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n version: address?.version as string,\n street1: payload.street1,\n street2: payload.street2,\n city: payload.city,\n state: payload.state,\n zip: payload.zip,\n },\n },\n })\n\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_UPDATED, contractorAddress)\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_DONE)\n })\n }\n\n return (\n <section className={className}>\n <AddressProvider\n value={{\n contractor,\n contractorType,\n address,\n isPending: isUpdatingAddressPending,\n }}\n >\n <FormProvider {...formMethods}>\n <HtmlForm onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </HtmlForm>\n </FormProvider>\n </AddressProvider>\n </section>\n )\n}\n\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","onEvent","baseSubmitHandler","useBase","contractorData","useContractorsGetSuspense","addressData","useContractorsGetAddressSuspense","updateAddress","isUpdatingAddressPending","useContractorsUpdateAddressMutation","contractor","contractorType","address","formDefaultValues","formMethods","useForm","zodResolver","AddressFormSchema","onSubmit","data","payload","contractorAddress","contractorEvents","AddressProvider","FormProvider","HtmlForm","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;AA0BO,SAASA,EAAQC,GAAqB;AAEz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