/** * External dependencies */ import { __, _n, sprintf } from '@wordpress/i18n'; import { Text } from '@woocommerce/experimental'; import { recordEvent } from '@woocommerce/tracks'; import { AbbreviatedCard } from '@woocommerce/components'; import { useSelect } from '@wordpress/data'; import { ONBOARDING_STORE_NAME } from '@woocommerce/data'; import { box, comment, page } from '@wordpress/icons'; import { createSlotFill } from '@wordpress/components'; /** * Internal dependencies */ import { getLowStockCount, getOrderStatuses, getUnreadOrders, } from '~/homescreen/activity-panel/orders/utils'; import { getUnapprovedReviews } from '~/homescreen/activity-panel/reviews/utils'; import { isWCAdmin } from '~/dashboard/utils'; import { Bell } from './icons/bell'; const EXTENDED_TASK_LIST_ID = 'extended_task_list'; const ORDER_PANEL_ID = 'orders-panel'; const REVIEWS_PANEL_ID = 'reviews-panel'; const STOCK_PANEL_ID = 'stock-panel'; export const ABBREVIATED_NOTIFICATION_SLOT_NAME = 'AbbreviatedNotification'; export const AbbreviatedNotificationsPanel = ( { thingsToDoNextCount } ) => { const { ordersToProcessCount, reviewsToModerateCount, stockNoticesCount, isSetupTaskListHidden, isExtendedTaskListHidden, } = useSelect( ( select ) => { const { getTaskList } = select( ONBOARDING_STORE_NAME ); const orderStatuses = getOrderStatuses( select ); return { ordersToProcessCount: getUnreadOrders( select, orderStatuses ), reviewsToModerateCount: getUnapprovedReviews( select ), stockNoticesCount: getLowStockCount( select ), isSetupTaskListHidden: getTaskList( 'setup' )?.isHidden, isExtendedTaskListHidden: getTaskList( 'extended' )?.isHidden, }; } ); const trackAbbreviatedCardClick = ( name ) => { recordEvent( 'activity_panel_click', { task: name, } ); }; const { Slot } = createSlotFill( ABBREVIATED_NOTIFICATION_SLOT_NAME ); const isWCAdminPage = isWCAdmin( window.location.href ); return (