box-ui-elements
Version:
Box UI Elements
101 lines (99 loc) • 3.18 kB
Flow
/**
* Flowtype definitions for types.ts
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.10.0
*/
import { Location } from "history";
import { match } from "react-router-dom";
declare export var CREATE: any; // "create"
declare export var Action: {|
+CREATE_START: "create_start", // "create_start"
+CREATE_END: "create_end", // "create_end"
+DELETE_START: "delete_start", // "delete_start"
+DELETE_END: "delete_end", // "delete_end"
+SET_ACTIVE: "set_active", // "set_active"
+UPDATE_START: "update_start", // "update_start"
+UPDATE_END: "update_end", // "update_end"
+REPLY_CREATE_START: "reply_create_start", // "reply_create_start"
+REPLY_CREATE_END: "reply_create_end", // "reply_create_end"
+REPLY_DELETE_START: "reply_delete_start", // "reply_delete_start"
+REPLY_DELETE_END: "reply_delete_end", // "reply_delete_end"
+REPLY_UPDATE_START: "reply_update_start", // "reply_update_start"
+REPLY_UPDATE_END: "reply_update_end" // "reply_update_end"
|};
export interface Annotator {
addListener: (
event: string | Symbol,
listener: (...args: any[]) => void
) => void;
emit: (event: string | Symbol, ...args: any[]) => void;
removeAllListeners: () => void;
removeListener: (
event: string | Symbol,
listener: (...args: any[]) => void
) => void;
}
export interface AnnotatorState {
activeAnnotationFileVersionId?: string | null;
activeAnnotationId?: string | null;
annotation?: {
id?: string,
...
} | null;
annotationReply?: {
id?: string,
...
} | null;
action?: $Values<typeof Action> | null;
error?: Error | null;
meta?: Metadata | null;
origin?: string;
}
export type GetMatchPath = (location?: Location) => match<MatchParams> | null;
export interface AnnotatorContext {
emitActiveAnnotationChangeEvent?: (id: string) => void;
emitAnnotationRemoveEvent?: (id: string, isStartEvent?: boolean) => void;
emitAnnotationReplyCreateEvent?: (
reply: Object,
requestId: string,
annotationId: string,
isStartEvent?: boolean
) => void;
emitAnnotationReplyDeleteEvent?: (
id: string,
annotationId: string,
isStartEvent?: boolean
) => void;
emitAnnotationReplyUpdateEvent?: (
reply: Object,
annotationId: string,
isStartEvent?: boolean
) => void;
emitAnnotationUpdateEvent?: (
annotation: Object,
isStartEvent?: boolean
) => void;
getAnnotationsMatchPath?: GetMatchPath;
getAnnotationsPath?: (fileVersionId?: string, annotationId?: string) => string;
state: AnnotatorState;
}
declare export var Status: {|
+ERROR: "error", // "error"
+PENDING: "pending", // "pending"
+SUCCESS: "success" // "success"
|};
export type MatchParams = {
annotationId?: string,
fileVersionId?: string,
...
};
export interface Metadata {
requestId?: string;
status: $Values<typeof Status>;
}
export interface AnnotationActionEvent {
annotation?: Object;
annotationReply?: Object;
error?: Error;
meta: Metadata;
}