@automattic/jetpack-scan 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/build/components/index.d.ts +4 -4
- package/build/components/index.js +4 -4
- package/build/components/threat-fixer-button/index.d.ts +1 -1
- package/build/components/threat-modal/fixer-state-notice.js +1 -1
- package/build/components/threat-modal/index.js +4 -3
- package/build/components/threat-modal/threat-actions.js +8 -5
- package/build/components/threat-modal/threat-fix-confirmation.js +10 -8
- package/build/components/threat-modal/threat-fix-details.js +3 -2
- package/build/components/threat-modal/threat-notice.d.ts +1 -1
- package/build/components/threat-modal/threat-notice.js +5 -2
- package/build/components/threat-modal/threat-summary.js +1 -1
- package/build/components/threat-modal/threat-technical-details.js +9 -4
- package/build/components/threat-severity-badge/test/index.test.js +1 -1
- package/build/components/threats-data-views/index.d.ts +1 -1
- package/build/components/threats-data-views/index.js +3 -3
- package/build/components/threats-data-views/test/index.test.js +1 -1
- package/build/components/threats-data-views/threats-status-toggle-group-control.d.ts +1 -1
- package/build/components/threats-data-views/threats-status-toggle-group-control.js +4 -2
- package/build/index.js +3 -3
- package/build/types/index.js +3 -3
- package/build/utils/index.d.ts +3 -3
- package/build/utils/index.js +1 -1
- package/package.json +23 -22
- package/src/components/threats-data-views/styles.module.scss +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.3.0] - 2026-04-11
|
|
9
|
+
### Changed
|
|
10
|
+
- Set `.repository.url` in `package.json` to the mirror repo rather than the monorepo. Required for enabling provenance. [#47149]
|
|
11
|
+
- Switch to Native TypeScript compiler based on Go. [#47375]
|
|
12
|
+
- Update DataViews dependency. [#46973]
|
|
13
|
+
- Update dependencies. [#47038] [#47472]
|
|
14
|
+
- Update package dependencies. [#47285] [#47300] [#47309] [#47684] [#47719] [#47799] [#47870] [#47890]
|
|
15
|
+
|
|
8
16
|
## [1.2.2] - 2026-02-04
|
|
9
17
|
### Changed
|
|
10
18
|
- Update package dependencies. [#45914] [#46143] [#46244] [#46362] [#46363] [#46430] [#46456] [#46647] [#46853] [#46854] [#46905]
|
|
@@ -167,6 +175,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
167
175
|
### Removed
|
|
168
176
|
- Updated dependencies. [#39754]
|
|
169
177
|
|
|
178
|
+
[1.3.0]: https://github.com/Automattic/jetpack-scan/compare/v1.2.2...v1.3.0
|
|
170
179
|
[1.2.2]: https://github.com/Automattic/jetpack-scan/compare/v1.2.1...v1.2.2
|
|
171
180
|
[1.2.1]: https://github.com/Automattic/jetpack-scan/compare/v1.2.0...v1.2.1
|
|
172
181
|
[1.2.0]: https://github.com/Automattic/jetpack-scan/compare/v1.1.0...v1.2.0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as ThreatFixerButton } from
|
|
2
|
-
export { default as ThreatModal } from
|
|
3
|
-
export { default as ThreatSeverityBadge } from
|
|
4
|
-
export { default as ThreatsDataViews } from
|
|
1
|
+
export { default as ThreatFixerButton } from './threat-fixer-button/index.tsx';
|
|
2
|
+
export { default as ThreatModal } from './threat-modal/index.tsx';
|
|
3
|
+
export { default as ThreatSeverityBadge } from './threat-severity-badge/index.tsx';
|
|
4
|
+
export { default as ThreatsDataViews } from './threats-data-views/index.tsx';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as ThreatFixerButton } from
|
|
2
|
-
export { default as ThreatModal } from
|
|
3
|
-
export { default as ThreatSeverityBadge } from
|
|
4
|
-
export { default as ThreatsDataViews } from
|
|
1
|
+
export { default as ThreatFixerButton } from './threat-fixer-button/index.js';
|
|
2
|
+
export { default as ThreatModal } from './threat-modal/index.js';
|
|
3
|
+
export { default as ThreatSeverityBadge } from './threat-severity-badge/index.js';
|
|
4
|
+
export { default as ThreatsDataViews } from './threats-data-views/index.js';
|
|
@@ -9,7 +9,7 @@ import { type Threat } from '@automattic/jetpack-scan';
|
|
|
9
9
|
*
|
|
10
10
|
* @return {JSX.Element} The component.
|
|
11
11
|
*/
|
|
12
|
-
export default function ThreatFixerButton({ threat, className, onClick
|
|
12
|
+
export default function ThreatFixerButton({ threat, className, onClick }: {
|
|
13
13
|
threat: Threat;
|
|
14
14
|
onClick: (items: Threat[]) => void;
|
|
15
15
|
className?: string;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import styles from './styles.module.scss';
|
|
5
|
-
import ThreatNotice from
|
|
5
|
+
import ThreatNotice from './threat-notice.js';
|
|
6
6
|
/**
|
|
7
7
|
* FixerStateNotice component
|
|
8
8
|
*
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Text } from '@automattic/jetpack-components';
|
|
3
3
|
import { Modal } from '@wordpress/components';
|
|
4
4
|
import { createContext } from 'react';
|
|
5
|
-
import ThreatSeverityBadge from
|
|
5
|
+
import ThreatSeverityBadge from '../threat-severity-badge/index.js';
|
|
6
6
|
import styles from './styles.module.scss';
|
|
7
|
-
import ThreatFixConfirmation from
|
|
7
|
+
import ThreatFixConfirmation from './threat-fix-confirmation.js';
|
|
8
8
|
export const ThreatModalContext = createContext(null);
|
|
9
9
|
/**
|
|
10
10
|
* ThreatModal component
|
|
@@ -30,7 +30,8 @@ export default function ThreatModal({ threat, isUserConnected, hasConnectedOwner
|
|
|
30
30
|
const siteCredentialsNeeded = !credentials || credentials.length === 0;
|
|
31
31
|
// Cast title to string
|
|
32
32
|
// TODO: This should not be done. If needed, we should render the modal with hideHeader={true} and then use our own header inside.
|
|
33
|
-
const modalTitle = (_jsxs("div", { className: styles.title, children: [
|
|
33
|
+
const modalTitle = (_jsxs("div", { className: styles.title, children: [
|
|
34
|
+
_jsx(Text, { variant: "title-small", children: threat.title }), !!threat.severity && _jsx(ThreatSeverityBadge, { severity: threat.severity })] }));
|
|
34
35
|
return (_jsx(Modal, { title: modalTitle, size: "large", ...modalProps, children: _jsx("div", { className: styles['threat-details'], children: _jsx(ThreatModalContext.Provider, { value: {
|
|
35
36
|
closeModal: modalProps.onRequestClose,
|
|
36
37
|
threat,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from '@automattic/jetpack-components';
|
|
3
3
|
import { __ } from '@wordpress/i18n';
|
|
4
4
|
import { useCallback, useContext, useMemo } from 'react';
|
|
5
5
|
import { getFixerState, getDetailedFixerAction } from '@automattic/jetpack-scan';
|
|
6
|
-
import FixerStateNotice from
|
|
7
|
-
import { ThreatModalContext } from
|
|
6
|
+
import FixerStateNotice from './fixer-state-notice.js';
|
|
7
|
+
import { ThreatModalContext } from './index.js';
|
|
8
8
|
import styles from './styles.module.scss';
|
|
9
9
|
/**
|
|
10
10
|
* ThreatActions component
|
|
@@ -33,8 +33,11 @@ const ThreatActions = () => {
|
|
|
33
33
|
if (!threat?.status || threat.status === 'fixed') {
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
|
-
return (_jsxs("div", { className: styles['modal-footer'], children: [
|
|
36
|
+
return (_jsxs("div", { className: styles['modal-footer'], children: [
|
|
37
|
+
_jsx(FixerStateNotice, { fixerState: fixerState }), _jsxs("div", { className: styles['threat-actions'], children: [threat.status === 'ignored' && (_jsx(Button, { disabled: disabled, isDestructive: true, variant: "secondary", onClick: onUnignoreClick, children: __('Un-ignore threat', 'jetpack-scan') })), threat.status === 'current' && (_jsxs(_Fragment, { children: [
|
|
38
|
+
_jsx(Button, { isDestructive: true, variant: "secondary", onClick: onIgnoreClick, disabled: disabled || (fixerState.inProgress && !fixerState.stale), children: __('Ignore threat', 'jetpack-scan') }), threat.fixable && (_jsx(Button, { isPrimary: true, disabled: disabled || (fixerState.inProgress && !fixerState.stale), onClick: onFixClick, children: fixerState.error || fixerState.stale
|
|
37
39
|
? __('Retry fixer', 'jetpack-scan')
|
|
38
|
-
: detailedFixerAction }))] }))] })
|
|
40
|
+
: detailedFixerAction }))] }))] })
|
|
41
|
+
] }));
|
|
39
42
|
};
|
|
40
43
|
export default ThreatActions;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
3
|
import { useContext } from 'react';
|
|
4
|
-
import { ThreatModalContext } from
|
|
5
|
-
import ThreatActions from
|
|
6
|
-
import ThreatFixDetails from
|
|
7
|
-
import ThreatNotice from
|
|
8
|
-
import ThreatSummary from
|
|
9
|
-
import ThreatTechnicalDetails from
|
|
4
|
+
import { ThreatModalContext } from './index.js';
|
|
5
|
+
import ThreatActions from './threat-actions.js';
|
|
6
|
+
import ThreatFixDetails from './threat-fix-details.js';
|
|
7
|
+
import ThreatNotice from './threat-notice.js';
|
|
8
|
+
import ThreatSummary from './threat-summary.js';
|
|
9
|
+
import ThreatTechnicalDetails from './threat-technical-details.js';
|
|
10
10
|
/**
|
|
11
11
|
* ThreatFixConfirmation component
|
|
12
12
|
*
|
|
@@ -14,6 +14,8 @@ import ThreatTechnicalDetails from "./threat-technical-details.js";
|
|
|
14
14
|
*/
|
|
15
15
|
const ThreatFixConfirmation = () => {
|
|
16
16
|
const { userConnectionNeeded, siteCredentialsNeeded } = useContext(ThreatModalContext);
|
|
17
|
-
return (_jsxs(_Fragment, { children: [
|
|
17
|
+
return (_jsxs(_Fragment, { children: [
|
|
18
|
+
_jsx(ThreatSummary, {}), _jsx(ThreatTechnicalDetails, {}), _jsx(ThreatFixDetails, {}), siteCredentialsNeeded && userConnectionNeeded && (_jsx(ThreatNotice, { 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-scan') })), !siteCredentialsNeeded && userConnectionNeeded && (_jsx(ThreatNotice, { title: __('User connection needed', 'jetpack-scan'), content: __('A user connection provides Jetpack the access necessary to ignore and auto-fix threats on your site.', 'jetpack-scan') })), siteCredentialsNeeded && !userConnectionNeeded && (_jsx(ThreatNotice, { title: __('Site credentials needed', 'jetpack-scan'), content: __('Your server credentials allow Jetpack to access the server that’s powering your website. This information is securely saved and only used to ignore and auto-fix threats detected on your site.', 'jetpack-scan') })), _jsx(ThreatActions, {})
|
|
19
|
+
] }));
|
|
18
20
|
};
|
|
19
21
|
export default ThreatFixConfirmation;
|
|
@@ -3,7 +3,7 @@ import { ContextualUpgradeTrigger, Text } from '@automattic/jetpack-components';
|
|
|
3
3
|
import { __, sprintf } from '@wordpress/i18n';
|
|
4
4
|
import { useMemo, useContext } from 'react';
|
|
5
5
|
import { getFixerDescription } from '@automattic/jetpack-scan';
|
|
6
|
-
import { ThreatModalContext } from
|
|
6
|
+
import { ThreatModalContext } from './index.js';
|
|
7
7
|
import styles from './styles.module.scss';
|
|
8
8
|
/**
|
|
9
9
|
* ThreatFixDetails component
|
|
@@ -35,6 +35,7 @@ const ThreatFixDetails = () => {
|
|
|
35
35
|
if (!threat.fixable && !threat.fixedIn) {
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
|
-
return (_jsxs("div", { className: styles.section, children: [
|
|
38
|
+
return (_jsxs("div", { className: styles.section, children: [
|
|
39
|
+
_jsx(Text, { variant: "title-small", children: title }), _jsx(Text, { children: fix }), handleUpgradeClick && (_jsx(ContextualUpgradeTrigger, { description: __('Looking for advanced scan results and one-click fixes?', 'jetpack-scan'), cta: __('Upgrade Jetpack now', 'jetpack-scan'), onClick: handleUpgradeClick }))] }));
|
|
39
40
|
};
|
|
40
41
|
export default ThreatFixDetails;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @return {JSX.Element} The rendered ThreatNotice component.
|
|
10
10
|
*/
|
|
11
11
|
declare const ThreatNotice: ({ status, title, content, }: {
|
|
12
|
-
status?: "
|
|
12
|
+
status?: "error" | "success" | "warning";
|
|
13
13
|
title: string;
|
|
14
14
|
content: string;
|
|
15
15
|
}) => JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { Notice, Spinner } from '@wordpress/components';
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { Icon, cautionFilled as warning } from '@wordpress/icons';
|
|
6
6
|
import { useContext } from 'react';
|
|
7
|
-
import { ThreatModalContext } from
|
|
7
|
+
import { ThreatModalContext } from './index.js';
|
|
8
8
|
import styles from './styles.module.scss';
|
|
9
9
|
/**
|
|
10
10
|
* ThreatNotice component
|
|
@@ -18,6 +18,9 @@ import styles from './styles.module.scss';
|
|
|
18
18
|
*/
|
|
19
19
|
const ThreatNotice = ({ status = 'warning', title, content, }) => {
|
|
20
20
|
const { userConnectionNeeded, userIsConnecting, handleConnectUser, siteCredentialsNeeded, credentialsRedirectUrl, credentialsIsFetching, } = useContext(ThreatModalContext);
|
|
21
|
-
return (_jsx(Notice, { status: status, isDismissible: false, children: _jsxs("div", { className: styles.notice, children: [
|
|
21
|
+
return (_jsx(Notice, { status: status, isDismissible: false, children: _jsxs("div", { className: styles.notice, children: [
|
|
22
|
+
_jsxs("div", { className: styles.notice__title, children: [status === 'success' ? (_jsx(Spinner, { className: styles.spinner })) : (_jsx(Icon, { icon: warning, size: 30 })), _jsx(Text, { variant: "title-small", mb: 2, children: title })
|
|
23
|
+
] }), _jsx(Text, { children: content }), _jsxs("div", { className: styles.notice__actions, children: [userConnectionNeeded && (_jsx(Button, { className: styles.notice__action, isExternalLink: true, weight: "regular", isLoading: userIsConnecting, onClick: handleConnectUser, children: __('Connect your user account', 'jetpack-scan') })), siteCredentialsNeeded && (_jsx(Button, { className: styles.notice__action, isExternalLink: true, weight: "regular", href: credentialsRedirectUrl, isLoading: credentialsIsFetching, children: __('Enter server credentials', 'jetpack-scan') }))] })
|
|
24
|
+
] }) }));
|
|
22
25
|
};
|
|
23
26
|
export default ThreatNotice;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Button, Text } from '@automattic/jetpack-components';
|
|
3
3
|
import { __ } from '@wordpress/i18n';
|
|
4
4
|
import { useContext } from 'react';
|
|
5
|
-
import { ThreatModalContext } from
|
|
5
|
+
import { ThreatModalContext } from './index.js';
|
|
6
6
|
import styles from './styles.module.scss';
|
|
7
7
|
/**
|
|
8
8
|
* ThreatSummary component
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Text, Button, DiffViewer, MarkedLines } from '@automattic/jetpack-components';
|
|
3
3
|
import { __ } from '@wordpress/i18n';
|
|
4
4
|
import { chevronDown, chevronUp, Icon } from '@wordpress/icons';
|
|
5
5
|
import { useState, useCallback, useContext } from 'react';
|
|
6
|
-
import { ThreatModalContext } from
|
|
6
|
+
import { ThreatModalContext } from './index.js';
|
|
7
7
|
import styles from './styles.module.scss';
|
|
8
8
|
/**
|
|
9
9
|
* ThreatTechnicalDetails component
|
|
@@ -19,8 +19,13 @@ const ThreatTechnicalDetails = () => {
|
|
|
19
19
|
if (!threat.filename && !threat.context && !threat.diff) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
return (_jsxs("div", { className: styles.section, children: [
|
|
22
|
+
return (_jsxs("div", { className: styles.section, children: [
|
|
23
|
+
_jsx("div", { className: styles.section__title, children: _jsx(Button, { variant: "link", className: styles.section__toggle, "aria-expanded": open, "aria-controls": `threat-details-${threat.id}`, onClick: toggleOpen, children: _jsxs("div", { className: styles.section__toggle__content, children: [
|
|
24
|
+
_jsx(Text, { variant: "title-small", mb: 0, children: open
|
|
23
25
|
? __('Hide the technical details', 'jetpack-scan')
|
|
24
|
-
: __('Show the technical details', 'jetpack-scan') }), _jsx(Icon, { icon: open ? chevronUp : chevronDown, size: 24 })
|
|
26
|
+
: __('Show the technical details', 'jetpack-scan') }), _jsx(Icon, { icon: open ? chevronUp : chevronDown, size: 24 })
|
|
27
|
+
] }) }) }), open && (_jsxs("div", { className: open ? styles.section__open : styles.section__closed, id: `threat-details-${threat.id}`, children: [threat.filename && (_jsxs(_Fragment, { children: [
|
|
28
|
+
_jsx(Text, { children: __('Threat found in file:', 'jetpack-scan') }), _jsx("pre", { className: styles.filename, children: threat.filename })
|
|
29
|
+
] })), threat.context && _jsx(MarkedLines, { context: threat.context }), threat.diff && _jsx(DiffViewer, { diff: threat.diff })] }))] }));
|
|
25
30
|
};
|
|
26
31
|
export default ThreatTechnicalDetails;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import ThreatSeverityBadge from
|
|
3
|
+
import ThreatSeverityBadge from '../index.js';
|
|
4
4
|
describe('ThreatSeverityBadge', () => {
|
|
5
5
|
it('renders the correct severity label', () => {
|
|
6
6
|
render(_jsx(ThreatSeverityBadge, { severity: 4 }));
|
|
@@ -16,7 +16,7 @@ import { type Threat } from '@automattic/jetpack-scan';
|
|
|
16
16
|
*
|
|
17
17
|
* @return {JSX.Element} The ThreatsDataViews component.
|
|
18
18
|
*/
|
|
19
|
-
export default function ThreatsDataViews({ data, filters, onChangeSelection, isThreatEligibleForFix, isThreatEligibleForIgnore, isThreatEligibleForUnignore, onFixThreats, onIgnoreThreats, onUnignoreThreats
|
|
19
|
+
export default function ThreatsDataViews({ data, filters, onChangeSelection, isThreatEligibleForFix, isThreatEligibleForIgnore, isThreatEligibleForUnignore, onFixThreats, onIgnoreThreats, onUnignoreThreats }: {
|
|
20
20
|
data: Threat[];
|
|
21
21
|
filters?: Filter[];
|
|
22
22
|
onChangeSelection?: (selectedItemIds: string[]) => void;
|
|
@@ -6,10 +6,10 @@ import { __ } from '@wordpress/i18n';
|
|
|
6
6
|
import { Icon } from '@wordpress/icons';
|
|
7
7
|
import { useCallback, useMemo, useState } from 'react';
|
|
8
8
|
import { ThreatSeverityBadge, getThreatType } from '@automattic/jetpack-scan';
|
|
9
|
-
import ThreatFixerButton from
|
|
10
|
-
import { THREAT_ACTION_FIX, THREAT_ACTION_IGNORE, THREAT_ACTION_UNIGNORE, THREAT_FIELD_AUTO_FIX, THREAT_FIELD_DESCRIPTION, THREAT_FIELD_EXTENSION, THREAT_FIELD_FIRST_DETECTED, THREAT_FIELD_FIXED_ON, THREAT_FIELD_ICON, THREAT_FIELD_PLUGIN, THREAT_FIELD_SEVERITY, THREAT_FIELD_SIGNATURE, THREAT_FIELD_STATUS, THREAT_FIELD_THEME, THREAT_FIELD_TITLE, THREAT_FIELD_TYPE, THREAT_ICONS, THREAT_STATUSES, THREAT_TYPES, } from
|
|
9
|
+
import ThreatFixerButton from '../threat-fixer-button/index.js';
|
|
10
|
+
import { THREAT_ACTION_FIX, THREAT_ACTION_IGNORE, THREAT_ACTION_UNIGNORE, THREAT_FIELD_AUTO_FIX, THREAT_FIELD_DESCRIPTION, THREAT_FIELD_EXTENSION, THREAT_FIELD_FIRST_DETECTED, THREAT_FIELD_FIXED_ON, THREAT_FIELD_ICON, THREAT_FIELD_PLUGIN, THREAT_FIELD_SEVERITY, THREAT_FIELD_SIGNATURE, THREAT_FIELD_STATUS, THREAT_FIELD_THEME, THREAT_FIELD_TITLE, THREAT_FIELD_TYPE, THREAT_ICONS, THREAT_STATUSES, THREAT_TYPES, } from './constants.js';
|
|
11
11
|
import styles from './styles.module.scss';
|
|
12
|
-
import ThreatsStatusToggleGroupControl from
|
|
12
|
+
import ThreatsStatusToggleGroupControl from './threats-status-toggle-group-control.js';
|
|
13
13
|
/**
|
|
14
14
|
* DataViews component for displaying security threats.
|
|
15
15
|
*
|
|
@@ -8,7 +8,7 @@ import { type Threat } from '@automattic/jetpack-scan';
|
|
|
8
8
|
* @param { Function } props.onChangeView - Callback function to handle view changes.
|
|
9
9
|
* @return {JSX.Element|null} The component or null.
|
|
10
10
|
*/
|
|
11
|
-
export default function ThreatsStatusToggleGroupControl({ data, view, onChangeView
|
|
11
|
+
export default function ThreatsStatusToggleGroupControl({ data, view, onChangeView }: {
|
|
12
12
|
data: Threat[];
|
|
13
13
|
view: View;
|
|
14
14
|
onChangeView: (newView: View) => void;
|
|
@@ -84,10 +84,12 @@ export default function ThreatsStatusToggleGroupControl({ data, view, onChangeVi
|
|
|
84
84
|
return null;
|
|
85
85
|
}
|
|
86
86
|
try {
|
|
87
|
-
return (_jsx("div", { children: _jsx("div", { className: styles['toggle-group-control'], children: _jsxs(ToggleGroupControl, { label: __('Filter threats by status', 'jetpack-scan'), value: selectedValue, onChange: onStatusFilterChange, isBlock: true, hideLabelFromVision: true, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, children: [
|
|
87
|
+
return (_jsx("div", { children: _jsx("div", { className: styles['toggle-group-control'], children: _jsxs(ToggleGroupControl, { label: __('Filter threats by status', 'jetpack-scan'), value: selectedValue, onChange: onStatusFilterChange, isBlock: true, hideLabelFromVision: true, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, children: [
|
|
88
|
+
_jsx(ToggleGroupControlOption, { value: "active", label: sprintf(
|
|
88
89
|
/* translators: %d: number of active threats */ __('Active threats (%d)', 'jetpack-scan'), activeThreatsCount) }), _jsx(ToggleGroupControlOption, { value: "historic", label: sprintf(
|
|
89
90
|
/* translators: %d: number of historic threats */
|
|
90
|
-
__('History (%d)', 'jetpack-scan'), historicThreatsCount) })
|
|
91
|
+
__('History (%d)', 'jetpack-scan'), historicThreatsCount) })
|
|
92
|
+
] }) }) }));
|
|
91
93
|
}
|
|
92
94
|
catch {
|
|
93
95
|
return null;
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './types/index.js';
|
|
2
|
+
export * from './constants/index.js';
|
|
3
|
+
export * from './utils/index.js';
|
|
4
4
|
export * from './components/index.js';
|
package/build/types/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './fixers.js';
|
|
2
|
+
export * from './status.js';
|
|
3
|
+
export * from './threats.js';
|
package/build/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ThreatFixStatus } from '../types/fixers.ts';
|
|
2
2
|
import { type Threat } from '../types/threats.ts';
|
|
3
|
-
export declare const getThreatType: (threat: Threat) => "
|
|
3
|
+
export declare const getThreatType: (threat: Threat) => "core" | "file" | "plugins" | "themes";
|
|
4
4
|
export declare const fixerTimestampIsStale: (lastUpdatedTimestamp: string) => boolean;
|
|
5
5
|
export declare const fixerIsInError: (fixerStatus: ThreatFixStatus) => boolean;
|
|
6
6
|
export declare const fixerIsInProgress: (fixerStatus: ThreatFixStatus) => boolean;
|
|
@@ -10,6 +10,6 @@ export declare const getFixerState: (fixerStatus: ThreatFixStatus) => {
|
|
|
10
10
|
error: boolean;
|
|
11
11
|
stale: boolean;
|
|
12
12
|
};
|
|
13
|
-
export declare const getFixerAction: (threat: Threat) => import("@wordpress/i18n").TranslatableText<"
|
|
14
|
-
export declare const getDetailedFixerAction: (threat: Threat) => import("@wordpress/i18n").TranslatableText<"
|
|
13
|
+
export declare const getFixerAction: (threat: Threat) => import("@wordpress/i18n").TranslatableText<"Auto-fix"> | import("@wordpress/i18n").TranslatableText<"Delete"> | import("@wordpress/i18n").TranslatableText<"Replace"> | import("@wordpress/i18n").TranslatableText<"Update">;
|
|
14
|
+
export declare const getDetailedFixerAction: (threat: Threat) => import("@wordpress/i18n").TranslatableText<"Auto-fix"> | import("@wordpress/i18n").TranslatableText<"Delete file"> | import("@wordpress/i18n").TranslatableText<"Delete plugin from site"> | import("@wordpress/i18n").TranslatableText<"Delete theme from site"> | import("@wordpress/i18n").TranslatableText<"Replace default salts"> | import("@wordpress/i18n").TranslatableText<"Replace from backup"> | import("@wordpress/i18n").TranslatableText<"Update"> | import("@wordpress/i18n").TranslatableText<"Update plugin to newer version"> | import("@wordpress/i18n").TranslatableText<"Update theme to newer version">;
|
|
15
15
|
export declare const getFixerDescription: (threat: Threat) => string;
|
package/build/utils/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __, sprintf } from '@wordpress/i18n';
|
|
2
|
-
import { FIXER_IS_STALE_THRESHOLD } from
|
|
2
|
+
import { FIXER_IS_STALE_THRESHOLD } from '../constants/index.js';
|
|
3
3
|
export const getThreatType = (threat) => {
|
|
4
4
|
if (threat.signature === 'Vulnerable.WP.Core') {
|
|
5
5
|
return 'core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/jetpack-scan",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A JS client for consuming Jetpack Scan services",
|
|
6
6
|
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/scan/#readme",
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/Automattic/jetpack.git"
|
|
13
|
-
"directory": "projects/js-packages/scan"
|
|
12
|
+
"url": "git+https://github.com/Automattic/jetpack-scan.git"
|
|
14
13
|
},
|
|
15
14
|
"license": "GPL-2.0-or-later",
|
|
16
15
|
"author": "Automattic",
|
|
@@ -26,36 +25,38 @@
|
|
|
26
25
|
"scripts": {
|
|
27
26
|
"build": "pnpm run clean && pnpm run compile-ts",
|
|
28
27
|
"clean": "rm -rf build/",
|
|
29
|
-
"compile-ts": "
|
|
28
|
+
"compile-ts": "tsgo --pretty",
|
|
30
29
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
31
30
|
"test-coverage": "pnpm run test --coverage",
|
|
32
|
-
"typecheck": "
|
|
31
|
+
"typecheck": "tsgo --noEmit"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@automattic/jetpack-api": "^1.0.
|
|
36
|
-
"@automattic/jetpack-base-styles": "^1.0.
|
|
37
|
-
"@automattic/jetpack-components": "^1.
|
|
38
|
-
"@wordpress/api-fetch": "7.
|
|
39
|
-
"@wordpress/components": "32.
|
|
40
|
-
"@wordpress/dataviews": "
|
|
41
|
-
"@wordpress/date": "5.
|
|
42
|
-
"@wordpress/element": "6.
|
|
43
|
-
"@wordpress/i18n": "6.
|
|
44
|
-
"@wordpress/icons": "
|
|
45
|
-
"@wordpress/
|
|
34
|
+
"@automattic/jetpack-api": "^1.0.22",
|
|
35
|
+
"@automattic/jetpack-base-styles": "^1.0.21",
|
|
36
|
+
"@automattic/jetpack-components": "^1.8.1",
|
|
37
|
+
"@wordpress/api-fetch": "7.43.0",
|
|
38
|
+
"@wordpress/components": "32.5.0",
|
|
39
|
+
"@wordpress/dataviews": "13.1.0",
|
|
40
|
+
"@wordpress/date": "5.43.0",
|
|
41
|
+
"@wordpress/element": "6.43.0",
|
|
42
|
+
"@wordpress/i18n": "6.16.0",
|
|
43
|
+
"@wordpress/icons": "12.0.0",
|
|
44
|
+
"@wordpress/theme": "0.10.0",
|
|
45
|
+
"@wordpress/url": "4.43.0",
|
|
46
46
|
"debug": "4.4.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@storybook/addon-docs": "10.
|
|
50
|
-
"@storybook/react": "10.
|
|
49
|
+
"@storybook/addon-docs": "10.3.3",
|
|
50
|
+
"@storybook/react": "10.3.3",
|
|
51
51
|
"@testing-library/dom": "10.4.1",
|
|
52
|
-
"@testing-library/react": "16.3.
|
|
52
|
+
"@testing-library/react": "16.3.2",
|
|
53
53
|
"@types/jest": "30.0.0",
|
|
54
|
-
"@types/react": "18.3.
|
|
55
|
-
"
|
|
54
|
+
"@types/react": "18.3.28",
|
|
55
|
+
"@typescript/native-preview": "7.0.0-dev.20260225.1",
|
|
56
|
+
"jest": "30.3.0",
|
|
56
57
|
"react": "^18.2.0",
|
|
57
58
|
"react-dom": "^18.2.0",
|
|
58
|
-
"storybook": "10.
|
|
59
|
+
"storybook": "10.3.3",
|
|
59
60
|
"typescript": "5.9.3"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|