@yext/chat-headless
Version:
A state manager library powered by Redux for Yext Chat integrations
36 lines • 1.19 kB
TypeScript
import { EnhancedStore, Unsubscribe, Action } from "@reduxjs/toolkit";
import { State } from "./models/state";
import { StateListener } from "./models/utils/StateListeners";
/**
* A Redux-backed implementation of the {@link StateManager} interface. Redux is used to
* manage the state, dispatch events, and register state listeners.
*
* @internal
*/
export declare class ReduxStateManager {
private store;
constructor();
/**
* Returns the current state.
*/
getState(): State;
/**
* Returns the Redux store.
*/
getStore(): EnhancedStore;
/**
* Dispatches an event. This can update the {@link State}.
*
* @param action - represents an intention to change the state.
* This includes "type" field for the action type and "payload" field for the data to dispatch
*/
dispatch<T extends Action>(action: T): void;
/**
* Adds a listener for a specific state value of type T.
*
* @param listener - The state listener to add
* @returns The function for removing the added listener
*/
addListener<T>(listener: StateListener<T>): Unsubscribe;
}
//# sourceMappingURL=ReduxStateManager.d.ts.map