Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

653 B
Raw Blame
import type { ExistingLink, PeekedToken } from './shared';

export const isSingleAccountRebindBlocked = (
  existingLink?: ExistingLink | null,
  tokenData?: PeekedToken | null,
): boolean =>
  !!(
    existingLink &&
    tokenData &&
    existingLink.platformUserId &&
    existingLink.platformUserId !== tokenData.platformUserId
  );

export const shouldShowSingleAccountSuccess = (
  existingLink?: ExistingLink | null,
  tokenData?: PeekedToken | null,
  done?: boolean,
): boolean => {
  if (done) return true;
  if (!existingLink) return false;
  if (!tokenData) return true;

  return existingLink.platformUserId === tokenData.platformUserId;
};