import { HandlerInput, RequestHandler } from 'ask-sdk-core'; import { Response } from 'ask-sdk-model'; import { ControlServicesProps } from '../controls/ControlServices'; import { IControl } from '../controls/interfaces/IControl'; import { IControlInput } from '../controls/interfaces/IControlInput'; import { IControlManager } from '../controls/interfaces/IControlManager'; import { IControlResultBuilder } from '../controls/interfaces/IControlResultBuilder'; import { ILogger } from '../controls/interfaces/ILogger'; export declare type CanHandleExceptionBehavior = 'ProduceResponse' | 'ReturnFalse' | 'Rethrow'; /** * RequestHandler for a skill built using Controls. * * This is the common runtime that drives the processing flow for a skill that * uses Controls. Please see the user guide for a thorough discussion of the * phases of processing and how the common `ControlHandler` interfaces with * an instance of `ControlManager` and the control tree. * */ export declare class ControlHandler implements RequestHandler { static attributeNameContext: string; controlManager: IControlManager; rootControl?: IControl; private additionalSessionContext; private controlInput; private preparedRequestId; /** * Determines if the controls state will be correctly reestablished on the * next turn * * Usage: * * If a skill uses more than one ControlHandler the state validation * procedure gets confused due to unexpected control states in session * attributes. In this situation, set `validateStateRoundtrip = false`. */ validateStateRoundtrip: boolean; /** * Behavior if an exception occurs during ControlHandler.canHandle. * * In all cases, `ControlManager.handleInternalError` will be called. The options * differ in how the response is produced. * * ProduceResponse (default) - treat the input as handled, and return the custom response * ReturnFalse - treat the input as 'cannot handle'. * Rethrow - let the exception bubble up to be processed by `CustomSkill.errorHandlers` * * Usage: * - The default, 'ProduceResponse', allows ControlManager */ canHandleThrowBehavior: CanHandleExceptionBehavior; protected canHandleFailureResponse?: Response; /** * The services props used to set global configuration * to be used across all Controls. */ services: ControlServicesProps; /** * The logger implementation. */ log: ILogger; constructor(controlManager: IControlManager, services?: ControlServicesProps); private prepare; private recordInputModality; private static createControlMap; /** * Determines if this RequestHandler handle the input. * * @param handlerInput - HandlerInput */ canHandle(handlerInput: HandlerInput): Promise; /** * Handle the input. * * @param handlerInput - HandlerInput */ handle(handlerInput: HandlerInput, processInput?: boolean): Promise; /** * Creates a string 'C:' for inclusion in UserAgent to indicate usage. * * The information gathered is only the number of Controls being used. * This will help the dev team to understand usage - thank you! */ userAgentInfo(): string; /** * Implements the core of the processing loop * * Public for testing */ static handleCore(rootControl: IControl, input: IControlInput, preparedRequestId: string | undefined, resultBuilder: IControlResultBuilder, handleInput: boolean | undefined, services: ControlServicesProps): Promise; private static initiativePhase; /** * Take the initiative in the dialog. * * Any existing content in the Response's prompt & reprompt is overwritten. * To avoid losing this content, pass it in using parameters promptPrefix & * repromptPrefix. * * Usage: * * This method is used to transition from a regular `RequestHandler` into * Controls For example, when a regular `RequestHandler` consumes the * input but doesn't want to keep the initiative, it can ask a * ControlHandler to take the initiative to complete the turn. A * prompt/reprompt fragment can be specified by the `RequestHandler` * which will be included as the start of the overall prompt/reprompt. * * @param handlerInput - Handler input * @param promptPrefix - Prompt fragment to prefix the prompt generated via * Controls. * @param repromptPrefix - Reprompt fragment to prefix to the prompt * generated via Controls */ takeInitiative(handlerInput: HandlerInput, promptPrefix: string, repromptPrefix?: string): Promise; static getPromptAndRepromptFromResponse(response: Response): [string, string]; private buildResponseCore; getSerializableControlStates(): { [key: string]: any; }; } /** * Visits each controls and collates the state objects. * * @param rootControl - Root control */ export declare function _extractStateFromControlTree(rootControl: IControl): { [key: string]: any; }; //# sourceMappingURL=ControlHandler.d.ts.map