Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .reports/embedded-react-sdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1390,11 +1390,16 @@ export const ContractorOnboardingStatus: {
function ContractorProfile(props: ContractorProfileProps): JSX;

// @public
interface ContractorProfileProps extends BaseComponentInterface<'Contractor.Profile'> {
type ContractorProfileProps = BaseComponentInterface<'Contractor.Profile'> & {
companyId: string;
contractorId?: string;
defaultValues?: Partial<ContractorDetailsFormData>;
}
} & ({
isAdmin?: true;
contractorId?: string;
} | {
isAdmin: false;
contractorId: string;
});

// @public
export function ContractorSelfOnboardingField(props: ContractorSelfOnboardingFieldProps): JSX;
Expand Down
404 changes: 0 additions & 404 deletions docs/api/Contractor/hooks.md

This file was deleted.

27 changes: 14 additions & 13 deletions docs/reference/contractor/hooks/use-contractor-details-form.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ Text input bound to the `ein` field of [useContractorDetailsForm](#usecontractor

#### Remarks

Available on the hook result as `form.Fields.Ein` for business contractors
who are not self-onboarding. Auto-formats input as `XX-XXXXXXX`. When the
contractor already has an EIN on file, the field shows a masked placeholder
and the required rule is waived.
Available on the hook result as `form.Fields.Ein` for business contractors.
Auto-formats input as `XX-XXXXXXX`. When the contractor already has an EIN on
file, the field shows a masked placeholder and the required rule is waived.

***

Expand Down Expand Up @@ -205,10 +204,10 @@ Text input bound to the `ssn` field of [useContractorDetailsForm](#usecontractor

#### Remarks

Available on the hook result as `form.Fields.Ssn` for individual contractors
who are not self-onboarding. Auto-formats input with dashes
(`XXX-XX-XXXX`). When the contractor already has an SSN on file, the field
shows a masked placeholder and the required rule is waived.
Available on the hook result as `form.Fields.Ssn` for individual contractors.
Auto-formats input with dashes (`XXX-XX-XXXX`). When the contractor already
has an SSN on file, the field shows a masked placeholder and the required
rule is waived.

***

Expand Down Expand Up @@ -316,9 +315,11 @@ A [HookLoadingResult](../../utilities.md#hookloadingresult) while loading, or a
Returns a discriminated union: a loading variant while the contractor fetch
resolves, and a ready variant exposing the form's data, pending status,
submit action, error handling, and bound `Fields`. Field visibility is
driven by the current `type`, `wageType`, and self-onboarding selection;
fields that do not apply are `undefined` on `form.Fields`. Self-onboarding
is only toggleable when the contractor's onboarding status allows it.
driven by the current `type` and `wageType` (self-onboarding only toggles the
`Email` field); fields that do not apply are `undefined` on `form.Fields`.
SSN/EIN are exposed by contractor type regardless of self-onboarding — each
consumer decides whether to render them. Self-onboarding is only toggleable
when the contractor's onboarding status allows it.

## Variables

Expand Down Expand Up @@ -395,15 +396,15 @@ before rendering.
| Property | Type | Description |
| ------ | ------ | ------ |
| `BusinessName` | ((`props`) => `Element`) \| `undefined` | Text input bound to `businessName`; available only for business contractors. |
| `Ein` | ((`props`) => `Element`) \| `undefined` | Text input bound to `ein`; available only for business contractors who are not self-onboarding. |
| `Ein` | ((`props`) => `Element`) \| `undefined` | Text input bound to `ein`; available only for business contractors. |
| `Email` | ((`props`) => `Element`) \| `undefined` | Text input bound to `email`; available only when self-onboarding is enabled. |
| `FileNewHireReport` | ((`props`) => `Element`) \| `undefined` | Switch bound to `fileNewHireReport`; available only for individual contractors. |
| `FirstName` | ((`props`) => `Element`) \| `undefined` | Text input bound to `firstName`; available only for individual contractors. |
| `HourlyRate` | ((`props`) => `Element`) \| `undefined` | Number input bound to `hourlyRate`; available only when `wageType` is `Hourly`. |
| `LastName` | ((`props`) => `Element`) \| `undefined` | Text input bound to `lastName`; available only for individual contractors. |
| `MiddleInitial` | ((`props`) => `Element`) \| `undefined` | Text input bound to `middleInitial`; available only for individual contractors. |
| `SelfOnboarding` | ((`props`) => `Element`) \| `undefined` | Switch bound to `selfOnboarding`; available only when toggleable. |
| `Ssn` | ((`props`) => `Element`) \| `undefined` | Text input bound to `ssn`; available only for individual contractors who are not self-onboarding. |
| `Ssn` | ((`props`) => `Element`) \| `undefined` | Text input bound to `ssn`; available only for individual contractors. |
| `StartDate` | (`props`) => `Element` | Date picker bound to `startDate`. Always available. |
| `Type` | (`props`) => `Element` | Radio group bound to `type`. Always available. |
| `WageType` | (`props`) => `Element` | Radio group bound to `wageType`. Always available. |
Expand Down
50 changes: 33 additions & 17 deletions docs/reference/contractor/onboarding/blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,22 @@ _Inherits `children`, `className`, `defaultValues`, `FallbackComponent`, `Loader

Form for creating or editing a contractor profile, supporting both individual and business contractor types.

### ContractorProfileProps

<a id="contractorprofileprops"></a>
### Parameters

Props for [ContractorProfile](#contractorprofile).

| Property | Type | Description |
| Parameter | Type | Description |
| ------ | ------ | ------ |
| `companyId` | `string` | UUID of the company the contractor belongs to. |
| `onEvent` | [`OnEventType`](../../index.md#oneventtype)\<[`EventType`](../../events.md#eventtype), `unknown`\> | Callback invoked each time the component emits an event — user interactions, successful API responses, step transitions, or errors. Receives the event type constant and an optional payload whose shape varies by event. See the [Event Handling guide](https://docs.gusto.com/embedded-payroll/docs/event-handling) and each component's event table for the full list of emitted events. |
| `contractorId?` | `string` | UUID of an existing contractor to edit. When omitted, the form creates a new contractor. |
| `defaultValues?` | `Partial`\<[`ContractorDetailsFormData`](../hooks/use-contractor-details-form.md#contractordetailsformdata)\> | Initial values for the contractor profile form fields. |
| `dictionary?` | `Record`\<`"en"`, [`DeepPartial`](../../index.md#deeppartial)\<`ContractorProfile`\>\> | Overrides for the component's i18n strings. Supply a partial object whose keys match the component's resource namespace — any omitted keys fall back to SDK defaults. See the [Translation guide](https://docs.gusto.com/embedded-payroll/docs/translation) for details. |

_Inherits `children`, `className`, `FallbackComponent`, `LoaderComponent` from [BaseComponentInterface](../../index.md#basecomponentinterface)._
| `props` | [`ContractorProfileProps`](#contractorprofileprops) | See [ContractorProfileProps](#contractorprofileprops). |

### Remarks

Renders different field sets depending on the contractor type (individual vs. business) and wage type
(hourly vs. fixed), and exposes a self-onboarding toggle that invites the contractor to complete their
own setup. When `contractorId` is provided, the form fetches the existing contractor and updates it on
submit; otherwise it creates a new contractor under `companyId`.
In admin mode (the default), renders different field sets depending on the contractor type (individual
vs. business) and wage type (hourly vs. fixed), and exposes a self-onboarding toggle that invites the
contractor to complete their own setup. When `contractorId` is provided, the form fetches the existing
contractor and updates it on submit; otherwise it creates a new contractor under `companyId`.

When `isAdmin` is `false`, renders the contractor self-onboarding profile instead: it resolves the
existing contractor's type and presents the individual (name + SSN) or business (business name + EIN)
fields for the contractor to complete.

| Event | Description | Data |
| ----- | ----------- | ---- |
Expand Down Expand Up @@ -276,6 +270,28 @@ function PaymentMethodStep() {

Pre-fill values accepted by [Address](#address). At least one of `street1`, `street2`, `city`, `state`, or `zip` must be provided.

<a id="contractorprofileprops"></a>

### ContractorProfileProps

> **ContractorProfileProps** = [`BaseComponentInterface`](../../index.md#basecomponentinterface)\<`"Contractor.Profile"`\> & `object` & \{ `contractorId?`: `string`; `isAdmin?`: `true`; \} \| \{ `contractorId`: `string`; `isAdmin`: `false`; \}

Props for [ContractorProfile](#contractorprofile).

#### Type Declaration

| Name | Type | Description |
| ------ | ------ | ------ |
| `companyId` | `string` | UUID of the company the contractor belongs to. |
| `defaultValues?` | `Partial`\<[`ContractorDetailsFormData`](../hooks/use-contractor-details-form.md#contractordetailsformdata)\> | Initial values for the contractor profile form fields. |

#### Remarks

Discriminated by `isAdmin`. In admin mode (the default) `contractorId` is
optional — omitting it creates a new contractor. In self-onboarding mode
(`isAdmin={false}`) `contractorId` is required, because the contractor must
already exist for its type (individual vs. business) to be resolved.

<a id="onboardingflowdefaultvalues"></a>

### OnboardingFlowDefaultValues
Expand Down
1 change: 0 additions & 1 deletion docs/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ shape mixed into every public SDK feature component.
- [`OnboardingFlowProps`](contractor/onboarding/onboarding-flow.md#onboardingflowprops)
- [`LandingProps`](contractor/onboarding/blocks.md#landingprops)
- [`ContractorListProps`](contractor/onboarding/blocks.md#contractorlistprops)
- [`ContractorProfileProps`](contractor/onboarding/blocks.md#contractorprofileprops)
- [`PaymentMethodProps`](contractor/onboarding/blocks.md#paymentmethodprops)
- [`NewHireReportProps`](contractor/onboarding/blocks.md#newhirereportprops)
- [`ContractorSubmitProps`](contractor/onboarding/blocks.md#contractorsubmitprops)
Expand Down
Loading
Loading