Socket
Socket
Sign inDemoInstall

@schibsted/niche-tracking

Package Overview
Dependencies
1
Maintainers
7
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.6.9 to 4.7.0

1

lib/pulse/helpers.d.ts

@@ -8,4 +8,5 @@ export declare const originToEngagementFormat: (data: {

'@type': string;
terms: string | undefined;
url: string;
};
export declare const withReferrer: (fn: any) => (options: any, trackerOptions?: any) => any;

16

lib/pulse/helpers.js

@@ -1,8 +0,12 @@

import { get } from '../utils';
import { get, getSearchParam } from '../utils';
import state from './state';
export const originToEngagementFormat = (data) => ({
'@id': data.id,
'@type': data.type,
url: data.url,
});
export const originToEngagementFormat = (data) => {
const terms = getSearchParam('utm_term');
return {
'@id': data.id,
'@type': data.type,
terms,
url: data.url,
};
};
export const withReferrer = (fn) => (options, trackerOptions) => {

@@ -9,0 +13,0 @@ if (!options.object) {

@@ -6,1 +6,2 @@ export function isWeb(): boolean;

export function isPromise(obj: any): boolean;
export function getSearchParam(key: any): string | undefined;

@@ -8,1 +8,12 @@ export const isWeb = () => typeof window !== 'undefined';

export const isPromise = (obj) => !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
export const getSearchParam = (key) => {
try {
const params = new URL(document.location).searchParams;
const value = params.get(key);
return value !== null && value !== void 0 ? value : undefined;
}
catch (error) {
//
}
return undefined;
};
{
"name": "@schibsted/niche-tracking",
"version": "4.6.9",
"version": "4.7.0",
"description": "Package containing tracking logic reused between multiple Schibsted niche sites",

@@ -26,3 +26,3 @@ "main": "lib/index.js",

},
"gitHead": "3ec7a2376961132c7bca25adaa397e72a3f8cc32"
"gitHead": "f64531781d6455ef3d5f27f9883eb7f7b86bc493"
}

@@ -1,10 +0,15 @@

import { get } from '../utils';
import { get, getSearchParam } from '../utils';
import state from './state';
export const originToEngagementFormat = (data: { id: string; type: string; url: string }) => ({
'@id': data.id,
'@type': data.type,
url: data.url,
});
export const originToEngagementFormat = (data: { id: string; type: string; url: string }) => {
const terms = getSearchParam('utm_term');
return {
'@id': data.id,
'@type': data.type,
terms,
url: data.url,
};
};
export const withReferrer = (fn: any) => (options: any, trackerOptions?: any) => {

@@ -11,0 +16,0 @@ if (!options.object) {

@@ -16,1 +16,13 @@ export const isWeb = () => typeof window !== 'undefined';

!!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
export const getSearchParam = (key) => {
try {
const params = new URL(document.location).searchParams;
const value = params.get(key);
return value ?? undefined;
} catch (error) {
//
}
return undefined;
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc