UNPKG

@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

48 lines (45 loc) 1.25 kB
import { Fullscreen } from '@shopify/app-bridge-core/actions'; import { resetStateReducer } from '../utilities.js'; /** * The default value for the fullscreen store * @internal * @beta */ var defaultFullscreenStore = false; /** * Returns the updated fullscreen state * @internal * @beta */ function fullscreenReducer(state, action) { if (state === void 0) { state = defaultFullscreenStore; } if (action.type === Fullscreen.Action.ENTER) { return true; } if (action.type === Fullscreen.Action.EXIT) { return false; } return state; } /** * @internal * @beta */ var fullscreenActionCreatorsMap = { enter: Fullscreen.enter, exit: Fullscreen.exit, }; /** * An object containing the key, actions, initial state and reducer of the Fullscreen 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 * @beta * */ var feature = { actions: fullscreenActionCreatorsMap, key: 'fullscreen', initialState: defaultFullscreenStore, reducer: resetStateReducer(fullscreenReducer), }; export { fullscreenReducer as default, defaultFullscreenStore, feature, fullscreenActionCreatorsMap };