mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-08 01:15:49 +02:00
feat: add plausible to integrations (#4647)
This commit is contained in:
parent
61174a1d9c
commit
0b5a7b7d36
@ -37,21 +37,21 @@ export const OFFICIAL_SDKS: Sdk[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'python',
|
name: 'python',
|
||||||
displayName: 'Python SDK',
|
displayName: 'Python SDK',
|
||||||
description: 'Officially Unleash Client for Python',
|
description: 'Officially Unleash Client for Python',
|
||||||
documentationUrl: 'https://docs.getunleash.io/reference/sdks/python',
|
documentationUrl: 'https://docs.getunleash.io/reference/sdks/python',
|
||||||
type: 'server',
|
type: 'server',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'ruby',
|
name: 'ruby',
|
||||||
displayName: 'Ruby SDK',
|
displayName: 'Ruby SDK',
|
||||||
description: 'Officially Unleash Client for Ruby',
|
description: 'Officially Unleash Client for Ruby',
|
||||||
documentationUrl: 'https://docs.getunleash.io/reference/sdks/ruby',
|
documentationUrl: 'https://docs.getunleash.io/reference/sdks/ruby',
|
||||||
type: 'server',
|
type: 'server',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'rust',
|
name: 'rust',
|
||||||
displayName: 'Rust SDK',
|
displayName: 'Rust SDK',
|
||||||
description: 'Officially Unleash Client for Rust',
|
description: 'Officially Unleash Client for Rust',
|
||||||
documentationUrl: 'https://docs.getunleash.io/reference/sdks/rust',
|
documentationUrl: 'https://docs.getunleash.io/reference/sdks/rust',
|
||||||
type: 'server',
|
type: 'server',
|
||||||
@ -80,14 +80,14 @@ export const OFFICIAL_SDKS: Sdk[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'ios',
|
name: 'ios',
|
||||||
displayName: 'iOS Proxy SDK',
|
displayName: 'iOS Proxy SDK',
|
||||||
description: 'Officially Unleash Client for iOS',
|
description: 'Officially Unleash Client for iOS',
|
||||||
documentationUrl: 'https://docs.getunleash.io/reference/sdks/ios-proxy',
|
documentationUrl: 'https://docs.getunleash.io/reference/sdks/ios-proxy',
|
||||||
type: 'client',
|
type: 'client',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'javascript',
|
name: 'javascript',
|
||||||
displayName: 'Javascript Proxy SDK',
|
displayName: 'Javascript Proxy SDK',
|
||||||
description: 'Officially Unleash Client for Javascript',
|
description: 'Officially Unleash Client for Javascript',
|
||||||
documentationUrl:
|
documentationUrl:
|
||||||
'https://docs.getunleash.io/reference/sdks/javascript-browser',
|
'https://docs.getunleash.io/reference/sdks/javascript-browser',
|
||||||
@ -95,14 +95,14 @@ export const OFFICIAL_SDKS: Sdk[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'react',
|
name: 'react',
|
||||||
displayName: 'React Proxy SDK',
|
displayName: 'React Proxy SDK',
|
||||||
description: 'Officially Unleash Client for React',
|
description: 'Officially Unleash Client for React',
|
||||||
documentationUrl: 'https://docs.getunleash.io/reference/sdks/react',
|
documentationUrl: 'https://docs.getunleash.io/reference/sdks/react',
|
||||||
type: 'client',
|
type: 'client',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'svelte',
|
name: 'svelte',
|
||||||
displayName: 'Svelte Proxy SDK',
|
displayName: 'Svelte Proxy SDK',
|
||||||
description: 'Officially Unleash Client for Svelte',
|
description: 'Officially Unleash Client for Svelte',
|
||||||
documentationUrl: 'https://docs.getunleash.io/reference/sdks/svelte',
|
documentationUrl: 'https://docs.getunleash.io/reference/sdks/svelte',
|
||||||
type: 'client',
|
type: 'client',
|
||||||
|
@ -50,7 +50,6 @@ export const ConfiguredIntegrations: VFC<ConfiguredIntegrationsProps> = ({
|
|||||||
title={providerConfig?.displayName || provider}
|
title={providerConfig?.displayName || provider}
|
||||||
isEnabled={enabled}
|
isEnabled={enabled}
|
||||||
description={description || ''}
|
description={description || ''}
|
||||||
isConfigured
|
|
||||||
link={`/integrations/edit/${id}`}
|
link={`/integrations/edit/${id}`}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -8,13 +8,13 @@ import { Badge } from 'component/common/Badge/Badge';
|
|||||||
import { IntegrationCardMenu } from './IntegrationCardMenu/IntegrationCardMenu';
|
import { IntegrationCardMenu } from './IntegrationCardMenu/IntegrationCardMenu';
|
||||||
import type { AddonSchema } from 'openapi';
|
import type { AddonSchema } from 'openapi';
|
||||||
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
|
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
|
||||||
|
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
||||||
|
|
||||||
interface IIntegrationCardProps {
|
interface IIntegrationCardProps {
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
title: string;
|
title: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
isConfigured?: boolean;
|
|
||||||
isEnabled?: boolean;
|
isEnabled?: boolean;
|
||||||
configureActionText?: string;
|
configureActionText?: string;
|
||||||
link: string;
|
link: string;
|
||||||
@ -87,8 +87,18 @@ export const IntegrationCard: VFC<IIntegrationCardProps> = ({
|
|||||||
deprecated,
|
deprecated,
|
||||||
isExternal = false,
|
isExternal = false,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { trackEvent } = usePlausibleTracker();
|
||||||
const isConfigured = addon !== undefined;
|
const isConfigured = addon !== undefined;
|
||||||
|
|
||||||
|
const handleClick = () => {
|
||||||
|
trackEvent('open-integration', {
|
||||||
|
props: {
|
||||||
|
integrationName: title,
|
||||||
|
isConfigured: isConfigured,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<>
|
<>
|
||||||
<StyledHeader>
|
<StyledHeader>
|
||||||
@ -136,11 +146,20 @@ export const IntegrationCard: VFC<IIntegrationCardProps> = ({
|
|||||||
|
|
||||||
if (isExternal) {
|
if (isExternal) {
|
||||||
return (
|
return (
|
||||||
<StyledAnchor href={link} target="_blank" rel="noreferrer">
|
<StyledAnchor
|
||||||
|
href={link}
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
onClick={handleClick}
|
||||||
|
>
|
||||||
{content}
|
{content}
|
||||||
</StyledAnchor>
|
</StyledAnchor>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return <StyledLink to={link}>{content}</StyledLink>;
|
return (
|
||||||
|
<StyledLink to={link} onClick={handleClick}>
|
||||||
|
{content}
|
||||||
|
</StyledLink>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -44,7 +44,8 @@ export type CustomEvents =
|
|||||||
| 'playground'
|
| 'playground'
|
||||||
| 'feature-type-edit'
|
| 'feature-type-edit'
|
||||||
| 'strategy-variants'
|
| 'strategy-variants'
|
||||||
| 'search-filter-suggestions';
|
| 'search-filter-suggestions'
|
||||||
|
| 'open-integration';
|
||||||
|
|
||||||
export const usePlausibleTracker = () => {
|
export const usePlausibleTracker = () => {
|
||||||
const plausible = useContext(PlausibleContext);
|
const plausible = useContext(PlausibleContext);
|
||||||
|
Loading…
Reference in New Issue
Block a user