@playpilot/tpi 8.21.1 → 8.21.3
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
package/src/routes/+page.svelte
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
import { getPageTextAndElements } from '$lib/injectionElements'
|
|
14
14
|
import type { LinkInjectionResponse, LinkInjection, LinkInjectionTypes } from '$lib/types/injection'
|
|
15
15
|
import { getRegionBasedOnIp } from '$lib/api/region'
|
|
16
|
-
import { isPixelAllowed } from '$lib/pixel'
|
|
17
16
|
import Editor from './components/Editorial/Editor.svelte'
|
|
18
17
|
import EditorTrigger from './components/Editorial/EditorTrigger.svelte'
|
|
19
18
|
import Alert from './components/Editorial/Alert.svelte'
|
|
@@ -83,8 +82,6 @@
|
|
|
83
82
|
isUrlExcluded = isUrlExcludedViaConfig(config)
|
|
84
83
|
if (isUrlExcluded) return
|
|
85
84
|
|
|
86
|
-
if (isPixelAllowed()) await getRegionBasedOnIp()
|
|
87
|
-
|
|
88
85
|
if (config?.html_selector) window.PlayPilotLinkInjections.selector = config?.html_selector
|
|
89
86
|
} catch(error) {
|
|
90
87
|
// We return if the config did not get fetched properly, as we can't determine what should and should
|
|
@@ -95,8 +92,10 @@
|
|
|
95
92
|
}
|
|
96
93
|
|
|
97
94
|
try {
|
|
98
|
-
response = await
|
|
99
|
-
|
|
95
|
+
[response] = (await Promise.all([
|
|
96
|
+
await (window.PlayPilotLinkInjections.initial_link_injections_promise || pollLinkInjections({ maxTries: 1, runAiWhenRelevant: !isCrawler() })),
|
|
97
|
+
await getRegionBasedOnIp(),
|
|
98
|
+
])) as [LinkInjectionResponse | null, string]
|
|
100
99
|
|
|
101
100
|
loading = false
|
|
102
101
|
|
|
@@ -85,6 +85,10 @@ vi.mock('$lib/consent', () => ({
|
|
|
85
85
|
hasConsentedTo: vi.fn(() => true),
|
|
86
86
|
}))
|
|
87
87
|
|
|
88
|
+
vi.mock('$lib/api/region', () => ({
|
|
89
|
+
getRegionBasedOnIp: vi.fn(),
|
|
90
|
+
}))
|
|
91
|
+
|
|
88
92
|
describe('$routes/+page.svelte', () => {
|
|
89
93
|
beforeEach(() => {
|
|
90
94
|
document.body.innerHTML = ''
|