import * as React from 'react'; import { BaseFrameworkAdaptor } from '../../adaptors/framework/BaseFrameworkAdaptor'; import { Provider } from './Provider'; import { SimpleXdmDefinitionBuilder } from '../../definitions/SimpleXdmDefinitionBuilder'; export declare module ModuleDefinitions { const MIN_REGISTRATION_NAME_LENGTH: number; const MAX_REGISTRATION_NAME_LENGTH: number; /** * All modules (classes that extend BaseModule) must be instantiated with props * that extend this interface. This facilitates the BaseModule's provision of * common module behaviour. */ interface Props { adaptor: BaseFrameworkAdaptor; } /** * All modules (classes that extend BaseModule) must have a state that extends this * interface. This facilitates the BaseModule's provision of common module behaviour. */ interface State { enabled: boolean; registered: boolean; } } export interface Module { props?: Props; state?: State; /** * Enable or disable a module. * @param enabled indication of whether the module should be enabled or disabled. */ setEnabled(enabled: boolean): void; /** * Determines if a module is enabled or disabled. */ isEnabled(): boolean; /** * Get the name used to register this module with the underlying framework. */ getModuleRegistrationName(): string; /** * Implementations of this method are responsible for returning an abject that can * be used to build a module that can be registered with Simple XDM. * @returns {SimpleXdmDefinitionBuilder} */ getSimpleXdmDefinitionBuilder(): SimpleXdmDefinitionBuilder; /** * Get the provider for this module. */ getProvider(): Provider; } /** * This class provides common module behaviour and characteristics. The term 'Module' refers to * a set of related functionality and provides the interface between a product that requires the * module functionality and the framework that implements it. */ export declare abstract class BaseModule extends React.Component implements Module { constructor(props: Props); componentDidMount(): void; setEnabled(enabled: boolean): void; isEnabled(): boolean; componentWillUnmount(): void; shouldComponentUpdate(): boolean; /** * Get the name used to register this module with the underlying framework. */ abstract getModuleRegistrationName(): string; /** * Implementations of this method are responsible for returning an abject that can * be used to build a module that can be registered with Simple XDM. * @returns {SimpleXdmDefinitionBuilder} */ abstract getSimpleXdmDefinitionBuilder(): SimpleXdmDefinitionBuilder; /** * Get the provider for this module. */ abstract getProvider(): Provider; validateRegistrationName(registrationName: string): void; render(): React.ReactElement | null; }