@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
34 lines (31 loc) • 939 B
JavaScript
import { LeaveConfirmation } from '@shopify/app-bridge-core/actions';
import { validateAction } from '@shopify/app-bridge-core/validate/actions/leaveConfirmation';
var defaultStore = null;
function reducer(state, action) {
if (state === void 0) { state = defaultStore; }
var castedAction = action;
if (validateAction(castedAction)) {
return state;
}
switch (action.type) {
case LeaveConfirmation.Action.ENABLE: {
var id = action.payload.id;
return { id: id };
}
case LeaveConfirmation.Action.DISABLE:
return null;
default:
return state;
}
}
var feature = {
actions: {
enable: LeaveConfirmation.enable,
disable: LeaveConfirmation.disable,
confirm: LeaveConfirmation.confirm,
},
key: 'leaveConfirmation',
initialState: defaultStore,
reducer: reducer,
};
export { feature, reducer };