Integration fields are used for defining user inputs in various parts of Proposales. (The content details sidebar and integration configuration page use these).

Integration Fields
// All types of fields are based on this type
type BaseIntegrationField = {
  id: string;
  name: string;
  readOnly?: boolean;
  defaultValue?: unknown;
  required?: boolean;
};

type IntegrationField =
  | IntegrationSelectField
  | IntegrationNumberField
  | IntegrationTextField
  | IntegrationHiddenField;

Select

The select field creates a select input, with the options specified

Select Field
type IntegrationSelectField = BaseIntegrationField & {
  type: 'select';
  defaultValue?: string;
  options?: {
    name: string;
    value?: string;
  }[];
};

Text Input

The text input can be of various HTML text input types

Text Field
type IntegrationTextField = BaseIntegrationField & {
  type: 'text' | 'url' | 'tel';
  defaultValue?: string;
};

Number Input

This works the same as text fields, but with numeric values

Number Field
type IntegrationNumberField = BaseIntegrationField & {
  type: 'number';
  defaultValue?: number | string;
  min?: number;
  max?: number;
  options?: {
    name: string;
    value?: number;
  }[];
};

Hidden field

Hidden fields are useful for setting properties internally without showing them them to the user. For example default values in a integration config. These are not visible in the UI, and are set to the default value specified.

Hidden field
type IntegrationHiddenField = BaseIntegrationField & {
  type: 'hidden';
  defaultValue?: string | number | boolean;
};