Skip to content

Commit

Permalink
[AVC Banner] Updates the AVC Banner for 2025 (elastic#205467)
Browse files Browse the repository at this point in the history
## Summary

- [x] Updates the AVC banner title and blog link
- [x] Banner will remain visible until EOY 2025 
- [x] Confirm that the original AVC banner code (not the part that hides
it EOY of 2024) is present in 8.16, 8.17 and 8.x branches

# Screenshots

![image](https://github.com/user-attachments/assets/c2ec37fc-4d42-45f9-aaa1-47b5a6cc715a)

---------

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
parkiino and elasticmachine authored Jan 7, 2025
1 parent d5c804b commit 08535f5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions api_docs/kbn_avc_banner.devdocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"functions": [
{
"parentPluginId": "@kbn/avc-banner",
"id": "def-public.AVCResultsBanner2024",
"id": "def-public.AVCResultsBanner",
"type": "Function",
"tags": [],
"label": "AVCResultsBanner2024",
"label": "AVCResultsBanner",
"description": [],
"signature": [
"({ onDismiss }: { onDismiss: () => void; }) => React.JSX.Element"
Expand All @@ -19,7 +19,7 @@
"children": [
{
"parentPluginId": "@kbn/avc-banner",
"id": "def-public.AVCResultsBanner2024.$1",
"id": "def-public.AVCResultsBanner.$1",
"type": "Object",
"tags": [],
"label": "{ onDismiss }",
Expand Down Expand Up @@ -75,4 +75,4 @@
"misc": [],
"objects": []
}
}
}
10 changes: 5 additions & 5 deletions src/platform/packages/shared/kbn-avc-banner/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import avcBannerBackground from './avc_banner_background.svg';

// Logic to hide banner at EOY 2024
export const useIsStillYear2024: () => boolean = () => {
// Logic to hide banner at EOY 2025
export const useIsStillYear2025: () => boolean = () => {
return useMemo(() => {
return new Date().getFullYear() === 2024;
return new Date().getFullYear() === 2025;
}, []);
};

export const AVCResultsBanner2024: React.FC<{ onDismiss: () => void }> = ({ onDismiss }) => {
export const AVCResultsBanner: React.FC<{ onDismiss: () => void }> = ({ onDismiss }) => {
const { docLinks } = useKibana().services;
const { euiTheme } = useEuiTheme();
const bannerTitle = i18n.translate('avcBanner.title', {
defaultMessage: '100% protection with zero false positives.',
defaultMessage: 'Proven defense with zero false positives',
});

const calloutStyles = css({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
},
securitySolution: {
artifactControl: `${SECURITY_SOLUTION_DOCS}artifact-control.html`,
avcResults: `${ELASTIC_WEBSITE_URL}blog/elastic-av-comparatives-business-security-test`,
avcResults: `${ELASTIC_WEBSITE_URL}blog/elastic-security-av-comparatives-business-test`,
bidirectionalIntegrations: `${SECURITY_SOLUTION_DOCS}third-party-actions.html`,
trustedApps: `${SECURITY_SOLUTION_DOCS}trusted-apps-ov.html`,
eventFilters: `${SECURITY_SOLUTION_DOCS}event-filters.html`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { FormattedMessage } from '@kbn/i18n-react';

import { useKibana } from '@kbn/kibana-react-plugin/public';

import { AVCResultsBanner2024, useIsStillYear2024 } from '@kbn/avc-banner';
import { AVCResultsBanner, useIsStillYear2025 } from '@kbn/avc-banner';

import {
isIntegrationPolicyTemplate,
Expand Down Expand Up @@ -336,9 +336,9 @@ export const OverviewPage: React.FC<Props> = memo(
</SideBar>
<EuiFlexItem grow={9} className="eui-textBreakWord">
{isUnverified && <UnverifiedCallout />}
{useIsStillYear2024() && isElasticDefend && showAVCBanner && (
{useIsStillYear2025() && isElasticDefend && showAVCBanner && (
<>
<AVCResultsBanner2024 onDismiss={onAVCBannerDismiss} />
<AVCResultsBanner onDismiss={onAVCBannerDismiss} />
<EuiSpacer size="s" />
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@

import React, { useCallback } from 'react';

import { AVCResultsBanner2024, useIsStillYear2024 } from '@kbn/avc-banner';
import { AVCResultsBanner, useIsStillYear2025 } from '@kbn/avc-banner';
import { useStoredIsAVCBannerDismissed } from '../hooks/use_stored_state';

export const OnboardingBanner = React.memo(() => {
const [isAVCBannerDismissed, setIsAVCBannerDismissed] = useStoredIsAVCBannerDismissed();
const isStillYear2024 = useIsStillYear2024();
const isStillYear2025 = useIsStillYear2025();

const dismissAVCBanner = useCallback(() => {
setIsAVCBannerDismissed(true);
}, [setIsAVCBannerDismissed]);

if (isAVCBannerDismissed || !isStillYear2024) {
if (isAVCBannerDismissed || !isStillYear2025) {
return null;
}

return <AVCResultsBanner2024 onDismiss={dismissAVCBanner} />;
return <AVCResultsBanner onDismiss={dismissAVCBanner} />;
});
OnboardingBanner.displayName = 'OnboardingBanner';

0 comments on commit 08535f5

Please sign in to comment.