From e18c4e7407020f2c69b0862191956cb0a65002ff Mon Sep 17 00:00:00 2001 From: Nate Weller Date: Tue, 14 Jan 2025 13:33:03 -0700 Subject: [PATCH] Move threat components into the scan client package --- pnpm-lock.yaml | 18 +++++-- projects/js-packages/components/index.ts | 7 ++- projects/js-packages/components/package.json | 2 - projects/js-packages/components/tsconfig.json | 9 +++- projects/js-packages/scan/package.json | 5 ++ .../js-packages/scan/src/components/index.ts | 5 ++ .../src}/components/scan-report/constants.ts | 14 ++--- .../src}/components/scan-report/index.tsx | 29 +++++------ .../scan-report/stories/index.stories.tsx | 2 +- .../components/scan-report/styles.module.scss | 0 .../components/threat-fixer-button/index.tsx | 16 +++--- .../stories/index.stories.tsx | 0 .../threat-fixer-button/styles.module.scss | 0 .../threat-modal/fixer-state-notice.tsx | 20 ++++---- .../src}/components/threat-modal/index.tsx | 9 ++-- .../threat-modal/stories/index.stories.tsx | 2 +- .../threat-modal/styles.module.scss | 0 .../threat-modal/threat-actions.tsx | 14 ++--- .../threat-modal/threat-fix-confirmation.tsx | 30 +++++------ .../threat-modal/threat-fix-details.tsx | 14 ++--- .../threat-modal/threat-ignore-details.tsx | 10 ++-- .../components/threat-modal/threat-notice.tsx | 8 +-- .../threat-modal/threat-summary.tsx | 7 ++- .../threat-modal/threat-technical-details.tsx | 12 ++--- .../threat-severity-badge/index.tsx | 10 ++-- .../stories/index.stories.tsx | 0 .../threat-severity-badge/styles.module.scss | 0 .../threat-severity-badge/test/index.test.tsx | 2 +- .../threats-data-views/constants.ts | 14 ++--- .../components/threats-data-views/index.tsx | 51 +++++++++---------- .../threats-data-views/stories/data.tsx | 0 .../stories/index.stories.tsx | 6 +-- .../threats-data-views/styles.module.scss | 0 .../threats-data-views/test/index.test.tsx | 2 +- projects/js-packages/scan/src/index.ts | 1 + projects/js-packages/scan/tsconfig.json | 3 +- .../components/ignore-threat-modal/index.jsx | 4 +- .../js/components/threat-fix-header/index.jsx | 4 +- .../unignore-threat-modal/index.jsx | 4 +- .../protect/src/js/routes/home/index.jsx | 3 +- .../src/js/routes/scan/scan-data-views.tsx | 4 +- .../routes/scan/scan-results-data-views.tsx | 3 +- 42 files changed, 182 insertions(+), 162 deletions(-) create mode 100644 projects/js-packages/scan/src/components/index.ts rename projects/js-packages/{components => scan/src}/components/scan-report/constants.ts (55%) rename projects/js-packages/{components => scan/src}/components/scan-report/index.tsx (91%) rename projects/js-packages/{components => scan/src}/components/scan-report/stories/index.stories.tsx (97%) rename projects/js-packages/{components => scan/src}/components/scan-report/styles.module.scss (100%) rename projects/js-packages/{components => scan/src}/components/threat-fixer-button/index.tsx (93%) rename projects/js-packages/{components => scan/src}/components/threat-fixer-button/stories/index.stories.tsx (100%) rename projects/js-packages/{components => scan/src}/components/threat-fixer-button/styles.module.scss (100%) rename projects/js-packages/{components => scan/src}/components/threat-modal/fixer-state-notice.tsx (89%) rename projects/js-packages/{components => scan/src}/components/threat-modal/index.tsx (95%) rename projects/js-packages/{components => scan/src}/components/threat-modal/stories/index.stories.tsx (99%) rename projects/js-packages/{components => scan/src}/components/threat-modal/styles.module.scss (100%) rename projects/js-packages/{components => scan/src}/components/threat-modal/threat-actions.tsx (90%) rename projects/js-packages/{components => scan/src}/components/threat-modal/threat-fix-confirmation.tsx (69%) rename projects/js-packages/{components => scan/src}/components/threat-modal/threat-fix-details.tsx (83%) rename projects/js-packages/{components => scan/src}/components/threat-modal/threat-ignore-details.tsx (92%) rename projects/js-packages/{components => scan/src}/components/threat-modal/threat-notice.tsx (93%) rename projects/js-packages/{components => scan/src}/components/threat-modal/threat-summary.tsx (82%) rename projects/js-packages/{components => scan/src}/components/threat-modal/threat-technical-details.tsx (83%) rename projects/js-packages/{components => scan/src}/components/threat-severity-badge/index.tsx (68%) rename projects/js-packages/{components => scan/src}/components/threat-severity-badge/stories/index.stories.tsx (100%) rename projects/js-packages/{components => scan/src}/components/threat-severity-badge/styles.module.scss (100%) rename projects/js-packages/{components => scan/src}/components/threat-severity-badge/test/index.test.tsx (85%) rename projects/js-packages/{components => scan/src}/components/threats-data-views/constants.ts (77%) rename projects/js-packages/{components => scan/src}/components/threats-data-views/index.tsx (93%) rename projects/js-packages/{components => scan/src}/components/threats-data-views/stories/data.tsx (100%) rename projects/js-packages/{components => scan/src}/components/threats-data-views/stories/index.stories.tsx (98%) rename projects/js-packages/{components => scan/src}/components/threats-data-views/styles.module.scss (100%) rename projects/js-packages/{components => scan/src}/components/threats-data-views/test/index.test.tsx (98%) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6f3b970b2d221..990be5a7efe29 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -458,9 +458,6 @@ importers: '@wordpress/data': specifier: 10.14.0 version: 10.14.0(react@18.3.1) - '@wordpress/dataviews': - specifier: 4.10.0 - version: 4.10.0(patch_hash=of6mtpeubmoicukrgy5ohupf6a)(@types/react@18.3.18)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@wordpress/date': specifier: 5.14.0 version: 5.14.0 @@ -1298,15 +1295,30 @@ importers: '@automattic/jetpack-base-styles': specifier: workspace:* version: link:../base-styles + '@automattic/jetpack-components': + specifier: workspace:* + version: link:../components '@wordpress/api-fetch': specifier: 7.14.0 version: 7.14.0 + '@wordpress/components': + specifier: 29.0.0 + version: 29.0.0(@types/react@18.3.18)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@wordpress/dataviews': + specifier: 4.10.0 + version: 4.10.0(patch_hash=of6mtpeubmoicukrgy5ohupf6a)(@types/react@18.3.18)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@wordpress/date': + specifier: 5.14.0 + version: 5.14.0 '@wordpress/element': specifier: 6.14.0 version: 6.14.0 '@wordpress/i18n': specifier: 5.14.0 version: 5.14.0 + '@wordpress/icons': + specifier: 10.14.0 + version: 10.14.0(react@18.3.1) '@wordpress/url': specifier: 4.14.0 version: 4.14.0 diff --git a/projects/js-packages/components/index.ts b/projects/js-packages/components/index.ts index c3cb89a23081f..8ac4b1024af6d 100644 --- a/projects/js-packages/components/index.ts +++ b/projects/js-packages/components/index.ts @@ -44,18 +44,17 @@ export { default as CopyToClipboard } from './components/copy-to-clipboard'; export * from './components/icons'; export { default as SplitButton } from './components/split-button'; export { default as ThemeProvider } from './components/theme-provider'; -export { default as ThreatFixerButton } from './components/threat-fixer-button'; -export { default as ThreatSeverityBadge } from './components/threat-severity-badge'; +export { default as ThreatFixerButton } from '../scan/src/components/threat-fixer-button'; export { default as ThreatsDataViews, HISTORIC_TABLE_FIELDS, -} from './components/threats-data-views'; +} from '../scan/src/components/threats-data-views'; export { default as ShieldIcon } from './components/shield-icon'; -export { default as ScanReport } from './components/scan-report'; export { default as Text, H2, H3, Title } from './components/text'; export { default as ToggleControl } from './components/toggle-control'; export { default as numberFormat } from './components/number-format'; export { default as QRCode } from './components/qr-code'; +export { default as Badge } from './components/badge'; export { default as Button } from './components/button'; export type { ButtonProps } from './components/button/types'; export { default as LoadingPlaceholder } from './components/loading-placeholder'; diff --git a/projects/js-packages/components/package.json b/projects/js-packages/components/package.json index c6ef9078b264e..0f1cbe7540201 100644 --- a/projects/js-packages/components/package.json +++ b/projects/js-packages/components/package.json @@ -16,13 +16,11 @@ "dependencies": { "@automattic/format-currency": "1.0.1", "@automattic/jetpack-boost-score-api": "workspace:*", - "@automattic/jetpack-scan": "workspace:*", "@babel/runtime": "^7", "@wordpress/browserslist-config": "6.14.0", "@wordpress/components": "29.0.0", "@wordpress/compose": "7.14.0", "@wordpress/data": "10.14.0", - "@wordpress/dataviews": "4.10.0", "@wordpress/date": "5.14.0", "@wordpress/element": "6.14.0", "@wordpress/i18n": "5.14.0", diff --git a/projects/js-packages/components/tsconfig.json b/projects/js-packages/components/tsconfig.json index 5ab6c619f8cbf..9b9214c4ae980 100644 --- a/projects/js-packages/components/tsconfig.json +++ b/projects/js-packages/components/tsconfig.json @@ -1,5 +1,12 @@ { "extends": "jetpack-js-tools/tsconfig.base.json", // List all sources and source-containing subdirs. - "include": [ "./index.ts", "./components", "./lib", "./tools" ] + "include": [ + "./index.ts", + "./components", + "./lib", + "./tools", + "../scan/src/components/threats-data-views", + "../scan/src/components/threat-fixer-button" + ] } diff --git a/projects/js-packages/scan/package.json b/projects/js-packages/scan/package.json index 6ff31e11c9a4a..f51b33680abd9 100644 --- a/projects/js-packages/scan/package.json +++ b/projects/js-packages/scan/package.json @@ -48,10 +48,15 @@ "dependencies": { "@automattic/jetpack-api": "workspace:*", "@automattic/jetpack-base-styles": "workspace:*", + "@automattic/jetpack-components": "workspace:*", "@wordpress/api-fetch": "7.14.0", "@wordpress/element": "6.14.0", "@wordpress/i18n": "5.14.0", "@wordpress/url": "4.14.0", + "@wordpress/components": "29.0.0", + "@wordpress/dataviews": "4.10.0", + "@wordpress/date": "5.14.0", + "@wordpress/icons": "10.14.0", "debug": "4.4.0", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/projects/js-packages/scan/src/components/index.ts b/projects/js-packages/scan/src/components/index.ts new file mode 100644 index 0000000000000..4bf65fd62648d --- /dev/null +++ b/projects/js-packages/scan/src/components/index.ts @@ -0,0 +1,5 @@ +export { default as ScanReport } from './scan-report/index.js'; +export { default as ThreatFixerButton } from './threat-fixer-button/index.js'; +export { default as ThreatSeverityBadge } from './threat-severity-badge/index.js'; +export { default as ThreatModal } from './threat-modal/index.js'; +export { default as ThreatsDataViews } from './threats-data-views/index.js'; diff --git a/projects/js-packages/components/components/scan-report/constants.ts b/projects/js-packages/scan/src/components/scan-report/constants.ts similarity index 55% rename from projects/js-packages/components/components/scan-report/constants.ts rename to projects/js-packages/scan/src/components/scan-report/constants.ts index 6a10d008b876f..87ee14ac48196 100644 --- a/projects/js-packages/components/components/scan-report/constants.ts +++ b/projects/js-packages/scan/src/components/scan-report/constants.ts @@ -8,16 +8,16 @@ import { } from '@wordpress/icons'; export const STATUS_TYPES = [ - { value: 'checked', label: __( 'Checked', 'jetpack-components' ) }, - { value: 'unchecked', label: __( 'Unchecked', 'jetpack-components' ) }, - { value: 'threat', label: __( 'Threat', 'jetpack-components' ) }, + { value: 'checked', label: __( 'Checked', 'jetpack-scan' ) }, + { value: 'unchecked', label: __( 'Unchecked', 'jetpack-scan' ) }, + { value: 'threat', label: __( 'Threat', 'jetpack-scan' ) }, ]; export const TYPES = [ - { value: 'core', label: __( 'WordPress', 'jetpack-components' ) }, - { value: 'plugins', label: __( 'Plugin', 'jetpack-components' ) }, - { value: 'themes', label: __( 'Theme', 'jetpack-components' ) }, - { value: 'files', label: __( 'Files', 'jetpack-components' ) }, + { value: 'core', label: __( 'WordPress', 'jetpack-scan' ) }, + { value: 'plugins', label: __( 'Plugin', 'jetpack-scan' ) }, + { value: 'themes', label: __( 'Theme', 'jetpack-scan' ) }, + { value: 'files', label: __( 'Files', 'jetpack-scan' ) }, ]; export const ICONS = { diff --git a/projects/js-packages/components/components/scan-report/index.tsx b/projects/js-packages/scan/src/components/scan-report/index.tsx similarity index 91% rename from projects/js-packages/components/components/scan-report/index.tsx rename to projects/js-packages/scan/src/components/scan-report/index.tsx index 6eab2e6e24895..3889d8cf2ef65 100644 --- a/projects/js-packages/components/components/scan-report/index.tsx +++ b/projects/js-packages/scan/src/components/scan-report/index.tsx @@ -1,4 +1,4 @@ -import { type ScanReportExtension } from '@automattic/jetpack-scan'; +import { ShieldIcon } from '@automattic/jetpack-components'; import { Tooltip } from '@wordpress/components'; import { type SupportedLayouts, @@ -10,7 +10,7 @@ import { import { __, _n } from '@wordpress/i18n'; import { Icon } from '@wordpress/icons'; import { useCallback, useMemo, useState } from 'react'; -import ShieldIcon from '../shield-icon'; +import { type ScanReportExtension } from '@automattic/jetpack-scan'; import { FIELD_NAME, FIELD_VERSION, @@ -20,7 +20,7 @@ import { STATUS_TYPES, TYPES, ICONS, -} from './constants'; +} from './constants.js'; import styles from './styles.module.scss'; /** @@ -85,7 +85,7 @@ export default function ScanReport( { dataSource, data, onChangeSelection } ): J { id: FIELD_STATUS, elements: STATUS_TYPES, - label: __( 'Status', 'jetpack-components' ), + label: __( 'Status', 'jetpack-scan' ), enableHiding: false, getValue( { item } ) { if ( item.checked ) { @@ -101,7 +101,7 @@ export default function ScanReport( { dataSource, data, onChangeSelection } ): J let variant: 'info' | 'error' | 'success' = 'info'; let text = __( 'This item was added to your site after the most recent scan. We will check for threats during the next scheduled one.', - 'jetpack-components' + 'jetpack-scan' ); if ( item.checked ) { @@ -111,7 +111,7 @@ export default function ScanReport( { dataSource, data, onChangeSelection } ): J 'Vulnerability detected.', 'Vulnerabilities detected.', item.threats.length, - 'jetpack-components' + 'jetpack-scan' ); if ( scanApi ) { @@ -119,21 +119,18 @@ export default function ScanReport( { dataSource, data, onChangeSelection } ): J 'Threat detected.', 'Threats detected.', item.threats.length, - 'jetpack-components' + 'jetpack-scan' ); } } else { variant = 'success'; text = __( 'No known vulnerabilities found that affect this version.', - 'jetpack-components' + 'jetpack-scan' ); if ( scanApi ) { - text = __( - 'No known threats found that affect this version.', - 'jetpack-components' - ); + text = __( 'No known threats found that affect this version.', 'jetpack-scan' ); } } } @@ -149,13 +146,13 @@ export default function ScanReport( { dataSource, data, onChangeSelection } ): J }, { id: FIELD_TYPE, - label: __( 'Type', 'jetpack-components' ), + label: __( 'Type', 'jetpack-scan' ), elements: TYPES, enableHiding: false, }, { id: FIELD_NAME, - label: __( 'Name', 'jetpack-components' ), + label: __( 'Name', 'jetpack-scan' ), enableHiding: false, enableGlobalSearch: true, getValue( { item }: { item: ScanReportExtension } ) { @@ -164,7 +161,7 @@ export default function ScanReport( { dataSource, data, onChangeSelection } ): J }, { id: FIELD_VERSION, - label: __( 'Version', 'jetpack-components' ), + label: __( 'Version', 'jetpack-scan' ), enableHiding: false, enableSorting: false, enableGlobalSearch: true, @@ -176,7 +173,7 @@ export default function ScanReport( { dataSource, data, onChangeSelection } ): J ? [ { id: FIELD_ICON, - label: __( 'Icon', 'jetpack-components' ), + label: __( 'Icon', 'jetpack-scan' ), enableSorting: false, enableHiding: false, getValue( { item }: { item: ScanReportExtension } ) { diff --git a/projects/js-packages/components/components/scan-report/stories/index.stories.tsx b/projects/js-packages/scan/src/components/scan-report/stories/index.stories.tsx similarity index 97% rename from projects/js-packages/components/components/scan-report/stories/index.stories.tsx rename to projects/js-packages/scan/src/components/scan-report/stories/index.stories.tsx index eebcbc428fb39..090d2e902f441 100644 --- a/projects/js-packages/components/components/scan-report/stories/index.stories.tsx +++ b/projects/js-packages/scan/src/components/scan-report/stories/index.stories.tsx @@ -1,4 +1,4 @@ -import ScanReport from '..'; +import ScanReport from '../index.js'; export default { title: 'JS Packages/Components/Scan Report', diff --git a/projects/js-packages/components/components/scan-report/styles.module.scss b/projects/js-packages/scan/src/components/scan-report/styles.module.scss similarity index 100% rename from projects/js-packages/components/components/scan-report/styles.module.scss rename to projects/js-packages/scan/src/components/scan-report/styles.module.scss diff --git a/projects/js-packages/components/components/threat-fixer-button/index.tsx b/projects/js-packages/scan/src/components/threat-fixer-button/index.tsx similarity index 93% rename from projects/js-packages/components/components/threat-fixer-button/index.tsx rename to projects/js-packages/scan/src/components/threat-fixer-button/index.tsx index 80bd145a2870f..ed67d33200b9f 100644 --- a/projects/js-packages/components/components/threat-fixer-button/index.tsx +++ b/projects/js-packages/scan/src/components/threat-fixer-button/index.tsx @@ -1,13 +1,13 @@ +import { Button } from '@automattic/jetpack-components'; +import { Tooltip } from '@wordpress/components'; +import { useCallback, useMemo } from '@wordpress/element'; +import { __ } from '@wordpress/i18n'; import { type Threat, getFixerState, getFixerAction, getFixerDescription, } from '@automattic/jetpack-scan'; -import { Tooltip } from '@wordpress/components'; -import { useCallback, useMemo } from '@wordpress/element'; -import { __ } from '@wordpress/i18n'; -import { Button } from '@automattic/jetpack-components'; import styles from './styles.module.scss'; /** @@ -39,15 +39,15 @@ export default function ThreatFixerButton( { } if ( fixerState.error ) { - return __( 'An error occurred auto-fixing this threat.', 'jetpack-components' ); + return __( 'An error occurred auto-fixing this threat.', 'jetpack-scan' ); } if ( fixerState.stale ) { - return __( 'The auto-fixer is taking longer than expected.', 'jetpack-components' ); + return __( 'The auto-fixer is taking longer than expected.', 'jetpack-scan' ); } if ( fixerState.inProgress ) { - return __( 'An auto-fixer is in progress.', 'jetpack-components' ); + return __( 'An auto-fixer is in progress.', 'jetpack-scan' ); } return getFixerDescription( threat ); @@ -59,7 +59,7 @@ export default function ThreatFixerButton( { } if ( fixerState.error ) { - return __( 'Error', 'jetpack-components' ); + return __( 'Error', 'jetpack-scan' ); } return getFixerAction( threat ); diff --git a/projects/js-packages/components/components/threat-fixer-button/stories/index.stories.tsx b/projects/js-packages/scan/src/components/threat-fixer-button/stories/index.stories.tsx similarity index 100% rename from projects/js-packages/components/components/threat-fixer-button/stories/index.stories.tsx rename to projects/js-packages/scan/src/components/threat-fixer-button/stories/index.stories.tsx diff --git a/projects/js-packages/components/components/threat-fixer-button/styles.module.scss b/projects/js-packages/scan/src/components/threat-fixer-button/styles.module.scss similarity index 100% rename from projects/js-packages/components/components/threat-fixer-button/styles.module.scss rename to projects/js-packages/scan/src/components/threat-fixer-button/styles.module.scss diff --git a/projects/js-packages/components/components/threat-modal/fixer-state-notice.tsx b/projects/js-packages/scan/src/components/threat-modal/fixer-state-notice.tsx similarity index 89% rename from projects/js-packages/components/components/threat-modal/fixer-state-notice.tsx rename to projects/js-packages/scan/src/components/threat-modal/fixer-state-notice.tsx index 861095cf0c363..6edb9f0efb32a 100644 --- a/projects/js-packages/components/components/threat-modal/fixer-state-notice.tsx +++ b/projects/js-packages/scan/src/components/threat-modal/fixer-state-notice.tsx @@ -1,10 +1,10 @@ -import { CONTACT_SUPPORT_URL } from '@automattic/jetpack-scan'; +import { Button } from '@automattic/jetpack-components'; import { createInterpolateElement } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { useMemo } from 'react'; -import { Button } from '@automattic/jetpack-components'; +import { CONTACT_SUPPORT_URL } from '@automattic/jetpack-scan'; import styles from './styles.module.scss'; -import ThreatNotice from './threat-notice'; +import ThreatNotice from './threat-notice.js'; /** * FixerStateNotice component @@ -24,7 +24,7 @@ const FixerStateNotice = ( { } ) => { const getInterpolatedContent = (): JSX.Element => { return createInterpolateElement( - __( 'Please try again or contact support.', 'jetpack-components' ), + __( 'Please try again or contact support.', 'jetpack-scan' ), { supportLink: ) } { threat.status === 'current' && ( @@ -72,7 +72,7 @@ const ThreatActions = (): JSX.Element => { onClick={ onIgnoreClick } disabled={ disabled || ( fixerState.inProgress && ! fixerState.stale ) } > - { __( 'Ignore threat', 'jetpack-components' ) } + { __( 'Ignore threat', 'jetpack-scan' ) } ) } { threat.fixable && [ 'all', 'fix' ].includes( actionToConfirm ) && ( @@ -82,7 +82,7 @@ const ThreatActions = (): JSX.Element => { onClick={ onFixClick } > { fixerState.error || fixerState.stale - ? __( 'Retry fixer', 'jetpack-components' ) + ? __( 'Retry fixer', 'jetpack-scan' ) : detailedFixerAction } ) } diff --git a/projects/js-packages/components/components/threat-modal/threat-fix-confirmation.tsx b/projects/js-packages/scan/src/components/threat-modal/threat-fix-confirmation.tsx similarity index 69% rename from projects/js-packages/components/components/threat-modal/threat-fix-confirmation.tsx rename to projects/js-packages/scan/src/components/threat-modal/threat-fix-confirmation.tsx index 630701a351335..807bb99914f5d 100644 --- a/projects/js-packages/components/components/threat-modal/threat-fix-confirmation.tsx +++ b/projects/js-packages/scan/src/components/threat-modal/threat-fix-confirmation.tsx @@ -1,13 +1,13 @@ +import { ContextualUpgradeTrigger } from '@automattic/jetpack-components'; import { __ } from '@wordpress/i18n'; import { useContext } from 'react'; -import ContextualUpgradeTrigger from '../contextual-upgrade-trigger'; -import ThreatActions from './threat-actions'; -import ThreatFixDetails from './threat-fix-details'; -import ThreatIgnoreDetails from './threat-ignore-details'; -import ThreatNotice from './threat-notice'; -import ThreatSummary from './threat-summary'; -import ThreatTechnicalDetails from './threat-technical-details'; -import { ThreatModalContext } from '.'; +import ThreatActions from './threat-actions.js'; +import ThreatFixDetails from './threat-fix-details.js'; +import ThreatIgnoreDetails from './threat-ignore-details.js'; +import ThreatNotice from './threat-notice.js'; +import ThreatSummary from './threat-summary.js'; +import ThreatTechnicalDetails from './threat-technical-details.js'; +import { ThreatModalContext } from './index.js'; /** * ThreatFixConfirmation component @@ -28,25 +28,25 @@ const ThreatFixConfirmation = () => { title={ 'Additional connections needed' } content={ __( 'A user connection and server credentials provide Jetpack the access necessary to ignore and auto-fix threats on your site.', - 'jetpack-components' + 'jetpack-scan' ) } /> ) } { ! siteCredentialsNeeded && userConnectionNeeded && ( ) } { siteCredentialsNeeded && ! userConnectionNeeded && ( ) } @@ -54,9 +54,9 @@ const ThreatFixConfirmation = () => { ) } diff --git a/projects/js-packages/components/components/threat-modal/threat-fix-details.tsx b/projects/js-packages/scan/src/components/threat-modal/threat-fix-details.tsx similarity index 83% rename from projects/js-packages/components/components/threat-modal/threat-fix-details.tsx rename to projects/js-packages/scan/src/components/threat-modal/threat-fix-details.tsx index 8577331e341b2..ac6819d5cd8ad 100644 --- a/projects/js-packages/components/components/threat-modal/threat-fix-details.tsx +++ b/projects/js-packages/scan/src/components/threat-modal/threat-fix-details.tsx @@ -1,9 +1,9 @@ -import { getFixerDescription } from '@automattic/jetpack-scan'; +import { Text } from '@automattic/jetpack-components'; import { __, sprintf } from '@wordpress/i18n'; import React, { useMemo, useContext } from 'react'; -import Text from '../text'; +import { getFixerDescription } from '@automattic/jetpack-scan'; import styles from './styles.module.scss'; -import { ThreatModalContext } from '.'; +import { ThreatModalContext } from './index.js'; /** * ThreatFixDetails component @@ -15,12 +15,12 @@ const ThreatFixDetails = (): JSX.Element => { const title = useMemo( () => { if ( threat.status === 'fixed' ) { - return __( 'How did Jetpack fix it?', 'jetpack-components' ); + return __( 'How did Jetpack fix it?', 'jetpack-scan' ); } if ( threat.status === 'current' && threat.fixable ) { - return __( 'How can Jetpack auto-fix this threat?', 'jetpack-components' ); + return __( 'How can Jetpack auto-fix this threat?', 'jetpack-scan' ); } - return __( 'How to fix it?', 'jetpack-components' ); + return __( 'How to fix it?', 'jetpack-scan' ); }, [ threat ] ); const fix = useMemo( () => { @@ -29,7 +29,7 @@ const ThreatFixDetails = (): JSX.Element => { if ( ! threat.fixable && threat.fixedIn ) { return sprintf( /* translators: Translates to Updates to version. %1$s: Name. %2$s: Fixed version */ - __( 'Update %1$s to version %2$s.', 'jetpack-components' ), + __( 'Update %1$s to version %2$s.', 'jetpack-scan' ), threat.extension.name, threat.fixedIn ); diff --git a/projects/js-packages/components/components/threat-modal/threat-ignore-details.tsx b/projects/js-packages/scan/src/components/threat-modal/threat-ignore-details.tsx similarity index 92% rename from projects/js-packages/components/components/threat-modal/threat-ignore-details.tsx rename to projects/js-packages/scan/src/components/threat-modal/threat-ignore-details.tsx index 85f2d730f9fc3..318aa1ee69fe6 100644 --- a/projects/js-packages/components/components/threat-modal/threat-ignore-details.tsx +++ b/projects/js-packages/scan/src/components/threat-modal/threat-ignore-details.tsx @@ -1,9 +1,9 @@ +import { Text, Button, getRedirectUrl } from '@automattic/jetpack-components'; import { createInterpolateElement } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { useContext } from 'react'; -import { Text, Button, getRedirectUrl } from '@automattic/jetpack-components'; import styles from './styles.module.scss'; -import { ThreatModalContext } from '.'; +import { ThreatModalContext } from './index.js'; const ThreatIgnoreDetails = () => { const { threat, isSupportedEnvironment } = useContext( ThreatModalContext ); @@ -17,18 +17,18 @@ const ThreatIgnoreDetails = () => { return (
- { __( 'Do you really want to ignore this threat?', 'jetpack-components' ) } + { __( 'Do you really want to ignore this threat?', 'jetpack-scan' ) } { __( 'By choosing to ignore this threat, you acknowledge that you have reviewed the detected code. You are accepting the risks of maintaining a potentially malicious or vulnerable file on your site.', - 'jetpack-components' + 'jetpack-scan' ) }{ ' ' } { isSupportedEnvironment && createInterpolateElement( __( 'If you are unsure, please request an estimate with Codeable.', - 'jetpack-components' + 'jetpack-scan' ), { codeableLink: ) } { siteCredentialsNeeded && ( @@ -80,7 +80,7 @@ const ThreatNotice = ( { href={ credentialsRedirectUrl } isLoading={ credentialsIsFetching } > - { __( 'Enter server credentials', 'jetpack-components' ) } + { __( 'Enter server credentials', 'jetpack-scan' ) } ) }
diff --git a/projects/js-packages/components/components/threat-modal/threat-summary.tsx b/projects/js-packages/scan/src/components/threat-modal/threat-summary.tsx similarity index 82% rename from projects/js-packages/components/components/threat-modal/threat-summary.tsx rename to projects/js-packages/scan/src/components/threat-modal/threat-summary.tsx index 7cef33fa9c7af..ed106ffbe681b 100644 --- a/projects/js-packages/components/components/threat-modal/threat-summary.tsx +++ b/projects/js-packages/scan/src/components/threat-modal/threat-summary.tsx @@ -1,9 +1,8 @@ +import { Button, Text } from '@automattic/jetpack-components'; import { __ } from '@wordpress/i18n'; import { useContext } from 'react'; -import { Button } from '@automattic/jetpack-components'; -import Text from '../text'; import styles from './styles.module.scss'; -import { ThreatModalContext } from '.'; +import { ThreatModalContext } from './index.js'; /** * ThreatSummary component @@ -19,7 +18,7 @@ const ThreatSummary = (): JSX.Element => { { !! threat.source && (
) } diff --git a/projects/js-packages/components/components/threat-modal/threat-technical-details.tsx b/projects/js-packages/scan/src/components/threat-modal/threat-technical-details.tsx similarity index 83% rename from projects/js-packages/components/components/threat-modal/threat-technical-details.tsx rename to projects/js-packages/scan/src/components/threat-modal/threat-technical-details.tsx index e2b7c5caa70eb..6c7a8503f161d 100644 --- a/projects/js-packages/components/components/threat-modal/threat-technical-details.tsx +++ b/projects/js-packages/scan/src/components/threat-modal/threat-technical-details.tsx @@ -1,11 +1,9 @@ +import { Text, Button, DiffViewer, MarkedLines } from '@automattic/jetpack-components'; import { __ } from '@wordpress/i18n'; import { chevronDown, chevronUp, Icon } from '@wordpress/icons'; import { useState, useCallback, useContext } from 'react'; -import { Text, Button } from '@automattic/jetpack-components'; -import DiffViewer from '../diff-viewer'; -import MarkedLines from '../marked-lines'; import styles from './styles.module.scss'; -import { ThreatModalContext } from '.'; +import { ThreatModalContext } from './index.js'; /** * ThreatTechnicalDetails component @@ -17,9 +15,9 @@ const ThreatTechnicalDetails = (): JSX.Element => { const [ open, setOpen ] = useState( false ); - let toggleContent = __( 'Show the technical details', 'jetpack-components' ); + let toggleContent = __( 'Show the technical details', 'jetpack-scan' ); if ( open ) { - toggleContent = __( 'Hide the technical details', 'jetpack-components' ); + toggleContent = __( 'Hide the technical details', 'jetpack-scan' ); } const toggleOpen = useCallback( () => { @@ -55,7 +53,7 @@ const ThreatTechnicalDetails = (): JSX.Element => { > { threat.filename && ( <> - { __( 'Threat found in file:', 'jetpack-components' ) } + { __( 'Threat found in file:', 'jetpack-scan' ) }
{ threat.filename }
) } diff --git a/projects/js-packages/components/components/threat-severity-badge/index.tsx b/projects/js-packages/scan/src/components/threat-severity-badge/index.tsx similarity index 68% rename from projects/js-packages/components/components/threat-severity-badge/index.tsx rename to projects/js-packages/scan/src/components/threat-severity-badge/index.tsx index 8aecc3ce49242..3865d3b13a46c 100644 --- a/projects/js-packages/components/components/threat-severity-badge/index.tsx +++ b/projects/js-packages/scan/src/components/threat-severity-badge/index.tsx @@ -1,11 +1,11 @@ +import { Badge } from '@automattic/jetpack-components'; import { _x } from '@wordpress/i18n'; -import Badge from '../badge'; const ThreatSeverityBadge = ( { severity } ) => { if ( severity >= 5 ) { return ( - { _x( 'Critical', 'Severity label for issues rated 5 or higher.', 'jetpack-components' ) } + { _x( 'Critical', 'Severity label for issues rated 5 or higher.', 'jetpack-scan' ) } ); } @@ -13,14 +13,12 @@ const ThreatSeverityBadge = ( { severity } ) => { if ( severity >= 3 && severity < 5 ) { return ( - { _x( 'High', 'Severity label for issues rated between 3 and 5.', 'jetpack-components' ) } + { _x( 'High', 'Severity label for issues rated between 3 and 5.', 'jetpack-scan' ) } ); } - return ( - { _x( 'Low', 'Severity label for issues rated below 3.', 'jetpack-components' ) } - ); + return { _x( 'Low', 'Severity label for issues rated below 3.', 'jetpack-scan' ) }; }; export default ThreatSeverityBadge; diff --git a/projects/js-packages/components/components/threat-severity-badge/stories/index.stories.tsx b/projects/js-packages/scan/src/components/threat-severity-badge/stories/index.stories.tsx similarity index 100% rename from projects/js-packages/components/components/threat-severity-badge/stories/index.stories.tsx rename to projects/js-packages/scan/src/components/threat-severity-badge/stories/index.stories.tsx diff --git a/projects/js-packages/components/components/threat-severity-badge/styles.module.scss b/projects/js-packages/scan/src/components/threat-severity-badge/styles.module.scss similarity index 100% rename from projects/js-packages/components/components/threat-severity-badge/styles.module.scss rename to projects/js-packages/scan/src/components/threat-severity-badge/styles.module.scss diff --git a/projects/js-packages/components/components/threat-severity-badge/test/index.test.tsx b/projects/js-packages/scan/src/components/threat-severity-badge/test/index.test.tsx similarity index 85% rename from projects/js-packages/components/components/threat-severity-badge/test/index.test.tsx rename to projects/js-packages/scan/src/components/threat-severity-badge/test/index.test.tsx index 6489511e21002..4381f95d35449 100644 --- a/projects/js-packages/components/components/threat-severity-badge/test/index.test.tsx +++ b/projects/js-packages/scan/src/components/threat-severity-badge/test/index.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import ThreatSeverityBadge from '..'; +import ThreatSeverityBadge from '../index.js'; describe( 'ThreatSeverityBadge', () => { it( 'renders the correct severity label', () => { diff --git a/projects/js-packages/components/components/threats-data-views/constants.ts b/projects/js-packages/scan/src/components/threats-data-views/constants.ts similarity index 77% rename from projects/js-packages/components/components/threats-data-views/constants.ts rename to projects/js-packages/scan/src/components/threats-data-views/constants.ts index 68112cc1d8717..37d487268ab9a 100644 --- a/projects/js-packages/components/components/threats-data-views/constants.ts +++ b/projects/js-packages/scan/src/components/threats-data-views/constants.ts @@ -8,16 +8,16 @@ import { } from '@wordpress/icons'; export const THREAT_STATUSES: { value: string; label: string; variant?: 'success' }[] = [ - { value: 'fixed', label: __( 'Fixed', 'jetpack-components' ), variant: 'success' }, - { value: 'ignored', label: __( 'Ignored', 'jetpack-components' ) }, + { value: 'fixed', label: __( 'Fixed', 'jetpack-scan' ), variant: 'success' }, + { value: 'ignored', label: __( 'Ignored', 'jetpack-scan' ) }, ]; export const THREAT_TYPES = [ - { value: 'plugins', label: __( 'Plugin', 'jetpack-components' ) }, - { value: 'themes', label: __( 'Theme', 'jetpack-components' ) }, - { value: 'core', label: __( 'WordPress', 'jetpack-components' ) }, - { value: 'file', label: __( 'File', 'jetpack-components' ) }, - { value: '', label: __( 'Unknown', 'jetpack-components' ) }, + { value: 'plugins', label: __( 'Plugin', 'jetpack-scan' ) }, + { value: 'themes', label: __( 'Theme', 'jetpack-scan' ) }, + { value: 'core', label: __( 'WordPress', 'jetpack-scan' ) }, + { value: 'file', label: __( 'File', 'jetpack-scan' ) }, + { value: '', label: __( 'Unknown', 'jetpack-scan' ) }, ]; export const THREAT_ICONS = { diff --git a/projects/js-packages/components/components/threats-data-views/index.tsx b/projects/js-packages/scan/src/components/threats-data-views/index.tsx similarity index 93% rename from projects/js-packages/components/components/threats-data-views/index.tsx rename to projects/js-packages/scan/src/components/threats-data-views/index.tsx index 71b385f0bc530..9b50173931c99 100644 --- a/projects/js-packages/components/components/threats-data-views/index.tsx +++ b/projects/js-packages/scan/src/components/threats-data-views/index.tsx @@ -1,4 +1,4 @@ -import { getFixerAction, getThreatType, type Threat } from '@automattic/jetpack-scan'; +import { Badge, useBreakpointMatch } from '@automattic/jetpack-components'; import { type Action, type Field, @@ -14,11 +14,10 @@ import { dateI18n } from '@wordpress/date'; import { __ } from '@wordpress/i18n'; import { Icon } from '@wordpress/icons'; import { useCallback, useMemo, useState } from 'react'; -import Badge from '../badge'; -import useBreakpointMatch from '../layout/use-breakpoint-match'; -import ThreatFixerButton from '../threat-fixer-button'; -import ThreatModal from '../threat-modal'; -import ThreatSeverityBadge from '../threat-severity-badge'; +import { getFixerAction, getThreatType, type Threat } from '@automattic/jetpack-scan'; +import ThreatFixerButton from '../threat-fixer-button/index.js'; +import ThreatModal from '../threat-modal/index.js'; +import ThreatSeverityBadge from '../threat-severity-badge/index.js'; import { CURRENT_TABLE_FIELDS, LIST_FIELDS, @@ -41,10 +40,10 @@ import { THREAT_ICONS, THREAT_STATUSES, THREAT_TYPES, -} from './constants'; +} from './constants.js'; import styles from './styles.module.scss'; -export { HISTORIC_TABLE_FIELDS } from './constants'; +export { HISTORIC_TABLE_FIELDS } from './constants.js'; /** * DataViews component for displaying security threats. @@ -272,7 +271,7 @@ export default function ThreatsDataViews( { const result: Field< Threat >[] = [ { id: THREAT_FIELD_TITLE, - label: __( 'Threat', 'jetpack-components' ), + label: __( 'Threat', 'jetpack-scan' ), enableGlobalSearch: true, enableHiding: false, render: ( { item }: { item: Threat } ) => ( @@ -281,7 +280,7 @@ export default function ThreatsDataViews( { }, { id: THREAT_FIELD_DESCRIPTION, - label: __( 'Description', 'jetpack-components' ), + label: __( 'Description', 'jetpack-scan' ), enableGlobalSearch: true, enableHiding: false, render: ( { item }: { item: Threat } ) => ( @@ -290,7 +289,7 @@ export default function ThreatsDataViews( { }, { id: THREAT_FIELD_ICON, - label: __( 'Icon', 'jetpack-components' ), + label: __( 'Icon', 'jetpack-scan' ), enableHiding: false, getValue( { item }: { item: Threat } ) { return getThreatType( item ); @@ -305,7 +304,7 @@ export default function ThreatsDataViews( { }, { id: THREAT_FIELD_TYPE, - label: __( 'Type', 'jetpack-components' ), + label: __( 'Type', 'jetpack-scan' ), elements: THREAT_TYPES, getValue( { item }: { item: Threat } ) { return getThreatType( item ) ?? ''; @@ -313,7 +312,7 @@ export default function ThreatsDataViews( { }, { id: THREAT_FIELD_EXTENSION, - label: __( 'Extension', 'jetpack-components' ), + label: __( 'Extension', 'jetpack-scan' ), enableGlobalSearch: true, enableHiding: true, getValue( { item }: { item: Threat } ) { @@ -325,7 +324,7 @@ export default function ThreatsDataViews( { }, { id: THREAT_FIELD_PLUGIN, - label: __( 'Plugin', 'jetpack-components' ), + label: __( 'Plugin', 'jetpack-scan' ), enableGlobalSearch: true, enableHiding: false, elements: plugins, @@ -335,7 +334,7 @@ export default function ThreatsDataViews( { }, { id: THREAT_FIELD_THEME, - label: __( 'Theme', 'jetpack-components' ), + label: __( 'Theme', 'jetpack-scan' ), enableGlobalSearch: true, enableHiding: false, elements: themes, @@ -347,7 +346,7 @@ export default function ThreatsDataViews( { ? [ { id: THREAT_FIELD_STATUS, - label: __( 'Status', 'jetpack-components' ), + label: __( 'Status', 'jetpack-scan' ), elements: THREAT_STATUSES, getValue( { item }: { item: Threat } ) { if ( ! item.status ) { @@ -367,7 +366,7 @@ export default function ThreatsDataViews( { return { threatStatus.label }; } } - return { __( 'Current', 'jetpack-components' ) }; + return { __( 'Current', 'jetpack-scan' ) }; }, }, ] @@ -376,7 +375,7 @@ export default function ThreatsDataViews( { ? [ { id: THREAT_FIELD_SEVERITY, - label: __( 'Severity', 'jetpack-components' ), + label: __( 'Severity', 'jetpack-scan' ), type: 'integer' as FieldType, getValue( { item }: { item: Threat } ) { return item.severity ?? 0; @@ -391,7 +390,7 @@ export default function ThreatsDataViews( { ? [ { id: THREAT_FIELD_SIGNATURE, - label: __( 'Signature', 'jetpack-components' ), + label: __( 'Signature', 'jetpack-scan' ), elements: signatures, enableGlobalSearch: true, getValue( { item }: { item: Threat } ) { @@ -404,7 +403,7 @@ export default function ThreatsDataViews( { ? [ { id: THREAT_FIELD_FIRST_DETECTED, - label: __( 'First Detected', 'jetpack-components' ), + label: __( 'First Detected', 'jetpack-scan' ), type: 'datetime' as FieldType, getValue( { item }: { item: Threat } ) { return item.firstDetected ? new Date( item.firstDetected ) : null; @@ -423,7 +422,7 @@ export default function ThreatsDataViews( { ? [ { id: THREAT_FIELD_FIXED_ON, - label: __( 'Fixed On', 'jetpack-components' ), + label: __( 'Fixed On', 'jetpack-scan' ), type: 'datetime' as FieldType, getValue( { item }: { item: Threat } ) { return item.fixedOn ? new Date( item.fixedOn ) : null; @@ -442,16 +441,16 @@ export default function ThreatsDataViews( { ? [ { id: THREAT_FIELD_AUTO_FIX, - label: __( 'Auto-fix', 'jetpack-components' ), + label: __( 'Auto-fix', 'jetpack-scan' ), enableHiding: false, elements: [ { value: 'yes', - label: __( 'Yes', 'jetpack-components' ), + label: __( 'Yes', 'jetpack-scan' ), }, { value: 'no', - label: __( 'No', 'jetpack-components' ), + label: __( 'No', 'jetpack-scan' ), }, ], getValue( { item }: { item: Threat } ) { @@ -511,7 +510,7 @@ export default function ThreatsDataViews( { if ( dataFields.includes( 'status' ) ) { result.push( { id: THREAT_ACTION_IGNORE, - label: __( 'Ignore', 'jetpack-components' ), + label: __( 'Ignore', 'jetpack-scan' ), callback: ( items: Threat[] ) => { showThreatModal( items[ 0 ], 'ignore' )(); }, @@ -530,7 +529,7 @@ export default function ThreatsDataViews( { if ( dataFields.includes( 'status' ) ) { result.push( { id: THREAT_ACTION_UNIGNORE, - label: __( 'Unignore', 'jetpack-components' ), + label: __( 'Unignore', 'jetpack-scan' ), callback: ( items: Threat[] ) => { showThreatModal( items[ 0 ], 'unignore' )(); }, diff --git a/projects/js-packages/components/components/threats-data-views/stories/data.tsx b/projects/js-packages/scan/src/components/threats-data-views/stories/data.tsx similarity index 100% rename from projects/js-packages/components/components/threats-data-views/stories/data.tsx rename to projects/js-packages/scan/src/components/threats-data-views/stories/data.tsx diff --git a/projects/js-packages/components/components/threats-data-views/stories/index.stories.tsx b/projects/js-packages/scan/src/components/threats-data-views/stories/index.stories.tsx similarity index 98% rename from projects/js-packages/components/components/threats-data-views/stories/index.stories.tsx rename to projects/js-packages/scan/src/components/threats-data-views/stories/index.stories.tsx index a79fdc8cb80f3..bb9a62662acb5 100644 --- a/projects/js-packages/components/components/threats-data-views/stories/index.stories.tsx +++ b/projects/js-packages/scan/src/components/threats-data-views/stories/index.stories.tsx @@ -1,6 +1,6 @@ -import ThreatsDataViews from '..'; -import { HISTORIC_TABLE_FIELDS } from '../constants'; -import { currentData, historicData } from './data'; +import { HISTORIC_TABLE_FIELDS } from '../constants.js'; +import ThreatsDataViews from '../index.js'; +import { currentData, historicData } from './data.js'; export default { title: 'JS Packages/Components/Threats Data Views', diff --git a/projects/js-packages/components/components/threats-data-views/styles.module.scss b/projects/js-packages/scan/src/components/threats-data-views/styles.module.scss similarity index 100% rename from projects/js-packages/components/components/threats-data-views/styles.module.scss rename to projects/js-packages/scan/src/components/threats-data-views/styles.module.scss diff --git a/projects/js-packages/components/components/threats-data-views/test/index.test.tsx b/projects/js-packages/scan/src/components/threats-data-views/test/index.test.tsx similarity index 98% rename from projects/js-packages/components/components/threats-data-views/test/index.test.tsx rename to projects/js-packages/scan/src/components/threats-data-views/test/index.test.tsx index 0757479d5c3a9..939cec0c5b7cb 100644 --- a/projects/js-packages/components/components/threats-data-views/test/index.test.tsx +++ b/projects/js-packages/scan/src/components/threats-data-views/test/index.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import ThreatsDataViews from '..'; +import ThreatsDataViews from '../index.js'; const data = [ // Scan API Data diff --git a/projects/js-packages/scan/src/index.ts b/projects/js-packages/scan/src/index.ts index 8009266228a9b..e63d2df138532 100644 --- a/projects/js-packages/scan/src/index.ts +++ b/projects/js-packages/scan/src/index.ts @@ -1,3 +1,4 @@ export * from './types/index.js'; +export * from './components/index.js'; export * from './constants/index.js'; export * from './utils/index.js'; diff --git a/projects/js-packages/scan/tsconfig.json b/projects/js-packages/scan/tsconfig.json index 1b20140ac7477..8004fedb6d6ae 100644 --- a/projects/js-packages/scan/tsconfig.json +++ b/projects/js-packages/scan/tsconfig.json @@ -4,6 +4,7 @@ "compilerOptions": { "typeRoots": [ "./node_modules/@types/", "src/*" ], "sourceMap": false, - "outDir": "./build/" + "outDir": "./build/", + "target": "ES2019" } } diff --git a/projects/plugins/protect/src/js/components/ignore-threat-modal/index.jsx b/projects/plugins/protect/src/js/components/ignore-threat-modal/index.jsx index 1d6f4457b39a4..9e978ebe1300f 100644 --- a/projects/plugins/protect/src/js/components/ignore-threat-modal/index.jsx +++ b/projects/plugins/protect/src/js/components/ignore-threat-modal/index.jsx @@ -1,5 +1,5 @@ -import { Button, getRedirectUrl, Text, ThreatSeverityBadge } from '@automattic/jetpack-components'; -import { getThreatIcon, getThreatSubtitle } from '@automattic/jetpack-scan'; +import { Button, getRedirectUrl, Text } from '@automattic/jetpack-components'; +import { getThreatIcon, getThreatSubtitle, ThreatSeverityBadge } from '@automattic/jetpack-scan'; import { Icon } from '@wordpress/components'; import { createInterpolateElement, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; diff --git a/projects/plugins/protect/src/js/components/threat-fix-header/index.jsx b/projects/plugins/protect/src/js/components/threat-fix-header/index.jsx index 45a8524e60b59..48582fa421fb2 100644 --- a/projects/plugins/protect/src/js/components/threat-fix-header/index.jsx +++ b/projects/plugins/protect/src/js/components/threat-fix-header/index.jsx @@ -1,5 +1,5 @@ -import { Text, ThreatSeverityBadge } from '@automattic/jetpack-components'; -import { getThreatIcon, getThreatSubtitle } from '@automattic/jetpack-scan'; +import { Text } from '@automattic/jetpack-components'; +import { getThreatIcon, getThreatSubtitle, ThreatSeverityBadge } from '@automattic/jetpack-scan'; import { Icon } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; import React, { useState, useCallback } from 'react'; diff --git a/projects/plugins/protect/src/js/components/unignore-threat-modal/index.jsx b/projects/plugins/protect/src/js/components/unignore-threat-modal/index.jsx index 7f1ef3652bb85..4fbf9c01a943a 100644 --- a/projects/plugins/protect/src/js/components/unignore-threat-modal/index.jsx +++ b/projects/plugins/protect/src/js/components/unignore-threat-modal/index.jsx @@ -1,5 +1,5 @@ -import { Button, Text, ThreatSeverityBadge } from '@automattic/jetpack-components'; -import { getThreatIcon, getThreatSubtitle } from '@automattic/jetpack-scan'; +import { Button, Text } from '@automattic/jetpack-components'; +import { getThreatIcon, getThreatSubtitle, ThreatSeverityBadge } from '@automattic/jetpack-scan'; import { __ } from '@wordpress/i18n'; import { Icon } from '@wordpress/icons'; import { useState } from 'react'; diff --git a/projects/plugins/protect/src/js/routes/home/index.jsx b/projects/plugins/protect/src/js/routes/home/index.jsx index 26dd89df95c8e..af8271b3b889d 100644 --- a/projects/plugins/protect/src/js/routes/home/index.jsx +++ b/projects/plugins/protect/src/js/routes/home/index.jsx @@ -1,4 +1,5 @@ -import { AdminSection, Container, Col, ScanReport } from '@automattic/jetpack-components'; +import { AdminSection, Container, Col } from '@automattic/jetpack-components'; +import { ScanReport } from '@automattic/jetpack-scan'; import { useMemo } from 'react'; import AdminPage from '../../components/admin-page'; import { SCAN_IN_PROGRESS_STATUSES } from '../../constants'; diff --git a/projects/plugins/protect/src/js/routes/scan/scan-data-views.tsx b/projects/plugins/protect/src/js/routes/scan/scan-data-views.tsx index 547f526cda10a..2c90b177f6efd 100644 --- a/projects/plugins/protect/src/js/routes/scan/scan-data-views.tsx +++ b/projects/plugins/protect/src/js/routes/scan/scan-data-views.tsx @@ -1,6 +1,6 @@ -import { ThreatsDataViews, getRedirectUrl } from '@automattic/jetpack-components'; +import { getRedirectUrl } from '@automattic/jetpack-components'; import { useConnection } from '@automattic/jetpack-connection'; -import { type Threat } from '@automattic/jetpack-scan'; +import { type Threat, ThreatsDataViews } from '@automattic/jetpack-scan'; import { useQueryClient } from '@tanstack/react-query'; import { useCallback, useEffect, useState } from 'react'; import { QUERY_CREDENTIALS_KEY } from '../../constants'; diff --git a/projects/plugins/protect/src/js/routes/scan/scan-results-data-views.tsx b/projects/plugins/protect/src/js/routes/scan/scan-results-data-views.tsx index 587f1131a74ea..526a88566b1cd 100644 --- a/projects/plugins/protect/src/js/routes/scan/scan-results-data-views.tsx +++ b/projects/plugins/protect/src/js/routes/scan/scan-results-data-views.tsx @@ -1,5 +1,4 @@ -import { ThreatsDataViews } from '@automattic/jetpack-components'; -import { type Threat } from '@automattic/jetpack-scan'; +import { type Threat, ThreatsDataViews } from '@automattic/jetpack-scan'; import { useCallback } from 'react'; import useScanStatusQuery from '../../data/scan/use-scan-status-query'; import useModal from '../../hooks/use-modal';