: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
import React from 'react';
import UIButton from '../UIComponents/UIButton';
import UIContainer from '../UIComponents/UIContainer';
import HubspotWrapper from './HubspotWrapper';
import { adminUrl, redirectNonce } from '../../constants/leadinConfig';
import { pluginPath } from '../../constants/leadinConfig';
import { __ } from '@wordpress/i18n';
interface IErrorHandlerProps {
resetErrorState?: React.MouseEventHandler<HTMLButtonElement>;
function redirectToPlugin() {
window.location.href = `${adminUrl}admin.php?page=leadin&leadin_expired=${redirectNonce}`;
export default function ErrorHandler({
errorInfo = { header: '', message: '', action: '' },
const isUnauthorized = status === 401 || status === 403;
const errorHeader = isUnauthorized
? __("Your plugin isn't authorized", 'leadin')
const errorMessage = isUnauthorized
? __('Reauthorize your plugin to access your free HubSpot tools', 'leadin')
<HubspotWrapper pluginPath={pluginPath}>
<UIContainer textAlign="center">
<UIButton data-test-id="authorize-button" onClick={redirectToPlugin}>
{__('Go to plugin', 'leadin')}
<UIButton data-test-id="retry-button" onClick={resetErrorState}>