UNPKG

crisp-api

Version:

Crisp API wrapper for Node - official, maintained by Crisp

123 lines (122 loc) 3.82 kB
/************************************************************************** * IMPORTS ***************************************************************************/ import BaseResource from "./BaseResource"; /************************************************************************** * INTERFACES ***************************************************************************/ export interface WebsiteVisitorCount { count?: number; active?: number; limited?: boolean; } export interface WebsiteVisitor { session_id?: string; inbox_id?: string; nickname?: string; email?: string; avatar?: string; useragent?: string; initiated?: boolean; active?: boolean; last_page?: WebsiteVisitorLastPage; geolocation?: WebsiteVisitorGeolocation; timezone?: number; capabilities?: string[]; locales?: string[]; } export interface WebsiteVisitorLastPage { page_title?: string; page_url?: string; } export interface WebsiteVisitorGeolocation { coordinates?: WebsiteVisitorGeolocationCoordinates; city?: string; region?: string; country?: string; } export interface WebsiteVisitorGeolocationCoordinates { latitude?: number; longitude?: number; } export interface WebsiteVisitorsMapPointsData { data?: WebsiteVisitorsMapPoint[]; } export interface WebsiteVisitorsMapPoint { visitors?: WebsiteVisitorsMapPointVisitors; geolocation?: WebsiteVisitorsMapPointGeolocation; } export interface WebsiteVisitorsMapPointGeolocation { coordinates?: WebsiteVisitorsMapPointGeolocationCoordinates; city?: string; region?: string; country?: string; } export interface WebsiteVisitorsMapPointGeolocationCoordinates { latitude?: number; longitude?: number; } export interface WebsiteVisitorsMapPointVisitors { count?: number; threshold?: number; sessions?: WebsiteVisitorsMapPointVisitorsSession[]; } export interface WebsiteVisitorsMapPointVisitorsSession { session_id?: string; nickname?: string; email?: string; avatar?: string; initiated?: boolean; active?: boolean; last_page?: WebsiteVisitorLastPage; timezone?: number; capabilities?: string[]; locales?: string[]; } export interface WebsiteVisitorsToken { session_id?: string; } export interface WebsiteVisitorsBlocked { rule?: string[]; blocked?: number; } /************************************************************************** * CLASSES ***************************************************************************/ /** * Crisp WebsiteVisitors Resource */ declare class WebsiteVisitors extends BaseResource { /** * Count Visitors */ countVisitors(websiteID: string): Promise<WebsiteVisitorCount>; /** * List Visitors */ listVisitors(websiteID: string, pageNumber?: number): Promise<WebsiteVisitor[]>; /** * Pinpoint Visitors On A Map */ pinpointVisitorsOnMap(websiteID: string, centerLongitude: number, centerLatitude: number, centerRadius: number): Promise<WebsiteVisitorsMapPoint[]>; /** * Get Session Identifier From Token */ getSessionIdentifierFromToken(websiteID: string, tokenID: string): Promise<WebsiteVisitorsToken>; /** * Count Blocked Visitors */ countBlockedVisitors(websiteID: string): Promise<WebsiteVisitorsBlocked>; /** * Count Blocked Visitors In Rule */ countBlockedVisitorsInRule(websiteID: string, rule: string): Promise<number>; /** * Clear Blocked Visitors In Rule */ clearBlockedVisitorsInRule(websiteID: string, rule: string): Promise<any>; } /************************************************************************** * EXPORTS ***************************************************************************/ export default WebsiteVisitors;