Skip to content

Commit

Permalink
Sandeep/bot 1523/remove rudder stack events (deriv-com#14168)
Browse files Browse the repository at this point in the history
* refactor: 🚧 removed rudderstack events until redefined

* refactor: ⚡ removed unused vars

* refactor: 🔥 clening up and fixing the broken test suits

* fix: ⚡ Fixed ui bugs
  • Loading branch information
sandeep-deriv authored Mar 25, 2024
1 parent 15af5a0 commit 7b48be6
Show file tree
Hide file tree
Showing 40 changed files with 251 additions and 980 deletions.
20 changes: 0 additions & 20 deletions packages/bot-web-ui/src/pages/bot-builder/bot-builder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import React from 'react';
import classNames from 'classnames';
import { useRemoteConfig } from '@deriv/api';
import { observer, useStore } from '@deriv/stores';
import { Analytics } from '@deriv-com/analytics';
import { botNotification } from 'Components/bot-notification/bot-notification';
import { notification_message } from 'Components/bot-notification/bot-notification-utils';
import { DBOT_TABS } from 'Constants/bot-contents';
import initDatadogLogs from 'Utils/datadog-logs';
import LoadModal from '../../components/load-modal';
import { useDBotStore } from '../../stores/useDBotStore';
Expand All @@ -31,24 +29,6 @@ const BotBuilder = observer(() => {
window.is_datadog_logging_enabled = remote_config_data.tracking_datadog; // This will be used in the middleware inside of bot-skeleton to check if datadog is enabled before logging
}, [remote_config_data.tracking_datadog]);

React.useEffect(() => {
const is_bot_builder = active_tab === DBOT_TABS.BOT_BUILDER;
if (is_bot_builder) {
Analytics.trackEvent('ce_bot_builder_form', {
action: 'open',
form_source: 'ce_bot_builder_form',
});
}
return () => {
if (is_bot_builder) {
Analytics.trackEvent('ce_bot_builder_form', {
action: 'close',
form_source: 'ce_bot_builder_form',
});
}
};
}, [active_tab]);

React.useEffect(() => {
onMount();
return () => onUnmount();
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ import Icon from '@deriv/components/src/components/icon/icon';
import { observer } from '@deriv/stores';
import { localize } from '@deriv/translations';
import { useDBotStore } from 'Stores/useDBotStore';
import {
rudderStackSendQsEditStrategyEvent,
rudderStackSendQsRunStrategyEvent,
rudderStackSendQsSelectedTabEvent,
rudderStackSendQsStrategyChangeEvent,
} from '../analytics/rudderstack-quick-strategy';
import { getQsActiveTabString } from '../analytics/utils';
import { STRATEGIES } from '../config';
import { TFormValues } from '../types';
import FormTabs from './form-tabs';
Expand All @@ -28,7 +21,7 @@ type TDesktopFormWrapper = {

const FormWrapper: React.FC<TDesktopFormWrapper> = observer(({ children, onClickClose, active_tab_ref }) => {
const [activeTab, setActiveTab] = React.useState('TRADE_PARAMETERS');
const { submitForm, isValid, setFieldValue, validateForm, values } = useFormikContext<TFormValues>();
const { submitForm, isValid, setFieldValue, validateForm } = useFormikContext<TFormValues>();
const { quick_strategy } = useDBotStore();
const { selected_strategy, setSelectedStrategy } = quick_strategy;
const strategy = STRATEGIES[selected_strategy as keyof typeof STRATEGIES];
Expand All @@ -41,30 +34,18 @@ const FormWrapper: React.FC<TDesktopFormWrapper> = observer(({ children, onClick
const onChangeStrategy = (strategy: string) => {
setSelectedStrategy(strategy);
setActiveTab('TRADE_PARAMETERS');
rudderStackSendQsStrategyChangeEvent({ selected_strategy });
};

const handleTabChange = (tab: string) => {
setActiveTab(tab);
rudderStackSendQsSelectedTabEvent({ strategy_switcher_mode: getQsActiveTabString(tab) });
};

const onEdit = async () => {
rudderStackSendQsEditStrategyEvent({
form_values: values,
selected_strategy,
strategy_switcher_mode: getQsActiveTabString(activeTab),
});
await setFieldValue('action', 'EDIT');
submitForm();
};

const onRun = () => {
rudderStackSendQsRunStrategyEvent({
form_values: values,
selected_strategy,
strategy_switcher_mode: getQsActiveTabString(activeTab),
});
handleSubmit();
};

Expand Down
Loading

0 comments on commit 7b48be6

Please sign in to comment.