analytics-client
Advanced tools
Comparing version 1.3.0 to 1.4.0-getQueryString-changes-d883b3d288bc529829aaf58798d9c18e037f5487
@@ -7,5 +7,10 @@ # Change Log | ||
# v1.3.0 | ||
# v1.4.0 | ||
## (2021-02-25) | ||
* Changed getQueryString to validate domains [Ezequiel Boehler] | ||
# v1.3.0 | ||
## (2021-02-24) | ||
* Don't store session ID in a cookie [Pranas Ziaukas] | ||
@@ -12,0 +17,0 @@ * Implement session ID parsing and logic [Pranas Ziaukas] |
{ | ||
"name": "analytics-client", | ||
"version": "1.3.0", | ||
"version": "1.4.0-getQueryString-changes-d883b3d288bc529829aaf58798d9c18e037f5487", | ||
"description": "Convenient builders to compose analytics tools", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -19,4 +19,4 @@ import { Client } from './client'; | ||
getSessionIdQueryString(): string; | ||
getQueryString(): string; | ||
getQueryString(destinationHostname?: string): string; | ||
isOptOutRequested(): boolean; | ||
} |
@@ -102,6 +102,16 @@ "use strict"; | ||
}; | ||
AnalyticsUrlParams.prototype.getQueryString = function () { | ||
return [this.getDeviceIdsQueryString(), this.getSessionIdQueryString()] | ||
.filter(function (x) { return x; }) | ||
.join('&'); | ||
AnalyticsUrlParams.prototype.getQueryString = function (destinationHostname) { | ||
var regex = /([a-zA-Z0-9-]+)(\.[a-zA-Z]{2,5})?(\.[a-zA-Z]+$)/g; | ||
var actualDomain = window.location.hostname.match(regex); | ||
var destinationDomain = destinationHostname | ||
? destinationHostname.match(regex) | ||
: undefined; | ||
if (actualDomain !== destinationDomain) { | ||
return [this.getDeviceIdsQueryString(), this.getSessionIdQueryString()] | ||
.filter(function (x) { return x; }) | ||
.join('&'); | ||
} | ||
else { | ||
return ''; | ||
} | ||
}; | ||
@@ -108,0 +118,0 @@ AnalyticsUrlParams.prototype.isOptOutRequested = function () { |
{ | ||
"name": "analytics-client", | ||
"version": "1.3.0", | ||
"version": "1.4.0-getQueryString-changes-d883b3d288bc529829aaf58798d9c18e037f5487", | ||
"description": "Convenient builders to compose analytics tools", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -166,6 +166,16 @@ import * as Cookies from 'js-cookie'; | ||
*/ | ||
getQueryString(): string { | ||
return [this.getDeviceIdsQueryString(), this.getSessionIdQueryString()] | ||
.filter(x => x) | ||
.join('&'); | ||
getQueryString(destinationHostname?: string): string { | ||
const regex = /([a-zA-Z0-9-]+)(\.[a-zA-Z]{2,5})?(\.[a-zA-Z]+$)/g; | ||
const actualDomain = window.location.hostname.match(regex); | ||
const destinationDomain = destinationHostname | ||
? destinationHostname.match(regex) | ||
: undefined; | ||
if (actualDomain !== destinationDomain) { | ||
return [this.getDeviceIdsQueryString(), this.getSessionIdQueryString()] | ||
.filter(x => x) | ||
.join('&'); | ||
} else { | ||
return ''; | ||
} | ||
} | ||
@@ -172,0 +182,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
302544
2411
2