Skip to content

Commit

Permalink
EPMRPP-88927 || Extra event is sent to GA when user expands a Notific…
Browse files Browse the repository at this point in the history
…ation or QG rule (#3722)
  • Loading branch information
BlazarQSO authored Jan 15, 2024
1 parent 50c0e87 commit 119a8a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
*/

import React, { useState } from 'react';
import { useTracking } from 'react-tracking';
import classNames from 'classnames/bind';
import Parser from 'html-react-parser';
import { Toggle } from 'componentLibrary/toggle';
import PropTypes from 'prop-types';
import { PROJECT_SETTINGS_PATTERN_ANALYSIS_EVENTS } from 'analyticsEvents/projectSettingsPageEvents';
import { ruleItemPropTypes, ruleItemDefaultProps } from './propTypes';
import styles from './ruleItem.scss';

Expand All @@ -36,7 +34,6 @@ export const RuleItem = ({
onRuleNameClick,
isPreview,
}) => {
const { trackEvent } = useTracking();
const [shown, setShown] = useState(false);
const { enabled, name } = item;
const isRuleNameClickable = Boolean(onRuleNameClick);
Expand All @@ -50,9 +47,6 @@ export const RuleItem = ({
}

const onClickHandler = () => {
if (!shown) {
trackEvent(PROJECT_SETTINGS_PATTERN_ANALYSIS_EVENTS.OPEN_NAME_PATTERN_ANALYSIS);
}
onClick(!shown);
setShown(!shown);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ export const PatternAnalysisContent = ({
},
];

const handleRuleItemClick = (isShown) => {
if (isShown) {
trackEvent(PROJECT_SETTINGS_PATTERN_ANALYSIS_EVENTS.OPEN_NAME_PATTERN_ANALYSIS);
}
};

return (
<>
<Layout
Expand Down Expand Up @@ -211,6 +217,7 @@ export const PatternAnalysisContent = ({
onToggle={onToggleHandler}
ruleItemContent={PatternRuleContent}
dataAutomationId="patternsList"
handleRuleItemClick={handleRuleItemClick}
/>
</div>
</>
Expand Down

0 comments on commit 119a8a8

Please sign in to comment.