@thoughtspot/visual-embed-sdk 1.32.6 → 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 (53) 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 +7 -4
  12. package/cjs/src/types.d.ts.map +1 -1
  13. package/cjs/src/types.js +7 -4
  14. package/cjs/src/types.js.map +1 -1
  15. package/cjs/src/utils/authService/authService.spec.js +3 -1
  16. package/cjs/src/utils/authService/authService.spec.js.map +1 -1
  17. package/dist/src/css-variables.d.ts +18 -3
  18. package/dist/src/css-variables.d.ts.map +1 -1
  19. package/dist/src/embed/base.d.ts +34 -32
  20. package/dist/src/embed/base.d.ts.map +1 -1
  21. package/dist/src/tokenizedFetch.d.ts.map +1 -1
  22. package/dist/src/types.d.ts +7 -4
  23. package/dist/src/types.d.ts.map +1 -1
  24. package/dist/tsembed-react.es.js +242 -79
  25. package/dist/tsembed-react.js +242 -79
  26. package/dist/tsembed.es.js +276 -111
  27. package/dist/tsembed.js +276 -111
  28. package/dist/visual-embed-sdk-react-full.d.ts +59 -39
  29. package/dist/visual-embed-sdk-react.d.ts +59 -39
  30. package/dist/visual-embed-sdk.d.ts +59 -39
  31. package/lib/package.json +3 -3
  32. package/lib/src/css-variables.d.ts +18 -3
  33. package/lib/src/css-variables.d.ts.map +1 -1
  34. package/lib/src/embed/base.d.ts +34 -32
  35. package/lib/src/embed/base.d.ts.map +1 -1
  36. package/lib/src/embed/base.js +34 -32
  37. package/lib/src/embed/base.js.map +1 -1
  38. package/lib/src/tokenizedFetch.d.ts.map +1 -1
  39. package/lib/src/tokenizedFetch.js +5 -1
  40. package/lib/src/tokenizedFetch.js.map +1 -1
  41. package/lib/src/types.d.ts +7 -4
  42. package/lib/src/types.d.ts.map +1 -1
  43. package/lib/src/types.js +7 -4
  44. package/lib/src/types.js.map +1 -1
  45. package/lib/src/utils/authService/authService.spec.js +3 -1
  46. package/lib/src/utils/authService/authService.spec.js.map +1 -1
  47. package/lib/src/visual-embed-sdk.d.ts +59 -39
  48. package/package.json +3 -3
  49. package/src/css-variables.ts +21 -3
  50. package/src/embed/base.ts +34 -32
  51. package/src/tokenizedFetch.ts +5 -1
  52. package/src/types.ts +7 -4
  53. package/src/utils/authService/authService.spec.ts +3 -1
@@ -1506,15 +1506,20 @@ 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
1514
  * execute: When execute returns true, the search will be run.
1514
1515
  * When execute returns false, the search will not be executed.
1516
+ *
1515
1517
  * error: Developers can customize the user facing message when execute is
1516
1518
  * set to false using the error parameter in responder
1517
1519
  *
1520
+ * @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
1521
+ *
1522
+ * @example
1518
1523
  *```js
1519
1524
  * .on(EmbedEvent.OnBeforeGetVizDataIntercept,
1520
1525
  * (payload, responder) => {
@@ -1550,8 +1555,6 @@ var EmbedEvent;
1550
1555
  * }})
1551
1556
  * })
1552
1557
  *```
1553
- *
1554
- * @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
1555
1558
  */
1556
1559
  EmbedEvent["OnBeforeGetVizDataIntercept"] = "onBeforeGetVizDataIntercept";
1557
1560
  /**
@@ -6206,7 +6209,11 @@ const setEmbedConfig = (newConfig) => {
6206
6209
  const tokenizedFetch = async (input, init) => {
6207
6210
  const embedConfig = getEmbedConfig();
6208
6211
  if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
6209
- 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
+ });
6210
6217
  }
6211
6218
  const req = new Request(input, init);
6212
6219
  const authToken = await getAuthenticationToken(embedConfig);
@@ -6873,7 +6880,7 @@ const DEFAULT_EMBED_HEIGHT = '100%';
6873
6880
 
6874
6881
  var Config = {
6875
6882
  DEBUG: false,
6876
- LIB_VERSION: '2.45.0'
6883
+ LIB_VERSION: '2.47.0'
6877
6884
  };
6878
6885
 
6879
6886
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
@@ -7703,20 +7710,24 @@ _.utf8Encode = function(string) {
7703
7710
 
7704
7711
  _.UUID = (function() {
7705
7712
 
7706
- // Time/ticks information
7707
- // 1*new Date() is a cross browser version of Date.now()
7713
+ // Time-based entropy
7708
7714
  var T = function() {
7709
- var d = 1 * new Date(),
7710
- i = 0;
7711
-
7712
- // this while loop figures how many browser ticks go by
7713
- // before 1*new Date() returns a new number, ie the amount
7714
- // of ticks that go by per millisecond
7715
- while (d == 1 * new Date()) {
7716
- 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
+ }
7717
7729
  }
7718
-
7719
- return d.toString(16) + i.toString(16);
7730
+ return time.toString(16) + Math.floor(ticks).toString(16);
7720
7731
  };
7721
7732
 
7722
7733
  // Math.Random entropy
@@ -8283,21 +8294,42 @@ _.dom_query = (function() {
8283
8294
  };
8284
8295
  })();
8285
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
+
8286
8300
  _.info = {
8287
- campaignParams: function() {
8288
- var campaign_keywords = 'utm_source utm_medium utm_campaign utm_content utm_term'.split(' '),
8289
- kw = '',
8301
+ campaignParams: function(default_value) {
8302
+ var kw = '',
8290
8303
  params = {};
8291
- _.each(campaign_keywords, function(kwkey) {
8304
+ _.each(CAMPAIGN_KEYWORDS, function(kwkey) {
8292
8305
  kw = _.getQueryParam(document$1.URL, kwkey);
8293
8306
  if (kw.length) {
8294
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;
8295
8323
  }
8296
8324
  });
8297
8325
 
8298
8326
  return params;
8299
8327
  },
8300
8328
 
8329
+ marketingParams: function() {
8330
+ return _.extend(_.info.campaignParams(), _.info.clickParams());
8331
+ },
8332
+
8301
8333
  searchEngine: function(referrer) {
8302
8334
  if (referrer.search('https?://(.*)google.([^/?]*)') === 0) {
8303
8335
  return 'google';
@@ -8494,12 +8526,13 @@ _.info = {
8494
8526
  });
8495
8527
  },
8496
8528
 
8497
- pageviewInfo: function(page) {
8529
+ mpPageViewProperties: function() {
8498
8530
  return _.strip_empty_properties({
8499
- 'mp_page': page,
8500
- 'mp_referrer': document$1.referrer,
8501
- 'mp_browser': _.info.browser(userAgent, navigator.vendor, windowOpera),
8502
- '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
8503
8536
  });
8504
8537
  }
8505
8538
  };
@@ -9166,6 +9199,9 @@ var RequestBatcher = function(storageKey, options) {
9166
9199
 
9167
9200
  this.stopped = !this.libConfig['batch_autostart'];
9168
9201
  this.consecutiveRemovalFailures = 0;
9202
+
9203
+ // extra client-side dedupe
9204
+ this.itemIdsSentSuccessfully = {};
9169
9205
  };
9170
9206
 
9171
9207
  /**
@@ -9258,7 +9294,34 @@ RequestBatcher.prototype.flush = function(options) {
9258
9294
  payload = this.beforeSendHook(payload);
9259
9295
  }
9260
9296
  if (payload) {
9261
- 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
+ }
9262
9325
  }
9263
9326
  transformedItems[item['id']] = payload;
9264
9327
  }, this);
@@ -9341,6 +9404,24 @@ RequestBatcher.prototype.flush = function(options) {
9341
9404
  }
9342
9405
  }, this)
9343
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));
9344
9425
  }
9345
9426
 
9346
9427
  } catch(err) {
@@ -10186,24 +10267,25 @@ MixpanelPeople.prototype.union = addOptOutCheckMixpanelPeople(function(list_name
10186
10267
  });
10187
10268
 
10188
10269
  /*
10189
- * Record that you have charged the current user a certain amount
10190
- * of money. Charges recorded with track_charge() will appear in the
10191
- * Mixpanel revenue report.
10192
- *
10193
- * ### Usage:
10194
- *
10195
- * // charge a user $50
10196
- * mixpanel.people.track_charge(50);
10197
- *
10198
- * // charge a user $30.50 on the 2nd of january
10199
- * mixpanel.people.track_charge(30.50, {
10200
- * '$time': new Date('jan 1 2012')
10201
- * });
10202
- *
10203
- * @param {Number} amount The amount of money charged to the current user
10204
- * @param {Object} [properties] An associative array of properties associated with the charge
10205
- * @param {Function} [callback] If provided, the callback will be called when the server responds
10206
- */
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
+ */
10207
10289
  MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(amount, properties, callback) {
10208
10290
  if (!_.isNumber(amount)) {
10209
10291
  amount = parseFloat(amount);
@@ -10219,15 +10301,16 @@ MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(am
10219
10301
  });
10220
10302
 
10221
10303
  /*
10222
- * Permanently clear all revenue report transactions from the
10223
- * current user's people analytics profile.
10224
- *
10225
- * ### Usage:
10226
- *
10227
- * mixpanel.people.clear_charges();
10228
- *
10229
- * @param {Function} [callback] If provided, the callback will be called after tracking the event.
10230
- */
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
+ */
10231
10314
  MixpanelPeople.prototype.clear_charges = function(callback) {
10232
10315
  return this.set('$transactions', [], callback);
10233
10316
  };
@@ -10627,13 +10710,6 @@ MixpanelPersistence.prototype.unregister = function(prop) {
10627
10710
  }
10628
10711
  };
10629
10712
 
10630
- MixpanelPersistence.prototype.update_campaign_params = function() {
10631
- if (!this.campaign_params_saved) {
10632
- this.register_once(_.info.campaignParams());
10633
- this.campaign_params_saved = true;
10634
- }
10635
- };
10636
-
10637
10713
  MixpanelPersistence.prototype.update_search_keyword = function(referrer) {
10638
10714
  this.register(_.info.searchInfo(referrer));
10639
10715
  };
@@ -10916,6 +10992,7 @@ var NOOP_FUNC = function() {};
10916
10992
  /** @const */ var PRIMARY_INSTANCE_NAME = 'mixpanel';
10917
10993
  /** @const */ var PAYLOAD_TYPE_BASE64 = 'base64';
10918
10994
  /** @const */ var PAYLOAD_TYPE_JSON = 'json';
10995
+ /** @const */ var DEVICE_ID_PREFIX = '$device:';
10919
10996
 
10920
10997
 
10921
10998
  /*
@@ -10957,6 +11034,9 @@ var DEFAULT_CONFIG = {
10957
11034
  'cookie_domain': '',
10958
11035
  'cookie_name': '',
10959
11036
  'loaded': NOOP_FUNC,
11037
+ 'track_marketing': true,
11038
+ 'track_pageview': false,
11039
+ 'skip_first_touch_marketing': false,
10960
11040
  'store_google': true,
10961
11041
  'save_referrer': true,
10962
11042
  'test': false,
@@ -11023,6 +11103,25 @@ var create_mplib = function(token, config, name) {
11023
11103
  instance['people'] = new MixpanelPeople();
11024
11104
  instance['people']._init(instance);
11025
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
+
11026
11125
  // if any instance on the page has debug = true, we set the
11027
11126
  // global debug to be true
11028
11127
  Config.DEBUG = Config.DEBUG || instance.get_config('debug');
@@ -11054,7 +11153,7 @@ var create_mplib = function(token, config, name) {
11054
11153
  * mixpanel.library_name.track(...);
11055
11154
  *
11056
11155
  * @param {String} token Your Mixpanel API token
11057
- * @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>.
11058
11157
  * @param {String} [name] The name for the new mixpanel instance that you want created
11059
11158
  */
11060
11159
  MixpanelLib.prototype.init = function (token, config, name) {
@@ -11092,7 +11191,7 @@ MixpanelLib.prototype._init = function(token, config, name) {
11092
11191
  // default to JSON payload for standard mixpanel.com API hosts
11093
11192
  if (!('api_payload_format' in config)) {
11094
11193
  var api_host = config['api_host'] || DEFAULT_CONFIG['api_host'];
11095
- if (api_host.match(/\.mixpanel\.com$/)) {
11194
+ if (api_host.match(/\.mixpanel\.com/)) {
11096
11195
  variable_features['api_payload_format'] = PAYLOAD_TYPE_JSON;
11097
11196
  }
11098
11197
  }
@@ -11163,10 +11262,14 @@ MixpanelLib.prototype._init = function(token, config, name) {
11163
11262
  // or the device id if something was already stored
11164
11263
  // in the persitence
11165
11264
  this.register_once({
11166
- 'distinct_id': uuid,
11265
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
11167
11266
  '$device_id': uuid
11168
11267
  }, '');
11169
11268
  }
11269
+
11270
+ if (this.get_config('track_pageview')) {
11271
+ this.track_pageview();
11272
+ }
11170
11273
  };
11171
11274
 
11172
11275
  // Private methods
@@ -11180,7 +11283,7 @@ MixpanelLib.prototype._loaded = function() {
11180
11283
  MixpanelLib.prototype._set_default_superprops = function() {
11181
11284
  this['persistence'].update_search_keyword(document$1.referrer);
11182
11285
  if (this.get_config('store_google')) {
11183
- this['persistence'].update_campaign_params();
11286
+ this.register(_.info.campaignParams(), {persistent: false});
11184
11287
  }
11185
11288
  if (this.get_config('save_referrer')) {
11186
11289
  this['persistence'].update_referrer_info(document$1.referrer);
@@ -11662,6 +11765,10 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
11662
11765
 
11663
11766
  this._set_default_superprops();
11664
11767
 
11768
+ var marketing_properties = this.get_config('track_marketing')
11769
+ ? _.info.marketingParams()
11770
+ : {};
11771
+
11665
11772
  // note: extend writes to the first object, so lets make sure we
11666
11773
  // don't write to the persistence properties object and info
11667
11774
  // properties object by passing in a new object
@@ -11670,6 +11777,7 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
11670
11777
  properties = _.extend(
11671
11778
  {},
11672
11779
  _.info.properties(),
11780
+ marketing_properties,
11673
11781
  this['persistence'].properties(),
11674
11782
  this.unpersisted_superprops,
11675
11783
  properties
@@ -11830,17 +11938,54 @@ MixpanelLib.prototype.get_group = function (group_key, group_id) {
11830
11938
  };
11831
11939
 
11832
11940
  /**
11833
- * 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.
11834
11944
  *
11835
- * @param {String} [page] The url of the page to record. If you don't include this, it defaults to the current url.
11836
- * @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.
11837
11967
  */
11838
- MixpanelLib.prototype.track_pageview = function(page) {
11839
- if (_.isUndefined(page)) {
11840
- page = document$1.location.href;
11968
+ MixpanelLib.prototype.track_pageview = addOptOutCheckMixpanelLib(function(properties, options) {
11969
+ if (typeof properties !== 'object') {
11970
+ properties = {};
11841
11971
  }
11842
- this.track('mp_page_view', _.info.pageviewInfo(page));
11843
- };
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
+ });
11844
11989
 
11845
11990
  /**
11846
11991
  * Track clicks on a set of document elements. Selector must be a
@@ -12089,7 +12234,15 @@ MixpanelLib.prototype.identify = function(
12089
12234
  // _unset_callback:function A callback to be run if and when the People unset queue is flushed
12090
12235
 
12091
12236
  var previous_distinct_id = this.get_distinct_id();
12092
- 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
+ }
12093
12246
 
12094
12247
  if (!this.get_property('$device_id')) {
12095
12248
  // The persisted distinct id might not actually be a device id at all
@@ -12130,7 +12283,7 @@ MixpanelLib.prototype.reset = function() {
12130
12283
  this._flags.identify_called = false;
12131
12284
  var uuid = _.UUID();
12132
12285
  this.register_once({
12133
- 'distinct_id': uuid,
12286
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
12134
12287
  '$device_id': uuid
12135
12288
  }, '');
12136
12289
  };
@@ -12255,8 +12408,8 @@ MixpanelLib.prototype.name_tag = function(name_tag) {
12255
12408
  * // batching or retry mechanisms.
12256
12409
  * api_transport: 'XHR'
12257
12410
  *
12258
- * // turn on request-batching/queueing/retry
12259
- * batch_requests: false,
12411
+ * // request-batching/queueing/retry
12412
+ * batch_requests: true,
12260
12413
  *
12261
12414
  * // maximum number of events/updates to send in a single
12262
12415
  * // network request
@@ -12328,10 +12481,20 @@ MixpanelLib.prototype.name_tag = function(name_tag) {
12328
12481
  * // secure, meaning they will only be transmitted over https
12329
12482
  * secure_cookie: false
12330
12483
  *
12484
+ * // disables enriching user profiles with first touch marketing data
12485
+ * skip_first_touch_marketing: false
12486
+ *
12331
12487
  * // the amount of time track_links will
12332
12488
  * // wait for Mixpanel's servers to respond
12333
12489
  * track_links_timeout: 300
12334
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
+ *
12335
12498
  * // if you set upgrade to be true, the library will check for
12336
12499
  * // a cookie from our old js library and import super
12337
12500
  * // properties from it, then the old cookie is deleted
@@ -14006,21 +14169,22 @@ const renderInQueue = (fn) => {
14006
14169
  /**
14007
14170
  * Imports TML representation of the metadata objects into ThoughtSpot.
14008
14171
  * @param data
14172
+ * @returns imports TML data into ThoughtSpot
14009
14173
  * @example
14010
14174
  * ```js
14011
- * executeTML({
14012
- * //Array of metadata Tmls
14013
- metadata_tmls: [
14014
- "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
14015
- \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
14016
- ],
14017
- import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
14018
- create_new: false, // If selected, creates TML objects with new GUIDs.
14019
- }).then(result => {
14020
- console.log(result);
14021
- }).catch(error => {
14022
- console.error(error);
14023
- });
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
+ * });
14024
14188
  *```
14025
14189
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
14026
14190
  * @group Global methods
@@ -14062,27 +14226,28 @@ const executeTML = async (data) => {
14062
14226
  * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
14063
14227
  * format.
14064
14228
  * @param data
14229
+ * @returns exports TML data
14065
14230
  * @example
14066
14231
  * ```js
14067
- exportTML({
14068
- metadata: [
14069
- {
14070
- type: "LIVEBOARD", //Metadata Type
14071
- identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
14072
- }
14073
- ],
14074
- export_associated: false,//indicates whether to export associated metadata objects
14075
- export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
14076
- //exporting a Liveboard and its associated objects, the API
14077
- //returns the Liveboard TML data with the FQNs of the referenced
14078
- //worksheet. If the exported TML data includes FQNs, you don't need
14079
- //to manually add FQNs of the referenced objects during TML import.
14080
- edoc_format: "JSON" //It takes JSON or YAML value
14081
- }).then(result => {
14082
- console.log(result);
14083
- }).catch(error => {
14084
- console.error(error);
14085
- });
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
+ * });
14086
14251
  * ```
14087
14252
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
14088
14253
  * @group Global methods
@@ -14278,7 +14443,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
14278
14443
  });
14279
14444
  }
14280
14445
 
14281
- var name="@thoughtspot/visual-embed-sdk";var version="1.32.6";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};
14282
14447
 
14283
14448
  /**
14284
14449
  * Copyright (c) 2022