import { Analytics } from '../../../core/analytics' import { getStorage } from '../utils' export const ZOOM_INFO_KEY = '_ziVisitorInfo' interface IZoomInfoData { status: string ziDetails?: { companyName: string country: string employeeCount: string primaryIndustry: string revenue: string website?: string } } export async function loadZoomInfo(analytics: Analytics): Promise { const data = getStorage(ZOOM_INFO_KEY) as IZoomInfoData | null if ( !data || data.status !== 'success' || !data.ziDetails || !data.ziDetails.website || analytics.group().traits()?.website ) { return } const reveal = data.ziDetails await analytics.group(null, { website: reveal.website, intentSource: 'zoominfo', name: reveal.companyName || undefined, country: reveal.country || undefined, industry: reveal.primaryIndustry || undefined, number_of_employees: reveal.employeeCount || undefined, annual_revenue: reveal.revenue || undefined, }) }