import { ActionButton, getRedirectUrl } from '@automattic/jetpack-components'; import { useProductCheckoutWorkflow, useConnection } from '@automattic/jetpack-connection'; import { createInterpolateElement } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import React from 'react'; import backupVideoThumbnail from './images/jetpack-backup-video-thumbnail.png'; import './style.scss'; const BackupVideoSection = ( { siteProductAvailabilityHandler, apiRoot, apiNonce, registrationNonce, } ) => { const { run: handleCheckoutWorkflow, hasCheckoutStarted } = useProductCheckoutWorkflow( { productSlug: 'jetpack_backup_t1_yearly', redirectUrl: 'admin.php?page=jetpack-backup', siteProductAvailabilityHandler, from: 'jetpack-backup', } ); const { siteIsRegistering, userIsConnecting, isOfflineMode, registrationError } = useConnection( { registrationNonce: registrationNonce, redirectUri: 'admin.php?page=jetpack-backup', apiRoot: apiRoot, apiNonce: apiNonce, autoTrigger: false, from: 'jetpack-backup', } ); const errorMessage = isOfflineMode ? createInterpolateElement( __( 'Unavailable in Offline Mode', 'jetpack-backup-pkg' ), { a: ( ), } ) : undefined; const buttonIsLoading = siteIsRegistering || userIsConnecting || hasCheckoutStarted; const displayButtonError = Boolean( registrationError ); return (

{ __( 'Take a walkthrough of VaultPress Backup', 'jetpack-backup-pkg' ) }

{ __( 'Save every change and get back online quickly with one-click restores.', 'jetpack-backup-pkg' ) }

{ /* eslint-disable-next-line jsx-a11y/media-has-caption */ }
); }; export { BackupVideoSection };