@amplitude/analytics-client-common
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -10,5 +10,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
CampaignParser.prototype.parse = function () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return [2 /*return*/, (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, constants_1.BASE_CAMPAIGN), this.getUtmParam()), this.getReferrer()), this.getClickIds())]; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
return [2 /*return*/, tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, constants_1.BASE_CAMPAIGN), this.getUtmParam()), this.getReferrer()), this.getClickIds())]; | ||
}); | ||
@@ -15,0 +15,0 @@ }); |
@@ -24,4 +24,2 @@ import { Storage, Campaign, CampaignParser as ICampaignParser, CampaignTracker as ICampaignTracker, CampaignTrackFunction, CampaignTrackerOptions } from '@amplitude/analytics-types'; | ||
[key: string]: any; | ||
} | import("@amplitude/analytics-types").IdentifyUserProperties | { | ||
[x: string]: any; | ||
}; | ||
@@ -28,0 +26,0 @@ group_properties?: { |
@@ -27,4 +27,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
if (ignoreSubdomainInReferrer === void 0) { ignoreSubdomainInReferrer = false; } | ||
var referrer = current.referrer, referring_domain = current.referring_domain, currentCampaign = (0, tslib_1.__rest)(current, ["referrer", "referring_domain"]); | ||
var _a = previous || {}, _previous_referrer = _a.referrer, prevReferringDomain = _a.referring_domain, previousCampaign = (0, tslib_1.__rest)(_a, ["referrer", "referring_domain"]); | ||
var referrer = current.referrer, referring_domain = current.referring_domain, currentCampaign = tslib_1.__rest(current, ["referrer", "referring_domain"]); | ||
var _a = previous || {}, _previous_referrer = _a.referrer, prevReferringDomain = _a.referring_domain, previousCampaign = tslib_1.__rest(_a, ["referrer", "referring_domain"]); | ||
if (current.referring_domain && this.excludeReferrers.includes(current.referring_domain)) { | ||
@@ -40,4 +40,4 @@ return false; | ||
CampaignTracker.prototype.saveCampaignToStorage = function (campaign) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
@@ -53,4 +53,4 @@ case 0: return [4 /*yield*/, this.storage.set(this.storageKey, campaign)]; | ||
CampaignTracker.prototype.getCampaignFromStorage = function () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
@@ -65,5 +65,5 @@ case 0: return [4 /*yield*/, this.storage.get(this.storageKey)]; | ||
var _this = this; | ||
var campaignParameters = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, constants_1.BASE_CAMPAIGN), campaign); | ||
var campaignParameters = tslib_1.__assign(tslib_1.__assign({}, constants_1.BASE_CAMPAIGN), campaign); | ||
var identifyEvent = Object.entries(campaignParameters).reduce(function (identify, _a) { | ||
var _b = (0, tslib_1.__read)(_a, 2), key = _b[0], value = _b[1]; | ||
var _b = tslib_1.__read(_a, 2), key = _b[0], value = _b[1]; | ||
identify.setOnce("initial_".concat(key), value || _this.initialEmptyValue); | ||
@@ -83,8 +83,8 @@ if (value) { | ||
}; | ||
return (0, tslib_1.__assign)((0, tslib_1.__assign)({}, (0, analytics_core_1.createIdentifyEvent)(identifyEvent)), (this.trackPageViews && pageViewEvent)); | ||
return tslib_1.__assign(tslib_1.__assign({}, (0, analytics_core_1.createIdentifyEvent)(identifyEvent)), (this.trackPageViews && pageViewEvent)); | ||
}; | ||
CampaignTracker.prototype.send = function (isNewSession) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var currentCampaign, previousCampaign; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
@@ -91,0 +91,0 @@ case 0: |
@@ -13,5 +13,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
IdentityEventSender.prototype.execute = function (context) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var userProperties; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__generator(this, function (_a) { | ||
userProperties = context.user_properties; | ||
@@ -18,0 +18,0 @@ if (userProperties) { |
@@ -6,3 +6,2 @@ import { UserSession, Storage, SessionManager as ISessionManager } from '@amplitude/analytics-types'; | ||
cache: UserSession; | ||
isSessionCacheValid: boolean; | ||
constructor(storage: Storage<UserSession>, apiKey: string); | ||
@@ -9,0 +8,0 @@ /** |
@@ -8,3 +8,2 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
this.storage = storage; | ||
this.isSessionCacheValid = true; | ||
this.storageKey = (0, cookie_name_1.getCookieName)(apiKey); | ||
@@ -22,5 +21,5 @@ this.cache = { optOut: false }; | ||
var _a; | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var _b; | ||
return (0, tslib_1.__generator)(this, function (_c) { | ||
return tslib_1.__generator(this, function (_c) { | ||
switch (_c.label) { | ||
@@ -40,19 +39,9 @@ case 0: | ||
SessionManager.prototype.setSession = function (session) { | ||
this.cache = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, this.cache), session); | ||
this.cache = tslib_1.__assign(tslib_1.__assign({}, this.cache), session); | ||
void this.storage.set(this.storageKey, this.cache); | ||
}; | ||
SessionManager.prototype.getSessionId = function () { | ||
var _this = this; | ||
this.isSessionCacheValid = true; | ||
void this.storage.get(this.storageKey).then(function (userSession) { | ||
// Checks if session id has been set since the last get | ||
if (_this.isSessionCacheValid) { | ||
_this.cache.sessionId = userSession === null || userSession === void 0 ? void 0 : userSession.sessionId; | ||
} | ||
}); | ||
return this.cache.sessionId; | ||
}; | ||
SessionManager.prototype.setSessionId = function (sessionId) { | ||
// Flags session id has been set | ||
this.isSessionCacheValid = false; | ||
this.setSession({ sessionId: sessionId }); | ||
@@ -59,0 +48,0 @@ }; |
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
function CookieStorage(options) { | ||
this.options = (0, tslib_1.__assign)({}, options); | ||
this.options = tslib_1.__assign({}, options); | ||
} | ||
CookieStorage.prototype.isEnabled = function () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var random, testStrorage, testKey, value, _a; | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
@@ -47,5 +47,5 @@ case 0: | ||
CookieStorage.prototype.get = function (key) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var value; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
@@ -79,5 +79,5 @@ case 0: return [4 /*yield*/, this.getRaw(key)]; | ||
var _a; | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var globalScope, cookie, match; | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return tslib_1.__generator(this, function (_b) { | ||
globalScope = (0, global_scope_1.getGlobalScope)(); | ||
@@ -95,5 +95,5 @@ cookie = (_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.document.cookie.split('; ')) !== null && _a !== void 0 ? _a : []; | ||
var _a; | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var expirationDays, expires, expireDate, date, str, globalScope; | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return tslib_1.__generator(this, function (_b) { | ||
try { | ||
@@ -135,4 +135,4 @@ expirationDays = (_a = this.options.expirationDays) !== null && _a !== void 0 ? _a : 0; | ||
CookieStorage.prototype.remove = function (key) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
@@ -148,4 +148,4 @@ case 0: return [4 /*yield*/, this.set(key, null)]; | ||
CookieStorage.prototype.reset = function () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
return [2 /*return*/]; | ||
@@ -152,0 +152,0 @@ }); |
@@ -6,3 +6,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var FetchTransport = /** @class */ (function (_super) { | ||
(0, tslib_1.__extends)(FetchTransport, _super); | ||
tslib_1.__extends(FetchTransport, _super); | ||
function FetchTransport() { | ||
@@ -12,5 +12,5 @@ return _super !== null && _super.apply(this, arguments) || this; | ||
FetchTransport.prototype.send = function (serverUrl, payload) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var options, response, responsePayload; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
@@ -17,0 +17,0 @@ case 0: |
@@ -24,4 +24,2 @@ import { Storage, Campaign, CampaignParser as ICampaignParser, CampaignTracker as ICampaignTracker, CampaignTrackFunction, CampaignTrackerOptions } from '@amplitude/analytics-types'; | ||
[key: string]: any; | ||
} | import("@amplitude/analytics-types").IdentifyUserProperties | { | ||
[x: string]: any; | ||
}; | ||
@@ -28,0 +26,0 @@ group_properties?: { |
@@ -6,3 +6,2 @@ import { UserSession, Storage, SessionManager as ISessionManager } from '@amplitude/analytics-types'; | ||
cache: UserSession; | ||
isSessionCacheValid: boolean; | ||
constructor(storage: Storage<UserSession>, apiKey: string); | ||
@@ -9,0 +8,0 @@ /** |
@@ -6,3 +6,2 @@ import { __assign, __awaiter, __generator } from "tslib"; | ||
this.storage = storage; | ||
this.isSessionCacheValid = true; | ||
this.storageKey = getStorageKey(apiKey); | ||
@@ -41,15 +40,5 @@ this.cache = { optOut: false }; | ||
SessionManager.prototype.getSessionId = function () { | ||
var _this = this; | ||
this.isSessionCacheValid = true; | ||
void this.storage.get(this.storageKey).then(function (userSession) { | ||
// Checks if session id has been set since the last get | ||
if (_this.isSessionCacheValid) { | ||
_this.cache.sessionId = userSession === null || userSession === void 0 ? void 0 : userSession.sessionId; | ||
} | ||
}); | ||
return this.cache.sessionId; | ||
}; | ||
SessionManager.prototype.setSessionId = function (sessionId) { | ||
// Flags session id has been set | ||
this.isSessionCacheValid = false; | ||
this.setSession({ sessionId: sessionId }); | ||
@@ -56,0 +45,0 @@ }; |
{ | ||
"name": "@amplitude/analytics-client-common", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "", | ||
@@ -38,5 +38,5 @@ "author": "Amplitude Inc", | ||
"@amplitude/analytics-connector": "^1.4.5", | ||
"@amplitude/analytics-core": "^0.11.0", | ||
"@amplitude/analytics-core": "^0.11.1", | ||
"@amplitude/analytics-types": "^0.14.0", | ||
"tslib": "^2.3.1" | ||
"tslib": "^2.4.1" | ||
}, | ||
@@ -46,3 +46,3 @@ "files": [ | ||
], | ||
"gitHead": "e4e95ad7ee239eaa9712eec347ad0ebe43bf2993" | ||
"gitHead": "bb021b75fd1c48cbdb98d8f328eebb74f85c6fb4" | ||
} |
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
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
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
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
151454
1568
Updatedtslib@^2.4.1