// Cross-platform haptic feedback. The app fires one Haptic vocabulary from its interaction code
// (tile placement, submit, errors); this routes it to whichever host Mini App is in play —
// Telegram's HapticFeedback or VK Bridge's taptic events — and stays silent in a plain browser.

import { type Haptic, telegramHaptic } from './telegram';
import { insideVK, vkHaptic } from './vk';

/**
 * haptic fires the host Mini App's haptic feedback for kind: Telegram's HapticFeedback inside
 * Telegram and VK Bridge's taptic inside VK; a no-op in an ordinary browser. Both backends
 * self-guard off their platform, so this is always safe to call. The VK send is fire-and-forget.
 */
export function haptic(kind: Haptic): void {
  telegramHaptic(kind);
  if (insideVK()) void vkHaptic(kind);
}
