Wizard: Add isPreview property to analytics tracking
This adds `isPreview` property to the analytics tracking with the use of chrome's `isBeta()`.
This commit is contained in:
parent
77a57db014
commit
39d2f91f03
3 changed files with 14 additions and 4 deletions
|
|
@ -38,7 +38,7 @@ import { releaseToVersion } from '../../../../Utilities/releaseToVersion';
|
||||||
import useDebounce from '../../../../Utilities/useDebounce';
|
import useDebounce from '../../../../Utilities/useDebounce';
|
||||||
|
|
||||||
const PackageRecommendations = () => {
|
const PackageRecommendations = () => {
|
||||||
const { analytics } = useChrome();
|
const { analytics, isBeta } = useChrome();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const arch = useAppSelector(selectArchitecture);
|
const arch = useAppSelector(selectArchitecture);
|
||||||
|
|
@ -82,6 +82,7 @@ const PackageRecommendations = () => {
|
||||||
`${AMPLITUDE_MODULE_NAME}-packageRecommendationsShown`,
|
`${AMPLITUDE_MODULE_NAME}-packageRecommendationsShown`,
|
||||||
{
|
{
|
||||||
module: AMPLITUDE_MODULE_NAME,
|
module: AMPLITUDE_MODULE_NAME,
|
||||||
|
isPreview: isBeta(),
|
||||||
shownRecommendations: response.data.packages,
|
shownRecommendations: response.data.packages,
|
||||||
selectedPackages: packages.map((pkg) => pkg.name),
|
selectedPackages: packages.map((pkg) => pkg.name),
|
||||||
}
|
}
|
||||||
|
|
@ -232,6 +233,7 @@ const PackageRecommendations = () => {
|
||||||
`${AMPLITUDE_MODULE_NAME}-recommendedPackageAdded`,
|
`${AMPLITUDE_MODULE_NAME}-recommendedPackageAdded`,
|
||||||
{
|
{
|
||||||
module: AMPLITUDE_MODULE_NAME,
|
module: AMPLITUDE_MODULE_NAME,
|
||||||
|
isPreview: isBeta(),
|
||||||
packageName: pkg,
|
packageName: pkg,
|
||||||
selectedPackages: packages.map(
|
selectedPackages: packages.map(
|
||||||
(pkg) => pkg.name
|
(pkg) => pkg.name
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,13 @@ import useChrome from '@redhat-cloud-services/frontend-components/useChrome';
|
||||||
|
|
||||||
import { AMPLITUDE_MODULE_NAME } from '../../../../../constants';
|
import { AMPLITUDE_MODULE_NAME } from '../../../../../constants';
|
||||||
import { setBlueprintId } from '../../../../../store/BlueprintSlice';
|
import { setBlueprintId } from '../../../../../store/BlueprintSlice';
|
||||||
import { useAppDispatch } from '../../../../../store/hooks';
|
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
|
||||||
import {
|
import {
|
||||||
CreateBlueprintRequest,
|
CreateBlueprintRequest,
|
||||||
useComposeBlueprintMutation,
|
useComposeBlueprintMutation,
|
||||||
useCreateBlueprintMutation,
|
useCreateBlueprintMutation,
|
||||||
} from '../../../../../store/imageBuilderApi';
|
} from '../../../../../store/imageBuilderApi';
|
||||||
|
import { selectPackages } from '../../../../../store/wizardSlice';
|
||||||
|
|
||||||
type CreateDropdownProps = {
|
type CreateDropdownProps = {
|
||||||
getBlueprintPayload: () => Promise<'' | CreateBlueprintRequest | undefined>;
|
getBlueprintPayload: () => Promise<'' | CreateBlueprintRequest | undefined>;
|
||||||
|
|
@ -32,7 +33,8 @@ export const CreateSaveAndBuildBtn = ({
|
||||||
setIsOpen,
|
setIsOpen,
|
||||||
isDisabled,
|
isDisabled,
|
||||||
}: CreateDropdownProps) => {
|
}: CreateDropdownProps) => {
|
||||||
const { analytics } = useChrome();
|
const { analytics, isBeta } = useChrome();
|
||||||
|
const packages = useAppSelector(selectPackages);
|
||||||
|
|
||||||
const [buildBlueprint] = useComposeBlueprintMutation();
|
const [buildBlueprint] = useComposeBlueprintMutation();
|
||||||
const [createBlueprint] = useCreateBlueprintMutation({
|
const [createBlueprint] = useCreateBlueprintMutation({
|
||||||
|
|
@ -45,7 +47,9 @@ export const CreateSaveAndBuildBtn = ({
|
||||||
|
|
||||||
analytics.track(`${AMPLITUDE_MODULE_NAME}-blueprintCreated`, {
|
analytics.track(`${AMPLITUDE_MODULE_NAME}-blueprintCreated`, {
|
||||||
module: AMPLITUDE_MODULE_NAME,
|
module: AMPLITUDE_MODULE_NAME,
|
||||||
|
isPreview: isBeta(),
|
||||||
type: 'createBlueprintAndBuildImages',
|
type: 'createBlueprintAndBuildImages',
|
||||||
|
packages: packages.map((pkg) => pkg.name),
|
||||||
});
|
});
|
||||||
|
|
||||||
const blueprint =
|
const blueprint =
|
||||||
|
|
@ -78,7 +82,8 @@ export const CreateSaveButton = ({
|
||||||
getBlueprintPayload,
|
getBlueprintPayload,
|
||||||
isDisabled,
|
isDisabled,
|
||||||
}: CreateDropdownProps) => {
|
}: CreateDropdownProps) => {
|
||||||
const { analytics } = useChrome();
|
const { analytics, isBeta } = useChrome();
|
||||||
|
const packages = useAppSelector(selectPackages);
|
||||||
|
|
||||||
const [createBlueprint, { isLoading }] = useCreateBlueprintMutation({
|
const [createBlueprint, { isLoading }] = useCreateBlueprintMutation({
|
||||||
fixedCacheKey: 'createBlueprintKey',
|
fixedCacheKey: 'createBlueprintKey',
|
||||||
|
|
@ -133,7 +138,9 @@ export const CreateSaveButton = ({
|
||||||
|
|
||||||
analytics.track(`${AMPLITUDE_MODULE_NAME}-blueprintCreated`, {
|
analytics.track(`${AMPLITUDE_MODULE_NAME}-blueprintCreated`, {
|
||||||
module: AMPLITUDE_MODULE_NAME,
|
module: AMPLITUDE_MODULE_NAME,
|
||||||
|
isPreview: isBeta(),
|
||||||
type: 'createBlueprint',
|
type: 'createBlueprint',
|
||||||
|
packages: packages.map((pkg) => pkg.name),
|
||||||
});
|
});
|
||||||
|
|
||||||
const blueprint =
|
const blueprint =
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ vi.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||||
analytics: {
|
analytics: {
|
||||||
track: () => 'test',
|
track: () => 'test',
|
||||||
},
|
},
|
||||||
|
isBeta: () => true,
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue