Skip to content

Commit

Permalink
[8.x] [AVC Banner] Updates the AVC Banner for 2025 (elastic#205467) (e…
Browse files Browse the repository at this point in the history
…lastic#205820)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[AVC Banner] Updates the AVC Banner for 2025
(elastic#205467)](elastic#205467)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Candace
Park","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-07T18:30:27Z","message":"[AVC
Banner] Updates the AVC Banner for 2025 (elastic#205467)\n\n## Summary\r\n\r\n-
[x] Updates the AVC banner title and blog link\r\n- [x] Banner will
remain visible until EOY 2025 \r\n- [x] Confirm that the original AVC
banner code (not the part that hides\r\nit EOY of 2024) is present in
8.16, 8.17 and 8.x branches\r\n\r\n#
Screenshots\r\n\r\n![image](https://github.com/user-attachments/assets/c2ec37fc-4d42-45f9-aaa1-47b5a6cc715a)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"08535f54a0d9b172f8cd695a5330bcd87f896d7c","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","Team:Defend
Workflows","backport:prev-major","v8.17.0","v8.18.0","v8.16.3","v8.17.1"],"number":205467,"url":"https://github.com/elastic/kibana/pull/205467","mergeCommit":{"message":"[AVC
Banner] Updates the AVC Banner for 2025 (elastic#205467)\n\n## Summary\r\n\r\n-
[x] Updates the AVC banner title and blog link\r\n- [x] Banner will
remain visible until EOY 2025 \r\n- [x] Confirm that the original AVC
banner code (not the part that hides\r\nit EOY of 2024) is present in
8.16, 8.17 and 8.x branches\r\n\r\n#
Screenshots\r\n\r\n![image](https://github.com/user-attachments/assets/c2ec37fc-4d42-45f9-aaa1-47b5a6cc715a)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"08535f54a0d9b172f8cd695a5330bcd87f896d7c"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/205467","number":205467,"mergeCommit":{"message":"[AVC
Banner] Updates the AVC Banner for 2025 (elastic#205467)\n\n## Summary\r\n\r\n-
[x] Updates the AVC banner title and blog link\r\n- [x] Banner will
remain visible until EOY 2025 \r\n- [x] Confirm that the original AVC
banner code (not the part that hides\r\nit EOY of 2024) is present in
8.16, 8.17 and 8.x branches\r\n\r\n#
Screenshots\r\n\r\n![image](https://github.com/user-attachments/assets/c2ec37fc-4d42-45f9-aaa1-47b5a6cc715a)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"08535f54a0d9b172f8cd695a5330bcd87f896d7c"}},{"branch":"8.17","label":"v8.17.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/205816","number":205816,"state":"OPEN"},{"branch":"8.x","label":"v8.18.0","labelRegex":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.3","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/205819","number":205819,"state":"OPEN"}]}]
BACKPORT-->
  • Loading branch information
parkiino authored Jan 8, 2025
1 parent 8822613 commit afcddd6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 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 }: React.PropsWithChildren<{ onDismiss: () => void; }>) => JSX.Element"
Expand All @@ -19,8 +19,8 @@
"children": [
{
"parentPluginId": "@kbn/avc-banner",
"id": "def-public.AVCResultsBanner2024.$1",
"type": "CompoundType",
"id": "def-public.AVCResultsBanner.$1",
"type": "Object",
"tags": [],
"label": "{ onDismiss }",
"description": [],
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 @@ -480,7 +480,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 afcddd6

Please sign in to comment.