@automattic/jetpack-components 0.62.0 → 0.64.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/components/action-button/index.jsx +9 -2
  3. package/components/action-popover/index.tsx +1 -1
  4. package/components/admin-page/index.tsx +1 -1
  5. package/components/automattic-byline-logo/index.tsx +1 -1
  6. package/components/boost-score-bar/index.tsx +2 -2
  7. package/components/boost-score-graph/tooltip.tsx +21 -11
  8. package/components/boost-score-graph/uplot-line-chart.tsx +3 -3
  9. package/components/button/index.tsx +1 -1
  10. package/components/copy-to-clipboard/index.tsx +2 -2
  11. package/components/gridicon/index.tsx +19 -19
  12. package/components/indeterminate-progress-bar/index.tsx +1 -1
  13. package/components/jetpack-footer/index.tsx +10 -10
  14. package/components/jetpack-logo/index.tsx +1 -1
  15. package/components/jetpack-protect-logo/index.tsx +1 -1
  16. package/components/jetpack-search-logo/index.tsx +1 -1
  17. package/components/jetpack-vaultpress-backup-logo/index.tsx +1 -1
  18. package/components/jetpack-videopress-logo/index.tsx +3 -1
  19. package/components/pricing-card/index.tsx +3 -3
  20. package/components/pricing-table/index.tsx +6 -6
  21. package/components/product-offer/index.tsx +3 -3
  22. package/components/product-offer/product-offer-header.tsx +1 -1
  23. package/components/product-price/index.tsx +2 -2
  24. package/components/record-meter-bar/index.tsx +3 -3
  25. package/components/status/index.tsx +5 -5
  26. package/components/terms-of-service/index.tsx +3 -3
  27. package/components/threat-fixer-button/index.tsx +7 -7
  28. package/components/threat-modal/fixer-state-notice.tsx +63 -0
  29. package/components/threat-modal/index.tsx +44 -89
  30. package/components/threat-modal/styles.module.scss +50 -4
  31. package/components/threat-modal/threat-actions.tsx +45 -49
  32. package/components/threat-modal/threat-fix-confirmation.tsx +54 -0
  33. package/components/threat-modal/threat-fix-details.tsx +17 -20
  34. package/components/threat-modal/threat-notice.tsx +84 -0
  35. package/components/threat-modal/threat-summary.tsx +30 -0
  36. package/components/threat-modal/threat-technical-details.tsx +45 -14
  37. package/components/threat-severity-badge/index.tsx +5 -3
  38. package/components/threats-data-views/constants.ts +7 -7
  39. package/components/threats-data-views/index.tsx +20 -20
  40. package/components/threats-data-views/styles.module.scss +2 -3
  41. package/components/threats-data-views/threats-status-toggle-group-control.tsx +24 -26
  42. package/components/upsell-banner/index.tsx +1 -1
  43. package/components/zendesk-chat/types.ts +1 -1
  44. package/package.json +14 -14
  45. package/components/threat-modal/credentials-gate.tsx +0 -65
  46. package/components/threat-modal/user-connection-gate.tsx +0 -64
@@ -0,0 +1,30 @@
1
+ import { __ } from '@wordpress/i18n';
2
+ import { useContext } from 'react';
3
+ import { Button } from '@automattic/jetpack-components';
4
+ import Text from '../text';
5
+ import styles from './styles.module.scss';
6
+ import { ThreatModalContext } from '.';
7
+
8
+ /**
9
+ * ThreatSummary component
10
+ *
11
+ * @return {JSX.Element} The rendered threat summary.
12
+ */
13
+ const ThreatSummary = (): JSX.Element => {
14
+ const { threat } = useContext( ThreatModalContext );
15
+
16
+ return (
17
+ <div className={ styles.section }>
18
+ { !! threat.description && <Text>{ threat.description }</Text> }
19
+ { !! threat.source && (
20
+ <div>
21
+ <Button variant="link" isExternalLink={ true } weight="regular" href={ threat.source }>
22
+ { __( 'See more technical details of this threat', 'jetpack-components' ) }
23
+ </Button>
24
+ </div>
25
+ ) }
26
+ </div>
27
+ );
28
+ };
29
+
30
+ export default ThreatSummary;
@@ -1,34 +1,65 @@
1
- import { Threat } from '@automattic/jetpack-scan';
2
1
  import { __ } from '@wordpress/i18n';
2
+ import { chevronDown, chevronUp, Icon } from '@wordpress/icons';
3
+ import { useState, useCallback, useContext } from 'react';
4
+ import { Text, Button } from '@automattic/jetpack-components';
3
5
  import DiffViewer from '../diff-viewer';
4
6
  import MarkedLines from '../marked-lines';
5
- import Text from '../text';
6
7
  import styles from './styles.module.scss';
8
+ import { ThreatModalContext } from '.';
7
9
 
8
10
  /**
9
11
  * ThreatTechnicalDetails component
10
12
  *
11
- * @param {object} props - The component props.
12
- * @param {object} props.threat - The threat object containing technical details.
13
- *
14
13
  * @return {JSX.Element | null} The rendered technical details or null if no details are available.
15
14
  */
16
- const ThreatTechnicalDetails = ( { threat }: { threat: Threat } ): JSX.Element => {
15
+ const ThreatTechnicalDetails = (): JSX.Element => {
16
+ const { threat } = useContext( ThreatModalContext );
17
+
18
+ const [ open, setOpen ] = useState( false );
19
+
20
+ const toggleOpen = useCallback( () => {
21
+ setOpen( ! open );
22
+ }, [ open ] );
23
+
17
24
  if ( ! threat.filename && ! threat.context && ! threat.diff ) {
18
25
  return null;
19
26
  }
20
27
 
21
28
  return (
22
29
  <div className={ styles.section }>
23
- <Text variant="title-small">{ __( 'The technical details', 'jetpack' ) }</Text>
24
- { threat.filename && (
25
- <>
26
- <Text>{ __( 'Threat found in file:', 'jetpack' ) }</Text>
27
- <pre className={ styles.filename }>{ threat.filename }</pre>
28
- </>
30
+ <div className={ styles.section__title }>
31
+ <Button
32
+ variant="link"
33
+ className={ styles.section__toggle }
34
+ aria-expanded={ open }
35
+ aria-controls={ `threat-details-${ threat.id }` }
36
+ onClick={ toggleOpen }
37
+ >
38
+ <div className={ styles.section__toggle__content }>
39
+ <Text variant="title-small" mb={ 0 }>
40
+ { open
41
+ ? __( 'Hide the technical details', 'jetpack-components' )
42
+ : __( 'Show the technical details', 'jetpack-components' ) }
43
+ </Text>
44
+ <Icon icon={ open ? chevronUp : chevronDown } size={ 24 } />
45
+ </div>
46
+ </Button>
47
+ </div>
48
+ { open && (
49
+ <div
50
+ className={ open ? styles.section__open : styles.section__closed }
51
+ id={ `threat-details-${ threat.id }` }
52
+ >
53
+ { threat.filename && (
54
+ <>
55
+ <Text>{ __( 'Threat found in file:', 'jetpack-components' ) }</Text>
56
+ <pre className={ styles.filename }>{ threat.filename }</pre>
57
+ </>
58
+ ) }
59
+ { threat.context && <MarkedLines context={ threat.context } /> }
60
+ { threat.diff && <DiffViewer diff={ threat.diff } /> }
61
+ </div>
29
62
  ) }
30
- { threat.context && <MarkedLines context={ threat.context } /> }
31
- { threat.diff && <DiffViewer diff={ threat.diff } /> }
32
63
  </div>
33
64
  );
34
65
  };
@@ -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 <Badge>{ _x( 'Low', 'Severity label for issues rated below 3.', 'jetpack' ) }</Badge>;
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: 'plugin', label: __( 'Plugin', 'jetpack' ) },
19
- { value: 'theme', label: __( 'Theme', 'jetpack' ) },
20
- { value: 'core', label: __( 'WordPress', 'jetpack' ) },
21
- { value: 'file', label: __( 'File', 'jetpack' ) },
18
+ { value: 'plugin', label: __( 'Plugin', 'jetpack-components' ) },
19
+ { value: 'theme', 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
  },
@@ -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,12 +272,12 @@ 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
  return getThreatType( item ) ?? '';
@@ -285,7 +285,7 @@ export default function ThreatsDataViews( {
285
285
  },
286
286
  {
287
287
  id: THREAT_FIELD_EXTENSION,
288
- label: __( 'Extension', 'jetpack' ),
288
+ label: __( 'Extension', 'jetpack-components' ),
289
289
  enableGlobalSearch: true,
290
290
  enableHiding: true,
291
291
  getValue( { item }: { item: Threat } ) {
@@ -297,7 +297,7 @@ export default function ThreatsDataViews( {
297
297
  },
298
298
  {
299
299
  id: THREAT_FIELD_PLUGIN,
300
- label: __( 'Plugin', 'jetpack' ),
300
+ label: __( 'Plugin', 'jetpack-components' ),
301
301
  enableGlobalSearch: true,
302
302
  enableHiding: false,
303
303
  elements: plugins,
@@ -307,7 +307,7 @@ export default function ThreatsDataViews( {
307
307
  },
308
308
  {
309
309
  id: THREAT_FIELD_THEME,
310
- label: __( 'Theme', 'jetpack' ),
310
+ label: __( 'Theme', 'jetpack-components' ),
311
311
  enableGlobalSearch: true,
312
312
  enableHiding: false,
313
313
  elements: themes,
@@ -319,7 +319,7 @@ export default function ThreatsDataViews( {
319
319
  ? [
320
320
  {
321
321
  id: THREAT_FIELD_SEVERITY,
322
- label: __( 'Severity', 'jetpack' ),
322
+ label: __( 'Severity', 'jetpack-components' ),
323
323
  type: 'integer' as FieldType,
324
324
  getValue( { item }: { item: Threat } ) {
325
325
  return item.severity ?? 0;
@@ -334,7 +334,7 @@ export default function ThreatsDataViews( {
334
334
  ? [
335
335
  {
336
336
  id: THREAT_FIELD_SIGNATURE,
337
- label: __( 'Signature', 'jetpack' ),
337
+ label: __( 'Signature', 'jetpack-components' ),
338
338
  elements: signatures,
339
339
  enableGlobalSearch: true,
340
340
  getValue( { item }: { item: Threat } ) {
@@ -347,7 +347,7 @@ export default function ThreatsDataViews( {
347
347
  ? [
348
348
  {
349
349
  id: THREAT_FIELD_FIRST_DETECTED,
350
- label: __( 'First Detected', 'jetpack' ),
350
+ label: __( 'First Detected', 'jetpack-components' ),
351
351
  type: 'datetime' as FieldType,
352
352
  getValue( { item }: { item: Threat } ) {
353
353
  return item.firstDetected ? new Date( item.firstDetected ) : null;
@@ -366,7 +366,7 @@ export default function ThreatsDataViews( {
366
366
  ? [
367
367
  {
368
368
  id: THREAT_FIELD_FIXED_ON,
369
- label: __( 'Fixed On', 'jetpack' ),
369
+ label: __( 'Fixed On', 'jetpack-components' ),
370
370
  type: 'datetime' as FieldType,
371
371
  getValue( { item }: { item: Threat } ) {
372
372
  return item.fixedOn ? new Date( item.fixedOn ) : null;
@@ -385,16 +385,16 @@ export default function ThreatsDataViews( {
385
385
  ? [
386
386
  {
387
387
  id: THREAT_FIELD_AUTO_FIX,
388
- label: __( 'Auto-fix', 'jetpack' ),
388
+ label: __( 'Auto-fix', 'jetpack-components' ),
389
389
  enableHiding: false,
390
390
  elements: [
391
391
  {
392
392
  value: 'yes',
393
- label: __( 'Yes', 'jetpack' ),
393
+ label: __( 'Yes', 'jetpack-components' ),
394
394
  },
395
395
  {
396
396
  value: 'no',
397
- label: __( 'No', 'jetpack' ),
397
+ label: __( 'No', 'jetpack-components' ),
398
398
  },
399
399
  ],
400
400
  getValue( { item }: { item: Threat } ) {
@@ -426,7 +426,7 @@ export default function ThreatsDataViews( {
426
426
  if ( dataFields.includes( 'fixable' ) ) {
427
427
  result.push( {
428
428
  id: THREAT_ACTION_FIX,
429
- label: __( 'Auto-fix', 'jetpack' ),
429
+ label: __( 'Auto-fix', 'jetpack-components' ),
430
430
  isPrimary: true,
431
431
  supportsBulk: true,
432
432
  callback: onFixThreats,
@@ -445,7 +445,7 @@ export default function ThreatsDataViews( {
445
445
  if ( dataFields.includes( 'status' ) ) {
446
446
  result.push( {
447
447
  id: THREAT_ACTION_IGNORE,
448
- label: __( 'Ignore', 'jetpack' ),
448
+ label: __( 'Ignore', 'jetpack-components' ),
449
449
  isPrimary: true,
450
450
  isDestructive: true,
451
451
  callback: onIgnoreThreats,
@@ -464,7 +464,7 @@ export default function ThreatsDataViews( {
464
464
  if ( dataFields.includes( 'status' ) ) {
465
465
  result.push( {
466
466
  id: THREAT_ACTION_UNIGNORE,
467
- label: __( 'Unignore', 'jetpack' ),
467
+ label: __( 'Unignore', 'jetpack-components' ),
468
468
  isPrimary: true,
469
469
  isDestructive: true,
470
470
  callback: onUnignoreThreats,
@@ -35,7 +35,6 @@
35
35
  }
36
36
  }
37
37
 
38
- .toggle-group-control__option {
39
- white-space: nowrap;
40
- padding: 0 12px;
38
+ .toggle-group-control {
39
+ min-width: 300px;
41
40
  }
@@ -120,41 +120,39 @@ export default function ThreatsStatusToggleGroupControl( {
120
120
 
121
121
  try {
122
122
  return (
123
- <ToggleGroupControl
124
- className={ styles[ 'toggle-group-control' ] }
125
- value={ selectedValue }
126
- onChange={ onStatusFilterChange }
127
- __nextHasNoMarginBottom
128
- >
129
- <ToggleGroupControlOption
130
- value="active"
131
- label={
132
- <span className={ styles[ 'toggle-group-control__option' ] }>
133
- { sprintf(
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
- </span>
141
- }
142
- />
143
- <ToggleGroupControlOption
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
- </span>
153
- }
154
- />
155
- </ToggleGroupControl>
150
+ />
151
+ </ToggleGroupControl>
152
+ </div>
153
+ </div>
156
154
  );
157
- } catch ( error ) {
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';
@@ -2,7 +2,7 @@ import type { FC } from 'react';
2
2
 
3
3
  declare global {
4
4
  interface Window {
5
- // eslint-disable-next-line @typescript-eslint/ban-types
5
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
6
6
  zE: Function;
7
7
  }
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/jetpack-components",
3
- "version": "0.62.0",
3
+ "version": "0.64.0",
4
4
  "description": "Jetpack Components Package",
5
5
  "author": "Automattic",
6
6
  "license": "GPL-2.0-or-later",
@@ -15,19 +15,19 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@automattic/format-currency": "1.0.1",
18
- "@automattic/jetpack-boost-score-api": "^0.1.47",
19
- "@automattic/jetpack-scan": "^0.3.0",
18
+ "@automattic/jetpack-boost-score-api": "^0.1.48",
19
+ "@automattic/jetpack-scan": "^0.5.0",
20
20
  "@babel/runtime": "^7",
21
- "@wordpress/browserslist-config": "6.12.0",
22
- "@wordpress/components": "28.12.0",
23
- "@wordpress/compose": "7.12.0",
24
- "@wordpress/data": "10.12.0",
25
- "@wordpress/dataviews": "4.8.0",
26
- "@wordpress/date": "5.12.0",
27
- "@wordpress/element": "6.12.0",
28
- "@wordpress/i18n": "5.12.0",
29
- "@wordpress/icons": "10.12.0",
30
- "@wordpress/notices": "5.12.0",
21
+ "@wordpress/browserslist-config": "6.13.0",
22
+ "@wordpress/components": "28.13.0",
23
+ "@wordpress/compose": "7.13.0",
24
+ "@wordpress/data": "10.13.0",
25
+ "@wordpress/dataviews": "4.9.0",
26
+ "@wordpress/date": "5.13.0",
27
+ "@wordpress/element": "6.13.0",
28
+ "@wordpress/i18n": "5.13.0",
29
+ "@wordpress/icons": "10.13.0",
30
+ "@wordpress/notices": "5.13.0",
31
31
  "clsx": "2.1.1",
32
32
  "prop-types": "^15.7.2",
33
33
  "qrcode.react": "3.1.0",
@@ -37,7 +37,7 @@
37
37
  "uplot-react": "1.1.4"
38
38
  },
39
39
  "devDependencies": {
40
- "@automattic/jetpack-base-styles": "^0.6.37",
40
+ "@automattic/jetpack-base-styles": "^0.6.38",
41
41
  "@babel/core": "7.26.0",
42
42
  "@babel/preset-react": "7.25.9",
43
43
  "@jest/globals": "29.4.3",
@@ -1,65 +0,0 @@
1
- import { Text, Button } from '@automattic/jetpack-components';
2
- import { Notice } from '@wordpress/components';
3
- import { __ } from '@wordpress/i18n';
4
- import React, { ReactElement } from 'react';
5
- import styles from './styles.module.scss';
6
-
7
- const CredentialsGate = ( {
8
- siteCredentialsNeeded,
9
- credentialsIsFetching,
10
- credentialsRedirectUrl,
11
- children,
12
- }: {
13
- siteCredentialsNeeded: boolean;
14
- credentialsIsFetching: boolean;
15
- credentialsRedirectUrl: string;
16
- children: ReactElement;
17
- } ): JSX.Element => {
18
- if ( ! siteCredentialsNeeded ) {
19
- return children;
20
- }
21
-
22
- return (
23
- <>
24
- <Notice
25
- status="warning"
26
- isDismissible={ false }
27
- children={
28
- <Text>
29
- { __(
30
- 'Before Jetpack can auto-fix threats on your site, it needs your server credentials.',
31
- 'jetpack'
32
- ) }
33
- </Text>
34
- }
35
- />
36
-
37
- <Text>
38
- { __(
39
- 'Your server credentials allow Jetpack to access the server that’s powering your website. This information is securely saved and only used to perform fix threats detected on your site.',
40
- 'jetpack'
41
- ) }
42
- </Text>
43
-
44
- <Text>
45
- { __(
46
- 'Once you’ve entered server credentials, Jetpack will be fixing the selected threats.',
47
- 'jetpack'
48
- ) }
49
- </Text>
50
-
51
- <div className={ styles[ 'modal-actions' ] }>
52
- <Button
53
- isExternalLink={ true }
54
- weight="regular"
55
- href={ credentialsRedirectUrl }
56
- isLoading={ credentialsIsFetching }
57
- >
58
- { __( 'Enter server credentials', 'jetpack' ) }
59
- </Button>
60
- </div>
61
- </>
62
- );
63
- };
64
-
65
- export default CredentialsGate;
@@ -1,64 +0,0 @@
1
- import { Text, Button } from '@automattic/jetpack-components';
2
- import { Notice } from '@wordpress/components';
3
- import { __ } from '@wordpress/i18n';
4
- import React, { ReactElement } from 'react';
5
- import styles from './styles.module.scss';
6
-
7
- const UserConnectionGate = ( {
8
- userConnectionNeeded,
9
- userIsConnecting,
10
- handleConnectUser,
11
- children,
12
- }: {
13
- userConnectionNeeded: boolean;
14
- userIsConnecting: boolean;
15
- handleConnectUser: () => void;
16
- children: ReactElement;
17
- } ): JSX.Element => {
18
- if ( ! userConnectionNeeded ) {
19
- return children;
20
- }
21
- return (
22
- <>
23
- <Notice
24
- status="warning"
25
- isDismissible={ false }
26
- children={
27
- <Text>
28
- { __(
29
- 'Before Jetpack can ignore and auto-fix threats on your site, a user connection is needed.',
30
- 'jetpack'
31
- ) }
32
- </Text>
33
- }
34
- />
35
-
36
- <Text>
37
- { __(
38
- 'A user connection provides Jetpack the access necessary to perform these tasks.',
39
- 'jetpack'
40
- ) }
41
- </Text>
42
-
43
- <Text>
44
- { __(
45
- 'Once you’ve secured a user connection, all Jetpack features will be available for use.',
46
- 'jetpack'
47
- ) }
48
- </Text>
49
-
50
- <div className={ styles[ 'modal-actions' ] }>
51
- <Button
52
- isExternalLink={ true }
53
- weight="regular"
54
- isLoading={ userIsConnecting }
55
- onClick={ handleConnectUser }
56
- >
57
- { __( 'Connect your user account', 'jetpack' ) }
58
- </Button>
59
- </div>
60
- </>
61
- );
62
- };
63
-
64
- export default UserConnectionGate;