@segment/analytics.js-core
Advanced tools
Comparing version 3.13.6 to 3.13.7
@@ -106,3 +106,2 @@ 'use strict'; | ||
*/ | ||
// TODO remove `unknown` | ||
Analytics.prototype.addDestinationMiddleware = function (integrationName, middlewares) { | ||
@@ -109,0 +108,0 @@ var self = this; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -19,4 +20,2 @@ * Module dependencies. | ||
* Initialize new `Entity` with `options`. | ||
* | ||
* @param {Object} options | ||
*/ | ||
@@ -58,7 +57,2 @@ function Entity(options) { | ||
* Get or set storage `options`. | ||
* | ||
* @param {Object} options | ||
* @property {Object} cookie | ||
* @property {Object} localStorage | ||
* @property {Boolean} persist (default: `true`) | ||
*/ | ||
@@ -72,4 +66,2 @@ Entity.prototype.options = function (options) { | ||
* Get or set the entity's `id`. | ||
* | ||
* @param {String} id | ||
*/ | ||
@@ -88,4 +80,2 @@ Entity.prototype.id = function (id) { | ||
* Get the entity's id. | ||
* | ||
* @return {String} | ||
*/ | ||
@@ -112,5 +102,5 @@ Entity.prototype._getId = function () { | ||
* Get the entity's id from cookies. | ||
* | ||
* @return {String} | ||
*/ | ||
// FIXME `options.cookie` is an optional field, so `this._options.cookie.key` | ||
// can thrown an exception. | ||
Entity.prototype._getIdFromCookie = function () { | ||
@@ -121,4 +111,2 @@ return this.storage().get(this._options.cookie.key); | ||
* Get the entity's id from cookies. | ||
* | ||
* @return {String} | ||
*/ | ||
@@ -133,4 +121,2 @@ Entity.prototype._getIdFromLocalStorage = function () { | ||
* Set the entity's `id`. | ||
* | ||
* @param {String} id | ||
*/ | ||
@@ -148,4 +134,2 @@ Entity.prototype._setId = function (id) { | ||
* Set the entity's `id` in cookies. | ||
* | ||
* @param {String} id | ||
*/ | ||
@@ -157,4 +141,2 @@ Entity.prototype._setIdInCookies = function (id) { | ||
* Set the entity's `id` in local storage. | ||
* | ||
* @param {String} id | ||
*/ | ||
@@ -170,4 +152,2 @@ Entity.prototype._setIdInLocalStorage = function (id) { | ||
* BACKWARDS COMPATIBILITY: aliased to `properties` | ||
* | ||
* @param {Object} traits | ||
*/ | ||
@@ -187,4 +167,2 @@ Entity.prototype.properties = Entity.prototype.traits = function (traits) { | ||
* since they aren't parsed back from local storage. | ||
* | ||
* @return {Object} | ||
*/ | ||
@@ -199,4 +177,2 @@ Entity.prototype._getTraits = function () { | ||
* Set the entity's `traits`. | ||
* | ||
* @param {Object} traits | ||
*/ | ||
@@ -215,5 +191,2 @@ Entity.prototype._setTraits = function (traits) { | ||
* extend the existing `traits` instead of overwriting. | ||
* | ||
* @param {String} id | ||
* @param {Object} traits | ||
*/ | ||
@@ -233,4 +206,2 @@ Entity.prototype.identify = function (id, traits) { | ||
* Save the entity to local storage and the cookie. | ||
* | ||
* @return {Boolean} | ||
*/ | ||
@@ -237,0 +208,0 @@ Entity.prototype.save = function () { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -23,4 +24,2 @@ * Module dependencies. | ||
* Initialize a new `Group` with `options`. | ||
* | ||
* @param {Object} options | ||
*/ | ||
@@ -27,0 +26,0 @@ function Group(options) { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
@@ -3,0 +4,0 @@ * Analytics.js |
@@ -23,6 +23,2 @@ 'use strict'; | ||
* Set a `key` and `value`. | ||
* | ||
* @param {String} key | ||
* @param {Mixed} value | ||
* @return {Boolean} | ||
*/ | ||
@@ -35,4 +31,2 @@ Memory.prototype.set = function (key, value) { | ||
* Get a `key`. | ||
* | ||
* @param {String} key | ||
*/ | ||
@@ -46,5 +40,2 @@ Memory.prototype.get = function (key) { | ||
* Remove a `key`. | ||
* | ||
* @param {String} key | ||
* @return {Boolean} | ||
*/ | ||
@@ -51,0 +42,0 @@ Memory.prototype.remove = function (key) { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var bindAll = require('bind-all'); | ||
@@ -10,7 +11,2 @@ var send = require('@segment/send-json'); | ||
* Set the metrics options. | ||
* | ||
* @param {Object} options | ||
* @field {String} host | ||
* @field {Number} sampleRate | ||
* @field {Number} flushTimer | ||
*/ | ||
@@ -33,5 +29,2 @@ Metrics.prototype.options = function (options) { | ||
* Increments the counter identified by name and tags by one. | ||
* | ||
* @param {String} metric Name of the metric to increment. | ||
* @param {Object} tags Dimensions associated with the metric. | ||
*/ | ||
@@ -38,0 +31,0 @@ Metrics.prototype.increment = function (metric, tags) { |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
@@ -25,9 +26,2 @@ * Module Dependencies. | ||
var toplevel = ['integrations', 'anonymousId', 'timestamp', 'context']; | ||
/** | ||
* Normalize `msg` based on integrations `list`. | ||
* | ||
* @param {Object} msg | ||
* @param {Array} list | ||
* @return {Function} | ||
*/ | ||
function normalize(msg, list) { | ||
@@ -64,3 +58,3 @@ var lower = map(function (s) { | ||
// and the rest to context. | ||
each(function (value, key) { | ||
each(function (_value, key) { | ||
if (includes(key, toplevel)) { | ||
@@ -67,0 +61,0 @@ ret[key] = opts[key]; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -12,4 +13,2 @@ * Module dependencies. | ||
* https://segment.com/docs/spec/page/#properties | ||
* | ||
* @return {Object} | ||
*/ | ||
@@ -27,4 +26,2 @@ function pageDefaults() { | ||
* Return the canonical path for the page. | ||
* | ||
* @return {string} | ||
*/ | ||
@@ -41,5 +38,2 @@ function canonicalPath() { | ||
* and strip the hash. | ||
* | ||
* @param {string} search | ||
* @return {string} | ||
*/ | ||
@@ -46,0 +40,0 @@ function canonicalUrl(search) { |
@@ -18,5 +18,2 @@ 'use strict'; | ||
* Set the `options` for the store. | ||
* | ||
* @param {Object} options | ||
* @field {Boolean} enabled (true) | ||
*/ | ||
@@ -33,5 +30,2 @@ Store.prototype.options = function (options) { | ||
* Set a `key` and `value` in local storage. | ||
* | ||
* @param {string} key | ||
* @param {Object} value | ||
*/ | ||
@@ -45,5 +39,2 @@ Store.prototype.set = function (key, value) { | ||
* Get a value from local storage by `key`. | ||
* | ||
* @param {string} key | ||
* @return {Object} | ||
*/ | ||
@@ -57,4 +48,2 @@ Store.prototype.get = function (key) { | ||
* Remove a value from local storage by `key`. | ||
* | ||
* @param {string} key | ||
*/ | ||
@@ -61,0 +50,0 @@ Store.prototype.remove = function (key) { |
'use strict'; | ||
/* | ||
* Module dependencies. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Entity = require('./entity'); | ||
@@ -13,5 +11,2 @@ var bindAll = require('bind-all'); | ||
var localStorage = require('./store'); | ||
/** | ||
* User defaults | ||
*/ | ||
User.defaults = { | ||
@@ -29,4 +24,2 @@ persist: true, | ||
* Initialize a new `User` with `options`. | ||
* | ||
* @param {Object} options | ||
*/ | ||
@@ -47,5 +40,2 @@ function User(options) { | ||
* | ||
* // FIXME: What are the mixed types? | ||
* @param {string} id | ||
* @return {Mixed} | ||
* @example | ||
@@ -133,4 +123,2 @@ * // didn't change because the user didn't have previous id. | ||
* Set the user's `anonymousid` in local storage. | ||
* | ||
* @param {String} id | ||
*/ | ||
@@ -161,3 +149,2 @@ User.prototype._setAnonymousIdInLocalStorage = function (id) { | ||
* @api private | ||
* @return {boolean} | ||
*/ | ||
@@ -164,0 +151,0 @@ User.prototype._loadOldCookie = function () { |
@@ -0,1 +1,13 @@ | ||
# 3.13.7 / 2020-07-29 | ||
- Publish types to npm | ||
- remove unnecessary --declaration flag from build script | ||
- update public interface with optional parameters for .init and .initialize | ||
- Added optional to args that get and set (#174) | ||
- Expose AJS types and update README (#173) | ||
- [Types] Move `user.js` to `user.ts` (#172) | ||
- Convert group, memory, metrics, normalize, pageDefaults and store to .ts (#171) | ||
- [TS] Move entity.js to entity.ts (#169) | ||
- v3.13.6 (#170) | ||
# 3.13.6 / 2020-06-15 | ||
@@ -2,0 +14,0 @@ |
{ | ||
"name": "@segment/analytics.js-core", | ||
"author": "Segment <friends@segment.com>", | ||
"version": "3.13.6", | ||
"version": "3.13.7", | ||
"description": "The hassle-free way to integrate analytics into any web application.", | ||
"types": "lib/index.d.ts", | ||
"keywords": [ | ||
@@ -7,0 +8,0 @@ "analytics", |
@@ -10,2 +10,12 @@ # analytics.js-core | ||
## Using Types | ||
We've recently introduced Typescript support and types to Analytics.js Core. While the exposed types still need some work | ||
(pull requests are welcome!), they're ready to be used. | ||
### Importing as an npm module | ||
If you use analytics.js-core as an npm module, you can leverage its types out of the box: | ||
<img src="![types](https://user-images.githubusercontent.com/484013/88733944-bbcf3680-d0ec-11ea-904c-a63b68f4975e.gif)" alt="Example of using analytics js types" width="500px"> | ||
## License | ||
@@ -12,0 +22,0 @@ |
25
110428
22
2035