@playpilot/tpi 8.40.0-beta.5 → 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.
- package/.playpilot/repo.yaml +14 -0
- package/dist/editorial.mount.js +10 -10
- package/dist/link-injections.js +2 -2
- package/dist/mount.css +1 -1
- package/dist/mount.js +8 -8
- package/package.json +3 -3
- package/src/lib/api/ads.ts +3 -1
- package/src/lib/api/config.ts +4 -0
- package/src/lib/api/region.ts +2 -1
- package/src/lib/disclaimer.ts +4 -3
- package/src/lib/explore.ts +2 -5
- package/src/lib/injection.ts +535 -537
- package/src/lib/retargeting.ts +2 -1
- package/src/lib/routes.ts +2 -1
- package/src/lib/types/config.d.ts +0 -1
- package/src/lib/user.ts +2 -1
- package/src/routes/+page.svelte +3 -3
- package/src/routes/components/Debugger.svelte +3 -10
- package/src/routes/components/Explore/ExploreCallToAction.svelte +2 -1
- package/src/routes/components/Explore/ExploreLayout.svelte +10 -18
- package/src/routes/components/Explore/ExploreRouter.svelte +9 -15
- package/src/routes/components/Explore/Routes/ExploreHome.svelte +1 -1
- package/src/routes/components/Modals/TitleModal.svelte +2 -1
- package/src/routes/components/Playlinks/Playlink.svelte +2 -1
- package/src/routes/components/Playlinks/Playlinks.svelte +2 -1
- package/src/routes/components/PostersScrollReveal.svelte +2 -1
- package/src/routes/components/Rails/ParticipantsRail.svelte +2 -1
- package/src/routes/components/Rails/TitlesRail.svelte +1 -6
- package/src/routes/components/Widgets/InjectionsWidgetRail.svelte +2 -1
- package/src/routes/explore/+page.svelte +2 -8
- package/src/tests/lib/api/ads.test.js +8 -0
- package/src/tests/routes/+page.test.js +8 -3
- package/svelte.config.js +32 -23
- package/vite.config.js +43 -43
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playpilot/tpi",
|
|
3
|
-
"version": "8.40.
|
|
3
|
+
"version": "8.40.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite dev",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@playpilot/retargeting-tracking": "^1.4.2",
|
|
21
21
|
"@sveltejs/adapter-auto": "^7.0.1",
|
|
22
|
-
"@sveltejs/kit": "^2.
|
|
22
|
+
"@sveltejs/kit": "^2.70.3",
|
|
23
23
|
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
|
24
24
|
"@testing-library/svelte": "^5.2.6",
|
|
25
25
|
"@types/node": "^25.5.2",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"prettier": "^3.8.3",
|
|
36
36
|
"prettier-plugin-svelte": "^3.2.6",
|
|
37
37
|
"sass": "^1.99.0",
|
|
38
|
-
"svelte": "5.
|
|
38
|
+
"svelte": "5.57.1",
|
|
39
39
|
"svelte-check": "^4.6.0",
|
|
40
40
|
"svelte-preprocess": "^6.0.5",
|
|
41
41
|
"svelte-tiny-slider": "^2.8.1",
|
package/src/lib/api/ads.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { track } from '../tracking'
|
|
|
5
5
|
import type { Campaign, CampaignFormat } from '../types/campaign'
|
|
6
6
|
import type { PlaylinkData } from '../types/playlink'
|
|
7
7
|
import { api } from './api'
|
|
8
|
+
import { getRegionBasedOnIp } from './region'
|
|
8
9
|
|
|
9
10
|
export async function fetchAds(): Promise<Campaign[]> {
|
|
10
11
|
if (!hasConsentedTo('ads')) return []
|
|
@@ -15,7 +16,8 @@ export async function fetchAds(): Promise<Campaign[]> {
|
|
|
15
16
|
if (!apiToken) throw new Error('No token was provided')
|
|
16
17
|
|
|
17
18
|
try {
|
|
18
|
-
const
|
|
19
|
+
const region = await getRegionBasedOnIp()
|
|
20
|
+
const response = await api<Campaign[]>(`/ads/browse/?api-token=${apiToken}®ion=${region}`)
|
|
19
21
|
|
|
20
22
|
return response
|
|
21
23
|
} catch (error: any) {
|
package/src/lib/api/config.ts
CHANGED
|
@@ -14,3 +14,7 @@ export async function fetchConfig(): Promise<ConfigResponse | null> {
|
|
|
14
14
|
return null
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
export function getConfigValue<K extends keyof ConfigResponse>(key: K): ConfigResponse[K] | undefined {
|
|
19
|
+
return window.PlayPilotLinkInjections?.config?.[key]
|
|
20
|
+
}
|
package/src/lib/api/region.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { SupportedRegion } from '$lib/enums/Region'
|
|
|
2
2
|
import { TrackingEvent } from '$lib/enums/TrackingEvent'
|
|
3
3
|
import { track } from '$lib/tracking'
|
|
4
4
|
import { RETARGETING_REGION_KEY } from '@playpilot/retargeting-tracking'
|
|
5
|
+
import { getConfigValue } from './config'
|
|
5
6
|
|
|
6
7
|
export async function getRegionBasedOnIp(timeout = 5000): Promise<string> {
|
|
7
8
|
const savedRegion = window.PlayPilotLinkInjections?.region
|
|
@@ -23,7 +24,7 @@ export async function getRegionBasedOnIp(timeout = 5000): Promise<string> {
|
|
|
23
24
|
} catch (error: any) {
|
|
24
25
|
track(TrackingEvent.RegionRequestFailed, null, { message: error.message })
|
|
25
26
|
|
|
26
|
-
const fallbackRegion =
|
|
27
|
+
const fallbackRegion = getConfigValue('fallback_region')
|
|
27
28
|
return fallbackRegion || ''
|
|
28
29
|
}
|
|
29
30
|
}
|
package/src/lib/disclaimer.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { mount, unmount } from 'svelte'
|
|
2
2
|
import InTextDisclaimer from '../routes/components/InTextDisclaimer.svelte'
|
|
3
|
+
import { getConfigValue } from './api/config'
|
|
3
4
|
|
|
4
5
|
export let inTextDisclaimerInsertComponent: object | null = null
|
|
5
6
|
|
|
6
7
|
export function insertInTextDisclaimer(elements: HTMLElement[]): void {
|
|
7
|
-
if (!
|
|
8
|
+
if (!getConfigValue('in_text_disclaimer_enabled')) return
|
|
8
9
|
if (inTextDisclaimerInsertComponent) return
|
|
9
10
|
|
|
10
11
|
const target = document.createElement('div')
|
|
11
|
-
const selector =
|
|
12
|
+
const selector = getConfigValue('in_text_disclaimer_selector')
|
|
12
13
|
const insertElement = (selector ? document.querySelector(selector) : null) || elements[0]
|
|
13
|
-
const insertPosition =
|
|
14
|
+
const insertPosition = getConfigValue('in_text_disclaimer_insert_position') || 'beforebegin'
|
|
14
15
|
|
|
15
16
|
target.dataset.playpilotInTextDisclaimer = 'true'
|
|
16
17
|
insertElement.insertAdjacentElement(insertPosition, target)
|
package/src/lib/explore.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mount, unmount } from 'svelte'
|
|
2
2
|
import ExploreRouter from '../routes/components/Explore/ExploreRouter.svelte'
|
|
3
|
+
import { getConfigValue } from './api/config'
|
|
3
4
|
|
|
4
5
|
export const exploreParentSelector = '[data-playpilot-explore]'
|
|
5
6
|
export const explorePreConsentSelector = '[data-playpilot-pre-consent-explore]'
|
|
@@ -68,7 +69,7 @@ export function insertExploreIntoNavigation(): boolean {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
function insertExploreCustomStyle(): void {
|
|
71
|
-
const customStyleString =
|
|
72
|
+
const customStyleString = getConfigValue('explore_custom_style')
|
|
72
73
|
|
|
73
74
|
if (!customStyleString) return
|
|
74
75
|
|
|
@@ -79,7 +80,3 @@ function insertExploreCustomStyle(): void {
|
|
|
79
80
|
|
|
80
81
|
document.body.appendChild(styleElement)
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
-
export function useExploreRouter(): boolean {
|
|
84
|
-
return !!window.PlayPilotLinkInjections?.config?.explore_use_router
|
|
85
|
-
}
|