@shopify/app-bridge-host
Version:
App Bridge Host contains middleware and components that are meant to be consumed by the app's host. The middleware and `Frame` component are responsible for facilitating messages posted between the client and host, and used to act on actions sent from the
52 lines (51 loc) • 2.69 kB
TypeScript
import { Reducer } from 'redux';
import * as Actions from '@shopify/app-bridge/actions';
export interface ReducerMap {
[key: string]: Reducer;
}
export interface InitialStateMap {
[key: string]: any;
}
/**
* A utility to reset the reducer state when `APICLIENT::LOAD`
* or `APICLIENT::UNLOAD` is dispatched
* @internal
* @param reducer - the reducer which should be reset
* @param initialState - an option value the state should be set to when it's reset
* */
export declare function resetAppReducer(reducer: Reducer, initialState?: any): Reducer<any, import("redux").AnyAction>;
/**
* A utility to reset the reducer state when `PRIVATE_APP::RESET` is dispatched
* @internal
* @param reducer - the reducer which should be reset
* */
export declare function resetStateReducer(reducer: Reducer): Reducer<any, import("redux").AnyAction>;
/**
* A utility to reset the state of a reducer when an action is dispatched
* @internal
* @param reducer - the reducer which should be reset
* @param type - the action type
* @param initialState - an option value the state should be set to when it's reset
*/
export declare function resetReducer(reducer: Reducer, type: string, initialState?: any): Reducer;
/**
* Wrap multiple reducers in a given wrapper function
* @internal
* @param reducers - a reducer map object
* @param wrapper - the function to wrap the reducer map object
* @param initialState - an optional value map for the state to be given to the wrapper
*/
export declare function wrapReducers<T extends ReducerMap>(reducers: T, wrapper: (reducer: Reducer, initialState?: InitialStateMap) => Reducer, initialState?: InitialStateMap): T;
/**
* Return the full action type given a group name
* @internal
*/
export declare function getGroupActionType(group: Actions.Group): typeof Actions.Error.ActionType | typeof Actions.Flash.ActionType | typeof Actions.Modal.ActionType | typeof Actions.ResourcePicker.ActionType | typeof Actions.Features.ActionType | typeof Actions.Button.ActionType | typeof Actions.ButtonGroup.ActionType | typeof Actions.Cart.ActionType | typeof Actions.Fullscreen.ActionType | typeof Actions.Loading.ActionType | typeof Actions.Print.ActionType | typeof Actions.Scanner.ActionType | typeof Actions.TitleBar.ActionType | typeof Actions.ContextualSaveBar.ActionType | typeof Actions.Share.ActionType | {
[x: number]: string;
ADMIN_SECTION: Actions.Redirect.ActionType.ADMIN_SECTION;
ADMIN_PATH: Actions.Redirect.ActionType.ADMIN_PATH;
REMOTE: Actions.Redirect.ActionType.REMOTE;
APP: Actions.Redirect.ActionType.APP;
PUSH: Actions.History.ActionType.PUSH;
REPLACE: Actions.History.ActionType.REPLACE;
};