@giphy/js-analytics
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -28,2 +28,7 @@ "use strict"; | ||
var gif = _a.gif, user = _a.user, responseId = _a.responseId, pingbackType = _a.type, actionType = _a.actionType, position = _a.position; | ||
// not all endpoints provide a response_id | ||
if (!responseId) { | ||
js_util_1.Logger.debug("Pingback aborted for " + gif.id + ", no responseId"); | ||
return; | ||
} | ||
var id = gif.id, _b = gif.bottle_data, bottle_data = _b === void 0 ? {} : _b; | ||
@@ -30,0 +35,0 @@ var tid = bottle_data.tid; |
@@ -11,3 +11,3 @@ { | ||
"name": "@giphy/js-analytics", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"main": "dist/index.js", | ||
@@ -39,3 +39,3 @@ "types": "dist/index.d.ts", | ||
}, | ||
"gitHead": "296180057a9d81c5d47a325cd3eff8c4b1c69b35" | ||
"gitHead": "a1ff1ea09b78484e2f7ea6d541c4fa404a6cb2ee" | ||
} |
@@ -45,2 +45,16 @@ import { IGif, IUser } from '@giphy/js-types' | ||
const position = { top: 0, left: 20 } as ClientRect | ||
test('no response id', () => { | ||
pingback({ | ||
gif: gif as IGif, | ||
user, | ||
// @ts-ignore | ||
responseId: undefined, | ||
type: 'GIF_RELATED', | ||
actionType: 'CLICK', | ||
position, | ||
}) | ||
// @ts-ignore | ||
expect(fetch.mock.calls.length).toEqual(0) | ||
}) | ||
test('request', () => { | ||
@@ -47,0 +61,0 @@ sessionStorage.setItem(SESSION_STORAGE_KEY, JSON.stringify(['a', 'b', 'c'])) |
@@ -6,3 +6,3 @@ import { debounce } from 'throttle-debounce' | ||
import { PingbackEventType } from '@giphy/js-types' | ||
import { forEach } from '@giphy/js-util' | ||
import { forEach, Logger } from '@giphy/js-util' | ||
import { sendPingback } from './send-pingback' | ||
@@ -35,2 +35,7 @@ | ||
const pingback = ({ gif, user, responseId, type: pingbackType, actionType, position }: Pingback) => { | ||
// not all endpoints provide a response_id | ||
if (!responseId) { | ||
Logger.debug(`Pingback aborted for ${gif.id}, no responseId`) | ||
return | ||
} | ||
const { id, bottle_data = {} } = gif | ||
@@ -37,0 +42,0 @@ const { tid } = bottle_data |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26428
524