@playpilot/tpi 5.9.0 → 5.9.2
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/link-injections.js +7 -7
- package/events.md +5 -4
- package/package.json +1 -1
- package/src/lib/ads.ts +0 -9
- package/src/lib/enums/SplitTest.ts +0 -7
- package/src/lib/enums/TrackingEvent.ts +1 -0
- package/src/routes/components/Ads/Display.svelte +0 -4
- package/src/routes/components/Modal.svelte +4 -4
- package/src/routes/components/Playlinks.svelte +7 -15
- package/src/routes/components/Popover.svelte +1 -1
- package/src/routes/components/RoundButton.svelte +1 -1
- package/src/routes/components/TitleModal.svelte +3 -7
- package/src/routes/components/TitlePopover.svelte +3 -7
- package/src/tests/routes/components/TitleModal.test.js +6 -7
package/events.md
CHANGED
|
@@ -70,7 +70,8 @@ Event | Action | Info | Payload
|
|
|
70
70
|
### Ads
|
|
71
71
|
Event | Action | Info | Payload
|
|
72
72
|
--- | --- | --- | ---
|
|
73
|
-
`ali_top_scroll_view` |
|
|
74
|
-
`ali_top_scroll_click` |
|
|
75
|
-
`ali_display_ad_view` |
|
|
76
|
-
`ali_display_ad_click` |
|
|
73
|
+
`ali_top_scroll_view` | _Fires any time the top scroll ad is viewed_ | | `campaign_name`
|
|
74
|
+
`ali_top_scroll_click` | _Fires any time the top scroll ad is called_ | | `campaign_name`
|
|
75
|
+
`ali_display_ad_view` | _Fires any time the display ad is viewed_ | | `campaign_name`
|
|
76
|
+
`ali_display_ad_click` | _Fires any time the display ad is clicked_ | | `campaign_name`
|
|
77
|
+
`ali_display_ad_playlink_click` | _Fires any time the playlink linked to the display ad is clicked_ | | `campaign_name`
|
package/package.json
CHANGED
package/src/lib/ads.ts
CHANGED
|
@@ -38,12 +38,3 @@ export function campaignToPlaylink(campaign: Campaign): PlaylinkData {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
// This is a temporary solution to load different campaigns per split test.
|
|
43
|
-
// Remove me once the split test is done.
|
|
44
|
-
export function getCampaignForDisplayAdVariant() {
|
|
45
|
-
const variantIndex = getSplitTestVariantIndex(SplitTest.DisplayAdPosition)
|
|
46
|
-
const campaignName = ['DigitalSpyAppleTVHeroA', 'DigitalSpyAppleTVHeroB', 'DigitalSpyAppleTVHeroC'][variantIndex]
|
|
47
|
-
|
|
48
|
-
return (window.PlayPilotLinkInjections?.ads || []).find(ad => ad.campaign_name === campaignName)
|
|
49
|
-
}
|
|
@@ -13,11 +13,4 @@ export const SplitTest = {
|
|
|
13
13
|
// Variant 0 is separate bubble
|
|
14
14
|
// Variant 1 is inline bubble
|
|
15
15
|
},
|
|
16
|
-
DisplayAdPosition: {
|
|
17
|
-
key: 'display_ad_position',
|
|
18
|
-
numberOfVariants: 3,
|
|
19
|
-
// Variant 0 is display ad in playlinks
|
|
20
|
-
// Variant 1 is display ad above card with highlighted playlink
|
|
21
|
-
// Variant 2 is display ad above card without highlighted playlink
|
|
22
|
-
},
|
|
23
16
|
} as const
|
|
@@ -30,6 +30,7 @@ export const TrackingEvent = Object.freeze({
|
|
|
30
30
|
TopScrollClick: 'ali_top_scroll_click',
|
|
31
31
|
DisplayAdView: 'ali_display_ad_view',
|
|
32
32
|
DisplayAdClick: 'ali_display_ad_click',
|
|
33
|
+
DisplayedAdPlaylickClick: 'ali_display_ad_playlink_click',
|
|
33
34
|
|
|
34
35
|
SplitTestView: 'ali_split_test_view',
|
|
35
36
|
SplitTestAction: 'ali_split_test_action'
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { SplitTest } from '$lib/enums/SplitTest'
|
|
3
2
|
import { TrackingEvent } from '$lib/enums/TrackingEvent'
|
|
4
|
-
import { trackSplitTestAction, trackSplitTestView } from '$lib/splitTest'
|
|
5
3
|
import { track } from '$lib/tracking'
|
|
6
4
|
import type { Campaign } from '$lib/types/campaign'
|
|
7
5
|
import Tooltip from '../Tooltip.svelte'
|
|
@@ -18,11 +16,9 @@
|
|
|
18
16
|
const { header: buttonLabel, url: href } = $derived(cta)
|
|
19
17
|
|
|
20
18
|
track(TrackingEvent.DisplayAdView, null, { campaign_name: campaign.campaign_name })
|
|
21
|
-
trackSplitTestView(SplitTest.DisplayAdPosition)
|
|
22
19
|
|
|
23
20
|
function onclick(): void {
|
|
24
21
|
track(TrackingEvent.DisplayAdClick, null, { campaign_name: campaign.campaign_name })
|
|
25
|
-
trackSplitTestAction(SplitTest.DisplayAdPosition, 'click')
|
|
26
22
|
}
|
|
27
23
|
</script>
|
|
28
24
|
|
|
@@ -123,6 +123,10 @@
|
|
|
123
123
|
background: var(--playpilot-detail-background, var(--playpilot-light));
|
|
124
124
|
transition: transform 200ms;
|
|
125
125
|
|
|
126
|
+
@supports (height: 1dvh) {
|
|
127
|
+
max-height: 80dvh;
|
|
128
|
+
}
|
|
129
|
+
|
|
126
130
|
@media (min-width: $max-width) {
|
|
127
131
|
margin-top: 0;
|
|
128
132
|
border-radius: var(--playpilot-detail-border-radius, margin(1));
|
|
@@ -130,10 +134,6 @@
|
|
|
130
134
|
max-height: unset;
|
|
131
135
|
}
|
|
132
136
|
|
|
133
|
-
@supports (height: 1dvh) {
|
|
134
|
-
max-height: 80dvh;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
137
|
&.tall {
|
|
138
138
|
@media (max-width: 599px) {
|
|
139
139
|
max-height: 90vh;
|
|
@@ -6,12 +6,10 @@
|
|
|
6
6
|
import type { PlaylinkData } from '$lib/types/playlink'
|
|
7
7
|
import type { TitleData } from '$lib/types/title'
|
|
8
8
|
import { heading } from '$lib/actions/heading'
|
|
9
|
-
import { isInSplitTestVariant, trackSplitTestAction } from '$lib/splitTest'
|
|
10
|
-
import { SplitTest } from '$lib/enums/SplitTest'
|
|
11
9
|
import { getContext } from 'svelte'
|
|
12
10
|
import Playlink from './Playlink.svelte'
|
|
13
11
|
import Display from './Ads/Display.svelte'
|
|
14
|
-
import { campaignToPlaylink } from '$lib/ads'
|
|
12
|
+
import { campaignToPlaylink, getFirstAdOfType } from '$lib/ads'
|
|
15
13
|
|
|
16
14
|
interface Props {
|
|
17
15
|
playlinks: PlaylinkData[]
|
|
@@ -21,18 +19,14 @@
|
|
|
21
19
|
const { playlinks, title }: Props = $props()
|
|
22
20
|
|
|
23
21
|
const isModal = getContext('scope') === 'modal'
|
|
24
|
-
|
|
25
|
-
const displayAd = (window.PlayPilotLinkInjections?.ads || []).find(ad => ad.campaign_name === 'DigitalSpyAppleTVHeroA')
|
|
26
|
-
const displayAdForPlaylink = (window.PlayPilotLinkInjections?.ads || []).find(ad => ad.campaign_name === 'DigitalSpyAppleTVPromotedOffer')
|
|
27
|
-
const showDisplayAd = displayAd && isInSplitTestVariant(SplitTest.DisplayAdPosition, 0)
|
|
28
|
-
const showPlaylinkAd = displayAdForPlaylink && isInSplitTestVariant(SplitTest.DisplayAdPosition, 1)
|
|
22
|
+
const displayAd = getFirstAdOfType('card')
|
|
29
23
|
|
|
30
24
|
let outerWidth = $state(0)
|
|
31
25
|
|
|
32
26
|
// Grid turns into a list when the playlinks container is small enough
|
|
33
27
|
// It is also a list by default if a display ad is present, as that would
|
|
34
28
|
// otherwise break the layout in ways that don't make sense to fix.
|
|
35
|
-
const list = $derived(outerWidth < 500 ||
|
|
29
|
+
const list = $derived(outerWidth < 500 || !!displayAd)
|
|
36
30
|
|
|
37
31
|
// Remove any playlinks without logos, these are likely sub providers.
|
|
38
32
|
const filteredPlaylinks = $derived(playlinks.filter(playlink => !!playlink.logo_url))
|
|
@@ -56,11 +50,9 @@
|
|
|
56
50
|
{#each mergedPlaylink as playlink, index}
|
|
57
51
|
<Playlink {playlink} onclick={() => onclick(playlink.name)} />
|
|
58
52
|
|
|
59
|
-
<!--
|
|
60
|
-
{#if
|
|
61
|
-
<
|
|
62
|
-
{:else if showPlaylinkAd && (index === 0)}
|
|
63
|
-
<Playlink playlink={campaignToPlaylink(displayAdForPlaylink)} onclick={() => trackSplitTestAction(SplitTest.DisplayAdPosition, 'click_playlink_ad')} hideCategory />
|
|
53
|
+
<!-- A fake highlighted playlink as part of the display ad, to be shown after the first playlink -->
|
|
54
|
+
{#if displayAd && (index === 0)}
|
|
55
|
+
<Playlink playlink={campaignToPlaylink(displayAd)} onclick={() => track(TrackingEvent.DisplayedAdPlaylickClick, title, { campaign_name: displayAd.campaign_name })} hideCategory />
|
|
64
56
|
{/if}
|
|
65
57
|
{/each}
|
|
66
58
|
|
|
@@ -69,7 +61,7 @@
|
|
|
69
61
|
{t('Title Unavailable')}
|
|
70
62
|
</div>
|
|
71
63
|
|
|
72
|
-
{#if
|
|
64
|
+
{#if displayAd}
|
|
73
65
|
<Display campaign={displayAd} compact={!isModal} />
|
|
74
66
|
{/if}
|
|
75
67
|
{/if}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const { children, size = '
|
|
11
|
+
const { children, size = '32px', onclick = () => null, ...rest }: Props = $props()
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<svelte:element this={rest.href ? 'a' : 'button'} role={rest.href ? 'link' : 'button'} {onclick} class="button" style:--size={size} {...rest}>
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
import Title from './Title.svelte'
|
|
8
8
|
import TopScroll from './Ads/TopScroll.svelte'
|
|
9
9
|
import Display from './Ads/Display.svelte'
|
|
10
|
-
import {
|
|
11
|
-
import { isInSplitTestVariant } from '$lib/splitTest'
|
|
12
|
-
import { SplitTest } from '$lib/enums/SplitTest'
|
|
10
|
+
import { getFirstAdOfType } from '$lib/ads'
|
|
13
11
|
|
|
14
12
|
interface Props {
|
|
15
13
|
onclose: () => void,
|
|
@@ -19,9 +17,7 @@
|
|
|
19
17
|
const { onclose, title }: Props = $props()
|
|
20
18
|
|
|
21
19
|
const topScrollAd = getFirstAdOfType('top_scroll')
|
|
22
|
-
const displayAd =
|
|
23
|
-
|
|
24
|
-
const isInDisplayAdFormatSplitTest = isInSplitTestVariant(SplitTest.DisplayAdPosition, 1) || isInSplitTestVariant(SplitTest.DisplayAdPosition, 2)
|
|
20
|
+
const displayAd = getFirstAdOfType('card')
|
|
25
21
|
|
|
26
22
|
track(TrackingEvent.TitleModalView, title)
|
|
27
23
|
|
|
@@ -53,6 +49,6 @@
|
|
|
53
49
|
{/if}
|
|
54
50
|
{/snippet}
|
|
55
51
|
|
|
56
|
-
<Modal {onclose} {onscroll} prepend={
|
|
52
|
+
<Modal {onclose} {onscroll} prepend={displayAd ? prepend : null} bubble={topScrollAd ? bubble : null} tall>
|
|
57
53
|
<Title {title} />
|
|
58
54
|
</Modal>
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { TrackingEvent } from '$lib/enums/TrackingEvent'
|
|
3
3
|
import { track } from '$lib/tracking'
|
|
4
|
-
import {
|
|
4
|
+
import { getFirstAdOfType } from '$lib/ads'
|
|
5
5
|
import type { TitleData } from '$lib/types/title'
|
|
6
6
|
import { onMount } from 'svelte'
|
|
7
7
|
import Popover from './Popover.svelte'
|
|
8
8
|
import Title from './Title.svelte'
|
|
9
9
|
import TopScroll from './Ads/TopScroll.svelte'
|
|
10
|
-
import { isInSplitTestVariant } from '$lib/splitTest'
|
|
11
|
-
import { SplitTest } from '$lib/enums/SplitTest'
|
|
12
10
|
import Display from './Ads/Display.svelte'
|
|
13
11
|
|
|
14
12
|
interface Props {
|
|
@@ -19,9 +17,7 @@
|
|
|
19
17
|
const { event, title }: Props = $props()
|
|
20
18
|
|
|
21
19
|
const topScroll = getFirstAdOfType('top_scroll')
|
|
22
|
-
const displayAd =
|
|
23
|
-
|
|
24
|
-
const isInDisplayAdFormatSplitTest = isInSplitTestVariant(SplitTest.DisplayAdPosition, 1) || isInSplitTestVariant(SplitTest.DisplayAdPosition, 2)
|
|
20
|
+
const displayAd = getFirstAdOfType('card')
|
|
25
21
|
|
|
26
22
|
let maxHeight = $state(0)
|
|
27
23
|
let element: HTMLElement | null = $state(null)
|
|
@@ -72,7 +68,7 @@
|
|
|
72
68
|
{/snippet}
|
|
73
69
|
|
|
74
70
|
<div class="title-popover" bind:this={element} data-playpilot-title-popover role="region" aria-labelledby="title">
|
|
75
|
-
<Popover bind:maxHeight append={
|
|
71
|
+
<Popover bind:maxHeight append={displayAd && !compact ? append : null} bubble={topScroll ? bubble : null}>
|
|
76
72
|
<Title {title} {compact} small />
|
|
77
73
|
</Popover>
|
|
78
74
|
</div>
|
|
@@ -64,15 +64,14 @@ describe('TitleModal.svelte', () => {
|
|
|
64
64
|
expect(container.querySelector('.top-scroll')).not.toBeTruthy()
|
|
65
65
|
})
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// window.PlayPilotLinkInjections = { ads: [{ campaign_format: 'card', content: {}, cta: {} }] }
|
|
67
|
+
it('Should render display ad when given', () => {
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
window.PlayPilotLinkInjections = { ads: [{ campaign_format: 'card', content: {}, cta: {} }] }
|
|
71
70
|
|
|
72
|
-
|
|
71
|
+
const { container } = render(TitleModal, { onclose, title })
|
|
73
72
|
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
expect(container.querySelector('.display')).toBeTruthy()
|
|
74
|
+
})
|
|
76
75
|
|
|
77
76
|
it('Should not render top scroll ad when not given', () => {
|
|
78
77
|
// @ts-ignore
|