@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
package/dist/tsembed.js CHANGED
@@ -1461,15 +1461,20 @@
1461
1461
  * Prerequisite: Set isOnBeforeGetVizDataInterceptEnabled : true
1462
1462
  * for this embed event to get emitted.
1463
1463
  *
1464
- * Parameter: payload
1465
- * Parameter: responder
1464
+ * @param: payload
1465
+ * @param: responder
1466
1466
  * Contains elements that lets developers define whether ThoughtSpot
1467
1467
  * will run the search or not, and if not, which error message to provide.
1468
+ *
1468
1469
  * execute: When execute returns true, the search will be run.
1469
1470
  * When execute returns false, the search will not be executed.
1471
+ *
1470
1472
  * error: Developers can customize the user facing message when execute is
1471
1473
  * set to false using the error parameter in responder
1472
1474
  *
1475
+ * @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
1476
+ *
1477
+ * @example
1473
1478
  *```js
1474
1479
  * .on(EmbedEvent.OnBeforeGetVizDataIntercept,
1475
1480
  * (payload, responder) => {
@@ -1505,8 +1510,6 @@
1505
1510
  * }})
1506
1511
  * })
1507
1512
  *```
1508
- *
1509
- * @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
1510
1513
  */
1511
1514
  EmbedEvent["OnBeforeGetVizDataIntercept"] = "onBeforeGetVizDataIntercept";
1512
1515
  /**
@@ -6098,7 +6101,11 @@
6098
6101
  const tokenizedFetch = async (input, init) => {
6099
6102
  const embedConfig = getEmbedConfig();
6100
6103
  if (embedConfig.authType !== exports.AuthType.TrustedAuthTokenCookieless) {
6101
- return fetch(input, init);
6104
+ return fetch(input, {
6105
+ // ensure cookies are included for the non cookie-less api calls.
6106
+ credentials: 'include',
6107
+ ...init,
6108
+ });
6102
6109
  }
6103
6110
  const req = new Request(input, init);
6104
6111
  const authToken = await getAuthenticationToken(embedConfig);
@@ -6765,7 +6772,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
6765
6772
 
6766
6773
  var Config = {
6767
6774
  DEBUG: false,
6768
- LIB_VERSION: '2.45.0'
6775
+ LIB_VERSION: '2.47.0'
6769
6776
  };
6770
6777
 
6771
6778
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
@@ -7595,20 +7602,24 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
7595
7602
 
7596
7603
  _.UUID = (function() {
7597
7604
 
7598
- // Time/ticks information
7599
- // 1*new Date() is a cross browser version of Date.now()
7605
+ // Time-based entropy
7600
7606
  var T = function() {
7601
- var d = 1 * new Date(),
7602
- i = 0;
7603
-
7604
- // this while loop figures how many browser ticks go by
7605
- // before 1*new Date() returns a new number, ie the amount
7606
- // of ticks that go by per millisecond
7607
- while (d == 1 * new Date()) {
7608
- i++;
7607
+ var time = 1 * new Date(); // cross-browser version of Date.now()
7608
+ var ticks;
7609
+ if (window$1.performance && window$1.performance.now) {
7610
+ ticks = window$1.performance.now();
7611
+ } else {
7612
+ // fall back to busy loop
7613
+ ticks = 0;
7614
+
7615
+ // this while loop figures how many browser ticks go by
7616
+ // before 1*new Date() returns a new number, ie the amount
7617
+ // of ticks that go by per millisecond
7618
+ while (time == 1 * new Date()) {
7619
+ ticks++;
7620
+ }
7609
7621
  }
7610
-
7611
- return d.toString(16) + i.toString(16);
7622
+ return time.toString(16) + Math.floor(ticks).toString(16);
7612
7623
  };
7613
7624
 
7614
7625
  // Math.Random entropy
@@ -8175,21 +8186,42 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
8175
8186
  };
8176
8187
  })();
8177
8188
 
8189
+ var CAMPAIGN_KEYWORDS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'];
8190
+ var CLICK_IDS = ['dclid', 'fbclid', 'gclid', 'ko_click_id', 'li_fat_id', 'msclkid', 'ttclid', 'twclid', 'wbraid'];
8191
+
8178
8192
  _.info = {
8179
- campaignParams: function() {
8180
- var campaign_keywords = 'utm_source utm_medium utm_campaign utm_content utm_term'.split(' '),
8181
- kw = '',
8193
+ campaignParams: function(default_value) {
8194
+ var kw = '',
8182
8195
  params = {};
8183
- _.each(campaign_keywords, function(kwkey) {
8196
+ _.each(CAMPAIGN_KEYWORDS, function(kwkey) {
8184
8197
  kw = _.getQueryParam(document$1.URL, kwkey);
8185
8198
  if (kw.length) {
8186
8199
  params[kwkey] = kw;
8200
+ } else if (default_value !== undefined) {
8201
+ params[kwkey] = default_value;
8202
+ }
8203
+ });
8204
+
8205
+ return params;
8206
+ },
8207
+
8208
+ clickParams: function() {
8209
+ var id = '',
8210
+ params = {};
8211
+ _.each(CLICK_IDS, function(idkey) {
8212
+ id = _.getQueryParam(document$1.URL, idkey);
8213
+ if (id.length) {
8214
+ params[idkey] = id;
8187
8215
  }
8188
8216
  });
8189
8217
 
8190
8218
  return params;
8191
8219
  },
8192
8220
 
8221
+ marketingParams: function() {
8222
+ return _.extend(_.info.campaignParams(), _.info.clickParams());
8223
+ },
8224
+
8193
8225
  searchEngine: function(referrer) {
8194
8226
  if (referrer.search('https?://(.*)google.([^/?]*)') === 0) {
8195
8227
  return 'google';
@@ -8386,12 +8418,13 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
8386
8418
  });
8387
8419
  },
8388
8420
 
8389
- pageviewInfo: function(page) {
8421
+ mpPageViewProperties: function() {
8390
8422
  return _.strip_empty_properties({
8391
- 'mp_page': page,
8392
- 'mp_referrer': document$1.referrer,
8393
- 'mp_browser': _.info.browser(userAgent, navigator.vendor, windowOpera),
8394
- 'mp_platform': _.info.os()
8423
+ 'current_page_title': document$1.title,
8424
+ 'current_domain': window$1.location.hostname,
8425
+ 'current_url_path': window$1.location.pathname,
8426
+ 'current_url_protocol': window$1.location.protocol,
8427
+ 'current_url_search': window$1.location.search
8395
8428
  });
8396
8429
  }
8397
8430
  };
@@ -9058,6 +9091,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
9058
9091
 
9059
9092
  this.stopped = !this.libConfig['batch_autostart'];
9060
9093
  this.consecutiveRemovalFailures = 0;
9094
+
9095
+ // extra client-side dedupe
9096
+ this.itemIdsSentSuccessfully = {};
9061
9097
  };
9062
9098
 
9063
9099
  /**
@@ -9150,7 +9186,34 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
9150
9186
  payload = this.beforeSendHook(payload);
9151
9187
  }
9152
9188
  if (payload) {
9153
- dataForRequest.push(payload);
9189
+ // mp_sent_by_lib_version prop captures which lib version actually
9190
+ // sends each event (regardless of which version originally queued
9191
+ // it for sending)
9192
+ if (payload['event'] && payload['properties']) {
9193
+ payload['properties'] = _.extend(
9194
+ {},
9195
+ payload['properties'],
9196
+ {'mp_sent_by_lib_version': Config.LIB_VERSION}
9197
+ );
9198
+ }
9199
+ var addPayload = true;
9200
+ var itemId = item['id'];
9201
+ if (itemId) {
9202
+ if ((this.itemIdsSentSuccessfully[itemId] || 0) > 5) {
9203
+ this.reportError('[dupe] item ID sent too many times, not sending', {
9204
+ item: item,
9205
+ batchSize: batch.length,
9206
+ timesSent: this.itemIdsSentSuccessfully[itemId]
9207
+ });
9208
+ addPayload = false;
9209
+ }
9210
+ } else {
9211
+ this.reportError('[dupe] found item with no ID', {item: item});
9212
+ }
9213
+
9214
+ if (addPayload) {
9215
+ dataForRequest.push(payload);
9216
+ }
9154
9217
  }
9155
9218
  transformedItems[item['id']] = payload;
9156
9219
  }, this);
@@ -9233,6 +9296,24 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
9233
9296
  }
9234
9297
  }, this)
9235
9298
  );
9299
+
9300
+ // client-side dedupe
9301
+ _.each(batch, _.bind(function(item) {
9302
+ var itemId = item['id'];
9303
+ if (itemId) {
9304
+ this.itemIdsSentSuccessfully[itemId] = this.itemIdsSentSuccessfully[itemId] || 0;
9305
+ this.itemIdsSentSuccessfully[itemId]++;
9306
+ if (this.itemIdsSentSuccessfully[itemId] > 5) {
9307
+ this.reportError('[dupe] item ID sent too many times', {
9308
+ item: item,
9309
+ batchSize: batch.length,
9310
+ timesSent: this.itemIdsSentSuccessfully[itemId]
9311
+ });
9312
+ }
9313
+ } else {
9314
+ this.reportError('[dupe] found item with no ID while removing', {item: item});
9315
+ }
9316
+ }, this));
9236
9317
  }
9237
9318
 
9238
9319
  } catch(err) {
@@ -10078,24 +10159,25 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10078
10159
  });
10079
10160
 
10080
10161
  /*
10081
- * Record that you have charged the current user a certain amount
10082
- * of money. Charges recorded with track_charge() will appear in the
10083
- * Mixpanel revenue report.
10084
- *
10085
- * ### Usage:
10086
- *
10087
- * // charge a user $50
10088
- * mixpanel.people.track_charge(50);
10089
- *
10090
- * // charge a user $30.50 on the 2nd of january
10091
- * mixpanel.people.track_charge(30.50, {
10092
- * '$time': new Date('jan 1 2012')
10093
- * });
10094
- *
10095
- * @param {Number} amount The amount of money charged to the current user
10096
- * @param {Object} [properties] An associative array of properties associated with the charge
10097
- * @param {Function} [callback] If provided, the callback will be called when the server responds
10098
- */
10162
+ * Record that you have charged the current user a certain amount
10163
+ * of money. Charges recorded with track_charge() will appear in the
10164
+ * Mixpanel revenue report.
10165
+ *
10166
+ * ### Usage:
10167
+ *
10168
+ * // charge a user $50
10169
+ * mixpanel.people.track_charge(50);
10170
+ *
10171
+ * // charge a user $30.50 on the 2nd of january
10172
+ * mixpanel.people.track_charge(30.50, {
10173
+ * '$time': new Date('jan 1 2012')
10174
+ * });
10175
+ *
10176
+ * @param {Number} amount The amount of money charged to the current user
10177
+ * @param {Object} [properties] An associative array of properties associated with the charge
10178
+ * @param {Function} [callback] If provided, the callback will be called when the server responds
10179
+ * @deprecated
10180
+ */
10099
10181
  MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(amount, properties, callback) {
10100
10182
  if (!_.isNumber(amount)) {
10101
10183
  amount = parseFloat(amount);
@@ -10111,15 +10193,16 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10111
10193
  });
10112
10194
 
10113
10195
  /*
10114
- * Permanently clear all revenue report transactions from the
10115
- * current user's people analytics profile.
10116
- *
10117
- * ### Usage:
10118
- *
10119
- * mixpanel.people.clear_charges();
10120
- *
10121
- * @param {Function} [callback] If provided, the callback will be called after tracking the event.
10122
- */
10196
+ * Permanently clear all revenue report transactions from the
10197
+ * current user's people analytics profile.
10198
+ *
10199
+ * ### Usage:
10200
+ *
10201
+ * mixpanel.people.clear_charges();
10202
+ *
10203
+ * @param {Function} [callback] If provided, the callback will be called after tracking the event.
10204
+ * @deprecated
10205
+ */
10123
10206
  MixpanelPeople.prototype.clear_charges = function(callback) {
10124
10207
  return this.set('$transactions', [], callback);
10125
10208
  };
@@ -10519,13 +10602,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10519
10602
  }
10520
10603
  };
10521
10604
 
10522
- MixpanelPersistence.prototype.update_campaign_params = function() {
10523
- if (!this.campaign_params_saved) {
10524
- this.register_once(_.info.campaignParams());
10525
- this.campaign_params_saved = true;
10526
- }
10527
- };
10528
-
10529
10605
  MixpanelPersistence.prototype.update_search_keyword = function(referrer) {
10530
10606
  this.register(_.info.searchInfo(referrer));
10531
10607
  };
@@ -10808,6 +10884,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10808
10884
  /** @const */ var PRIMARY_INSTANCE_NAME = 'mixpanel';
10809
10885
  /** @const */ var PAYLOAD_TYPE_BASE64 = 'base64';
10810
10886
  /** @const */ var PAYLOAD_TYPE_JSON = 'json';
10887
+ /** @const */ var DEVICE_ID_PREFIX = '$device:';
10811
10888
 
10812
10889
 
10813
10890
  /*
@@ -10849,6 +10926,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10849
10926
  'cookie_domain': '',
10850
10927
  'cookie_name': '',
10851
10928
  'loaded': NOOP_FUNC,
10929
+ 'track_marketing': true,
10930
+ 'track_pageview': false,
10931
+ 'skip_first_touch_marketing': false,
10852
10932
  'store_google': true,
10853
10933
  'save_referrer': true,
10854
10934
  'test': false,
@@ -10915,6 +10995,25 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10915
10995
  instance['people'] = new MixpanelPeople();
10916
10996
  instance['people']._init(instance);
10917
10997
 
10998
+ if (!instance.get_config('skip_first_touch_marketing')) {
10999
+ // We need null UTM params in the object because
11000
+ // UTM parameters act as a tuple. If any UTM param
11001
+ // is present, then we set all UTM params including
11002
+ // empty ones together
11003
+ var utm_params = _.info.campaignParams(null);
11004
+ var initial_utm_params = {};
11005
+ var has_utm = false;
11006
+ _.each(utm_params, function(utm_value, utm_key) {
11007
+ initial_utm_params['initial_' + utm_key] = utm_value;
11008
+ if (utm_value) {
11009
+ has_utm = true;
11010
+ }
11011
+ });
11012
+ if (has_utm) {
11013
+ instance['people'].set_once(initial_utm_params);
11014
+ }
11015
+ }
11016
+
10918
11017
  // if any instance on the page has debug = true, we set the
10919
11018
  // global debug to be true
10920
11019
  Config.DEBUG = Config.DEBUG || instance.get_config('debug');
@@ -10946,7 +11045,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10946
11045
  * mixpanel.library_name.track(...);
10947
11046
  *
10948
11047
  * @param {String} token Your Mixpanel API token
10949
- * @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>.
11048
+ * @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>.
10950
11049
  * @param {String} [name] The name for the new mixpanel instance that you want created
10951
11050
  */
10952
11051
  MixpanelLib.prototype.init = function (token, config, name) {
@@ -10984,7 +11083,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10984
11083
  // default to JSON payload for standard mixpanel.com API hosts
10985
11084
  if (!('api_payload_format' in config)) {
10986
11085
  var api_host = config['api_host'] || DEFAULT_CONFIG['api_host'];
10987
- if (api_host.match(/\.mixpanel\.com$/)) {
11086
+ if (api_host.match(/\.mixpanel\.com/)) {
10988
11087
  variable_features['api_payload_format'] = PAYLOAD_TYPE_JSON;
10989
11088
  }
10990
11089
  }
@@ -11055,10 +11154,14 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11055
11154
  // or the device id if something was already stored
11056
11155
  // in the persitence
11057
11156
  this.register_once({
11058
- 'distinct_id': uuid,
11157
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
11059
11158
  '$device_id': uuid
11060
11159
  }, '');
11061
11160
  }
11161
+
11162
+ if (this.get_config('track_pageview')) {
11163
+ this.track_pageview();
11164
+ }
11062
11165
  };
11063
11166
 
11064
11167
  // Private methods
@@ -11072,7 +11175,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11072
11175
  MixpanelLib.prototype._set_default_superprops = function() {
11073
11176
  this['persistence'].update_search_keyword(document$1.referrer);
11074
11177
  if (this.get_config('store_google')) {
11075
- this['persistence'].update_campaign_params();
11178
+ this.register(_.info.campaignParams(), {persistent: false});
11076
11179
  }
11077
11180
  if (this.get_config('save_referrer')) {
11078
11181
  this['persistence'].update_referrer_info(document$1.referrer);
@@ -11554,6 +11657,10 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11554
11657
 
11555
11658
  this._set_default_superprops();
11556
11659
 
11660
+ var marketing_properties = this.get_config('track_marketing')
11661
+ ? _.info.marketingParams()
11662
+ : {};
11663
+
11557
11664
  // note: extend writes to the first object, so lets make sure we
11558
11665
  // don't write to the persistence properties object and info
11559
11666
  // properties object by passing in a new object
@@ -11562,6 +11669,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11562
11669
  properties = _.extend(
11563
11670
  {},
11564
11671
  _.info.properties(),
11672
+ marketing_properties,
11565
11673
  this['persistence'].properties(),
11566
11674
  this.unpersisted_superprops,
11567
11675
  properties
@@ -11722,17 +11830,54 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11722
11830
  };
11723
11831
 
11724
11832
  /**
11725
- * Track mp_page_view event. This is now ignored by the server.
11833
+ * Track a default Mixpanel page view event, which includes extra default event properties to
11834
+ * improve page view data. The `config.track_pageview` option for <a href="#mixpanelinit">mixpanel.init()</a>
11835
+ * may be turned on for tracking page loads automatically.
11726
11836
  *
11727
- * @param {String} [page] The url of the page to record. If you don't include this, it defaults to the current url.
11728
- * @deprecated
11837
+ * ### Usage
11838
+ *
11839
+ * // track a default $mp_web_page_view event
11840
+ * mixpanel.track_pageview();
11841
+ *
11842
+ * // track a page view event with additional event properties
11843
+ * mixpanel.track_pageview({'ab_test_variant': 'card-layout-b'});
11844
+ *
11845
+ * // example approach to track page views on different page types as event properties
11846
+ * mixpanel.track_pageview({'page': 'pricing'});
11847
+ * mixpanel.track_pageview({'page': 'homepage'});
11848
+ *
11849
+ * // UNCOMMON: Tracking a page view event with a custom event_name option. NOT expected to be used for
11850
+ * // individual pages on the same site or product. Use cases for custom event_name may be page
11851
+ * // views on different products or internal applications that are considered completely separate
11852
+ * mixpanel.track_pageview({'page': 'customer-search'}, {'event_name': '[internal] Admin Page View'});
11853
+ *
11854
+ * @param {Object} [properties] An optional set of additional properties to send with the page view event
11855
+ * @param {Object} [options] Page view tracking options
11856
+ * @param {String} [options.event_name] - Alternate name for the tracking event
11857
+ * @returns {Boolean|Object} If the tracking request was successfully initiated/queued, an object
11858
+ * with the tracking payload sent to the API server is returned; otherwise false.
11729
11859
  */
11730
- MixpanelLib.prototype.track_pageview = function(page) {
11731
- if (_.isUndefined(page)) {
11732
- page = document$1.location.href;
11860
+ MixpanelLib.prototype.track_pageview = addOptOutCheckMixpanelLib(function(properties, options) {
11861
+ if (typeof properties !== 'object') {
11862
+ properties = {};
11733
11863
  }
11734
- this.track('mp_page_view', _.info.pageviewInfo(page));
11735
- };
11864
+ options = options || {};
11865
+ var event_name = options['event_name'] || '$mp_web_page_view';
11866
+
11867
+ var default_page_properties = _.extend(
11868
+ _.info.mpPageViewProperties(),
11869
+ _.info.campaignParams(),
11870
+ _.info.clickParams()
11871
+ );
11872
+
11873
+ var event_properties = _.extend(
11874
+ {},
11875
+ default_page_properties,
11876
+ properties
11877
+ );
11878
+
11879
+ return this.track(event_name, event_properties);
11880
+ });
11736
11881
 
11737
11882
  /**
11738
11883
  * Track clicks on a set of document elements. Selector must be a
@@ -11981,7 +12126,15 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11981
12126
  // _unset_callback:function A callback to be run if and when the People unset queue is flushed
11982
12127
 
11983
12128
  var previous_distinct_id = this.get_distinct_id();
11984
- this.register({'$user_id': new_distinct_id});
12129
+ if (new_distinct_id && previous_distinct_id !== new_distinct_id) {
12130
+ // we allow the following condition if previous distinct_id is same as new_distinct_id
12131
+ // so that you can force flush people updates for anonymous profiles.
12132
+ if (typeof new_distinct_id === 'string' && new_distinct_id.indexOf(DEVICE_ID_PREFIX) === 0) {
12133
+ this.report_error('distinct_id cannot have $device: prefix');
12134
+ return -1;
12135
+ }
12136
+ this.register({'$user_id': new_distinct_id});
12137
+ }
11985
12138
 
11986
12139
  if (!this.get_property('$device_id')) {
11987
12140
  // The persisted distinct id might not actually be a device id at all
@@ -12022,7 +12175,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12022
12175
  this._flags.identify_called = false;
12023
12176
  var uuid = _.UUID();
12024
12177
  this.register_once({
12025
- 'distinct_id': uuid,
12178
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
12026
12179
  '$device_id': uuid
12027
12180
  }, '');
12028
12181
  };
@@ -12147,8 +12300,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12147
12300
  * // batching or retry mechanisms.
12148
12301
  * api_transport: 'XHR'
12149
12302
  *
12150
- * // turn on request-batching/queueing/retry
12151
- * batch_requests: false,
12303
+ * // request-batching/queueing/retry
12304
+ * batch_requests: true,
12152
12305
  *
12153
12306
  * // maximum number of events/updates to send in a single
12154
12307
  * // network request
@@ -12220,10 +12373,20 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12220
12373
  * // secure, meaning they will only be transmitted over https
12221
12374
  * secure_cookie: false
12222
12375
  *
12376
+ * // disables enriching user profiles with first touch marketing data
12377
+ * skip_first_touch_marketing: false
12378
+ *
12223
12379
  * // the amount of time track_links will
12224
12380
  * // wait for Mixpanel's servers to respond
12225
12381
  * track_links_timeout: 300
12226
12382
  *
12383
+ * // adds any UTM parameters and click IDs present on the page to any events fired
12384
+ * track_marketing: true
12385
+ *
12386
+ * // enables automatic page view tracking using default page view events through
12387
+ * // the track_pageview() method
12388
+ * track_pageview: false
12389
+ *
12227
12390
  * // if you set upgrade to be true, the library will check for
12228
12391
  * // a cookie from our old js library and import super
12229
12392
  * // properties from it, then the old cookie is deleted
@@ -13882,21 +14045,22 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
13882
14045
  /**
13883
14046
  * Imports TML representation of the metadata objects into ThoughtSpot.
13884
14047
  * @param data
14048
+ * @returns imports TML data into ThoughtSpot
13885
14049
  * @example
13886
14050
  * ```js
13887
- * executeTML({
13888
- * //Array of metadata Tmls
13889
- metadata_tmls: [
13890
- "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
13891
- \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
13892
- ],
13893
- import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
13894
- create_new: false, // If selected, creates TML objects with new GUIDs.
13895
- }).then(result => {
13896
- console.log(result);
13897
- }).catch(error => {
13898
- console.error(error);
13899
- });
14051
+ * executeTML({
14052
+ * //Array of metadata Tmls in string format
14053
+ * metadata_tmls: [
14054
+ * "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
14055
+ * \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
14056
+ * ],
14057
+ * import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
14058
+ * create_new: false, // If selected, creates TML objects with new GUIDs.
14059
+ * }).then(result => {
14060
+ * console.log(result);
14061
+ * }).catch(error => {
14062
+ * console.error(error);
14063
+ * });
13900
14064
  *```
13901
14065
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
13902
14066
  * @group Global methods
@@ -13938,27 +14102,28 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
13938
14102
  * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
13939
14103
  * format.
13940
14104
  * @param data
14105
+ * @returns exports TML data
13941
14106
  * @example
13942
14107
  * ```js
13943
- exportTML({
13944
- metadata: [
13945
- {
13946
- type: "LIVEBOARD", //Metadata Type
13947
- identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
13948
- }
13949
- ],
13950
- export_associated: false,//indicates whether to export associated metadata objects
13951
- export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
13952
- //exporting a Liveboard and its associated objects, the API
13953
- //returns the Liveboard TML data with the FQNs of the referenced
13954
- //worksheet. If the exported TML data includes FQNs, you don't need
13955
- //to manually add FQNs of the referenced objects during TML import.
13956
- edoc_format: "JSON" //It takes JSON or YAML value
13957
- }).then(result => {
13958
- console.log(result);
13959
- }).catch(error => {
13960
- console.error(error);
13961
- });
14108
+ * exportTML({
14109
+ * metadata: [
14110
+ * {
14111
+ * type: "LIVEBOARD", //Metadata Type
14112
+ * identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
14113
+ * }
14114
+ * ],
14115
+ * export_associated: false,//indicates whether to export associated metadata objects
14116
+ * export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
14117
+ * //exporting a Liveboard and its associated objects, the API
14118
+ * //returns the Liveboard TML data with the FQNs of the referenced
14119
+ * //worksheet. If the exported TML data includes FQNs, you don't need
14120
+ * //to manually add FQNs of the referenced objects during TML import.
14121
+ * edoc_format: "JSON" //It takes JSON or YAML value
14122
+ * }).then(result => {
14123
+ * console.log(result);
14124
+ * }).catch(error => {
14125
+ * console.error(error);
14126
+ * });
13962
14127
  * ```
13963
14128
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
13964
14129
  * @group Global methods
@@ -14154,7 +14319,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
14154
14319
  });
14155
14320
  }
14156
14321
 
14157
- 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$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};
14322
+ 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};
14158
14323
 
14159
14324
  /**
14160
14325
  * Copyright (c) 2022