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

@amplitude/analytics-client-common

Package Overview
Dependencies
Maintainers
0
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplitude/analytics-client-common - npm Package Compare versions

Comparing version 2.2.3 to 2.2.4

36

lib/cjs/storage/cookie.js

@@ -46,9 +46,10 @@ Object.defineProperty(exports, "__esModule", { value: true });

CookieStorage.prototype.get = function (key) {
var _a;
return tslib_1.__awaiter(this, void 0, void 0, function () {
var value;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
var value, decodedValue;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.getRaw(key)];
case 1:
value = _a.sent();
value = _b.sent();
if (!value) {

@@ -58,10 +59,9 @@ return [2 /*return*/, undefined];

try {
try {
value = decodeURIComponent(atob(value));
}
catch (_b) {
decodedValue = (_a = decodeCookiesAsDefault(value)) !== null && _a !== void 0 ? _a : decodeCookiesWithDoubleUrlEncoding(value);
if (decodedValue === undefined) {
console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(key, ", value: ").concat(value));
return [2 /*return*/, undefined];
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return [2 /*return*/, JSON.parse(value)];
return [2 /*return*/, JSON.parse(decodedValue)];
}

@@ -155,2 +155,20 @@ catch (_c) {

exports.CookieStorage = CookieStorage;
var decodeCookiesAsDefault = function (value) {
try {
return decodeURIComponent(atob(value));
}
catch (_a) {
return undefined;
}
};
var decodeCookiesWithDoubleUrlEncoding = function (value) {
// Modern Ruby (v7+) automatically encodes cookies with URL encoding by
// https://api.rubyonrails.org/classes/ActionDispatch/Cookies.html
try {
return decodeURIComponent(atob(decodeURIComponent(value)));
}
catch (_a) {
return undefined;
}
};
//# sourceMappingURL=cookie.js.map

@@ -44,9 +44,10 @@ import { __assign, __awaiter, __generator } from "tslib";

CookieStorage.prototype.get = function (key) {
var _a;
return __awaiter(this, void 0, void 0, function () {
var value;
return __generator(this, function (_a) {
switch (_a.label) {
var value, decodedValue;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.getRaw(key)];
case 1:
value = _a.sent();
value = _b.sent();
if (!value) {

@@ -56,10 +57,9 @@ return [2 /*return*/, undefined];

try {
try {
value = decodeURIComponent(atob(value));
}
catch (_b) {
decodedValue = (_a = decodeCookiesAsDefault(value)) !== null && _a !== void 0 ? _a : decodeCookiesWithDoubleUrlEncoding(value);
if (decodedValue === undefined) {
console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(key, ", value: ").concat(value));
return [2 /*return*/, undefined];
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return [2 /*return*/, JSON.parse(value)];
return [2 /*return*/, JSON.parse(decodedValue)];
}

@@ -153,2 +153,20 @@ catch (_c) {

export { CookieStorage };
var decodeCookiesAsDefault = function (value) {
try {
return decodeURIComponent(atob(value));
}
catch (_a) {
return undefined;
}
};
var decodeCookiesWithDoubleUrlEncoding = function (value) {
// Modern Ruby (v7+) automatically encodes cookies with URL encoding by
// https://api.rubyonrails.org/classes/ActionDispatch/Cookies.html
try {
return decodeURIComponent(atob(decodeURIComponent(value)));
}
catch (_a) {
return undefined;
}
};
//# sourceMappingURL=cookie.js.map
{
"name": "@amplitude/analytics-client-common",
"version": "2.2.3",
"version": "2.2.4",
"description": "",

@@ -46,3 +46,3 @@ "author": "Amplitude Inc",

],
"gitHead": "58f78b288db20dec13ef0c4381d14916ad4d4811"
"gitHead": "bd12b9b751890e3e1b802235a748d729c624866f"
}

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