@internetarchive/bookreader
Advanced tools
Comparing version 5.0.0-47 to 5.0.0-48
@@ -85,2 +85,4 @@ /* global BookReader, BookReaderJSIAinit */ | ||
const isRestricted = brManifest.data.isRestricted; | ||
window.dispatchEvent(new CustomEvent('contextmenu', { detail: { isRestricted } })); | ||
if (customAutoflipParams.autoflip) { | ||
@@ -87,0 +89,0 @@ br.autoToggle(customAutoflipParams); |
@@ -0,1 +1,5 @@ | ||
# 5.0.0-48 | ||
- Fix: move analytics to sample bucket @iisa | ||
- Dev: update dependencies (concurrently, jest) @renovate | ||
# 5.0.0-47 | ||
@@ -2,0 +6,0 @@ - Fix: XSS vulnerability in search results @latonv |
{ | ||
"name": "@internetarchive/bookreader", | ||
"version": "5.0.0-47", | ||
"version": "5.0.0-48", | ||
"description": "The Internet Archive BookReader.", | ||
@@ -50,7 +50,7 @@ "repository": { | ||
"@open-wc/testing-helpers": "^2.1.3", | ||
"@types/jest": "^29.0.3", | ||
"@types/jest": "^29.1.1", | ||
"@webcomponents/webcomponentsjs": "^2.6.0", | ||
"babel-loader": "8.2.5", | ||
"codecov": "^3.8.3", | ||
"concurrently": "7.2.2", | ||
"concurrently": "7.4.0", | ||
"core-js": "3.22.3", | ||
@@ -64,4 +64,4 @@ "cpx2": "4.2.0", | ||
"iso-language-codes": "1.1.0", | ||
"jest": "^29.0.3", | ||
"jest-environment-jsdom": "^29.0.3", | ||
"jest": "^29.1.2", | ||
"jest-environment-jsdom": "^29.1.2", | ||
"jquery": "3.6.1", | ||
@@ -68,0 +68,0 @@ "jquery-colorbox": "1.6.4", |
@@ -452,6 +452,6 @@ // eslint-disable-next-line no-unused-vars | ||
if (window.archive_analytics) { | ||
window.archive_analytics?.send_event_no_sampling( | ||
window.archive_analytics?.send_event( | ||
'BookReader', | ||
`contextmenu-${this.bookIsRestricted ? 'restricted' : 'unrestricted'}`, | ||
e.target.classList.value | ||
e.target?.classList?.value | ||
); | ||
@@ -458,0 +458,0 @@ } |
@@ -107,3 +107,3 @@ import { html } from 'lit'; | ||
} | ||
window.archive_analytics?.send_event_no_sampling( | ||
window.archive_analytics?.send_event( | ||
'BookReader', | ||
@@ -110,0 +110,0 @@ `VolumesSort|${orderBy}`, |
@@ -49,2 +49,9 @@ import { | ||
beforeEach(() => { | ||
window.archive_analytics = { | ||
send_event_no_sampling: sinon.fake(), | ||
send_event: sinon.fake() | ||
}; | ||
}); | ||
afterEach(() => { | ||
@@ -520,4 +527,2 @@ window.br = null; | ||
it('watches on `div.BRscreen`', async () => { | ||
window.archive_analytics = { send_event_no_sampling: sinon.fake() }; | ||
const el = fixtureSync(container()); | ||
@@ -534,5 +539,4 @@ const brStub = { | ||
expect(window.archive_analytics.send_event_no_sampling.called).toEqual( | ||
false | ||
); | ||
expect(window.archive_analytics.send_event_no_sampling.called).toEqual(false); | ||
expect(window.archive_analytics.send_event.called).toEqual(false); | ||
expect(elSpy.called).toEqual(false); | ||
@@ -556,4 +560,5 @@ | ||
expect(window.archive_analytics.send_event_no_sampling.called).toEqual( | ||
true | ||
false | ||
); | ||
expect(window.archive_analytics.send_event.called).toEqual(true); | ||
// we prevent default | ||
@@ -563,4 +568,2 @@ expect(preventDefaultSpy.called).toEqual(true); | ||
it('watches on `img.BRpageimage`', async () => { | ||
window.archive_analytics = { send_event_no_sampling: sinon.fake() }; | ||
const el = fixtureSync(container()); | ||
@@ -576,5 +579,4 @@ const brStub = { | ||
expect(window.archive_analytics.send_event_no_sampling.called).toEqual( | ||
false | ||
); | ||
expect(window.archive_analytics.send_event_no_sampling.called).toEqual(false); | ||
expect(window.archive_analytics.send_event.called).toEqual(false); | ||
@@ -595,3 +597,4 @@ const body = document.querySelector('body'); | ||
// analytics fires | ||
expect(window.archive_analytics.send_event_no_sampling.called).toEqual(true); | ||
expect(window.archive_analytics.send_event_no_sampling.called).toEqual(false); | ||
expect(window.archive_analytics.send_event.called).toEqual(true); | ||
// we prevent default | ||
@@ -602,4 +605,2 @@ expect(preventDefaultSpy.called).toEqual(true); | ||
it('Allows unrestricted books access to context menu', async () => { | ||
window.archive_analytics = { send_event_no_sampling: sinon.fake() }; | ||
const el = fixtureSync(container()); | ||
@@ -618,3 +619,5 @@ const brStub = { | ||
); | ||
expect(window.archive_analytics.send_event.called).toEqual(false); | ||
const body = document.querySelector('body'); | ||
@@ -634,3 +637,4 @@ // const element stub for img.BRpageimage | ||
// analytics fires | ||
expect(window.archive_analytics.send_event_no_sampling.called).toEqual(true); | ||
expect(window.archive_analytics.send_event_no_sampling.called).toEqual(false); | ||
expect(window.archive_analytics.send_event.called).toEqual(true); | ||
// we do not prevent default | ||
@@ -637,0 +641,0 @@ expect(preventDefaultSpy.called).toEqual(false); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
9041877
440
28875