Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.6 KB
Raw Blame
import { CreateOtpRequestBody, OtpType } from '@activepieces/shared';
import { t } from 'i18next';
import { MailCheck } from 'lucide-react';
import { toast } from 'sonner';

import { authMutations } from '../hooks/auth-hooks';

const CheckEmailNote = ({ email, type }: CreateOtpRequestBody) => {
  const { mutate: resendVerification } = authMutations.useSendOtpEmail({
    onSuccess: () => {
      toast.success(
        type === OtpType.EMAIL_VERIFICATION
          ? t('Verification email resent, if previous one expired.')
          : t('Password reset link resent, if previous one expired.'),
        {
          duration: 3000,
        },
      );
    },
  });
  return (
    <div className="gap-2 w-full flex flex-col">
      <div className="gap-4 w-full flex flex-row items-center justify-center">
        <MailCheck className="w-16 h-16" />
        <span className="text-left w-fit">
          {type === OtpType.EMAIL_VERIFICATION
            ? t('We sent you a link to complete your registration to')
            : t('We sent you a link to reset your password to')}
          <strong>&nbsp;{email}</strong>.
        </span>
      </div>
      <div className="flex flex-row gap-1">
        {t("Didn't receive an email or it expired?")}
        <button
          className="cursor-pointer text-accent-11 underline"
          onClick={() =>
            resendVerification({
              email,
              type,
            })
          }
        >
          {t('Resend')}
        </button>
      </div>
    </div>
  );
};

CheckEmailNote.displayName = 'CheckEmailNote';
export { CheckEmailNote };