From 469574f9395914037b9f58359e649aa4debc3030 Mon Sep 17 00:00:00 2001 From: Germain Tchuinkam Date: Tue, 16 Jan 2024 16:12:37 -0500 Subject: [PATCH 1/2] Added bridge method call --- ui/src/components/AuthPage/index.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ui/src/components/AuthPage/index.tsx b/ui/src/components/AuthPage/index.tsx index f5380c5..3827120 100644 --- a/ui/src/components/AuthPage/index.tsx +++ b/ui/src/components/AuthPage/index.tsx @@ -11,11 +11,13 @@ import { gridSize } from '@atlaskit/theme'; import WatchIcon from '@atlaskit/icon/glyph/watch'; import WatchFilledIcon from '@atlaskit/icon/glyph/watch-filled'; +import { getCallBridge } from '@forge/bridge/out/bridge'; import { ApplicationState } from '../../routes'; import { ForgeLink } from '../ForgeLink'; import { connectGroup } from '../../services/invokes'; import { ErrorMessages } from '../../errorMessages'; import { AuthErrorTypes, ErrorTypes } from '../../resolverTypes'; +import { useAppContext } from '../../hooks/useAppContext'; const SectionMessageWrapper = styled.div` margin-bottom: ${gridSize() * 2}px; @@ -97,9 +99,19 @@ export const AuthPage = () => { const [isLoadingSubmit, setLoadingSubmit] = useState(false); const [errorType, setErrorType] = useState(null); const [isTokenVisible, setIsTokenVisible] = useState(false); + const { appId } = useAppContext(); const navigate = useNavigate(); + const fireAppConfiguredAnalytic = async () => { + const action = 'configured'; + const actionSubject = 'compassApp'; + await getCallBridge()('fireForgeAnalytic', { + forgeAppId: appId, + analyticEvent: `${action} ${actionSubject}`, + }); + }; + const handleNavigateToConnectedPage = () => { navigate(`..${ApplicationState.CONNECTED}`, { replace: true }); }; @@ -111,6 +123,7 @@ export const AuthPage = () => { const { success, errors } = await connectGroup(token.trim(), tokenName); if (success) { + await fireAppConfiguredAnalytic(); handleNavigateToConnectedPage(); } else { setErrorType((errors && errors[0].errorType) || AuthErrorTypes.UNEXPECTED_ERROR); From 1dc34f9cb7ac91372e8530fe0e45f59a894da84a Mon Sep 17 00:00:00 2001 From: Germain Tchuinkam Date: Wed, 17 Jan 2024 11:56:30 -0500 Subject: [PATCH 2/2] analytic fix --- ui/src/components/AuthPage/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/components/AuthPage/index.tsx b/ui/src/components/AuthPage/index.tsx index 3827120..db9fe0c 100644 --- a/ui/src/components/AuthPage/index.tsx +++ b/ui/src/components/AuthPage/index.tsx @@ -108,7 +108,7 @@ export const AuthPage = () => { const actionSubject = 'compassApp'; await getCallBridge()('fireForgeAnalytic', { forgeAppId: appId, - analyticEvent: `${action} ${actionSubject}`, + analyticEvent: `${actionSubject} ${action}`, }); };