@gusto/embedded-react-sdk 0.37.0-rc.4 → 0.37.0-rc.5
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/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +5 -6
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/Profile/useContractorProfile.js +2 -3
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +2 -3
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +2 -3
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +2 -3
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -4
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -4
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +3 -4
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -4
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +3 -4
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +2 -3
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +2 -3
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/i18n/en/Payroll.OffCycle.json.js +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +9 -9
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -11,11 +11,10 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../../shared/constants.js";
|
|
13
13
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [d, s] = t("CreateSignatoryContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
s as CreateSignatoryProvider,
|
|
18
|
+
d as useCreateSignatory
|
|
20
19
|
};
|
|
21
20
|
//# sourceMappingURL=useCreateSignatory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateSignatory.js","sources":["../../../../../src/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.ts"],"sourcesContent":["import { type Signatory } from '@gusto/embedded-api/models/components/signatory'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\nexport type CreateSignatoryDefaultValues = RequireAtLeastOne<\n Pick<Signatory, 'firstName' | 'lastName' | 'email' | 'title' | 'phone' | 'birthday'> &\n Pick<\n NonNullable<Signatory['homeAddress']>,\n 'street1' | 'street2' | 'city' | 'state' | 'zip'\n > & {\n ssn?: string\n }\n>\ntype CreateSignatoryContextType = {\n isPending: boolean\n currentSignatory?: Signatory\n}\n\nconst [useCreateSignatory, CreateSignatoryProvider] =\n createCompoundContext<CreateSignatoryContextType>('CreateSignatoryContext')\n\nexport { useCreateSignatory, CreateSignatoryProvider }\n"],"names":["useCreateSignatory","CreateSignatoryProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCreateSignatory.js","sources":["../../../../../src/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.ts"],"sourcesContent":["import { type Signatory } from '@gusto/embedded-api/models/components/signatory'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\nexport type CreateSignatoryDefaultValues = RequireAtLeastOne<\n Pick<Signatory, 'firstName' | 'lastName' | 'email' | 'title' | 'phone' | 'birthday'> &\n Pick<\n NonNullable<Signatory['homeAddress']>,\n 'street1' | 'street2' | 'city' | 'state' | 'zip'\n > & {\n ssn?: string\n }\n>\ntype CreateSignatoryContextType = {\n isPending: boolean\n currentSignatory?: Signatory\n}\n\nconst [useCreateSignatory, CreateSignatoryProvider] =\n createCompoundContext<CreateSignatoryContextType>('CreateSignatoryContext')\n\nexport { useCreateSignatory, CreateSignatoryProvider }\n"],"names":["useCreateSignatory","CreateSignatoryProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,CAACA,GAAoBC,CAAuB,IAChDC,EAAkD,wBAAwB;"}
|
|
@@ -11,11 +11,10 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../../shared/constants.js";
|
|
13
13
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [S, c] = t("InviteSignatoryContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
c as InviteSignatoryProvider,
|
|
18
|
+
S as useInviteSignatory
|
|
20
19
|
};
|
|
21
20
|
//# sourceMappingURL=useInviteSignatory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInviteSignatory.js","sources":["../../../../../src/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.ts"],"sourcesContent":["import { type Signatory } from '@gusto/embedded-api/models/components/signatory'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\ntype InviteSignatoryContextType = {\n isPending: boolean\n}\n\nexport type InviteSignatoryDefaultValues = RequireAtLeastOne<\n Pick<Signatory, 'firstName' | 'lastName' | 'email' | 'title'> & {\n confirmEmail: string\n }\n>\n\nconst [useInviteSignatory, InviteSignatoryProvider] =\n createCompoundContext<InviteSignatoryContextType>('InviteSignatoryContext')\n\nexport { useInviteSignatory, InviteSignatoryProvider }\n"],"names":["useInviteSignatory","InviteSignatoryProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useInviteSignatory.js","sources":["../../../../../src/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.ts"],"sourcesContent":["import { type Signatory } from '@gusto/embedded-api/models/components/signatory'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\ntype InviteSignatoryContextType = {\n isPending: boolean\n}\n\nexport type InviteSignatoryDefaultValues = RequireAtLeastOne<\n Pick<Signatory, 'firstName' | 'lastName' | 'email' | 'title'> & {\n confirmEmail: string\n }\n>\n\nconst [useInviteSignatory, InviteSignatoryProvider] =\n createCompoundContext<InviteSignatoryContextType>('InviteSignatoryContext')\n\nexport { useInviteSignatory, InviteSignatoryProvider }\n"],"names":["useInviteSignatory","InviteSignatoryProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,CAACA,GAAoBC,CAAuB,IAChDC,EAAkD,wBAAwB;"}
|
|
@@ -11,15 +11,14 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../shared/constants.js";
|
|
13
13
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as t } from "../../Base/createCompoundContext.js";
|
|
16
|
-
const
|
|
15
|
+
const d = {
|
|
17
16
|
createSignatory: "createSignatory",
|
|
18
17
|
inviteSignatory: "inviteSignatory"
|
|
19
|
-
}, [
|
|
18
|
+
}, [v, x] = t("AssignSignatoryContext");
|
|
20
19
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
x as AssignSignatoryProvider,
|
|
21
|
+
d as SignatoryAssignmentMode,
|
|
22
|
+
v as useAssignSignatory
|
|
24
23
|
};
|
|
25
24
|
//# sourceMappingURL=useAssignSignatory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAssignSignatory.js","sources":["../../../../src/components/Company/AssignSignatory/useAssignSignatory.ts"],"sourcesContent":["import { type CreateSignatoryDefaultValues } from './CreateSignatory'\nimport { type InviteSignatoryDefaultValues } from './InviteSignatory'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\nexport const SignatoryAssignmentMode = {\n createSignatory: 'createSignatory',\n inviteSignatory: 'inviteSignatory',\n} as const\n\nexport type AssignSignatoryDefaultValues = RequireAtLeastOne<{\n create?: CreateSignatoryDefaultValues\n invite?: InviteSignatoryDefaultValues\n}>\n\ntype AssignSignatoryContextType = {\n companyId: string\n signatoryId?: string\n defaultValues?: AssignSignatoryDefaultValues\n onSignatoryAssignmentModeChange: (mode: string) => void\n onSignatoryFormEvent: BaseComponentInterface['onEvent']\n}\n\nconst [useAssignSignatory, AssignSignatoryProvider] =\n createCompoundContext<AssignSignatoryContextType>('AssignSignatoryContext')\n\nexport { useAssignSignatory, AssignSignatoryProvider }\n"],"names":["SignatoryAssignmentMode","useAssignSignatory","AssignSignatoryProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAssignSignatory.js","sources":["../../../../src/components/Company/AssignSignatory/useAssignSignatory.ts"],"sourcesContent":["import { type CreateSignatoryDefaultValues } from './CreateSignatory'\nimport { type InviteSignatoryDefaultValues } from './InviteSignatory'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\nexport const SignatoryAssignmentMode = {\n createSignatory: 'createSignatory',\n inviteSignatory: 'inviteSignatory',\n} as const\n\nexport type AssignSignatoryDefaultValues = RequireAtLeastOne<{\n create?: CreateSignatoryDefaultValues\n invite?: InviteSignatoryDefaultValues\n}>\n\ntype AssignSignatoryContextType = {\n companyId: string\n signatoryId?: string\n defaultValues?: AssignSignatoryDefaultValues\n onSignatoryAssignmentModeChange: (mode: string) => void\n onSignatoryFormEvent: BaseComponentInterface['onEvent']\n}\n\nconst [useAssignSignatory, AssignSignatoryProvider] =\n createCompoundContext<AssignSignatoryContextType>('AssignSignatoryContext')\n\nexport { useAssignSignatory, AssignSignatoryProvider }\n"],"names":["SignatoryAssignmentMode","useAssignSignatory","AssignSignatoryProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAMO,MAAMA,IAA0B;AAAA,EACrC,iBAAiB;AAAA,EACjB,iBAAiB;AACnB,GAeM,CAACC,GAAoBC,CAAuB,IAChDC,EAAkD,wBAAwB;"}
|
|
@@ -11,11 +11,10 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../../shared/constants.js";
|
|
13
13
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [C, d] = o("BankAccountContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
d as BankAccountFormProvider,
|
|
18
|
+
C as useBankAccountForm
|
|
20
19
|
};
|
|
21
20
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/BankAccount/BankAccountForm/context.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\nimport { type OnEventType } from '@/components/Base/useBase'\nimport { type EventType } from '@/shared/constants'\n\ntype BankAccountFormContextType = {\n isPending: boolean\n isEditing: boolean\n onEvent: OnEventType<EventType, unknown>\n}\n\nconst [useBankAccountForm, BankAccountFormProvider] =\n createCompoundContext<BankAccountFormContextType>('BankAccountContext')\n\nexport { useBankAccountForm, BankAccountFormProvider }\n"],"names":["useBankAccountForm","BankAccountFormProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/BankAccount/BankAccountForm/context.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\nimport { type OnEventType } from '@/components/Base/useBase'\nimport { type EventType } from '@/shared/constants'\n\ntype BankAccountFormContextType = {\n isPending: boolean\n isEditing: boolean\n onEvent: OnEventType<EventType, unknown>\n}\n\nconst [useBankAccountForm, BankAccountFormProvider] =\n createCompoundContext<BankAccountFormContextType>('BankAccountContext')\n\nexport { useBankAccountForm, BankAccountFormProvider }\n"],"names":["useBankAccountForm","BankAccountFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAoBC,CAAuB,IAChDC,EAAkD,oBAAoB;"}
|
|
@@ -11,13 +11,12 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../../shared/constants.js";
|
|
13
13
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [a, d] = t(
|
|
17
16
|
"CompanyDocumentListContext"
|
|
18
17
|
);
|
|
19
18
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
d as DocumentListProvider,
|
|
20
|
+
a as useDocumentList
|
|
22
21
|
};
|
|
23
22
|
//# sourceMappingURL=useDocumentList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Company/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import { type Signatory } from '@gusto/embedded-api/models/components/signatory'\nimport { type Form as FormSchema } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n companyForms: FormSchema[]\n documentListError: Error | null\n handleRequestFormToSign: (form: FormSchema) => void\n handleChangeSignatory: () => void\n handleContinue: () => void\n isSelfSignatory: boolean\n signatory?: Signatory\n}\n\nconst [useDocumentList, DocumentListProvider] = createCompoundContext<DocumentListContextType>(\n 'CompanyDocumentListContext',\n)\n\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Company/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import { type Signatory } from '@gusto/embedded-api/models/components/signatory'\nimport { type Form as FormSchema } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n companyForms: FormSchema[]\n documentListError: Error | null\n handleRequestFormToSign: (form: FormSchema) => void\n handleChangeSignatory: () => void\n handleContinue: () => void\n isSelfSignatory: boolean\n signatory?: Signatory\n}\n\nconst [useDocumentList, DocumentListProvider] = createCompoundContext<DocumentListContextType>(\n 'CompanyDocumentListContext',\n)\n\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,CAACA,GAAiBC,CAAoB,IAAIC;AAAA,EAC9C;AACF;"}
|
|
@@ -11,13 +11,12 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../../shared/constants.js";
|
|
13
13
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [c, d] = o(
|
|
17
16
|
"CompanySignatureFormContext"
|
|
18
17
|
);
|
|
19
18
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
d as SignatureFormProvider,
|
|
20
|
+
c as useSignatureForm
|
|
22
21
|
};
|
|
23
22
|
//# sourceMappingURL=useSignatureForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignatureForm.js","sources":["../../../../../src/components/Company/DocumentSigner/SignatureForm/useSignatureForm.ts"],"sourcesContent":["import { type Form as FormSchema } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype SignatureFormContextType = {\n form: FormSchema\n pdfUrl?: string | null\n isPending: boolean\n onBack: () => void\n}\n\nconst [useSignatureForm, SignatureFormProvider] = createCompoundContext<SignatureFormContextType>(\n 'CompanySignatureFormContext',\n)\n\nexport { useSignatureForm, SignatureFormProvider }\n"],"names":["useSignatureForm","SignatureFormProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSignatureForm.js","sources":["../../../../../src/components/Company/DocumentSigner/SignatureForm/useSignatureForm.ts"],"sourcesContent":["import { type Form as FormSchema } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype SignatureFormContextType = {\n form: FormSchema\n pdfUrl?: string | null\n isPending: boolean\n onBack: () => void\n}\n\nconst [useSignatureForm, SignatureFormProvider] = createCompoundContext<SignatureFormContextType>(\n 'CompanySignatureFormContext',\n)\n\nexport { useSignatureForm, SignatureFormProvider }\n"],"names":["useSignatureForm","SignatureFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAkBC,CAAqB,IAAIC;AAAA,EAChD;AACF;"}
|
|
@@ -13,19 +13,18 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
13
13
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
14
14
|
import "../../../shared/constants.js";
|
|
15
15
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
16
|
-
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
17
16
|
import { createCompoundContext as t } from "../../Base/createCompoundContext.js";
|
|
18
|
-
const
|
|
17
|
+
const C = o.object({
|
|
19
18
|
federalEin: o.string().optional(),
|
|
20
19
|
taxPayerType: o.enum(Object.values(e)).optional(),
|
|
21
20
|
filingForm: o.enum(Object.values(r)).optional(),
|
|
22
21
|
legalName: o.string().min(1)
|
|
23
|
-
}), [
|
|
22
|
+
}), [b, j] = t(
|
|
24
23
|
"CompanyFederalTaxesContext"
|
|
25
24
|
);
|
|
26
25
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
C as FederalTaxFormSchema,
|
|
27
|
+
j as FederalTaxesProvider,
|
|
28
|
+
b as useFederalTaxes
|
|
30
29
|
};
|
|
31
30
|
//# sourceMappingURL=useFederalTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFederalTaxes.js","sources":["../../../../src/components/Company/FederalTaxes/useFederalTaxes.ts"],"sourcesContent":["import { z } from 'zod'\nimport type { FederalTaxDetails } from '@gusto/embedded-api/models/components/federaltaxdetails'\nimport {\n FilingForm,\n TaxPayerType,\n} from '@gusto/embedded-api/models/operations/putv1companiescompanyidfederaltaxdetails'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\nexport const FederalTaxFormSchema = z.object({\n federalEin: z.string().optional(),\n taxPayerType: z.enum(Object.values(TaxPayerType) as [string, ...string[]]).optional(),\n filingForm: z.enum(Object.values(FilingForm) as [string, ...string[]]).optional(),\n legalName: z.string().min(1),\n})\n\nexport type FederalTaxFormInputs = z.input<typeof FederalTaxFormSchema>\n\nexport type FederalTaxesDefaultValues = RequireAtLeastOne<{\n taxPayerType?: FederalTaxFormInputs['taxPayerType']\n filingForm?: FederalTaxFormInputs['filingForm']\n legalName?: FederalTaxFormInputs['legalName']\n}>\n\ntype FederalTaxesContextType = {\n isPending: boolean\n federalTaxDetails?: FederalTaxDetails\n}\n\nconst [useFederalTaxes, FederalTaxesProvider] = createCompoundContext<FederalTaxesContextType>(\n 'CompanyFederalTaxesContext',\n)\n\nexport { useFederalTaxes, FederalTaxesProvider }\n"],"names":["FederalTaxFormSchema","z","TaxPayerType","FilingForm","useFederalTaxes","FederalTaxesProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFederalTaxes.js","sources":["../../../../src/components/Company/FederalTaxes/useFederalTaxes.ts"],"sourcesContent":["import { z } from 'zod'\nimport type { FederalTaxDetails } from '@gusto/embedded-api/models/components/federaltaxdetails'\nimport {\n FilingForm,\n TaxPayerType,\n} from '@gusto/embedded-api/models/operations/putv1companiescompanyidfederaltaxdetails'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\nexport const FederalTaxFormSchema = z.object({\n federalEin: z.string().optional(),\n taxPayerType: z.enum(Object.values(TaxPayerType) as [string, ...string[]]).optional(),\n filingForm: z.enum(Object.values(FilingForm) as [string, ...string[]]).optional(),\n legalName: z.string().min(1),\n})\n\nexport type FederalTaxFormInputs = z.input<typeof FederalTaxFormSchema>\n\nexport type FederalTaxesDefaultValues = RequireAtLeastOne<{\n taxPayerType?: FederalTaxFormInputs['taxPayerType']\n filingForm?: FederalTaxFormInputs['filingForm']\n legalName?: FederalTaxFormInputs['legalName']\n}>\n\ntype FederalTaxesContextType = {\n isPending: boolean\n federalTaxDetails?: FederalTaxDetails\n}\n\nconst [useFederalTaxes, FederalTaxesProvider] = createCompoundContext<FederalTaxesContextType>(\n 'CompanyFederalTaxesContext',\n)\n\nexport { useFederalTaxes, FederalTaxesProvider }\n"],"names":["FederalTaxFormSchema","z","TaxPayerType","FilingForm","useFederalTaxes","FederalTaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AASO,MAAMA,IAAuBC,EAAE,OAAO;AAAA,EAC3C,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,cAAcA,EAAE,KAAK,OAAO,OAAOC,CAAY,CAA0B,EAAE,SAAA;AAAA,EAC3E,YAAYD,EAAE,KAAK,OAAO,OAAOE,CAAU,CAA0B,EAAE,SAAA;AAAA,EACvE,WAAWF,EAAE,OAAA,EAAS,IAAI,CAAC;AAC7B,CAAC,GAeK,CAACG,GAAiBC,CAAoB,IAAIC;AAAA,EAC9C;AACF;"}
|
|
@@ -11,17 +11,16 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../shared/constants.js";
|
|
13
13
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as t } from "../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [A, P] = t("IndustryItems", {
|
|
17
16
|
items: []
|
|
18
|
-
}), [
|
|
17
|
+
}), [f, v] = t("IndustryApi", {
|
|
19
18
|
isPending: !1
|
|
20
19
|
});
|
|
21
20
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
v as IndustryApiStateProvider,
|
|
22
|
+
P as IndustryItemsProvider,
|
|
23
|
+
f as useIndustryApiState,
|
|
24
|
+
A as useIndustryItems
|
|
26
25
|
};
|
|
27
26
|
//# sourceMappingURL=Context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","sources":["../../../../src/components/Company/Industry/Context.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\nimport type { ComboBoxOption } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\n\nconst [useIndustryItems, IndustryItemsProvider] = createCompoundContext('IndustryItems', {\n items: [] as ComboBoxOption[],\n})\n\nconst [useIndustryApiState, IndustryApiStateProvider] = createCompoundContext('IndustryApi', {\n isPending: false,\n})\n\nexport { IndustryApiStateProvider, IndustryItemsProvider, useIndustryItems, useIndustryApiState }\n"],"names":["useIndustryItems","IndustryItemsProvider","createCompoundContext","useIndustryApiState","IndustryApiStateProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Context.js","sources":["../../../../src/components/Company/Industry/Context.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\nimport type { ComboBoxOption } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\n\nconst [useIndustryItems, IndustryItemsProvider] = createCompoundContext('IndustryItems', {\n items: [] as ComboBoxOption[],\n})\n\nconst [useIndustryApiState, IndustryApiStateProvider] = createCompoundContext('IndustryApi', {\n isPending: false,\n})\n\nexport { IndustryApiStateProvider, IndustryItemsProvider, useIndustryItems, useIndustryApiState }\n"],"names":["useIndustryItems","IndustryItemsProvider","createCompoundContext","useIndustryApiState","IndustryApiStateProvider"],"mappings":";;;;;;;;;;;;;;AAGA,MAAM,CAACA,GAAkBC,CAAqB,IAAIC,EAAsB,iBAAiB;AAAA,EACvF,OAAO,CAAA;AACT,CAAC,GAEK,CAACC,GAAqBC,CAAwB,IAAIF,EAAsB,eAAe;AAAA,EAC3F,WAAW;AACb,CAAC;"}
|
|
@@ -11,13 +11,12 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../../shared/constants.js";
|
|
13
13
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [d, L] = o(
|
|
17
16
|
"CompanyDocumentFormContext"
|
|
18
17
|
);
|
|
19
18
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
L as LocationsFormProvider,
|
|
20
|
+
d as useLocationsForm
|
|
22
21
|
};
|
|
23
22
|
//# sourceMappingURL=useLocationForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocationForm.js","sources":["../../../../../src/components/Company/Locations/LocationForm/useLocationForm.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\n\ntype LocationsFormContextType = {\n isPending: boolean\n handleCancel: () => void\n}\n\nconst [useLocationsForm, LocationsFormProvider] = createCompoundContext<LocationsFormContextType>(\n 'CompanyDocumentFormContext',\n)\n\nexport { useLocationsForm, LocationsFormProvider }\n"],"names":["useLocationsForm","LocationsFormProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLocationForm.js","sources":["../../../../../src/components/Company/Locations/LocationForm/useLocationForm.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\n\ntype LocationsFormContextType = {\n isPending: boolean\n handleCancel: () => void\n}\n\nconst [useLocationsForm, LocationsFormProvider] = createCompoundContext<LocationsFormContextType>(\n 'CompanyDocumentFormContext',\n)\n\nexport { useLocationsForm, LocationsFormProvider }\n"],"names":["useLocationsForm","LocationsFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAOA,MAAM,CAACA,GAAkBC,CAAqB,IAAIC;AAAA,EAChD;AACF;"}
|
|
@@ -11,13 +11,12 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../../shared/constants.js";
|
|
13
13
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [d, f] = o(
|
|
17
16
|
"CompanyDocumentListContext"
|
|
18
17
|
);
|
|
19
18
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
f as LocationsListProvider,
|
|
20
|
+
d as useLocationsList
|
|
22
21
|
};
|
|
23
22
|
//# 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'\nimport type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ntype LocationsListContextType = {\n locationList: Location[]\n totalPages: number\n totalCount: number\n currentPage: number\n itemsPerPage: PaginationItemsPerPage\n handleItemsPerPageChange: (n: PaginationItemsPerPage) => 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'\nimport type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ntype LocationsListContextType = {\n locationList: Location[]\n totalPages: number\n totalCount: number\n currentPage: number\n itemsPerPage: PaginationItemsPerPage\n handleItemsPerPageChange: (n: PaginationItemsPerPage) => 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":";;;;;;;;;;;;;;AAoBA,MAAM,CAACA,GAAkBC,CAAqB,IAAIC;AAAA,EAChD;AACF;"}
|
|
@@ -11,11 +11,10 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../shared/constants.js";
|
|
13
13
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [x, C] = o("OnboardingOverviewContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
C as OnboardingOverviewProvider,
|
|
18
|
+
x as useOnboardingOverview
|
|
20
19
|
};
|
|
21
20
|
//# 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;"}
|
|
@@ -12,9 +12,8 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
12
12
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
13
13
|
import "../../../shared/constants.js";
|
|
14
14
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
15
|
-
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
16
15
|
import { createCompoundContext as t } from "../../Base/createCompoundContext.js";
|
|
17
|
-
const
|
|
16
|
+
const x = o.object({
|
|
18
17
|
frequency: o.enum(["Every week", "Every other week", "Twice per month", "Monthly"]),
|
|
19
18
|
anchorPayDate: o.date().optional(),
|
|
20
19
|
anchorEndOfPayPeriod: o.date().optional(),
|
|
@@ -22,10 +21,10 @@ const S = o.object({
|
|
|
22
21
|
day2: o.number().min(1).max(31).optional(),
|
|
23
22
|
customName: o.string().optional(),
|
|
24
23
|
customTwicePerMonth: o.string().optional()
|
|
25
|
-
}), [
|
|
24
|
+
}), [S, f] = t("PayScheduleContext");
|
|
26
25
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
f as PayScheduleProvider,
|
|
27
|
+
x as PayScheduleSchema,
|
|
28
|
+
S as usePaySchedule
|
|
30
29
|
};
|
|
31
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 paymentSpeed?: string\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})\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 paymentSpeed?: string\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})\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":";;;;;;;;;;;;;;;AA4BO,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACxC,WAAWA,EAAE,KAAK,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,CAAC;AAAA,EAClF,eAAeA,EAAE,KAAA,EAAO,SAAA;AAAA,EACxB,sBAAsBA,EAAE,KAAA,EAAO,SAAA;AAAA,EAC/B,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAA;AAAA,EAChC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAA;AAAA,EAChC,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,qBAAqBA,EAAE,OAAA,EAAS,SAAA;AAClC,CAAC,GAcK,CAACC,GAAgBC,CAAmB,IACxCC,EAA8C,oBAAoB;"}
|
|
@@ -11,11 +11,10 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../../shared/constants.js";
|
|
13
13
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [c, d] = t("StateTaxesFormContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
d as StateTaxesFormProvider,
|
|
18
|
+
c as useStateTaxesForm
|
|
20
19
|
};
|
|
21
20
|
//# 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;"}
|
|
@@ -11,11 +11,10 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../../shared/constants.js";
|
|
13
13
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [c, d] = t("StateTaxesListContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
d as StateTaxesListProvider,
|
|
18
|
+
c as useStateTaxesList
|
|
20
19
|
};
|
|
21
20
|
//# 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;"}
|
|
@@ -12,20 +12,19 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
12
12
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
13
13
|
import "../../../shared/constants.js";
|
|
14
14
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
15
|
-
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
16
15
|
import { createCompoundContext as r } from "../../Base/createCompoundContext.js";
|
|
17
|
-
const
|
|
16
|
+
const u = t.object({
|
|
18
17
|
street1: t.string().min(1),
|
|
19
18
|
street2: t.string().optional(),
|
|
20
19
|
city: t.string().min(1),
|
|
21
20
|
state: t.string().min(1),
|
|
22
21
|
zip: t.string().min(1)
|
|
23
|
-
}), [
|
|
22
|
+
}), [z, b] = r(
|
|
24
23
|
"ContractorAddressContext"
|
|
25
24
|
);
|
|
26
25
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
u as AddressFormSchema,
|
|
27
|
+
b as AddressProvider,
|
|
28
|
+
z as useAddress
|
|
30
29
|
};
|
|
31
30
|
//# sourceMappingURL=useAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAddress.js","sources":["../../../../src/components/Contractor/Address/useAddress.ts"],"sourcesContent":["import type { Contractor, ContractorType } from '@gusto/embedded-api/models/components/contractor'\nimport type { ContractorAddress } from '@gusto/embedded-api/models/components/contractoraddress'\nimport { z } from 'zod'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\nexport interface AddressContextType {\n contractor?: Contractor\n contractorType?: ContractorType\n address?: ContractorAddress\n isPending: boolean\n}\n\nexport type AddressDefaultValues = RequireAtLeastOne<\n Pick<ContractorAddress, 'street1' | 'street2' | 'city' | 'state' | 'zip'>\n>\n\nexport const AddressFormSchema = z.object({\n street1: z.string().min(1),\n street2: z.string().optional(),\n city: z.string().min(1),\n state: z.string().min(1),\n zip: z.string().min(1),\n})\n\nexport type AddressFormValues = z.infer<typeof AddressFormSchema>\n\nconst [useAddress, AddressProvider] = createCompoundContext<AddressContextType>(\n 'ContractorAddressContext',\n)\n\nexport { useAddress, AddressProvider }\n"],"names":["AddressFormSchema","z","useAddress","AddressProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAddress.js","sources":["../../../../src/components/Contractor/Address/useAddress.ts"],"sourcesContent":["import type { Contractor, ContractorType } from '@gusto/embedded-api/models/components/contractor'\nimport type { ContractorAddress } from '@gusto/embedded-api/models/components/contractoraddress'\nimport { z } from 'zod'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\nexport interface AddressContextType {\n contractor?: Contractor\n contractorType?: ContractorType\n address?: ContractorAddress\n isPending: boolean\n}\n\nexport type AddressDefaultValues = RequireAtLeastOne<\n Pick<ContractorAddress, 'street1' | 'street2' | 'city' | 'state' | 'zip'>\n>\n\nexport const AddressFormSchema = z.object({\n street1: z.string().min(1),\n street2: z.string().optional(),\n city: z.string().min(1),\n state: z.string().min(1),\n zip: z.string().min(1),\n})\n\nexport type AddressFormValues = z.infer<typeof AddressFormSchema>\n\nconst [useAddress, AddressProvider] = createCompoundContext<AddressContextType>(\n 'ContractorAddressContext',\n)\n\nexport { useAddress, AddressProvider }\n"],"names":["AddressFormSchema","z","useAddress","AddressProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;AAiBO,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACxC,SAASA,EAAE,SAAS,IAAI,CAAC;AAAA,EACzB,SAASA,EAAE,OAAA,EAAS,SAAA;AAAA,EACpB,MAAMA,EAAE,SAAS,IAAI,CAAC;AAAA,EACtB,OAAOA,EAAE,SAAS,IAAI,CAAC;AAAA,EACvB,KAAKA,EAAE,OAAA,EAAS,IAAI,CAAC;AACvB,CAAC,GAIK,CAACC,GAAYC,CAAe,IAAIC;AAAA,EACpC;AACF;"}
|
|
@@ -17,7 +17,6 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
17
17
|
import { SDKInternalError as Y } from "../../../types/sdkError.js";
|
|
18
18
|
import { ContractorSelfOnboardingStatuses as x, componentEvents as b, ContractorOnboardingStatus as ee } from "../../../shared/constants.js";
|
|
19
19
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
20
|
-
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
21
20
|
import { useI18n as oe } from "../../../i18n/I18n.js";
|
|
22
21
|
import { SSN_REGEX as se, NAME_REGEX as N } from "../../../helpers/validations.js";
|
|
23
22
|
import { removeNonDigits as ae } from "../../../helpers/formattedStrings.js";
|
|
@@ -96,7 +95,7 @@ const i = k, a = J, ie = s.object({
|
|
|
96
95
|
});
|
|
97
96
|
}
|
|
98
97
|
);
|
|
99
|
-
function
|
|
98
|
+
function Be({
|
|
100
99
|
companyId: t,
|
|
101
100
|
contractorId: f,
|
|
102
101
|
defaultValues: m,
|
|
@@ -229,6 +228,6 @@ export {
|
|
|
229
228
|
a as ContractorType,
|
|
230
229
|
i as WageType,
|
|
231
230
|
re as createContractorProfileValidationSchema,
|
|
232
|
-
|
|
231
|
+
Be as useContractorProfile
|
|
233
232
|
};
|
|
234
233
|
//# sourceMappingURL=useContractorProfile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContractorProfile.js","sources":["../../../../src/components/Contractor/Profile/useContractorProfile.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { useForm, useWatch } from 'react-hook-form'\nimport { z } from 'zod'\nimport { useContractorsCreateMutation } from '@gusto/embedded-api/react-query/contractorsCreate'\nimport { useContractorsUpdateMutation } from '@gusto/embedded-api/react-query/contractorsUpdate'\nimport type { ContractorCreateRequestBody } from '@gusto/embedded-api/models/components/contractorcreaterequestbody'\nimport type { ContractorUpdateRequestBody } from '@gusto/embedded-api/models/components/contractorupdaterequestbody'\nimport {\n ContractorWageType as ApiWageType,\n ContractorType as ApiContractorType,\n type Contractor,\n} from '@gusto/embedded-api/models/components/contractor'\nimport { useBase } from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport {\n componentEvents,\n ContractorOnboardingStatus,\n ContractorSelfOnboardingStatuses,\n} from '@/shared/constants'\nimport { SSN_REGEX, NAME_REGEX } from '@/helpers/validations'\nimport { removeNonDigits } from '@/helpers/formattedStrings'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { normalizeEin } from '@/helpers/federalEin'\nimport { SDKInternalError } from '@/types/sdkError'\n\n// Re-export the API types for convenience\nexport const WageType = ApiWageType\nexport const ContractorType = ApiContractorType\n\n// Form schema definition - exported for use in stories and tests\nconst ContractorProfileSchema = z.object({\n // Self-onboarding toggle\n selfOnboarding: z.boolean(),\n email: z.string().email().optional(),\n\n // Required contractor fields\n contractorType: z.enum([ContractorType.Individual, ContractorType.Business]),\n wageType: z.enum([WageType.Hourly, WageType.Fixed]),\n startDate: z.date(),\n\n // Individual contractor fields\n firstName: z.string().min(1).regex(NAME_REGEX).optional(),\n middleInitial: z.string().optional(),\n lastName: z.string().min(1).regex(NAME_REGEX).optional(),\n ssn: z.string().optional(),\n\n // Business contractor fields\n businessName: z.string().optional(),\n ein: z.string().optional(),\n\n // Wage fields\n hourlyRate: z.number().min(0).optional(),\n})\n\nexport type ContractorProfileFormData = z.infer<typeof ContractorProfileSchema>\n\n// Create validation schema - exported for stories\nexport const createContractorProfileValidationSchema = (\n t: (key: string) => string,\n hasSsn: boolean,\n hasEin: boolean,\n) => {\n return ContractorProfileSchema.superRefine(\n (data: ContractorProfileFormData, ctx: z.RefinementCtx) => {\n // Email validation for contractor invitation\n if (data.selfOnboarding && !data.email) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['email'],\n message: t('validations.email'),\n })\n }\n\n // Individual contractor validations\n if (data.contractorType === ContractorType.Individual) {\n if (!data.firstName) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['firstName'],\n message: t('validations.firstName'),\n })\n }\n\n if (!data.lastName) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['lastName'],\n message: t('validations.lastName'),\n })\n }\n\n if (!data.ssn) {\n if (!hasSsn && !data.selfOnboarding) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ssn'],\n message: t('validations.ssn'),\n })\n }\n } else {\n // Validate SSN format\n const cleanSSN = removeNonDigits(data.ssn)\n if (!SSN_REGEX.test(cleanSSN)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ssn'],\n message: t('validations.ssnFormat'),\n })\n }\n }\n }\n\n // Business contractor validations\n if (data.contractorType === ContractorType.Business) {\n if (!data.businessName) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['businessName'],\n message: t('validations.businessName'),\n })\n }\n\n if (!data.ein) {\n if (!hasEin && !data.selfOnboarding) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ein'],\n message: t('validations.ein'),\n })\n }\n } else {\n // Validate EIN format after normalization (XX-XXXXXXX)\n const normalizedEin = normalizeEin(data.ein)\n if (!/^\\d{2}-\\d{7}$/.test(normalizedEin)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ein'],\n message: t('validations.einFormat'),\n })\n }\n }\n }\n\n // Hourly rate validation for hourly contractors\n if (data.wageType === WageType.Hourly) {\n if (data.hourlyRate === undefined || data.hourlyRate < 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hourlyRate'],\n message: t('validations.hourlyRate'),\n })\n }\n }\n },\n )\n}\n\nexport interface UseContractorProfileProps {\n companyId: string\n contractorId?: string\n defaultValues?: Partial<ContractorProfileFormData>\n existingContractor?: Contractor\n}\n\nexport function useContractorProfile({\n companyId,\n contractorId,\n defaultValues,\n existingContractor,\n}: UseContractorProfileProps) {\n useI18n('Contractor.Profile')\n const { t } = useTranslation('Contractor.Profile')\n const { onEvent, baseSubmitHandler } = useBase()\n\n // Create validation schema with translations\n const validationSchema = createContractorProfileValidationSchema(\n t as (key: string) => string,\n existingContractor?.hasSsn ?? false,\n existingContractor?.hasEin ?? false,\n )\n\n // API mutations\n const { mutateAsync: createContractor, isPending: isCreating } = useContractorsCreateMutation()\n const { mutateAsync: updateContractor, isPending: isUpdating } = useContractorsUpdateMutation()\n\n // Prepare default values from existing contractor or provided defaults\n const formDefaultValues = useMemo(\n () => ({\n selfOnboarding: false,\n contractorType: ContractorType.Business,\n wageType: WageType.Fixed,\n startDate: new Date(),\n ...defaultValues,\n // Override with existing contractor data if available\n ...(existingContractor && {\n selfOnboarding: existingContractor.onboardingStatus\n ? // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses\n ContractorSelfOnboardingStatuses.has(existingContractor.onboardingStatus)\n : false,\n contractorType: existingContractor.type || ContractorType.Business,\n wageType: existingContractor.wageType || WageType.Fixed,\n startDate: existingContractor.startDate\n ? new Date(existingContractor.startDate)\n : new Date(),\n firstName: existingContractor.firstName || undefined,\n middleInitial: existingContractor.middleInitial || undefined,\n lastName: existingContractor.lastName || undefined,\n businessName: existingContractor.businessName || undefined,\n email: existingContractor.email || undefined,\n hourlyRate: existingContractor.hourlyRate\n ? (() => {\n const parsed = parseFloat(existingContractor.hourlyRate)\n return isNaN(parsed) ? undefined : parsed\n })()\n : undefined,\n }),\n }),\n [existingContractor, defaultValues],\n )\n\n // Form setup\n const formMethods = useForm<ContractorProfileFormData, unknown, ContractorProfileFormData>({\n resolver: zodResolver(validationSchema),\n defaultValues: formDefaultValues,\n })\n\n const { handleSubmit, formState } = formMethods\n\n // Watch form values for conditional rendering\n const watchedType = useWatch({ control: formMethods.control, name: 'contractorType' })\n const watchedWageType = useWatch({ control: formMethods.control, name: 'wageType' })\n const watchedSelfOnboarding = useWatch({\n control: formMethods.control,\n name: 'selfOnboarding',\n })\n\n // Helper function to transform form data to API payload\n const transformFormDataToCreatePayload = (\n data: ContractorProfileFormData,\n ): ContractorCreateRequestBody => {\n const basePayload = {\n type: data.contractorType,\n wageType: data.wageType,\n startDate: formatDateToStringDate(data.startDate) || '',\n selfOnboarding: data.selfOnboarding,\n email: data.selfOnboarding ? data.email : undefined,\n hourlyRate: data.wageType === WageType.Hourly ? String(data.hourlyRate) : undefined,\n isActive: true,\n }\n\n if (data.contractorType === ContractorType.Individual) {\n return {\n ...basePayload,\n firstName: data.firstName,\n middleInitial: data.middleInitial || undefined,\n lastName: data.lastName,\n ssn: data.ssn,\n fileNewHireReport: false, // Default value\n }\n } else {\n return {\n ...basePayload,\n fileNewHireReport: false, // Default value\n businessName: data.businessName,\n ein: data.ein?.replace(/-/g, ''),\n }\n }\n }\n\n const transformFormDataToUpdatePayload = (\n data: ContractorProfileFormData,\n version: string,\n ): ContractorUpdateRequestBody => {\n const createPayload = transformFormDataToCreatePayload(data)\n return {\n ...createPayload,\n version,\n }\n }\n\n // Event handlers\n const onSubmit: SubmitHandler<ContractorProfileFormData> = async data => {\n await baseSubmitHandler(data, async payload => {\n let contractorId = existingContractor?.uuid\n if (existingContractor) {\n // Update existing contractor\n if (!existingContractor.version) {\n throw new SDKInternalError('Contractor version is required for updates')\n }\n const version = existingContractor.version\n const apiPayload = transformFormDataToUpdatePayload(payload, version)\n\n const updateResponse = await updateContractor({\n request: {\n contractorUuid: contractorId!,\n contractorUpdateRequestBody: apiPayload,\n },\n })\n\n onEvent(componentEvents.CONTRACTOR_UPDATED, updateResponse.contractor)\n } else {\n // Create new contractor\n const apiPayload = transformFormDataToCreatePayload(payload)\n\n const createResponse = await createContractor({\n request: {\n companyUuid: companyId,\n contractorCreateRequestBody: apiPayload,\n },\n })\n\n contractorId = createResponse.contractor?.uuid\n onEvent(componentEvents.CONTRACTOR_CREATED, createResponse.contractor)\n }\n\n onEvent(componentEvents.CONTRACTOR_PROFILE_DONE, {\n selfOnboarding:\n payload.selfOnboarding &&\n existingContractor?.onboardingStatus !==\n ContractorOnboardingStatus.ADMIN_ONBOARDING_REVIEW,\n contractorId,\n })\n })\n }\n\n // Conditional rendering helpers\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion\n const shouldShowEmailField = !!watchedSelfOnboarding\n const shouldShowBusinessFields = watchedType === ContractorType.Business\n const shouldShowIndividualFields = watchedType === ContractorType.Individual\n const shouldShowHourlyRate = watchedWageType === WageType.Hourly\n const shouldShowSsnField = watchedType === ContractorType.Individual && !watchedSelfOnboarding\n const shouldShowEinField = watchedType === ContractorType.Business && !watchedSelfOnboarding\n\n // Form field options\n const contractorTypeOptions = [\n { label: 'Individual', value: ContractorType.Individual },\n { label: 'Business', value: ContractorType.Business },\n ]\n\n const wageTypeOptions = [\n { label: 'Hourly', value: WageType.Hourly },\n { label: 'Fixed', value: WageType.Fixed },\n ]\n\n // Determine if we're currently submitting (creating or updating)\n const isSubmitting = isCreating || isUpdating\n // Return only what the component actually needs\n return {\n // Form methods and submission\n formMethods,\n handleSubmit: handleSubmit(onSubmit),\n formState: {\n ...formState,\n isSubmitting,\n },\n\n // Conditional rendering flags\n shouldShowEmailField,\n shouldShowBusinessFields,\n shouldShowIndividualFields,\n shouldShowHourlyRate,\n shouldShowSsnField,\n shouldShowEinField,\n\n // Form options\n contractorTypeOptions,\n wageTypeOptions,\n\n // Component state\n isEditing: !!contractorId,\n }\n}\n"],"names":["WageType","ApiWageType","ContractorType","ApiContractorType","ContractorProfileSchema","z","NAME_REGEX","createContractorProfileValidationSchema","hasSsn","hasEin","data","ctx","cleanSSN","removeNonDigits","SSN_REGEX","normalizedEin","normalizeEin","useContractorProfile","companyId","contractorId","defaultValues","existingContractor","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","validationSchema","createContractor","isCreating","useContractorsCreateMutation","updateContractor","isUpdating","useContractorsUpdateMutation","formDefaultValues","useMemo","ContractorSelfOnboardingStatuses","parsed","formMethods","useForm","zodResolver","handleSubmit","formState","watchedType","useWatch","watchedWageType","watchedSelfOnboarding","transformFormDataToCreatePayload","basePayload","formatDateToStringDate","transformFormDataToUpdatePayload","version","onSubmit","payload","SDKInternalError","apiPayload","updateResponse","componentEvents","createResponse","ContractorOnboardingStatus","shouldShowEmailField","shouldShowBusinessFields","shouldShowIndividualFields","shouldShowHourlyRate","shouldShowSsnField","shouldShowEinField","contractorTypeOptions","wageTypeOptions","isSubmitting"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6BO,MAAMA,IAAWC,GACXC,IAAiBC,GAGxBC,KAA0BC,EAAE,OAAO;AAAA;AAAA,EAEvC,gBAAgBA,EAAE,QAAA;AAAA,EAClB,OAAOA,EAAE,OAAA,EAAS,MAAA,EAAQ,SAAA;AAAA;AAAA,EAG1B,gBAAgBA,EAAE,KAAK,CAACH,EAAe,YAAYA,EAAe,QAAQ,CAAC;AAAA,EAC3E,UAAUG,EAAE,KAAK,CAACL,EAAS,QAAQA,EAAS,KAAK,CAAC;AAAA,EAClD,WAAWK,EAAE,KAAA;AAAA;AAAA,EAGb,WAAWA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,MAAMC,CAAU,EAAE,SAAA;AAAA,EAC/C,eAAeD,EAAE,OAAA,EAAS,SAAA;AAAA,EAC1B,UAAUA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,MAAMC,CAAU,EAAE,SAAA;AAAA,EA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AAEjB;"}
|
|
1
|
+
{"version":3,"file":"useContractorProfile.js","sources":["../../../../src/components/Contractor/Profile/useContractorProfile.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { useForm, useWatch } from 'react-hook-form'\nimport { z } from 'zod'\nimport { useContractorsCreateMutation } from '@gusto/embedded-api/react-query/contractorsCreate'\nimport { useContractorsUpdateMutation } from '@gusto/embedded-api/react-query/contractorsUpdate'\nimport type { ContractorCreateRequestBody } from '@gusto/embedded-api/models/components/contractorcreaterequestbody'\nimport type { ContractorUpdateRequestBody } from '@gusto/embedded-api/models/components/contractorupdaterequestbody'\nimport {\n ContractorWageType as ApiWageType,\n ContractorType as ApiContractorType,\n type Contractor,\n} from '@gusto/embedded-api/models/components/contractor'\nimport { useBase } from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport {\n componentEvents,\n ContractorOnboardingStatus,\n ContractorSelfOnboardingStatuses,\n} from '@/shared/constants'\nimport { SSN_REGEX, NAME_REGEX } from '@/helpers/validations'\nimport { removeNonDigits } from '@/helpers/formattedStrings'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { normalizeEin } from '@/helpers/federalEin'\nimport { SDKInternalError } from '@/types/sdkError'\n\n// Re-export the API types for convenience\nexport const WageType = ApiWageType\nexport const ContractorType = ApiContractorType\n\n// Form schema definition - exported for use in stories and tests\nconst ContractorProfileSchema = z.object({\n // Self-onboarding toggle\n selfOnboarding: z.boolean(),\n email: z.string().email().optional(),\n\n // Required contractor fields\n contractorType: z.enum([ContractorType.Individual, ContractorType.Business]),\n wageType: z.enum([WageType.Hourly, WageType.Fixed]),\n startDate: z.date(),\n\n // Individual contractor fields\n firstName: z.string().min(1).regex(NAME_REGEX).optional(),\n middleInitial: z.string().optional(),\n lastName: z.string().min(1).regex(NAME_REGEX).optional(),\n ssn: z.string().optional(),\n\n // Business contractor fields\n businessName: z.string().optional(),\n ein: z.string().optional(),\n\n // Wage fields\n hourlyRate: z.number().min(0).optional(),\n})\n\nexport type ContractorProfileFormData = z.infer<typeof ContractorProfileSchema>\n\n// Create validation schema - exported for stories\nexport const createContractorProfileValidationSchema = (\n t: (key: string) => string,\n hasSsn: boolean,\n hasEin: boolean,\n) => {\n return ContractorProfileSchema.superRefine(\n (data: ContractorProfileFormData, ctx: z.RefinementCtx) => {\n // Email validation for contractor invitation\n if (data.selfOnboarding && !data.email) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['email'],\n message: t('validations.email'),\n })\n }\n\n // Individual contractor validations\n if (data.contractorType === ContractorType.Individual) {\n if (!data.firstName) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['firstName'],\n message: t('validations.firstName'),\n })\n }\n\n if (!data.lastName) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['lastName'],\n message: t('validations.lastName'),\n })\n }\n\n if (!data.ssn) {\n if (!hasSsn && !data.selfOnboarding) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ssn'],\n message: t('validations.ssn'),\n })\n }\n } else {\n // Validate SSN format\n const cleanSSN = removeNonDigits(data.ssn)\n if (!SSN_REGEX.test(cleanSSN)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ssn'],\n message: t('validations.ssnFormat'),\n })\n }\n }\n }\n\n // Business contractor validations\n if (data.contractorType === ContractorType.Business) {\n if (!data.businessName) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['businessName'],\n message: t('validations.businessName'),\n })\n }\n\n if (!data.ein) {\n if (!hasEin && !data.selfOnboarding) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ein'],\n message: t('validations.ein'),\n })\n }\n } else {\n // Validate EIN format after normalization (XX-XXXXXXX)\n const normalizedEin = normalizeEin(data.ein)\n if (!/^\\d{2}-\\d{7}$/.test(normalizedEin)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['ein'],\n message: t('validations.einFormat'),\n })\n }\n }\n }\n\n // Hourly rate validation for hourly contractors\n if (data.wageType === WageType.Hourly) {\n if (data.hourlyRate === undefined || data.hourlyRate < 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hourlyRate'],\n message: t('validations.hourlyRate'),\n })\n }\n }\n },\n )\n}\n\nexport interface UseContractorProfileProps {\n companyId: string\n contractorId?: string\n defaultValues?: Partial<ContractorProfileFormData>\n existingContractor?: Contractor\n}\n\nexport function useContractorProfile({\n companyId,\n contractorId,\n defaultValues,\n existingContractor,\n}: UseContractorProfileProps) {\n useI18n('Contractor.Profile')\n const { t } = useTranslation('Contractor.Profile')\n const { onEvent, baseSubmitHandler } = useBase()\n\n // Create validation schema with translations\n const validationSchema = createContractorProfileValidationSchema(\n t as (key: string) => string,\n existingContractor?.hasSsn ?? false,\n existingContractor?.hasEin ?? false,\n )\n\n // API mutations\n const { mutateAsync: createContractor, isPending: isCreating } = useContractorsCreateMutation()\n const { mutateAsync: updateContractor, isPending: isUpdating } = useContractorsUpdateMutation()\n\n // Prepare default values from existing contractor or provided defaults\n const formDefaultValues = useMemo(\n () => ({\n selfOnboarding: false,\n contractorType: ContractorType.Business,\n wageType: WageType.Fixed,\n startDate: new Date(),\n ...defaultValues,\n // Override with existing contractor data if available\n ...(existingContractor && {\n selfOnboarding: existingContractor.onboardingStatus\n ? // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses\n ContractorSelfOnboardingStatuses.has(existingContractor.onboardingStatus)\n : false,\n contractorType: existingContractor.type || ContractorType.Business,\n wageType: existingContractor.wageType || WageType.Fixed,\n startDate: existingContractor.startDate\n ? new Date(existingContractor.startDate)\n : new Date(),\n firstName: existingContractor.firstName || undefined,\n middleInitial: existingContractor.middleInitial || undefined,\n lastName: existingContractor.lastName || undefined,\n businessName: existingContractor.businessName || undefined,\n email: existingContractor.email || undefined,\n hourlyRate: existingContractor.hourlyRate\n ? (() => {\n const parsed = parseFloat(existingContractor.hourlyRate)\n return isNaN(parsed) ? undefined : parsed\n })()\n : undefined,\n }),\n }),\n [existingContractor, defaultValues],\n )\n\n // Form setup\n const formMethods = useForm<ContractorProfileFormData, unknown, ContractorProfileFormData>({\n resolver: zodResolver(validationSchema),\n defaultValues: formDefaultValues,\n })\n\n const { handleSubmit, formState } = formMethods\n\n // Watch form values for conditional rendering\n const watchedType = useWatch({ control: formMethods.control, name: 'contractorType' })\n const watchedWageType = useWatch({ control: formMethods.control, name: 'wageType' })\n const watchedSelfOnboarding = useWatch({\n control: formMethods.control,\n name: 'selfOnboarding',\n })\n\n // Helper function to transform form data to API payload\n const transformFormDataToCreatePayload = (\n data: ContractorProfileFormData,\n ): ContractorCreateRequestBody => {\n const basePayload = {\n type: data.contractorType,\n wageType: data.wageType,\n startDate: formatDateToStringDate(data.startDate) || '',\n selfOnboarding: data.selfOnboarding,\n email: data.selfOnboarding ? data.email : undefined,\n hourlyRate: data.wageType === WageType.Hourly ? String(data.hourlyRate) : undefined,\n isActive: true,\n }\n\n if (data.contractorType === ContractorType.Individual) {\n return {\n ...basePayload,\n firstName: data.firstName,\n middleInitial: data.middleInitial || undefined,\n lastName: data.lastName,\n ssn: data.ssn,\n fileNewHireReport: false, // Default value\n }\n } else {\n return {\n ...basePayload,\n fileNewHireReport: false, // Default value\n businessName: data.businessName,\n ein: data.ein?.replace(/-/g, ''),\n }\n }\n }\n\n const transformFormDataToUpdatePayload = (\n data: ContractorProfileFormData,\n version: string,\n ): ContractorUpdateRequestBody => {\n const createPayload = transformFormDataToCreatePayload(data)\n return {\n ...createPayload,\n version,\n }\n }\n\n // Event handlers\n const onSubmit: SubmitHandler<ContractorProfileFormData> = async data => {\n await baseSubmitHandler(data, async payload => {\n let contractorId = existingContractor?.uuid\n if (existingContractor) {\n // Update existing contractor\n if (!existingContractor.version) {\n throw new SDKInternalError('Contractor version is required for updates')\n }\n const version = existingContractor.version\n const apiPayload = transformFormDataToUpdatePayload(payload, version)\n\n const updateResponse = await updateContractor({\n request: {\n contractorUuid: contractorId!,\n contractorUpdateRequestBody: apiPayload,\n },\n })\n\n onEvent(componentEvents.CONTRACTOR_UPDATED, updateResponse.contractor)\n } else {\n // Create new contractor\n const apiPayload = transformFormDataToCreatePayload(payload)\n\n const createResponse = await createContractor({\n request: {\n companyUuid: companyId,\n contractorCreateRequestBody: apiPayload,\n },\n })\n\n contractorId = createResponse.contractor?.uuid\n onEvent(componentEvents.CONTRACTOR_CREATED, createResponse.contractor)\n }\n\n onEvent(componentEvents.CONTRACTOR_PROFILE_DONE, {\n selfOnboarding:\n payload.selfOnboarding &&\n existingContractor?.onboardingStatus !==\n ContractorOnboardingStatus.ADMIN_ONBOARDING_REVIEW,\n contractorId,\n })\n })\n }\n\n // Conditional rendering helpers\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion\n const shouldShowEmailField = !!watchedSelfOnboarding\n const shouldShowBusinessFields = watchedType === ContractorType.Business\n const shouldShowIndividualFields = watchedType === ContractorType.Individual\n const shouldShowHourlyRate = watchedWageType === WageType.Hourly\n const shouldShowSsnField = watchedType === ContractorType.Individual && !watchedSelfOnboarding\n const shouldShowEinField = watchedType === ContractorType.Business && !watchedSelfOnboarding\n\n // Form field options\n const contractorTypeOptions = [\n { label: 'Individual', value: ContractorType.Individual },\n { label: 'Business', value: ContractorType.Business },\n ]\n\n const wageTypeOptions = [\n { label: 'Hourly', value: WageType.Hourly },\n { label: 'Fixed', value: WageType.Fixed },\n ]\n\n // Determine if we're currently submitting (creating or updating)\n const isSubmitting = isCreating || isUpdating\n // Return only what the component actually needs\n return {\n // Form methods and submission\n formMethods,\n handleSubmit: handleSubmit(onSubmit),\n formState: {\n ...formState,\n isSubmitting,\n },\n\n // Conditional rendering flags\n shouldShowEmailField,\n shouldShowBusinessFields,\n shouldShowIndividualFields,\n shouldShowHourlyRate,\n shouldShowSsnField,\n shouldShowEinField,\n\n // Form options\n contractorTypeOptions,\n wageTypeOptions,\n\n // Component state\n isEditing: !!contractorId,\n }\n}\n"],"names":["WageType","ApiWageType","ContractorType","ApiContractorType","ContractorProfileSchema","z","NAME_REGEX","createContractorProfileValidationSchema","hasSsn","hasEin","data","ctx","cleanSSN","removeNonDigits","SSN_REGEX","normalizedEin","normalizeEin","useContractorProfile","companyId","contractorId","defaultValues","existingContractor","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","validationSchema","createContractor","isCreating","useContractorsCreateMutation","updateContractor","isUpdating","useContractorsUpdateMutation","formDefaultValues","useMemo","ContractorSelfOnboardingStatuses","parsed","formMethods","useForm","zodResolver","handleSubmit","formState","watchedType","useWatch","watchedWageType","watchedSelfOnboarding","transformFormDataToCreatePayload","basePayload","formatDateToStringDate","transformFormDataToUpdatePayload","version","onSubmit","payload","SDKInternalError","apiPayload","updateResponse","componentEvents","createResponse","ContractorOnboardingStatus","shouldShowEmailField","shouldShowBusinessFields","shouldShowIndividualFields","shouldShowHourlyRate","shouldShowSsnField","shouldShowEinField","contractorTypeOptions","wageTypeOptions","isSubmitting"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BO,MAAMA,IAAWC,GACXC,IAAiBC,GAGxBC,KAA0BC,EAAE,OAAO;AAAA;AAAA,EAEvC,gBAAgBA,EAAE,QAAA;AAAA,EAClB,OAAOA,EAAE,OAAA,EAAS,MAAA,EAAQ,SAAA;AAAA;AAAA,EAG1B,gBAAgBA,EAAE,KAAK,CAACH,EAAe,YAAYA,EAAe,QAAQ,CAAC;AAAA,EAC3E,UAAUG,EAAE,KAAK,CAACL,EAAS,QAAQA,EAAS,KAAK,CAAC;AAAA,EAClD,WAAWK,EAAE,KAAA;AAAA;AAAA,EAGb,WAAWA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,MAAMC,CAAU,EAAE,SAAA;AAAA,EAC/C,eAAeD,EAAE,OAAA,EAAS,SAAA;AAAA,EAC1B,UAAUA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,MAAMC,CAAU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