mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-24 20:06:55 +01:00
feat: order environment plausible events
This commit is contained in:
parent
4c8aef58ae
commit
528e45f2bd
@ -18,9 +18,9 @@ export const OrderEnvironments: FC<OrderEnvironmentsProps> = () => {
|
|||||||
'purchaseAdditionalEnvironments',
|
'purchaseAdditionalEnvironments',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!isPro() || !isPurchaseAdditionalEnvironmentsEnabled) {
|
// if (!isPro() || !isPurchaseAdditionalEnvironmentsEnabled) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
const onSubmit = (environments: string[]) => {
|
const onSubmit = (environments: string[]) => {
|
||||||
setPurchaseDialogOpen(false);
|
setPurchaseDialogOpen(false);
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import FormTemplate from 'component/common/FormTemplate/FormTemplate';
|
|||||||
import { OrderEnvironmentsDialogPricing } from './OrderEnvironmentsDialogPricing/OrderEnvironmentsDialogPricing';
|
import { OrderEnvironmentsDialogPricing } from './OrderEnvironmentsDialogPricing/OrderEnvironmentsDialogPricing';
|
||||||
import GeneralSelect from 'component/common/GeneralSelect/GeneralSelect';
|
import GeneralSelect from 'component/common/GeneralSelect/GeneralSelect';
|
||||||
import Input from 'component/common/Input/Input';
|
import Input from 'component/common/Input/Input';
|
||||||
|
import { usePlausibleTracker } from '../../../../../hooks/usePlausibleTracker';
|
||||||
|
|
||||||
type OrderEnvironmentsDialogProps = {
|
type OrderEnvironmentsDialogProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@ -75,10 +76,19 @@ export const OrderEnvironmentsDialog: FC<OrderEnvironmentsDialogProps> = ({
|
|||||||
onClose,
|
onClose,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { trackEvent } = usePlausibleTracker();
|
||||||
const [selectedOption, setSelectedOption] = useState(OPTIONS[0]);
|
const [selectedOption, setSelectedOption] = useState(OPTIONS[0]);
|
||||||
const [costCheckboxChecked, setCostCheckboxChecked] = useState(false);
|
const [costCheckboxChecked, setCostCheckboxChecked] = useState(false);
|
||||||
const [environmentNames, setEnvironmentNames] = useState<string[]>([]);
|
const [environmentNames, setEnvironmentNames] = useState<string[]>([]);
|
||||||
|
|
||||||
|
const trackEnvironmentSelect = () => {
|
||||||
|
trackEvent('order-environments', {
|
||||||
|
props: {
|
||||||
|
eventType: 'selected environment count',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledDialog open={open} title=''>
|
<StyledDialog open={open} title=''>
|
||||||
<FormTemplate
|
<FormTemplate
|
||||||
@ -135,6 +145,7 @@ export const OrderEnvironmentsDialog: FC<OrderEnvironmentsDialogProps> = ({
|
|||||||
setEnvironmentNames((names) =>
|
setEnvironmentNames((names) =>
|
||||||
names.slice(0, value),
|
names.slice(0, value),
|
||||||
);
|
);
|
||||||
|
trackEnvironmentSelect();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { Box, Button, styled, Typography } from '@mui/material';
|
|||||||
import { ThemeMode } from 'component/common/ThemeMode/ThemeMode';
|
import { ThemeMode } from 'component/common/ThemeMode/ThemeMode';
|
||||||
import { ReactComponent as ProPlanIcon } from 'assets/icons/pro-enterprise-feature-badge.svg';
|
import { ReactComponent as ProPlanIcon } from 'assets/icons/pro-enterprise-feature-badge.svg';
|
||||||
import { ReactComponent as ProPlanIconLight } from 'assets/icons/pro-enterprise-feature-badge-light.svg';
|
import { ReactComponent as ProPlanIconLight } from 'assets/icons/pro-enterprise-feature-badge-light.svg';
|
||||||
|
import { usePlausibleTracker } from '../../../../../hooks/usePlausibleTracker';
|
||||||
|
|
||||||
type PurchasableFeatureProps = {
|
type PurchasableFeatureProps = {
|
||||||
title: ReactNode;
|
title: ReactNode;
|
||||||
@ -50,6 +51,17 @@ export const PurchasableFeature: FC<PurchasableFeatureProps> = ({
|
|||||||
description,
|
description,
|
||||||
onClick,
|
onClick,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { trackEvent } = usePlausibleTracker();
|
||||||
|
|
||||||
|
const onViewPricingClick = () => {
|
||||||
|
onClick();
|
||||||
|
trackEvent('order-environments', {
|
||||||
|
props: {
|
||||||
|
eventType: 'view pricing clicked',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledContainer>
|
<StyledContainer>
|
||||||
<StyledMessage>
|
<StyledMessage>
|
||||||
@ -62,7 +74,7 @@ export const PurchasableFeature: FC<PurchasableFeatureProps> = ({
|
|||||||
</Box>
|
</Box>
|
||||||
</StyledMessage>
|
</StyledMessage>
|
||||||
<StyledButtonContainer>
|
<StyledButtonContainer>
|
||||||
<Button variant='contained' onClick={onClick}>
|
<Button variant='contained' onClick={onViewPricingClick}>
|
||||||
View pricing
|
View pricing
|
||||||
</Button>
|
</Button>
|
||||||
</StyledButtonContainer>
|
</StyledButtonContainer>
|
||||||
|
|||||||
@ -69,7 +69,8 @@ export type CustomEvents =
|
|||||||
| 'events-exported'
|
| 'events-exported'
|
||||||
| 'event-timeline'
|
| 'event-timeline'
|
||||||
| 'onboarding'
|
| 'onboarding'
|
||||||
| 'personal-dashboard';
|
| 'personal-dashboard'
|
||||||
|
| 'order-environments';
|
||||||
|
|
||||||
export const usePlausibleTracker = () => {
|
export const usePlausibleTracker = () => {
|
||||||
const plausible = useContext(PlausibleContext);
|
const plausible = useContext(PlausibleContext);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user