@gusto/embedded-react-sdk 0.52.0 → 0.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/components/Base/Base.d.ts +2 -0
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +4 -1
- package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -1
- package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.js.map +1 -1
- package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.d.ts +1 -1
- package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +2 -2
- package/dist/components/Common/UI/DateRangePicker/DateRangePickerTypes.d.ts +3 -2
- package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.d.ts +1 -1
- package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.js.map +1 -1
- package/dist/components/Common/UI/Menu/MenuTypes.d.ts +3 -3
- package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +2 -2
- package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.d.ts +2 -2
- package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.js.map +1 -1
- package/dist/components/Common/UI/Select/SelectTypes.d.ts +2 -2
- package/dist/components/Common/UI/Table/TableTypes.d.ts +4 -4
- package/dist/components/Common/UI/Table/TableTypes.js.map +1 -1
- package/dist/components/Common/UI/Tabs/TabsTypes.d.ts +2 -2
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -8
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +8 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +5 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.d.ts +2 -1
- package/dist/components/Contractor/ContractorList/index.js +121 -99
- package/dist/components/Contractor/ContractorList/index.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.d.ts +1 -1
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.d.ts +2 -0
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js +150 -80
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.test.d.ts +1 -0
- package/dist/components/Contractor/Profile/BusinessSelfOnboardingProfile.js +19 -18
- package/dist/components/Contractor/Profile/BusinessSelfOnboardingProfile.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfile.d.ts +1 -1
- package/dist/components/Contractor/Profile/ContractorProfile.js +114 -110
- package/dist/components/Contractor/Profile/ContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Profile/IndividualSelfOnboardingProfile.js +27 -26
- package/dist/components/Contractor/Profile/IndividualSelfOnboardingProfile.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +106 -63
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.d.ts +2 -2
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +10 -8
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProvider.d.ts +1 -0
- package/dist/contexts/GustoProvider/GustoProvider.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +1 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/ThemeProvider/types.d.ts +2 -2
- package/dist/i18n/en/Contractor.ContractorList.json.js +22 -20
- package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -1
- package/dist/i18n/en/Contractor.Submit.json.js +11 -11
- package/dist/i18n/types.d.ts +7 -3
- package/dist/models/WA_RISK_CODES.d.ts +1 -0
- package/dist/models/WA_RISK_CODES.js.map +1 -1
- package/dist/partner-hook-utils/composeErrorHandler.d.ts +4 -0
- package/dist/partner-hook-utils/composeErrorHandler.js.map +1 -1
- package/dist/partner-hook-utils/form/SDKFormProvider.d.ts +1 -0
- package/dist/partner-hook-utils/form/SDKFormProvider.js.map +1 -1
- package/dist/partner-hook-utils/form/composeSubmitHandler.d.ts +4 -0
- package/dist/partner-hook-utils/form/composeSubmitHandler.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/DatePickerHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/DatePickerHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SelectHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/SelectHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SwitchHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/SwitchHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/TextInputHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/TextInputHookField.js.map +1 -1
- package/dist/partner-hook-utils/types.d.ts +9 -0
- package/dist/shared/constants.d.ts +10 -0
- package/dist/shared/constants.js +7 -6
- package/dist/shared/constants.js.map +1 -1
- package/dist/types/Helpers.d.ts +2 -0
- package/dist/types/hooks.d.ts +1 -0
- package/dist/types/observability.d.ts +1 -0
- package/docs/guides/endpoint-inventory.json +17 -1
- package/package.json +11 -11
|
@@ -1,120 +1,124 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { useWatch as
|
|
5
|
-
import
|
|
6
|
-
import { useContractorDetailsForm as
|
|
7
|
-
import { ContractorType as
|
|
8
|
-
import { SelfOnboardingContractorProfile as
|
|
9
|
-
import
|
|
10
|
-
import { BaseBoundaries as
|
|
1
|
+
import { jsx as t, jsxs as r, Fragment as N } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as E, useState as h, useEffect as v } from "react";
|
|
3
|
+
import { useTranslation as O } from "react-i18next";
|
|
4
|
+
import { useWatch as C } from "react-hook-form";
|
|
5
|
+
import S from "classnames";
|
|
6
|
+
import { useContractorDetailsForm as y } from "./shared/useContractorDetailsForm/useContractorDetailsForm.js";
|
|
7
|
+
import { ContractorType as F } from "./shared/useContractorDetailsForm/contractorDetailsSchema.js";
|
|
8
|
+
import { SelfOnboardingContractorProfile as A } from "./SelfOnboardingContractorProfile.js";
|
|
9
|
+
import T from "./ContractorProfile.module.scss.js";
|
|
10
|
+
import { BaseBoundaries as M, BaseLayout as I } from "../../Base/Base.js";
|
|
11
11
|
import "../../Base/useBase.js";
|
|
12
|
-
import { SDKFormProvider as
|
|
13
|
-
import { Form as
|
|
14
|
-
import { Flex as
|
|
15
|
-
import { Grid as
|
|
16
|
-
import { useComponentContext as
|
|
17
|
-
import { useComponentDictionary as
|
|
18
|
-
import {
|
|
19
|
-
function
|
|
20
|
-
|
|
12
|
+
import { SDKFormProvider as L } from "../../../partner-hook-utils/form/SDKFormProvider.js";
|
|
13
|
+
import { Form as P } from "../../Common/Form/Form.js";
|
|
14
|
+
import { Flex as c } from "../../Common/Flex/Flex.js";
|
|
15
|
+
import { Grid as R } from "../../Common/Grid/Grid.js";
|
|
16
|
+
import { useComponentContext as _ } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
17
|
+
import { useComponentDictionary as x, useI18n as B } from "../../../i18n/I18n.js";
|
|
18
|
+
import { ContractorOnboardingStatus as b, componentEvents as g } from "../../../shared/constants.js";
|
|
19
|
+
function U(a) {
|
|
20
|
+
return a?.onboarded === !0 || a?.onboardingStatus === b.ONBOARDING_COMPLETED || a?.onboardingStatus === b.SELF_ONBOARDING_REVIEW || a?.onboardingStatus === b.ADMIN_ONBOARDING_REVIEW;
|
|
21
|
+
}
|
|
22
|
+
function Q(a) {
|
|
23
|
+
const n = {
|
|
21
24
|
create: [],
|
|
22
25
|
update: ["firstName", "lastName", "businessName", "hourlyRate", "workState"]
|
|
23
26
|
};
|
|
24
|
-
return
|
|
25
|
-
create: [...
|
|
26
|
-
update: [...
|
|
27
|
+
return a ? n : {
|
|
28
|
+
create: [...n.create ?? [], "ssn", "ein"],
|
|
29
|
+
update: [...n.update ?? [], "ssn", "ein"]
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
+
function oe(a) {
|
|
33
|
+
return x("Contractor.Profile", a.dictionary), /* @__PURE__ */ t(M, { componentName: "Contractor.Profile", FallbackComponent: a.FallbackComponent, children: a.isAdmin === !1 ? /* @__PURE__ */ t(
|
|
34
|
+
A,
|
|
32
35
|
{
|
|
33
|
-
contractorId:
|
|
34
|
-
onEvent:
|
|
35
|
-
className:
|
|
36
|
+
contractorId: a.contractorId,
|
|
37
|
+
onEvent: a.onEvent,
|
|
38
|
+
className: a.className
|
|
36
39
|
}
|
|
37
|
-
) : /* @__PURE__ */
|
|
40
|
+
) : /* @__PURE__ */ t(V, { ...a }) });
|
|
38
41
|
}
|
|
39
|
-
function
|
|
40
|
-
companyId:
|
|
41
|
-
contractorId:
|
|
42
|
-
defaultValues:
|
|
43
|
-
className:
|
|
42
|
+
function V({
|
|
43
|
+
companyId: a,
|
|
44
|
+
contractorId: n,
|
|
45
|
+
defaultValues: f,
|
|
46
|
+
className: u,
|
|
44
47
|
onEvent: e
|
|
45
48
|
}) {
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
() => ({ type:
|
|
49
|
-
[
|
|
50
|
-
), [s,
|
|
51
|
-
!
|
|
52
|
-
),
|
|
53
|
-
() =>
|
|
49
|
+
B("Contractor.Profile");
|
|
50
|
+
const o = E(
|
|
51
|
+
() => ({ type: F.Business, ...f }),
|
|
52
|
+
[f]
|
|
53
|
+
), [s, i] = h(
|
|
54
|
+
!n && (o.selfOnboarding ?? !1)
|
|
55
|
+
), d = E(
|
|
56
|
+
() => Q(s),
|
|
54
57
|
[s]
|
|
55
|
-
),
|
|
56
|
-
|
|
57
|
-
companyId:
|
|
58
|
-
contractorId:
|
|
59
|
-
defaultValues:
|
|
60
|
-
optionalFieldsToRequire:
|
|
58
|
+
), l = y(
|
|
59
|
+
n ? {
|
|
60
|
+
companyId: a,
|
|
61
|
+
contractorId: n,
|
|
62
|
+
defaultValues: o,
|
|
63
|
+
optionalFieldsToRequire: d
|
|
61
64
|
} : {
|
|
62
|
-
companyId:
|
|
63
|
-
defaultValues:
|
|
64
|
-
optionalFieldsToRequire:
|
|
65
|
+
companyId: a,
|
|
66
|
+
defaultValues: o,
|
|
67
|
+
optionalFieldsToRequire: d
|
|
65
68
|
}
|
|
66
69
|
);
|
|
67
|
-
return
|
|
68
|
-
|
|
70
|
+
return l.isLoading ? /* @__PURE__ */ t(I, { isLoading: !0, error: l.errorHandling.errors }) : /* @__PURE__ */ t(
|
|
71
|
+
H,
|
|
69
72
|
{
|
|
70
|
-
contractor:
|
|
73
|
+
contractor: l,
|
|
71
74
|
onEvent: e,
|
|
72
|
-
className:
|
|
73
|
-
setSelfOnboardingActive:
|
|
75
|
+
className: u,
|
|
76
|
+
setSelfOnboardingActive: i
|
|
74
77
|
}
|
|
75
78
|
);
|
|
76
79
|
}
|
|
77
|
-
function
|
|
78
|
-
contractor:
|
|
79
|
-
onEvent:
|
|
80
|
-
className:
|
|
81
|
-
setSelfOnboardingActive:
|
|
80
|
+
function H({
|
|
81
|
+
contractor: a,
|
|
82
|
+
onEvent: n,
|
|
83
|
+
className: f,
|
|
84
|
+
setSelfOnboardingActive: u
|
|
82
85
|
}) {
|
|
83
|
-
const { t: e } =
|
|
84
|
-
control:
|
|
86
|
+
const { t: e } = O("Contractor.Profile"), o = _(), s = C({
|
|
87
|
+
control: a.form.hookFormInternals.formMethods.control,
|
|
85
88
|
name: "selfOnboarding"
|
|
86
89
|
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}, [s,
|
|
90
|
-
const { Fields:
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
),
|
|
96
|
-
contractorId:
|
|
97
|
-
|
|
90
|
+
v(() => {
|
|
91
|
+
u(s);
|
|
92
|
+
}, [s, u]);
|
|
93
|
+
const { Fields: i } = a.form, d = a.status.mode, l = U(a.data.contractor), p = !s || l, D = async () => {
|
|
94
|
+
const m = await a.actions.onSubmit();
|
|
95
|
+
m && (n(
|
|
96
|
+
m.mode === "create" ? g.CONTRACTOR_CREATED : g.CONTRACTOR_UPDATED,
|
|
97
|
+
m.data
|
|
98
|
+
), n(g.CONTRACTOR_PROFILE_DONE, {
|
|
99
|
+
contractorId: m.data.uuid,
|
|
100
|
+
onboardingStatus: m.data.onboardingStatus,
|
|
101
|
+
selfOnboarding: s && !l
|
|
98
102
|
}));
|
|
99
103
|
};
|
|
100
|
-
return /* @__PURE__ */
|
|
101
|
-
|
|
104
|
+
return /* @__PURE__ */ t("section", { className: S(T.root, f), children: /* @__PURE__ */ t(I, { error: a.errorHandling.errors, children: /* @__PURE__ */ t(L, { formHookResult: a, children: /* @__PURE__ */ r(P, { onSubmit: () => {
|
|
105
|
+
D();
|
|
102
106
|
}, children: [
|
|
103
|
-
/* @__PURE__ */ r(
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ r(c, { flexDirection: "column", gap: 20, alignItems: "stretch", children: [
|
|
108
|
+
/* @__PURE__ */ t("header", { children: /* @__PURE__ */ r(c, { flexDirection: "column", gap: 4, children: [
|
|
109
|
+
/* @__PURE__ */ t(o.Heading, { as: "h2", children: e("title") }),
|
|
110
|
+
/* @__PURE__ */ t(o.Text, { variant: "supporting", children: e("subtitle") })
|
|
107
111
|
] }) }),
|
|
108
|
-
(
|
|
109
|
-
|
|
110
|
-
|
|
112
|
+
(i.SelfOnboarding || i.Email) && /* @__PURE__ */ t(o.Box, { children: /* @__PURE__ */ r(R, { gap: 16, children: [
|
|
113
|
+
i.SelfOnboarding && /* @__PURE__ */ t(
|
|
114
|
+
i.SelfOnboarding,
|
|
111
115
|
{
|
|
112
116
|
label: e("fields.selfOnboarding.label"),
|
|
113
117
|
description: e("fields.selfOnboarding.description")
|
|
114
118
|
}
|
|
115
119
|
),
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
i.Email && /* @__PURE__ */ t(
|
|
121
|
+
i.Email,
|
|
118
122
|
{
|
|
119
123
|
label: e("fields.email.label"),
|
|
120
124
|
validationMessages: {
|
|
@@ -124,11 +128,11 @@ function Q({
|
|
|
124
128
|
}
|
|
125
129
|
)
|
|
126
130
|
] }) }),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
|
|
129
|
-
/* @__PURE__ */ r(
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
|
|
131
|
+
/* @__PURE__ */ t(i.Type, { label: e("fields.contractorType.label") }),
|
|
132
|
+
i.FirstName && i.LastName && /* @__PURE__ */ r(N, { children: [
|
|
133
|
+
/* @__PURE__ */ r(R, { gridTemplateColumns: { base: "1fr", medium: "1fr 1fr" }, gap: 16, children: [
|
|
134
|
+
/* @__PURE__ */ t(
|
|
135
|
+
i.FirstName,
|
|
132
136
|
{
|
|
133
137
|
label: e("fields.firstName.label"),
|
|
134
138
|
validationMessages: {
|
|
@@ -137,10 +141,10 @@ function Q({
|
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
),
|
|
140
|
-
|
|
144
|
+
i.MiddleInitial && /* @__PURE__ */ t(i.MiddleInitial, { label: e("fields.middleInitial.label") })
|
|
141
145
|
] }),
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
-
|
|
146
|
+
/* @__PURE__ */ t(
|
|
147
|
+
i.LastName,
|
|
144
148
|
{
|
|
145
149
|
label: e("fields.lastName.label"),
|
|
146
150
|
validationMessages: {
|
|
@@ -149,8 +153,8 @@ function Q({
|
|
|
149
153
|
}
|
|
150
154
|
}
|
|
151
155
|
),
|
|
152
|
-
|
|
153
|
-
|
|
156
|
+
i.Ssn && p && /* @__PURE__ */ t(
|
|
157
|
+
i.Ssn,
|
|
154
158
|
{
|
|
155
159
|
label: e("fields.ssn.label"),
|
|
156
160
|
validationMessages: {
|
|
@@ -160,16 +164,16 @@ function Q({
|
|
|
160
164
|
}
|
|
161
165
|
)
|
|
162
166
|
] }),
|
|
163
|
-
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
|
|
167
|
+
i.BusinessName && /* @__PURE__ */ r(N, { children: [
|
|
168
|
+
/* @__PURE__ */ t(
|
|
169
|
+
i.BusinessName,
|
|
166
170
|
{
|
|
167
171
|
label: e("fields.businessName.label"),
|
|
168
172
|
validationMessages: { REQUIRED: e("validations.businessName") }
|
|
169
173
|
}
|
|
170
174
|
),
|
|
171
|
-
|
|
172
|
-
|
|
175
|
+
i.Ein && p && /* @__PURE__ */ t(
|
|
176
|
+
i.Ein,
|
|
173
177
|
{
|
|
174
178
|
label: e("fields.ein.label"),
|
|
175
179
|
validationMessages: {
|
|
@@ -179,9 +183,9 @@ function Q({
|
|
|
179
183
|
}
|
|
180
184
|
)
|
|
181
185
|
] }),
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
-
|
|
184
|
-
|
|
186
|
+
/* @__PURE__ */ t(i.WageType, { label: e("fields.wageType.label") }),
|
|
187
|
+
i.HourlyRate && /* @__PURE__ */ t(
|
|
188
|
+
i.HourlyRate,
|
|
185
189
|
{
|
|
186
190
|
label: e("fields.hourlyRate.label"),
|
|
187
191
|
min: 0,
|
|
@@ -189,8 +193,8 @@ function Q({
|
|
|
189
193
|
validationMessages: { REQUIRED: e("validations.hourlyRate") }
|
|
190
194
|
}
|
|
191
195
|
),
|
|
192
|
-
/* @__PURE__ */
|
|
193
|
-
|
|
196
|
+
/* @__PURE__ */ t(
|
|
197
|
+
i.StartDate,
|
|
194
198
|
{
|
|
195
199
|
label: e("fields.startDate.label"),
|
|
196
200
|
description: e("fields.startDate.description"),
|
|
@@ -198,18 +202,18 @@ function Q({
|
|
|
198
202
|
}
|
|
199
203
|
)
|
|
200
204
|
] }),
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
|
|
205
|
+
/* @__PURE__ */ t(c, { gap: 12, justifyContent: "flex-end", children: /* @__PURE__ */ t(
|
|
206
|
+
o.Button,
|
|
203
207
|
{
|
|
204
208
|
type: "submit",
|
|
205
209
|
variant: "primary",
|
|
206
|
-
isDisabled:
|
|
207
|
-
children:
|
|
210
|
+
isDisabled: a.status.isPending,
|
|
211
|
+
children: a.status.isPending ? e(d === "create" ? "buttons.creating" : "buttons.updating") : e(d === "create" ? "buttons.create" : "buttons.update")
|
|
208
212
|
}
|
|
209
213
|
) })
|
|
210
214
|
] }) }) }) });
|
|
211
215
|
}
|
|
212
216
|
export {
|
|
213
|
-
|
|
217
|
+
oe as ContractorProfile
|
|
214
218
|
};
|
|
215
219
|
//# sourceMappingURL=ContractorProfile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractorProfile.js","sources":["../../../../src/components/Contractor/Profile/ContractorProfile.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useWatch } from 'react-hook-form'\nimport classNames from 'classnames'\nimport {\n useContractorDetailsForm,\n ContractorType,\n type ContractorDetailsFormData,\n type ContractorDetailsOptionalFieldsToRequire,\n type UseContractorDetailsFormReady,\n} from './shared/useContractorDetailsForm'\nimport { SelfOnboardingContractorProfile } from './SelfOnboardingContractorProfile'\nimport styles from './ContractorProfile.module.scss'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { Form } from '@/components/Common/Form'\nimport { Flex, Grid } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { componentEvents, ContractorOnboardingStatus } from '@/shared/constants'\n\n// The admin form restores the contractor profile's product requiredness on top\n// of the hook's API-aligned baseline (which leaves ssn/ein optional and\n// create-only fields optional on update). When the admin invites the contractor\n// to self-onboard, SSN/EIN are hidden and the contractor supplies them later, so\n// they are dropped from the required set. An SSN/EIN already on file is still\n// waived via redaction, so promoting them when not inviting is safe.\nfunction computeRequiredFields(\n selfOnboardingActive: boolean,\n): ContractorDetailsOptionalFieldsToRequire {\n const base: ContractorDetailsOptionalFieldsToRequire = {\n create: [],\n update: ['firstName', 'lastName', 'businessName', 'hourlyRate', 'workState'],\n }\n if (selfOnboardingActive) return base\n return {\n create: [...(base.create ?? []), 'ssn', 'ein'],\n update: [...(base.update ?? []), 'ssn', 'ein'],\n }\n}\n\n/**\n * Props for {@link ContractorProfile} in admin mode.\n *\n * @remarks\n * Renders the admin create/edit form. When `contractorId` is omitted, the form\n * creates a new contractor under `companyId`. When provided, it fetches and\n * updates the existing contractor.\n *\n * @public\n */\nexport interface ContractorProfileAdminProps extends BaseComponentInterface<'Contractor.Profile'> {\n /** UUID of the company the contractor belongs to. */\n companyId: string\n /** Initial values for the contractor profile form fields. */\n defaultValues?: Partial<ContractorDetailsFormData>\n /** When `true` (the default), renders the admin create/edit form. */\n isAdmin?: true\n /** UUID of an existing contractor to edit. When omitted, the form creates a new contractor. */\n contractorId?: string\n}\n\n/**\n * Props for {@link ContractorProfile} in self-onboarding mode.\n *\n * @remarks\n * Renders the contractor self-onboarding profile. The contractor must already\n * exist so its type (individual vs. business) can be resolved to determine\n * which fields to display.\n *\n * @public\n */\nexport interface ContractorProfileSelfOnboardingProps extends BaseComponentInterface<'Contractor.Profile'> {\n /** UUID of the company the contractor belongs to. */\n companyId: string\n /** Initial values for the contractor profile form fields. */\n defaultValues?: Partial<ContractorDetailsFormData>\n /** When `false`, renders the contractor self-onboarding profile. */\n isAdmin: false\n /** UUID of the existing contractor completing self-onboarding. Required in self-onboarding mode. */\n contractorId: string\n}\n\n/**\n * Props for {@link ContractorProfile}.\n *\n * @remarks\n * Discriminated by `isAdmin`. See {@link ContractorProfileAdminProps} and\n * {@link ContractorProfileSelfOnboardingProps} for the specific prop shapes.\n *\n * @public\n */\nexport type ContractorProfileProps =\n ContractorProfileAdminProps | ContractorProfileSelfOnboardingProps\n\n/**\n * Form for creating or editing a contractor profile, supporting both individual and business contractor types.\n *\n * @remarks\n * In admin mode (the default), renders different field sets depending on the contractor type (individual\n * vs. business) and wage type (hourly vs. fixed), and exposes a self-onboarding toggle that invites the\n * contractor to complete their own setup. When `contractorId` is provided, the form fetches the existing\n * contractor and updates it on submit; otherwise it creates a new contractor under `companyId`.\n *\n * When `isAdmin` is `false`, renders the contractor self-onboarding profile instead: it resolves the\n * existing contractor's type and presents the individual (name + SSN) or business (business name + EIN)\n * fields for the contractor to complete.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/created` | A new contractor was created successfully. | The created contractor entity |\n * | `contractor/updated` | An existing contractor was updated successfully. | The updated contractor entity |\n * | `contractor/profile/done` | The contractor profile step finished. | `{ contractorId: string, selfOnboarding: boolean }` |\n *\n * @param props - See {@link ContractorProfileProps}.\n * @returns The rendered contractor profile form.\n * @public\n */\nexport function ContractorProfile(props: ContractorProfileProps) {\n useComponentDictionary('Contractor.Profile', props.dictionary)\n return (\n <BaseBoundaries componentName=\"Contractor.Profile\" FallbackComponent={props.FallbackComponent}>\n {props.isAdmin === false ? (\n <SelfOnboardingContractorProfile\n contractorId={props.contractorId}\n onEvent={props.onEvent}\n className={props.className}\n />\n ) : (\n <ContractorProfileRoot {...props} />\n )}\n </BaseBoundaries>\n )\n}\n\nfunction ContractorProfileRoot({\n companyId,\n contractorId,\n defaultValues,\n className,\n onEvent,\n}: ContractorProfileProps) {\n useI18n('Contractor.Profile')\n\n const resolvedDefaults = useMemo<Partial<ContractorDetailsFormData>>(\n () => ({ type: ContractorType.Business, ...defaultValues }),\n [defaultValues],\n )\n\n // Mirrors the Employee AdminProfile loop: SSN/EIN requiredness depends on the\n // self-onboarding toggle, which lives in the form the hook creates. Seed from\n // the create-mode default, then sync from the watched value (see the ready child).\n const [selfOnboardingActive, setSelfOnboardingActive] = useState(\n !contractorId && (resolvedDefaults.selfOnboarding ?? false),\n )\n\n const optionalFieldsToRequire = useMemo(\n () => computeRequiredFields(selfOnboardingActive),\n [selfOnboardingActive],\n )\n\n const contractor = useContractorDetailsForm(\n contractorId\n ? {\n companyId,\n contractorId,\n defaultValues: resolvedDefaults,\n optionalFieldsToRequire,\n }\n : {\n companyId,\n defaultValues: resolvedDefaults,\n optionalFieldsToRequire,\n },\n )\n\n if (contractor.isLoading) {\n return <BaseLayout isLoading error={contractor.errorHandling.errors} />\n }\n\n return (\n <ContractorProfileReady\n contractor={contractor}\n onEvent={onEvent}\n className={className}\n setSelfOnboardingActive={setSelfOnboardingActive}\n />\n )\n}\n\ninterface ContractorProfileReadyProps {\n contractor: UseContractorDetailsFormReady\n onEvent: ContractorProfileProps['onEvent']\n className?: string\n setSelfOnboardingActive: (value: boolean) => void\n}\n\nfunction ContractorProfileReady({\n contractor,\n onEvent,\n className,\n setSelfOnboardingActive,\n}: ContractorProfileReadyProps) {\n const { t } = useTranslation('Contractor.Profile')\n const Components = useComponentContext()\n\n const watchedSelfOnboarding = useWatch({\n control: contractor.form.hookFormInternals.formMethods.control,\n name: 'selfOnboarding',\n })\n\n useEffect(() => {\n setSelfOnboardingActive(watchedSelfOnboarding)\n }, [watchedSelfOnboarding, setSelfOnboardingActive])\n\n const { Fields } = contractor.form\n const mode = contractor.status.mode\n\n const handleSubmit = async () => {\n const onboardingStatus = contractor.data.contractor?.onboardingStatus\n const result = await contractor.actions.onSubmit()\n if (!result) return\n\n onEvent(\n result.mode === 'create'\n ? componentEvents.CONTRACTOR_CREATED\n : componentEvents.CONTRACTOR_UPDATED,\n result.data,\n )\n\n onEvent(componentEvents.CONTRACTOR_PROFILE_DONE, {\n contractorId: result.data.uuid,\n selfOnboarding:\n watchedSelfOnboarding &&\n onboardingStatus !== ContractorOnboardingStatus.ADMIN_ONBOARDING_REVIEW,\n })\n }\n\n return (\n <section className={classNames(styles.root, className)}>\n <BaseLayout error={contractor.errorHandling.errors}>\n <SDKFormProvider formHookResult={contractor}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={20} alignItems=\"stretch\">\n <header>\n <Flex flexDirection=\"column\" gap={4}>\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Components.Text variant=\"supporting\">{t('subtitle')}</Components.Text>\n </Flex>\n </header>\n\n {(Fields.SelfOnboarding || Fields.Email) && (\n <Components.Box>\n <Grid gap={16}>\n {Fields.SelfOnboarding && (\n <Fields.SelfOnboarding\n label={t('fields.selfOnboarding.label')}\n description={t('fields.selfOnboarding.description')}\n />\n )}\n\n {Fields.Email && (\n <Fields.Email\n label={t('fields.email.label')}\n validationMessages={{\n REQUIRED: t('validations.email'),\n INVALID_EMAIL: t('validations.emailFormat'),\n }}\n />\n )}\n </Grid>\n </Components.Box>\n )}\n\n <Fields.Type label={t('fields.contractorType.label')} />\n\n {Fields.FirstName && Fields.LastName && (\n <>\n <Grid gridTemplateColumns={{ base: '1fr', medium: '1fr 1fr' }} gap={16}>\n <Fields.FirstName\n label={t('fields.firstName.label')}\n validationMessages={{\n REQUIRED: t('validations.firstName'),\n INVALID_NAME: t('validations.firstNameFormat'),\n }}\n />\n {Fields.MiddleInitial && (\n <Fields.MiddleInitial label={t('fields.middleInitial.label')} />\n )}\n </Grid>\n <Fields.LastName\n label={t('fields.lastName.label')}\n validationMessages={{\n REQUIRED: t('validations.lastName'),\n INVALID_NAME: t('validations.lastNameFormat'),\n }}\n />\n {Fields.Ssn && !watchedSelfOnboarding && (\n <Fields.Ssn\n label={t('fields.ssn.label')}\n validationMessages={{\n INVALID_SSN: t('validations.ssnFormat'),\n REQUIRED: t('validations.ssn'),\n }}\n />\n )}\n </>\n )}\n\n {Fields.BusinessName && (\n <>\n <Fields.BusinessName\n label={t('fields.businessName.label')}\n validationMessages={{ REQUIRED: t('validations.businessName') }}\n />\n {Fields.Ein && !watchedSelfOnboarding && (\n <Fields.Ein\n label={t('fields.ein.label')}\n validationMessages={{\n INVALID_EIN: t('validations.einFormat'),\n REQUIRED: t('validations.ein'),\n }}\n />\n )}\n </>\n )}\n\n <Fields.WageType label={t('fields.wageType.label')} />\n\n {Fields.HourlyRate && (\n <Fields.HourlyRate\n label={t('fields.hourlyRate.label')}\n min={0}\n format=\"currency\"\n validationMessages={{ REQUIRED: t('validations.hourlyRate') }}\n />\n )}\n\n <Fields.StartDate\n label={t('fields.startDate.label')}\n description={t('fields.startDate.description')}\n validationMessages={{ REQUIRED: t('validations.startDate') }}\n />\n </Flex>\n\n <Flex gap={12} justifyContent=\"flex-end\">\n <Components.Button\n type=\"submit\"\n variant=\"primary\"\n isDisabled={contractor.status.isPending}\n >\n {contractor.status.isPending\n ? mode === 'create'\n ? t('buttons.creating')\n : t('buttons.updating')\n : mode === 'create'\n ? t('buttons.create')\n : t('buttons.update')}\n </Components.Button>\n </Flex>\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n </section>\n )\n}\n"],"names":["computeRequiredFields","selfOnboardingActive","base","ContractorProfile","props","useComponentDictionary","jsx","BaseBoundaries","SelfOnboardingContractorProfile","ContractorProfileRoot","companyId","contractorId","defaultValues","className","onEvent","useI18n","resolvedDefaults","useMemo","ContractorType","setSelfOnboardingActive","useState","optionalFieldsToRequire","contractor","useContractorDetailsForm","BaseLayout","ContractorProfileReady","t","useTranslation","Components","useComponentContext","watchedSelfOnboarding","useWatch","useEffect","Fields","mode","handleSubmit","onboardingStatus","result","componentEvents","ContractorOnboardingStatus","classNames","styles","SDKFormProvider","jsxs","Form","Flex","Grid","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,SAASA,EACPC,GAC0C;AAC1C,QAAMC,IAAiD;AAAA,IACrD,QAAQ,CAAA;AAAA,IACR,QAAQ,CAAC,aAAa,YAAY,gBAAgB,cAAc,WAAW;AAAA,EAAA;AAE7E,SAAID,IAA6BC,IAC1B;AAAA,IACL,QAAQ,CAAC,GAAIA,EAAK,UAAU,CAAA,GAAK,OAAO,KAAK;AAAA,IAC7C,QAAQ,CAAC,GAAIA,EAAK,UAAU,CAAA,GAAK,OAAO,KAAK;AAAA,EAAA;AAEjD;AAgFO,SAASC,GAAkBC,GAA+B;AAC/D,SAAAC,EAAuB,sBAAsBD,EAAM,UAAU,GAE3D,gBAAAE,EAACC,KAAe,eAAc,sBAAqB,mBAAmBH,EAAM,mBACzE,UAAAA,EAAM,YAAY,KACjB,gBAAAE;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,cAAcJ,EAAM;AAAA,MACpB,SAASA,EAAM;AAAA,MACf,WAAWA,EAAM;AAAA,IAAA;AAAA,EAAA,IAGnB,gBAAAE,EAACG,GAAA,EAAuB,GAAGL,GAAO,EAAA,CAEtC;AAEJ;AAEA,SAASK,EAAsB;AAAA,EAC7B,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AACF,GAA2B;AACzB,EAAAC,EAAQ,oBAAoB;AAE5B,QAAMC,IAAmBC;AAAA,IACvB,OAAO,EAAE,MAAMC,EAAe,UAAU,GAAGN,EAAA;AAAA,IAC3C,CAACA,CAAa;AAAA,EAAA,GAMV,CAACX,GAAsBkB,CAAuB,IAAIC;AAAA,IACtD,CAACT,MAAiBK,EAAiB,kBAAkB;AAAA,EAAA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src/components/Contractor/Profile/ContractorProfile.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useWatch } from 'react-hook-form'\nimport { type Contractor } from '@gusto/embedded-api/models/components/contractor'\nimport classNames from 'classnames'\nimport {\n useContractorDetailsForm,\n ContractorType,\n type ContractorDetailsFormData,\n type ContractorDetailsOptionalFieldsToRequire,\n type UseContractorDetailsFormReady,\n} from './shared/useContractorDetailsForm'\nimport { SelfOnboardingContractorProfile } from './SelfOnboardingContractorProfile'\nimport styles from './ContractorProfile.module.scss'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { Form } from '@/components/Common/Form'\nimport { Flex, Grid } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { componentEvents, ContractorOnboardingStatus } from '@/shared/constants'\n\n// Once the contractor has finished self-onboarding (or the record is otherwise\n// under admin review / completed), the admin needs to view and edit SSN/EIN even\n// though the self-onboarding toggle stays on. Mirrors the Employee AdminProfile\n// `checkHasCompletedSelfOnboarding` override.\nfunction hasCompletedSelfOnboarding(contractor?: Contractor | null): boolean {\n return (\n contractor?.onboarded === true ||\n contractor?.onboardingStatus === ContractorOnboardingStatus.ONBOARDING_COMPLETED ||\n contractor?.onboardingStatus === ContractorOnboardingStatus.SELF_ONBOARDING_REVIEW ||\n contractor?.onboardingStatus === ContractorOnboardingStatus.ADMIN_ONBOARDING_REVIEW\n )\n}\n\n// The admin form restores the contractor profile's product requiredness on top\n// of the hook's API-aligned baseline (which leaves ssn/ein optional and\n// create-only fields optional on update). When the admin invites the contractor\n// to self-onboard, SSN/EIN are hidden and the contractor supplies them later, so\n// they are dropped from the required set. An SSN/EIN already on file is still\n// waived via redaction, so promoting them when not inviting is safe.\nfunction computeRequiredFields(\n selfOnboardingActive: boolean,\n): ContractorDetailsOptionalFieldsToRequire {\n const base: ContractorDetailsOptionalFieldsToRequire = {\n create: [],\n update: ['firstName', 'lastName', 'businessName', 'hourlyRate', 'workState'],\n }\n if (selfOnboardingActive) return base\n return {\n create: [...(base.create ?? []), 'ssn', 'ein'],\n update: [...(base.update ?? []), 'ssn', 'ein'],\n }\n}\n\n/**\n * Props for {@link ContractorProfile} in admin mode.\n *\n * @remarks\n * Renders the admin create/edit form. When `contractorId` is omitted, the form\n * creates a new contractor under `companyId`. When provided, it fetches and\n * updates the existing contractor.\n *\n * @public\n */\nexport interface ContractorProfileAdminProps extends BaseComponentInterface<'Contractor.Profile'> {\n /** UUID of the company the contractor belongs to. */\n companyId: string\n /** Initial values for the contractor profile form fields. */\n defaultValues?: Partial<ContractorDetailsFormData>\n /** When `true` (the default), renders the admin create/edit form. */\n isAdmin?: true\n /** UUID of an existing contractor to edit. When omitted, the form creates a new contractor. */\n contractorId?: string\n}\n\n/**\n * Props for {@link ContractorProfile} in self-onboarding mode.\n *\n * @remarks\n * Renders the contractor self-onboarding profile. The contractor must already\n * exist so its type (individual vs. business) can be resolved to determine\n * which fields to display.\n *\n * @public\n */\nexport interface ContractorProfileSelfOnboardingProps extends BaseComponentInterface<'Contractor.Profile'> {\n /** UUID of the company the contractor belongs to. */\n companyId: string\n /** Initial values for the contractor profile form fields. */\n defaultValues?: Partial<ContractorDetailsFormData>\n /** When `false`, renders the contractor self-onboarding profile. */\n isAdmin: false\n /** UUID of the existing contractor completing self-onboarding. Required in self-onboarding mode. */\n contractorId: string\n}\n\n/**\n * Props for {@link ContractorProfile}.\n *\n * @remarks\n * Discriminated by `isAdmin`. See {@link ContractorProfileAdminProps} and\n * {@link ContractorProfileSelfOnboardingProps} for the specific prop shapes.\n *\n * @public\n */\nexport type ContractorProfileProps =\n ContractorProfileAdminProps | ContractorProfileSelfOnboardingProps\n\n/**\n * Form for creating or editing a contractor profile, supporting both individual and business contractor types.\n *\n * @remarks\n * In admin mode (the default), renders different field sets depending on the contractor type (individual\n * vs. business) and wage type (hourly vs. fixed), and exposes a self-onboarding toggle that invites the\n * contractor to complete their own setup. When `contractorId` is provided, the form fetches the existing\n * contractor and updates it on submit; otherwise it creates a new contractor under `companyId`.\n *\n * When `isAdmin` is `false`, renders the contractor self-onboarding profile instead: it resolves the\n * existing contractor's type and presents the individual (name + SSN) or business (business name + EIN)\n * fields for the contractor to complete.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/created` | A new contractor was created successfully. | The created contractor entity |\n * | `contractor/updated` | An existing contractor was updated successfully. | The updated contractor entity |\n * | `contractor/profile/done` | The contractor profile step finished. | `{ contractorId: string, onboardingStatus?: string, selfOnboarding: boolean }` |\n *\n * @param props - See {@link ContractorProfileProps}.\n * @returns The rendered contractor profile form.\n * @public\n */\nexport function ContractorProfile(props: ContractorProfileProps) {\n useComponentDictionary('Contractor.Profile', props.dictionary)\n return (\n <BaseBoundaries componentName=\"Contractor.Profile\" FallbackComponent={props.FallbackComponent}>\n {props.isAdmin === false ? (\n <SelfOnboardingContractorProfile\n contractorId={props.contractorId}\n onEvent={props.onEvent}\n className={props.className}\n />\n ) : (\n <ContractorProfileRoot {...props} />\n )}\n </BaseBoundaries>\n )\n}\n\nfunction ContractorProfileRoot({\n companyId,\n contractorId,\n defaultValues,\n className,\n onEvent,\n}: ContractorProfileProps) {\n useI18n('Contractor.Profile')\n\n const resolvedDefaults = useMemo<Partial<ContractorDetailsFormData>>(\n () => ({ type: ContractorType.Business, ...defaultValues }),\n [defaultValues],\n )\n\n // Mirrors the Employee AdminProfile loop: SSN/EIN requiredness depends on the\n // self-onboarding toggle, which lives in the form the hook creates. Seed from\n // the create-mode default, then sync from the watched value (see the ready child).\n const [selfOnboardingActive, setSelfOnboardingActive] = useState(\n !contractorId && (resolvedDefaults.selfOnboarding ?? false),\n )\n\n const optionalFieldsToRequire = useMemo(\n () => computeRequiredFields(selfOnboardingActive),\n [selfOnboardingActive],\n )\n\n const contractor = useContractorDetailsForm(\n contractorId\n ? {\n companyId,\n contractorId,\n defaultValues: resolvedDefaults,\n optionalFieldsToRequire,\n }\n : {\n companyId,\n defaultValues: resolvedDefaults,\n optionalFieldsToRequire,\n },\n )\n\n if (contractor.isLoading) {\n return <BaseLayout isLoading error={contractor.errorHandling.errors} />\n }\n\n return (\n <ContractorProfileReady\n contractor={contractor}\n onEvent={onEvent}\n className={className}\n setSelfOnboardingActive={setSelfOnboardingActive}\n />\n )\n}\n\ninterface ContractorProfileReadyProps {\n contractor: UseContractorDetailsFormReady\n onEvent: ContractorProfileProps['onEvent']\n className?: string\n setSelfOnboardingActive: (value: boolean) => void\n}\n\nfunction ContractorProfileReady({\n contractor,\n onEvent,\n className,\n setSelfOnboardingActive,\n}: ContractorProfileReadyProps) {\n const { t } = useTranslation('Contractor.Profile')\n const Components = useComponentContext()\n\n const watchedSelfOnboarding = useWatch({\n control: contractor.form.hookFormInternals.formMethods.control,\n name: 'selfOnboarding',\n })\n\n useEffect(() => {\n setSelfOnboardingActive(watchedSelfOnboarding)\n }, [watchedSelfOnboarding, setSelfOnboardingActive])\n\n const { Fields } = contractor.form\n const mode = contractor.status.mode\n\n // SSN/EIN are hidden while collection is delegated to the contractor, but must\n // reappear once they've finished so the admin can review/edit them.\n const completedSelfOnboarding = hasCompletedSelfOnboarding(contractor.data.contractor)\n const showTaxId = !watchedSelfOnboarding || completedSelfOnboarding\n\n const handleSubmit = async () => {\n const result = await contractor.actions.onSubmit()\n if (!result) return\n\n onEvent(\n result.mode === 'create'\n ? componentEvents.CONTRACTOR_CREATED\n : componentEvents.CONTRACTOR_UPDATED,\n result.data,\n )\n\n onEvent(componentEvents.CONTRACTOR_PROFILE_DONE, {\n contractorId: result.data.uuid,\n onboardingStatus: result.data.onboardingStatus,\n selfOnboarding: watchedSelfOnboarding && !completedSelfOnboarding,\n })\n }\n\n return (\n <section className={classNames(styles.root, className)}>\n <BaseLayout error={contractor.errorHandling.errors}>\n <SDKFormProvider formHookResult={contractor}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={20} alignItems=\"stretch\">\n <header>\n <Flex flexDirection=\"column\" gap={4}>\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Components.Text variant=\"supporting\">{t('subtitle')}</Components.Text>\n </Flex>\n </header>\n\n {(Fields.SelfOnboarding || Fields.Email) && (\n <Components.Box>\n <Grid gap={16}>\n {Fields.SelfOnboarding && (\n <Fields.SelfOnboarding\n label={t('fields.selfOnboarding.label')}\n description={t('fields.selfOnboarding.description')}\n />\n )}\n\n {Fields.Email && (\n <Fields.Email\n label={t('fields.email.label')}\n validationMessages={{\n REQUIRED: t('validations.email'),\n INVALID_EMAIL: t('validations.emailFormat'),\n }}\n />\n )}\n </Grid>\n </Components.Box>\n )}\n\n <Fields.Type label={t('fields.contractorType.label')} />\n\n {Fields.FirstName && Fields.LastName && (\n <>\n <Grid gridTemplateColumns={{ base: '1fr', medium: '1fr 1fr' }} gap={16}>\n <Fields.FirstName\n label={t('fields.firstName.label')}\n validationMessages={{\n REQUIRED: t('validations.firstName'),\n INVALID_NAME: t('validations.firstNameFormat'),\n }}\n />\n {Fields.MiddleInitial && (\n <Fields.MiddleInitial label={t('fields.middleInitial.label')} />\n )}\n </Grid>\n <Fields.LastName\n label={t('fields.lastName.label')}\n validationMessages={{\n REQUIRED: t('validations.lastName'),\n INVALID_NAME: t('validations.lastNameFormat'),\n }}\n />\n {Fields.Ssn && showTaxId && (\n <Fields.Ssn\n label={t('fields.ssn.label')}\n validationMessages={{\n INVALID_SSN: t('validations.ssnFormat'),\n REQUIRED: t('validations.ssn'),\n }}\n />\n )}\n </>\n )}\n\n {Fields.BusinessName && (\n <>\n <Fields.BusinessName\n label={t('fields.businessName.label')}\n validationMessages={{ REQUIRED: t('validations.businessName') }}\n />\n {Fields.Ein && showTaxId && (\n <Fields.Ein\n label={t('fields.ein.label')}\n validationMessages={{\n INVALID_EIN: t('validations.einFormat'),\n REQUIRED: t('validations.ein'),\n }}\n />\n )}\n </>\n )}\n\n <Fields.WageType label={t('fields.wageType.label')} />\n\n {Fields.HourlyRate && (\n <Fields.HourlyRate\n label={t('fields.hourlyRate.label')}\n min={0}\n format=\"currency\"\n validationMessages={{ REQUIRED: t('validations.hourlyRate') }}\n />\n )}\n\n <Fields.StartDate\n label={t('fields.startDate.label')}\n description={t('fields.startDate.description')}\n validationMessages={{ REQUIRED: t('validations.startDate') }}\n />\n </Flex>\n\n <Flex gap={12} justifyContent=\"flex-end\">\n <Components.Button\n type=\"submit\"\n variant=\"primary\"\n isDisabled={contractor.status.isPending}\n >\n {contractor.status.isPending\n ? mode === 'create'\n ? t('buttons.creating')\n : t('buttons.updating')\n : mode === 'create'\n ? t('buttons.create')\n : t('buttons.update')}\n </Components.Button>\n </Flex>\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n </section>\n )\n}\n"],"names":["hasCompletedSelfOnboarding","contractor","ContractorOnboardingStatus","computeRequiredFields","selfOnboardingActive","base","ContractorProfile","props","useComponentDictionary","jsx","BaseBoundaries","SelfOnboardingContractorProfile","ContractorProfileRoot","companyId","contractorId","defaultValues","className","onEvent","useI18n","resolvedDefaults","useMemo","ContractorType","setSelfOnboardingActive","useState","optionalFieldsToRequire","useContractorDetailsForm","BaseLayout","ContractorProfileReady","t","useTranslation","Components","useComponentContext","watchedSelfOnboarding","useWatch","useEffect","Fields","mode","completedSelfOnboarding","showTaxId","handleSubmit","result","componentEvents","classNames","styles","SDKFormProvider","jsxs","Form","Flex","Grid","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,SAASA,EAA2BC,GAAyC;AAC3E,SACEA,GAAY,cAAc,MAC1BA,GAAY,qBAAqBC,EAA2B,wBAC5DD,GAAY,qBAAqBC,EAA2B,0BAC5DD,GAAY,qBAAqBC,EAA2B;AAEhE;AAQA,SAASC,EACPC,GAC0C;AAC1C,QAAMC,IAAiD;AAAA,I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OAAOP,EAAE,kBAAkB;AAAA,YAC3B,oBAAoB;AAAA,cAClB,aAAaA,EAAE,uBAAuB;AAAA,cACtC,UAAUA,EAAE,iBAAiB;AAAA,YAAA;AAAA,UAC/B;AAAA,QAAA;AAAA,MACF,GAEJ;AAAA,wBAGDO,EAAO,UAAP,EAAgB,OAAOP,EAAE,uBAAuB,GAAG;AAAA,MAEnDO,EAAO,cACN,gBAAA1B;AAAA,QAAC0B,EAAO;AAAA,QAAP;AAAA,UACC,OAAOP,EAAE,yBAAyB;AAAA,UAClC,KAAK;AAAA,UACL,QAAO;AAAA,UACP,oBAAoB,EAAE,UAAUA,EAAE,wBAAwB,EAAA;AAAA,QAAE;AAAA,MAAA;AAAA,MAIhE,gBAAAnB;AAAA,QAAC0B,EAAO;AAAA,QAAP;AAAA,UACC,OAAOP,EAAE,wBAAwB;AAAA,UACjC,aAAaA,EAAE,8BAA8B;AAAA,UAC7C,oBAAoB,EAAE,UAAUA,EAAE,uBAAuB,EAAA;AAAA,QAAE;AAAA,MAAA;AAAA,IAC7D,GACF;AAAA,IAEA,gBAAAnB,EAACsC,GAAA,EAAK,KAAK,IAAI,gBAAe,YAC5B,UAAA,gBAAAtC;AAAA,MAACqB,EAAW;AAAA,MAAX;AAAA,QACC,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,YAAY7B,EAAW,OAAO;AAAA,QAE7B,YAAW,OAAO,YAEb2B,EADFQ,MAAS,WACL,qBACA,kBADkB,IAGpBR,EADFQ,MAAS,WACL,mBACA,gBADgB;AAAA,MACA;AAAA,IAAA,EAC1B,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, jsxs as a, Fragment as p } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as g } from "react-i18next";
|
|
3
|
-
import
|
|
4
|
-
import { useContractorDetailsForm as
|
|
3
|
+
import b from "classnames";
|
|
4
|
+
import { useContractorDetailsForm as N } from "./shared/useContractorDetailsForm/useContractorDetailsForm.js";
|
|
5
5
|
import I from "./ContractorProfile.module.scss.js";
|
|
6
6
|
import { BaseLayout as d } from "../../Base/Base.js";
|
|
7
7
|
import "../../Base/useBase.js";
|
|
@@ -20,33 +20,34 @@ function H({
|
|
|
20
20
|
onEvent: l,
|
|
21
21
|
className: c
|
|
22
22
|
}) {
|
|
23
|
-
const { t: i } = g("Contractor.Profile"),
|
|
23
|
+
const { t: i } = g("Contractor.Profile"), o = F(), t = N({
|
|
24
24
|
contractorId: f,
|
|
25
25
|
withSelfOnboardingField: !1,
|
|
26
26
|
defaultValues: { selfOnboarding: !0 },
|
|
27
27
|
optionalFieldsToRequire: R
|
|
28
28
|
});
|
|
29
|
-
if (
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
const { Fields:
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
contractorId:
|
|
29
|
+
if (t.isLoading)
|
|
30
|
+
return /* @__PURE__ */ r(d, { isLoading: !0, error: t.errorHandling.errors });
|
|
31
|
+
const { Fields: e } = t.form, u = async () => {
|
|
32
|
+
const n = await t.actions.onSubmit();
|
|
33
|
+
n && (l(m.CONTRACTOR_UPDATED, n.data), l(m.CONTRACTOR_PROFILE_DONE, {
|
|
34
|
+
contractorId: n.data.uuid,
|
|
35
|
+
onboardingStatus: n.data.onboardingStatus,
|
|
35
36
|
selfOnboarding: !0
|
|
36
37
|
}));
|
|
37
38
|
};
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ r("section", { className: b(I.root, c), children: /* @__PURE__ */ r(d, { error: t.errorHandling.errors, children: /* @__PURE__ */ r(D, { formHookResult: t, children: /* @__PURE__ */ a(h, { onSubmit: () => {
|
|
39
40
|
u();
|
|
40
41
|
}, children: [
|
|
41
42
|
/* @__PURE__ */ a(s, { flexDirection: "column", gap: 20, alignItems: "stretch", children: [
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ r("header", { children: /* @__PURE__ */ a(s, { flexDirection: "column", gap: 4, children: [
|
|
44
|
+
/* @__PURE__ */ r(o.Heading, { as: "h2", children: i("selfOnboarding.title") }),
|
|
45
|
+
/* @__PURE__ */ r(o.Text, { variant: "supporting", children: i("selfOnboarding.individualDescription") })
|
|
45
46
|
] }) }),
|
|
46
|
-
|
|
47
|
+
e.FirstName && e.LastName && /* @__PURE__ */ a(p, { children: [
|
|
47
48
|
/* @__PURE__ */ a(v, { gridTemplateColumns: { base: "1fr", medium: "1fr 1fr" }, gap: 16, children: [
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
49
|
+
/* @__PURE__ */ r(
|
|
50
|
+
e.FirstName,
|
|
50
51
|
{
|
|
51
52
|
label: i("fields.firstName.label"),
|
|
52
53
|
validationMessages: {
|
|
@@ -55,10 +56,10 @@ function H({
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
),
|
|
58
|
-
|
|
59
|
+
e.MiddleInitial && /* @__PURE__ */ r(e.MiddleInitial, { label: i("fields.middleInitial.label") })
|
|
59
60
|
] }),
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
61
|
+
/* @__PURE__ */ r(
|
|
62
|
+
e.LastName,
|
|
62
63
|
{
|
|
63
64
|
label: i("fields.lastName.label"),
|
|
64
65
|
validationMessages: {
|
|
@@ -67,8 +68,8 @@ function H({
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
),
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
e.Ssn && /* @__PURE__ */ r(
|
|
72
|
+
e.Ssn,
|
|
72
73
|
{
|
|
73
74
|
label: i("fields.ssn.label"),
|
|
74
75
|
validationMessages: {
|
|
@@ -79,13 +80,13 @@ function H({
|
|
|
79
80
|
)
|
|
80
81
|
] })
|
|
81
82
|
] }),
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
|
|
83
|
+
/* @__PURE__ */ r(s, { gap: 12, justifyContent: "flex-end", children: /* @__PURE__ */ r(
|
|
84
|
+
o.Button,
|
|
84
85
|
{
|
|
85
86
|
type: "submit",
|
|
86
87
|
variant: "primary",
|
|
87
|
-
isDisabled:
|
|
88
|
-
children:
|
|
88
|
+
isDisabled: t.status.isPending,
|
|
89
|
+
children: t.status.isPending ? i("selfOnboarding.submitting") : i("selfOnboarding.continue")
|
|
89
90
|
}
|
|
90
91
|
) })
|
|
91
92
|
] }) }) }) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndividualSelfOnboardingProfile.js","sources":["../../../../src/components/Contractor/Profile/IndividualSelfOnboardingProfile.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport {\n useContractorDetailsForm,\n type ContractorDetailsOptionalFieldsToRequire,\n} from './shared/useContractorDetailsForm'\nimport type { ContractorSelfOnboardingProfileProps } from './SelfOnboardingContractorProfile'\nimport styles from './ContractorProfile.module.scss'\nimport { BaseLayout } from '@/components/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { Form } from '@/components/Common/Form'\nimport { Flex, Grid } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { componentEvents } from '@/shared/constants'\n\nconst INDIVIDUAL_REQUIRED_FIELDS: ContractorDetailsOptionalFieldsToRequire = {\n update: ['firstName', 'lastName', 'ssn'],\n}\n\n/**\n * Self-onboarding profile for an individual contractor — collects legal name\n * and SSN.\n *\n * @internal\n */\nexport function IndividualSelfOnboardingProfile({\n contractorId,\n onEvent,\n className,\n}: ContractorSelfOnboardingProfileProps) {\n const { t } = useTranslation('Contractor.Profile')\n const Components = useComponentContext()\n\n const contractor = useContractorDetailsForm({\n contractorId,\n withSelfOnboardingField: false,\n defaultValues: { selfOnboarding: true },\n optionalFieldsToRequire: INDIVIDUAL_REQUIRED_FIELDS,\n })\n\n if (contractor.isLoading) {\n return <BaseLayout isLoading error={contractor.errorHandling.errors} />\n }\n\n const { Fields } = contractor.form\n\n const handleSubmit = async () => {\n const result = await contractor.actions.onSubmit()\n if (!result) return\n\n onEvent(componentEvents.CONTRACTOR_UPDATED, result.data)\n onEvent(componentEvents.CONTRACTOR_PROFILE_DONE, {\n contractorId: result.data.uuid,\n selfOnboarding: true,\n })\n }\n\n return (\n <section className={classNames(styles.root, className)}>\n <BaseLayout error={contractor.errorHandling.errors}>\n <SDKFormProvider formHookResult={contractor}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={20} alignItems=\"stretch\">\n <header>\n <Flex flexDirection=\"column\" gap={4}>\n <Components.Heading as=\"h2\">{t('selfOnboarding.title')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('selfOnboarding.individualDescription')}\n </Components.Text>\n </Flex>\n </header>\n\n {Fields.FirstName && Fields.LastName && (\n <>\n <Grid gridTemplateColumns={{ base: '1fr', medium: '1fr 1fr' }} gap={16}>\n <Fields.FirstName\n label={t('fields.firstName.label')}\n validationMessages={{\n REQUIRED: t('validations.firstName'),\n INVALID_NAME: t('validations.firstNameFormat'),\n }}\n />\n {Fields.MiddleInitial && (\n <Fields.MiddleInitial label={t('fields.middleInitial.label')} />\n )}\n </Grid>\n <Fields.LastName\n label={t('fields.lastName.label')}\n validationMessages={{\n REQUIRED: t('validations.lastName'),\n INVALID_NAME: t('validations.lastNameFormat'),\n }}\n />\n {Fields.Ssn && (\n <Fields.Ssn\n label={t('fields.ssn.label')}\n validationMessages={{\n INVALID_SSN: t('validations.ssnFormat'),\n REQUIRED: t('validations.ssn'),\n }}\n />\n )}\n </>\n )}\n </Flex>\n\n <Flex gap={12} justifyContent=\"flex-end\">\n <Components.Button\n type=\"submit\"\n variant=\"primary\"\n isDisabled={contractor.status.isPending}\n >\n {contractor.status.isPending\n ? t('selfOnboarding.submitting')\n : t('selfOnboarding.continue')}\n </Components.Button>\n </Flex>\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n </section>\n )\n}\n"],"names":["INDIVIDUAL_REQUIRED_FIELDS","IndividualSelfOnboardingProfile","contractorId","onEvent","className","t","useTranslation","Components","useComponentContext","contractor","useContractorDetailsForm","BaseLayout","Fields","handleSubmit","result","componentEvents","jsx","classNames","styles","SDKFormProvider","jsxs","Form","Flex","Fragment","Grid"],"mappings":";;;;;;;;;;;;;;AAeA,MAAMA,IAAuE;AAAA,EAC3E,QAAQ,CAAC,aAAa,YAAY,KAAK;AACzC;AAQO,SAASC,EAAgC;AAAA,EAC9C,cAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AACF,GAAyC;AACvC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,oBAAoB,GAC3CC,IAAaC,EAAA,GAEbC,IAAaC,EAAyB;AAAA,IAC1C,cAAAR;AAAA,IACA,yBAAyB;AAAA,IACzB,eAAe,EAAE,gBAAgB,GAAA;AAAA,IACjC,yBAAyBF;AAAA,EAAA,CAC1B;AAED,MAAIS,EAAW;AACb,6BAAQE,GAAA,EAAW,WAAS,IAAC,OAAOF,EAAW,cAAc,QAAQ;AAGvE,QAAM,EAAE,QAAAG,MAAWH,EAAW,MAExBI,IAAe,YAAY;AAC/B,UAAMC,IAAS,MAAML,EAAW,QAAQ,SAAA;AACxC,IAAKK,MAELX,EAAQY,EAAgB,oBAAoBD,EAAO,IAAI,GACvDX,EAAQY,EAAgB,yBAAyB;AAAA,MAC/C,cAAcD,EAAO,KAAK;AAAA,MAC1B,gBAAgB;AAAA,IAAA,CACjB;AAAA,EACH;AAEA,SACE,gBAAAE,EAAC,WAAA,EAAQ,WAAWC,EAAWC,EAAO,MAAMd,CAAS,GACnD,UAAA,gBAAAY,EAACL,GAAA,EAAW,OAAOF,EAAW,cAAc,QAC1C,UAAA,gBAAAO,EAACG,GAAA,EAAgB,gBAAgBV,GAC/B,UAAA,gBAAAW,EAACC,KAAK,UAAU,MAAA;AAAM,IAAKR,EA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A,cAClB,aAAaA,EAAE,uBAAuB;AAAA,cACtC,UAAUA,EAAE,iBAAiB;AAAA,YAAA;AAAA,UAC/B;AAAA,QAAA;AAAA,MACF,EAAA,CAEJ;AAAA,IAAA,GAEJ;AAAA,IAEA,gBAAAW,EAACM,GAAA,EAAK,KAAK,IAAI,gBAAe,YAC5B,UAAA,gBAAAN;AAAA,MAACT,EAAW;AAAA,MAAX;AAAA,QACC,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,YAAYE,EAAW,OAAO;AAAA,QAE7B,YAAW,OAAO,YACfJ,EAAE,2BAA2B,IAC7BA,EAAE,yBAAyB;AAAA,MAAA;AAAA,IAAA,EACjC,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"IndividualSelfOnboardingProfile.js","sources":["../../../../src/components/Contractor/Profile/IndividualSelfOnboardingProfile.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport {\n useContractorDetailsForm,\n type ContractorDetailsOptionalFieldsToRequire,\n} from './shared/useContractorDetailsForm'\nimport type { ContractorSelfOnboardingProfileProps } from './SelfOnboardingContractorProfile'\nimport styles from './ContractorProfile.module.scss'\nimport { BaseLayout } from '@/components/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { Form } from '@/components/Common/Form'\nimport { Flex, Grid } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { componentEvents } from '@/shared/constants'\n\nconst INDIVIDUAL_REQUIRED_FIELDS: ContractorDetailsOptionalFieldsToRequire = {\n update: ['firstName', 'lastName', 'ssn'],\n}\n\n/**\n * Self-onboarding profile for an individual contractor — collects legal name\n * and SSN.\n *\n * @internal\n */\nexport function IndividualSelfOnboardingProfile({\n contractorId,\n onEvent,\n className,\n}: ContractorSelfOnboardingProfileProps) {\n const { t } = useTranslation('Contractor.Profile')\n const Components = useComponentContext()\n\n const contractor = useContractorDetailsForm({\n contractorId,\n withSelfOnboardingField: false,\n defaultValues: { selfOnboarding: true },\n optionalFieldsToRequire: INDIVIDUAL_REQUIRED_FIELDS,\n })\n\n if (contractor.isLoading) {\n return <BaseLayout isLoading error={contractor.errorHandling.errors} />\n }\n\n const { Fields } = contractor.form\n\n const handleSubmit = async () => {\n const result = await contractor.actions.onSubmit()\n if (!result) return\n\n onEvent(componentEvents.CONTRACTOR_UPDATED, result.data)\n onEvent(componentEvents.CONTRACTOR_PROFILE_DONE, {\n contractorId: result.data.uuid,\n onboardingStatus: result.data.onboardingStatus,\n selfOnboarding: true,\n })\n }\n\n return (\n <section className={classNames(styles.root, className)}>\n <BaseLayout error={contractor.errorHandling.errors}>\n <SDKFormProvider formHookResult={contractor}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={20} alignItems=\"stretch\">\n <header>\n <Flex flexDirection=\"column\" gap={4}>\n <Components.Heading as=\"h2\">{t('selfOnboarding.title')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('selfOnboarding.individualDescription')}\n </Components.Text>\n </Flex>\n </header>\n\n {Fields.FirstName && Fields.LastName && (\n <>\n <Grid gridTemplateColumns={{ base: '1fr', medium: '1fr 1fr' }} gap={16}>\n <Fields.FirstName\n label={t('fields.firstName.label')}\n validationMessages={{\n REQUIRED: t('validations.firstName'),\n INVALID_NAME: t('validations.firstNameFormat'),\n }}\n />\n {Fields.MiddleInitial && (\n <Fields.MiddleInitial label={t('fields.middleInitial.label')} />\n )}\n </Grid>\n <Fields.LastName\n label={t('fields.lastName.label')}\n validationMessages={{\n REQUIRED: t('validations.lastName'),\n INVALID_NAME: t('validations.lastNameFormat'),\n }}\n />\n {Fields.Ssn && (\n <Fields.Ssn\n label={t('fields.ssn.label')}\n validationMessages={{\n INVALID_SSN: t('validations.ssnFormat'),\n REQUIRED: t('validations.ssn'),\n }}\n />\n )}\n </>\n )}\n </Flex>\n\n <Flex gap={12} justifyContent=\"flex-end\">\n <Components.Button\n type=\"submit\"\n variant=\"primary\"\n isDisabled={contractor.status.isPending}\n >\n {contractor.status.isPending\n ? t('selfOnboarding.submitting')\n : t('selfOnboarding.continue')}\n </Components.Button>\n </Flex>\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n </section>\n )\n}\n"],"names":["INDIVIDUAL_REQUIRED_FIELDS","IndividualSelfOnboardingProfile","contractorId","onEvent","className","t","useTranslation","Components","useComponentContext","contractor","useContractorDetailsForm","BaseLayout","Fields","handleSubmit","result","componentEvents","jsx","classNames","styles","SDKFormProvider","jsxs","Form","Flex","Fragment","Grid"],"mappings":";;;;;;;;;;;;;;AAeA,MAAMA,IAAuE;AAAA,EAC3E,QAAQ,CAAC,aAAa,YAAY,KAAK;AACzC;AAQO,SAASC,EAAgC;AAAA,EAC9C,cAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AACF,GAAyC;AACvC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,oBAAoB,GAC3CC,IAAaC,EAAA,GAEbC,IAAaC,EAAyB;AAAA,IAC1C,cAAAR;AAAA,IACA,yBAAyB;AAAA,IACzB,eAAe,EAAE,gBAAgB,GAAA;AAAA,IACjC,yBAAyBF;AAAA,EAAA,CAC1B;AAED,MAAIS,EAAW;AACb,6BAAQE,GAAA,EAAW,WAAS,IAAC,OAAOF,EAAW,cAAc,QAAQ;AAGvE,QAAM,EAAE,QAAAG,MAAWH,EAAW,MAExBI,IAAe,YAAY;AAC/B,UAAMC,IAAS,MAAML,EAAW,QAAQ,SAAA;AACxC,IAAKK,MAELX,EAAQY,EAAgB,oBAAoBD,EAAO,IAAI,GACvDX,EAAQY,EAAgB,yBAAyB;AAAA,MAC/C,cAAcD,EAAO,KAAK;AAAA,MAC1B,kBAAkBA,EAAO,KAAK;AAAA,MAC9B,gBAAgB;AAAA,IAAA,CACjB;AAAA,EACH;AAEA,SACE,gBAAAE,EAAC,WAAA,EAAQ,WAAWC,EAAWC,EAAO,MAAMd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