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