/// <reference types="react" />
/// <reference types="recompose" />
import * as React from "react";
import * as PropTypes from "prop-types";
import { InferableComponentEnhancerWithProps } from "recompose";
import { Notifier } from "./NotificationManager";
import { ErrorHandler } from "./ErrorHandler";
import { XRM } from "./xrm";
export * from "./NotificationManager";
export interface DynamicsContext {
    xrm: XRM | null;
    notifier: Notifier;
    errorHandler: ErrorHandler;
}
export interface DynamicsProps {
    xrm?: XRM | null;
    notifier?: Notifier;
    errorHandler?: ErrorHandler;
}
/** Not used yet. */
export declare const dynamicsShape: PropTypes.Requireable<any>;
/**
 * Render the first child only. Places Xrm and a NotificationManager into the context.
 * Declare a child's use of the context:
 * ```
 * class Foo extends React.Component {
 *  public static contextTypes = {
 *        Xrm: PropTypes.object, // can use isRequired
 *        notifier: PropTypes.instanceOf(Object) // can use isRequired
 *  }
 *  constructor(props, context) {
 *   super(props, context);
 *   ...
 *  }
 * ...
 * ```
 * You can access the context using `this.context.notifier.add(..)`. Instead of retyping
 * the contextTypes in the child, you can use `public static contextTypes { ...Dynamics.childContextTypes }`.
 *
 * The component is stateless as only the children define the render.
 *
 * TODO: Notifier only works on forms, make more general so it works in non-forms.
 */
export declare class Dynamics<P extends DynamicsProps = DynamicsProps, S = {}> extends React.Component<P, S> {
    constructor(props: P, context: any);
    private defaultErrorHandler;
    private defaultNotifier;
    getChildContext(): DynamicsContext;
    /** Get Xrm from the props or the global environment window.parent. */
    protected getXrm: () => XRM | null;
    readonly notifier: Notifier;
    readonly errorHandler: ErrorHandler;
    static childContextTypes: {
        notifier: PropTypes.Requireable<any>;
        xrm: PropTypes.Requireable<any>;
        errorHandler: PropTypes.Requireable<any>;
    };
    render(): React.ReactElement<any>;
}
/** Use this to compose your component with Xrm and NotificationManager
 * in the props.
 *
 * const YourComponent = ({notificationManager, Xrm, ...rest}) => {
 *   console.log(notifier, Xrm); // to prove that it is there.
 * }
 * export default withDynamics(YourComponent)
 * ```
 */
export declare const withDynamics: InferableComponentEnhancerWithProps<{
    notifier: any;
    xrm: any;
    errorHandler: any;
}, {}>;
export default Dynamics;
