Skip to content

fix: posthog-event develop #558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/Shared/Components/GettingStartedCard/GettingStarted.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ import './gettingStarted.scss'
import { Button, ButtonStyleType, ButtonVariantType } from '../Button'

const GettingStartedCard = ({ className, hideGettingStartedCard }: GettingStartedType) => {
const onClickedOkay = async (e) => {
const onClickedOkay = async () => {
setActionWithExpiry('clickedOkay', 1)
hideGettingStartedCard()
await handlePostHogEventUpdate(e)
await handlePostHogEventUpdate(POSTHOG_EVENT_ONBOARDING.TOOLTIP_OKAY)
}

const onClickedDontShowAgain = async (e) => {
const onClickedDontShowAgain = async () => {
const updatedPayload = {
key: LOGIN_COUNT,
value: `${MAX_LOGIN_COUNT}`,
}
await updateLoginCount(updatedPayload)
hideGettingStartedCard(updatedPayload.value)
await handlePostHogEventUpdate(e)
await handlePostHogEventUpdate(POSTHOG_EVENT_ONBOARDING.TOOLTIP_DONT_SHOW_AGAIN)
}

return (
Expand All @@ -53,15 +53,13 @@ const GettingStartedCard = ({ className, hideGettingStartedCard }: GettingStarte
size={ComponentSizeType.xs}
dataTestId="getting-started-okay"
onClick={onClickedOkay}
data-posthog={POSTHOG_EVENT_ONBOARDING.TOOLTIP_OKAY}
/>
<Button
text="Don't show again"
size={ComponentSizeType.xs}
dataTestId="getting-started-don't-show-again"
onClick={onClickedDontShowAgain}
style={ButtonStyleType.neutral}
data-posthog={POSTHOG_EVENT_ONBOARDING.TOOLTIP_DONT_SHOW_AGAIN}
variant={ButtonVariantType.secondary}
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/Shared/Components/Header/PageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const PageHeader = ({
hideGettingStartedCard()
}

const onClickHelp = async (e) => {
const onClickHelp = async () => {
if (
!window._env_.K8S_CLIENT &&
currentServerInfo.serverInfo?.installationType !== InstallationType.ENTERPRISE
Expand All @@ -113,7 +113,7 @@ const PageHeader = ({
}
setActionWithExpiry('clickedOkay', 1)
hideGettingStartedCard()
await handlePostHogEventUpdate(e, POSTHOG_EVENT_ONBOARDING.HELP)
await handlePostHogEventUpdate(POSTHOG_EVENT_ONBOARDING.HELP)
ReactGA.event({
category: 'Main Navigation',
action: `Help Clicked`,
Expand Down
1 change: 1 addition & 0 deletions src/Shared/Components/Header/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@

export { default as PageHeader } from './PageHeader'
export * from './HeaderWithCreateButton'
export * from './utils'
4 changes: 2 additions & 2 deletions src/Shared/Components/Header/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import { LOGIN_COUNT } from '../../../Common'
const millisecondsInDay = 86400000
export const getDateInMilliseconds = (days) => 1 + new Date().valueOf() + (days ?? 0) * millisecondsInDay

export const handlePostHogEventUpdate = async (e, eventName?: string): Promise<void> => {
export const handlePostHogEventUpdate = async (eventName?: string): Promise<void> => {
const payload = {
eventType: eventName || e.target?.dataset.posthog,
eventType: eventName,
key: LOGIN_COUNT,
value: '',
active: true,
Expand Down