@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
55 lines (50 loc) • 1.45 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var Actions = require('@shopify/app-bridge-core/actions');
var utilities = require('../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 === Actions.Fullscreen.Action.ENTER) {
return true;
}
if (action.type === Actions.Fullscreen.Action.EXIT) {
return false;
}
return state;
}
/**
* @internal
* @beta
*/
var fullscreenActionCreatorsMap = {
enter: Actions.Fullscreen.enter,
exit: Actions.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: utilities.resetStateReducer(fullscreenReducer),
};
exports.default = fullscreenReducer;
exports.defaultFullscreenStore = defaultFullscreenStore;
exports.feature = feature;
exports.fullscreenActionCreatorsMap = fullscreenActionCreatorsMap;