clarity-js 0.7.48 → 0.7.49

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.
@@ -37,6 +37,7 @@ export default async function (type: Event, ts: number = null): Promise<void> {
37
37
  tokens.push(pTarget.id);
38
38
  tokens.push(entry.data.x);
39
39
  tokens.push(entry.data.y);
40
+ if (entry.data.id !== undefined) { tokens.push(entry.data.id); }
40
41
  queue(tokens);
41
42
  baseline.track(entry.event, entry.data.x, entry.data.y);
42
43
  }
@@ -58,8 +58,13 @@ function touch(event: Event, root: Node, evt: TouchEvent): void {
58
58
  x = x && frame ? x + Math.round(frame.offsetLeft) : x;
59
59
  y = y && frame ? y + Math.round(frame.offsetTop) : y;
60
60
 
61
+ // identifier is 0-based, unique for each touch point and resets when all fingers are lifted
62
+ // that is not a part of the spec, but it is how it is implemented in browsers
63
+ // tested in Chromium-based browsers as well as Firefox
64
+ const id = "identifier" in entry ? entry["identifier"] : undefined;
65
+
61
66
  // Check for null values before processing this event
62
- if (x !== null && y !== null) { handler({ time: t, event, data: { target: target(evt), x, y } }); }
67
+ if (x !== null && y !== null) { handler({ time: t, event, data: { target: target(evt), x, y, id } }); }
63
68
  }
64
69
  }
65
70
  }
package/types/data.d.ts CHANGED
@@ -237,7 +237,7 @@ export const enum Setting {
237
237
  MinUploadDelay = 100, // Minimum time before we are ready to flush events to the server
238
238
  MaxUploadDelay = 30 * Time.Second, // Do flush out payload once every 30s,
239
239
  ExtractLimit = 10000, // Do not extract more than 10000 characters
240
- ChecksumPrecision = 24, // n-bit integer to represent token hash
240
+ ChecksumPrecision = 28, // n-bit integer to represent token hash
241
241
  UploadTimeout = 15000 // Timeout in ms for XHR requests
242
242
  }
243
243
 
@@ -104,6 +104,7 @@ export interface PointerData {
104
104
  target: Target;
105
105
  x: number;
106
106
  y: number;
107
+ id?: number;
107
108
  }
108
109
 
109
110
  export interface ClickData {