@playpilot/tpi 8.21.0 → 8.21.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playpilot/tpi",
3
- "version": "8.21.0",
3
+ "version": "8.21.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -16,7 +16,7 @@
16
16
  "release": "node release.js"
17
17
  },
18
18
  "devDependencies": {
19
- "@playpilot/retargeting-tracking": "^1.2.0",
19
+ "@playpilot/retargeting-tracking": "^1.3.2",
20
20
  "@sveltejs/adapter-auto": "^7.0.1",
21
21
  "@sveltejs/kit": "^2.56.1",
22
22
  "@sveltejs/vite-plugin-svelte": "^4.0.0",
@@ -1,6 +1,7 @@
1
1
  import { SupportedRegion } from '$lib/enums/Region'
2
2
  import { TrackingEvent } from '$lib/enums/TrackingEvent'
3
3
  import { track } from '$lib/tracking'
4
+ import { RETARGETING_REGION_KEY } from '@playpilot/retargeting-tracking'
4
5
 
5
6
  export async function getRegionBasedOnIp(timeout = 5000): Promise<string> {
6
7
  const savedRegion = window.PlayPilotLinkInjections?.region
@@ -41,4 +42,7 @@ function setSavedRegion(region: string): void {
41
42
  if (!window.PlayPilotLinkInjections) return
42
43
 
43
44
  window.PlayPilotLinkInjections.region = region
45
+
46
+ // @ts-ignore
47
+ window[RETARGETING_REGION_KEY] = region
44
48
  }
@@ -12,6 +12,8 @@
12
12
  import { authorize, getAuthToken, isEditorialModeEnabled, removeAuthCookie, setEditorialParamInUrl } from '$lib/api/auth'
13
13
  import { getPageTextAndElements } from '$lib/injectionElements'
14
14
  import type { LinkInjectionResponse, LinkInjection, LinkInjectionTypes } from '$lib/types/injection'
15
+ import { getRegionBasedOnIp } from '$lib/api/region'
16
+ import { isPixelAllowed } from '$lib/pixel'
15
17
  import Editor from './components/Editorial/Editor.svelte'
16
18
  import EditorTrigger from './components/Editorial/EditorTrigger.svelte'
17
19
  import Alert from './components/Editorial/Alert.svelte'
@@ -81,6 +83,8 @@
81
83
  isUrlExcluded = isUrlExcludedViaConfig(config)
82
84
  if (isUrlExcluded) return
83
85
 
86
+ if (isPixelAllowed()) await getRegionBasedOnIp()
87
+
84
88
  if (config?.html_selector) window.PlayPilotLinkInjections.selector = config?.html_selector
85
89
  } catch(error) {
86
90
  // We return if the config did not get fetched properly, as we can't determine what should and should