@textback/notification-widget
Version:
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
35 lines (29 loc) • 1.08 kB
JavaScript
import Component from '../index.js';
import appInsights from '../../../sdk/utils/appInsights.js';
import find from '../../../sdk/utils/find.js';
import './styles.scss';
export default class Button extends Component {
constructor() {
super(...arguments);
this.element.setAttribute('channel', this.channel);
this.channelAPI = find(this.widgetAPI.getEnabledChannels(), channel => {
return channel.id === this.config.id && channel.channel === this.config.channel && channel.channelId === this.config.channelId;
});
}
render() {
let self = this;
super.render();
this.element.addEventListener('click', () => {
appInsights.trackButtonClick(this.widgetId, 'notificationWidget.button.click', this.channel)
});
}
get defaults() {
return {
config: JSON.parse(this.element.getAttribute('config')) || {},
channel: this.element.getAttribute('channel')
}
}
static get tagName() {
return 'tb-notification-button';
}
};