@thoughtspot/visual-embed-sdk 1.32.7 → 1.32.9

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 (61) 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 +40 -37
  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 +80 -8
  12. package/cjs/src/types.d.ts.map +1 -1
  13. package/cjs/src/types.js +76 -6
  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/cjs/src/utils.d.ts.map +1 -1
  18. package/cjs/src/utils.js +3 -1
  19. package/cjs/src/utils.js.map +1 -1
  20. package/dist/src/css-variables.d.ts +18 -3
  21. package/dist/src/css-variables.d.ts.map +1 -1
  22. package/dist/src/embed/base.d.ts +34 -32
  23. package/dist/src/embed/base.d.ts.map +1 -1
  24. package/dist/src/tokenizedFetch.d.ts.map +1 -1
  25. package/dist/src/types.d.ts +80 -8
  26. package/dist/src/types.d.ts.map +1 -1
  27. package/dist/src/utils.d.ts.map +1 -1
  28. package/dist/tsembed-react.es.js +314 -82
  29. package/dist/tsembed-react.js +257 -81
  30. package/dist/tsembed.es.js +354 -119
  31. package/dist/tsembed.js +297 -118
  32. package/dist/visual-embed-sdk-react-full.d.ts +132 -43
  33. package/dist/visual-embed-sdk-react.d.ts +132 -43
  34. package/dist/visual-embed-sdk.d.ts +132 -43
  35. package/lib/package.json +3 -3
  36. package/lib/src/css-variables.d.ts +18 -3
  37. package/lib/src/css-variables.d.ts.map +1 -1
  38. package/lib/src/embed/base.d.ts +34 -32
  39. package/lib/src/embed/base.d.ts.map +1 -1
  40. package/lib/src/embed/base.js +40 -37
  41. package/lib/src/embed/base.js.map +1 -1
  42. package/lib/src/tokenizedFetch.d.ts.map +1 -1
  43. package/lib/src/tokenizedFetch.js +5 -1
  44. package/lib/src/tokenizedFetch.js.map +1 -1
  45. package/lib/src/types.d.ts +80 -8
  46. package/lib/src/types.d.ts.map +1 -1
  47. package/lib/src/types.js +76 -6
  48. package/lib/src/types.js.map +1 -1
  49. package/lib/src/utils/authService/authService.spec.js +3 -1
  50. package/lib/src/utils/authService/authService.spec.js.map +1 -1
  51. package/lib/src/utils.d.ts.map +1 -1
  52. package/lib/src/utils.js +3 -1
  53. package/lib/src/utils.js.map +1 -1
  54. package/lib/src/visual-embed-sdk.d.ts +132 -43
  55. package/package.json +3 -3
  56. package/src/css-variables.ts +21 -3
  57. package/src/embed/base.ts +35 -32
  58. package/src/tokenizedFetch.ts +5 -1
  59. package/src/types.ts +80 -8
  60. package/src/utils/authService/authService.spec.ts +3 -1
  61. package/src/utils.ts +3 -0
@@ -321,7 +321,7 @@
321
321
  return false;
322
322
  };
323
323
  const getCustomisations = (embedConfig, viewConfig) => {
324
- var _a, _b;
324
+ var _a, _b, _c, _d;
325
325
  const customizationsFromViewConfig = viewConfig.customizations;
326
326
  const customizationsFromEmbedConfig = embedConfig.customizations
327
327
  || embedConfig.customisations;
@@ -333,6 +333,8 @@
333
333
  ...(_a = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _a === void 0 ? void 0 : _a.customCSS,
334
334
  ...(_b = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _b === void 0 ? void 0 : _b.customCSS,
335
335
  },
336
+ customCSSUrl: ((_c = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _c === void 0 ? void 0 : _c.customCSSUrl)
337
+ || ((_d = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _d === void 0 ? void 0 : _d.customCSSUrl),
336
338
  },
337
339
  content: {
338
340
  ...customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.content,
@@ -1584,8 +1586,8 @@
1584
1586
  * Prerequisite: Set isOnBeforeGetVizDataInterceptEnabled : true
1585
1587
  * for this embed event to get emitted.
1586
1588
  *
1587
- * Parameter: payload
1588
- * Parameter: responder
1589
+ * @param: payload
1590
+ * @param: responder
1589
1591
  * Contains elements that lets developers define whether ThoughtSpot
1590
1592
  * will run the search or not, and if not, which error message to provide.
1591
1593
  *
@@ -1597,6 +1599,7 @@
1597
1599
  *
1598
1600
  * @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
1599
1601
  *
1602
+ * @example
1600
1603
  *```js
1601
1604
  * .on(EmbedEvent.OnBeforeGetVizDataIntercept,
1602
1605
  * (payload, responder) => {
@@ -1632,7 +1635,6 @@
1632
1635
  * }})
1633
1636
  * })
1634
1637
  *```
1635
- *
1636
1638
  */
1637
1639
  EmbedEvent["OnBeforeGetVizDataIntercept"] = "onBeforeGetVizDataIntercept";
1638
1640
  /**
@@ -2339,11 +2341,24 @@
2339
2341
  * filter: {
2340
2342
  * column: "item type",
2341
2343
  * oper: "IN",
2342
- * values: ["bags","shirts"],
2344
+ * values: ["bags","shirts"]
2343
2345
  * }
2344
2346
  * });
2345
2347
  * ```
2346
2348
  * @example
2349
+ * ```js
2350
+ *
2351
+ * liveboardEmbed.trigger(HostEvent.UpdateFilters, {
2352
+ * filter: {
2353
+ * column: "date",
2354
+ * oper: "EQ",
2355
+ * values: ["JULY","2023"],
2356
+ * type: "MONTH_YEAR"
2357
+ * }
2358
+ * });
2359
+ * ```
2360
+ *
2361
+ * @example
2347
2362
  *
2348
2363
  * ```js
2349
2364
  * liveboardEmbed.trigger(HostEvent.UpdateFilters, {
@@ -2360,7 +2375,8 @@
2360
2375
  * {
2361
2376
  * column: "Date",
2362
2377
  * oper: 'EQ',
2363
- * values: ["1656680400"]
2378
+ * values: ["2023-07-31"],
2379
+ * types: "EXACT_DATE"
2364
2380
  * }]
2365
2381
  * });
2366
2382
  * ```
@@ -6221,7 +6237,11 @@
6221
6237
  const tokenizedFetch = async (input, init) => {
6222
6238
  const embedConfig = getEmbedConfig();
6223
6239
  if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
6224
- return fetch(input, init);
6240
+ return fetch(input, {
6241
+ // ensure cookies are included for the non cookie-less api calls.
6242
+ credentials: 'include',
6243
+ ...init,
6244
+ });
6225
6245
  }
6226
6246
  const req = new Request(input, init);
6227
6247
  const authToken = await getAuthenticationToken(embedConfig);
@@ -6888,7 +6908,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
6888
6908
 
6889
6909
  var Config = {
6890
6910
  DEBUG: false,
6891
- LIB_VERSION: '2.45.0'
6911
+ LIB_VERSION: '2.47.0'
6892
6912
  };
6893
6913
 
6894
6914
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
@@ -7718,20 +7738,24 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
7718
7738
 
7719
7739
  _.UUID = (function() {
7720
7740
 
7721
- // Time/ticks information
7722
- // 1*new Date() is a cross browser version of Date.now()
7741
+ // Time-based entropy
7723
7742
  var T = function() {
7724
- var d = 1 * new Date(),
7725
- i = 0;
7726
-
7727
- // this while loop figures how many browser ticks go by
7728
- // before 1*new Date() returns a new number, ie the amount
7729
- // of ticks that go by per millisecond
7730
- while (d == 1 * new Date()) {
7731
- i++;
7743
+ var time = 1 * new Date(); // cross-browser version of Date.now()
7744
+ var ticks;
7745
+ if (window$1.performance && window$1.performance.now) {
7746
+ ticks = window$1.performance.now();
7747
+ } else {
7748
+ // fall back to busy loop
7749
+ ticks = 0;
7750
+
7751
+ // this while loop figures how many browser ticks go by
7752
+ // before 1*new Date() returns a new number, ie the amount
7753
+ // of ticks that go by per millisecond
7754
+ while (time == 1 * new Date()) {
7755
+ ticks++;
7756
+ }
7732
7757
  }
7733
-
7734
- return d.toString(16) + i.toString(16);
7758
+ return time.toString(16) + Math.floor(ticks).toString(16);
7735
7759
  };
7736
7760
 
7737
7761
  // Math.Random entropy
@@ -8298,21 +8322,42 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
8298
8322
  };
8299
8323
  })();
8300
8324
 
8325
+ var CAMPAIGN_KEYWORDS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'];
8326
+ var CLICK_IDS = ['dclid', 'fbclid', 'gclid', 'ko_click_id', 'li_fat_id', 'msclkid', 'ttclid', 'twclid', 'wbraid'];
8327
+
8301
8328
  _.info = {
8302
- campaignParams: function() {
8303
- var campaign_keywords = 'utm_source utm_medium utm_campaign utm_content utm_term'.split(' '),
8304
- kw = '',
8329
+ campaignParams: function(default_value) {
8330
+ var kw = '',
8305
8331
  params = {};
8306
- _.each(campaign_keywords, function(kwkey) {
8332
+ _.each(CAMPAIGN_KEYWORDS, function(kwkey) {
8307
8333
  kw = _.getQueryParam(document$1.URL, kwkey);
8308
8334
  if (kw.length) {
8309
8335
  params[kwkey] = kw;
8336
+ } else if (default_value !== undefined) {
8337
+ params[kwkey] = default_value;
8338
+ }
8339
+ });
8340
+
8341
+ return params;
8342
+ },
8343
+
8344
+ clickParams: function() {
8345
+ var id = '',
8346
+ params = {};
8347
+ _.each(CLICK_IDS, function(idkey) {
8348
+ id = _.getQueryParam(document$1.URL, idkey);
8349
+ if (id.length) {
8350
+ params[idkey] = id;
8310
8351
  }
8311
8352
  });
8312
8353
 
8313
8354
  return params;
8314
8355
  },
8315
8356
 
8357
+ marketingParams: function() {
8358
+ return _.extend(_.info.campaignParams(), _.info.clickParams());
8359
+ },
8360
+
8316
8361
  searchEngine: function(referrer) {
8317
8362
  if (referrer.search('https?://(.*)google.([^/?]*)') === 0) {
8318
8363
  return 'google';
@@ -8509,12 +8554,13 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
8509
8554
  });
8510
8555
  },
8511
8556
 
8512
- pageviewInfo: function(page) {
8557
+ mpPageViewProperties: function() {
8513
8558
  return _.strip_empty_properties({
8514
- 'mp_page': page,
8515
- 'mp_referrer': document$1.referrer,
8516
- 'mp_browser': _.info.browser(userAgent, navigator.vendor, windowOpera),
8517
- 'mp_platform': _.info.os()
8559
+ 'current_page_title': document$1.title,
8560
+ 'current_domain': window$1.location.hostname,
8561
+ 'current_url_path': window$1.location.pathname,
8562
+ 'current_url_protocol': window$1.location.protocol,
8563
+ 'current_url_search': window$1.location.search
8518
8564
  });
8519
8565
  }
8520
8566
  };
@@ -9181,6 +9227,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
9181
9227
 
9182
9228
  this.stopped = !this.libConfig['batch_autostart'];
9183
9229
  this.consecutiveRemovalFailures = 0;
9230
+
9231
+ // extra client-side dedupe
9232
+ this.itemIdsSentSuccessfully = {};
9184
9233
  };
9185
9234
 
9186
9235
  /**
@@ -9273,7 +9322,34 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
9273
9322
  payload = this.beforeSendHook(payload);
9274
9323
  }
9275
9324
  if (payload) {
9276
- dataForRequest.push(payload);
9325
+ // mp_sent_by_lib_version prop captures which lib version actually
9326
+ // sends each event (regardless of which version originally queued
9327
+ // it for sending)
9328
+ if (payload['event'] && payload['properties']) {
9329
+ payload['properties'] = _.extend(
9330
+ {},
9331
+ payload['properties'],
9332
+ {'mp_sent_by_lib_version': Config.LIB_VERSION}
9333
+ );
9334
+ }
9335
+ var addPayload = true;
9336
+ var itemId = item['id'];
9337
+ if (itemId) {
9338
+ if ((this.itemIdsSentSuccessfully[itemId] || 0) > 5) {
9339
+ this.reportError('[dupe] item ID sent too many times, not sending', {
9340
+ item: item,
9341
+ batchSize: batch.length,
9342
+ timesSent: this.itemIdsSentSuccessfully[itemId]
9343
+ });
9344
+ addPayload = false;
9345
+ }
9346
+ } else {
9347
+ this.reportError('[dupe] found item with no ID', {item: item});
9348
+ }
9349
+
9350
+ if (addPayload) {
9351
+ dataForRequest.push(payload);
9352
+ }
9277
9353
  }
9278
9354
  transformedItems[item['id']] = payload;
9279
9355
  }, this);
@@ -9356,6 +9432,24 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
9356
9432
  }
9357
9433
  }, this)
9358
9434
  );
9435
+
9436
+ // client-side dedupe
9437
+ _.each(batch, _.bind(function(item) {
9438
+ var itemId = item['id'];
9439
+ if (itemId) {
9440
+ this.itemIdsSentSuccessfully[itemId] = this.itemIdsSentSuccessfully[itemId] || 0;
9441
+ this.itemIdsSentSuccessfully[itemId]++;
9442
+ if (this.itemIdsSentSuccessfully[itemId] > 5) {
9443
+ this.reportError('[dupe] item ID sent too many times', {
9444
+ item: item,
9445
+ batchSize: batch.length,
9446
+ timesSent: this.itemIdsSentSuccessfully[itemId]
9447
+ });
9448
+ }
9449
+ } else {
9450
+ this.reportError('[dupe] found item with no ID while removing', {item: item});
9451
+ }
9452
+ }, this));
9359
9453
  }
9360
9454
 
9361
9455
  } catch(err) {
@@ -10201,24 +10295,25 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10201
10295
  });
10202
10296
 
10203
10297
  /*
10204
- * Record that you have charged the current user a certain amount
10205
- * of money. Charges recorded with track_charge() will appear in the
10206
- * Mixpanel revenue report.
10207
- *
10208
- * ### Usage:
10209
- *
10210
- * // charge a user $50
10211
- * mixpanel.people.track_charge(50);
10212
- *
10213
- * // charge a user $30.50 on the 2nd of january
10214
- * mixpanel.people.track_charge(30.50, {
10215
- * '$time': new Date('jan 1 2012')
10216
- * });
10217
- *
10218
- * @param {Number} amount The amount of money charged to the current user
10219
- * @param {Object} [properties] An associative array of properties associated with the charge
10220
- * @param {Function} [callback] If provided, the callback will be called when the server responds
10221
- */
10298
+ * Record that you have charged the current user a certain amount
10299
+ * of money. Charges recorded with track_charge() will appear in the
10300
+ * Mixpanel revenue report.
10301
+ *
10302
+ * ### Usage:
10303
+ *
10304
+ * // charge a user $50
10305
+ * mixpanel.people.track_charge(50);
10306
+ *
10307
+ * // charge a user $30.50 on the 2nd of january
10308
+ * mixpanel.people.track_charge(30.50, {
10309
+ * '$time': new Date('jan 1 2012')
10310
+ * });
10311
+ *
10312
+ * @param {Number} amount The amount of money charged to the current user
10313
+ * @param {Object} [properties] An associative array of properties associated with the charge
10314
+ * @param {Function} [callback] If provided, the callback will be called when the server responds
10315
+ * @deprecated
10316
+ */
10222
10317
  MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(amount, properties, callback) {
10223
10318
  if (!_.isNumber(amount)) {
10224
10319
  amount = parseFloat(amount);
@@ -10234,15 +10329,16 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10234
10329
  });
10235
10330
 
10236
10331
  /*
10237
- * Permanently clear all revenue report transactions from the
10238
- * current user's people analytics profile.
10239
- *
10240
- * ### Usage:
10241
- *
10242
- * mixpanel.people.clear_charges();
10243
- *
10244
- * @param {Function} [callback] If provided, the callback will be called after tracking the event.
10245
- */
10332
+ * Permanently clear all revenue report transactions from the
10333
+ * current user's people analytics profile.
10334
+ *
10335
+ * ### Usage:
10336
+ *
10337
+ * mixpanel.people.clear_charges();
10338
+ *
10339
+ * @param {Function} [callback] If provided, the callback will be called after tracking the event.
10340
+ * @deprecated
10341
+ */
10246
10342
  MixpanelPeople.prototype.clear_charges = function(callback) {
10247
10343
  return this.set('$transactions', [], callback);
10248
10344
  };
@@ -10642,13 +10738,6 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10642
10738
  }
10643
10739
  };
10644
10740
 
10645
- MixpanelPersistence.prototype.update_campaign_params = function() {
10646
- if (!this.campaign_params_saved) {
10647
- this.register_once(_.info.campaignParams());
10648
- this.campaign_params_saved = true;
10649
- }
10650
- };
10651
-
10652
10741
  MixpanelPersistence.prototype.update_search_keyword = function(referrer) {
10653
10742
  this.register(_.info.searchInfo(referrer));
10654
10743
  };
@@ -10931,6 +11020,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10931
11020
  /** @const */ var PRIMARY_INSTANCE_NAME = 'mixpanel';
10932
11021
  /** @const */ var PAYLOAD_TYPE_BASE64 = 'base64';
10933
11022
  /** @const */ var PAYLOAD_TYPE_JSON = 'json';
11023
+ /** @const */ var DEVICE_ID_PREFIX = '$device:';
10934
11024
 
10935
11025
 
10936
11026
  /*
@@ -10972,6 +11062,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
10972
11062
  'cookie_domain': '',
10973
11063
  'cookie_name': '',
10974
11064
  'loaded': NOOP_FUNC,
11065
+ 'track_marketing': true,
11066
+ 'track_pageview': false,
11067
+ 'skip_first_touch_marketing': false,
10975
11068
  'store_google': true,
10976
11069
  'save_referrer': true,
10977
11070
  'test': false,
@@ -11038,6 +11131,25 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11038
11131
  instance['people'] = new MixpanelPeople();
11039
11132
  instance['people']._init(instance);
11040
11133
 
11134
+ if (!instance.get_config('skip_first_touch_marketing')) {
11135
+ // We need null UTM params in the object because
11136
+ // UTM parameters act as a tuple. If any UTM param
11137
+ // is present, then we set all UTM params including
11138
+ // empty ones together
11139
+ var utm_params = _.info.campaignParams(null);
11140
+ var initial_utm_params = {};
11141
+ var has_utm = false;
11142
+ _.each(utm_params, function(utm_value, utm_key) {
11143
+ initial_utm_params['initial_' + utm_key] = utm_value;
11144
+ if (utm_value) {
11145
+ has_utm = true;
11146
+ }
11147
+ });
11148
+ if (has_utm) {
11149
+ instance['people'].set_once(initial_utm_params);
11150
+ }
11151
+ }
11152
+
11041
11153
  // if any instance on the page has debug = true, we set the
11042
11154
  // global debug to be true
11043
11155
  Config.DEBUG = Config.DEBUG || instance.get_config('debug');
@@ -11069,7 +11181,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11069
11181
  * mixpanel.library_name.track(...);
11070
11182
  *
11071
11183
  * @param {String} token Your Mixpanel API token
11072
- * @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>.
11184
+ * @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>.
11073
11185
  * @param {String} [name] The name for the new mixpanel instance that you want created
11074
11186
  */
11075
11187
  MixpanelLib.prototype.init = function (token, config, name) {
@@ -11107,7 +11219,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11107
11219
  // default to JSON payload for standard mixpanel.com API hosts
11108
11220
  if (!('api_payload_format' in config)) {
11109
11221
  var api_host = config['api_host'] || DEFAULT_CONFIG['api_host'];
11110
- if (api_host.match(/\.mixpanel\.com$/)) {
11222
+ if (api_host.match(/\.mixpanel\.com/)) {
11111
11223
  variable_features['api_payload_format'] = PAYLOAD_TYPE_JSON;
11112
11224
  }
11113
11225
  }
@@ -11178,10 +11290,14 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11178
11290
  // or the device id if something was already stored
11179
11291
  // in the persitence
11180
11292
  this.register_once({
11181
- 'distinct_id': uuid,
11293
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
11182
11294
  '$device_id': uuid
11183
11295
  }, '');
11184
11296
  }
11297
+
11298
+ if (this.get_config('track_pageview')) {
11299
+ this.track_pageview();
11300
+ }
11185
11301
  };
11186
11302
 
11187
11303
  // Private methods
@@ -11195,7 +11311,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11195
11311
  MixpanelLib.prototype._set_default_superprops = function() {
11196
11312
  this['persistence'].update_search_keyword(document$1.referrer);
11197
11313
  if (this.get_config('store_google')) {
11198
- this['persistence'].update_campaign_params();
11314
+ this.register(_.info.campaignParams(), {persistent: false});
11199
11315
  }
11200
11316
  if (this.get_config('save_referrer')) {
11201
11317
  this['persistence'].update_referrer_info(document$1.referrer);
@@ -11677,6 +11793,10 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11677
11793
 
11678
11794
  this._set_default_superprops();
11679
11795
 
11796
+ var marketing_properties = this.get_config('track_marketing')
11797
+ ? _.info.marketingParams()
11798
+ : {};
11799
+
11680
11800
  // note: extend writes to the first object, so lets make sure we
11681
11801
  // don't write to the persistence properties object and info
11682
11802
  // properties object by passing in a new object
@@ -11685,6 +11805,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11685
11805
  properties = _.extend(
11686
11806
  {},
11687
11807
  _.info.properties(),
11808
+ marketing_properties,
11688
11809
  this['persistence'].properties(),
11689
11810
  this.unpersisted_superprops,
11690
11811
  properties
@@ -11845,17 +11966,54 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
11845
11966
  };
11846
11967
 
11847
11968
  /**
11848
- * Track mp_page_view event. This is now ignored by the server.
11969
+ * Track a default Mixpanel page view event, which includes extra default event properties to
11970
+ * improve page view data. The `config.track_pageview` option for <a href="#mixpanelinit">mixpanel.init()</a>
11971
+ * may be turned on for tracking page loads automatically.
11849
11972
  *
11850
- * @param {String} [page] The url of the page to record. If you don't include this, it defaults to the current url.
11851
- * @deprecated
11973
+ * ### Usage
11974
+ *
11975
+ * // track a default $mp_web_page_view event
11976
+ * mixpanel.track_pageview();
11977
+ *
11978
+ * // track a page view event with additional event properties
11979
+ * mixpanel.track_pageview({'ab_test_variant': 'card-layout-b'});
11980
+ *
11981
+ * // example approach to track page views on different page types as event properties
11982
+ * mixpanel.track_pageview({'page': 'pricing'});
11983
+ * mixpanel.track_pageview({'page': 'homepage'});
11984
+ *
11985
+ * // UNCOMMON: Tracking a page view event with a custom event_name option. NOT expected to be used for
11986
+ * // individual pages on the same site or product. Use cases for custom event_name may be page
11987
+ * // views on different products or internal applications that are considered completely separate
11988
+ * mixpanel.track_pageview({'page': 'customer-search'}, {'event_name': '[internal] Admin Page View'});
11989
+ *
11990
+ * @param {Object} [properties] An optional set of additional properties to send with the page view event
11991
+ * @param {Object} [options] Page view tracking options
11992
+ * @param {String} [options.event_name] - Alternate name for the tracking event
11993
+ * @returns {Boolean|Object} If the tracking request was successfully initiated/queued, an object
11994
+ * with the tracking payload sent to the API server is returned; otherwise false.
11852
11995
  */
11853
- MixpanelLib.prototype.track_pageview = function(page) {
11854
- if (_.isUndefined(page)) {
11855
- page = document$1.location.href;
11996
+ MixpanelLib.prototype.track_pageview = addOptOutCheckMixpanelLib(function(properties, options) {
11997
+ if (typeof properties !== 'object') {
11998
+ properties = {};
11856
11999
  }
11857
- this.track('mp_page_view', _.info.pageviewInfo(page));
11858
- };
12000
+ options = options || {};
12001
+ var event_name = options['event_name'] || '$mp_web_page_view';
12002
+
12003
+ var default_page_properties = _.extend(
12004
+ _.info.mpPageViewProperties(),
12005
+ _.info.campaignParams(),
12006
+ _.info.clickParams()
12007
+ );
12008
+
12009
+ var event_properties = _.extend(
12010
+ {},
12011
+ default_page_properties,
12012
+ properties
12013
+ );
12014
+
12015
+ return this.track(event_name, event_properties);
12016
+ });
11859
12017
 
11860
12018
  /**
11861
12019
  * Track clicks on a set of document elements. Selector must be a
@@ -12104,7 +12262,15 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12104
12262
  // _unset_callback:function A callback to be run if and when the People unset queue is flushed
12105
12263
 
12106
12264
  var previous_distinct_id = this.get_distinct_id();
12107
- this.register({'$user_id': new_distinct_id});
12265
+ if (new_distinct_id && previous_distinct_id !== new_distinct_id) {
12266
+ // we allow the following condition if previous distinct_id is same as new_distinct_id
12267
+ // so that you can force flush people updates for anonymous profiles.
12268
+ if (typeof new_distinct_id === 'string' && new_distinct_id.indexOf(DEVICE_ID_PREFIX) === 0) {
12269
+ this.report_error('distinct_id cannot have $device: prefix');
12270
+ return -1;
12271
+ }
12272
+ this.register({'$user_id': new_distinct_id});
12273
+ }
12108
12274
 
12109
12275
  if (!this.get_property('$device_id')) {
12110
12276
  // The persisted distinct id might not actually be a device id at all
@@ -12145,7 +12311,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12145
12311
  this._flags.identify_called = false;
12146
12312
  var uuid = _.UUID();
12147
12313
  this.register_once({
12148
- 'distinct_id': uuid,
12314
+ 'distinct_id': DEVICE_ID_PREFIX + uuid,
12149
12315
  '$device_id': uuid
12150
12316
  }, '');
12151
12317
  };
@@ -12270,8 +12436,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12270
12436
  * // batching or retry mechanisms.
12271
12437
  * api_transport: 'XHR'
12272
12438
  *
12273
- * // turn on request-batching/queueing/retry
12274
- * batch_requests: false,
12439
+ * // request-batching/queueing/retry
12440
+ * batch_requests: true,
12275
12441
  *
12276
12442
  * // maximum number of events/updates to send in a single
12277
12443
  * // network request
@@ -12343,10 +12509,20 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
12343
12509
  * // secure, meaning they will only be transmitted over https
12344
12510
  * secure_cookie: false
12345
12511
  *
12512
+ * // disables enriching user profiles with first touch marketing data
12513
+ * skip_first_touch_marketing: false
12514
+ *
12346
12515
  * // the amount of time track_links will
12347
12516
  * // wait for Mixpanel's servers to respond
12348
12517
  * track_links_timeout: 300
12349
12518
  *
12519
+ * // adds any UTM parameters and click IDs present on the page to any events fired
12520
+ * track_marketing: true
12521
+ *
12522
+ * // enables automatic page view tracking using default page view events through
12523
+ * // the track_pageview() method
12524
+ * track_pageview: false
12525
+ *
12350
12526
  * // if you set upgrade to be true, the library will check for
12351
12527
  * // a cookie from our old js library and import super
12352
12528
  * // properties from it, then the old cookie is deleted
@@ -13960,7 +14136,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
13960
14136
  });
13961
14137
  }
13962
14138
 
13963
- 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};
14139
+ var name="@thoughtspot/visual-embed-sdk";var version="1.32.9";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};
13964
14140
 
13965
14141
  /**
13966
14142
  * Copyright (c) 2022