@thoughtspot/visual-embed-sdk 1.32.7 → 1.32.8

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.
Files changed (48) hide show
  1. package/cjs/package.json +3 -3
  2. package/cjs/src/css-variables.d.ts +18 -3
  3. package/cjs/src/css-variables.d.ts.map +1 -1
  4. package/cjs/src/embed/base.d.ts +34 -32
  5. package/cjs/src/embed/base.d.ts.map +1 -1
  6. package/cjs/src/embed/base.js +34 -32
  7. package/cjs/src/embed/base.js.map +1 -1
  8. package/cjs/src/tokenizedFetch.d.ts.map +1 -1
  9. package/cjs/src/tokenizedFetch.js +5 -1
  10. package/cjs/src/tokenizedFetch.js.map +1 -1
  11. package/cjs/src/types.d.ts +3 -3
  12. package/cjs/src/types.js +3 -3
  13. package/cjs/src/utils/authService/authService.spec.js +3 -1
  14. package/cjs/src/utils/authService/authService.spec.js.map +1 -1
  15. package/dist/src/css-variables.d.ts +18 -3
  16. package/dist/src/css-variables.d.ts.map +1 -1
  17. package/dist/src/embed/base.d.ts +34 -32
  18. package/dist/src/embed/base.d.ts.map +1 -1
  19. package/dist/src/tokenizedFetch.d.ts.map +1 -1
  20. package/dist/src/types.d.ts +3 -3
  21. package/dist/tsembed-react.es.js +238 -78
  22. package/dist/tsembed-react.js +238 -78
  23. package/dist/tsembed.es.js +272 -110
  24. package/dist/tsembed.js +272 -110
  25. package/dist/visual-embed-sdk-react-full.d.ts +55 -38
  26. package/dist/visual-embed-sdk-react.d.ts +55 -38
  27. package/dist/visual-embed-sdk.d.ts +55 -38
  28. package/lib/package.json +3 -3
  29. package/lib/src/css-variables.d.ts +18 -3
  30. package/lib/src/css-variables.d.ts.map +1 -1
  31. package/lib/src/embed/base.d.ts +34 -32
  32. package/lib/src/embed/base.d.ts.map +1 -1
  33. package/lib/src/embed/base.js +34 -32
  34. package/lib/src/embed/base.js.map +1 -1
  35. package/lib/src/tokenizedFetch.d.ts.map +1 -1
  36. package/lib/src/tokenizedFetch.js +5 -1
  37. package/lib/src/tokenizedFetch.js.map +1 -1
  38. package/lib/src/types.d.ts +3 -3
  39. package/lib/src/types.js +3 -3
  40. package/lib/src/utils/authService/authService.spec.js +3 -1
  41. package/lib/src/utils/authService/authService.spec.js.map +1 -1
  42. package/lib/src/visual-embed-sdk.d.ts +55 -38
  43. package/package.json +3 -3
  44. package/src/css-variables.ts +21 -3
  45. package/src/embed/base.ts +34 -32
  46. package/src/tokenizedFetch.ts +5 -1
  47. package/src/types.ts +3 -3
  48. package/src/utils/authService/authService.spec.ts +3 -1
@@ -1584,8 +1584,8 @@
1584
1584
  * Prerequisite: Set isOnBeforeGetVizDataInterceptEnabled : true
1585
1585
  * for this embed event to get emitted.
1586
1586
  *
1587
- * Parameter: payload
1588
- * Parameter: responder
1587
+ * @param: payload
1588
+ * @param: responder
1589
1589
  * Contains elements that lets developers define whether ThoughtSpot
1590
1590
  * will run the search or not, and if not, which error message to provide.
1591
1591
  *
@@ -1597,6 +1597,7 @@
1597
1597
  *
1598
1598
  * @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
1599
1599
  *
1600
+ * @example
1600
1601
  *```js
1601
1602
  * .on(EmbedEvent.OnBeforeGetVizDataIntercept,
1602
1603
  * (payload, responder) => {
@@ -1632,7 +1633,6 @@
1632
1633
  * }})
1633
1634
  * })
1634
1635
  *```
1635
- *
1636
1636
  */
1637
1637
  EmbedEvent["OnBeforeGetVizDataIntercept"] = "onBeforeGetVizDataIntercept";
1638
1638
  /**
@@ -6221,7 +6221,11 @@
6221
6221
  const tokenizedFetch = async (input, init) => {
6222
6222
  const embedConfig = getEmbedConfig();
6223
6223
  if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
6224
- return fetch(input, init);
6224
+ return fetch(input, {
6225
+ // ensure cookies are included for the non cookie-less api calls.
6226
+ credentials: 'include',
6227
+ ...init,
6228
+ });
6225
6229
  }
6226
6230
  const req = new Request(input, init);
6227
6231
  const authToken = await getAuthenticationToken(embedConfig);
@@ -6888,7 +6892,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
6888
6892
 
6889
6893
  var Config = {
6890
6894
  DEBUG: false,
6891
- LIB_VERSION: '2.45.0'
6895
+ LIB_VERSION: '2.47.0'
6892
6896
  };
6893
6897
 
6894
6898
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
@@ -7718,20 +7722,24 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
7718
7722
 
7719
7723
  _.UUID = (function() {
7720
7724
 
7721
- // Time/ticks information
7722
- // 1*new Date() is a cross browser version of Date.now()
7725
+ // Time-based entropy
7723
7726
  var T = function() {
7724
- var d = 1 * new Date(),
7725
- i = 0;
7726
-
7727
- // this while loop figures how many browser ticks go by
7728
- // before 1*new Date() returns a new number, ie the amount
7729
- // of ticks that go by per millisecond
7730
- while (d == 1 * new Date()) {
7731
- i++;
7727
+ var time = 1 * new Date(); // cross-browser version of Date.now()
7728
+ var ticks;
7729
+ if (window$1.performance && window$1.performance.now) {
7730
+ ticks = window$1.performance.now();
7731
+ } else {
7732
+ // fall back to busy loop
7733
+ ticks = 0;
7734
+
7735
+ // this while loop figures how many browser ticks go by
7736
+ // before 1*new Date() returns a new number, ie the amount
7737
+ // of ticks that go by per millisecond
7738
+ while (time == 1 * new Date()) {
7739
+ ticks++;
7740
+ }
7732
7741
  }
7733
-
7734
- return d.toString(16) + i.toString(16);
7742
+ return time.toString(16) + Math.floor(ticks).toString(16);
7735
7743
  };
7736
7744
 
7737
7745
  // Math.Random entropy
@@ -8298,21 +8306,42 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
8298
8306
  };
8299
8307
  })();
8300
8308
 
8309
+ var CAMPAIGN_KEYWORDS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'];
8310
+ var CLICK_IDS = ['dclid', 'fbclid', 'gclid', 'ko_click_id', 'li_fat_id', 'msclkid', 'ttclid', 'twclid', 'wbraid'];
8311
+
8301
8312
  _.info = {
8302
- campaignParams: function() {
8303
- var campaign_keywords = 'utm_source utm_medium utm_campaign utm_content utm_term'.split(' '),
8304
- kw = '',
8313
+ campaignParams: function(default_value) {
8314
+ var kw = '',
8305
8315
  params = {};
8306
- _.each(campaign_keywords, function(kwkey) {
8316
+ _.each(CAMPAIGN_KEYWORDS, function(kwkey) {
8307
8317
  kw = _.getQueryParam(document$1.URL, kwkey);
8308
8318
  if (kw.length) {
8309
8319
  params[kwkey] = kw;
8320
+ } else if (default_value !== undefined) {
8321
+ params[kwkey] = default_value;
8322
+ }
8323
+ });
8324
+
8325
+ return params;
8326
+ },
8327
+
8328
+ clickParams: function() {
8329
+ var id = '',
8330
+ params = {};
8331
+ _.each(CLICK_IDS, function(idkey) {
8332
+ id = _.getQueryParam(document$1.URL, idkey);
8333
+ if (id.length) {
8334
+ params[idkey] = id;
8310
8335
  }
8311
8336
  });
8312
8337
 
8313
8338
  return params;
8314
8339
  },
8315
8340
 
8341
+ marketingParams: function() {
8342
+ return _.extend(_.info.campaignParams(), _.info.clickParams());
8343
+ },
8344
+
8316
8345
  searchEngine: function(referrer) {
8317
8346
  if (referrer.search('https?://(.*)google.([^/?]*)') === 0) {
8318
8347
  return 'google';
@@ -8509,12 +8538,13 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
8509
8538
  });
8510
8539
  },
8511
8540
 
8512
- pageviewInfo: function(page) {
8541
+ mpPageViewProperties: function() {
8513
8542
  return _.strip_empty_properties({
8514
- 'mp_page': page,
8515
- 'mp_referrer': document$1.referrer,
8516
- 'mp_browser': _.info.browser(userAgent, navigator.vendor, windowOpera),
8517
- 'mp_platform': _.info.os()
8543
+ 'current_page_title': document$1.title,
8544
+ 'current_domain': window$1.location.hostname,
8545
+ 'current_url_path': window$1.location.pathname,
8546
+ 'current_url_protocol': window$1.location.protocol,
8547
+ 'current_url_search': window$1.location.search
8518
8548
  });
8519
8549
  }
8520
8550
  };
@@ -9181,6 +9211,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
9181
9211
 
9182
9212
  this.stopped = !this.libConfig['batch_autostart'];
9183
9213
  this.consecutiveRemovalFailures = 0;
9214
+
9215
+ // extra client-side dedupe
9216
+ this.itemIdsSentSuccessfully = {};
9184
9217
  };
9185
9218
 
9186
9219
  /**
@@ -9273,7 +9306,34 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
9273
9306
  payload = this.beforeSendHook(payload);
9274
9307
  }
9275
9308
  if (payload) {
9276
- dataForRequest.push(payload);
9309
+ // mp_sent_by_lib_version prop captures which lib version actually
9310
+ // sends each event (regardless of which version originally queued
9311
+ // it for sending)
9312
+ if (payload['event'] && payload['properties']) {
9313
+ payload['properties'] = _.extend(
9314
+ {},
9315
+ payload['properties'],
9316
+ {'mp_sent_by_lib_version': Config.LIB_VERSION}
9317
+ );
9318
+ }
9319
+ var addPayload = true;
9320
+ var itemId = item['id'];
9321
+ if (itemId) {
9322
+ if ((this.itemIdsSentSuccessfully[itemId] || 0) > 5) {
9323
+ this.reportError('[dupe] item ID sent too many times, not sending', {
9324
+ item: item,
9325
+ batchSize: batch.length,
9326
+ timesSent: this.itemIdsSentSuccessfully[itemId]
9327
+ });
9328
+ addPayload = false;
9329
+ }
9330
+ } else {
9331
+ this.reportError('[dupe] found item with no ID', {item: item});
9332
+ }
9333
+
9334
+ if (addPayload) {
9335
+ dataForRequest.push(payload);
9336
+ }
9277
9337
  }
9278
9338
  transformedItems[item['id']] = payload;
9279
9339
  }, this);
@@ -9356,6 +9416,24 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
9356
9416
  }
9357
9417
  }, this)
9358
9418
  );
9419
+
9420
+ // client-side dedupe
9421
+ _.each(batch, _.bind(function(item) {
9422
+ var itemId = item['id'];
9423
+ if (itemId) {
9424
+ this.itemIdsSentSuccessfully[itemId] = this.itemIdsSentSuccessfully[itemId] || 0;
9425
+ this.itemIdsSentSuccessfully[itemId]++;
9426
+ if (this.itemIdsSentSuccessfully[itemId] > 5) {
9427
+ this.reportError('[dupe] item ID sent too many times', {
9428
+ item: item,
9429
+ batchSize: batch.length,
9430
+ timesSent: this.itemIdsSentSuccessfully[itemId]
9431
+ });
9432
+ }
9433
+ } else {
9434
+ this.reportError('[dupe] found item with no ID while removing', {item: item});
9435
+ }
9436
+ }, this));
9359
9437
  }
9360
9438
 
9361
9439
  } catch(err) {
@@ -10201,24 +10279,25 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10201
10279
  });
10202
10280
 
10203
10281
  /*
10204
- * Record that you have charged the current user a certain amount
10205
- * of money. Charges recorded with track_charge() will appear in the
10206
- * Mixpanel revenue report.
10207
- *
10208
- * ### Usage:
10209
- *
10210
- * // charge a user $50
10211
- * mixpanel.people.track_charge(50);
10212
- *
10213
- * // charge a user $30.50 on the 2nd of january
10214
- * mixpanel.people.track_charge(30.50, {
10215
- * '$time': new Date('jan 1 2012')
10216
- * });
10217
- *
10218
- * @param {Number} amount The amount of money charged to the current user
10219
- * @param {Object} [properties] An associative array of properties associated with the charge
10220
- * @param {Function} [callback] If provided, the callback will be called when the server responds
10221
- */
10282
+ * Record that you have charged the current user a certain amount
10283
+ * of money. Charges recorded with track_charge() will appear in the
10284
+ * Mixpanel revenue report.
10285
+ *
10286
+ * ### Usage:
10287
+ *
10288
+ * // charge a user $50
10289
+ * mixpanel.people.track_charge(50);
10290
+ *
10291
+ * // charge a user $30.50 on the 2nd of january
10292
+ * mixpanel.people.track_charge(30.50, {
10293
+ * '$time': new Date('jan 1 2012')
10294
+ * });
10295
+ *
10296
+ * @param {Number} amount The amount of money charged to the current user
10297
+ * @param {Object} [properties] An associative array of properties associated with the charge
10298
+ * @param {Function} [callback] If provided, the callback will be called when the server responds
10299
+ * @deprecated
10300
+ */
10222
10301
  MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(amount, properties, callback) {
10223
10302
  if (!_.isNumber(amount)) {
10224
10303
  amount = parseFloat(amount);
@@ -10234,15 +10313,16 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10234
10313
  });
10235
10314
 
10236
10315
  /*
10237
- * Permanently clear all revenue report transactions from the
10238
- * current user's people analytics profile.
10239
- *
10240
- * ### Usage:
10241
- *
10242
- * mixpanel.people.clear_charges();
10243
- *
10244
- * @param {Function} [callback] If provided, the callback will be called after tracking the event.
10245
- */
10316
+ * Permanently clear all revenue report transactions from the
10317
+ * current user's people analytics profile.
10318
+ *
10319
+ * ### Usage:
10320
+ *
10321
+ * mixpanel.people.clear_charges();
10322
+ *
10323
+ * @param {Function} [callback] If provided, the callback will be called after tracking the event.
10324
+ * @deprecated
10325
+ */
10246
10326
  MixpanelPeople.prototype.clear_charges = function(callback) {
10247
10327
  return this.set('$transactions', [], callback);
10248
10328
  };
@@ -10642,13 +10722,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10642
10722
  }
10643
10723
  };
10644
10724
 
10645
- MixpanelPersistence.prototype.update_campaign_params = function() {
10646
- if (!this.campaign_params_saved) {
10647
- this.register_once(_.info.campaignParams());
10648
- this.campaign_params_saved = true;
10649
- }
10650
- };
10651
-
10652
10725
  MixpanelPersistence.prototype.update_search_keyword = function(referrer) {
10653
10726
  this.register(_.info.searchInfo(referrer));
10654
10727
  };
@@ -10931,6 +11004,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10931
11004
  /** @const */ var PRIMARY_INSTANCE_NAME = 'mixpanel';
10932
11005
  /** @const */ var PAYLOAD_TYPE_BASE64 = 'base64';
10933
11006
  /** @const */ var PAYLOAD_TYPE_JSON = 'json';
11007
+ /** @const */ var DEVICE_ID_PREFIX = '$device:';
10934
11008
 
10935
11009
 
10936
11010
  /*
@@ -10972,6 +11046,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10972
11046
  'cookie_domain': '',
10973
11047
  'cookie_name': '',
10974
11048
  'loaded': NOOP_FUNC,
11049
+ 'track_marketing': true,
11050
+ 'track_pageview': false,
11051
+ 'skip_first_touch_marketing': false,
10975
11052
  'store_google': true,
10976
11053
  'save_referrer': true,
10977
11054
  'test': false,
@@ -11038,6 +11115,25 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11038
11115
  instance['people'] = new MixpanelPeople();
11039
11116
  instance['people']._init(instance);
11040
11117
 
11118
+ if (!instance.get_config('skip_first_touch_marketing')) {
11119
+ // We need null UTM params in the object because
11120
+ // UTM parameters act as a tuple. If any UTM param
11121
+ // is present, then we set all UTM params including
11122
+ // empty ones together
11123
+ var utm_params = _.info.campaignParams(null);
11124
+ var initial_utm_params = {};
11125
+ var has_utm = false;
11126
+ _.each(utm_params, function(utm_value, utm_key) {
11127
+ initial_utm_params['initial_' + utm_key] = utm_value;
11128
+ if (utm_value) {
11129
+ has_utm = true;
11130
+ }
11131
+ });
11132
+ if (has_utm) {
11133
+ instance['people'].set_once(initial_utm_params);
11134
+ }
11135
+ }
11136
+
11041
11137
  // if any instance on the page has debug = true, we set the
11042
11138
  // global debug to be true
11043
11139
  Config.DEBUG = Config.DEBUG || instance.get_config('debug');
@@ -11069,7 +11165,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11069
11165
  * mixpanel.library_name.track(...);
11070
11166
  *
11071
11167
  * @param {String} token Your Mixpanel API token
11072
- * @param {Object} [config] A dictionary of config options to override. <a href="https://github.com/mixpanel/mixpanel-js/blob/8b2e1f7b/src/mixpanel-core.js#L87-L110">See a list of default config options</a>.
11168
+ * @param {Object} [config] A dictionary of config options to override. <a href="https://github.com/mixpanel/mixpanel-js/blob/v2.46.0/src/mixpanel-core.js#L88-L127">See a list of default config options</a>.
11073
11169
  * @param {String} [name] The name for the new mixpanel instance that you want created
11074
11170
  */
11075
11171
  MixpanelLib.prototype.init = function (token, config, name) {
@@ -11107,7 +11203,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11107
11203
  // default to JSON payload for standard mixpanel.com API hosts
11108
11204
  if (!('api_payload_format' in config)) {
11109
11205
  var api_host = config['api_host'] || DEFAULT_CONFIG['api_host'];
11110
- if (api_host.match(/\.mixpanel\.com$/)) {
11206
+ if (api_host.match(/\.mixpanel\.com/)) {
11111
11207
  variable_features['api_payload_format'] = PAYLOAD_TYPE_JSON;
11112
11208
  }
11113
11209
  }
@@ -11178,10 +11274,14 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11178
11274
  // or the device id if something was already stored
11179
11275
  // in the persitence
11180
11276
  this.register_once({
11181
- 'distinct_id': uuid,
11277
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
11182
11278
  '$device_id': uuid
11183
11279
  }, '');
11184
11280
  }
11281
+
11282
+ if (this.get_config('track_pageview')) {
11283
+ this.track_pageview();
11284
+ }
11185
11285
  };
11186
11286
 
11187
11287
  // Private methods
@@ -11195,7 +11295,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11195
11295
  MixpanelLib.prototype._set_default_superprops = function() {
11196
11296
  this['persistence'].update_search_keyword(document$1.referrer);
11197
11297
  if (this.get_config('store_google')) {
11198
- this['persistence'].update_campaign_params();
11298
+ this.register(_.info.campaignParams(), {persistent: false});
11199
11299
  }
11200
11300
  if (this.get_config('save_referrer')) {
11201
11301
  this['persistence'].update_referrer_info(document$1.referrer);
@@ -11677,6 +11777,10 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11677
11777
 
11678
11778
  this._set_default_superprops();
11679
11779
 
11780
+ var marketing_properties = this.get_config('track_marketing')
11781
+ ? _.info.marketingParams()
11782
+ : {};
11783
+
11680
11784
  // note: extend writes to the first object, so lets make sure we
11681
11785
  // don't write to the persistence properties object and info
11682
11786
  // properties object by passing in a new object
@@ -11685,6 +11789,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11685
11789
  properties = _.extend(
11686
11790
  {},
11687
11791
  _.info.properties(),
11792
+ marketing_properties,
11688
11793
  this['persistence'].properties(),
11689
11794
  this.unpersisted_superprops,
11690
11795
  properties
@@ -11845,17 +11950,54 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11845
11950
  };
11846
11951
 
11847
11952
  /**
11848
- * Track mp_page_view event. This is now ignored by the server.
11953
+ * Track a default Mixpanel page view event, which includes extra default event properties to
11954
+ * improve page view data. The `config.track_pageview` option for <a href="#mixpanelinit">mixpanel.init()</a>
11955
+ * may be turned on for tracking page loads automatically.
11849
11956
  *
11850
- * @param {String} [page] The url of the page to record. If you don't include this, it defaults to the current url.
11851
- * @deprecated
11957
+ * ### Usage
11958
+ *
11959
+ * // track a default $mp_web_page_view event
11960
+ * mixpanel.track_pageview();
11961
+ *
11962
+ * // track a page view event with additional event properties
11963
+ * mixpanel.track_pageview({'ab_test_variant': 'card-layout-b'});
11964
+ *
11965
+ * // example approach to track page views on different page types as event properties
11966
+ * mixpanel.track_pageview({'page': 'pricing'});
11967
+ * mixpanel.track_pageview({'page': 'homepage'});
11968
+ *
11969
+ * // UNCOMMON: Tracking a page view event with a custom event_name option. NOT expected to be used for
11970
+ * // individual pages on the same site or product. Use cases for custom event_name may be page
11971
+ * // views on different products or internal applications that are considered completely separate
11972
+ * mixpanel.track_pageview({'page': 'customer-search'}, {'event_name': '[internal] Admin Page View'});
11973
+ *
11974
+ * @param {Object} [properties] An optional set of additional properties to send with the page view event
11975
+ * @param {Object} [options] Page view tracking options
11976
+ * @param {String} [options.event_name] - Alternate name for the tracking event
11977
+ * @returns {Boolean|Object} If the tracking request was successfully initiated/queued, an object
11978
+ * with the tracking payload sent to the API server is returned; otherwise false.
11852
11979
  */
11853
- MixpanelLib.prototype.track_pageview = function(page) {
11854
- if (_.isUndefined(page)) {
11855
- page = document$1.location.href;
11980
+ MixpanelLib.prototype.track_pageview = addOptOutCheckMixpanelLib(function(properties, options) {
11981
+ if (typeof properties !== 'object') {
11982
+ properties = {};
11856
11983
  }
11857
- this.track('mp_page_view', _.info.pageviewInfo(page));
11858
- };
11984
+ options = options || {};
11985
+ var event_name = options['event_name'] || '$mp_web_page_view';
11986
+
11987
+ var default_page_properties = _.extend(
11988
+ _.info.mpPageViewProperties(),
11989
+ _.info.campaignParams(),
11990
+ _.info.clickParams()
11991
+ );
11992
+
11993
+ var event_properties = _.extend(
11994
+ {},
11995
+ default_page_properties,
11996
+ properties
11997
+ );
11998
+
11999
+ return this.track(event_name, event_properties);
12000
+ });
11859
12001
 
11860
12002
  /**
11861
12003
  * Track clicks on a set of document elements. Selector must be a
@@ -12104,7 +12246,15 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12104
12246
  // _unset_callback:function A callback to be run if and when the People unset queue is flushed
12105
12247
 
12106
12248
  var previous_distinct_id = this.get_distinct_id();
12107
- this.register({'$user_id': new_distinct_id});
12249
+ if (new_distinct_id && previous_distinct_id !== new_distinct_id) {
12250
+ // we allow the following condition if previous distinct_id is same as new_distinct_id
12251
+ // so that you can force flush people updates for anonymous profiles.
12252
+ if (typeof new_distinct_id === 'string' && new_distinct_id.indexOf(DEVICE_ID_PREFIX) === 0) {
12253
+ this.report_error('distinct_id cannot have $device: prefix');
12254
+ return -1;
12255
+ }
12256
+ this.register({'$user_id': new_distinct_id});
12257
+ }
12108
12258
 
12109
12259
  if (!this.get_property('$device_id')) {
12110
12260
  // The persisted distinct id might not actually be a device id at all
@@ -12145,7 +12295,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12145
12295
  this._flags.identify_called = false;
12146
12296
  var uuid = _.UUID();
12147
12297
  this.register_once({
12148
- 'distinct_id': uuid,
12298
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
12149
12299
  '$device_id': uuid
12150
12300
  }, '');
12151
12301
  };
@@ -12270,8 +12420,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12270
12420
  * // batching or retry mechanisms.
12271
12421
  * api_transport: 'XHR'
12272
12422
  *
12273
- * // turn on request-batching/queueing/retry
12274
- * batch_requests: false,
12423
+ * // request-batching/queueing/retry
12424
+ * batch_requests: true,
12275
12425
  *
12276
12426
  * // maximum number of events/updates to send in a single
12277
12427
  * // network request
@@ -12343,10 +12493,20 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12343
12493
  * // secure, meaning they will only be transmitted over https
12344
12494
  * secure_cookie: false
12345
12495
  *
12496
+ * // disables enriching user profiles with first touch marketing data
12497
+ * skip_first_touch_marketing: false
12498
+ *
12346
12499
  * // the amount of time track_links will
12347
12500
  * // wait for Mixpanel's servers to respond
12348
12501
  * track_links_timeout: 300
12349
12502
  *
12503
+ * // adds any UTM parameters and click IDs present on the page to any events fired
12504
+ * track_marketing: true
12505
+ *
12506
+ * // enables automatic page view tracking using default page view events through
12507
+ * // the track_pageview() method
12508
+ * track_pageview: false
12509
+ *
12350
12510
  * // if you set upgrade to be true, the library will check for
12351
12511
  * // a cookie from our old js library and import super
12352
12512
  * // properties from it, then the old cookie is deleted
@@ -13960,7 +14120,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
13960
14120
  });
13961
14121
  }
13962
14122
 
13963
- var name="@thoughtspot/visual-embed-sdk";var version="1.32.7";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^46.9.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/lodash":"^4.17.0","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^5.3.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"48 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
14123
+ var name="@thoughtspot/visual-embed-sdk";var version="1.32.8";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^46.9.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/lodash":"^4.17.0","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^5.3.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"49 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
13964
14124
 
13965
14125
  /**
13966
14126
  * Copyright (c) 2022