mirror of
https://github.com/strapi/strapi.git
synced 2025-12-04 11:02:12 +00:00
Add event to marketplace page
Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
parent
91c33b9c8e
commit
f2259ee269
@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
import { useIntl } from 'react-intl';
|
||||
import styled from 'styled-components';
|
||||
import { Helmet } from 'react-helmet';
|
||||
import { pxToRem, CheckPagePermissions } from '@strapi/helper-plugin';
|
||||
import { pxToRem, CheckPagePermissions, useTracking } from '@strapi/helper-plugin';
|
||||
import { Layout, HeaderLayout, ContentLayout } from '@strapi/design-system/Layout';
|
||||
import { Flex } from '@strapi/design-system/Flex';
|
||||
import { Box } from '@strapi/design-system/Box';
|
||||
@ -27,6 +27,11 @@ const StackCentered = styled(Stack)`
|
||||
|
||||
const MarketPlacePage = () => {
|
||||
const { formatMessage } = useIntl();
|
||||
const { trackUsage } = useTracking();
|
||||
|
||||
useEffect(() => {
|
||||
trackUsage('didGoToMarketplace');
|
||||
}, [trackUsage]);
|
||||
|
||||
return (
|
||||
<CheckPagePermissions permissions={adminPermissions.marketplace.main}>
|
||||
|
||||
@ -2,11 +2,13 @@ import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { ThemeProvider, lightTheme } from '@strapi/design-system';
|
||||
import { useTracking } from '@strapi/helper-plugin';
|
||||
import MarketPlacePage from '../index';
|
||||
|
||||
jest.mock('@strapi/helper-plugin', () => ({
|
||||
pxToRem: jest.fn(),
|
||||
CheckPagePermissions: ({ children }) => children,
|
||||
useTracking: jest.fn(() => ({ trackUsage: jest.fn() })),
|
||||
}));
|
||||
|
||||
const App = (
|
||||
@ -440,4 +442,12 @@ describe('Marketplace coming soon', () => {
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
|
||||
it('sends an event when the user enters the marketplace', () => {
|
||||
const trackUsage = jest.fn();
|
||||
useTracking.mockImplementation(() => ({ trackUsage }));
|
||||
render(App);
|
||||
|
||||
expect(trackUsage).toHaveBeenCalledWith('didGoToMarketplace');
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user