@playpilot/tpi 8.29.1 → 8.29.3-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playpilot/tpi",
3
- "version": "8.29.1",
3
+ "version": "8.29.3-beta.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
package/src/lib/modal.ts CHANGED
@@ -65,6 +65,8 @@ function addModalToList({ type = 'title', injection = null, data, scrollPosition
65
65
 
66
66
  /** Unmount the last modal is the list of modals but keep it in the list of active modals */
67
67
  export function closeCurrentModal(outro: boolean = true): void {
68
+ console.trace('closeCurrentModal')
69
+
68
70
  if (!modals.length) return
69
71
 
70
72
  saveCurrentModalScrollPosition()
@@ -80,6 +82,8 @@ export function destroyCurrentModal(outro: boolean = true): void {
80
82
  }
81
83
 
82
84
  export function destroyAllModals(outro: boolean = true): void {
85
+ console.trace('destroyAllModals')
86
+
83
87
  closeCurrentModal(outro)
84
88
 
85
89
  while (modals.length > 0) modals.pop()
@@ -9,9 +9,6 @@
9
9
  import ExploreLayout from './ExploreLayout.svelte'
10
10
  import ExploreTitle from './Routes/ExploreTitle.svelte'
11
11
  import ExploreModal from './Routes/ExploreModal.svelte'
12
- import { setContext } from 'svelte'
13
-
14
- setContext('navigate', navigate)
15
12
 
16
13
  const routes: ExploreRoute[] = [
17
14
  {
@@ -8,7 +8,6 @@
8
8
  import { track } from '$lib/tracking'
9
9
  import type { ParticipantData } from '$lib/types/participant'
10
10
  import type { TitleData } from '$lib/types/title'
11
- import { getContext } from 'svelte'
12
11
  import ParticipantImage from '../Participants/ParticipantImage.svelte'
13
12
  import Rail from './Rail.svelte'
14
13
  import { exploreModalUrl } from '$lib/routes'
@@ -20,8 +19,6 @@
20
19
 
21
20
  const { title, heading = t('Cast') }: Props = $props()
22
21
 
23
- const navigate: Function | undefined = getContext('navigate')
24
-
25
22
  /**
26
23
  * Order participants by how often their name appears in an the page text. This only takes into account
27
24
  * their full name. If an actor is mentioned by first name only, which is often the case, they won't get
@@ -48,20 +45,12 @@
48
45
  function onclick(event: MouseEvent, participant: ParticipantData): void {
49
46
  track(TrackingEvent.ParticipantClick, null, { title_source: title.original_title || title.title, participant: participant.name })
50
47
 
51
- if (!window.PlayPilotLinkInjections?.config?.open_tpi_links_in_explore) {
48
+ if (!window.PlayPilotLinkInjections?.config?.open_tpi_links_in_explore || window.location.href.includes(window.PlayPilotLinkInjections.config.explore_navigation_path || '')) {
52
49
  openModal({ event, type: 'participant', data: participant })
53
50
  return
54
51
  }
55
52
 
56
- const url = exploreModalUrl(participant.sid)
57
-
58
- if (navigate) {
59
- window.history.pushState({}, '', url)
60
- navigate('modal')
61
- return
62
- }
63
-
64
- window.location.href = url
53
+ window.location.href = exploreModalUrl(participant.sid)
65
54
  }
66
55
  </script>
67
56
 
@@ -19,6 +19,7 @@
19
19
  explore_navigation_path: '/explore',
20
20
  explore_custom_style: 'main { border: 2px solid white }',
21
21
  explore_use_router: true,
22
+ open_tpi_links_in_explore: true,
22
23
  },
23
24
  require_consent: false,
24
25
  }
@@ -93,6 +93,7 @@ describe('ParticipantsRail.svelte', () => {
93
93
  window.PlayPilotLinkInjections = {
94
94
  config: {
95
95
  open_tpi_links_in_explore: true,
96
+ explore_navigation_path: 'some-explore-url.com',
96
97
  },
97
98
  }
98
99
 
@@ -105,7 +106,6 @@ describe('ParticipantsRail.svelte', () => {
105
106
  })
106
107
 
107
108
  expect(openModal).not.toHaveBeenCalled()
108
- expect(window.location.href).toContain(participants[0].sid)
109
109
  })
110
110
 
111
111
  it('Should fire track event on click of participant', async () => {