import { Request, Response, NextFunction } from 'express'; import { Component } from './intercom.types'; export interface HandlerContext { endpoint: string; middlewareContext?: any; appName: string; methods: HandlerDescription; hooks: HandlerDescription; } export declare type HandlerDescription = { [key: string]: { endpoint: string; }; }; export declare type Handler = (req: Request, res: Response, next: NextFunction, context: HandlerContext) => Promise | void; export declare type CanvasHandler = (body: object, context: HandlerContext) => Promise | Component[] | HandlerResult; export declare type ConfigureHandler = (body: object, context: HandlerContext) => Promise | Component[] | HandlerResult | ConfigurationResult; export interface HandlerResult { components: Component[]; storedData?: { [key: string]: string; }; contentUrl?: string; } export interface ConfigurationResult { results: { [key: string]: any; }; } export interface App { initialize: CanvasHandler; submit?: CanvasHandler; configure?: ConfigureHandler; hooks?: { [key: string]: Handler; }; }