@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
package/dist/tsembed.js CHANGED
@@ -1461,8 +1461,8 @@
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
  *
@@ -1474,6 +1474,7 @@
1474
1474
  *
1475
1475
  * @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
1476
1476
  *
1477
+ * @example
1477
1478
  *```js
1478
1479
  * .on(EmbedEvent.OnBeforeGetVizDataIntercept,
1479
1480
  * (payload, responder) => {
@@ -1509,7 +1510,6 @@
1509
1510
  * }})
1510
1511
  * })
1511
1512
  *```
1512
- *
1513
1513
  */
1514
1514
  EmbedEvent["OnBeforeGetVizDataIntercept"] = "onBeforeGetVizDataIntercept";
1515
1515
  /**
@@ -6101,7 +6101,11 @@
6101
6101
  const tokenizedFetch = async (input, init) => {
6102
6102
  const embedConfig = getEmbedConfig();
6103
6103
  if (embedConfig.authType !== exports.AuthType.TrustedAuthTokenCookieless) {
6104
- 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
+ });
6105
6109
  }
6106
6110
  const req = new Request(input, init);
6107
6111
  const authToken = await getAuthenticationToken(embedConfig);
@@ -6768,7 +6772,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
6768
6772
 
6769
6773
  var Config = {
6770
6774
  DEBUG: false,
6771
- LIB_VERSION: '2.45.0'
6775
+ LIB_VERSION: '2.47.0'
6772
6776
  };
6773
6777
 
6774
6778
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
@@ -7598,20 +7602,24 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
7598
7602
 
7599
7603
  _.UUID = (function() {
7600
7604
 
7601
- // Time/ticks information
7602
- // 1*new Date() is a cross browser version of Date.now()
7605
+ // Time-based entropy
7603
7606
  var T = function() {
7604
- var d = 1 * new Date(),
7605
- i = 0;
7606
-
7607
- // this while loop figures how many browser ticks go by
7608
- // before 1*new Date() returns a new number, ie the amount
7609
- // of ticks that go by per millisecond
7610
- while (d == 1 * new Date()) {
7611
- 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
+ }
7612
7621
  }
7613
-
7614
- return d.toString(16) + i.toString(16);
7622
+ return time.toString(16) + Math.floor(ticks).toString(16);
7615
7623
  };
7616
7624
 
7617
7625
  // Math.Random entropy
@@ -8178,21 +8186,42 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
8178
8186
  };
8179
8187
  })();
8180
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
+
8181
8192
  _.info = {
8182
- campaignParams: function() {
8183
- var campaign_keywords = 'utm_source utm_medium utm_campaign utm_content utm_term'.split(' '),
8184
- kw = '',
8193
+ campaignParams: function(default_value) {
8194
+ var kw = '',
8185
8195
  params = {};
8186
- _.each(campaign_keywords, function(kwkey) {
8196
+ _.each(CAMPAIGN_KEYWORDS, function(kwkey) {
8187
8197
  kw = _.getQueryParam(document$1.URL, kwkey);
8188
8198
  if (kw.length) {
8189
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;
8190
8215
  }
8191
8216
  });
8192
8217
 
8193
8218
  return params;
8194
8219
  },
8195
8220
 
8221
+ marketingParams: function() {
8222
+ return _.extend(_.info.campaignParams(), _.info.clickParams());
8223
+ },
8224
+
8196
8225
  searchEngine: function(referrer) {
8197
8226
  if (referrer.search('https?://(.*)google.([^/?]*)') === 0) {
8198
8227
  return 'google';
@@ -8389,12 +8418,13 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
8389
8418
  });
8390
8419
  },
8391
8420
 
8392
- pageviewInfo: function(page) {
8421
+ mpPageViewProperties: function() {
8393
8422
  return _.strip_empty_properties({
8394
- 'mp_page': page,
8395
- 'mp_referrer': document$1.referrer,
8396
- 'mp_browser': _.info.browser(userAgent, navigator.vendor, windowOpera),
8397
- '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
8398
8428
  });
8399
8429
  }
8400
8430
  };
@@ -9061,6 +9091,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
9061
9091
 
9062
9092
  this.stopped = !this.libConfig['batch_autostart'];
9063
9093
  this.consecutiveRemovalFailures = 0;
9094
+
9095
+ // extra client-side dedupe
9096
+ this.itemIdsSentSuccessfully = {};
9064
9097
  };
9065
9098
 
9066
9099
  /**
@@ -9153,7 +9186,34 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
9153
9186
  payload = this.beforeSendHook(payload);
9154
9187
  }
9155
9188
  if (payload) {
9156
- 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
+ }
9157
9217
  }
9158
9218
  transformedItems[item['id']] = payload;
9159
9219
  }, this);
@@ -9236,6 +9296,24 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
9236
9296
  }
9237
9297
  }, this)
9238
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));
9239
9317
  }
9240
9318
 
9241
9319
  } catch(err) {
@@ -10081,24 +10159,25 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10081
10159
  });
10082
10160
 
10083
10161
  /*
10084
- * Record that you have charged the current user a certain amount
10085
- * of money. Charges recorded with track_charge() will appear in the
10086
- * Mixpanel revenue report.
10087
- *
10088
- * ### Usage:
10089
- *
10090
- * // charge a user $50
10091
- * mixpanel.people.track_charge(50);
10092
- *
10093
- * // charge a user $30.50 on the 2nd of january
10094
- * mixpanel.people.track_charge(30.50, {
10095
- * '$time': new Date('jan 1 2012')
10096
- * });
10097
- *
10098
- * @param {Number} amount The amount of money charged to the current user
10099
- * @param {Object} [properties] An associative array of properties associated with the charge
10100
- * @param {Function} [callback] If provided, the callback will be called when the server responds
10101
- */
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
+ */
10102
10181
  MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(amount, properties, callback) {
10103
10182
  if (!_.isNumber(amount)) {
10104
10183
  amount = parseFloat(amount);
@@ -10114,15 +10193,16 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10114
10193
  });
10115
10194
 
10116
10195
  /*
10117
- * Permanently clear all revenue report transactions from the
10118
- * current user's people analytics profile.
10119
- *
10120
- * ### Usage:
10121
- *
10122
- * mixpanel.people.clear_charges();
10123
- *
10124
- * @param {Function} [callback] If provided, the callback will be called after tracking the event.
10125
- */
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
+ */
10126
10206
  MixpanelPeople.prototype.clear_charges = function(callback) {
10127
10207
  return this.set('$transactions', [], callback);
10128
10208
  };
@@ -10522,13 +10602,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10522
10602
  }
10523
10603
  };
10524
10604
 
10525
- MixpanelPersistence.prototype.update_campaign_params = function() {
10526
- if (!this.campaign_params_saved) {
10527
- this.register_once(_.info.campaignParams());
10528
- this.campaign_params_saved = true;
10529
- }
10530
- };
10531
-
10532
10605
  MixpanelPersistence.prototype.update_search_keyword = function(referrer) {
10533
10606
  this.register(_.info.searchInfo(referrer));
10534
10607
  };
@@ -10811,6 +10884,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10811
10884
  /** @const */ var PRIMARY_INSTANCE_NAME = 'mixpanel';
10812
10885
  /** @const */ var PAYLOAD_TYPE_BASE64 = 'base64';
10813
10886
  /** @const */ var PAYLOAD_TYPE_JSON = 'json';
10887
+ /** @const */ var DEVICE_ID_PREFIX = '$device:';
10814
10888
 
10815
10889
 
10816
10890
  /*
@@ -10852,6 +10926,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10852
10926
  'cookie_domain': '',
10853
10927
  'cookie_name': '',
10854
10928
  'loaded': NOOP_FUNC,
10929
+ 'track_marketing': true,
10930
+ 'track_pageview': false,
10931
+ 'skip_first_touch_marketing': false,
10855
10932
  'store_google': true,
10856
10933
  'save_referrer': true,
10857
10934
  'test': false,
@@ -10918,6 +10995,25 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10918
10995
  instance['people'] = new MixpanelPeople();
10919
10996
  instance['people']._init(instance);
10920
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
+
10921
11017
  // if any instance on the page has debug = true, we set the
10922
11018
  // global debug to be true
10923
11019
  Config.DEBUG = Config.DEBUG || instance.get_config('debug');
@@ -10949,7 +11045,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10949
11045
  * mixpanel.library_name.track(...);
10950
11046
  *
10951
11047
  * @param {String} token Your Mixpanel API token
10952
- * @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>.
10953
11049
  * @param {String} [name] The name for the new mixpanel instance that you want created
10954
11050
  */
10955
11051
  MixpanelLib.prototype.init = function (token, config, name) {
@@ -10987,7 +11083,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10987
11083
  // default to JSON payload for standard mixpanel.com API hosts
10988
11084
  if (!('api_payload_format' in config)) {
10989
11085
  var api_host = config['api_host'] || DEFAULT_CONFIG['api_host'];
10990
- if (api_host.match(/\.mixpanel\.com$/)) {
11086
+ if (api_host.match(/\.mixpanel\.com/)) {
10991
11087
  variable_features['api_payload_format'] = PAYLOAD_TYPE_JSON;
10992
11088
  }
10993
11089
  }
@@ -11058,10 +11154,14 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11058
11154
  // or the device id if something was already stored
11059
11155
  // in the persitence
11060
11156
  this.register_once({
11061
- 'distinct_id': uuid,
11157
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
11062
11158
  '$device_id': uuid
11063
11159
  }, '');
11064
11160
  }
11161
+
11162
+ if (this.get_config('track_pageview')) {
11163
+ this.track_pageview();
11164
+ }
11065
11165
  };
11066
11166
 
11067
11167
  // Private methods
@@ -11075,7 +11175,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11075
11175
  MixpanelLib.prototype._set_default_superprops = function() {
11076
11176
  this['persistence'].update_search_keyword(document$1.referrer);
11077
11177
  if (this.get_config('store_google')) {
11078
- this['persistence'].update_campaign_params();
11178
+ this.register(_.info.campaignParams(), {persistent: false});
11079
11179
  }
11080
11180
  if (this.get_config('save_referrer')) {
11081
11181
  this['persistence'].update_referrer_info(document$1.referrer);
@@ -11557,6 +11657,10 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11557
11657
 
11558
11658
  this._set_default_superprops();
11559
11659
 
11660
+ var marketing_properties = this.get_config('track_marketing')
11661
+ ? _.info.marketingParams()
11662
+ : {};
11663
+
11560
11664
  // note: extend writes to the first object, so lets make sure we
11561
11665
  // don't write to the persistence properties object and info
11562
11666
  // properties object by passing in a new object
@@ -11565,6 +11669,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11565
11669
  properties = _.extend(
11566
11670
  {},
11567
11671
  _.info.properties(),
11672
+ marketing_properties,
11568
11673
  this['persistence'].properties(),
11569
11674
  this.unpersisted_superprops,
11570
11675
  properties
@@ -11725,17 +11830,54 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11725
11830
  };
11726
11831
 
11727
11832
  /**
11728
- * 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.
11729
11836
  *
11730
- * @param {String} [page] The url of the page to record. If you don't include this, it defaults to the current url.
11731
- * @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.
11732
11859
  */
11733
- MixpanelLib.prototype.track_pageview = function(page) {
11734
- if (_.isUndefined(page)) {
11735
- page = document$1.location.href;
11860
+ MixpanelLib.prototype.track_pageview = addOptOutCheckMixpanelLib(function(properties, options) {
11861
+ if (typeof properties !== 'object') {
11862
+ properties = {};
11736
11863
  }
11737
- this.track('mp_page_view', _.info.pageviewInfo(page));
11738
- };
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
+ });
11739
11881
 
11740
11882
  /**
11741
11883
  * Track clicks on a set of document elements. Selector must be a
@@ -11984,7 +12126,15 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11984
12126
  // _unset_callback:function A callback to be run if and when the People unset queue is flushed
11985
12127
 
11986
12128
  var previous_distinct_id = this.get_distinct_id();
11987
- 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
+ }
11988
12138
 
11989
12139
  if (!this.get_property('$device_id')) {
11990
12140
  // The persisted distinct id might not actually be a device id at all
@@ -12025,7 +12175,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12025
12175
  this._flags.identify_called = false;
12026
12176
  var uuid = _.UUID();
12027
12177
  this.register_once({
12028
- 'distinct_id': uuid,
12178
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
12029
12179
  '$device_id': uuid
12030
12180
  }, '');
12031
12181
  };
@@ -12150,8 +12300,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12150
12300
  * // batching or retry mechanisms.
12151
12301
  * api_transport: 'XHR'
12152
12302
  *
12153
- * // turn on request-batching/queueing/retry
12154
- * batch_requests: false,
12303
+ * // request-batching/queueing/retry
12304
+ * batch_requests: true,
12155
12305
  *
12156
12306
  * // maximum number of events/updates to send in a single
12157
12307
  * // network request
@@ -12223,10 +12373,20 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12223
12373
  * // secure, meaning they will only be transmitted over https
12224
12374
  * secure_cookie: false
12225
12375
  *
12376
+ * // disables enriching user profiles with first touch marketing data
12377
+ * skip_first_touch_marketing: false
12378
+ *
12226
12379
  * // the amount of time track_links will
12227
12380
  * // wait for Mixpanel's servers to respond
12228
12381
  * track_links_timeout: 300
12229
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
+ *
12230
12390
  * // if you set upgrade to be true, the library will check for
12231
12391
  * // a cookie from our old js library and import super
12232
12392
  * // properties from it, then the old cookie is deleted
@@ -13885,21 +14045,22 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
13885
14045
  /**
13886
14046
  * Imports TML representation of the metadata objects into ThoughtSpot.
13887
14047
  * @param data
14048
+ * @returns imports TML data into ThoughtSpot
13888
14049
  * @example
13889
14050
  * ```js
13890
- * executeTML({
13891
- * //Array of metadata Tmls
13892
- metadata_tmls: [
13893
- "'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
13894
- \"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
13895
- ],
13896
- import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
13897
- create_new: false, // If selected, creates TML objects with new GUIDs.
13898
- }).then(result => {
13899
- console.log(result);
13900
- }).catch(error => {
13901
- console.error(error);
13902
- });
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
+ * });
13903
14064
  *```
13904
14065
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
13905
14066
  * @group Global methods
@@ -13941,27 +14102,28 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
13941
14102
  * Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
13942
14103
  * format.
13943
14104
  * @param data
14105
+ * @returns exports TML data
13944
14106
  * @example
13945
14107
  * ```js
13946
- exportTML({
13947
- metadata: [
13948
- {
13949
- type: "LIVEBOARD", //Metadata Type
13950
- identifier: "9bd202f5-d431-44bf-9a07-b4f7be372125" //Metadata Id
13951
- }
13952
- ],
13953
- export_associated: false,//indicates whether to export associated metadata objects
13954
- export_fqn: false, //Adds FQNs of the referenced objects.For example, if you are
13955
- //exporting a Liveboard and its associated objects, the API
13956
- //returns the Liveboard TML data with the FQNs of the referenced
13957
- //worksheet. If the exported TML data includes FQNs, you don't need
13958
- //to manually add FQNs of the referenced objects during TML import.
13959
- edoc_format: "JSON" //It takes JSON or YAML value
13960
- }).then(result => {
13961
- console.log(result);
13962
- }).catch(error => {
13963
- console.error(error);
13964
- });
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
+ * });
13965
14127
  * ```
13966
14128
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
13967
14129
  * @group Global methods
@@ -14157,7 +14319,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
14157
14319
  });
14158
14320
  }
14159
14321
 
14160
- var name="@thoughtspot/visual-embed-sdk";var version="1.32.7";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^46.9.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/lodash":"^4.17.0","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^5.3.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"48 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
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};
14161
14323
 
14162
14324
  /**
14163
14325
  * Copyright (c) 2022