import type { CaseAssistAPIErrorStatusResponse } from '../../api/service/case-assist/case-assist-api-client.js'; import type { CaseAssistEngine } from '../../app/case-assist-engine/case-assist-engine.js'; import type { CaseFieldSuggestion } from '../../features/case-field/case-field-state.js'; import { type Controller } from '../controller/headless-controller.js'; export interface CaseFieldProps { options?: CaseFieldOptions; } export interface CaseFieldOptions { field: string; } /** * A scoped and simplified part of the headless state that is relevant to the `CaseField` controller. * * @group Controllers * @category CaseField */ export interface CaseFieldState { /** * Whether suggestions are being retrieved for the field. */ loading: boolean; /** * The error that occurred while fetching suggestions, if any. */ error: CaseAssistAPIErrorStatusResponse | null; /** * The current field value. */ value: string; /** * The field suggestions. */ suggestions: CaseFieldSuggestion[]; } /** * The `CaseField` controller is responsible for setting the value and retrieving suggestions for a field from the case creation form and optionally trigger Case Assist API requests. * * For example implementations, see the following [Coveo Quantic Case Assist components](https://docs.coveo.com/en/quantic/latest/reference/case-assist-components/): * * [quanticCaseClassification.js](https://github.com/coveo/ui-kit/blob/main/packages/quantic/force-app/main/default/lwc/quanticCaseClassification/quanticCaseClassification.js) * * [quanticDocumentSuggestion](https://github.com/coveo/ui-kit/blob/main/packages/quantic/force-app/main/default/lwc/quanticDocumentSuggestion/quanticDocumentSuggestion.js) * * @group Controllers * @category CaseField */ export interface CaseField extends Controller { /** * Sets the value of the specified field. * * @param value - The field value to set. * @param updatesToFetch - A set of flags dictating whether to fetch case assist data after updating the field value. * @param autoSelection - A flag indicating whether the update was triggered by an automatic selection. */ update(value: string, updatesToFetch?: UpdateCaseFieldFetchOptions, autoSelection?: boolean): void; /** * A scoped and simplified part of the headless state that is relevant to the `CaseField` controller. */ state: CaseFieldState; } export interface UpdateCaseFieldFetchOptions { caseClassifications?: boolean; documentSuggestions?: boolean; } /** * Creates a `CaseField` controller instance. * * @param engine - The headless engine. * @param props - The configurable `CaseField` controller properties. * @returns A `CaseField` controller instance. * * @group Controllers * @category CaseField */ export declare function buildCaseField(engine: CaseAssistEngine, props?: CaseFieldProps): CaseField;