@shopify/app-bridge-core
Version:
**[Join our team and work on libraries like this one.](https://www.shopify.ca/careers)**
41 lines (38 loc) • 981 B
JavaScript
import { actionWrapper } from '../helper.js';
import { ActionSet } from '../ActionSet.js';
import { Group } from '../types.js';
import { Action } from './types.js';
/**
* A set of Actions for Updating, Requesting Features of AppBridge
* @public
*/
class Features extends ActionSet {
constructor(app, options) {
super(app, Group.Features, Group.Features, options ? options.id : undefined);
}
/**
* @public
*/
dispatch(action, payload) {
switch (action) {
case Action.REQUEST:
this.dispatchFeaturesAction(Action.REQUEST, payload);
break;
}
return this;
}
/**
* @internal
*/
dispatchFeaturesAction(type, payload) {
this.app.dispatch(actionWrapper({
group: Group.Features,
type,
payload: {
...(payload || {}),
id: this.id,
},
}));
}
}
export { Features };