@playpilot/tpi 8.40.0 → 8.40.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.
@@ -139,5 +139,4 @@ export type ConfigResponse = {
139
139
  explore_navigation_insert_position?: InsertPosition
140
140
  explore_insert_cta_in_tpi?: boolean
141
141
  explore_custom_style?: string
142
- explore_use_router?: boolean
143
142
  }
@@ -3,7 +3,7 @@
3
3
  import { fetchLinkInjections } from '$lib/api/externalPages'
4
4
  import { Language } from '$lib/enums/Language'
5
5
  import { SplitTest } from '$lib/enums/SplitTest'
6
- import { destroyExplore, insertExplore, useExploreRouter } from '$lib/explore'
6
+ import { destroyExplore, insertExplore } from '$lib/explore'
7
7
  import { getPageTextAndElements } from '$lib/injectionElements'
8
8
  import { getLanguage } from '$lib/language'
9
9
  import { getFullUrlPath } from '$lib/url'
@@ -217,14 +217,6 @@
217
217
  <button onclick={replaceWithBetaScript}>Use beta script</button>
218
218
  {/if}
219
219
 
220
- {#if !useExploreRouter()}
221
- <button onclick={(() => {
222
- destroyExplore()
223
- window.PlayPilotLinkInjections.config!.explore_use_router = !useExploreRouter()
224
- insertExplore()
225
- })}>Toggle new explore</button>
226
- {/if}
227
-
228
220
  <hr />
229
221
 
230
222
  <div>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { ExploreFilter } from '$lib/types/filter'
3
3
  import { heading } from '$lib/actions/heading'
4
- import { exploreParentSelector, useExploreRouter } from '$lib/explore'
4
+ import { exploreParentSelector } from '$lib/explore'
5
5
  import { t } from '$lib/localization'
6
6
  import { track } from '$lib/tracking'
7
7
  import { TrackingEvent } from '$lib/enums/TrackingEvent'
@@ -57,28 +57,20 @@
57
57
  <!-- eslint-disable-next-line svelte/no-at-html-tags -->
58
58
  {@html t('Streaming Guide Disclaimer')}
59
59
  </p>
60
-
61
- {#if !useExploreRouter()}
62
- <p class="description">
63
- {t('Streaming Guide Description')}
64
- </p>
65
- {/if}
66
60
  </div>
67
61
  </div>
68
62
 
69
63
  <Search oninput={(query) => searchQuery = query} />
70
64
 
71
- {#if useExploreRouter()}
72
- <div class="filter">
73
- <Filter
74
- {filter}
75
- {searchQuery}
76
- limit={clientWidth < 500}
77
- showSorting={!searchQuery}
78
- onchange={() => navigate('results')}
79
- onempty={() => navigate('home')} />
80
- </div>
81
- {/if}
65
+ <div class="filter">
66
+ <Filter
67
+ {filter}
68
+ {searchQuery}
69
+ limit={clientWidth < 500}
70
+ showSorting={!searchQuery}
71
+ onchange={() => navigate('results')}
72
+ onempty={() => navigate('home')} />
73
+ </div>
82
74
 
83
75
  {#await isUserRegionSupported() then isSupported}
84
76
  {#if !isSupported}
@@ -1,7 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { ExploreRoute } from '$lib/types/explore'
3
3
  import type { ExploreFilter } from '$lib/types/filter'
4
- import { useExploreRouter } from '$lib/explore'
5
4
  import { track } from '$lib/tracking'
6
5
  import { TrackingEvent } from '$lib/enums/TrackingEvent'
7
6
  import ExploreHome from './Routes/ExploreHome.svelte'
@@ -11,29 +10,24 @@
11
10
  import ExploreModal from './Routes/ExploreModal.svelte'
12
11
 
13
12
  const routes: ExploreRoute[] = [
13
+ {
14
+ key: 'home',
15
+ component: ExploreHome,
16
+ },
14
17
  {
15
18
  key: 'results',
16
19
  component: ExploreResults,
17
20
  },
18
- ]
19
-
20
- if (useExploreRouter()) {
21
- routes.unshift({
22
- key: 'home',
23
- component: ExploreHome,
24
- })
25
-
26
- routes.push({
21
+ {
27
22
  key: 'title',
28
23
  component: ExploreTitle,
29
- })
30
-
31
- routes.push({
24
+ },
25
+ {
32
26
  key: 'modal',
33
27
  component: ExploreHome,
34
28
  appendComponent: ExploreModal,
35
- })
36
- }
29
+ }
30
+ ]
37
31
 
38
32
  const initialRouteKey = getCurrentRouteParam() || routes[0].key
39
33
 
@@ -32,7 +32,7 @@
32
32
  }
33
33
  </script>
34
34
 
35
- <svelte:window {onscroll} bind:innerWidth={windowWidth} />
35
+ <svelte:window bind:innerWidth={windowWidth} />
36
36
 
37
37
  <div data-testid="explore-home"></div>
38
38
 
@@ -8,7 +8,6 @@
8
8
  import { exploreModalUrl } from '$lib/routes'
9
9
  import { generateRandomHash } from '$lib/hash'
10
10
  import { getFirstTitleWithAvailableTrailer } from '$lib/trailer'
11
- import { useExploreRouter } from '$lib/explore'
12
11
  import { getContext, onMount } from 'svelte'
13
12
  import type TinySlider from 'svelte-tiny-slider'
14
13
 
@@ -92,11 +91,7 @@
92
91
  return
93
92
  }
94
93
 
95
- if (useExploreRouter()) {
96
- openModal({ event, type: 'titles-rail', data: titles as TitleData[], returnToTitle, props: { initialIndex: index } })
97
- } else {
98
- openModal({ event, data: title, returnToTitle })
99
- }
94
+ openModal({ event, type: 'titles-rail', data: titles as TitleData[], returnToTitle, props: { initialIndex: index } })
100
95
  }
101
96
 
102
97
  async function expandFirstAvailableTrailer(): Promise<void> {
@@ -6,9 +6,8 @@
6
6
  */
7
7
 
8
8
  import { browser } from '$app/environment'
9
- import { destroyExplore, insertExplore, insertExploreIntoNavigation, useExploreRouter } from '$lib/explore'
9
+ import { insertExplore, insertExploreIntoNavigation } from '$lib/explore'
10
10
  import Debugger from '../components/Debugger.svelte'
11
-
12
11
  if (browser) {
13
12
  // @ts-ignore
14
13
  window.PlayPilotLinkInjections = {
@@ -18,7 +17,6 @@
18
17
  explore_navigation_label: 'Streaming guide (inserted)',
19
18
  explore_navigation_path: '/explore',
20
19
  explore_custom_style: 'main { border: 2px solid white }',
21
- explore_use_router: true,
22
20
  open_tpi_links_in_explore: true,
23
21
  },
24
22
  require_consent: false,
@@ -34,11 +32,7 @@
34
32
  <title>PlayPilot Link Injections - Explore</title>
35
33
  </svelte:head>
36
34
 
37
- <button onclick={(() => {
38
- destroyExplore()
39
- window.PlayPilotLinkInjections.config!.explore_use_router = !useExploreRouter()
40
- insertExplore()
41
- })}>Toggle new explore</button>
35
+
42
36
 
43
37
  <main>
44
38
  <!--
@@ -72,6 +72,14 @@ describe('$lib/api/ads', () => {
72
72
  await expect(async () => await fetchAds()).rejects.toThrowError()
73
73
  expect(track).toHaveBeenCalledWith(TrackingEvent.AdsFetchFailed, null, { status: 505 })
74
74
  })
75
+
76
+ it('Should include set region', async () => {
77
+ window.PlayPilotLinkInjections.region = 'uk'
78
+
79
+ await fetchAds()
80
+
81
+ expect(api).toHaveBeenCalledWith(expect.stringContaining('&region=uk'))
82
+ })
75
83
  })
76
84
 
77
85
  describe('getFirstAdOfType', () => {
package/svelte.config.js CHANGED
@@ -1,23 +1,32 @@
1
- import adapter from '@sveltejs/adapter-auto'
2
- import { sveltePreprocess } from 'svelte-preprocess'
3
-
4
- /** @type {import('@sveltejs/kit').Config} */
5
- const config = {
6
- preprocess: sveltePreprocess({
7
- scss: {
8
- includePaths: ['src'],
9
- prependData: `
10
- @use "src/lib/scss/_functions.scss" as *;
11
- @use "src/lib/scss/_mixins.scss" as *;
12
- `,
13
- },
14
- }),
15
- kit: {
16
- // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
17
- // If your environment is not supported, or you settled on a specific environment, switch out the adapter.
18
- // See https://svelte.dev/docs/kit/adapters for more information about adapters.
19
- adapter: adapter(),
20
- },
21
- }
22
-
23
- export default config
1
+ import adapter from '@sveltejs/adapter-auto'
2
+ import { sveltePreprocess } from 'svelte-preprocess'
3
+
4
+ /** @type {import('@sveltejs/kit').Config} */
5
+ const config = {
6
+ preprocess: sveltePreprocess({
7
+ scss: {
8
+ includePaths: ['src'],
9
+ prependData: `
10
+ @use "src/lib/scss/_functions.scss" as *;
11
+ @use "src/lib/scss/_mixins.scss" as *;
12
+ `,
13
+ },
14
+ }),
15
+ kit: {
16
+ // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
17
+ // If your environment is not supported, or you settled on a specific environment, switch out the adapter.
18
+ // See https://svelte.dev/docs/kit/adapters for more information about adapters.
19
+ adapter: adapter(),
20
+ },
21
+ compilerOptions: {
22
+ warningFilter: (warning) => {
23
+ const ignore = [
24
+ 'state_referenced_locally',
25
+ ]
26
+
27
+ return !ignore.includes(warning.code)
28
+ },
29
+ },
30
+ }
31
+
32
+ export default config
package/vite.config.js CHANGED
@@ -1,43 +1,43 @@
1
- import path from 'path'
2
- import * as dotenv from 'dotenv'
3
- import { defineConfig } from 'vitest/config'
4
- import { sveltekit } from '@sveltejs/kit/vite'
5
- import packageJson from './package.json'
6
-
7
- dotenv.config({ path: '.env' })
8
-
9
- export default defineConfig(() => ({
10
- plugins: [
11
- sveltekit(),
12
- ],
13
-
14
- server: {
15
- port: 3000,
16
- allowedHosts: ['engage-moderate-happy-davis.trycloudflare.com'],
17
- },
18
-
19
- test: {
20
- environment: 'happy-dom',
21
- environmentOptions: {
22
- happyDOM: {
23
- settings: {
24
- disableJavaScriptFileLoading: true,
25
- },
26
- },
27
- },
28
- include: ['src/**/*.{test,spec}.{js,ts}'],
29
- setupFiles: ['src/tests/setup.js'],
30
- },
31
-
32
- resolve: {
33
- conditions: process.env.VITEST ? ['browser'] : [],
34
- alias: {
35
- '$lib': path.resolve(__dirname, './src/lib'),
36
- },
37
- },
38
-
39
- define: {
40
- __SCRIPT_VERSION__: JSON.stringify(packageJson.version),
41
- __IS_EDITORIAL_SCRIPT__: true,
42
- },
43
- }))
1
+ import path from 'path'
2
+ import * as dotenv from 'dotenv'
3
+ import { defineConfig } from 'vitest/config'
4
+ import { sveltekit } from '@sveltejs/kit/vite'
5
+ import packageJson from './package.json'
6
+
7
+ dotenv.config({ path: '.env' })
8
+
9
+ export default defineConfig(() => ({
10
+ plugins: [
11
+ sveltekit(),
12
+ ],
13
+
14
+ server: {
15
+ port: 3000,
16
+ allowedHosts: ['engage-moderate-happy-davis.trycloudflare.com'],
17
+ },
18
+
19
+ test: {
20
+ environment: 'happy-dom',
21
+ environmentOptions: {
22
+ happyDOM: {
23
+ settings: {
24
+ disableJavaScriptFileLoading: true,
25
+ },
26
+ },
27
+ },
28
+ include: ['src/**/*.{test,spec}.{js,ts}'],
29
+ setupFiles: ['src/tests/setup.js'],
30
+ },
31
+
32
+ resolve: {
33
+ conditions: process.env.VITEST ? ['browser'] : [],
34
+ alias: {
35
+ '$lib': path.resolve(__dirname, './src/lib'),
36
+ },
37
+ },
38
+
39
+ define: {
40
+ __SCRIPT_VERSION__: JSON.stringify(packageJson.version),
41
+ __IS_EDITORIAL_SCRIPT__: true,
42
+ },
43
+ }))