@playpilot/tpi 6.9.2 → 6.9.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playpilot/tpi",
3
- "version": "6.9.2",
3
+ "version": "6.9.4",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -88,12 +88,12 @@ export const translations = {
88
88
  },
89
89
  'Rent': {
90
90
  [Language.English]: 'Rent',
91
- [Language.Swedish]: 'Hyra',
91
+ [Language.Swedish]: 'Hyr',
92
92
  [Language.Danish]: 'Lej',
93
93
  },
94
94
  'Rent Or Buy': {
95
95
  [Language.English]: 'Rent or Buy',
96
- [Language.Swedish]: 'Hyra',
96
+ [Language.Swedish]: 'Hyr/köp',
97
97
  [Language.Danish]: 'Lej eller køb',
98
98
  },
99
99
  'Watch': {
@@ -54,6 +54,11 @@ export type ConfigResponse = {
54
54
  */
55
55
  require_affiliate_consent?: boolean
56
56
 
57
+ /**
58
+ * Scroll reveal posters that show on mobile are enabled by default. Use this option to disable them.
59
+ */
60
+ disable_scroll_reveal_posters?: boolean
61
+
57
62
  /**
58
63
  * The following options are all relevant for in text disclaimers, which renders as a disclaimer text within the article,
59
64
  * rather than only inside of title cards.
@@ -17,6 +17,7 @@
17
17
  onDestroy(destroyAllPosters)
18
18
 
19
19
  function onscroll(): void {
20
+ if (window.PlayPilotLinkInjections?.config?.disable_scroll_reveal_posters) return
20
21
  if (!isMobile) return
21
22
 
22
23
  setScrollTimeout()
@@ -14,8 +14,11 @@ function createPosterLink(top = 0, url = 'poster.jpg') {
14
14
  return link
15
15
  }
16
16
 
17
- describe('FloatingPoster', () => {
17
+ describe('PostersScrollReveal', () => {
18
18
  beforeEach(() => {
19
+ // @ts-ignore
20
+ window.PlayPilotLinkInjections = {}
21
+
19
22
  document.body.innerHTML = ''
20
23
 
21
24
  Object.defineProperty(window, 'innerHeight', {
@@ -44,6 +47,19 @@ describe('FloatingPoster', () => {
44
47
  expect(poster?.getAttribute('src')).toBe('poster.jpg')
45
48
  })
46
49
 
50
+ it('Should not create poster when config object value is given', async () => {
51
+ window.PlayPilotLinkInjections.config = { disable_scroll_reveal_posters: true }
52
+
53
+ createPosterLink(500)
54
+
55
+ render(PostersScrollReveal)
56
+
57
+ window.dispatchEvent(new Event('scroll'))
58
+
59
+ const poster = document.querySelector('[data-playpilot-poster]')
60
+ expect(poster).not.toBeTruthy()
61
+ })
62
+
47
63
  it('Should not create posters on desktop when link is in viewport', async () => {
48
64
  createPosterLink(500)
49
65