/** * Internal dependencies */ import type { Opportunity } from '../recommendation-engine'; import type { Maybe, ReadonlyNonEmptyArray, Url } from '../utils'; export type SuggestionGenerationRequest = { readonly url: string; readonly title: string; readonly language: string; readonly pageSummary: string; readonly editableElements: ReadonlyArray< SuggestionGenerationEditableElement >; readonly linksAndButtons: ReadonlyArray< SuggestionGenerationActionInfo >; readonly forms: ReadonlyArray< SuggestionGenerationFormInfo >; readonly source?: Opportunity; }; export type SuggestionGenerationResponse = { readonly tests: ReadonlyArray< ExperimentSuggestion >; }; export type ExperimentSuggestion = { readonly name: string; readonly description: string; readonly type: 'nab/css'; readonly url: Url; readonly variants: ReadonlyNonEmptyArray< { readonly name: string; readonly css: string; readonly content: ReadonlyArray< { readonly selector: string; readonly html: string; } >; } >; readonly goals: ReadonlyNonEmptyArray< { readonly name: string; readonly actions: ReadonlyNonEmptyArray< { readonly type: 'nab/click'; readonly selector: string; } >; } >; }; export type SuggestionGenerationActionInfo = { readonly tag: string; readonly selector: Maybe< string >; readonly label: string; readonly href?: string; readonly type?: string; }; export type SuggestionGenerationFormInfo = { readonly selector: Maybe< string >; readonly fields: ReadonlyArray< string >; readonly submitButtons: ReadonlyArray< SuggestionGenerationActionInfo >; }; export type SuggestionGenerationEditableElement = { readonly selector: string; readonly html: string; };