Skip to content

contactDetailsSubstore

Manages the contact information the user fills in before submitting a request. This includes two fixed fields (name and email) and a set of dynamic request fields loaded from the API. All fields perform inline validation on change.

Table of contents

Properties

Methods


Properties

tempPreConfigRequestFields

tempPreConfigRequestFields: TPreConfigRequestFields | undefined

Temporary pre-config request field overrides, automatically cleared after they are applied.

When configsSubstore.setupFromPreConfig is called with a preConfig that contains request-field values, those values are written here first. The substore then consumes them to pre-fill requestFieldsValues and immediately sets this property back to undefined.

Related


requestFieldsData

requestFieldsData: ApiResource<TRequestField[]>

API resource containing the dynamic request-field definitions, including loading and error state.

Each TRequestField describes a field group with one or more sub-fields (e.g., a company address field with street, city, and postal-code sub-fields). The UI should render each field according to its type and the sub-fields it contains.

See ApiResource for the shape of loading/error state.

Related


requestFieldsValues

requestFieldsValues: {
[requestFieldId: number]: {
[requestSubFieldId: number]: string
}
}

Current user-entered values for all request fields, keyed by field ID and sub-field ID.

Initialised to empty strings. Updated by setSubFieldValue. The entire structure is sent to the API when submitting (see submitSubstore.submit).

Related


requestFieldsErrors

requestFieldsErrors: {
[requestFieldId: number]: {
[requestSubFieldId: number]:
| false
| "missing"
| "invalid-number"
| "unchecked-checkbox"
}
}

Validation error state for all request fields, keyed by field ID and sub-field ID.

false means the field is valid. String values indicate the type of error. Errors are recomputed each time setSubFieldValue is called and also when submitSubstore.submit is triggered to catch unfilled fields.

Related


fixedContactDetails

fixedContactDetails: {
id: "name" | "email";
value: string;
error: false | "missing" | "invalid-email";
}[]

The fixed name and email contact fields with their current values and validation error states.

Always contains exactly two entries (one for "name", one for "email"). Updated by setFixedContactDetailsValue.

Related


Methods

setSubFieldValue

setSubFieldValue: (args: {
requestFieldId: number;
requestSubFieldId: number;
value: string;
}) => void

Updates a specific sub-field value and revalidates it immediately.

After writing the new value to requestFieldsValues, the SDK synchronously recomputes the error entry in requestFieldsErrors for this sub-field.

Parameters

NameTypeDescription
args.requestFieldIdnumberID of the parent request field
args.requestSubFieldIdnumberID of the sub-field to update
args.valuestringNew string value

Related


setFixedContactDetailsValue

setFixedContactDetailsValue: (args: {
id: "name" | "email";
value: string;
}) => void

Updates a fixed contact field (name or email) and runs validation on the new value.

After writing the value, the SDK synchronously validates it:

  • "name" — checks the field is not empty
  • "email" — checks the field is not empty and matches a valid email pattern

Parameters

NameTypeDescription
args.id"name" | "email"Which fixed field to update
args.valuestringNew string value

Related