mixpanel-browser 2.43.0 → 2.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  ---
2
- category: 5ae0c2c9fa0ec6000345c0ac
2
+ category: 62ec0192a94ae90a45602b13
3
3
  title: JavaScript Full API Reference
4
4
  ---
5
5
 
@@ -450,8 +450,8 @@ The default config is:
450
450
  // batching or retry mechanisms.
451
451
  api_transport: 'XHR'
452
452
 
453
- // turn on request-batching/queueing/retry
454
- batch_requests: false,
453
+ // request-batching/queueing/retry
454
+ batch_requests: true,
455
455
 
456
456
  // maximum number of events/updates to send in a single
457
457
  // network request
@@ -538,14 +538,6 @@ The default config is:
538
538
  // the format {'Header-Name': value}
539
539
  xhr_headers: {}
540
540
 
541
- // protocol for fetching in-app message resources, e.g.
542
- // 'https://' or 'http://'; defaults to '//' (which defers to the
543
- // current page's protocol)
544
- inapp_protocol: '//'
545
-
546
- // whether to open in-app message link in new tab/window
547
- inapp_link_new_window: false
548
-
549
541
  // whether to ignore or respect the web browser's Do Not Track setting
550
542
  ignore_dnt: false
551
543
  }
@@ -761,24 +753,6 @@ mixpanel.people.append({
761
753
  | **callback** | <span class="mp-arg-type">Function</span></br></span><span class="mp-arg-optional">optional</span> | If provided, the callback will be called after tracking the event. |
762
754
 
763
755
 
764
- ___
765
- ## mixpanel.people.clear_charges
766
- Permanently clear all revenue report transactions from the current user's people analytics profile.
767
-
768
-
769
- ### Usage:
770
-
771
- ```javascript
772
- mixpanel.people.clear_charges();
773
- ```
774
-
775
-
776
-
777
- | Argument | Type | Description |
778
- | ------------- | ------------- | ----- |
779
- | **callback** | <span class="mp-arg-type">Function</span></br></span><span class="mp-arg-optional">optional</span> | If provided, the callback will be called after tracking the event. |
780
-
781
-
782
756
  ___
783
757
  ## mixpanel.people.delete_user
784
758
  Permanently deletes the current people analytics profile from Mixpanel (using the current distinct_id).
@@ -904,32 +878,6 @@ mixpanel.people.set_once({
904
878
  | **callback** | <span class="mp-arg-type">Function</span></br></span><span class="mp-arg-optional">optional</span> | If provided, the callback will be called after tracking the event. |
905
879
 
906
880
 
907
- ___
908
- ## mixpanel.people.track_charge
909
- Record that you have charged the current user a certain amount of money. Charges recorded with track_charge() will appear in the Mixpanel revenue report.
910
-
911
-
912
- ### Usage:
913
-
914
- ```javascript
915
- // charge a user $50
916
- mixpanel.people.track_charge(50);
917
-
918
- // charge a user $30.50 on the 2nd of january
919
- mixpanel.people.track_charge(30.50, {
920
- '$time': new Date('jan 1 2012')
921
- });
922
- ```
923
-
924
-
925
-
926
- | Argument | Type | Description |
927
- | ------------- | ------------- | ----- |
928
- | **amount** | <span class="mp-arg-type">Number</span></br></span><span class="mp-arg-required">required</span> | The amount of money charged to the current user |
929
- | **properties** | <span class="mp-arg-type">Object</span></br></span><span class="mp-arg-optional">optional</span> | An associative array of properties associated with the charge |
930
- | **callback** | <span class="mp-arg-type">Function</span></br></span><span class="mp-arg-optional">optional</span> | If provided, the callback will be called when the server responds |
931
-
932
-
933
881
  ___
934
882
  ## mixpanel.people.union
935
883
  Merge a given list with a list-valued people analytics property, excluding duplicate values.
package/doc/template.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- category: 5ae0c2c9fa0ec6000345c0ac
2
+ category: 62ec0192a94ae90a45602b13
3
3
  title: JavaScript Full API Reference
4
4
  ---
5
5
 
@@ -68,8 +68,8 @@ var MIXPANEL_LIB_URL = '//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js';
68
68
 
69
69
  function _set_and_defer_chained(fn_name) {
70
70
  mock_group[fn_name] = function() {
71
- call2_args = arguments;
72
- call2 = [fn_name].concat(Array.prototype.slice.call(call2_args, 0));
71
+ var call2_args = arguments;
72
+ var call2 = [fn_name].concat(Array.prototype.slice.call(call2_args, 0));
73
73
  target.push([call1, call2]);
74
74
  };
75
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixpanel-browser",
3
- "version": "2.43.0",
3
+ "version": "2.46.0",
4
4
  "description": "The official Mixpanel JavaScript browser client library",
5
5
  "main": "dist/mixpanel.cjs.js",
6
6
  "directories": {
@@ -12,7 +12,7 @@
12
12
  "build-full": "FULL=1 ./build.sh",
13
13
  "build-test-polyfill": "webpack tests/vendor/core-js-polyfills.src.js tests/vendor/core-js-polyfills.js",
14
14
  "dox": "node doc/build-docs.js",
15
- "dox-publish": "rdme docs doc/readme.io --key=$RDME_API_KEY --version=1.0",
15
+ "dox-publish": "rdme docs:single doc/readme.io/javascript-full-api-reference.md --key=$RDME_API_KEY --version=$RDME_DOC_VERSION",
16
16
  "integration_test": "echo 'Browse to localhost:3000/tests' && node testServer.js",
17
17
  "lint": "eslint ./src",
18
18
  "prepublishOnly": "npm run build-dist",
@@ -37,19 +37,19 @@
37
37
  "babel-preset-es2015": "6.6.0",
38
38
  "babelify": "6.1.2",
39
39
  "browserify": "10.2.4",
40
- "chai": "3.5.0",
40
+ "chai": "4.0.0",
41
41
  "cookie-parser": "1.3.4",
42
42
  "core-js": "3.6.5",
43
43
  "dox": "0.9.0",
44
44
  "eslint": "4.18.2",
45
45
  "express": "4.12.2",
46
- "jsdom": "11.12.0",
46
+ "jsdom": "16.5.0",
47
47
  "jsdom-global": "3.0.2",
48
48
  "localStorage": "1.0.4",
49
49
  "lodash": "4.17.21",
50
50
  "mocha": "7.1.1",
51
51
  "morgan": "1.9.1",
52
- "rdme": "4.0.0",
52
+ "rdme": "7.5.0",
53
53
  "request": "2.88.0",
54
54
  "rollup": "0.25.8",
55
55
  "rollup-plugin-npm": "1.4.0",
package/src/config.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var Config = {
2
2
  DEBUG: false,
3
- LIB_VERSION: '2.43.0'
3
+ LIB_VERSION: '2.46.0'
4
4
  };
5
5
 
6
6
  export default Config;
@@ -4,7 +4,6 @@ import { _, console, userAgent, window, document, navigator, slice } from './uti
4
4
  import { FormTracker, LinkTracker } from './dom-trackers';
5
5
  import { RequestBatcher } from './request-batcher';
6
6
  import { MixpanelGroup } from './mixpanel-group';
7
- import { MixpanelNotification } from './mixpanel-notification';
8
7
  import { MixpanelPeople } from './mixpanel-people';
9
8
  import {
10
9
  MixpanelPersistence,
@@ -58,6 +57,7 @@ var NOOP_FUNC = function() {};
58
57
  /** @const */ var PRIMARY_INSTANCE_NAME = 'mixpanel';
59
58
  /** @const */ var PAYLOAD_TYPE_BASE64 = 'base64';
60
59
  /** @const */ var PAYLOAD_TYPE_JSON = 'json';
60
+ /** @const */ var DEVICE_ID_PREFIX = '$device:';
61
61
 
62
62
 
63
63
  /*
@@ -93,6 +93,7 @@ var DEFAULT_CONFIG = {
93
93
  'cdn': 'https://cdn.mxpnl.com',
94
94
  'cross_site_cookie': false,
95
95
  'cross_subdomain_cookie': true,
96
+ 'error_reporter': NOOP_FUNC,
96
97
  'persistence': 'cookie',
97
98
  'persistence_name': '',
98
99
  'cookie_domain': '',
@@ -117,8 +118,6 @@ var DEFAULT_CONFIG = {
117
118
  'opt_out_tracking_cookie_prefix': null,
118
119
  'property_blacklist': [],
119
120
  'xhr_headers': {}, // { header: value, header2: value }
120
- 'inapp_protocol': '//',
121
- 'inapp_link_new_window': false,
122
121
  'ignore_dnt': false,
123
122
  'batch_requests': true,
124
123
  'batch_size': 50,
@@ -160,8 +159,6 @@ var create_mplib = function(token, config, name) {
160
159
  }
161
160
 
162
161
  instance._cached_groups = {}; // cache groups in a pool
163
- instance._user_decide_check_complete = false;
164
- instance._events_tracked_before_user_decide_check_complete = [];
165
162
 
166
163
  instance._init(token, config, name);
167
164
 
@@ -204,11 +201,11 @@ var create_mplib = function(token, config, name) {
204
201
  */
205
202
  MixpanelLib.prototype.init = function (token, config, name) {
206
203
  if (_.isUndefined(name)) {
207
- console.error('You must name your new library: init(token, config, name)');
204
+ this.report_error('You must name your new library: init(token, config, name)');
208
205
  return;
209
206
  }
210
207
  if (name === PRIMARY_INSTANCE_NAME) {
211
- console.error('You must initialize the main mixpanel object right after you include the Mixpanel js snippet');
208
+ this.report_error('You must initialize the main mixpanel object right after you include the Mixpanel js snippet');
212
209
  return;
213
210
  }
214
211
 
@@ -231,7 +228,6 @@ MixpanelLib.prototype._init = function(token, config, name) {
231
228
 
232
229
  this['__loaded'] = true;
233
230
  this['config'] = {};
234
- this['_triggered_notifs'] = [];
235
231
 
236
232
  var variable_features = {};
237
233
 
@@ -309,7 +305,7 @@ MixpanelLib.prototype._init = function(token, config, name) {
309
305
  // or the device id if something was already stored
310
306
  // in the persitence
311
307
  this.register_once({
312
- 'distinct_id': uuid,
308
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
313
309
  '$device_id': uuid
314
310
  }, '');
315
311
  }
@@ -350,7 +346,7 @@ MixpanelLib.prototype._dom_loaded = function() {
350
346
 
351
347
  MixpanelLib.prototype._track_dom = function(DomClass, args) {
352
348
  if (this.get_config('img')) {
353
- console.error('You can\'t use DOM tracking functions with img = true.');
349
+ this.report_error('You can\'t use DOM tracking functions with img = true.');
354
350
  return false;
355
351
  }
356
352
 
@@ -452,6 +448,7 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
452
448
 
453
449
  url += '?' + _.HTTPBuildQuery(data);
454
450
 
451
+ var lib = this;
455
452
  if ('img' in data) {
456
453
  var img = document.createElement('img');
457
454
  img.src = url;
@@ -460,7 +457,7 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
460
457
  try {
461
458
  succeeded = sendBeacon(url, body_data);
462
459
  } catch (e) {
463
- console.error(e);
460
+ lib.report_error(e);
464
461
  succeeded = false;
465
462
  }
466
463
  try {
@@ -468,7 +465,7 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
468
465
  callback(succeeded ? 1 : 0);
469
466
  }
470
467
  } catch (e) {
471
- console.error(e);
468
+ lib.report_error(e);
472
469
  }
473
470
  } else if (USE_XHR) {
474
471
  try {
@@ -500,7 +497,7 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
500
497
  try {
501
498
  response = _.JSONDecode(req.responseText);
502
499
  } catch (e) {
503
- console.error(e);
500
+ lib.report_error(e);
504
501
  if (options.ignore_json_errors) {
505
502
  response = req.responseText;
506
503
  } else {
@@ -523,7 +520,7 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
523
520
  } else {
524
521
  error = 'Bad HTTP status: ' + req.status + ' ' + req.statusText;
525
522
  }
526
- console.error(error);
523
+ lib.report_error(error);
527
524
  if (callback) {
528
525
  if (verbose_mode) {
529
526
  callback({status: 0, error: error, xhr_req: req});
@@ -536,7 +533,7 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
536
533
  };
537
534
  req.send(body_data);
538
535
  } catch (e) {
539
- console.error(e);
536
+ lib.report_error(e);
540
537
  succeeded = false;
541
538
  }
542
539
  } else {
@@ -626,7 +623,9 @@ MixpanelLib.prototype.init_batchers = function() {
626
623
  }, this),
627
624
  beforeSendHook: _.bind(function(item) {
628
625
  return this._run_hook('before_send_' + attrs.type, item);
629
- }, this)
626
+ }, this),
627
+ errorReporter: this.get_config('error_reporter'),
628
+ stopAllBatchingFunc: _.bind(this.stop_batch_senders, this)
630
629
  }
631
630
  );
632
631
  }, this);
@@ -783,7 +782,7 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
783
782
  }
784
783
 
785
784
  if (_.isUndefined(event_name)) {
786
- console.error('No event name provided to mixpanel.track');
785
+ this.report_error('No event name provided to mixpanel.track');
787
786
  return;
788
787
  }
789
788
 
@@ -824,7 +823,7 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
824
823
  delete properties[blacklisted_prop];
825
824
  });
826
825
  } else {
827
- console.error('Invalid value for property_blacklist config: ' + property_blacklist);
826
+ this.report_error('Invalid value for property_blacklist config: ' + property_blacklist);
828
827
  }
829
828
 
830
829
  var data = {
@@ -840,8 +839,6 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
840
839
  send_request_options: options
841
840
  }, callback);
842
841
 
843
- this._check_and_handle_triggered_notifications(data);
844
-
845
842
  return ret;
846
843
  });
847
844
 
@@ -1069,7 +1066,7 @@ MixpanelLib.prototype.track_forms = function() {
1069
1066
  */
1070
1067
  MixpanelLib.prototype.time_event = function(event_name) {
1071
1068
  if (_.isUndefined(event_name)) {
1072
- console.error('No event name provided to mixpanel.time_event');
1069
+ this.report_error('No event name provided to mixpanel.time_event');
1073
1070
  return;
1074
1071
  }
1075
1072
 
@@ -1234,7 +1231,15 @@ MixpanelLib.prototype.identify = function(
1234
1231
  // _unset_callback:function A callback to be run if and when the People unset queue is flushed
1235
1232
 
1236
1233
  var previous_distinct_id = this.get_distinct_id();
1237
- this.register({'$user_id': new_distinct_id});
1234
+ if (new_distinct_id && previous_distinct_id !== new_distinct_id) {
1235
+ // we allow the following condition if previous distinct_id is same as new_distinct_id
1236
+ // so that you can force flush people updates for anonymous profiles.
1237
+ if (typeof new_distinct_id === 'string' && new_distinct_id.indexOf(DEVICE_ID_PREFIX) === 0) {
1238
+ this.report_error('distinct_id cannot have $device: prefix');
1239
+ return -1;
1240
+ }
1241
+ this.register({'$user_id': new_distinct_id});
1242
+ }
1238
1243
 
1239
1244
  if (!this.get_property('$device_id')) {
1240
1245
  // The persisted distinct id might not actually be a device id at all
@@ -1252,7 +1257,6 @@ MixpanelLib.prototype.identify = function(
1252
1257
  this.unregister(ALIAS_ID_KEY);
1253
1258
  this.register({'distinct_id': new_distinct_id});
1254
1259
  }
1255
- this._check_and_handle_notifications(this.get_distinct_id());
1256
1260
  this._flags.identify_called = true;
1257
1261
  // Flush any queued up people requests
1258
1262
  this['people']._flush(_set_callback, _add_callback, _append_callback, _set_once_callback, _union_callback, _unset_callback, _remove_callback);
@@ -1276,7 +1280,7 @@ MixpanelLib.prototype.reset = function() {
1276
1280
  this._flags.identify_called = false;
1277
1281
  var uuid = _.UUID();
1278
1282
  this.register_once({
1279
- 'distinct_id': uuid,
1283
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
1280
1284
  '$device_id': uuid
1281
1285
  }, '');
1282
1286
  };
@@ -1342,7 +1346,7 @@ MixpanelLib.prototype.alias = function(alias, original) {
1342
1346
  // mixpanel.people.identify() call made for this user. It is VERY BAD to make an alias with
1343
1347
  // this ID, as it will duplicate users.
1344
1348
  if (alias === this.get_property(PEOPLE_DISTINCT_ID_KEY)) {
1345
- console.critical('Attempting to create alias for existing People user - aborting.');
1349
+ this.report_error('Attempting to create alias for existing People user - aborting.');
1346
1350
  return -2;
1347
1351
  }
1348
1352
 
@@ -1362,7 +1366,7 @@ MixpanelLib.prototype.alias = function(alias, original) {
1362
1366
  _this.identify(alias);
1363
1367
  });
1364
1368
  } else {
1365
- console.error('alias matches current distinct_id - skipping api call.');
1369
+ this.report_error('alias matches current distinct_id - skipping api call.');
1366
1370
  this.identify(alias);
1367
1371
  return -1;
1368
1372
  }
@@ -1401,8 +1405,8 @@ MixpanelLib.prototype.name_tag = function(name_tag) {
1401
1405
  * // batching or retry mechanisms.
1402
1406
  * api_transport: 'XHR'
1403
1407
  *
1404
- * // turn on request-batching/queueing/retry
1405
- * batch_requests: false,
1408
+ * // request-batching/queueing/retry
1409
+ * batch_requests: true,
1406
1410
  *
1407
1411
  * // maximum number of events/updates to send in a single
1408
1412
  * // network request
@@ -1489,14 +1493,6 @@ MixpanelLib.prototype.name_tag = function(name_tag) {
1489
1493
  * // the format {'Header-Name': value}
1490
1494
  * xhr_headers: {}
1491
1495
  *
1492
- * // protocol for fetching in-app message resources, e.g.
1493
- * // 'https://' or 'http://'; defaults to '//' (which defers to the
1494
- * // current page's protocol)
1495
- * inapp_protocol: '//'
1496
- *
1497
- * // whether to open in-app message link in new tab/window
1498
- * inapp_link_new_window: false
1499
- *
1500
1496
  * // whether to ignore or respect the web browser's Do Not Track setting
1501
1497
  * ignore_dnt: false
1502
1498
  * }
@@ -1545,7 +1541,7 @@ MixpanelLib.prototype.get_config = function(prop_name) {
1545
1541
  MixpanelLib.prototype._run_hook = function(hook_name) {
1546
1542
  var ret = (this['config']['hooks'][hook_name] || IDENTITY_FUNC).apply(this, slice.call(arguments, 1));
1547
1543
  if (typeof ret === 'undefined') {
1548
- console.error(hook_name + ' hook did not return a value');
1544
+ this.report_error(hook_name + ' hook did not return a value');
1549
1545
  ret = null;
1550
1546
  }
1551
1547
  return ret;
@@ -1587,75 +1583,6 @@ MixpanelLib.prototype._event_is_disabled = function(event_name) {
1587
1583
  _.include(this.__disabled_events, event_name);
1588
1584
  };
1589
1585
 
1590
- MixpanelLib.prototype._check_and_handle_triggered_notifications = addOptOutCheckMixpanelLib(function(event_data) {
1591
- if (!this._user_decide_check_complete) {
1592
- this._events_tracked_before_user_decide_check_complete.push(event_data);
1593
- } else {
1594
- var arr = this['_triggered_notifs'];
1595
- for (var i = 0; i < arr.length; i++) {
1596
- var notif = new MixpanelNotification(arr[i], this);
1597
- if (notif._matches_event_data(event_data)) {
1598
- this._show_notification(arr[i]);
1599
- return;
1600
- }
1601
- }
1602
- }
1603
- });
1604
-
1605
- MixpanelLib.prototype._check_and_handle_notifications = addOptOutCheckMixpanelLib(function(distinct_id) {
1606
- if (
1607
- !distinct_id ||
1608
- this._flags.identify_called ||
1609
- this.get_config('disable_notifications')
1610
- ) {
1611
- return;
1612
- }
1613
-
1614
- console.log('MIXPANEL NOTIFICATION CHECK');
1615
-
1616
- var data = {
1617
- 'verbose': true,
1618
- 'version': '3',
1619
- 'lib': 'web',
1620
- 'token': this.get_config('token'),
1621
- 'distinct_id': distinct_id
1622
- };
1623
- this._send_request(
1624
- this.get_config('api_host') + '/decide/',
1625
- data,
1626
- {method: 'GET', transport: 'XHR'},
1627
- this._prepare_callback(_.bind(function(result) {
1628
- if (result['notifications'] && result['notifications'].length > 0) {
1629
- this['_triggered_notifs'] = [];
1630
- var notifications = [];
1631
- _.each(result['notifications'], function(notif) {
1632
- (notif['display_triggers'] && notif['display_triggers'].length > 0 ? this['_triggered_notifs'] : notifications).push(notif);
1633
- }, this);
1634
- if (notifications.length > 0) {
1635
- this._show_notification.call(this, notifications[0]);
1636
- }
1637
- }
1638
- this._handle_user_decide_check_complete();
1639
- }, this))
1640
- );
1641
- });
1642
-
1643
- MixpanelLib.prototype._handle_user_decide_check_complete = function() {
1644
- this._user_decide_check_complete = true;
1645
-
1646
- // check notifications against events that were tracked before decide call completed
1647
- var events = this._events_tracked_before_user_decide_check_complete;
1648
- while (events.length > 0) {
1649
- var data = events.shift(); // replay in the same order they came in
1650
- this._check_and_handle_triggered_notifications(data);
1651
- }
1652
- };
1653
-
1654
- MixpanelLib.prototype._show_notification = function(notif_data) {
1655
- var notification = new MixpanelNotification(notif_data, this);
1656
- notification.show();
1657
- };
1658
-
1659
1586
  // perform some housekeeping around GDPR opt-in/out state
1660
1587
  MixpanelLib.prototype._gdpr_init = function() {
1661
1588
  var is_localStorage_requested = this.get_config('opt_out_tracking_persistence_type') === 'localStorage';
@@ -1901,6 +1828,18 @@ MixpanelLib.prototype.clear_opt_in_out_tracking = function(options) {
1901
1828
  this._gdpr_update_persistence(options);
1902
1829
  };
1903
1830
 
1831
+ MixpanelLib.prototype.report_error = function(msg, err) {
1832
+ console.error.apply(console.error, arguments);
1833
+ try {
1834
+ if (!err && !(msg instanceof Error)) {
1835
+ msg = new Error(msg);
1836
+ }
1837
+ this.get_config('error_reporter')(msg, err);
1838
+ } catch(err) {
1839
+ console.error(err);
1840
+ }
1841
+ };
1842
+
1904
1843
  // EXPORTS (for closure compiler)
1905
1844
 
1906
1845
  // MixpanelLib Exports
@@ -1923,9 +1862,6 @@ MixpanelLib.prototype['get_config'] = MixpanelLib.protot
1923
1862
  MixpanelLib.prototype['get_property'] = MixpanelLib.prototype.get_property;
1924
1863
  MixpanelLib.prototype['get_distinct_id'] = MixpanelLib.prototype.get_distinct_id;
1925
1864
  MixpanelLib.prototype['toString'] = MixpanelLib.prototype.toString;
1926
- MixpanelLib.prototype['_check_and_handle_notifications'] = MixpanelLib.prototype._check_and_handle_notifications;
1927
- MixpanelLib.prototype['_handle_user_decide_check_complete'] = MixpanelLib.prototype._handle_user_decide_check_complete;
1928
- MixpanelLib.prototype['_show_notification'] = MixpanelLib.prototype._show_notification;
1929
1865
  MixpanelLib.prototype['opt_out_tracking'] = MixpanelLib.prototype.opt_out_tracking;
1930
1866
  MixpanelLib.prototype['opt_in_tracking'] = MixpanelLib.prototype.opt_in_tracking;
1931
1867
  MixpanelLib.prototype['has_opted_out_tracking'] = MixpanelLib.prototype.has_opted_out_tracking;
@@ -1946,8 +1882,6 @@ MixpanelPersistence.prototype['update_referrer_info'] = MixpanelPersistence.pro
1946
1882
  MixpanelPersistence.prototype['get_cross_subdomain'] = MixpanelPersistence.prototype.get_cross_subdomain;
1947
1883
  MixpanelPersistence.prototype['clear'] = MixpanelPersistence.prototype.clear;
1948
1884
 
1949
- _.safewrap_class(MixpanelLib, ['identify', '_check_and_handle_notifications', '_show_notification']);
1950
-
1951
1885
 
1952
1886
  var instances = {};
1953
1887
  var extend_mp = function() {
@@ -244,24 +244,25 @@ MixpanelPeople.prototype.union = addOptOutCheckMixpanelPeople(function(list_name
244
244
  });
245
245
 
246
246
  /*
247
- * Record that you have charged the current user a certain amount
248
- * of money. Charges recorded with track_charge() will appear in the
249
- * Mixpanel revenue report.
250
- *
251
- * ### Usage:
252
- *
253
- * // charge a user $50
254
- * mixpanel.people.track_charge(50);
255
- *
256
- * // charge a user $30.50 on the 2nd of january
257
- * mixpanel.people.track_charge(30.50, {
258
- * '$time': new Date('jan 1 2012')
259
- * });
260
- *
261
- * @param {Number} amount The amount of money charged to the current user
262
- * @param {Object} [properties] An associative array of properties associated with the charge
263
- * @param {Function} [callback] If provided, the callback will be called when the server responds
264
- */
247
+ * Record that you have charged the current user a certain amount
248
+ * of money. Charges recorded with track_charge() will appear in the
249
+ * Mixpanel revenue report.
250
+ *
251
+ * ### Usage:
252
+ *
253
+ * // charge a user $50
254
+ * mixpanel.people.track_charge(50);
255
+ *
256
+ * // charge a user $30.50 on the 2nd of january
257
+ * mixpanel.people.track_charge(30.50, {
258
+ * '$time': new Date('jan 1 2012')
259
+ * });
260
+ *
261
+ * @param {Number} amount The amount of money charged to the current user
262
+ * @param {Object} [properties] An associative array of properties associated with the charge
263
+ * @param {Function} [callback] If provided, the callback will be called when the server responds
264
+ * @deprecated
265
+ */
265
266
  MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(amount, properties, callback) {
266
267
  if (!_.isNumber(amount)) {
267
268
  amount = parseFloat(amount);
@@ -277,15 +278,16 @@ MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(am
277
278
  });
278
279
 
279
280
  /*
280
- * Permanently clear all revenue report transactions from the
281
- * current user's people analytics profile.
282
- *
283
- * ### Usage:
284
- *
285
- * mixpanel.people.clear_charges();
286
- *
287
- * @param {Function} [callback] If provided, the callback will be called after tracking the event.
288
- */
281
+ * Permanently clear all revenue report transactions from the
282
+ * current user's people analytics profile.
283
+ *
284
+ * ### Usage:
285
+ *
286
+ * mixpanel.people.clear_charges();
287
+ *
288
+ * @param {Function} [callback] If provided, the callback will be called after tracking the event.
289
+ * @deprecated
290
+ */
289
291
  MixpanelPeople.prototype.clear_charges = function(callback) {
290
292
  return this.set('$transactions', [], callback);
291
293
  };
@@ -9,7 +9,6 @@ import {
9
9
  REMOVE_ACTION,
10
10
  UNION_ACTION
11
11
  } from './api-actions';
12
- import Config from './config';
13
12
  import { _, console } from './utils';
14
13
 
15
14
  /*
@@ -25,7 +24,6 @@ import { _, console } from './utils';
25
24
  // This key is deprecated, but we want to check for it to see whether aliasing is allowed.
26
25
  /** @const */ var PEOPLE_DISTINCT_ID_KEY = '$people_distinct_id';
27
26
  /** @const */ var ALIAS_ID_KEY = '__alias';
28
- /** @const */ var CAMPAIGN_IDS_KEY = '__cmpns';
29
27
  /** @const */ var EVENT_TIMERS_KEY = '__timers';
30
28
  /** @const */ var RESERVED_PROPERTIES = [
31
29
  SET_QUEUE_KEY,
@@ -37,7 +35,6 @@ import { _, console } from './utils';
37
35
  UNION_QUEUE_KEY,
38
36
  PEOPLE_DISTINCT_ID_KEY,
39
37
  ALIAS_ID_KEY,
40
- CAMPAIGN_IDS_KEY,
41
38
  EVENT_TIMERS_KEY
42
39
  ];
43
40
 
@@ -151,7 +148,6 @@ MixpanelPersistence.prototype.upgrade = function(config) {
151
148
 
152
149
  MixpanelPersistence.prototype.save = function() {
153
150
  if (this.disabled) { return; }
154
- this._expire_notification_campaigns();
155
151
  this.storage.set(
156
152
  this.name,
157
153
  _.JSONEncode(this['props']),
@@ -223,22 +219,6 @@ MixpanelPersistence.prototype.unregister = function(prop) {
223
219
  }
224
220
  };
225
221
 
226
- MixpanelPersistence.prototype._expire_notification_campaigns = _.safewrap(function() {
227
- var campaigns_shown = this['props'][CAMPAIGN_IDS_KEY],
228
- EXPIRY_TIME = Config.DEBUG ? 60 * 1000 : 60 * 60 * 1000; // 1 minute (Config.DEBUG) / 1 hour (PDXN)
229
- if (!campaigns_shown) {
230
- return;
231
- }
232
- for (var campaign_id in campaigns_shown) {
233
- if (1 * new Date() - campaigns_shown[campaign_id] > EXPIRY_TIME) {
234
- delete campaigns_shown[campaign_id];
235
- }
236
- }
237
- if (_.isEmptyObject(campaigns_shown)) {
238
- delete this['props'][CAMPAIGN_IDS_KEY];
239
- }
240
- });
241
-
242
222
  MixpanelPersistence.prototype.update_campaign_params = function() {
243
223
  if (!this.campaign_params_saved) {
244
224
  this.register_once(_.info.campaignParams());
@@ -501,6 +481,5 @@ export {
501
481
  UNION_QUEUE_KEY,
502
482
  PEOPLE_DISTINCT_ID_KEY,
503
483
  ALIAS_ID_KEY,
504
- CAMPAIGN_IDS_KEY,
505
484
  EVENT_TIMERS_KEY
506
485
  };