@playpilot/tpi 8.34.3 → 8.34.5
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/dist/editorial.mount.js +6 -6
- package/dist/link-injections.js +1 -1
- package/dist/mount.js +5 -5
- package/package.json +1 -1
- package/src/lib/enums/TrackingEvent.ts +1 -0
- package/src/routes/components/Rails/ParticipantsRail.svelte +9 -1
- package/src/routes/components/Tracking/TrackingPixelsForTitleDataPerLink.svelte +1 -1
- package/src/tests/routes/components/Rails/ParticipantsRail.test.js +10 -0
package/package.json
CHANGED
|
@@ -68,6 +68,7 @@ export const TrackingEvent = {
|
|
|
68
68
|
RegionRequestFailed: 'ali_region_request_failed',
|
|
69
69
|
YouTubeAvailabilityRequestFailed: 'ali_youtube_availability_request_failed',
|
|
70
70
|
CardToExploreCta: 'ali_card_to_explore_cta',
|
|
71
|
+
TitleParticipantsView: 'ali_title_participants_view',
|
|
71
72
|
|
|
72
73
|
// Explore
|
|
73
74
|
// These deliberately do not use the `ali_` prefix. We might want to separate this from TPI at some point
|
|
@@ -52,9 +52,17 @@
|
|
|
52
52
|
|
|
53
53
|
window.location.href = exploreModalUrl(participant.sid)
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
async function getParticipants(): Promise<ParticipantData[]> {
|
|
57
|
+
const participants = await fetchParticipantsForTitle(title)
|
|
58
|
+
|
|
59
|
+
if (participants.length) track(TrackingEvent.TitleParticipantsView, title, { participants: participants.map(p => p.name).slice(0, 20) })
|
|
60
|
+
|
|
61
|
+
return participants
|
|
62
|
+
}
|
|
55
63
|
</script>
|
|
56
64
|
|
|
57
|
-
{#await
|
|
65
|
+
{#await getParticipants()}
|
|
58
66
|
<Rail {heading}>
|
|
59
67
|
{#each { length: 5 }}
|
|
60
68
|
<div class="participant">
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
trackViaPixel(MetaEvent.GenreInterest, { genre: genreData.find(g => g.slug === genre)?.name, source: MetaSource.Link })
|
|
48
48
|
})
|
|
49
49
|
|
|
50
|
-
participants?.slice(0,
|
|
50
|
+
participants?.slice(0, 20).forEach(participant => {
|
|
51
51
|
trackViaPixel(MetaEvent.ParticipantInterest, { participant: participant.name, source: MetaSource.Link })
|
|
52
52
|
})
|
|
53
53
|
|
|
@@ -119,4 +119,14 @@ describe('ParticipantsRail.svelte', () => {
|
|
|
119
119
|
|
|
120
120
|
expect(track).toHaveBeenCalledWith(TrackingEvent.ParticipantClick, null, { title_source: title.original_title, participant: participants[0].name })
|
|
121
121
|
})
|
|
122
|
+
|
|
123
|
+
it('Should fire track event after participants are fetched', async () => {
|
|
124
|
+
vi.mocked(fetchParticipantsForTitle).mockResolvedValueOnce(participants)
|
|
125
|
+
|
|
126
|
+
render(ParticipantsRail, { title })
|
|
127
|
+
|
|
128
|
+
await waitFor(async () => {
|
|
129
|
+
expect(track).toHaveBeenCalledWith(TrackingEvent.TitleParticipantsView, title, { participants: participants.map(p => p.name) })
|
|
130
|
+
})
|
|
131
|
+
})
|
|
122
132
|
})
|