AuthAlert.tsx59 lines · main
| 1 | import { useParams } from 'common' |
| 2 | import { ExternalLink } from 'lucide-react' |
| 3 | import Link from 'next/link' |
| 4 | import { Alert, AlertDescription, AlertTitle, Button, WarningIcon } from 'ui' |
| 5 | |
| 6 | import { DOCS_URL } from '@/lib/constants' |
| 7 | |
| 8 | export const AuthAlert = ({ |
| 9 | title, |
| 10 | isHookSendSMSEnabled, |
| 11 | }: { |
| 12 | title: string |
| 13 | isHookSendSMSEnabled: boolean |
| 14 | }) => { |
| 15 | const { ref } = useParams() |
| 16 | |
| 17 | switch (title) { |
| 18 | // TODO (KM): Remove after 10th October 2024 when we disable the provider |
| 19 | case 'Slack (Deprecated)': |
| 20 | return ( |
| 21 | <Alert variant="warning"> |
| 22 | <WarningIcon /> |
| 23 | <AlertTitle>Slack (Deprecated) Provider</AlertTitle> |
| 24 | <AlertDescription> |
| 25 | Recently, Slack has updated their OAuth API. Please use the new Slack (OIDC) provider |
| 26 | below. Developers using this provider should move over to the new provider. Please refer |
| 27 | to our{' '} |
| 28 | <a |
| 29 | href={`${DOCS_URL}/guides/auth/social-login/auth-slack`} |
| 30 | className="underline" |
| 31 | target="_blank" |
| 32 | > |
| 33 | documentation |
| 34 | </a>{' '} |
| 35 | for more details. |
| 36 | </AlertDescription> |
| 37 | </Alert> |
| 38 | ) |
| 39 | case 'Phone': |
| 40 | return ( |
| 41 | isHookSendSMSEnabled && ( |
| 42 | <Alert> |
| 43 | <WarningIcon /> |
| 44 | <AlertTitle> |
| 45 | SMS provider settings are disabled while the SMS hook is enabled. |
| 46 | </AlertTitle> |
| 47 | <AlertDescription className="flex flex-col gap-y-3"> |
| 48 | <p>The SMS hook will be used in place of the SMS provider configured</p> |
| 49 | <Button asChild type="default" className="w-min" icon={<ExternalLink />}> |
| 50 | <Link href={`/project/${ref}/auth/hooks`}>View auth hooks</Link> |
| 51 | </Button> |
| 52 | </AlertDescription> |
| 53 | </Alert> |
| 54 | ) |
| 55 | ) |
| 56 | default: |
| 57 | return null |
| 58 | } |
| 59 | } |