Skip to content

Commit

Permalink
feat: add confidence score, visitor found, and timestamps to data types
Browse files Browse the repository at this point in the history
  • Loading branch information
makma committed Mar 29, 2022
1 parent b000f36 commit 97d8c39
Show file tree
Hide file tree
Showing 10 changed files with 2,755 additions and 122 deletions.
77 changes: 29 additions & 48 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,39 @@ export interface Options {
authenticationMode?: AuthenticationMode;
}

/**
* More info: https://dev.fingerprintjs.com/docs/server-api#query-parameters
*/
export type VisitorHistoryFilter = {
request_id?: string;
linked_id?: string;
limit?: number;
before?: number;
};

/**
* More info: https://dev.fingerprintjs.com/docs/server-api#response
*/
export interface VisitorsResponse {
lastTimestamp?: string;
visitorId: string;
visits: Visit[];
lastTimestamp?: number;
}

export interface Visit {
requestId: string;
incognito: string;
linkedId: 'string';
linkedId: string;
time: Date;
timestamp: number;
url: string;
ip: string;
ipLocation: IpLocation;
browserDetails: BrowserDetails;
confidence: Confidence;
visitorFound: boolean;
firstSeenAt: SeenAt;
lastSeenAt: SeenAt;
}

export interface IpLocation {
Expand Down Expand Up @@ -94,93 +104,64 @@ export interface BrowserDetails {
userAgents: string;
}

export interface Confidence {
score: number;
}

export interface SeenAt {
global: Date | null;
subscription: Date | null;
}

/**
* More info: https://dev.fingerprintjs.com/docs/webhooks#identification-webhook-object-format
*/
export interface VisitWebhook {
// Unique request identifier
// nullable: false, maxLength: 20
requestId: string;
// customer-provided data, for example requestType and yourCustomId
// both the tag and the information it contains are optional
// and only for the customer's need.
// nullable: true, maxLength: 4096
tag: any | null;
// user-provided scalar identifier
// nullable: true, maxLength: 4096
linkedId: string | null;
// persistent visitor identifier
// helpful to detect anonymous or private mode users
// nullable: false, maxLength: 20
visitorId: string;
// timestamp in milliseconds (since unix epoch)
// nullable: false
visitorFound: boolean | null;
timestamp: number;
// if the page view was made in incognito or private mode
// nullable: false
time: Date;
incognito: boolean;
// URL where the API was called in the browser
// nullable: false, maxLength: 4096
url: string;
// The URL of a client-side referrer
// nullable: true, maxLength: 4096
clientReferrer: string | null;
// nullable: false, maxLength: 40
ip: string;
// nullable: false
ipLocation: {
// miles
// nullable: true
accuracyRadius: number | null;
// nullable: true
city: {
// nullable: true, maxLength: 4096
name: string | null;
} | null;
// nullable: true
continent: {
// nullable: true, maxLength: 2
code: string | null;
// nullable: true, maxLength: 40
name: string | null;
} | null;
// nullable: true
country: {
// nullable: true, maxLength: 2
code: string | null;
// nullable: true, maxLength: 250
name: string | null;
} | null;
// nullable: true
latitude: number | null;
// nullable: true
longitude: number | null;
// nullable: true, maxLength: 40
postalCode: string | null;
// nullable: true
subdivisions:
| {
// nullable: true, maxLength: 250
isoCode: string | null;
// nullable: true, maxLength: 250
name: string | null;
}[]
| null;
// nullable: true, maxLength: 250
timezone: string | null;
};
// nullable: false
browserDetails: {
// nullable: true, maxLength: 250
browserName: string | null;
// nullable: true, maxLength: 250
browserFullVersion: string | null;
// nullable: true, maxLength: 250
browserMajorVersion: string | null;
// nullable: true, maxLength: 250
os: string | null;
// nullable: true, maxLength: 250
osVersion: string | null;
// nullable: true, maxLength: 250
device: string | null;
// nullable: true, maxLength: 4096
userAgent: string | null;
};
confidence: Confidence | null;
firstSeenAt: SeenAt;
lastSeenAt: SeenAt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ Object {
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36",
},
"clientReferrer": "https: //www.martinmakarsky.com/",
"confidence": Object {
"score": 0.97,
},
"firstSeenAt": Object {
"global": "2022-03-16T11:26:45.362Z",
"subscription": "2022-03-16T11:31:01.101Z",
},
"incognito": false,
"ip": "185.5.70.59",
"ipLocation": Object {
Expand All @@ -31,6 +38,10 @@ Object {
"organization": Object {},
"timezone": "Europe/Prague",
},
"lastSeenAt": Object {
"global": "2022-03-16T11:28:34.023Z",
"subscription": null,
},
"linkedId": "makma",
"requestId": "1627054081281.wo4lLc",
"tag": Object {
Expand All @@ -39,6 +50,7 @@ Object {
"time": "",
"timestamp": 1627054081282,
"url": "https://www.martinmakarsky.com/not-very-secret-experiment-page",
"visitorFound": true,
"visitorId": "TaDnMBz9XCpZNuSzFUqP",
}
`;
Loading

0 comments on commit 97d8c39

Please sign in to comment.