From 3486940fdc009d2a473f4b8347d1f828cd6a937a Mon Sep 17 00:00:00 2001 From: mitra Date: Mon, 6 May 2024 14:05:01 +0800 Subject: [PATCH 1/5] fix: :sparkles: set performance value for login time once cfd is loaded --- .../appstore/src/components/main-title-bar/asset-summary.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/appstore/src/components/main-title-bar/asset-summary.tsx b/packages/appstore/src/components/main-title-bar/asset-summary.tsx index cd6436230c46..eb54f6b2a8e0 100644 --- a/packages/appstore/src/components/main-title-bar/asset-summary.tsx +++ b/packages/appstore/src/components/main-title-bar/asset-summary.tsx @@ -63,7 +63,7 @@ const AssetSummary = observer(() => { } // measure performance metrics - setPerformanceValue('login_time'); + is_landing_company_loaded && setPerformanceValue('login_time'); setPerformanceValue('redirect_from_deriv_com_time'); setPerformanceValue('switch_currency_accounts_time'); setPerformanceValue('switch_from_demo_to_real_time'); From e3ab4e5995e3efdbfd1222f05e105442f1a28a88 Mon Sep 17 00:00:00 2001 From: mitra Date: Tue, 7 May 2024 15:31:05 +0800 Subject: [PATCH 2/5] fix: :bug: addressing habibi comments --- .../appstore/src/components/cfds-listing/index.tsx | 12 +++++++++++- .../src/components/main-title-bar/asset-summary.tsx | 9 +-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/appstore/src/components/cfds-listing/index.tsx b/packages/appstore/src/components/cfds-listing/index.tsx index c04e94f8862d..1e06fb385ccc 100644 --- a/packages/appstore/src/components/cfds-listing/index.tsx +++ b/packages/appstore/src/components/cfds-listing/index.tsx @@ -9,6 +9,7 @@ import { MT5_ACCOUNT_STATUS, makeLazyLoader, moduleLoader, + setPerformanceValue, } from '@deriv/shared'; import { localize, Localize } from '@deriv/translations'; import { Analytics } from '@deriv-com/analytics'; @@ -67,7 +68,6 @@ const CFDsListing = observer(() => { const { setAccountType, toggleCTraderTransferModal } = cfd; const { account_status, - ctrader_accounts_list, is_landing_company_loaded, is_populating_mt5_account_list, real_account_creation_unlock_date, @@ -172,6 +172,16 @@ const CFDsListing = observer(() => { return null; }; + React.useEffect(() => { + if (is_landing_company_loaded && !is_populating_mt5_account_list) { + setPerformanceValue('login_time'); + setPerformanceValue('redirect_from_deriv_com_time'); + setPerformanceValue('switch_currency_accounts_time'); + setPerformanceValue('switch_from_demo_to_real_time'); + setPerformanceValue('switch_from_real_to_demo_time'); + } + }, [is_landing_company_loaded]); + return ( { ); } - // measure performance metrics - is_landing_company_loaded && setPerformanceValue('login_time'); - setPerformanceValue('redirect_from_deriv_com_time'); - setPerformanceValue('switch_currency_accounts_time'); - setPerformanceValue('switch_from_demo_to_real_time'); - setPerformanceValue('switch_from_real_to_demo_time'); - return (
{has_active_related_deriv_account || selected_account_type === 'demo' ? ( From c15cc951791faeb5579050da5395f83910792d0a Mon Sep 17 00:00:00 2001 From: mitra Date: Tue, 7 May 2024 15:49:23 +0800 Subject: [PATCH 3/5] feat: :bug: import useeffect from react --- packages/appstore/src/components/cfds-listing/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/appstore/src/components/cfds-listing/index.tsx b/packages/appstore/src/components/cfds-listing/index.tsx index 1e06fb385ccc..0e85207f85e9 100644 --- a/packages/appstore/src/components/cfds-listing/index.tsx +++ b/packages/appstore/src/components/cfds-listing/index.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import { observer, useStore } from '@deriv/stores'; import { Loading, Text, StaticUrl } from '@deriv/components'; import { @@ -172,7 +172,7 @@ const CFDsListing = observer(() => { return null; }; - React.useEffect(() => { + useEffect(() => { if (is_landing_company_loaded && !is_populating_mt5_account_list) { setPerformanceValue('login_time'); setPerformanceValue('redirect_from_deriv_com_time'); From bc2c5c7db03169c609861c86dc7eaa2f42b83538 Mon Sep 17 00:00:00 2001 From: mitra Date: Wed, 8 May 2024 17:08:44 +0800 Subject: [PATCH 4/5] feat: :sparkles: add multiplier option metric --- .../components/options-multipliers-listing/index.tsx | 10 ++++++++-- packages/appstore/src/modules/traders-hub/index.tsx | 6 +++++- .../shared/src/services/performance-metrics-methods.ts | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/appstore/src/components/options-multipliers-listing/index.tsx b/packages/appstore/src/components/options-multipliers-listing/index.tsx index a235889681a8..f663c3292aa0 100644 --- a/packages/appstore/src/components/options-multipliers-listing/index.tsx +++ b/packages/appstore/src/components/options-multipliers-listing/index.tsx @@ -1,7 +1,7 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import { observer } from 'mobx-react-lite'; import { Text, StaticUrl } from '@deriv/components'; -import { ContentFlag } from '@deriv/shared'; +import { ContentFlag, setPerformanceValue } from '@deriv/shared'; import { useStore } from '@deriv/stores'; import { Localize, localize } from '@deriv/translations'; import ListingContainer from 'Components/containers/listing-container'; @@ -53,6 +53,12 @@ const OptionsAndMultipliersListing = observer(() => { return null; }; + useEffect(() => { + if (is_landing_company_loaded) { + setPerformanceValue('option_multiplier_section_loading_time'); + } + }, [is_landing_company_loaded]); + return ( } diff --git a/packages/appstore/src/modules/traders-hub/index.tsx b/packages/appstore/src/modules/traders-hub/index.tsx index b057b64dbe8f..dc7ed80b13c3 100644 --- a/packages/appstore/src/modules/traders-hub/index.tsx +++ b/packages/appstore/src/modules/traders-hub/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { DesktopWrapper, MobileWrapper, ButtonToggle, Div100vhContainer, Text } from '@deriv/components'; -import { isDesktop, routes, ContentFlag, checkServerMaintenance } from '@deriv/shared'; +import { isDesktop, routes, ContentFlag, checkServerMaintenance, startPerformanceEventTimer } from '@deriv/shared'; import { observer, useStore } from '@deriv/stores'; import { Localize, localize } from '@deriv/translations'; import CFDsListing from 'Components/cfds-listing'; @@ -80,6 +80,10 @@ const TradersHub = observer(() => { return () => clearTimeout(timer); }, [handleScroll, is_eu_user, is_tour_open, setTogglePlatformType]); + React.useLayoutEffect(() => { + startPerformanceEventTimer('option_multiplier_section_loading_time'); + }, []); + const eu_title = content_flag === ContentFlag.EU_DEMO || content_flag === ContentFlag.EU_REAL || is_eu_user; const getPlatformToggleOptions = () => [ diff --git a/packages/shared/src/services/performance-metrics-methods.ts b/packages/shared/src/services/performance-metrics-methods.ts index 75195291be62..b550db858ef8 100644 --- a/packages/shared/src/services/performance-metrics-methods.ts +++ b/packages/shared/src/services/performance-metrics-methods.ts @@ -16,6 +16,7 @@ declare global { switch_currency_accounts_time: number; switch_from_demo_to_real_time: number; switch_from_real_to_demo_time: number; + options_multipliers_section_loading_time: number; }; } } @@ -36,6 +37,7 @@ export const startPerformanceEventTimer = (action: keyof typeof global.Window.pr switch_currency_accounts_time: 0, switch_from_demo_to_real_time: 0, switch_from_real_to_demo_time: 0, + options_multipliers_section_loading_time: 0, }; } From f5a13172a451495cc7fbae1d2313c6ae61ddcfbe Mon Sep 17 00:00:00 2001 From: mitra Date: Wed, 8 May 2024 17:09:41 +0800 Subject: [PATCH 5/5] fix: :bug: address comment --- packages/appstore/src/components/cfds-listing/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/appstore/src/components/cfds-listing/index.tsx b/packages/appstore/src/components/cfds-listing/index.tsx index 0e85207f85e9..161f4f4e656e 100644 --- a/packages/appstore/src/components/cfds-listing/index.tsx +++ b/packages/appstore/src/components/cfds-listing/index.tsx @@ -173,14 +173,14 @@ const CFDsListing = observer(() => { }; useEffect(() => { - if (is_landing_company_loaded && !is_populating_mt5_account_list) { + if (is_landing_company_loaded && is_populating_mt5_account_list) { setPerformanceValue('login_time'); setPerformanceValue('redirect_from_deriv_com_time'); setPerformanceValue('switch_currency_accounts_time'); setPerformanceValue('switch_from_demo_to_real_time'); setPerformanceValue('switch_from_real_to_demo_time'); } - }, [is_landing_company_loaded]); + }, [is_populating_mt5_account_list]); return (