@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
@@ -1506,8 +1506,8 @@ var EmbedEvent;
1506
1506
  * Prerequisite: Set isOnBeforeGetVizDataInterceptEnabled : true
1507
1507
  * for this embed event to get emitted.
1508
1508
  *
1509
- * Parameter: payload
1510
- * Parameter: responder
1509
+ * @param: payload
1510
+ * @param: responder
1511
1511
  * Contains elements that lets developers define whether ThoughtSpot
1512
1512
  * will run the search or not, and if not, which error message to provide.
1513
1513
  *
@@ -1519,6 +1519,7 @@ var EmbedEvent;
1519
1519
  *
1520
1520
  * @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
1521
1521
  *
1522
+ * @example
1522
1523
  *```js
1523
1524
  * .on(EmbedEvent.OnBeforeGetVizDataIntercept,
1524
1525
  * (payload, responder) => {
@@ -1554,7 +1555,6 @@ var EmbedEvent;
1554
1555
  * }})
1555
1556
  * })
1556
1557
  *```
1557
- *
1558
1558
  */
1559
1559
  EmbedEvent["OnBeforeGetVizDataIntercept"] = "onBeforeGetVizDataIntercept";
1560
1560
  /**
@@ -6209,7 +6209,11 @@ const setEmbedConfig = (newConfig) => {
6209
6209
  const tokenizedFetch = async (input, init) => {
6210
6210
  const embedConfig = getEmbedConfig();
6211
6211
  if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
6212
- return fetch(input, init);
6212
+ return fetch(input, {
6213
+ // ensure cookies are included for the non cookie-less api calls.
6214
+ credentials: 'include',
6215
+ ...init,
6216
+ });
6213
6217
  }
6214
6218
  const req = new Request(input, init);
6215
6219
  const authToken = await getAuthenticationToken(embedConfig);
@@ -6876,7 +6880,7 @@ const DEFAULT_EMBED_HEIGHT = '100%';
6876
6880
 
6877
6881
  var Config = {
6878
6882
  DEBUG: false,
6879
- LIB_VERSION: '2.45.0'
6883
+ LIB_VERSION: '2.47.0'
6880
6884
  };
6881
6885
 
6882
6886
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
@@ -7706,20 +7710,24 @@ _.utf8Encode = function(string) {
7706
7710
 
7707
7711
  _.UUID = (function() {
7708
7712
 
7709
- // Time/ticks information
7710
- // 1*new Date() is a cross browser version of Date.now()
7713
+ // Time-based entropy
7711
7714
  var T = function() {
7712
- var d = 1 * new Date(),
7713
- i = 0;
7714
-
7715
- // this while loop figures how many browser ticks go by
7716
- // before 1*new Date() returns a new number, ie the amount
7717
- // of ticks that go by per millisecond
7718
- while (d == 1 * new Date()) {
7719
- i++;
7715
+ var time = 1 * new Date(); // cross-browser version of Date.now()
7716
+ var ticks;
7717
+ if (window$1.performance && window$1.performance.now) {
7718
+ ticks = window$1.performance.now();
7719
+ } else {
7720
+ // fall back to busy loop
7721
+ ticks = 0;
7722
+
7723
+ // this while loop figures how many browser ticks go by
7724
+ // before 1*new Date() returns a new number, ie the amount
7725
+ // of ticks that go by per millisecond
7726
+ while (time == 1 * new Date()) {
7727
+ ticks++;
7728
+ }
7720
7729
  }
7721
-
7722
- return d.toString(16) + i.toString(16);
7730
+ return time.toString(16) + Math.floor(ticks).toString(16);
7723
7731
  };
7724
7732
 
7725
7733
  // Math.Random entropy
@@ -8286,21 +8294,42 @@ _.dom_query = (function() {
8286
8294
  };
8287
8295
  })();
8288
8296
 
8297
+ var CAMPAIGN_KEYWORDS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'];
8298
+ var CLICK_IDS = ['dclid', 'fbclid', 'gclid', 'ko_click_id', 'li_fat_id', 'msclkid', 'ttclid', 'twclid', 'wbraid'];
8299
+
8289
8300
  _.info = {
8290
- campaignParams: function() {
8291
- var campaign_keywords = 'utm_source utm_medium utm_campaign utm_content utm_term'.split(' '),
8292
- kw = '',
8301
+ campaignParams: function(default_value) {
8302
+ var kw = '',
8293
8303
  params = {};
8294
- _.each(campaign_keywords, function(kwkey) {
8304
+ _.each(CAMPAIGN_KEYWORDS, function(kwkey) {
8295
8305
  kw = _.getQueryParam(document$1.URL, kwkey);
8296
8306
  if (kw.length) {
8297
8307
  params[kwkey] = kw;
8308
+ } else if (default_value !== undefined) {
8309
+ params[kwkey] = default_value;
8310
+ }
8311
+ });
8312
+
8313
+ return params;
8314
+ },
8315
+
8316
+ clickParams: function() {
8317
+ var id = '',
8318
+ params = {};
8319
+ _.each(CLICK_IDS, function(idkey) {
8320
+ id = _.getQueryParam(document$1.URL, idkey);
8321
+ if (id.length) {
8322
+ params[idkey] = id;
8298
8323
  }
8299
8324
  });
8300
8325
 
8301
8326
  return params;
8302
8327
  },
8303
8328
 
8329
+ marketingParams: function() {
8330
+ return _.extend(_.info.campaignParams(), _.info.clickParams());
8331
+ },
8332
+
8304
8333
  searchEngine: function(referrer) {
8305
8334
  if (referrer.search('https?://(.*)google.([^/?]*)') === 0) {
8306
8335
  return 'google';
@@ -8497,12 +8526,13 @@ _.info = {
8497
8526
  });
8498
8527
  },
8499
8528
 
8500
- pageviewInfo: function(page) {
8529
+ mpPageViewProperties: function() {
8501
8530
  return _.strip_empty_properties({
8502
- 'mp_page': page,
8503
- 'mp_referrer': document$1.referrer,
8504
- 'mp_browser': _.info.browser(userAgent, navigator.vendor, windowOpera),
8505
- 'mp_platform': _.info.os()
8531
+ 'current_page_title': document$1.title,
8532
+ 'current_domain': window$1.location.hostname,
8533
+ 'current_url_path': window$1.location.pathname,
8534
+ 'current_url_protocol': window$1.location.protocol,
8535
+ 'current_url_search': window$1.location.search
8506
8536
  });
8507
8537
  }
8508
8538
  };
@@ -9169,6 +9199,9 @@ var RequestBatcher = function(storageKey, options) {
9169
9199
 
9170
9200
  this.stopped = !this.libConfig['batch_autostart'];
9171
9201
  this.consecutiveRemovalFailures = 0;
9202
+
9203
+ // extra client-side dedupe
9204
+ this.itemIdsSentSuccessfully = {};
9172
9205
  };
9173
9206
 
9174
9207
  /**
@@ -9261,7 +9294,34 @@ RequestBatcher.prototype.flush = function(options) {
9261
9294
  payload = this.beforeSendHook(payload);
9262
9295
  }
9263
9296
  if (payload) {
9264
- dataForRequest.push(payload);
9297
+ // mp_sent_by_lib_version prop captures which lib version actually
9298
+ // sends each event (regardless of which version originally queued
9299
+ // it for sending)
9300
+ if (payload['event'] && payload['properties']) {
9301
+ payload['properties'] = _.extend(
9302
+ {},
9303
+ payload['properties'],
9304
+ {'mp_sent_by_lib_version': Config.LIB_VERSION}
9305
+ );
9306
+ }
9307
+ var addPayload = true;
9308
+ var itemId = item['id'];
9309
+ if (itemId) {
9310
+ if ((this.itemIdsSentSuccessfully[itemId] || 0) > 5) {
9311
+ this.reportError('[dupe] item ID sent too many times, not sending', {
9312
+ item: item,
9313
+ batchSize: batch.length,
9314
+ timesSent: this.itemIdsSentSuccessfully[itemId]
9315
+ });
9316
+ addPayload = false;
9317
+ }
9318
+ } else {
9319
+ this.reportError('[dupe] found item with no ID', {item: item});
9320
+ }
9321
+
9322
+ if (addPayload) {
9323
+ dataForRequest.push(payload);
9324
+ }
9265
9325
  }
9266
9326
  transformedItems[item['id']] = payload;
9267
9327
  }, this);
@@ -9344,6 +9404,24 @@ RequestBatcher.prototype.flush = function(options) {
9344
9404
  }
9345
9405
  }, this)
9346
9406
  );
9407
+
9408
+ // client-side dedupe
9409
+ _.each(batch, _.bind(function(item) {
9410
+ var itemId = item['id'];
9411
+ if (itemId) {
9412
+ this.itemIdsSentSuccessfully[itemId] = this.itemIdsSentSuccessfully[itemId] || 0;
9413
+ this.itemIdsSentSuccessfully[itemId]++;
9414
+ if (this.itemIdsSentSuccessfully[itemId] > 5) {
9415
+ this.reportError('[dupe] item ID sent too many times', {
9416
+ item: item,
9417
+ batchSize: batch.length,
9418
+ timesSent: this.itemIdsSentSuccessfully[itemId]
9419
+ });
9420
+ }
9421
+ } else {
9422
+ this.reportError('[dupe] found item with no ID while removing', {item: item});
9423
+ }
9424
+ }, this));
9347
9425
  }
9348
9426
 
9349
9427
  } catch(err) {
@@ -10189,24 +10267,25 @@ MixpanelPeople.prototype.union = addOptOutCheckMixpanelPeople(function(list_name
10189
10267
  });
10190
10268
 
10191
10269
  /*
10192
- * Record that you have charged the current user a certain amount
10193
- * of money. Charges recorded with track_charge() will appear in the
10194
- * Mixpanel revenue report.
10195
- *
10196
- * ### Usage:
10197
- *
10198
- * // charge a user $50
10199
- * mixpanel.people.track_charge(50);
10200
- *
10201
- * // charge a user $30.50 on the 2nd of january
10202
- * mixpanel.people.track_charge(30.50, {
10203
- * '$time': new Date('jan 1 2012')
10204
- * });
10205
- *
10206
- * @param {Number} amount The amount of money charged to the current user
10207
- * @param {Object} [properties] An associative array of properties associated with the charge
10208
- * @param {Function} [callback] If provided, the callback will be called when the server responds
10209
- */
10270
+ * Record that you have charged the current user a certain amount
10271
+ * of money. Charges recorded with track_charge() will appear in the
10272
+ * Mixpanel revenue report.
10273
+ *
10274
+ * ### Usage:
10275
+ *
10276
+ * // charge a user $50
10277
+ * mixpanel.people.track_charge(50);
10278
+ *
10279
+ * // charge a user $30.50 on the 2nd of january
10280
+ * mixpanel.people.track_charge(30.50, {
10281
+ * '$time': new Date('jan 1 2012')
10282
+ * });
10283
+ *
10284
+ * @param {Number} amount The amount of money charged to the current user
10285
+ * @param {Object} [properties] An associative array of properties associated with the charge
10286
+ * @param {Function} [callback] If provided, the callback will be called when the server responds
10287
+ * @deprecated
10288
+ */
10210
10289
  MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(amount, properties, callback) {
10211
10290
  if (!_.isNumber(amount)) {
10212
10291
  amount = parseFloat(amount);
@@ -10222,15 +10301,16 @@ MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(am
10222
10301
  });
10223
10302
 
10224
10303
  /*
10225
- * Permanently clear all revenue report transactions from the
10226
- * current user's people analytics profile.
10227
- *
10228
- * ### Usage:
10229
- *
10230
- * mixpanel.people.clear_charges();
10231
- *
10232
- * @param {Function} [callback] If provided, the callback will be called after tracking the event.
10233
- */
10304
+ * Permanently clear all revenue report transactions from the
10305
+ * current user's people analytics profile.
10306
+ *
10307
+ * ### Usage:
10308
+ *
10309
+ * mixpanel.people.clear_charges();
10310
+ *
10311
+ * @param {Function} [callback] If provided, the callback will be called after tracking the event.
10312
+ * @deprecated
10313
+ */
10234
10314
  MixpanelPeople.prototype.clear_charges = function(callback) {
10235
10315
  return this.set('$transactions', [], callback);
10236
10316
  };
@@ -10630,13 +10710,6 @@ MixpanelPersistence.prototype.unregister = function(prop) {
10630
10710
  }
10631
10711
  };
10632
10712
 
10633
- MixpanelPersistence.prototype.update_campaign_params = function() {
10634
- if (!this.campaign_params_saved) {
10635
- this.register_once(_.info.campaignParams());
10636
- this.campaign_params_saved = true;
10637
- }
10638
- };
10639
-
10640
10713
  MixpanelPersistence.prototype.update_search_keyword = function(referrer) {
10641
10714
  this.register(_.info.searchInfo(referrer));
10642
10715
  };
@@ -10919,6 +10992,7 @@ var NOOP_FUNC = function() {};
10919
10992
  /** @const */ var PRIMARY_INSTANCE_NAME = 'mixpanel';
10920
10993
  /** @const */ var PAYLOAD_TYPE_BASE64 = 'base64';
10921
10994
  /** @const */ var PAYLOAD_TYPE_JSON = 'json';
10995
+ /** @const */ var DEVICE_ID_PREFIX = '$device:';
10922
10996
 
10923
10997
 
10924
10998
  /*
@@ -10960,6 +11034,9 @@ var DEFAULT_CONFIG = {
10960
11034
  'cookie_domain': '',
10961
11035
  'cookie_name': '',
10962
11036
  'loaded': NOOP_FUNC,
11037
+ 'track_marketing': true,
11038
+ 'track_pageview': false,
11039
+ 'skip_first_touch_marketing': false,
10963
11040
  'store_google': true,
10964
11041
  'save_referrer': true,
10965
11042
  'test': false,
@@ -11026,6 +11103,25 @@ var create_mplib = function(token, config, name) {
11026
11103
  instance['people'] = new MixpanelPeople();
11027
11104
  instance['people']._init(instance);
11028
11105
 
11106
+ if (!instance.get_config('skip_first_touch_marketing')) {
11107
+ // We need null UTM params in the object because
11108
+ // UTM parameters act as a tuple. If any UTM param
11109
+ // is present, then we set all UTM params including
11110
+ // empty ones together
11111
+ var utm_params = _.info.campaignParams(null);
11112
+ var initial_utm_params = {};
11113
+ var has_utm = false;
11114
+ _.each(utm_params, function(utm_value, utm_key) {
11115
+ initial_utm_params['initial_' + utm_key] = utm_value;
11116
+ if (utm_value) {
11117
+ has_utm = true;
11118
+ }
11119
+ });
11120
+ if (has_utm) {
11121
+ instance['people'].set_once(initial_utm_params);
11122
+ }
11123
+ }
11124
+
11029
11125
  // if any instance on the page has debug = true, we set the
11030
11126
  // global debug to be true
11031
11127
  Config.DEBUG = Config.DEBUG || instance.get_config('debug');
@@ -11057,7 +11153,7 @@ var create_mplib = function(token, config, name) {
11057
11153
  * mixpanel.library_name.track(...);
11058
11154
  *
11059
11155
  * @param {String} token Your Mixpanel API token
11060
- * @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>.
11156
+ * @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>.
11061
11157
  * @param {String} [name] The name for the new mixpanel instance that you want created
11062
11158
  */
11063
11159
  MixpanelLib.prototype.init = function (token, config, name) {
@@ -11095,7 +11191,7 @@ MixpanelLib.prototype._init = function(token, config, name) {
11095
11191
  // default to JSON payload for standard mixpanel.com API hosts
11096
11192
  if (!('api_payload_format' in config)) {
11097
11193
  var api_host = config['api_host'] || DEFAULT_CONFIG['api_host'];
11098
- if (api_host.match(/\.mixpanel\.com$/)) {
11194
+ if (api_host.match(/\.mixpanel\.com/)) {
11099
11195
  variable_features['api_payload_format'] = PAYLOAD_TYPE_JSON;
11100
11196
  }
11101
11197
  }
@@ -11166,10 +11262,14 @@ MixpanelLib.prototype._init = function(token, config, name) {
11166
11262
  // or the device id if something was already stored
11167
11263
  // in the persitence
11168
11264
  this.register_once({
11169
- 'distinct_id': uuid,
11265
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
11170
11266
  '$device_id': uuid
11171
11267
  }, '');
11172
11268
  }
11269
+
11270
+ if (this.get_config('track_pageview')) {
11271
+ this.track_pageview();
11272
+ }
11173
11273
  };
11174
11274
 
11175
11275
  // Private methods
@@ -11183,7 +11283,7 @@ MixpanelLib.prototype._loaded = function() {
11183
11283
  MixpanelLib.prototype._set_default_superprops = function() {
11184
11284
  this['persistence'].update_search_keyword(document$1.referrer);
11185
11285
  if (this.get_config('store_google')) {
11186
- this['persistence'].update_campaign_params();
11286
+ this.register(_.info.campaignParams(), {persistent: false});
11187
11287
  }
11188
11288
  if (this.get_config('save_referrer')) {
11189
11289
  this['persistence'].update_referrer_info(document$1.referrer);
@@ -11665,6 +11765,10 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
11665
11765
 
11666
11766
  this._set_default_superprops();
11667
11767
 
11768
+ var marketing_properties = this.get_config('track_marketing')
11769
+ ? _.info.marketingParams()
11770
+ : {};
11771
+
11668
11772
  // note: extend writes to the first object, so lets make sure we
11669
11773
  // don't write to the persistence properties object and info
11670
11774
  // properties object by passing in a new object
@@ -11673,6 +11777,7 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
11673
11777
  properties = _.extend(
11674
11778
  {},
11675
11779
  _.info.properties(),
11780
+ marketing_properties,
11676
11781
  this['persistence'].properties(),
11677
11782
  this.unpersisted_superprops,
11678
11783
  properties
@@ -11833,17 +11938,54 @@ MixpanelLib.prototype.get_group = function (group_key, group_id) {
11833
11938
  };
11834
11939
 
11835
11940
  /**
11836
- * Track mp_page_view event. This is now ignored by the server.
11941
+ * Track a default Mixpanel page view event, which includes extra default event properties to
11942
+ * improve page view data. The `config.track_pageview` option for <a href="#mixpanelinit">mixpanel.init()</a>
11943
+ * may be turned on for tracking page loads automatically.
11837
11944
  *
11838
- * @param {String} [page] The url of the page to record. If you don't include this, it defaults to the current url.
11839
- * @deprecated
11945
+ * ### Usage
11946
+ *
11947
+ * // track a default $mp_web_page_view event
11948
+ * mixpanel.track_pageview();
11949
+ *
11950
+ * // track a page view event with additional event properties
11951
+ * mixpanel.track_pageview({'ab_test_variant': 'card-layout-b'});
11952
+ *
11953
+ * // example approach to track page views on different page types as event properties
11954
+ * mixpanel.track_pageview({'page': 'pricing'});
11955
+ * mixpanel.track_pageview({'page': 'homepage'});
11956
+ *
11957
+ * // UNCOMMON: Tracking a page view event with a custom event_name option. NOT expected to be used for
11958
+ * // individual pages on the same site or product. Use cases for custom event_name may be page
11959
+ * // views on different products or internal applications that are considered completely separate
11960
+ * mixpanel.track_pageview({'page': 'customer-search'}, {'event_name': '[internal] Admin Page View'});
11961
+ *
11962
+ * @param {Object} [properties] An optional set of additional properties to send with the page view event
11963
+ * @param {Object} [options] Page view tracking options
11964
+ * @param {String} [options.event_name] - Alternate name for the tracking event
11965
+ * @returns {Boolean|Object} If the tracking request was successfully initiated/queued, an object
11966
+ * with the tracking payload sent to the API server is returned; otherwise false.
11840
11967
  */
11841
- MixpanelLib.prototype.track_pageview = function(page) {
11842
- if (_.isUndefined(page)) {
11843
- page = document$1.location.href;
11968
+ MixpanelLib.prototype.track_pageview = addOptOutCheckMixpanelLib(function(properties, options) {
11969
+ if (typeof properties !== 'object') {
11970
+ properties = {};
11844
11971
  }
11845
- this.track('mp_page_view', _.info.pageviewInfo(page));
11846
- };
11972
+ options = options || {};
11973
+ var event_name = options['event_name'] || '$mp_web_page_view';
11974
+
11975
+ var default_page_properties = _.extend(
11976
+ _.info.mpPageViewProperties(),
11977
+ _.info.campaignParams(),
11978
+ _.info.clickParams()
11979
+ );
11980
+
11981
+ var event_properties = _.extend(
11982
+ {},
11983
+ default_page_properties,
11984
+ properties
11985
+ );
11986
+
11987
+ return this.track(event_name, event_properties);
11988
+ });
11847
11989
 
11848
11990
  /**
11849
11991
  * Track clicks on a set of document elements. Selector must be a
@@ -12092,7 +12234,15 @@ MixpanelLib.prototype.identify = function(
12092
12234
  // _unset_callback:function A callback to be run if and when the People unset queue is flushed
12093
12235
 
12094
12236
  var previous_distinct_id = this.get_distinct_id();
12095
- this.register({'$user_id': new_distinct_id});
12237
+ if (new_distinct_id && previous_distinct_id !== new_distinct_id) {
12238
+ // we allow the following condition if previous distinct_id is same as new_distinct_id
12239
+ // so that you can force flush people updates for anonymous profiles.
12240
+ if (typeof new_distinct_id === 'string' && new_distinct_id.indexOf(DEVICE_ID_PREFIX) === 0) {
12241
+ this.report_error('distinct_id cannot have $device: prefix');
12242
+ return -1;
12243
+ }
12244
+ this.register({'$user_id': new_distinct_id});
12245
+ }
12096
12246
 
12097
12247
  if (!this.get_property('$device_id')) {
12098
12248
  // The persisted distinct id might not actually be a device id at all
@@ -12133,7 +12283,7 @@ MixpanelLib.prototype.reset = function() {
12133
12283
  this._flags.identify_called = false;
12134
12284
  var uuid = _.UUID();
12135
12285
  this.register_once({
12136
- 'distinct_id': uuid,
12286
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
12137
12287
  '$device_id': uuid
12138
12288
  }, '');
12139
12289
  };
@@ -12258,8 +12408,8 @@ MixpanelLib.prototype.name_tag = function(name_tag) {
12258
12408
  * // batching or retry mechanisms.
12259
12409
  * api_transport: 'XHR'
12260
12410
  *
12261
- * // turn on request-batching/queueing/retry
12262
- * batch_requests: false,
12411
+ * // request-batching/queueing/retry
12412
+ * batch_requests: true,
12263
12413
  *
12264
12414
  * // maximum number of events/updates to send in a single
12265
12415
  * // network request
@@ -12331,10 +12481,20 @@ MixpanelLib.prototype.name_tag = function(name_tag) {
12331
12481
  * // secure, meaning they will only be transmitted over https
12332
12482
  * secure_cookie: false
12333
12483
  *
12484
+ * // disables enriching user profiles with first touch marketing data
12485
+ * skip_first_touch_marketing: false
12486
+ *
12334
12487
  * // the amount of time track_links will
12335
12488
  * // wait for Mixpanel's servers to respond
12336
12489
  * track_links_timeout: 300
12337
12490
  *
12491
+ * // adds any UTM parameters and click IDs present on the page to any events fired
12492
+ * track_marketing: true
12493
+ *
12494
+ * // enables automatic page view tracking using default page view events through
12495
+ * // the track_pageview() method
12496
+ * track_pageview: false
12497
+ *
12338
12498
  * // if you set upgrade to be true, the library will check for
12339
12499
  * // a cookie from our old js library and import super
12340
12500
  * // properties from it, then the old cookie is deleted
@@ -14009,21 +14169,22 @@ const renderInQueue = (fn) => {
14009
14169
  /**
14010
14170
  * Imports TML representation of the metadata objects into ThoughtSpot.
14011
14171
  * @param data
14172
+ * @returns imports TML data into ThoughtSpot
14012
14173
  * @example
14013
14174
  * ```js
14014
- * executeTML({
14015
- * //Array of metadata Tmls
14016
- metadata_tmls: [
14017
- "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
14018
- \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
14019
- ],
14020
- import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
14021
- create_new: false, // If selected, creates TML objects with new GUIDs.
14022
- }).then(result => {
14023
- console.log(result);
14024
- }).catch(error => {
14025
- console.error(error);
14026
- });
14175
+ * executeTML({
14176
+ * //Array of metadata Tmls in string format
14177
+ * metadata_tmls: [
14178
+ * "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
14179
+ * \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
14180
+ * ],
14181
+ * import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
14182
+ * create_new: false, // If selected, creates TML objects with new GUIDs.
14183
+ * }).then(result => {
14184
+ * console.log(result);
14185
+ * }).catch(error => {
14186
+ * console.error(error);
14187
+ * });
14027
14188
  *```
14028
14189
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
14029
14190
  * @group Global methods
@@ -14065,27 +14226,28 @@ const executeTML = async (data) => {
14065
14226
  * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
14066
14227
  * format.
14067
14228
  * @param data
14229
+ * @returns exports TML data
14068
14230
  * @example
14069
14231
  * ```js
14070
- exportTML({
14071
- metadata: [
14072
- {
14073
- type: "LIVEBOARD", //Metadata Type
14074
- identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
14075
- }
14076
- ],
14077
- export_associated: false,//indicates whether to export associated metadata objects
14078
- export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
14079
- //exporting a Liveboard and its associated objects, the API
14080
- //returns the Liveboard TML data with the FQNs of the referenced
14081
- //worksheet. If the exported TML data includes FQNs, you don't need
14082
- //to manually add FQNs of the referenced objects during TML import.
14083
- edoc_format: "JSON" //It takes JSON or YAML value
14084
- }).then(result => {
14085
- console.log(result);
14086
- }).catch(error => {
14087
- console.error(error);
14088
- });
14232
+ * exportTML({
14233
+ * metadata: [
14234
+ * {
14235
+ * type: "LIVEBOARD", //Metadata Type
14236
+ * identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
14237
+ * }
14238
+ * ],
14239
+ * export_associated: false,//indicates whether to export associated metadata objects
14240
+ * export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
14241
+ * //exporting a Liveboard and its associated objects, the API
14242
+ * //returns the Liveboard TML data with the FQNs of the referenced
14243
+ * //worksheet. If the exported TML data includes FQNs, you don't need
14244
+ * //to manually add FQNs of the referenced objects during TML import.
14245
+ * edoc_format: "JSON" //It takes JSON or YAML value
14246
+ * }).then(result => {
14247
+ * console.log(result);
14248
+ * }).catch(error => {
14249
+ * console.error(error);
14250
+ * });
14089
14251
  * ```
14090
14252
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
14091
14253
  * @group Global methods
@@ -14281,7 +14443,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
14281
14443
  });
14282
14444
  }
14283
14445
 
14284
- 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={".":{"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,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};
14446
+ 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={".":{"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,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};
14285
14447
 
14286
14448
  /**
14287
14449
  * Copyright (c) 2022