@playpilot/tpi 8.5.8 → 8.5.10-beta.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
@@ -100,6 +100,7 @@ Event | Action | Info | Payload
100
100
  `ali_expand_title_description` | _Fires any time the "show more" button is clicked for a title description_ | | `Title`
101
101
  `ali_region_request_failed` | _Fires when requests to external service for getting the user region fails_ | | `message` (error message as returned by the request)
102
102
  `ali_youtube_availability_request_failed` | _Fires when requests to external service for getting the youtube availability fails_ | | `message` (error message as returned by the request)
103
+ `ali_card_to_explore_cta` | _Fires when the CTA in title cards leading to the streaming guide is clicked_ | |
103
104
 
104
105
  ### Explore
105
106
  Event | Action | Info | Payload
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playpilot/tpi",
3
- "version": "8.5.8",
3
+ "version": "8.5.10-beta.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -61,6 +61,7 @@ export const TrackingEvent = {
61
61
  ExpandTitleDescription: 'ali_expand_title_description',
62
62
  RegionRequestFailed: 'ali_region_request_failed',
63
63
  YouTubeAvailabilityRequestFailed: 'ali_youtube_availability_request_failed',
64
+ CardToExploreCta: 'ali_card_to_explore_cta',
64
65
 
65
66
  // Explore
66
67
  // These deliberately do not use the `ali_` prefix. We might want to separate this from TPI at some point
package/src/main.ts CHANGED
@@ -37,6 +37,10 @@ window.PlayPilotLinkInjections = {
37
37
  app: null,
38
38
 
39
39
  async initialize(options = { token: '', selector: '', after_article_selector: '', after_article_insert_position: '', language: null, region: null, organization_sid: null, domain_sid: null, editorial_token: '', require_consent: true, no_affiliate: false }): Promise<void> {
40
+ if (window.PlayPilotLinkInjections.app) return
41
+
42
+ console.log('set')
43
+
40
44
  if (!options.token) {
41
45
  console.error('An API token is required.')
42
46
  return
@@ -87,8 +91,8 @@ window.PlayPilotLinkInjections = {
87
91
  const script = document.createElement('script')
88
92
 
89
93
  script.id = 'playpilot-mount'
90
- script.src = `https://cdn.jsdelivr.net/npm/@playpilot/tpi@${__SCRIPT_VERSION__}/dist/${shouldLoadEditorial ? 'editorial.' : ''}mount.js`
91
- // script.src = './dist/mount.js' // Use me during development of this script
94
+ // script.src = `https://cdn.jsdelivr.net/npm/@playpilot/tpi@${__SCRIPT_VERSION__}/dist/${shouldLoadEditorial ? 'editorial.' : ''}mount.js`
95
+ script.src = './dist/mount.js' // Use me during development of this script
92
96
 
93
97
  script.onload = () => window.PlayPilotMount?.mount()
94
98
 
package/src/mount.ts CHANGED
@@ -4,7 +4,7 @@ import { clearLinkInjections } from '$lib/injection'
4
4
 
5
5
  window.PlayPilotMount = {
6
6
  mount(): void {
7
- if (window.PlayPilotLinkInjections.app) this.destroy()
7
+ if (window.PlayPilotLinkInjections.app) return
8
8
 
9
9
  const target = document.createElement('div')
10
10
  target.id = 'playpilot-link-injection'
@@ -1,10 +1,13 @@
1
1
  <script lang="ts">
2
+ import { TrackingEvent } from '$lib/enums/TrackingEvent'
3
+ import { track } from '$lib/tracking'
2
4
  import IconArrow from '../Icons/IconArrow.svelte'
3
5
 
4
6
  const src = 'https://cdn.jsdelivr.net/npm/@playpilot/tpi@latest/src/lib/images/titles-list.webp'
7
+ const href = window.PlayPilotLinkInjections?.config?.explore_navigation_path
5
8
  </script>
6
9
 
7
- <a class="call-to-action" href={window.PlayPilotLinkInjections?.config?.explore_navigation_path}>
10
+ <a class="call-to-action" {href} onclick={() => track(TrackingEvent.CardToExploreCta)}>
8
11
  <img {src} alt="" width="70" height="57" />
9
12
 
10
13
  <div>
@@ -67,7 +67,7 @@
67
67
  }
68
68
  })
69
69
 
70
- const response = await fetchTitles(params)
70
+ const response = await fetchTitles(params) || { next: null, previous: null, results: [] }
71
71
 
72
72
  if (requestId === latestRequestId) titles = [...titles, ...response.results]
73
73