@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
39 lines (35 loc) • 1.02 kB
JavaScript
;
var Actions = require('@shopify/app-bridge-core/actions');
var feedbackModal = require('@shopify/app-bridge-core/validate/actions/feedbackModal');
var defaultStore = null;
function reducer(state, action) {
if (state === void 0) { state = defaultStore; }
var castedAction = action;
if (feedbackModal.validateAction(castedAction)) {
return state;
}
switch (action.type) {
case Actions.FeedbackModal.Action.OPEN: {
var _a = action.payload, formId = _a.formId, id = _a.id;
return {
id: id,
formId: formId,
};
}
case Actions.FeedbackModal.Action.CLOSE:
return null;
default:
return state;
}
}
var feature = {
actions: {
open: Actions.FeedbackModal.open,
close: Actions.FeedbackModal.close,
},
key: 'feedbackModal',
initialState: defaultStore,
reducer: reducer,
};
exports.feature = feature;
exports.reducer = reducer;