New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

analytics-client

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

analytics-client - npm Package Compare versions

Comparing version 1.3.0-url-session-id-e1044d2af608a5db024c0ffa059d4d2e0ca9bf5f to 1.3.0

8

CHANGELOG.md

@@ -8,6 +8,12 @@ # Change Log

# v1.3.0
## (2021-02-23)
## (2021-02-25)
* Don't store session ID in a cookie [Pranas Ziaukas]
* Implement session ID parsing and logic [Pranas Ziaukas]
# v1.2.1
## (2021-02-24)
* Fix `optOutRequested` typo [Pranas Ziaukas]
# v1.2.0

@@ -14,0 +20,0 @@ ## (2021-02-22)

2

dist/package.json
{
"name": "analytics-client",
"version": "1.3.0-url-session-id-e1044d2af608a5db024c0ffa059d4d2e0ca9bf5f",
"version": "1.3.0",
"description": "Convenient builders to compose analytics tools",

@@ -5,0 +5,0 @@ "repository": {

@@ -5,5 +5,4 @@ export declare const URL_PARAM_DEVICE_ID = "d_id";

export declare const COOKIES_DEVICE_IDS = "__analytics_dids";
export declare const COOKIES_SESSION_ID = "__analytics_sid";
export declare const COOKIES_TTL_DAYS = 300;
export declare const USER_PROP_COMPONENT_NAME = "ComponentName";
export declare const USER_PROP_ANALYTICS_CLIENT_VERSION = "AnalyticsClientVersion";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.USER_PROP_ANALYTICS_CLIENT_VERSION = exports.USER_PROP_COMPONENT_NAME = exports.COOKIES_TTL_DAYS = exports.COOKIES_SESSION_ID = exports.COOKIES_DEVICE_IDS = exports.URL_PARAM_OPT_OUT_REQUEST = exports.URL_PARAM_SESSION_ID = exports.URL_PARAM_DEVICE_ID = void 0;
exports.USER_PROP_ANALYTICS_CLIENT_VERSION = exports.USER_PROP_COMPONENT_NAME = exports.COOKIES_TTL_DAYS = exports.COOKIES_DEVICE_IDS = exports.URL_PARAM_OPT_OUT_REQUEST = exports.URL_PARAM_SESSION_ID = exports.URL_PARAM_DEVICE_ID = void 0;
exports.URL_PARAM_DEVICE_ID = 'd_id';

@@ -8,3 +8,2 @@ exports.URL_PARAM_SESSION_ID = 's_id';

exports.COOKIES_DEVICE_IDS = '__analytics_dids';
exports.COOKIES_SESSION_ID = '__analytics_sid';
exports.COOKIES_TTL_DAYS = 300;

@@ -11,0 +10,0 @@ exports.USER_PROP_COMPONENT_NAME = 'ComponentName';

@@ -7,3 +7,3 @@ import { Client } from './client';

private sessionId;
private optOutRequsted;
private optOutRequested;
constructor(client?: Client | undefined);

@@ -17,3 +17,3 @@ private setDeviceIds;

getPassedDeviceId(): string | undefined;
getSessionId(): number | null;
getSessionId(): number | undefined;
getDeviceIdsQueryString(): string;

@@ -20,0 +20,0 @@ getSessionIdQueryString(): string;

@@ -11,8 +11,5 @@ "use strict";

this.deviceIds = new Set();
this.sessionId = null;
this.optOutRequsted = false;
this.optOutRequested = false;
var storedDeviceIdValue = Cookies.get(config_1.COOKIES_DEVICE_IDS);
this.setDeviceIds(storedDeviceIdValue, null);
var storedSessionIdValue = Cookies.get(config_1.COOKIES_SESSION_ID);
this.setSessionId(storedSessionIdValue);
}

@@ -37,6 +34,2 @@ AnalyticsUrlParams.prototype.setDeviceIds = function (inputIdString, currentDeviceId) {

this.sessionId = Number(storedValue);
Cookies.set(config_1.COOKIES_SESSION_ID, storedValue, {
expires: config_1.COOKIES_TTL_DAYS,
path: '/',
});
}

@@ -47,7 +40,6 @@ return this.sessionId;

Cookies.remove(config_1.COOKIES_DEVICE_IDS);
Cookies.remove(config_1.COOKIES_SESSION_ID);
};
AnalyticsUrlParams.prototype.consumeUrlParameters = function (queryString) {
var params = new URLSearchParams(queryString);
this.optOutRequsted = params.get(config_1.URL_PARAM_OPT_OUT_REQUEST) === 'true';
this.optOutRequested = params.get(config_1.URL_PARAM_OPT_OUT_REQUEST) === 'true';
var passedDeviceId = params.get(config_1.URL_PARAM_DEVICE_ID);

@@ -108,3 +100,3 @@ if (passedDeviceId) {

var id = this.getSessionId();
if (id === null) {
if (id == null) {
return '';

@@ -120,3 +112,3 @@ }

AnalyticsUrlParams.prototype.isOptOutRequested = function () {
return this.optOutRequsted;
return this.optOutRequested;
};

@@ -123,0 +115,0 @@ return AnalyticsUrlParams;

{
"name": "analytics-client",
"version": "1.3.0-url-session-id-e1044d2af608a5db024c0ffa059d4d2e0ca9bf5f",
"version": "1.3.0",
"description": "Convenient builders to compose analytics tools",

@@ -5,0 +5,0 @@ "repository": {

@@ -11,3 +11,2 @@ /** Query parameter names used to pass IDs between sites. */

export const COOKIES_DEVICE_IDS = '__analytics_dids';
export const COOKIES_SESSION_ID = '__analytics_sid';
export const COOKIES_TTL_DAYS = 300;

@@ -14,0 +13,0 @@

@@ -5,3 +5,2 @@ import * as Cookies from 'js-cookie';

COOKIES_DEVICE_IDS,
COOKIES_SESSION_ID,
COOKIES_TTL_DAYS,

@@ -22,4 +21,4 @@ URL_PARAM_DEVICE_ID,

private passedDeviceId: string | undefined;
private sessionId: number | null = null;
private optOutRequsted: boolean = false;
private sessionId: number | undefined;
private optOutRequested: boolean = false;

@@ -29,5 +28,2 @@ constructor(private client?: Client) {

this.setDeviceIds(storedDeviceIdValue, null);
const storedSessionIdValue = Cookies.get(COOKIES_SESSION_ID);
this.setSessionId(storedSessionIdValue);
}

@@ -58,6 +54,2 @@

this.sessionId = Number(storedValue);
Cookies.set(COOKIES_SESSION_ID, storedValue, {
expires: COOKIES_TTL_DAYS,
path: '/',
});
}

@@ -69,3 +61,2 @@ return this.sessionId;

Cookies.remove(COOKIES_DEVICE_IDS);
Cookies.remove(COOKIES_SESSION_ID);
}

@@ -83,3 +74,3 @@

this.optOutRequsted = params.get(URL_PARAM_OPT_OUT_REQUEST) === 'true';
this.optOutRequested = params.get(URL_PARAM_OPT_OUT_REQUEST) === 'true';

@@ -172,3 +163,3 @@ const passedDeviceId = params.get(URL_PARAM_DEVICE_ID);

const id = this.getSessionId();
if (id === null) {
if (id == null) {
return '';

@@ -193,4 +184,4 @@ }

isOptOutRequested(): boolean {
return this.optOutRequsted;
return this.optOutRequested;
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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