@kiwicom/smart-faq
Version:
43 lines (34 loc) • 932 B
JavaScript
// @flow strict
import * as React from 'react';
import LogContext from '@kiwicom/nitro/lib/services/log/context';
import type { Context as LogContextType } from '@kiwicom/nitro/lib/services/log/context';
import type { Props as EventProps } from '@kiwicom/nitro/lib/records/Event';
import { defaultDestinations } from '../../../const/events';
type Props = {|
subCategory: string,
action: string,
props?: EventProps,
|};
// TODO replace by nitro LogMount
export default class LogMount extends React.Component<Props> {
context: LogContextType;
static contextType = LogContext;
static defaultProps = {
props: {},
};
componentDidMount() {
const { subCategory, action, props } = this.props;
this.context.log(
{
category: 'SmartFAQ',
subCategory,
action,
destinations: defaultDestinations,
},
props ?? {},
);
}
render() {
return null;
}
}