From 263ea9a29da4781272ac5ff2105cfcd59b3d94c3 Mon Sep 17 00:00:00 2001 From: Jesse Wang Date: Thu, 24 Oct 2024 14:07:19 -0700 Subject: [PATCH 1/4] chore(session-replay): fixing typing issues with rrweb --- .../session-replay-browser/src/events/event-compressor.ts | 2 +- packages/session-replay-browser/src/hooks/click.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/session-replay-browser/src/events/event-compressor.ts b/packages/session-replay-browser/src/events/event-compressor.ts index 3c9945289..4581ec023 100644 --- a/packages/session-replay-browser/src/events/event-compressor.ts +++ b/packages/session-replay-browser/src/events/event-compressor.ts @@ -1,7 +1,7 @@ import type { eventWithTime } from '@amplitude/rrweb-types'; import { SessionReplayJoinedConfig } from 'src/config/types'; import { SessionReplayEventsManager } from 'src/typings/session-replay'; -import { pack } from '@amplitude/rrweb'; +import { pack } from '@amplitude/rrweb-packer'; import { getGlobalScope } from '@amplitude/analytics-client-common'; interface TaskQueue { diff --git a/packages/session-replay-browser/src/hooks/click.ts b/packages/session-replay-browser/src/hooks/click.ts index b188bc9df..8767f3720 100644 --- a/packages/session-replay-browser/src/hooks/click.ts +++ b/packages/session-replay-browser/src/hooks/click.ts @@ -96,8 +96,8 @@ export const clickHook: (options: Options) => mouseInteractionCallBack = const { left: scrollX, top: scrollY } = utils.getWindowScroll(globalScope as unknown as Window); const event: ClickEvent = { - x: x + scrollX, - y: y + scrollY, + x: ( x ?? 0 ) + scrollX, + y: ( y ?? 0 ) + scrollY, selector, viewportHeight: innerHeight, From ad3d2da1a5f47c5d8288537cb40d793a0af4c8da Mon Sep 17 00:00:00 2001 From: Jesse Wang Date: Fri, 25 Oct 2024 13:45:54 -0700 Subject: [PATCH 2/4] chore(session replay): add in rrweb update changes --- packages/session-replay-browser/package.json | 4 +- yarn.lock | 83 ++++++++++++++------ 2 files changed, 64 insertions(+), 23 deletions(-) diff --git a/packages/session-replay-browser/package.json b/packages/session-replay-browser/package.json index 551636731..fddc59bba 100644 --- a/packages/session-replay-browser/package.json +++ b/packages/session-replay-browser/package.json @@ -42,7 +42,9 @@ "@amplitude/analytics-core": ">=1 <3", "@amplitude/analytics-remote-config": "^0.4.1", "@amplitude/analytics-types": ">=1 <3", - "@amplitude/rrweb": "2.0.0-alpha.21", + "@amplitude/rrweb": "2.0.0-alpha.25", + "@amplitude/rrweb-snapshot": "2.0.0-alpha.25", + "@amplitude/rrweb-packer": "2.0.0-alpha.25", "idb": "^8.0.0", "tslib": "^2.4.1" }, diff --git a/yarn.lock b/yarn.lock index d56aad664..251a0282f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -116,37 +116,52 @@ "@amplitude/analytics-types" "^2.1.1" tslib "^2.4.1" -"@amplitude/rrdom@^2.0.0-alpha.21": - version "2.0.0-alpha.21" - resolved "https://registry.yarnpkg.com/@amplitude/rrdom/-/rrdom-2.0.0-alpha.21.tgz#e6f5e2b511676032ceaad2e4667f9755777f477b" - integrity sha512-o6mPzNd8BgmiRDFaKB4fz4E2v3TL5+CzioD9mjrA167vurgFD9kak6d9s9DDxy+gVvRXoQ8bf3myyZLzPNVg4Q== +"@amplitude/rrdom@^2.0.0-alpha.25": + version "2.0.0-alpha.25" + resolved "https://registry.yarnpkg.com/@amplitude/rrdom/-/rrdom-2.0.0-alpha.25.tgz#c44c1bbcaee9e95148b3998912f6cb2ca085475f" + integrity sha512-GTdwpDJmwAZcllNmGH3xmLEfKkMhOqmqkpG9G0MVGdhRmL3pTAhmSZuyPUYUho71ZjKQtGnHMDPgfOtniWsWbw== dependencies: - "@amplitude/rrweb-snapshot" "^2.0.0-alpha.21" + "@amplitude/rrweb-snapshot" "^2.0.0-alpha.25" -"@amplitude/rrweb-snapshot@^2.0.0-alpha.21": - version "2.0.0-alpha.21" - resolved "https://registry.yarnpkg.com/@amplitude/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.21.tgz#16098883f93203f8341ddb39500148bb69059795" - integrity sha512-7zVdfdItDk6cFeYr3sMn1JypAAFDbEjb26G7PgoJHqWE6avMhtYdW3gxAlvRX4DTR3cLw/8rd31jHIZpDKFOgg== +"@amplitude/rrweb-packer@2.0.0-alpha.25": + version "2.0.0-alpha.25" + resolved "https://registry.yarnpkg.com/@amplitude/rrweb-packer/-/rrweb-packer-2.0.0-alpha.25.tgz#e83fd577da7979b52a0262ddad5ea68c30bd4d7c" + integrity sha512-VqQ24tPDfP55Y1XlqC/hBvheyUxREruYhOnwvTzcHo+1bCVlMuru07j50oVv/SW3FHmY6t4k6LL1sQNZGGbx8g== + dependencies: + "@amplitude/rrweb-types" "^2.0.0-alpha.25" + fflate "^0.4.4" -"@amplitude/rrweb-types@^2.0.0-alpha.21": - version "2.0.0-alpha.21" - resolved "https://registry.yarnpkg.com/@amplitude/rrweb-types/-/rrweb-types-2.0.0-alpha.21.tgz#b375f9459206a2a3c6ab164671c0b05d021225e2" - integrity sha512-y6iuwJBdtTPgcrsf7T13LVhpWtuJp8yscXGU/FXyHMpGzXLRjKxos/3hNVZ6hKAYV3kiVInED4JIViqmaXOdcQ== +"@amplitude/rrweb-snapshot@2.0.0-alpha.25", "@amplitude/rrweb-snapshot@^2.0.0-alpha.25": + version "2.0.0-alpha.25" + resolved "https://registry.yarnpkg.com/@amplitude/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.25.tgz#a748cb4c3e0ea5dfd12620262433508c85595f45" + integrity sha512-sXNJHGGqFeVoua7qXKd8cuI4s4RtWZyse1ovKmTLyKVLIWDNtv+kbubpR6ze4EAy5ciOvLe7H41L8ps6JZZg7g== dependencies: - "@amplitude/rrweb-snapshot" "^2.0.0-alpha.21" + postcss "^8.4.38" -"@amplitude/rrweb@2.0.0-alpha.21": - version "2.0.0-alpha.21" - resolved "https://registry.yarnpkg.com/@amplitude/rrweb/-/rrweb-2.0.0-alpha.21.tgz#a7fb7c1547a1d8b6b4eb054285af5d75fd920a1f" - integrity sha512-Ry5J4U7jBcqG2i7cXwo9v1JSQqh0wh4nTRKOgIxM3vXvNti1hzS88I4nsCjrytm8aaCTNB6SCVa3n+yrGE3b8A== +"@amplitude/rrweb-types@^2.0.0-alpha.25": + version "2.0.0-alpha.25" + resolved "https://registry.yarnpkg.com/@amplitude/rrweb-types/-/rrweb-types-2.0.0-alpha.25.tgz#1ec3cd5fa5ef4fedef8c34fbf4ccae2f9e7e505e" + integrity sha512-KtHn3Bu9EhTPJ5bRbf6Qs8+uz4PUlmk4qg+c4N5b1P36erHnhX5tuk9bfwzJawtDYX7x5a4jEdeqFBwLQrt//g== dependencies: - "@amplitude/rrdom" "^2.0.0-alpha.21" - "@amplitude/rrweb-snapshot" "^2.0.0-alpha.21" - "@amplitude/rrweb-types" "^2.0.0-alpha.21" + "@amplitude/rrweb-snapshot" "^2.0.0-alpha.25" + +"@amplitude/rrweb-utils@^2.0.0-alpha.25": + version "2.0.0-alpha.25" + resolved "https://registry.yarnpkg.com/@amplitude/rrweb-utils/-/rrweb-utils-2.0.0-alpha.25.tgz#d2f62e348652952e422f236ee08ee3b0bfb2582d" + integrity sha512-+mXjaWFBgCxY16ZvTTKbVveF1ecQTXvP8x3ddjatbEkYVds6A8gox7lAUEQW3YGGAa5MFcnhYvGNJb+iPqw9iw== + +"@amplitude/rrweb@2.0.0-alpha.25": + version "2.0.0-alpha.25" + resolved "https://registry.yarnpkg.com/@amplitude/rrweb/-/rrweb-2.0.0-alpha.25.tgz#c4b1c05c64fb01aa7969aa0c47a0663acf46251a" + integrity sha512-YdsUoCCGyuUfcGnsbx1/xxBN3Lp0XMAluMpV9IsQg8iGVHyWVb9MSscPxMNkDLzrrjLTLhGxIuyO2FY0OKxkfQ== + dependencies: + "@amplitude/rrdom" "^2.0.0-alpha.25" + "@amplitude/rrweb-snapshot" "^2.0.0-alpha.25" + "@amplitude/rrweb-types" "^2.0.0-alpha.25" + "@amplitude/rrweb-utils" "^2.0.0-alpha.25" "@types/css-font-loading-module" "0.0.7" "@xstate/fsm" "^1.4.0" base64-arraybuffer "^1.0.1" - fflate "^0.4.4" mitt "^3.0.0" "@amplitude/ua-parser-js@^0.7.31", "@amplitude/ua-parser-js@^0.7.33": @@ -10336,6 +10351,11 @@ mute-stream@^1.0.0: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-1.0.0.tgz#e31bd9fe62f0aed23520aa4324ea6671531e013e" integrity sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA== +nanoid@^3.3.7: + version "3.3.7" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" + integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== + nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -11103,6 +11123,11 @@ picocolors@^1.0.1: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== +picocolors@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== + picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" @@ -11166,6 +11191,15 @@ posix-character-classes@^0.1.0: resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" integrity sha512-xTgYBc3fuo7Yt7JbiuFxSYGToMoz8fLoE6TC9Wx1P/u+LfeThMOAqmuyECnlBaaJb+u1m9hHiXUEtwW4OzfUJg== +postcss@^8.4.38: + version "8.4.47" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.47.tgz#5bf6c9a010f3e724c503bf03ef7947dcb0fea365" + integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ== + dependencies: + nanoid "^3.3.7" + picocolors "^1.1.0" + source-map-js "^1.2.1" + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -12203,6 +12237,11 @@ sort-keys@^4.0.0: dependencies: is-plain-obj "^2.0.0" +source-map-js@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" + integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== + source-map-resolve@^0.5.0: version "0.5.3" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" From af5bab31b52ba64ce17a626dacde79444c9bcfe3 Mon Sep 17 00:00:00 2001 From: Jesse Wang Date: Mon, 28 Oct 2024 15:51:11 -0700 Subject: [PATCH 3/4] chore(session replay): updating undefined click interactions --- packages/session-replay-browser/package.json | 6 +- .../session-replay-browser/src/hooks/click.ts | 7 ++- yarn.lock | 62 +++++++++---------- 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/packages/session-replay-browser/package.json b/packages/session-replay-browser/package.json index fddc59bba..56e99c06c 100644 --- a/packages/session-replay-browser/package.json +++ b/packages/session-replay-browser/package.json @@ -42,9 +42,9 @@ "@amplitude/analytics-core": ">=1 <3", "@amplitude/analytics-remote-config": "^0.4.1", "@amplitude/analytics-types": ">=1 <3", - "@amplitude/rrweb": "2.0.0-alpha.25", - "@amplitude/rrweb-snapshot": "2.0.0-alpha.25", - "@amplitude/rrweb-packer": "2.0.0-alpha.25", + "@amplitude/rrweb": "2.0.0-alpha.26", + "@amplitude/rrweb-snapshot": "2.0.0-alpha.26", + "@amplitude/rrweb-packer": "2.0.0-alpha.26", "idb": "^8.0.0", "tslib": "^2.4.1" }, diff --git a/packages/session-replay-browser/src/hooks/click.ts b/packages/session-replay-browser/src/hooks/click.ts index 8767f3720..821bcf059 100644 --- a/packages/session-replay-browser/src/hooks/click.ts +++ b/packages/session-replay-browser/src/hooks/click.ts @@ -86,6 +86,9 @@ export const clickHook: (options: Options) => mouseInteractionCallBack = } const { x, y } = e; + if (x === undefined || y === undefined) { + return; + } const node = record.mirror.getNode(e.id); let selector; @@ -96,8 +99,8 @@ export const clickHook: (options: Options) => mouseInteractionCallBack = const { left: scrollX, top: scrollY } = utils.getWindowScroll(globalScope as unknown as Window); const event: ClickEvent = { - x: ( x ?? 0 ) + scrollX, - y: ( y ?? 0 ) + scrollY, + x: x + scrollX, + y: y + scrollY, selector, viewportHeight: innerHeight, diff --git a/yarn.lock b/yarn.lock index 251a0282f..ddca936c9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -116,49 +116,49 @@ "@amplitude/analytics-types" "^2.1.1" tslib "^2.4.1" -"@amplitude/rrdom@^2.0.0-alpha.25": - version "2.0.0-alpha.25" - resolved "https://registry.yarnpkg.com/@amplitude/rrdom/-/rrdom-2.0.0-alpha.25.tgz#c44c1bbcaee9e95148b3998912f6cb2ca085475f" - integrity sha512-GTdwpDJmwAZcllNmGH3xmLEfKkMhOqmqkpG9G0MVGdhRmL3pTAhmSZuyPUYUho71ZjKQtGnHMDPgfOtniWsWbw== +"@amplitude/rrdom@^2.0.0-alpha.26": + version "2.0.0-alpha.26" + resolved "https://registry.yarnpkg.com/@amplitude/rrdom/-/rrdom-2.0.0-alpha.26.tgz#4a1b6434371a90bf788b47256d35e18fad33bd18" + integrity sha512-pxuDZjc86cCrNwjQ+00TYNmVKZHm50wmcCd0u0bHgrasVuRSBWddB5Nt70TyvXC40oelAEDYyJWOoVWU+W+9gA== dependencies: - "@amplitude/rrweb-snapshot" "^2.0.0-alpha.25" + "@amplitude/rrweb-snapshot" "^2.0.0-alpha.26" -"@amplitude/rrweb-packer@2.0.0-alpha.25": - version "2.0.0-alpha.25" - resolved "https://registry.yarnpkg.com/@amplitude/rrweb-packer/-/rrweb-packer-2.0.0-alpha.25.tgz#e83fd577da7979b52a0262ddad5ea68c30bd4d7c" - integrity sha512-VqQ24tPDfP55Y1XlqC/hBvheyUxREruYhOnwvTzcHo+1bCVlMuru07j50oVv/SW3FHmY6t4k6LL1sQNZGGbx8g== +"@amplitude/rrweb-packer@2.0.0-alpha.26": + version "2.0.0-alpha.26" + resolved "https://registry.yarnpkg.com/@amplitude/rrweb-packer/-/rrweb-packer-2.0.0-alpha.26.tgz#9d34ca929773943a33c342d77a03d0cab91816a3" + integrity sha512-uJM5/VFdjLUsKM++pAaXAAxpkBbh3r2Skxjx+3YS4OY49/kjA+KgzX1ottT8niOWQCxPngFgfOwle18z0QBXGA== dependencies: - "@amplitude/rrweb-types" "^2.0.0-alpha.25" + "@amplitude/rrweb-types" "^2.0.0-alpha.26" fflate "^0.4.4" -"@amplitude/rrweb-snapshot@2.0.0-alpha.25", "@amplitude/rrweb-snapshot@^2.0.0-alpha.25": - version "2.0.0-alpha.25" - resolved "https://registry.yarnpkg.com/@amplitude/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.25.tgz#a748cb4c3e0ea5dfd12620262433508c85595f45" - integrity sha512-sXNJHGGqFeVoua7qXKd8cuI4s4RtWZyse1ovKmTLyKVLIWDNtv+kbubpR6ze4EAy5ciOvLe7H41L8ps6JZZg7g== +"@amplitude/rrweb-snapshot@2.0.0-alpha.26", "@amplitude/rrweb-snapshot@^2.0.0-alpha.26": + version "2.0.0-alpha.26" + resolved "https://registry.yarnpkg.com/@amplitude/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.26.tgz#67c1e74e1dbb9a189823daa1b9b9fb8f225e661b" + integrity sha512-ZXAqF+fX/0ngyCS8/Iu83FeMMMXuw9FRKFFK6vTUjvXXvFnBx1WjQZLVNJbaZu3hZUN7sECATuOXQklccY/TJw== dependencies: postcss "^8.4.38" -"@amplitude/rrweb-types@^2.0.0-alpha.25": - version "2.0.0-alpha.25" - resolved "https://registry.yarnpkg.com/@amplitude/rrweb-types/-/rrweb-types-2.0.0-alpha.25.tgz#1ec3cd5fa5ef4fedef8c34fbf4ccae2f9e7e505e" - integrity sha512-KtHn3Bu9EhTPJ5bRbf6Qs8+uz4PUlmk4qg+c4N5b1P36erHnhX5tuk9bfwzJawtDYX7x5a4jEdeqFBwLQrt//g== +"@amplitude/rrweb-types@^2.0.0-alpha.26": + version "2.0.0-alpha.26" + resolved "https://registry.yarnpkg.com/@amplitude/rrweb-types/-/rrweb-types-2.0.0-alpha.26.tgz#e5ff279b8f89e9ccb6cb6a3072906b639a39a48d" + integrity sha512-50SnMId2Xp3dGaVAEAQCwF3PkX0As8JSMpBoqrw+0bX8uubUySE4mR/tpv75wQ81JK49ruwrdMcmFWSWLfHA/w== dependencies: - "@amplitude/rrweb-snapshot" "^2.0.0-alpha.25" + "@amplitude/rrweb-snapshot" "^2.0.0-alpha.26" -"@amplitude/rrweb-utils@^2.0.0-alpha.25": - version "2.0.0-alpha.25" - resolved "https://registry.yarnpkg.com/@amplitude/rrweb-utils/-/rrweb-utils-2.0.0-alpha.25.tgz#d2f62e348652952e422f236ee08ee3b0bfb2582d" - integrity sha512-+mXjaWFBgCxY16ZvTTKbVveF1ecQTXvP8x3ddjatbEkYVds6A8gox7lAUEQW3YGGAa5MFcnhYvGNJb+iPqw9iw== +"@amplitude/rrweb-utils@^2.0.0-alpha.26": + version "2.0.0-alpha.26" + resolved "https://registry.yarnpkg.com/@amplitude/rrweb-utils/-/rrweb-utils-2.0.0-alpha.26.tgz#b03b1ecce9cf2a8d3b9608eab245d71919a53bce" + integrity sha512-8GHzpI3nqI6GKGGwrBj3TClWqQ4g9TwXlnPZthGbiUgJ1U3mgF06u4e4tsort958IujYZQf0hk6JdLwB9HgvCg== -"@amplitude/rrweb@2.0.0-alpha.25": - version "2.0.0-alpha.25" - resolved "https://registry.yarnpkg.com/@amplitude/rrweb/-/rrweb-2.0.0-alpha.25.tgz#c4b1c05c64fb01aa7969aa0c47a0663acf46251a" - integrity sha512-YdsUoCCGyuUfcGnsbx1/xxBN3Lp0XMAluMpV9IsQg8iGVHyWVb9MSscPxMNkDLzrrjLTLhGxIuyO2FY0OKxkfQ== +"@amplitude/rrweb@2.0.0-alpha.26": + version "2.0.0-alpha.26" + resolved "https://registry.yarnpkg.com/@amplitude/rrweb/-/rrweb-2.0.0-alpha.26.tgz#0c386131d64f3bdf48a4e6f327e757644c565c20" + integrity sha512-VDJc81dNyzYSlC+afCG7kikT6OjiWjxo1o/75jNu67AAxOKRuQkddGn0jiwJDgwMYDmqw6jje0QNufbsTpci2g== dependencies: - "@amplitude/rrdom" "^2.0.0-alpha.25" - "@amplitude/rrweb-snapshot" "^2.0.0-alpha.25" - "@amplitude/rrweb-types" "^2.0.0-alpha.25" - "@amplitude/rrweb-utils" "^2.0.0-alpha.25" + "@amplitude/rrdom" "^2.0.0-alpha.26" + "@amplitude/rrweb-snapshot" "^2.0.0-alpha.26" + "@amplitude/rrweb-types" "^2.0.0-alpha.26" + "@amplitude/rrweb-utils" "^2.0.0-alpha.26" "@types/css-font-loading-module" "0.0.7" "@xstate/fsm" "^1.4.0" base64-arraybuffer "^1.0.1" From fd8d3c71e8a22412e5206d5a53c0919fbcb753d2 Mon Sep 17 00:00:00 2001 From: Jesse Wang Date: Tue, 29 Oct 2024 09:38:30 -0700 Subject: [PATCH 4/4] chore(session replay): fix test --- packages/session-replay-browser/test/hooks/click.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/session-replay-browser/test/hooks/click.test.ts b/packages/session-replay-browser/test/hooks/click.test.ts index ebcd47665..731c75128 100644 --- a/packages/session-replay-browser/test/hooks/click.test.ts +++ b/packages/session-replay-browser/test/hooks/click.test.ts @@ -54,6 +54,15 @@ describe('click', () => { }); expect(jest.spyOn(mockEventsManager, 'addEvent')).not.toHaveBeenCalled(); }); + test('do nothing if x/y is undefined', () => { + hook({ + id: 1234, + type: MouseInteractions.Click, + x: undefined, + y: undefined, + }); + expect(jest.spyOn(mockEventsManager, 'addEvent')).not.toHaveBeenCalled(); + }); test('do nothing if no window given', () => { mockGlobalScope(undefined); const hook = clickHook({