import freemius from "../utils/freemius";
import {__} from "@wordpress/i18n";
import {Button} from "@wordpress/components";
import {heading} from "@wordpress/icons";

function UpgradeButton() {

	let url: string | undefined;
	let label: string | undefined;

	if (!freemius.is_premium) {
		url = freemius.checkout_url;
		label = __('Get Pro', 'advanced-fields-for-elementor-forms');
	} else if (freemius.is_not_paying) {
		url = freemius.get_upgrade_url;
		label = __('Upgrade Now!', 'advanced-fields-for-elementor-forms');
	} else {
		return null;
	}

	return (
		<Button
			type={'button'}
			size={'compact'}
			variant={'primary'}
			href={url}
			icon={heading}
		>
			{label}
		</Button>
	)
}

export default UpgradeButton;
