/**
* External dependencies
*/
import { Fragment } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { Button } from '@wordpress/components';
import { recordEvent } from '@woocommerce/tracks';
/**
* Internal dependencies
*/
import {
CollapsibleCard,
CardDivider,
ProductIcon,
PluginCardBody,
} from '~/marketing/components';
import { InstalledPlugin } from '~/marketing/types';
import { useInstalledPlugins } from '~/marketing/hooks';
export const InstalledExtensions = () => {
const { installedPlugins, activatingPlugins, activateInstalledPlugin } =
useInstalledPlugins();
if ( installedPlugins.length === 0 ) {
return null;
}
const getButton = ( plugin: InstalledPlugin ) => {
if ( plugin.status === 'installed' ) {
return (
);
}
if ( plugin.status === 'activated' ) {
return (
);
}
if ( plugin.status === 'configured' ) {
return (
);
}
};
return (
{ installedPlugins.map( ( el, idx ) => {
return (
}
name={ el.name }
description={ el.description }
button={ getButton( el ) }
/>
{ idx !== installedPlugins.length - 1 && (
) }
);
} ) }
);
};