@playpilot/tpi 8.6.0 → 8.6.1

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/events.md CHANGED
@@ -18,8 +18,10 @@ All events share a common payload:
18
18
  Events related to titles share an additional set of data (referred to below as `Title`):
19
19
 
20
20
  - `original_title`
21
+ - `title`
21
22
  - `title_sid`
22
23
  - `title_type`: "movie" or "series"
24
+ - `genres`: An array of all genres for the title
23
25
  - `providers`: An array of provider names
24
26
 
25
27
  Events may have additional data in their payload.
@@ -112,4 +114,5 @@ Event | Action | Info | Payload
112
114
  `explore_search` | _Fires any time the user searches for something_ | | `query`
113
115
  `venus_title_rail_modal_view` | _Fires any time a title is clicked in a rail, opening the rail modal_ | | `rail` (heading key of the rail)
114
116
  `venus_title_rail_expand_click` | _Fires any time a title is expanded in a rail directly via a click_ | Does not fire when a title opens automatically on load or navigate | `Title`, `rail` (heading key of the rail)
117
+ `venus_title_rail_set_index` | _Fires when navigating in the titles rail modal, either via arrows, swipe, or clicking titles_ | | `Title`, `index` (index of the new position of the slider)
115
118
  `venus_navigate` | _Fires when navigating on the explore page_ | Does not fire on initial load | `route` (the key of the given route)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playpilot/tpi",
3
- "version": "8.6.0",
3
+ "version": "8.6.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -73,6 +73,7 @@ export const TrackingEvent = {
73
73
  ExploreFetchProvidersFailed: 'venus_fetch_providers_failed',
74
74
  ExploreTitleRailModalView: 'venus_title_rail_modal_view',
75
75
  ExploreTitleRailExpandClick: 'venus_title_rail_expand_click',
76
+ ExploreTitleRailSetIndex: 'venus_title_rail_set_index',
76
77
  ExploreNavigate: 'venus_navigate',
77
78
  } as const
78
79
 
@@ -11,10 +11,11 @@
11
11
  interface Props {
12
12
  items: Record<string, any>[]
13
13
  initialIndex?: number
14
+ onchange?: (index: number) => void
14
15
  each: Snippet<[item: any, currentIndex: number]>
15
16
  }
16
17
 
17
- const { items, initialIndex = 0, each }: Props = $props()
18
+ const { items, initialIndex = 0, onchange = () => null, each }: Props = $props()
18
19
 
19
20
  const transitionDuration = 300
20
21
 
@@ -27,6 +28,11 @@
27
28
  requestAnimationFrame(() => initialized = true)
28
29
  })
29
30
  })
31
+
32
+ function setSliderIndex(index: number): void {
33
+ onchange(index)
34
+ slider.setIndex(index)
35
+ }
30
36
  </script>
31
37
 
32
38
  <Modal blur>
@@ -37,7 +43,7 @@
37
43
  {#each items as item, index}
38
44
  <!-- svelte-ignore a11y_click_events_have_key_events -->
39
45
  <!-- svelte-ignore a11y_no_static_element_interactions -->
40
- <div class="item" class:active={index === currentIndex} onclick={() => slider.setIndex(index)}>
46
+ <div class="item" class:active={index === currentIndex} onclick={() => setSliderIndex(index)}>
41
47
  {#if Math.abs(index - currentIndex) === 1 || currentIndex === index}
42
48
  <div class="content" transition:fade={{ duration: initialized ? transitionDuration : 0 }}>
43
49
  {@render each(item, currentIndex)}
@@ -47,15 +53,15 @@
47
53
  {/each}
48
54
  {/snippet}
49
55
 
50
- {#snippet controls({ setIndex, currentIndex, reachedEnd })}
56
+ {#snippet controls({ currentIndex, reachedEnd })}
51
57
  {#if currentIndex > 0}
52
- <button class="arrow left" onclick={() => setIndex(currentIndex - 1)} aria-label="Previous" aria-live="polite">
58
+ <button class="arrow left" onclick={() => setSliderIndex(currentIndex - 1)} aria-label="Previous" aria-live="polite">
53
59
  <IconArrow size={21} direction="left" title="Previous" />
54
60
  </button>
55
61
  {/if}
56
62
 
57
63
  {#if !reachedEnd}
58
- <button class="arrow right" onclick={() => setIndex(currentIndex + 1)} aria-label="Next" aria-live="polite">
64
+ <button class="arrow right" onclick={() => setSliderIndex(currentIndex + 1)} aria-label="Next" aria-live="polite">
59
65
  <IconArrow size={21} title="Next" />
60
66
  </button>
61
67
  {/if}
@@ -1,4 +1,6 @@
1
1
  <script lang="ts">
2
+ import { TrackingEvent } from '$lib/enums/TrackingEvent'
3
+ import { track } from '$lib/tracking'
2
4
  import type { TitleData } from '$lib/types/title'
3
5
  import Title from '../Title.svelte'
4
6
  import RailModal from './RailModal.svelte'
@@ -11,7 +13,7 @@
11
13
  const { titles, initialIndex = 0 }: Props = $props()
12
14
  </script>
13
15
 
14
- <RailModal items={titles} {initialIndex}>
16
+ <RailModal items={titles} {initialIndex} onchange={(index) => track(TrackingEvent.ExploreTitleRailSetIndex, titles[index], { index })}>
15
17
  {#snippet each(title, currentIndex)}
16
18
  <Title {title} useVideoBackground={title.sid === titles[currentIndex]?.sid} />
17
19
  {/snippet}