@incognia/web-sdk 1.23.0 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ declare global {
4
4
  }
5
5
  }
6
6
  export type Identity = {
7
+ /** The unique identifier of the user's account. This value is used to associate this event with the user's account. */
7
8
  accountId: string;
8
9
  };
9
10
  /**
@@ -13,58 +14,95 @@ export type GetSessionTokenParams = {
13
14
  askForGeolocation: boolean;
14
15
  };
15
16
  export type GenerateRequestTokenParams = {
17
+ /** Whether to attempt collecting geolocation data (may require user permission). */
16
18
  askForGeolocation?: boolean;
19
+ /** The maximum length of the generated request token. If not specified, the default value (8KB) will be used. */
17
20
  maxLength?: number;
21
+ /** Wait for the data collection to be sent to our servers before generating the request token. This ensures that the most up-to-date data is used, but may increase the time required to generate the token. The delay is most noticeable immediately after the initial init call. After the first token generation, the SDK will have already collected the necessary data, and subsequent delays should be minimal. */
18
22
  ensureDataCollection?: boolean;
23
+ /** The maximum time (ms) to wait for data collection to complete when ensureDataCollection is enabled. If the timeout is reached before data collection finishes, the SDK will generate the request token anyway. If not specified, the SDK will wait until data collection is complete. */
19
24
  dataCollectionTimeoutMs?: number;
20
25
  };
21
26
  export type EventProperties = Record<string, string | number | boolean>;
22
27
  export type EventAddress = {
28
+ /** Locale used for formatting or interpreting the address (e.g., "en-US", "pt-BR"). */
23
29
  locale?: string;
30
+ /** Country code (e.g., "US", "BR"). */
24
31
  countryCode?: string;
32
+ /** Full country name (e.g., "United States", "Brazil"). */
25
33
  countryName?: string;
34
+ /** State, province, or region name (e.g., "California"). */
26
35
  state?: string;
36
+ /** City or municipality name (e.g., "New York City"). */
27
37
  city?: string;
38
+ /** Neighborhood, district, or suburb within the city (e.g., "Manhattan"). */
28
39
  neighborhood?: string;
40
+ /** Street number. Can be a string for cases like "12A" or "S/N". */
29
41
  number?: string | number;
42
+ /** Street name (e.g., "Fifth Avenue"). */
30
43
  street?: string;
44
+ /** Postal or ZIP code (e.g., "10118"). Can be string or number depending on format. */
31
45
  postalCode?: string | number;
46
+ /** Full address line (free-form), typically combining street, number, and complement. */
32
47
  addressLine?: string;
48
+ /** Latitude coordinate */
33
49
  latitude?: number;
50
+ /** Longitude coordinate */
34
51
  longitude?: number;
35
52
  };
36
53
  export type CustomEventParams = {
54
+ /** A tag that can be used to categorize the type of event. */
37
55
  tag: string;
56
+ /** The unique identifier of the user's account. This value is used to associate this event with the user's account. If value is number it will be converted to string. */
38
57
  accountId?: string | number;
58
+ /** A unique identifier for the attempt, allowing you to identify and analyze Incognia's results. */
39
59
  externalId?: string | number;
60
+ /** The address related to the mapped event. */
40
61
  address?: EventAddress;
62
+ /** A map of additional properties that can be used to provide more context about the event and help Incognia's analysis. Keys must be strings, and values may be of type Boolean, String or Number. */
41
63
  properties?: EventProperties;
42
64
  };
43
65
  export type IncogniaOptions = {
66
+ /** The unique identifier of your application, which can be found in the Incognia dashboard. */
44
67
  appId?: string;
68
+ /** Enables debug logging. */
45
69
  logEnabled?: boolean;
70
+ /** Enables the SDK to gather user interaction data on the webpage, such as mouse movements and clicks. */
46
71
  trackUserInteraction?: boolean;
72
+ /** A custom domain to be used for the SDK's requests. */
47
73
  customDomain?: string;
74
+ /** Sets the maximum length, in bytes, that a request token generated by the SDK should have. It must be set to an integer no smaller than 1000. */
48
75
  requestTokenMaxLength?: number;
76
+ /** Domain from which the Incognia SDK script is loaded. This value is set through Incognia Options and determines the CDN domain used by the SDK loader to fetch the artifact. */
49
77
  scriptSrcDomain?: string;
78
+ /** Enables the SDK to detect whether Incognia's domains are blocked. This intentionally triggers a network error visible in the browser's DevTools console. */
50
79
  domainBlockerDetectionEnabled?: boolean;
80
+ /** Enables the SDK to use cookies for storing identifiers. */
51
81
  cookieEnabled?: boolean;
82
+ /** The domain to be used for the SDK's cookies. Should be used to allow cookies across a shared subdomain (e.g., a domain=incognia.com will use the same identifier for dashboard.incognia.com and developer.incognia.com). */
52
83
  cookieDomain?: string;
84
+ /** Enables the SDK to collect motion sensor data (accelerometer and gyroscope). */
85
+ sensorsEnabled?: boolean;
53
86
  };
54
87
  declare class IncogniaWebSdk {
55
88
  #private;
89
+ /** Initializes the Incognia SDK with the app id or options parameters. */
56
90
  init(appIdOrOptions: string | IncogniaOptions): Promise<void>;
91
+ /** Sets an account id. */
57
92
  setAccountId(accountId: string | number): Promise<void>;
93
+ /** Clears the account id. */
58
94
  clearAccountId(): Promise<void>;
59
95
  /**
60
96
  * @deprecated Since v1.2.0 - Use `setAccountId` to set a new account id and `clearAccountId` to clear the account id instead.
61
97
  */
62
98
  identify(identity: Identity): Promise<void>;
99
+ /** Generates the request token. */
63
100
  generateRequestToken(options?: GenerateRequestTokenParams): Promise<string | undefined>;
64
101
  /**
65
102
  * @deprecated Since v1.2.0 - Use `generateRequestToken` instead.
66
103
  */
67
104
  getSessionToken(options?: GetSessionTokenParams): Promise<string | undefined>;
105
+ /** Sends a custom event with the specified parameters. */
68
106
  sendCustomEvent(params: CustomEventParams): Promise<void>;
69
107
  sendLocationEvent(): Promise<void>;
70
108
  }