Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@giphy/js-analytics

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@giphy/js-analytics - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

2

dist/util.d.ts

@@ -1,2 +0,2 @@

import { PingbackRequestAction, PingbackActionType, PingbackAttribute } from './types';
import { PingbackActionType, PingbackAttribute, PingbackRequestAction } from './types';
export declare function getAction(action_type: PingbackActionType, gif_id: string, tid?: string, position?: ClientRect, attributes?: PingbackAttribute[]): PingbackRequestAction;

@@ -5,3 +5,5 @@ "use strict";

if (attributes === void 0) { attributes = []; }
if (position) {
if (position &&
// apppend position only if it's not passed as a custom attribute
!attributes.some(function (attributes) { return attributes.key === 'position'; })) {
attributes.push({

@@ -8,0 +10,0 @@ key: "position",

@@ -11,3 +11,3 @@ {

"name": "@giphy/js-analytics",
"version": "1.7.0",
"version": "1.7.1",
"main": "dist/index.js",

@@ -41,3 +41,3 @@ "types": "dist/index.d.ts",

},
"gitHead": "6f2c35c17ee0ebbf04bf568a3e0944308d008dc7"
"gitHead": "79318608ea6336eb3f72a657375c4d3e9e4370ee"
}
import { IGif, IUser } from '@giphy/js-types'
import pingback from '../pingback'
import { SESSION_STORAGE_KEY, addLastSearchResponseId } from '../session'
import { addLastSearchResponseId, SESSION_STORAGE_KEY } from '../session'

@@ -79,3 +79,2 @@ const gl = ((typeof window !== 'undefined' ? window : global) || {}) as any

})
// @ts-ignore

@@ -126,2 +125,37 @@ expect(fetch.mock.calls.length).toEqual(2)

})
test('request custom attributes', () => {
sessionStorage.setItem(SESSION_STORAGE_KEY, JSON.stringify(['a', 'b', 'c']))
pingback({
gif: gif as IGif,
user: {},
type: 'GIF_RELATED',
responseId,
actionType: 'CLICK',
attributes: [{ key: 'position', value: `1` }],
position,
})
// @ts-ignore
expect(fetch.mock.calls.length).toEqual(1)
// @ts-ignore
const [[, options]] = fetch.mock.calls
const {
sessions: [session],
} = JSON.parse(options.body)
const [event] = session.events
const { actions } = event
delete event.actions
const [action] = actions
delete action.ts
expect(action).toEqual({
action_type: 'CLICK',
gif_id: '9870',
tid: 'tid!',
attributes: [
{
key: 'position',
value: `1`,
},
],
})
})
})

@@ -1,2 +0,2 @@

import { PingbackRequestAction, PingbackActionType, PingbackAttribute } from './types'
import { PingbackActionType, PingbackAttribute, PingbackRequestAction } from './types'

@@ -10,3 +10,7 @@ export function getAction(

): PingbackRequestAction {
if (position) {
if (
position &&
// apppend position only if it's not passed as a custom attribute
!attributes.some(attributes => attributes.key === 'position')
) {
attributes.push({

@@ -13,0 +17,0 @@ key: `position`,

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc