@playpilot/tpi 8.5.10-beta.1 → 8.5.10-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playpilot/tpi",
3
- "version": "8.5.10-beta.1",
3
+ "version": "8.5.10-beta.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
package/src/main.ts CHANGED
@@ -6,7 +6,7 @@ import { isCrawler } from '$lib/crawler'
6
6
  import { getPageTextAndElements } from '$lib/injectionElements'
7
7
  import { isUrlExcludedViaConfig } from '$lib/url'
8
8
 
9
- window.PlayPilotLinkInjections = {
9
+ window.PlayPilotLinkInjections ||= {
10
10
  token: '',
11
11
  editorial_token: '',
12
12
  selector: '',
@@ -37,10 +37,6 @@ window.PlayPilotLinkInjections = {
37
37
  app: null,
38
38
 
39
39
  async initialize(options = { token: '', selector: '', after_article_selector: '', after_article_insert_position: '', language: null, region: null, organization_sid: null, domain_sid: null, editorial_token: '', require_consent: true, no_affiliate: false }): Promise<void> {
40
- if (window.PlayPilotLinkInjections.app) return
41
-
42
- console.log('set')
43
-
44
40
  if (!options.token) {
45
41
  console.error('An API token is required.')
46
42
  return
@@ -83,6 +79,8 @@ window.PlayPilotLinkInjections = {
83
79
 
84
80
  destroy(): void {
85
81
  window.PlayPilotMount?.destroy()
82
+ // @ts-ignore
83
+ delete window.PlayPilotLinkInjections
86
84
  },
87
85
 
88
86
  mount(): void {
@@ -91,8 +89,8 @@ window.PlayPilotLinkInjections = {
91
89
  const script = document.createElement('script')
92
90
 
93
91
  script.id = 'playpilot-mount'
94
- // script.src = `https://cdn.jsdelivr.net/npm/@playpilot/tpi@${__SCRIPT_VERSION__}/dist/${shouldLoadEditorial ? 'editorial.' : ''}mount.js`
95
- script.src = './dist/mount.js' // Use me during development of this script
92
+ script.src = `https://cdn.jsdelivr.net/npm/@playpilot/tpi@${__SCRIPT_VERSION__}/dist/${shouldLoadEditorial ? 'editorial.' : ''}mount.js`
93
+ // script.src = './dist/mount.js' // Use me during development of this script
96
94
 
97
95
  script.onload = () => window.PlayPilotMount?.mount()
98
96
 
@@ -32,6 +32,7 @@
32
32
 
33
33
  onMount(async () => {
34
34
  track(TrackingEvent.ExplorePageView)
35
+ console.log('track page view')
35
36
 
36
37
  if (!window.PlayPilotLinkInjections.ads?.length) window.PlayPilotLinkInjections.ads = await fetchAds()
37
38
  })