@giphy/js-analytics
Advanced tools
Comparing version 1.0.5 to 1.0.6
export { default as pingback } from './pingback'; | ||
export { default as bottleData } from './bottle-data'; | ||
export { addLastSearchResponseId } from './session'; | ||
export * from './types'; |
@@ -7,2 +7,4 @@ "use strict"; | ||
exports.bottleData = bottle_data_1.default; | ||
var session_1 = require("./session"); | ||
exports.addLastSearchResponseId = session_1.addLastSearchResponseId; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,3 @@ | ||
import { PingbackEventType, PingbackRequestAction } from './types'; | ||
import { PingbackEventType } from '@giphy/js-types'; | ||
import { PingbackRequestAction } from './types'; | ||
declare type SessionEvent = { | ||
@@ -16,3 +17,5 @@ event_type: PingbackEventType; | ||
}; | ||
export declare const SESSION_STORAGE_KEY = "responseIds"; | ||
export declare function addLastSearchResponseId(responseId: string): void; | ||
export declare const createSession: (event_type: PingbackEventType, actions: PingbackRequestAction[], responseId?: string, loggedInUserId?: string) => Session; | ||
export {}; |
@@ -7,5 +7,6 @@ "use strict"; | ||
var cookie_1 = __importDefault(require("cookie")); | ||
exports.SESSION_STORAGE_KEY = 'responseIds'; | ||
function getLastResponseId() { | ||
try { | ||
var sessionIds = sessionStorage.getItem('responseIds'); | ||
var sessionIds = sessionStorage.getItem(exports.SESSION_STORAGE_KEY); | ||
if (sessionIds) { | ||
@@ -19,2 +20,18 @@ var responseIds = JSON.parse(sessionIds) || []; | ||
} | ||
function addLastSearchResponseId(responseId) { | ||
try { | ||
var existing = sessionStorage.getItem(exports.SESSION_STORAGE_KEY); | ||
if (existing) { | ||
var searchResponseIds = JSON.parse(existing); | ||
if (searchResponseIds[searchResponseIds.length - 1] !== responseId) { | ||
window.sessionStorage.setItem(exports.SESSION_STORAGE_KEY, JSON.stringify(searchResponseIds.concat([responseId]))); | ||
} | ||
} | ||
else { | ||
sessionStorage.setItem(exports.SESSION_STORAGE_KEY, JSON.stringify([responseId])); | ||
} | ||
} | ||
catch (_) { } | ||
} | ||
exports.addLastSearchResponseId = addLastSearchResponseId; | ||
// the session is the request payload of a pingback request | ||
@@ -21,0 +38,0 @@ exports.createSession = function (event_type, actions, responseId, loggedInUserId) { |
@@ -1,2 +0,2 @@ | ||
import { IGif, IUser } from '@giphy/js-types'; | ||
import { IGif, IUser, PingbackEventType } from '@giphy/js-types'; | ||
export declare type Pingback = { | ||
@@ -18,2 +18,1 @@ gif: IGif; | ||
}; | ||
export declare type PingbackEventType = 'GIF_TRENDING' | 'GIF_RELATED' | 'GIF_CHANNEL' | 'GIF_SEARCH' | 'GIF_EXPLORE'; |
@@ -6,3 +6,3 @@ { | ||
"prepublish": "npm run clean && tsc", | ||
"refresh": "tsc", | ||
"build": "tsc", | ||
"test": "jest --config ./jestconfig.js", | ||
@@ -12,3 +12,3 @@ "test:watch": "jest --config ./jestconfig.js --watchAll" | ||
"name": "@giphy/js-analytics", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"main": "dist/index.js", | ||
@@ -21,4 +21,4 @@ "types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@giphy/js-types": "^1.0.5", | ||
"@giphy/js-util": "^1.0.5", | ||
"@giphy/js-types": "^1.0.6", | ||
"@giphy/js-util": "^1.0.6", | ||
"cookie": "0.3.1", | ||
@@ -35,3 +35,3 @@ "dompurify": "^1.0.10", | ||
}, | ||
"gitHead": "f05648f2d7571d864513dbc041447e328e163738" | ||
"gitHead": "28535e55d485cb4cc4a22cc2b829791e5c0c1c32" | ||
} |
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
15219
213
Updated@giphy/js-types@^1.0.6
Updated@giphy/js-util@^1.0.6