declare let window: any;

export const identify = (userAddress: string, userEmail?: string) => {
  if (window?.heap) {
    window.heap.identify(userAddress);

    if (userEmail) {
      window.heap.addUserProperties({ email: userEmail });
    }
  }
};

export const hover = (payload: Record<string, any>) => {
  return () => {
    return window?.heap && window.heap.track('hover', payload);
  };
};

export const click = (payload: Record<string, any>) => {
  if (window?.heap) {
    window.heap.track('click', payload);
  }
};
