@automattic/jetpack-components 0.63.0 → 0.64.1
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 +15 -0
- package/components/action-button/index.jsx +9 -2
- package/components/action-popover/index.tsx +1 -1
- package/components/admin-page/index.tsx +1 -1
- package/components/automattic-byline-logo/index.tsx +1 -1
- package/components/boost-score-bar/index.tsx +2 -2
- package/components/boost-score-graph/tooltip.tsx +21 -11
- package/components/boost-score-graph/tooltips-plugin.ts +2 -3
- package/components/boost-score-graph/uplot-line-chart.tsx +3 -3
- package/components/button/index.tsx +1 -1
- package/components/copy-to-clipboard/index.tsx +2 -2
- package/components/gridicon/index.tsx +19 -19
- package/components/indeterminate-progress-bar/index.tsx +1 -1
- package/components/jetpack-footer/index.tsx +10 -10
- package/components/jetpack-logo/index.tsx +1 -1
- package/components/jetpack-protect-logo/index.tsx +1 -1
- package/components/jetpack-search-logo/index.tsx +1 -1
- package/components/jetpack-vaultpress-backup-logo/index.tsx +1 -1
- package/components/jetpack-videopress-logo/index.tsx +3 -1
- package/components/number-slider/index.tsx +1 -1
- package/components/pricing-card/index.tsx +3 -3
- package/components/pricing-table/index.tsx +8 -8
- package/components/product-offer/index.tsx +3 -3
- package/components/product-offer/product-offer-header.tsx +1 -1
- package/components/product-price/index.tsx +2 -2
- package/components/record-meter-bar/index.tsx +3 -3
- package/components/status/index.tsx +5 -5
- package/components/terms-of-service/index.tsx +3 -3
- package/components/threat-fixer-button/index.tsx +5 -5
- package/components/threat-modal/fixer-state-notice.tsx +6 -6
- package/components/threat-modal/threat-actions.tsx +4 -4
- package/components/threat-modal/threat-fix-confirmation.tsx +5 -5
- package/components/threat-modal/threat-fix-details.tsx +9 -6
- package/components/threat-modal/threat-notice.tsx +3 -3
- package/components/threat-modal/threat-summary.tsx +2 -2
- package/components/threat-modal/threat-technical-details.tsx +4 -4
- package/components/threat-severity-badge/index.tsx +5 -3
- package/components/threats-data-views/constants.ts +7 -7
- package/components/threats-data-views/index.tsx +34 -24
- package/components/threats-data-views/styles.module.scss +2 -3
- package/components/threats-data-views/threats-status-toggle-group-control.tsx +24 -26
- package/components/upsell-banner/index.tsx +1 -1
- package/components/zendesk-chat/types.ts +1 -1
- package/package.json +15 -15
|
@@ -28,7 +28,7 @@ const MultipleButtonsText = ( { multipleButtonsLabels } ) => {
|
|
|
28
28
|
/* translators: %1$s is button label 1 and %2$s is button label 2 */
|
|
29
29
|
__(
|
|
30
30
|
'By clicking <strong>%1$s</strong> or <strong>%2$s</strong>, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your site‘s data</shareDetailsLink> with us.',
|
|
31
|
-
'jetpack'
|
|
31
|
+
'jetpack-components'
|
|
32
32
|
),
|
|
33
33
|
multipleButtonsLabels[ 0 ],
|
|
34
34
|
multipleButtonsLabels[ 1 ]
|
|
@@ -44,7 +44,7 @@ const MultipleButtonsText = ( { multipleButtonsLabels } ) => {
|
|
|
44
44
|
return createInterpolateElement(
|
|
45
45
|
__(
|
|
46
46
|
'By clicking the buttons above, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your site‘s data</shareDetailsLink> with us.',
|
|
47
|
-
'jetpack'
|
|
47
|
+
'jetpack-components'
|
|
48
48
|
),
|
|
49
49
|
{
|
|
50
50
|
tosLink: <Link slug="wpcom-tos" />,
|
|
@@ -59,7 +59,7 @@ const SingleButtonText = ( { agreeButtonLabel } ) =>
|
|
|
59
59
|
/* translators: %s is a button label */
|
|
60
60
|
__(
|
|
61
61
|
'By clicking <strong>%s</strong>, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your site‘s data</shareDetailsLink> with us.',
|
|
62
|
-
'jetpack'
|
|
62
|
+
'jetpack-components'
|
|
63
63
|
),
|
|
64
64
|
agreeButtonLabel
|
|
65
65
|
),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Button } from '@automattic/jetpack-components';
|
|
2
1
|
import {
|
|
3
2
|
type Threat,
|
|
4
3
|
getFixerState,
|
|
@@ -8,6 +7,7 @@ import {
|
|
|
8
7
|
import { Tooltip } from '@wordpress/components';
|
|
9
8
|
import { useCallback, useMemo } from '@wordpress/element';
|
|
10
9
|
import { __ } from '@wordpress/i18n';
|
|
10
|
+
import { Button } from '@automattic/jetpack-components';
|
|
11
11
|
import styles from './styles.module.scss';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -39,15 +39,15 @@ export default function ThreatFixerButton( {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if ( fixerState.error ) {
|
|
42
|
-
return __( 'An error occurred auto-fixing this threat.', 'jetpack' );
|
|
42
|
+
return __( 'An error occurred auto-fixing this threat.', 'jetpack-components' );
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if ( fixerState.stale ) {
|
|
46
|
-
return __( 'The auto-fixer is taking longer than expected.', 'jetpack' );
|
|
46
|
+
return __( 'The auto-fixer is taking longer than expected.', 'jetpack-components' );
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
if ( fixerState.inProgress ) {
|
|
50
|
-
return __( 'An auto-fixer is in progress.', 'jetpack' );
|
|
50
|
+
return __( 'An auto-fixer is in progress.', 'jetpack-components' );
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
return getFixerDescription( threat );
|
|
@@ -59,7 +59,7 @@ export default function ThreatFixerButton( {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
if ( fixerState.error ) {
|
|
62
|
-
return __( 'Error', 'jetpack' );
|
|
62
|
+
return __( 'Error', 'jetpack-components' );
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return getFixerAction( threat );
|
|
@@ -23,10 +23,10 @@ const FixerStateNotice = ( {
|
|
|
23
23
|
if ( fixerState.error ) {
|
|
24
24
|
return {
|
|
25
25
|
status: 'error' as const,
|
|
26
|
-
title: __( 'An error occurred auto-fixing this threat', 'jetpack' ),
|
|
26
|
+
title: __( 'An error occurred auto-fixing this threat', 'jetpack-components' ),
|
|
27
27
|
content: __(
|
|
28
28
|
'Jetpack encountered a filesystem error while attempting to auto-fix this threat. Please try again later or contact support.',
|
|
29
|
-
'jetpack'
|
|
29
|
+
'jetpack-components'
|
|
30
30
|
),
|
|
31
31
|
};
|
|
32
32
|
}
|
|
@@ -34,10 +34,10 @@ const FixerStateNotice = ( {
|
|
|
34
34
|
if ( fixerState.stale ) {
|
|
35
35
|
return {
|
|
36
36
|
status: 'error' as const,
|
|
37
|
-
title: __( 'The auto-fixer is taking longer than expected', 'jetpack' ),
|
|
37
|
+
title: __( 'The auto-fixer is taking longer than expected', 'jetpack-components' ),
|
|
38
38
|
content: __(
|
|
39
39
|
'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.',
|
|
40
|
-
'jetpack'
|
|
40
|
+
'jetpack-components'
|
|
41
41
|
),
|
|
42
42
|
};
|
|
43
43
|
}
|
|
@@ -45,8 +45,8 @@ const FixerStateNotice = ( {
|
|
|
45
45
|
if ( fixerState.inProgress ) {
|
|
46
46
|
return {
|
|
47
47
|
status: 'success' as const,
|
|
48
|
-
title: __( 'An auto-fixer is in progress', 'jetpack' ),
|
|
49
|
-
content: __( 'Please wait while Jetpack auto-fixes the threat.', 'jetpack' ),
|
|
48
|
+
title: __( 'An auto-fixer is in progress', 'jetpack-components' ),
|
|
49
|
+
content: __( 'Please wait while Jetpack auto-fixes the threat.', 'jetpack-components' ),
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Button } from '@automattic/jetpack-components';
|
|
2
1
|
import { getFixerState, getDetailedFixerAction } from '@automattic/jetpack-scan';
|
|
3
2
|
import { __ } from '@wordpress/i18n';
|
|
4
3
|
import { useCallback, useContext, useMemo } from 'react';
|
|
4
|
+
import { Button } from '@automattic/jetpack-components';
|
|
5
5
|
import FixerStateNotice from './fixer-state-notice';
|
|
6
6
|
import styles from './styles.module.scss';
|
|
7
7
|
import { ThreatModalContext } from '.';
|
|
@@ -59,7 +59,7 @@ const ThreatActions = (): JSX.Element => {
|
|
|
59
59
|
variant="secondary"
|
|
60
60
|
onClick={ onUnignoreClick }
|
|
61
61
|
>
|
|
62
|
-
{ __( 'Un-ignore threat', 'jetpack' ) }
|
|
62
|
+
{ __( 'Un-ignore threat', 'jetpack-components' ) }
|
|
63
63
|
</Button>
|
|
64
64
|
) }
|
|
65
65
|
{ threat.status === 'current' && (
|
|
@@ -70,7 +70,7 @@ const ThreatActions = (): JSX.Element => {
|
|
|
70
70
|
onClick={ onIgnoreClick }
|
|
71
71
|
disabled={ disabled || ( fixerState.inProgress && ! fixerState.stale ) }
|
|
72
72
|
>
|
|
73
|
-
{ __( 'Ignore threat', 'jetpack' ) }
|
|
73
|
+
{ __( 'Ignore threat', 'jetpack-components' ) }
|
|
74
74
|
</Button>
|
|
75
75
|
{ threat.fixable && (
|
|
76
76
|
<Button
|
|
@@ -79,7 +79,7 @@ const ThreatActions = (): JSX.Element => {
|
|
|
79
79
|
onClick={ onFixClick }
|
|
80
80
|
>
|
|
81
81
|
{ fixerState.error || fixerState.stale
|
|
82
|
-
? __( 'Retry fixer', 'jetpack' )
|
|
82
|
+
? __( 'Retry fixer', 'jetpack-components' )
|
|
83
83
|
: detailedFixerAction }
|
|
84
84
|
</Button>
|
|
85
85
|
) }
|
|
@@ -24,25 +24,25 @@ const ThreatFixConfirmation = () => {
|
|
|
24
24
|
title={ 'Additional connections needed' }
|
|
25
25
|
content={ __(
|
|
26
26
|
'A user connection and server credentials provide Jetpack the access necessary to ignore and auto-fix threats on your site.',
|
|
27
|
-
'jetpack'
|
|
27
|
+
'jetpack-components'
|
|
28
28
|
) }
|
|
29
29
|
/>
|
|
30
30
|
) }
|
|
31
31
|
{ ! siteCredentialsNeeded && userConnectionNeeded && (
|
|
32
32
|
<ThreatNotice
|
|
33
|
-
title={ __( 'User connection needed', 'jetpack' ) }
|
|
33
|
+
title={ __( 'User connection needed', 'jetpack-components' ) }
|
|
34
34
|
content={ __(
|
|
35
35
|
'A user connection provides Jetpack the access necessary to ignore and auto-fix threats on your site.',
|
|
36
|
-
'jetpack'
|
|
36
|
+
'jetpack-components'
|
|
37
37
|
) }
|
|
38
38
|
/>
|
|
39
39
|
) }
|
|
40
40
|
{ siteCredentialsNeeded && ! userConnectionNeeded && (
|
|
41
41
|
<ThreatNotice
|
|
42
|
-
title={ __( 'Site credentials needed', 'jetpack' ) }
|
|
42
|
+
title={ __( 'Site credentials needed', 'jetpack-components' ) }
|
|
43
43
|
content={ __(
|
|
44
44
|
'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.',
|
|
45
|
-
'jetpack'
|
|
45
|
+
'jetpack-components'
|
|
46
46
|
) }
|
|
47
47
|
/>
|
|
48
48
|
) }
|
|
@@ -16,12 +16,12 @@ const ThreatFixDetails = (): JSX.Element => {
|
|
|
16
16
|
|
|
17
17
|
const title = useMemo( () => {
|
|
18
18
|
if ( threat.status === 'fixed' ) {
|
|
19
|
-
return __( 'How did Jetpack fix it?', 'jetpack' );
|
|
19
|
+
return __( 'How did Jetpack fix it?', 'jetpack-components' );
|
|
20
20
|
}
|
|
21
21
|
if ( threat.status === 'current' && threat.fixable ) {
|
|
22
|
-
return __( 'How can Jetpack auto-fix this threat?', 'jetpack' );
|
|
22
|
+
return __( 'How can Jetpack auto-fix this threat?', 'jetpack-components' );
|
|
23
23
|
}
|
|
24
|
-
return __( 'How to fix it?', 'jetpack' );
|
|
24
|
+
return __( 'How to fix it?', 'jetpack-components' );
|
|
25
25
|
}, [ threat ] );
|
|
26
26
|
|
|
27
27
|
const fix = useMemo( () => {
|
|
@@ -30,7 +30,7 @@ const ThreatFixDetails = (): JSX.Element => {
|
|
|
30
30
|
if ( ! threat.fixable && threat.fixedIn ) {
|
|
31
31
|
return sprintf(
|
|
32
32
|
/* translators: Translates to Updates to version. %1$s: Name. %2$s: Fixed version */
|
|
33
|
-
__( 'Update %1$s to version %2$s.', 'jetpack' ),
|
|
33
|
+
__( 'Update %1$s to version %2$s.', 'jetpack-components' ),
|
|
34
34
|
threat.extension.name,
|
|
35
35
|
threat.fixedIn
|
|
36
36
|
);
|
|
@@ -50,8 +50,11 @@ const ThreatFixDetails = (): JSX.Element => {
|
|
|
50
50
|
<Text>{ fix }</Text>
|
|
51
51
|
{ handleUpgradeClick && (
|
|
52
52
|
<ContextualUpgradeTrigger
|
|
53
|
-
description={ __(
|
|
54
|
-
|
|
53
|
+
description={ __(
|
|
54
|
+
'Looking for advanced scan results and one-click fixes?',
|
|
55
|
+
'jetpack-components'
|
|
56
|
+
) }
|
|
57
|
+
cta={ __( 'Upgrade Jetpack now', 'jetpack-components' ) }
|
|
55
58
|
onClick={ handleUpgradeClick }
|
|
56
59
|
/>
|
|
57
60
|
) }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Text, Button } from '@automattic/jetpack-components';
|
|
2
1
|
import { Notice, Spinner } from '@wordpress/components';
|
|
3
2
|
import { __ } from '@wordpress/i18n';
|
|
4
3
|
import { Icon, warning } from '@wordpress/icons';
|
|
5
4
|
import { useContext } from 'react';
|
|
5
|
+
import { Text, Button } from '@automattic/jetpack-components';
|
|
6
6
|
import styles from './styles.module.scss';
|
|
7
7
|
import { ThreatModalContext } from '.';
|
|
8
8
|
|
|
@@ -60,7 +60,7 @@ const ThreatNotice = ( {
|
|
|
60
60
|
isLoading={ userIsConnecting }
|
|
61
61
|
onClick={ handleConnectUser }
|
|
62
62
|
>
|
|
63
|
-
{ __( 'Connect your user account', 'jetpack' ) }
|
|
63
|
+
{ __( 'Connect your user account', 'jetpack-components' ) }
|
|
64
64
|
</Button>
|
|
65
65
|
) }
|
|
66
66
|
{ siteCredentialsNeeded && (
|
|
@@ -71,7 +71,7 @@ const ThreatNotice = ( {
|
|
|
71
71
|
href={ credentialsRedirectUrl }
|
|
72
72
|
isLoading={ credentialsIsFetching }
|
|
73
73
|
>
|
|
74
|
-
{ __( 'Enter server credentials', 'jetpack' ) }
|
|
74
|
+
{ __( 'Enter server credentials', 'jetpack-components' ) }
|
|
75
75
|
</Button>
|
|
76
76
|
) }
|
|
77
77
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Button } from '@automattic/jetpack-components';
|
|
2
1
|
import { __ } from '@wordpress/i18n';
|
|
3
2
|
import { useContext } from 'react';
|
|
3
|
+
import { Button } from '@automattic/jetpack-components';
|
|
4
4
|
import Text from '../text';
|
|
5
5
|
import styles from './styles.module.scss';
|
|
6
6
|
import { ThreatModalContext } from '.';
|
|
@@ -19,7 +19,7 @@ const ThreatSummary = (): JSX.Element => {
|
|
|
19
19
|
{ !! threat.source && (
|
|
20
20
|
<div>
|
|
21
21
|
<Button variant="link" isExternalLink={ true } weight="regular" href={ threat.source }>
|
|
22
|
-
{ __( 'See more technical details of this threat', 'jetpack' ) }
|
|
22
|
+
{ __( 'See more technical details of this threat', 'jetpack-components' ) }
|
|
23
23
|
</Button>
|
|
24
24
|
</div>
|
|
25
25
|
) }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Text, Button } from '@automattic/jetpack-components';
|
|
2
1
|
import { __ } from '@wordpress/i18n';
|
|
3
2
|
import { chevronDown, chevronUp, Icon } from '@wordpress/icons';
|
|
4
3
|
import { useState, useCallback, useContext } from 'react';
|
|
4
|
+
import { Text, Button } from '@automattic/jetpack-components';
|
|
5
5
|
import DiffViewer from '../diff-viewer';
|
|
6
6
|
import MarkedLines from '../marked-lines';
|
|
7
7
|
import styles from './styles.module.scss';
|
|
@@ -38,8 +38,8 @@ const ThreatTechnicalDetails = (): JSX.Element => {
|
|
|
38
38
|
<div className={ styles.section__toggle__content }>
|
|
39
39
|
<Text variant="title-small" mb={ 0 }>
|
|
40
40
|
{ open
|
|
41
|
-
? __( 'Hide the technical details', 'jetpack' )
|
|
42
|
-
: __( 'Show the technical details', 'jetpack' ) }
|
|
41
|
+
? __( 'Hide the technical details', 'jetpack-components' )
|
|
42
|
+
: __( 'Show the technical details', 'jetpack-components' ) }
|
|
43
43
|
</Text>
|
|
44
44
|
<Icon icon={ open ? chevronUp : chevronDown } size={ 24 } />
|
|
45
45
|
</div>
|
|
@@ -52,7 +52,7 @@ const ThreatTechnicalDetails = (): JSX.Element => {
|
|
|
52
52
|
>
|
|
53
53
|
{ threat.filename && (
|
|
54
54
|
<>
|
|
55
|
-
<Text>{ __( 'Threat found in file:', 'jetpack' ) }</Text>
|
|
55
|
+
<Text>{ __( 'Threat found in file:', 'jetpack-components' ) }</Text>
|
|
56
56
|
<pre className={ styles.filename }>{ threat.filename }</pre>
|
|
57
57
|
</>
|
|
58
58
|
) }
|
|
@@ -5,7 +5,7 @@ const ThreatSeverityBadge = ( { severity } ) => {
|
|
|
5
5
|
if ( severity >= 5 ) {
|
|
6
6
|
return (
|
|
7
7
|
<Badge variant="danger">
|
|
8
|
-
{ _x( 'Critical', 'Severity label for issues rated 5 or higher.', 'jetpack' ) }
|
|
8
|
+
{ _x( 'Critical', 'Severity label for issues rated 5 or higher.', 'jetpack-components' ) }
|
|
9
9
|
</Badge>
|
|
10
10
|
);
|
|
11
11
|
}
|
|
@@ -13,12 +13,14 @@ const ThreatSeverityBadge = ( { severity } ) => {
|
|
|
13
13
|
if ( severity >= 3 && severity < 5 ) {
|
|
14
14
|
return (
|
|
15
15
|
<Badge variant="warning">
|
|
16
|
-
{ _x( 'High', 'Severity label for issues rated between 3 and 5.', 'jetpack' ) }
|
|
16
|
+
{ _x( 'High', 'Severity label for issues rated between 3 and 5.', 'jetpack-components' ) }
|
|
17
17
|
</Badge>
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
return
|
|
21
|
+
return (
|
|
22
|
+
<Badge>{ _x( 'Low', 'Severity label for issues rated below 3.', 'jetpack-components' ) }</Badge>
|
|
23
|
+
);
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
export default ThreatSeverityBadge;
|
|
@@ -9,16 +9,16 @@ import {
|
|
|
9
9
|
|
|
10
10
|
export const THREAT_STATUSES: { value: string; label: string; variant?: 'success' | 'warning' }[] =
|
|
11
11
|
[
|
|
12
|
-
{ value: 'current', label: __( 'Active', 'jetpack' ), variant: 'warning' },
|
|
13
|
-
{ value: 'fixed', label: __( 'Fixed', 'jetpack' ), variant: 'success' },
|
|
14
|
-
{ value: 'ignored', label: __( 'Ignored', 'jetpack' ) },
|
|
12
|
+
{ value: 'current', label: __( 'Active', 'jetpack-components' ), variant: 'warning' },
|
|
13
|
+
{ value: 'fixed', label: __( 'Fixed', 'jetpack-components' ), variant: 'success' },
|
|
14
|
+
{ value: 'ignored', label: __( 'Ignored', 'jetpack-components' ) },
|
|
15
15
|
];
|
|
16
16
|
|
|
17
17
|
export const THREAT_TYPES = [
|
|
18
|
-
{ value: '
|
|
19
|
-
{ value: '
|
|
20
|
-
{ value: 'core', label: __( 'WordPress', 'jetpack' ) },
|
|
21
|
-
{ value: 'file', label: __( 'File', 'jetpack' ) },
|
|
18
|
+
{ value: 'plugins', label: __( 'Plugin', 'jetpack-components' ) },
|
|
19
|
+
{ value: 'themes', label: __( 'Theme', 'jetpack-components' ) },
|
|
20
|
+
{ value: 'core', label: __( 'WordPress', 'jetpack-components' ) },
|
|
21
|
+
{ value: 'file', label: __( 'File', 'jetpack-components' ) },
|
|
22
22
|
];
|
|
23
23
|
|
|
24
24
|
export const THREAT_ICONS = {
|
|
@@ -112,7 +112,7 @@ export default function ThreatsDataViews( {
|
|
|
112
112
|
combinedFields: [
|
|
113
113
|
{
|
|
114
114
|
id: THREAT_FIELD_THREAT,
|
|
115
|
-
label: __( 'Threat', 'jetpack' ),
|
|
115
|
+
label: __( 'Threat', 'jetpack-components' ),
|
|
116
116
|
children: [ THREAT_FIELD_TITLE, THREAT_FIELD_DESCRIPTION ],
|
|
117
117
|
direction: 'vertical',
|
|
118
118
|
},
|
|
@@ -168,12 +168,12 @@ export default function ThreatsDataViews( {
|
|
|
168
168
|
// Extensions (Themes and Plugins)
|
|
169
169
|
if ( threat.extension ) {
|
|
170
170
|
switch ( threat.extension.type ) {
|
|
171
|
-
case '
|
|
171
|
+
case 'themes':
|
|
172
172
|
if ( ! acc.themes.find( ( { value } ) => value === threat.extension.slug ) ) {
|
|
173
173
|
acc.themes.push( { value: threat.extension.slug, label: threat.extension.name } );
|
|
174
174
|
}
|
|
175
175
|
break;
|
|
176
|
-
case '
|
|
176
|
+
case 'plugins':
|
|
177
177
|
if ( ! acc.plugins.find( ( { value } ) => value === threat.extension.slug ) ) {
|
|
178
178
|
acc.plugins.push( { value: threat.extension.slug, label: threat.extension.name } );
|
|
179
179
|
}
|
|
@@ -222,7 +222,7 @@ export default function ThreatsDataViews( {
|
|
|
222
222
|
const result: Field< Threat >[] = [
|
|
223
223
|
{
|
|
224
224
|
id: THREAT_FIELD_TITLE,
|
|
225
|
-
label: __( 'Title', 'jetpack' ),
|
|
225
|
+
label: __( 'Title', 'jetpack-components' ),
|
|
226
226
|
enableGlobalSearch: true,
|
|
227
227
|
enableHiding: false,
|
|
228
228
|
render: ( { item }: { item: Threat } ) => (
|
|
@@ -231,7 +231,7 @@ export default function ThreatsDataViews( {
|
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
233
|
id: THREAT_FIELD_DESCRIPTION,
|
|
234
|
-
label: __( 'Description', 'jetpack' ),
|
|
234
|
+
label: __( 'Description', 'jetpack-components' ),
|
|
235
235
|
enableGlobalSearch: true,
|
|
236
236
|
enableHiding: false,
|
|
237
237
|
render: ( { item }: { item: Threat } ) => (
|
|
@@ -240,7 +240,7 @@ export default function ThreatsDataViews( {
|
|
|
240
240
|
},
|
|
241
241
|
{
|
|
242
242
|
id: THREAT_FIELD_ICON,
|
|
243
|
-
label: __( 'Icon', 'jetpack' ),
|
|
243
|
+
label: __( 'Icon', 'jetpack-components' ),
|
|
244
244
|
enableHiding: false,
|
|
245
245
|
getValue( { item }: { item: Threat } ) {
|
|
246
246
|
return getThreatType( item );
|
|
@@ -255,7 +255,7 @@ export default function ThreatsDataViews( {
|
|
|
255
255
|
},
|
|
256
256
|
{
|
|
257
257
|
id: THREAT_FIELD_STATUS,
|
|
258
|
-
label: __( 'Status', 'jetpack' ),
|
|
258
|
+
label: __( 'Status', 'jetpack-components' ),
|
|
259
259
|
elements: THREAT_STATUSES,
|
|
260
260
|
getValue( { item }: { item: Threat } ) {
|
|
261
261
|
if ( ! item.status ) {
|
|
@@ -272,20 +272,31 @@ export default function ThreatsDataViews( {
|
|
|
272
272
|
return <Badge variant={ status?.variant }>{ status.label }</Badge>;
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
return <Badge variant="warning">{ __( 'Active', 'jetpack' ) }</Badge>;
|
|
275
|
+
return <Badge variant="warning">{ __( 'Active', 'jetpack-components' ) }</Badge>;
|
|
276
276
|
},
|
|
277
277
|
},
|
|
278
278
|
{
|
|
279
279
|
id: THREAT_FIELD_TYPE,
|
|
280
|
-
label: __( 'Type', 'jetpack' ),
|
|
280
|
+
label: __( 'Type', 'jetpack-components' ),
|
|
281
281
|
elements: THREAT_TYPES,
|
|
282
282
|
getValue( { item }: { item: Threat } ) {
|
|
283
|
-
|
|
283
|
+
switch ( getThreatType( item ) ) {
|
|
284
|
+
case 'core':
|
|
285
|
+
return __( 'WordPress', 'jetpack-components' );
|
|
286
|
+
case 'plugins':
|
|
287
|
+
return __( 'Plugin', 'jetpack-components' );
|
|
288
|
+
case 'themes':
|
|
289
|
+
return __( 'Theme', 'jetpack-components' );
|
|
290
|
+
case 'file':
|
|
291
|
+
return __( 'File', 'jetpack-components' );
|
|
292
|
+
default:
|
|
293
|
+
return __( 'Unknown', 'jetpack-components' );
|
|
294
|
+
}
|
|
284
295
|
},
|
|
285
296
|
},
|
|
286
297
|
{
|
|
287
298
|
id: THREAT_FIELD_EXTENSION,
|
|
288
|
-
label: __( 'Extension', 'jetpack' ),
|
|
299
|
+
label: __( 'Extension', 'jetpack-components' ),
|
|
289
300
|
enableGlobalSearch: true,
|
|
290
301
|
enableHiding: true,
|
|
291
302
|
getValue( { item }: { item: Threat } ) {
|
|
@@ -297,7 +308,7 @@ export default function ThreatsDataViews( {
|
|
|
297
308
|
},
|
|
298
309
|
{
|
|
299
310
|
id: THREAT_FIELD_PLUGIN,
|
|
300
|
-
label: __( 'Plugin', 'jetpack' ),
|
|
311
|
+
label: __( 'Plugin', 'jetpack-components' ),
|
|
301
312
|
enableGlobalSearch: true,
|
|
302
313
|
enableHiding: false,
|
|
303
314
|
elements: plugins,
|
|
@@ -307,7 +318,7 @@ export default function ThreatsDataViews( {
|
|
|
307
318
|
},
|
|
308
319
|
{
|
|
309
320
|
id: THREAT_FIELD_THEME,
|
|
310
|
-
label: __( 'Theme', 'jetpack' ),
|
|
321
|
+
label: __( 'Theme', 'jetpack-components' ),
|
|
311
322
|
enableGlobalSearch: true,
|
|
312
323
|
enableHiding: false,
|
|
313
324
|
elements: themes,
|
|
@@ -319,7 +330,7 @@ export default function ThreatsDataViews( {
|
|
|
319
330
|
? [
|
|
320
331
|
{
|
|
321
332
|
id: THREAT_FIELD_SEVERITY,
|
|
322
|
-
label: __( 'Severity', 'jetpack' ),
|
|
333
|
+
label: __( 'Severity', 'jetpack-components' ),
|
|
323
334
|
type: 'integer' as FieldType,
|
|
324
335
|
getValue( { item }: { item: Threat } ) {
|
|
325
336
|
return item.severity ?? 0;
|
|
@@ -334,7 +345,7 @@ export default function ThreatsDataViews( {
|
|
|
334
345
|
? [
|
|
335
346
|
{
|
|
336
347
|
id: THREAT_FIELD_SIGNATURE,
|
|
337
|
-
label: __( 'Signature', 'jetpack' ),
|
|
348
|
+
label: __( 'Signature', 'jetpack-components' ),
|
|
338
349
|
elements: signatures,
|
|
339
350
|
enableGlobalSearch: true,
|
|
340
351
|
getValue( { item }: { item: Threat } ) {
|
|
@@ -347,7 +358,7 @@ export default function ThreatsDataViews( {
|
|
|
347
358
|
? [
|
|
348
359
|
{
|
|
349
360
|
id: THREAT_FIELD_FIRST_DETECTED,
|
|
350
|
-
label: __( 'First Detected', 'jetpack' ),
|
|
361
|
+
label: __( 'First Detected', 'jetpack-components' ),
|
|
351
362
|
type: 'datetime' as FieldType,
|
|
352
363
|
getValue( { item }: { item: Threat } ) {
|
|
353
364
|
return item.firstDetected ? new Date( item.firstDetected ) : null;
|
|
@@ -366,7 +377,7 @@ export default function ThreatsDataViews( {
|
|
|
366
377
|
? [
|
|
367
378
|
{
|
|
368
379
|
id: THREAT_FIELD_FIXED_ON,
|
|
369
|
-
label: __( 'Fixed On', 'jetpack' ),
|
|
380
|
+
label: __( 'Fixed On', 'jetpack-components' ),
|
|
370
381
|
type: 'datetime' as FieldType,
|
|
371
382
|
getValue( { item }: { item: Threat } ) {
|
|
372
383
|
return item.fixedOn ? new Date( item.fixedOn ) : null;
|
|
@@ -385,16 +396,16 @@ export default function ThreatsDataViews( {
|
|
|
385
396
|
? [
|
|
386
397
|
{
|
|
387
398
|
id: THREAT_FIELD_AUTO_FIX,
|
|
388
|
-
label: __( 'Auto-fix', 'jetpack' ),
|
|
399
|
+
label: __( 'Auto-fix', 'jetpack-components' ),
|
|
389
400
|
enableHiding: false,
|
|
390
401
|
elements: [
|
|
391
402
|
{
|
|
392
403
|
value: 'yes',
|
|
393
|
-
label: __( 'Yes', 'jetpack' ),
|
|
404
|
+
label: __( 'Yes', 'jetpack-components' ),
|
|
394
405
|
},
|
|
395
406
|
{
|
|
396
407
|
value: 'no',
|
|
397
|
-
label: __( 'No', 'jetpack' ),
|
|
408
|
+
label: __( 'No', 'jetpack-components' ),
|
|
398
409
|
},
|
|
399
410
|
],
|
|
400
411
|
getValue( { item }: { item: Threat } ) {
|
|
@@ -426,9 +437,8 @@ export default function ThreatsDataViews( {
|
|
|
426
437
|
if ( dataFields.includes( 'fixable' ) ) {
|
|
427
438
|
result.push( {
|
|
428
439
|
id: THREAT_ACTION_FIX,
|
|
429
|
-
label: __( 'Auto-fix', 'jetpack' ),
|
|
440
|
+
label: __( 'Auto-fix', 'jetpack-components' ),
|
|
430
441
|
isPrimary: true,
|
|
431
|
-
supportsBulk: true,
|
|
432
442
|
callback: onFixThreats,
|
|
433
443
|
isEligible( item ) {
|
|
434
444
|
if ( ! onFixThreats ) {
|
|
@@ -445,7 +455,7 @@ export default function ThreatsDataViews( {
|
|
|
445
455
|
if ( dataFields.includes( 'status' ) ) {
|
|
446
456
|
result.push( {
|
|
447
457
|
id: THREAT_ACTION_IGNORE,
|
|
448
|
-
label: __( 'Ignore', 'jetpack' ),
|
|
458
|
+
label: __( 'Ignore', 'jetpack-components' ),
|
|
449
459
|
isPrimary: true,
|
|
450
460
|
isDestructive: true,
|
|
451
461
|
callback: onIgnoreThreats,
|
|
@@ -464,7 +474,7 @@ export default function ThreatsDataViews( {
|
|
|
464
474
|
if ( dataFields.includes( 'status' ) ) {
|
|
465
475
|
result.push( {
|
|
466
476
|
id: THREAT_ACTION_UNIGNORE,
|
|
467
|
-
label: __( 'Unignore', 'jetpack' ),
|
|
477
|
+
label: __( 'Unignore', 'jetpack-components' ),
|
|
468
478
|
isPrimary: true,
|
|
469
479
|
isDestructive: true,
|
|
470
480
|
callback: onUnignoreThreats,
|
|
@@ -120,41 +120,39 @@ export default function ThreatsStatusToggleGroupControl( {
|
|
|
120
120
|
|
|
121
121
|
try {
|
|
122
122
|
return (
|
|
123
|
-
<
|
|
124
|
-
className={ styles[ 'toggle-group-control' ] }
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
123
|
+
<div>
|
|
124
|
+
<div className={ styles[ 'toggle-group-control' ] }>
|
|
125
|
+
<ToggleGroupControl
|
|
126
|
+
value={ selectedValue }
|
|
127
|
+
onChange={ onStatusFilterChange }
|
|
128
|
+
isBlock
|
|
129
|
+
hideLabelFromVision
|
|
130
|
+
__nextHasNoMarginBottom
|
|
131
|
+
__next40pxDefaultSize
|
|
132
|
+
>
|
|
133
|
+
<ToggleGroupControlOption
|
|
134
|
+
value="active"
|
|
135
|
+
label={ sprintf(
|
|
134
136
|
/* translators: %d: number of active threats */ __(
|
|
135
137
|
'Active threats (%d)',
|
|
136
|
-
'jetpack'
|
|
138
|
+
'jetpack-components'
|
|
137
139
|
),
|
|
138
140
|
activeThreatsCount
|
|
139
141
|
) }
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
value="historic"
|
|
145
|
-
label={
|
|
146
|
-
<span className={ styles[ 'toggle-group-control__option' ] }>
|
|
147
|
-
{ sprintf(
|
|
142
|
+
/>
|
|
143
|
+
<ToggleGroupControlOption
|
|
144
|
+
value="historic"
|
|
145
|
+
label={ sprintf(
|
|
148
146
|
/* translators: %d: number of historic threats */
|
|
149
|
-
__( 'History (%d)', 'jetpack' ),
|
|
147
|
+
__( 'History (%d)', 'jetpack-components' ),
|
|
150
148
|
historicThreatsCount
|
|
151
149
|
) }
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
</
|
|
150
|
+
/>
|
|
151
|
+
</ToggleGroupControl>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
156
154
|
);
|
|
157
|
-
} catch
|
|
155
|
+
} catch {
|
|
158
156
|
return null;
|
|
159
157
|
}
|
|
160
158
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Button } from '@automattic/jetpack-components';
|
|
2
1
|
import { Card, CardBody } from '@wordpress/components';
|
|
3
2
|
import { createInterpolateElement } from '@wordpress/element';
|
|
4
3
|
import React from 'react';
|
|
4
|
+
import { Button } from '@automattic/jetpack-components';
|
|
5
5
|
import { UpsellBannerProps } from './types';
|
|
6
6
|
|
|
7
7
|
import './style.scss';
|