Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Move threat components from jetpack-components to jetpack-scan
changelog

changelog

Update changelog

Update changelog

changelog
  • Loading branch information
nateweller committed Mar 24, 2025
commit a80157f8dab5e60ea2fdaf06cde1f2fb7400170e
123 changes: 99 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: major
Copy link
Contributor Author

@nateweller nateweller Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using "major" here as we are removing components. Is this correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is! Thanks!

Type: removed

Removed threat components
4 changes: 1 addition & 3 deletions projects/js-packages/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ export { default as CopyToClipboard } from './components/copy-to-clipboard/index
export * from './components/icons/index.js';
export { default as SplitButton } from './components/split-button/index.js';
export { default as ThemeProvider } from './components/theme-provider/index.js';
export { default as ThreatFixerButton } from './components/threat-fixer-button/index.js';
export { default as ThreatSeverityBadge } from './components/threat-severity-badge/index.js';
export { default as ThreatsDataViews } from './components/threats-data-views/index.js';
export { default as Text, H2, H3, Title } from './components/text/index.js';
export { default as ToggleControl } from './components/toggle-control/index.js';
export { default as NumberControl } from './components/number-control/index.js';
Expand All @@ -56,6 +53,7 @@ export { default as Button } from './components/button/index.js';
export type { ButtonProps } from './components/button/types.js';
export { default as LoadingPlaceholder } from './components/loading-placeholder/index.js';
export { default as TermsOfService } from './components/terms-of-service/index.js';
export { default as Badge } from './components/badge/index.js';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exporting Badge here so threat components can use it from their new home in the scan package.

export { default as Chip } from './components/chip/index.js';
export {
default as PricingTable,
Expand Down
20 changes: 9 additions & 11 deletions projects/js-packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@
"@automattic/format-currency": "1.0.1",
"@automattic/jetpack-boost-score-api": "workspace:*",
"@automattic/jetpack-api": "workspace:*",
"@automattic/jetpack-scan": "workspace:*",
"@automattic/jetpack-script-data": "workspace:*",
"@babel/runtime": "^7",
"@wordpress/browserslist-config": "6.19.0",
"@wordpress/components": "29.5.0",
"@wordpress/compose": "7.19.0",
"@wordpress/data": "10.19.0",
"@wordpress/dataviews": "4.15.0",
"@wordpress/date": "5.19.0",
"@wordpress/element": "6.19.0",
"@wordpress/i18n": "5.19.0",
"@wordpress/icons": "10.19.0",
"@wordpress/notices": "5.19.0",
"@wordpress/browserslist-config": "6.17.0",
"@wordpress/components": "29.3.0",
"@wordpress/compose": "7.17.0",
"@wordpress/data": "10.17.0",
"@wordpress/date": "5.17.0",
"@wordpress/element": "6.17.0",
"@wordpress/i18n": "5.17.0",
"@wordpress/icons": "10.17.0",
"@wordpress/notices": "5.17.0",
"clsx": "2.1.1",
"prop-types": "^15.7.2",
"qrcode.react": "4.2.0",
Expand Down
4 changes: 4 additions & 0 deletions projects/js-packages/scan/changelog/migrate-components-scan
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Added threat components
5 changes: 5 additions & 0 deletions projects/js-packages/scan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
"@wordpress/element": "6.19.0",
"@wordpress/i18n": "5.19.0",
"@wordpress/url": "4.19.0",
"@automattic/jetpack-components": "workspace:*",
"@wordpress/components": "29.3.0",
"@wordpress/dataviews": "4.13.0",
"@wordpress/date": "5.17.0",
"@wordpress/icons": "10.17.0",
"debug": "4.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 4 additions & 0 deletions projects/js-packages/scan/src/components/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default as ThreatFixerButton } from './threat-fixer-button/index.js';
export { default as ThreatModal } from './threat-modal/index.js';
export { default as ThreatSeverityBadge } from './threat-severity-badge/index.js';
export { default as ThreatsDataViews } from './threats-data-views/index.js';
Original file line number Diff line number Diff line change
@@ -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';

/**
Expand Down Expand Up @@ -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 );
Expand All @@ -59,7 +59,7 @@ export default function ThreatFixerButton( {
}

if ( fixerState.error ) {
return __( 'Error', 'jetpack-components' );
return __( 'Error', 'jetpack-scan' );
}

return getFixerAction( threat );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,30 @@ const FixerStateNotice = ( {
if ( fixerState.error ) {
return {
status: 'error' as const,
title: __( 'An error occurred auto-fixing this threat', 'jetpack-components' ),
title: __( 'An error occurred auto-fixing this threat', 'jetpack-scan' ),
content: __(
'Jetpack encountered a filesystem error while attempting to auto-fix this threat. Please try again later or contact support.',
'jetpack-components'
'jetpack-scan'
),
};
}

if ( fixerState.stale ) {
return {
status: 'error' as const,
title: __( 'The auto-fixer is taking longer than expected', 'jetpack-components' ),
title: __( 'The auto-fixer is taking longer than expected', 'jetpack-scan' ),
content: __(
'Jetpack has been attempting to auto-fix this threat for too long, and something may have gone wrong. Please try again later or contact support.',
'jetpack-components'
'jetpack-scan'
),
};
}

if ( fixerState.inProgress ) {
return {
status: 'success' as const,
title: __( 'An auto-fixer is in progress', 'jetpack-components' ),
content: __( 'Please wait while Jetpack auto-fixes the threat.', 'jetpack-components' ),
title: __( 'An auto-fixer is in progress', 'jetpack-scan' ),
content: __( 'Please wait while Jetpack auto-fixes the threat.', 'jetpack-scan' ),
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Threat } from '@automattic/jetpack-scan';
import { Text } from '@automattic/jetpack-components';
import { Modal } from '@wordpress/components';
import { createContext } from 'react';
import Text from '../text/index.js';
import { type Threat } from '@automattic/jetpack-scan';
import ThreatSeverityBadge from '../threat-severity-badge/index.js';
import styles from './styles.module.scss';
import ThreatFixConfirmation from './threat-fix-confirmation.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button } from '@automattic/jetpack-components';
import { useCallback, useState } from 'react';
import Button from '../../button/index.js';
import ThreatModal from '../index.js';

export default {
Expand Down
Loading