()
| 11 | import { useTranslation } from 'next-i18next' |
| 12 | |
| 13 | export const Purchase = () => { |
| 14 | const [shouldShowLicense, setShouldShowLicense] = useState(false) |
| 15 | const router = useRouter() |
| 16 | const { t } = useTranslation('common') |
| 17 | |
| 18 | const includedFeatures = useMemo(() => { |
| 19 | return [t('feature_1'), t('feature_2'), t('feature_3')] |
| 20 | }, [t]) |
| 21 | |
| 22 | useEffect(() => { |
| 23 | const newLicenseKey = router.query.license_key as string |
| 24 | console.log({ newLicenseKey }) |
| 25 | |
| 26 | if (newLicenseKey) { |
| 27 | clientValidateLicenseKey(newLicenseKey) |
| 28 | .then(({ isValid }) => { |
| 29 | if (isValid) { |
| 30 | saveLicenseKey(newLicenseKey) |
| 31 | toast(t('thanks_to_buy'), { icon: '✅' }) |
| 32 | } |
| 33 | }) |
| 34 | .then(() => { |
| 35 | setShouldShowLicense(true) |
| 36 | }) |
| 37 | } else { |
| 38 | if (loadLicenseKey()) { |
| 39 | setShouldShowLicense(true) |
| 40 | } |
| 41 | } |
| 42 | // eslint-disable-next-line react-hooks/exhaustive-deps |
| 43 | }, [router.query.license_key]) |
| 44 | |
| 45 | return ( |
| 46 | <div className="bg-white py-24 sm:py-32"> |
| 47 | <div className="mx-auto max-w-7xl px-6 lg:px-8"> |
| 48 | <div className="mx-auto max-w-2xl sm:text-center"> |
| 49 | <h2 className="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl"> |
| 50 | {t('price')} |
| 51 | </h2> |
| 52 | <p className="mt-6 text-lg leading-8 text-gray-600"> |
| 53 | {t('please_buy', { |
| 54 | rateLimitCount: RATE_LIMIT_COUNT, |
| 55 | })} |
| 56 | </p> |
| 57 | </div> |
| 58 | <div className="mx-auto mt-16 max-w-2xl rounded-3xl ring-1 ring-gray-200 sm:mt-20 lg:mx-0 lg:flex lg:max-w-none"> |
| 59 | <div className="p-8 sm:p-10 lg:flex-auto"> |
| 60 | <h3 className="text-2xl font-bold tracking-tight text-gray-900"> |
| 61 | {t('pay_to_use')} |
| 62 | </h3> |
| 63 | <p className="mt-6 text-base leading-7 text-gray-600"> |
| 64 | {t('pay_to_use_p1')} |
| 65 | </p> |
| 66 | <div className="mt-10 flex items-center gap-x-4"> |
| 67 | <h4 className="flex-none text-sm font-semibold leading-6 text-indigo-600"> |
| 68 | {t('pay_to_use_p2')} |
| 69 | </h4> |
| 70 | <div className="h-px flex-auto bg-gray-100" /> |
nothing calls this directly
no test coverage detected