@flows/js-components
Version:
Built-in components for Flows JS SDK
44 lines (41 loc) • 1.48 kB
text/typescript
/**
* Properties provided by Flows based on block and block template setup.
*/
interface FlowsProperties {
/**
* Unique identifier of the block, useful for stable key during rendering. Keep in mind each workflow version will have a different id for each block.
*/
id: string;
/**
* User defined key for identifying the block.
*/
key?: string;
/**
* Id of the workflow this block belongs to.
*/
workflowId: string;
}
type ComponentProps<T extends Record<string, any> = any> = {
/**
* Properties provided by Flows based on block and block template setup.
*/
__flows: FlowsProperties;
} & T;
type TourComponentProps<T extends Record<string, any> = any> = {
/**
* Properties provided by Flows based on block and block template setup.
*/
__flows: FlowsProperties;
continue: () => void;
previous?: () => void;
cancel: () => void;
} & T;
type _Component<T extends Record<string, any> = any> = (props: T) => {
element: HTMLElement | null;
cleanup: () => void;
};
type Component<T extends Record<string, any> = any> = _Component<ComponentProps<T>>;
type TourComponent<T extends Record<string, any> = any> = _Component<TourComponentProps<T>>;
type Components = Record<string, Component>;
type TourComponents = Record<string, TourComponent>;
export type { ComponentProps as C, TourComponents as T, Component as a, Components as b, TourComponent as c, TourComponentProps as d };