@playpilot/tpi 5.16.2 → 5.17.0
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,32 +1,39 @@
|
|
|
1
1
|
/** @see /events.md */
|
|
2
2
|
export const TrackingEvent = Object.freeze({
|
|
3
|
+
// General
|
|
3
4
|
ArticlePageView: 'ali_article_page_view',
|
|
4
5
|
ArticleInjected: 'ali_links_injected',
|
|
5
6
|
InjectionVisible: 'ali_injection_visible',
|
|
6
7
|
|
|
8
|
+
// Modal
|
|
7
9
|
TitleModalView: 'ali_title_modal_view',
|
|
8
10
|
TitleModalClose: 'ali_title_modal_close',
|
|
9
11
|
TitleModalScroll: 'ali_title_modal_scroll',
|
|
10
12
|
TitleModalPlaylinkClick: 'ali_title_modal_playlink_click',
|
|
11
13
|
TitleModalSaveClick: 'ali_title_modal_save_click',
|
|
12
14
|
|
|
15
|
+
// Popover
|
|
13
16
|
TitlePopoverView: 'ali_title_popover_view',
|
|
14
17
|
TitlePopoverClose: 'ali_title_popover_close',
|
|
15
18
|
TitlePopoverSaveClick: 'ali_title_popover_save_click',
|
|
16
19
|
TitlePopoverPlaylinkClick: 'ali_title_popover_playlink_click',
|
|
17
20
|
|
|
21
|
+
// After article
|
|
18
22
|
AfterArticlePlaylinkClick: 'ali_after_article_playlink_click',
|
|
19
23
|
AfterArticleModalButtonClick: 'ali_after_article_modal_button_click',
|
|
20
24
|
|
|
25
|
+
// Fails
|
|
21
26
|
InjectionFailed: 'ali_injection_failed',
|
|
22
27
|
TotalInjectionsCount: 'ali_injection_count',
|
|
23
28
|
FetchingConfigFailed: 'ali_fetch_config_failed',
|
|
24
29
|
AuthFailed: 'ali_auth_failed',
|
|
25
30
|
|
|
31
|
+
// Errors
|
|
26
32
|
ManualReport: 'ali_manual_report',
|
|
27
33
|
EditorError: 'ali_editor_error',
|
|
28
34
|
InjectionError: 'ali_injection_error',
|
|
29
35
|
|
|
36
|
+
// Ads
|
|
30
37
|
TopScrollView: 'ali_top_scroll_view',
|
|
31
38
|
TopScrollClick: 'ali_top_scroll_click',
|
|
32
39
|
DisplayAdView: 'ali_display_ad_view',
|
|
@@ -34,6 +41,7 @@ export const TrackingEvent = Object.freeze({
|
|
|
34
41
|
DisplayedAdPlaylickClick: 'ali_display_ad_playlink_click',
|
|
35
42
|
AdsFetchFailed: 'ali_ads_fetch_failed',
|
|
36
43
|
|
|
44
|
+
// Split tests
|
|
37
45
|
SplitTestView: 'ali_split_test_view',
|
|
38
46
|
SplitTestAction: 'ali_split_test_action',
|
|
39
47
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { browser } from '$app/environment'
|
|
3
|
-
import { title, linkInjections, campaign } from '$lib/fakeData'
|
|
3
|
+
import { title, linkInjections, campaign, participants } from '$lib/fakeData'
|
|
4
|
+
import { openModal } from '$lib/modal'
|
|
4
5
|
import Disclaimer from '../components/Ads/Disclaimer.svelte'
|
|
5
6
|
import Display from '../components/Ads/Display.svelte'
|
|
6
7
|
import TopScroll from '../components/Ads/TopScroll.svelte'
|
|
@@ -13,12 +14,9 @@
|
|
|
13
14
|
import RoundButton from '../components/RoundButton.svelte'
|
|
14
15
|
import SkeletonText from '../components/SkeletonText.svelte'
|
|
15
16
|
import Title from '../components/Title.svelte'
|
|
16
|
-
import TitleModal from '../components/TitleModal.svelte'
|
|
17
17
|
import TitlePopover from '../components/TitlePopover.svelte'
|
|
18
18
|
import Tooltip from '../components/Tooltip.svelte'
|
|
19
19
|
|
|
20
|
-
let showModal = $state(false)
|
|
21
|
-
|
|
22
20
|
// @ts-ignore
|
|
23
21
|
if (browser) window.PlayPilotLinkInjections = {}
|
|
24
22
|
</script>
|
|
@@ -68,11 +66,10 @@
|
|
|
68
66
|
<div class="group">
|
|
69
67
|
<div>
|
|
70
68
|
<h3>TitleModal.svelte</h3>
|
|
71
|
-
<div class="item"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
{/if}
|
|
69
|
+
<div class="item">
|
|
70
|
+
<button onclick={() => openModal({ type: 'title', data: title })}>Show title modal</button>
|
|
71
|
+
<button onclick={() => openModal({ type: 'participant', data: participants[0] })}>Show participant modal</button>
|
|
72
|
+
</div>
|
|
76
73
|
</div>
|
|
77
74
|
</div>
|
|
78
75
|
|
package/vite.config.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
1
|
import path from 'path'
|
|
3
2
|
import { defineConfig } from 'vitest/config'
|
|
4
3
|
import { sveltekit } from '@sveltejs/kit/vite'
|
|
@@ -10,47 +9,18 @@ export default defineConfig(({ command }) => ({
|
|
|
10
9
|
plugins: [
|
|
11
10
|
command === 'build' ? svelte() : sveltekit(),
|
|
12
11
|
command === 'build' && cssInjectedByJsPlugin(),
|
|
13
|
-
|
|
14
|
-
// The build is output to /dist/index.html and /dist/assets/index-[random-hash].js
|
|
15
|
-
// We only care for the .js file. We remove the .html file, and move and remove the .js to the root .dist folder.
|
|
16
|
-
// Additionally we wrap the original output in (() => { ... }); so that all functions are self contained. This
|
|
17
|
-
// helps prevent clashes with global functions.
|
|
18
|
-
|
|
19
|
-
name: 'move-build-files',
|
|
20
|
-
writeBundle() {
|
|
21
|
-
const distPath = path.resolve(__dirname, './dist')
|
|
22
|
-
const assetsPath = path.resolve(__dirname, './dist/assets')
|
|
23
|
-
|
|
24
|
-
// Remove index.html
|
|
25
|
-
const indexHtml = path.join(distPath, 'index.html')
|
|
26
|
-
if (fs.existsSync(indexHtml)) fs.unlinkSync(indexHtml)
|
|
27
|
-
|
|
28
|
-
// Find the index-[hash].js file
|
|
29
|
-
const files = fs.readdirSync(assetsPath)
|
|
30
|
-
const jsFile = files.find(f => /^index-.*\.js$/.test(f))
|
|
31
|
-
|
|
32
|
-
if (!jsFile) return
|
|
33
|
-
|
|
34
|
-
const sourcePath = path.join(assetsPath, jsFile)
|
|
35
|
-
const targetPath = path.join(distPath, 'link-injections.js')
|
|
36
|
-
|
|
37
|
-
// Read original file and wrap it in a self contained function
|
|
38
|
-
const originalContent = fs.readFileSync(sourcePath, 'utf8')
|
|
39
|
-
const wrappedContent = `(() => {\n${originalContent}\n})();\n`
|
|
40
|
-
|
|
41
|
-
// Write a new file
|
|
42
|
-
fs.writeFileSync(targetPath, wrappedContent)
|
|
43
|
-
console.log(`Moved and renamed ${jsFile} to link-injections.js`)
|
|
44
|
-
|
|
45
|
-
// Remove original file
|
|
46
|
-
fs.unlinkSync(sourcePath)
|
|
12
|
+
],
|
|
47
13
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
14
|
+
build: {
|
|
15
|
+
rollupOptions: {
|
|
16
|
+
input: './src/main.ts',
|
|
17
|
+
output: {
|
|
18
|
+
format: 'iife',
|
|
19
|
+
name: 'PlayPilotLinkInjections',
|
|
20
|
+
entryFileNames: 'link-injections.js',
|
|
51
21
|
},
|
|
52
22
|
},
|
|
53
|
-
|
|
23
|
+
},
|
|
54
24
|
|
|
55
25
|
server: {
|
|
56
26
|
port: 3000,
|