import { DefaultPermissionsConfig, ExtendedFields } from '@wix/bex-core'; import { CustomFieldsWidgetState } from '../../state'; import { OnCustomFieldChange } from './OnCustomFieldChange'; export type CustomFieldsWidgetTheme = 'card' | 'inline'; export type CustomFieldsWidgetProps = { /** * Custom fields widget subtitle. * */ subtitle?: string; /** * Applies a data-hook HTML attribute that can be used in tests */ dataHook?: string; /** * Existing extended fields values, usually under `myEntity.extendedFields`. */ extendedFields?: ExtendedFields; hideEmptyState?: boolean; /** * The fieldName in the object passed to the `onSave` callback. */ fieldName?: string; /** * Empty state content overrides */ emptyStateOverrides?: { /** * Empty state title. * */ title?: string; /** * Empty state subtitle. * */ subtitle?: string; }; filterable?: boolean; containsPii?: boolean; defaultPermissions?: DefaultPermissionsConfig; enableArchive?: boolean; /** * The theme of the widget - "card" (default) or "inline" */ theme?: CustomFieldsWidgetTheme; /** * A callback that is invoked when a custom field changes. * @param id The id of the custom field * @param value The value of the custom field * @param allFields The current values of all the fields * @param namespace The namespace of the custom field */ onChange?: OnCustomFieldChange; } & ( | { /** * The FQDN to be used to extract schema from data-extension service. */ fqdn: string; state?: never; } | { fqdn?: never; /** * Pass CustomFieldsWidgetState from useCustomFieldsWidget hook if you want to control the loading and error state from outside */ state: CustomFieldsWidgetState; } ); export interface CustomFieldsWidgetBaseProps extends Omit { state: CustomFieldsWidgetState; }