diff --git a/packages/session-replay-browser/package.json b/packages/session-replay-browser/package.json index 551636731..56e99c06c 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.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/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..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; 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({ diff --git a/yarn.lock b/yarn.lock index d56aad664..ddca936c9 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.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.21" + "@amplitude/rrweb-snapshot" "^2.0.0-alpha.26" -"@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.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.26" + 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.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: - "@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.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/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.26" + +"@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.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.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" - 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"