import { EnhancedStore as ReduxEnhancedStore } from "@reduxjs/toolkit"; import { History } from "history"; import { MapDispatchToPropsParam, Options } from "react-redux"; import { Action, AnyAction, Middleware, Reducer, Store } from "redux"; import { StateToPropsParam } from "../FlexModule"; import { AppState } from "../state"; declare let store: ReduxEnhancedStore; export type AppDispatch = typeof store.dispatch; /** * @interface FlexState * @property {AppState} flex Flex application state * @category State */ export interface FlexState { readonly flex: AppState; } /** * @interface StoreSettings * @property {enableReduxLogging} boolean * @property {history} History object * @category State * @private */ export interface StoreSettings { enableReduxLogging: boolean; history: History; } /** * @typedef {Store} EnhancedStore * @property {Function} [addReducer] - Function used to add reducer to an already created store. * @memberof Store */ export interface EnhancedStore extends Store { addReducer?: (name: string, _reducer: Reducer) => void; } /** * Determines if an action has been decorated with the Flex Public Dispatch Symbol * @param action * @private */ export declare function isFlexPublicDispatch(action: AnyAction): boolean; /** * This function checks to see whether the current state slice has been labeled Private. * @private * @param state */ export declare function isPrivateState(state: any): boolean; /** * Method 'flexConnect' is deprecated. Please use Redux connect method if you still need this API * @property {Function} [flexConnect] - Preferred function for creating connected components. * @memberof Store * @deprecated * @deprecatedSince 2.0.0 * @altRecommendation Use Redux's connect method instead * @altRecommendationExample * import { connect } from "react-redux"; * function connect(mapStateToProps?, mapDispatchToProps?, mergeProps?, options?) {}; * @altRecommendationLink https://react-redux.js.org/api/connect * @ignore */ export declare function flexConnect(mapStateToProps: StateToPropsParam, mapDispatchToProps?: null | MapDispatchToPropsParam, mergeProps?: any, options?: Options<{}, StateProps, OwnProps, FlexState>): import("react-redux").InferableComponentEnhancerWithProps & StateProps, OwnProps>; /** * This function is called by the flexConnect function. It checks for a `mapDispatchToProps` and if it exists, * decorates the dispatched value th the FLEX_PUBLIC_DISPATCH symbol * The FLEX_PUBLIC_DISPATCH key is checked for in middleware and is not forwarded if both the FLEX_PUBLIC_DISPATCH * and Private symbol are present on the object. * @param dispatchToProps * @private */ export declare function decorateObjectDispatchToProps(dispatchToProps: any): any; /** * This function is used in as part of the flexConnect function. It Checks to see if a stateToProps function exists, * if it does, the function is decorated. The decorator's job is to filter out all Private slices from the function, * ensuring Customer Developers can't read Private state. * @param originalStateToProps * @private */ export declare function decorateStateToProps(originalStateToProps: any): Function | undefined; /** * Store enhancer which allows the user to add any additional reducers after the store has been created. * @param {any} originalCreateStore the original create store * @returns {EnhancedStore} It returns enhanced store with an additional `addReducer` method. * @category Core / State * @method flexStoreEnhancer * @memberof Store * @example * Import Flex from "@twilio/flex-ui"; * const myReduxStore = createStore( * reducers, * compose( * applyFlexMiddleware(), * Flex.flexStoreEnhancer // <-- Add enhancer part of compose * ) * ); * * Flex.Manager.create(configuration, myReduxStore as any).then(manager => { * ReactDOM.render( * * * * * , * container * ); * }); */ export declare const flexStoreEnhancer: (originalCreateStore: any) => (originalReducer: any, initialState: any) => any; /** * This creates the store. * @private */ export declare function configureFlexStore(settings: StoreSettings): import("@reduxjs/toolkit/dist/configureStore").ToolkitStore>[]>; /** * @returns {Store} A copy of the current state of the store * @category Core / State * @function getDefaultStore * @memberof Store * @private */ export declare function getDefaultStore(): import("@reduxjs/toolkit/dist/configureStore").ToolkitStore>[]>; export {};