-
Notifications
You must be signed in to change notification settings - Fork 802
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
116 additions
and
94 deletions.
There are no files selected for viewing
168 changes: 79 additions & 89 deletions
168
projects/plugins/protect/src/js/routes/firewall/firewall-subheading.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
projects/plugins/protect/src/js/routes/firewall/firewall-upgrade-prompt.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Button } from '@automattic/jetpack-components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { useCallback } from 'react'; | ||
import useAnalyticsTracks from '../../hooks/use-analytics-tracks'; | ||
import usePlan from '../../hooks/use-plan'; | ||
import useWafData from '../../hooks/use-waf-data'; | ||
import styles from './styles.module.scss'; | ||
|
||
const FirewallUpgradePrompt = () => { | ||
const { recordEvent } = useAnalyticsTracks(); | ||
const { adminUrl } = window.jetpackProtectInitialState || {}; | ||
const firewallUrl = adminUrl + '#/firewall'; | ||
const { upgradePlan } = usePlan( { redirectUrl: firewallUrl } ); | ||
|
||
const { | ||
config: { automaticRulesAvailable }, | ||
} = useWafData(); | ||
|
||
const getScan = useCallback( () => { | ||
recordEvent( 'jetpack_protect_waf_header_get_scan_link_click' ); | ||
upgradePlan(); | ||
}, [ recordEvent, upgradePlan ] ); | ||
|
||
return ( | ||
<Button className={ styles[ 'upgrade-prompt-button' ] } onClick={ getScan }> | ||
{ ! automaticRulesAvailable | ||
? __( 'Upgrade to enable automatic firewall protection', 'jetpack-protect' ) | ||
: __( | ||
'Upgrade to update automatic security rules', | ||
'jetpack-protect', | ||
/* dummy arg to avoid bad minification */ 0 | ||
) } | ||
</Button> | ||
); | ||
}; | ||
|
||
export default FirewallUpgradePrompt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters