import { __ } from '@wordpress/i18n';
import { UPGRADE_LINK } from '../../constants';
import { getUpgradeLink } from '../../../../../../assets/dev/js/utils';
const getErrorButton = ( { errorType, imagesLeft, allowRetry } ) => {
const isElementorOne = window?.imageOptimizerUserData?.isElementorOne || false;
if ( 'auth-error' === errorType ) {
const connectLink = window?.imageOptimizerControlSettings?.connectLink;
return `
${ __( 'Connect', 'image-optimization' ) }
`;
} else if ( 'connection-error' === errorType ) {
return `
`;
} else if ( typeof imagesLeft !== 'undefined' && 0 === imagesLeft ) {
if ( isElementorOne ) {
return '';
}
const subscriptionId = window?.imageOptimizerUserData?.planData?.subscription_id;
return `
${ __( 'Upgrade', 'image-optimization' ) }
`;
} else if ( allowRetry ) {
return `
`;
}
};
export {
getErrorButton,
};