@shopify/app-bridge-host
Version:
App Bridge Host contains components and middleware to be consumed by the app's host, as well as the host itself. The middleware and `Frame` component are responsible for facilitating communication between the client and host, and used to act on actions se
70 lines (69 loc) • 2.06 kB
TypeScript
import { ActionCreatorsMapObject, AnyAction } from 'redux';
import { AppLink, NavigationMenu, ChannelMenu } from '@shopify/app-bridge-core/actions';
import type { Feature } from '../../../../withFeature';
/**
* The interface for the mapped Menu actions dispatcher
* @internal
* */
export interface MenuActionCreatorsMap extends ActionCreatorsMapObject {
updateNavigationMenu: typeof NavigationMenu.update;
}
/**
* Returns a mapped object with methods for dispatching Menu actions
* @internal
* */
export declare const menuActionCreatorsMap: MenuActionCreatorsMap;
/**
* The interface for the Navigation Menu action group state
* @internal
* */
export interface NavigationMenuStore {
items: AppLink.Payload[];
active?: string;
}
/**
* The interface for the Channel Menu action group state
* @internal
* */
export interface ChannelMenuStore {
items: AppLink.Payload[];
active?: string;
}
/**
* The interface for the Menu state
* @internal
* */
export interface MenuStore {
navigationMenu?: NavigationMenuStore;
channelMenu?: ChannelMenuStore;
}
export type Action = NavigationMenu.NavigationMenuAction | ChannelMenu.ChannelMenuAction | AnyAction;
/**
* The default loading state
* @internal
*/
export declare const defaultMenuStore: {
navigationMenu: undefined;
channelMenu: undefined;
};
/**
* Returns the updated menu state
* @internal
*/
export default function menuReducer(state: MenuStore | undefined, action: Action): MenuStore;
/**
* The interface props that are passed down to the Menu component
* as a the result of calling the `withFeature` decorator
* @public
* */
export interface WithFeature {
actions: MenuActionCreatorsMap;
store: MenuStore;
}
/**
* An object containing the key, actions, initial state and reducer of the Menu feature
* Can be used with the `withFeature` decorator to add the reducer
* and then make its actions and store available to the wrapped component
* @public
* */
export declare const feature: Feature<WithFeature['store'], WithFeature['actions']>;