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.

Each requestFieldId in the pre-config is matched against sub-field slug or text (case-insensitive). Prefer slug when generating pre-filled links.

Related


initialRequestFieldsData

initialRequestFieldsData: ApiResource<TRequestField[]>

Complete request-field definitions as returned from the API (after filtering inactive groups), including hidden sub-fields.

The SDK uses this resource internally for validation, pre-config matching, select-value localization, and session reset defaults. Integrations that need to submit hidden or readonly values should read values from requestFieldsValues — those keys still exist for every sub-field defined here, even when the sub-field is not shown in requestFieldsData.

Related


requestFieldsData

requestFieldsData: ApiResource<TRequestField[]>

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

This is derived from initialRequestFieldsData: sub-fields with mode: "hidden" are stripped out, and empty groups are removed. Hidden fields are omitted from the checkout UI but their values can still be set via pre-config or API defaults and are included in submission.

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). Each sub-field has a name, an optional slug, a text label, a required flag, and a mode:

modeUI behaviourUser can edit via SDK
"editable"Shown as a normal inputYes — setSubFieldValue
"readonly"Shown but not editableNo — values come from defaults or pre-config
"hidden"Not listed in requestFieldsDataNo — not shown; value still stored if present

The UI should render each visible sub-field according to its type:

TypeDescription
textSingle-line text input
numberNumeric input
textareaMulti-line text input
checkboxBoolean; stored as "true" / "false"
selectDropdown with predefined options (see below)

Select sub-fields include an options array. Each option has a slug, a label, and optional per-language labels (e.g. da_label). Store the selected option’s label via setSubFieldValue. When the user changes language, the SDK re-localizes stored select values automatically.

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"
| "invalid-option"
}
}

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

Errors are recomputed automatically when requestFieldsValues change (and when request-field definitions load). You do not need to validate manually after each keystroke.

false means the field is valid. String values indicate the type of error:

ErrorWhen
"missing"Required field is empty
"invalid-number"Required number field is not a valid number
"unchecked-checkbox"Required checkbox is unchecked
"invalid-option"Required select field value does not match any option

Fixed name and email errors are kept in sync with fixedContactDetails values the same way.

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