@giphy/js-analytics
Advanced tools
Comparing version 1.6.2 to 1.7.0
export { default as pingback } from './pingback'; | ||
export { default as bottleData } from './bottle-data'; | ||
export { addLastSearchResponseId } from './session'; | ||
export * from './types'; |
@@ -5,6 +5,4 @@ "use strict"; | ||
exports.pingback = pingback_1.default; | ||
var bottle_data_1 = require("./bottle-data"); | ||
exports.bottleData = bottle_data_1.default; | ||
var session_1 = require("./session"); | ||
exports.addLastSearchResponseId = session_1.addLastSearchResponseId; | ||
//# sourceMappingURL=index.js.map |
import { Pingback } from './types'; | ||
declare const pingback: ({ gif, user, responseId, type: pingbackType, actionType, position }: Pingback) => void; | ||
declare const pingback: ({ gif, user, responseId, type: pingbackType, actionType, position, attributes }: Pingback) => void; | ||
export default pingback; |
@@ -27,3 +27,3 @@ "use strict"; | ||
var pingback = function (_a) { | ||
var gif = _a.gif, user = _a.user, responseId = _a.responseId, pingbackType = _a.type, actionType = _a.actionType, position = _a.position; | ||
var gif = _a.gif, user = _a.user, responseId = _a.responseId, pingbackType = _a.type, actionType = _a.actionType, position = _a.position, attributes = _a.attributes; | ||
// not all endpoints provide a response_id | ||
@@ -47,3 +47,3 @@ if (!responseId) { | ||
// add the action | ||
actionMap[responseId].push(util_1.getAction(actionType, String(id), tid, position)); | ||
actionMap[responseId].push(util_1.getAction(actionType, String(id), tid, position, attributes)); | ||
// if there's a tid, skip the queue | ||
@@ -50,0 +50,0 @@ tid ? fetchPingbackRequest() : debouncedPingbackEvent(); |
@@ -14,3 +14,3 @@ "use strict"; | ||
var cookie_1 = __importDefault(require("cookie")); | ||
var uuid_1 = require("uuid"); | ||
var uuid_1 = require("uuid"); // v1 only for pingback verfication | ||
exports.SESSION_STORAGE_KEY = 'responseIds'; | ||
@@ -72,3 +72,3 @@ function getLastResponseId() { | ||
user: { | ||
user_id: cookie_1.default.parse(document.cookie).giphy_pbid, | ||
user_id: cookie_1.default.parse(document ? document.cookie : {}).giphy_pbid, | ||
logged_in_user_id: loggedInUserId || '', | ||
@@ -75,0 +75,0 @@ random_id: getRandomId(), |
import { IGif, IUser, PingbackEventType } from '@giphy/js-types'; | ||
export declare type PingbackAttribute = { | ||
key: string; | ||
value: string; | ||
}; | ||
export declare type Pingback = { | ||
@@ -9,2 +13,3 @@ gif: IGif; | ||
position?: ClientRect; | ||
attributes?: PingbackAttribute[]; | ||
}; | ||
@@ -11,0 +16,0 @@ export declare type PingbackActionType = 'CLICK' | 'SEEN' | 'HOVER'; |
@@ -1,6 +0,2 @@ | ||
import { PingbackRequestAction, PingbackActionType } from './types'; | ||
export declare type Attribute = { | ||
key: string; | ||
value: string; | ||
}; | ||
export declare function getAction(action_type: PingbackActionType, gif_id: string, tid?: string, position?: ClientRect): PingbackRequestAction; | ||
import { PingbackRequestAction, PingbackActionType, PingbackAttribute } from './types'; | ||
export declare function getAction(action_type: PingbackActionType, gif_id: string, tid?: string, position?: ClientRect, attributes?: PingbackAttribute[]): PingbackRequestAction; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function getAction(action_type, gif_id, tid, position) { | ||
var attributes = []; | ||
function getAction(action_type, gif_id, tid, position, attributes) { | ||
if (attributes === void 0) { attributes = []; } | ||
if (position) { | ||
@@ -6,0 +6,0 @@ attributes.push({ |
@@ -11,3 +11,3 @@ { | ||
"name": "@giphy/js-analytics", | ||
"version": "1.6.2", | ||
"version": "1.7.0", | ||
"main": "dist/index.js", | ||
@@ -41,3 +41,3 @@ "types": "dist/index.d.ts", | ||
}, | ||
"gitHead": "160e08e508ba0a7a0bc85ba824b8df6706cb6147" | ||
"gitHead": "6f2c35c17ee0ebbf04bf568a3e0944308d008dc7" | ||
} |
export { default as pingback } from './pingback' | ||
export { default as bottleData } from './bottle-data' | ||
export { addLastSearchResponseId } from './session' | ||
export * from './types' |
@@ -33,3 +33,3 @@ import { debounce } from 'throttle-debounce' | ||
const pingback = ({ gif, user, responseId, type: pingbackType, actionType, position }: Pingback) => { | ||
const pingback = ({ gif, user, responseId, type: pingbackType, actionType, position, attributes }: Pingback) => { | ||
// not all endpoints provide a response_id | ||
@@ -56,3 +56,3 @@ if (!responseId) { | ||
// add the action | ||
actionMap[responseId].push(getAction(actionType, String(id), tid, position)) | ||
actionMap[responseId].push(getAction(actionType, String(id), tid, position, attributes)) | ||
@@ -59,0 +59,0 @@ // if there's a tid, skip the queue |
import cookie from 'cookie' | ||
import { PingbackEventType } from '@giphy/js-types' | ||
import { PingbackRequestAction } from './types' | ||
import { v1 as uuid } from 'uuid' | ||
import { v1 as uuid } from 'uuid' // v1 only for pingback verfication | ||
@@ -77,3 +77,3 @@ type SessionEvent = { | ||
user: { | ||
user_id: cookie.parse(document.cookie).giphy_pbid, | ||
user_id: cookie.parse(document ? document.cookie : ({} as any)).giphy_pbid, | ||
logged_in_user_id: loggedInUserId || '', | ||
@@ -80,0 +80,0 @@ random_id: getRandomId(), |
import { IGif, IUser, PingbackEventType } from '@giphy/js-types' | ||
export type PingbackAttribute = { | ||
key: string | ||
value: string | ||
} | ||
export type Pingback = { | ||
@@ -10,2 +15,3 @@ gif: IGif | ||
position?: ClientRect | ||
attributes?: PingbackAttribute[] | ||
} | ||
@@ -12,0 +18,0 @@ |
@@ -1,6 +0,3 @@ | ||
import { PingbackRequestAction, PingbackActionType } from './types' | ||
export type Attribute = { | ||
key: string | ||
value: string | ||
} | ||
import { PingbackRequestAction, PingbackActionType, PingbackAttribute } from './types' | ||
export function getAction( | ||
@@ -10,5 +7,5 @@ action_type: PingbackActionType, | ||
tid?: string, | ||
position?: ClientRect | ||
position?: ClientRect, | ||
attributes: PingbackAttribute[] = [] | ||
): PingbackRequestAction { | ||
const attributes: Attribute[] = [] | ||
if (position) { | ||
@@ -15,0 +12,0 @@ attributes.push({ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
27271
28
543