analytics-client
Advanced tools
Comparing version 1.0.0-amplitude-init-changes-0593b1efbd0ee817f7280e490b46cb4cb9c52a9c to 1.0.0-amplitude-init-changes-34c278f0f3fa5ec04c709995f9ac811451c8c76a
@@ -8,3 +8,3 @@ # Change Log | ||
# v1.0.0 | ||
## (2021-02-15) | ||
## (2021-02-16) | ||
@@ -11,0 +11,0 @@ * Changes on how device_id is treated on init [Ezequiel Boehler] |
{ | ||
"name": "analytics-client", | ||
"version": "1.0.0-amplitude-init-changes-0593b1efbd0ee817f7280e490b46cb4cb9c52a9c", | ||
"version": "1.0.0-amplitude-init-changes-34c278f0f3fa5ec04c709995f9ac811451c8c76a", | ||
"description": "Convenient builders to compose analytics tools", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -13,5 +13,5 @@ import { Client } from './client'; | ||
allDeviceIds(): string[]; | ||
getPassedDeviceIds(): string[]; | ||
getPassedDeviceId(): string | null; | ||
getDeviceIdsQueryString(): string; | ||
isOptOutRequested(): boolean; | ||
} |
@@ -11,3 +11,3 @@ "use strict"; | ||
this.deviceIds = new Set(); | ||
this.passedDeviceIds = new Set(); | ||
this.passedDeviceIds = []; | ||
this.optOutRequsted = false; | ||
@@ -19,3 +19,3 @@ var storedValue = Cookies.get(config_1.COOKIES_DEVICE_IDS); | ||
var list = inputIdString ? inputIdString.split(deviceIdSeparator) : []; | ||
this.passedDeviceIds = new Set(Array.from(list)); | ||
this.passedDeviceIds = list; | ||
if (currentDeviceId) { | ||
@@ -70,6 +70,5 @@ list.push(currentDeviceId); | ||
}; | ||
AnalyticsUrlParams.prototype.getPassedDeviceIds = function () { | ||
var passedIds = this.passedDeviceIds; | ||
var res = new Set(passedIds); | ||
return Array.from(res); | ||
AnalyticsUrlParams.prototype.getPassedDeviceId = function () { | ||
var passedId = this.passedDeviceIds.length > 0 ? this.passedDeviceIds[0] : null; | ||
return passedId; | ||
}; | ||
@@ -76,0 +75,0 @@ AnalyticsUrlParams.prototype.getDeviceIdsQueryString = function () { |
{ | ||
"name": "analytics-client", | ||
"version": "1.0.0-amplitude-init-changes-0593b1efbd0ee817f7280e490b46cb4cb9c52a9c", | ||
"version": "1.0.0-amplitude-init-changes-34c278f0f3fa5ec04c709995f9ac811451c8c76a", | ||
"description": "Convenient builders to compose analytics tools", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -32,4 +32,4 @@ Analytics client | ||
// Then if there was any passed device id we can obtain them like this. | ||
// passedDeviceId is either the first d_id param passed on the URL or null, so getPassedDeviceIds()[0] works even when no d_id is sent on the URL. | ||
const passedDeviceId = urlParamsHandler.getPassedDeviceIds()[0] | ||
// passedDeviceId is either the first d_id param passed on the URL or null | ||
const passedDeviceId = urlParamsHandler.getPassedDeviceId() | ||
@@ -42,3 +42,3 @@ // Now that we checked for any passed device_id we can proceed with creating and initializing the client | ||
componentVersion: require('./package.json').version, // (optional) automated version reporting | ||
deviceId: passedDeviceId, | ||
deviceId: passedDeviceId, | ||
}) | ||
@@ -45,0 +45,0 @@ ``` |
@@ -18,3 +18,3 @@ import * as Cookies from 'js-cookie'; | ||
private deviceIds: Set<string> = new Set(); | ||
private passedDeviceIds: Set<string> = new Set(); | ||
private passedDeviceIds: string[] = []; | ||
private optOutRequsted: boolean = false; | ||
@@ -32,3 +32,3 @@ | ||
const list = inputIdString ? inputIdString.split(deviceIdSeparator) : []; | ||
this.passedDeviceIds = new Set(Array.from(list)); | ||
this.passedDeviceIds = list; | ||
@@ -109,6 +109,6 @@ if (currentDeviceId) { | ||
*/ | ||
getPassedDeviceIds() { | ||
const passedIds = this.passedDeviceIds; | ||
const res = new Set(passedIds); | ||
return Array.from(res); | ||
getPassedDeviceId() { | ||
const passedId = | ||
this.passedDeviceIds.length > 0 ? this.passedDeviceIds[0] : null; | ||
return passedId; | ||
} | ||
@@ -115,0 +115,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
285475
2141