@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.
- package/cjs/package.json +3 -3
- package/cjs/src/css-variables.d.ts +18 -3
- package/cjs/src/css-variables.d.ts.map +1 -1
- package/cjs/src/embed/base.d.ts +34 -32
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +34 -32
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/tokenizedFetch.d.ts.map +1 -1
- package/cjs/src/tokenizedFetch.js +5 -1
- package/cjs/src/tokenizedFetch.js.map +1 -1
- package/cjs/src/types.d.ts +7 -4
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +7 -4
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/authService/authService.spec.js +3 -1
- package/cjs/src/utils/authService/authService.spec.js.map +1 -1
- package/dist/src/css-variables.d.ts +18 -3
- package/dist/src/css-variables.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +34 -32
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/tokenizedFetch.d.ts.map +1 -1
- package/dist/src/types.d.ts +7 -4
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +242 -79
- package/dist/tsembed-react.js +242 -79
- package/dist/tsembed.es.js +276 -111
- package/dist/tsembed.js +276 -111
- package/dist/visual-embed-sdk-react-full.d.ts +59 -39
- package/dist/visual-embed-sdk-react.d.ts +59 -39
- package/dist/visual-embed-sdk.d.ts +59 -39
- package/lib/package.json +3 -3
- package/lib/src/css-variables.d.ts +18 -3
- package/lib/src/css-variables.d.ts.map +1 -1
- package/lib/src/embed/base.d.ts +34 -32
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +34 -32
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/tokenizedFetch.d.ts.map +1 -1
- package/lib/src/tokenizedFetch.js +5 -1
- package/lib/src/tokenizedFetch.js.map +1 -1
- package/lib/src/types.d.ts +7 -4
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +7 -4
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/authService/authService.spec.js +3 -1
- package/lib/src/utils/authService/authService.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +59 -39
- package/package.json +3 -3
- package/src/css-variables.ts +21 -3
- package/src/embed/base.ts +34 -32
- package/src/tokenizedFetch.ts +5 -1
- package/src/types.ts +7 -4
- package/src/utils/authService/authService.spec.ts +3 -1
package/dist/tsembed-react.es.js
CHANGED
|
@@ -1620,15 +1620,20 @@ var EmbedEvent;
|
|
|
1620
1620
|
* Prerequisite: Set isOnBeforeGetVizDataInterceptEnabled : true
|
|
1621
1621
|
* for this embed event to get emitted.
|
|
1622
1622
|
*
|
|
1623
|
-
*
|
|
1624
|
-
*
|
|
1623
|
+
* @param: payload
|
|
1624
|
+
* @param: responder
|
|
1625
1625
|
* Contains elements that lets developers define whether ThoughtSpot
|
|
1626
1626
|
* will run the search or not, and if not, which error message to provide.
|
|
1627
|
+
*
|
|
1627
1628
|
* execute: When execute returns true, the search will be run.
|
|
1628
1629
|
* When execute returns false, the search will not be executed.
|
|
1630
|
+
*
|
|
1629
1631
|
* error: Developers can customize the user facing message when execute is
|
|
1630
1632
|
* set to false using the error parameter in responder
|
|
1631
1633
|
*
|
|
1634
|
+
* @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
|
|
1635
|
+
*
|
|
1636
|
+
* @example
|
|
1632
1637
|
*```js
|
|
1633
1638
|
* .on(EmbedEvent.OnBeforeGetVizDataIntercept,
|
|
1634
1639
|
* (payload, responder) => {
|
|
@@ -1664,8 +1669,6 @@ var EmbedEvent;
|
|
|
1664
1669
|
* }})
|
|
1665
1670
|
* })
|
|
1666
1671
|
*```
|
|
1667
|
-
*
|
|
1668
|
-
* @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
|
|
1669
1672
|
*/
|
|
1670
1673
|
EmbedEvent["OnBeforeGetVizDataIntercept"] = "onBeforeGetVizDataIntercept";
|
|
1671
1674
|
/**
|
|
@@ -6306,7 +6309,11 @@ const getEmbedConfig = () => config;
|
|
|
6306
6309
|
const tokenizedFetch = async (input, init) => {
|
|
6307
6310
|
const embedConfig = getEmbedConfig();
|
|
6308
6311
|
if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
|
|
6309
|
-
return fetch(input,
|
|
6312
|
+
return fetch(input, {
|
|
6313
|
+
// ensure cookies are included for the non cookie-less api calls.
|
|
6314
|
+
credentials: 'include',
|
|
6315
|
+
...init,
|
|
6316
|
+
});
|
|
6310
6317
|
}
|
|
6311
6318
|
const req = new Request(input, init);
|
|
6312
6319
|
const authToken = await getAuthenticationToken(embedConfig);
|
|
@@ -6973,7 +6980,7 @@ const DEFAULT_EMBED_HEIGHT = '100%';
|
|
|
6973
6980
|
|
|
6974
6981
|
var Config = {
|
|
6975
6982
|
DEBUG: false,
|
|
6976
|
-
LIB_VERSION: '2.
|
|
6983
|
+
LIB_VERSION: '2.47.0'
|
|
6977
6984
|
};
|
|
6978
6985
|
|
|
6979
6986
|
// since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
|
|
@@ -7803,20 +7810,24 @@ _.utf8Encode = function(string) {
|
|
|
7803
7810
|
|
|
7804
7811
|
_.UUID = (function() {
|
|
7805
7812
|
|
|
7806
|
-
// Time
|
|
7807
|
-
// 1*new Date() is a cross browser version of Date.now()
|
|
7813
|
+
// Time-based entropy
|
|
7808
7814
|
var T = function() {
|
|
7809
|
-
var
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7815
|
+
var time = 1 * new Date(); // cross-browser version of Date.now()
|
|
7816
|
+
var ticks;
|
|
7817
|
+
if (window$1.performance && window$1.performance.now) {
|
|
7818
|
+
ticks = window$1.performance.now();
|
|
7819
|
+
} else {
|
|
7820
|
+
// fall back to busy loop
|
|
7821
|
+
ticks = 0;
|
|
7822
|
+
|
|
7823
|
+
// this while loop figures how many browser ticks go by
|
|
7824
|
+
// before 1*new Date() returns a new number, ie the amount
|
|
7825
|
+
// of ticks that go by per millisecond
|
|
7826
|
+
while (time == 1 * new Date()) {
|
|
7827
|
+
ticks++;
|
|
7828
|
+
}
|
|
7817
7829
|
}
|
|
7818
|
-
|
|
7819
|
-
return d.toString(16) + i.toString(16);
|
|
7830
|
+
return time.toString(16) + Math.floor(ticks).toString(16);
|
|
7820
7831
|
};
|
|
7821
7832
|
|
|
7822
7833
|
// Math.Random entropy
|
|
@@ -8383,21 +8394,42 @@ _.dom_query = (function() {
|
|
|
8383
8394
|
};
|
|
8384
8395
|
})();
|
|
8385
8396
|
|
|
8397
|
+
var CAMPAIGN_KEYWORDS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'];
|
|
8398
|
+
var CLICK_IDS = ['dclid', 'fbclid', 'gclid', 'ko_click_id', 'li_fat_id', 'msclkid', 'ttclid', 'twclid', 'wbraid'];
|
|
8399
|
+
|
|
8386
8400
|
_.info = {
|
|
8387
|
-
campaignParams: function() {
|
|
8388
|
-
var
|
|
8389
|
-
kw = '',
|
|
8401
|
+
campaignParams: function(default_value) {
|
|
8402
|
+
var kw = '',
|
|
8390
8403
|
params = {};
|
|
8391
|
-
_.each(
|
|
8404
|
+
_.each(CAMPAIGN_KEYWORDS, function(kwkey) {
|
|
8392
8405
|
kw = _.getQueryParam(document$1.URL, kwkey);
|
|
8393
8406
|
if (kw.length) {
|
|
8394
8407
|
params[kwkey] = kw;
|
|
8408
|
+
} else if (default_value !== undefined) {
|
|
8409
|
+
params[kwkey] = default_value;
|
|
8410
|
+
}
|
|
8411
|
+
});
|
|
8412
|
+
|
|
8413
|
+
return params;
|
|
8414
|
+
},
|
|
8415
|
+
|
|
8416
|
+
clickParams: function() {
|
|
8417
|
+
var id = '',
|
|
8418
|
+
params = {};
|
|
8419
|
+
_.each(CLICK_IDS, function(idkey) {
|
|
8420
|
+
id = _.getQueryParam(document$1.URL, idkey);
|
|
8421
|
+
if (id.length) {
|
|
8422
|
+
params[idkey] = id;
|
|
8395
8423
|
}
|
|
8396
8424
|
});
|
|
8397
8425
|
|
|
8398
8426
|
return params;
|
|
8399
8427
|
},
|
|
8400
8428
|
|
|
8429
|
+
marketingParams: function() {
|
|
8430
|
+
return _.extend(_.info.campaignParams(), _.info.clickParams());
|
|
8431
|
+
},
|
|
8432
|
+
|
|
8401
8433
|
searchEngine: function(referrer) {
|
|
8402
8434
|
if (referrer.search('https?://(.*)google.([^/?]*)') === 0) {
|
|
8403
8435
|
return 'google';
|
|
@@ -8594,12 +8626,13 @@ _.info = {
|
|
|
8594
8626
|
});
|
|
8595
8627
|
},
|
|
8596
8628
|
|
|
8597
|
-
|
|
8629
|
+
mpPageViewProperties: function() {
|
|
8598
8630
|
return _.strip_empty_properties({
|
|
8599
|
-
'
|
|
8600
|
-
'
|
|
8601
|
-
'
|
|
8602
|
-
'
|
|
8631
|
+
'current_page_title': document$1.title,
|
|
8632
|
+
'current_domain': window$1.location.hostname,
|
|
8633
|
+
'current_url_path': window$1.location.pathname,
|
|
8634
|
+
'current_url_protocol': window$1.location.protocol,
|
|
8635
|
+
'current_url_search': window$1.location.search
|
|
8603
8636
|
});
|
|
8604
8637
|
}
|
|
8605
8638
|
};
|
|
@@ -9266,6 +9299,9 @@ var RequestBatcher = function(storageKey, options) {
|
|
|
9266
9299
|
|
|
9267
9300
|
this.stopped = !this.libConfig['batch_autostart'];
|
|
9268
9301
|
this.consecutiveRemovalFailures = 0;
|
|
9302
|
+
|
|
9303
|
+
// extra client-side dedupe
|
|
9304
|
+
this.itemIdsSentSuccessfully = {};
|
|
9269
9305
|
};
|
|
9270
9306
|
|
|
9271
9307
|
/**
|
|
@@ -9358,7 +9394,34 @@ RequestBatcher.prototype.flush = function(options) {
|
|
|
9358
9394
|
payload = this.beforeSendHook(payload);
|
|
9359
9395
|
}
|
|
9360
9396
|
if (payload) {
|
|
9361
|
-
|
|
9397
|
+
// mp_sent_by_lib_version prop captures which lib version actually
|
|
9398
|
+
// sends each event (regardless of which version originally queued
|
|
9399
|
+
// it for sending)
|
|
9400
|
+
if (payload['event'] && payload['properties']) {
|
|
9401
|
+
payload['properties'] = _.extend(
|
|
9402
|
+
{},
|
|
9403
|
+
payload['properties'],
|
|
9404
|
+
{'mp_sent_by_lib_version': Config.LIB_VERSION}
|
|
9405
|
+
);
|
|
9406
|
+
}
|
|
9407
|
+
var addPayload = true;
|
|
9408
|
+
var itemId = item['id'];
|
|
9409
|
+
if (itemId) {
|
|
9410
|
+
if ((this.itemIdsSentSuccessfully[itemId] || 0) > 5) {
|
|
9411
|
+
this.reportError('[dupe] item ID sent too many times, not sending', {
|
|
9412
|
+
item: item,
|
|
9413
|
+
batchSize: batch.length,
|
|
9414
|
+
timesSent: this.itemIdsSentSuccessfully[itemId]
|
|
9415
|
+
});
|
|
9416
|
+
addPayload = false;
|
|
9417
|
+
}
|
|
9418
|
+
} else {
|
|
9419
|
+
this.reportError('[dupe] found item with no ID', {item: item});
|
|
9420
|
+
}
|
|
9421
|
+
|
|
9422
|
+
if (addPayload) {
|
|
9423
|
+
dataForRequest.push(payload);
|
|
9424
|
+
}
|
|
9362
9425
|
}
|
|
9363
9426
|
transformedItems[item['id']] = payload;
|
|
9364
9427
|
}, this);
|
|
@@ -9441,6 +9504,24 @@ RequestBatcher.prototype.flush = function(options) {
|
|
|
9441
9504
|
}
|
|
9442
9505
|
}, this)
|
|
9443
9506
|
);
|
|
9507
|
+
|
|
9508
|
+
// client-side dedupe
|
|
9509
|
+
_.each(batch, _.bind(function(item) {
|
|
9510
|
+
var itemId = item['id'];
|
|
9511
|
+
if (itemId) {
|
|
9512
|
+
this.itemIdsSentSuccessfully[itemId] = this.itemIdsSentSuccessfully[itemId] || 0;
|
|
9513
|
+
this.itemIdsSentSuccessfully[itemId]++;
|
|
9514
|
+
if (this.itemIdsSentSuccessfully[itemId] > 5) {
|
|
9515
|
+
this.reportError('[dupe] item ID sent too many times', {
|
|
9516
|
+
item: item,
|
|
9517
|
+
batchSize: batch.length,
|
|
9518
|
+
timesSent: this.itemIdsSentSuccessfully[itemId]
|
|
9519
|
+
});
|
|
9520
|
+
}
|
|
9521
|
+
} else {
|
|
9522
|
+
this.reportError('[dupe] found item with no ID while removing', {item: item});
|
|
9523
|
+
}
|
|
9524
|
+
}, this));
|
|
9444
9525
|
}
|
|
9445
9526
|
|
|
9446
9527
|
} catch(err) {
|
|
@@ -10286,24 +10367,25 @@ MixpanelPeople.prototype.union = addOptOutCheckMixpanelPeople(function(list_name
|
|
|
10286
10367
|
});
|
|
10287
10368
|
|
|
10288
10369
|
/*
|
|
10289
|
-
* Record that you have charged the current user a certain amount
|
|
10290
|
-
* of money. Charges recorded with track_charge() will appear in the
|
|
10291
|
-
* Mixpanel revenue report.
|
|
10292
|
-
*
|
|
10293
|
-
* ### Usage:
|
|
10294
|
-
*
|
|
10295
|
-
* // charge a user $50
|
|
10296
|
-
* mixpanel.people.track_charge(50);
|
|
10297
|
-
*
|
|
10298
|
-
* // charge a user $30.50 on the 2nd of january
|
|
10299
|
-
* mixpanel.people.track_charge(30.50, {
|
|
10300
|
-
* '$time': new Date('jan 1 2012')
|
|
10301
|
-
* });
|
|
10302
|
-
*
|
|
10303
|
-
* @param {Number} amount The amount of money charged to the current user
|
|
10304
|
-
* @param {Object} [properties] An associative array of properties associated with the charge
|
|
10305
|
-
* @param {Function} [callback] If provided, the callback will be called when the server responds
|
|
10306
|
-
|
|
10370
|
+
* Record that you have charged the current user a certain amount
|
|
10371
|
+
* of money. Charges recorded with track_charge() will appear in the
|
|
10372
|
+
* Mixpanel revenue report.
|
|
10373
|
+
*
|
|
10374
|
+
* ### Usage:
|
|
10375
|
+
*
|
|
10376
|
+
* // charge a user $50
|
|
10377
|
+
* mixpanel.people.track_charge(50);
|
|
10378
|
+
*
|
|
10379
|
+
* // charge a user $30.50 on the 2nd of january
|
|
10380
|
+
* mixpanel.people.track_charge(30.50, {
|
|
10381
|
+
* '$time': new Date('jan 1 2012')
|
|
10382
|
+
* });
|
|
10383
|
+
*
|
|
10384
|
+
* @param {Number} amount The amount of money charged to the current user
|
|
10385
|
+
* @param {Object} [properties] An associative array of properties associated with the charge
|
|
10386
|
+
* @param {Function} [callback] If provided, the callback will be called when the server responds
|
|
10387
|
+
* @deprecated
|
|
10388
|
+
*/
|
|
10307
10389
|
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(amount, properties, callback) {
|
|
10308
10390
|
if (!_.isNumber(amount)) {
|
|
10309
10391
|
amount = parseFloat(amount);
|
|
@@ -10319,15 +10401,16 @@ MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(am
|
|
|
10319
10401
|
});
|
|
10320
10402
|
|
|
10321
10403
|
/*
|
|
10322
|
-
* Permanently clear all revenue report transactions from the
|
|
10323
|
-
* current user's people analytics profile.
|
|
10324
|
-
*
|
|
10325
|
-
* ### Usage:
|
|
10326
|
-
*
|
|
10327
|
-
* mixpanel.people.clear_charges();
|
|
10328
|
-
*
|
|
10329
|
-
* @param {Function} [callback] If provided, the callback will be called after tracking the event.
|
|
10330
|
-
|
|
10404
|
+
* Permanently clear all revenue report transactions from the
|
|
10405
|
+
* current user's people analytics profile.
|
|
10406
|
+
*
|
|
10407
|
+
* ### Usage:
|
|
10408
|
+
*
|
|
10409
|
+
* mixpanel.people.clear_charges();
|
|
10410
|
+
*
|
|
10411
|
+
* @param {Function} [callback] If provided, the callback will be called after tracking the event.
|
|
10412
|
+
* @deprecated
|
|
10413
|
+
*/
|
|
10331
10414
|
MixpanelPeople.prototype.clear_charges = function(callback) {
|
|
10332
10415
|
return this.set('$transactions', [], callback);
|
|
10333
10416
|
};
|
|
@@ -10727,13 +10810,6 @@ MixpanelPersistence.prototype.unregister = function(prop) {
|
|
|
10727
10810
|
}
|
|
10728
10811
|
};
|
|
10729
10812
|
|
|
10730
|
-
MixpanelPersistence.prototype.update_campaign_params = function() {
|
|
10731
|
-
if (!this.campaign_params_saved) {
|
|
10732
|
-
this.register_once(_.info.campaignParams());
|
|
10733
|
-
this.campaign_params_saved = true;
|
|
10734
|
-
}
|
|
10735
|
-
};
|
|
10736
|
-
|
|
10737
10813
|
MixpanelPersistence.prototype.update_search_keyword = function(referrer) {
|
|
10738
10814
|
this.register(_.info.searchInfo(referrer));
|
|
10739
10815
|
};
|
|
@@ -11016,6 +11092,7 @@ var NOOP_FUNC = function() {};
|
|
|
11016
11092
|
/** @const */ var PRIMARY_INSTANCE_NAME = 'mixpanel';
|
|
11017
11093
|
/** @const */ var PAYLOAD_TYPE_BASE64 = 'base64';
|
|
11018
11094
|
/** @const */ var PAYLOAD_TYPE_JSON = 'json';
|
|
11095
|
+
/** @const */ var DEVICE_ID_PREFIX = '$device:';
|
|
11019
11096
|
|
|
11020
11097
|
|
|
11021
11098
|
/*
|
|
@@ -11057,6 +11134,9 @@ var DEFAULT_CONFIG = {
|
|
|
11057
11134
|
'cookie_domain': '',
|
|
11058
11135
|
'cookie_name': '',
|
|
11059
11136
|
'loaded': NOOP_FUNC,
|
|
11137
|
+
'track_marketing': true,
|
|
11138
|
+
'track_pageview': false,
|
|
11139
|
+
'skip_first_touch_marketing': false,
|
|
11060
11140
|
'store_google': true,
|
|
11061
11141
|
'save_referrer': true,
|
|
11062
11142
|
'test': false,
|
|
@@ -11123,6 +11203,25 @@ var create_mplib = function(token, config, name) {
|
|
|
11123
11203
|
instance['people'] = new MixpanelPeople();
|
|
11124
11204
|
instance['people']._init(instance);
|
|
11125
11205
|
|
|
11206
|
+
if (!instance.get_config('skip_first_touch_marketing')) {
|
|
11207
|
+
// We need null UTM params in the object because
|
|
11208
|
+
// UTM parameters act as a tuple. If any UTM param
|
|
11209
|
+
// is present, then we set all UTM params including
|
|
11210
|
+
// empty ones together
|
|
11211
|
+
var utm_params = _.info.campaignParams(null);
|
|
11212
|
+
var initial_utm_params = {};
|
|
11213
|
+
var has_utm = false;
|
|
11214
|
+
_.each(utm_params, function(utm_value, utm_key) {
|
|
11215
|
+
initial_utm_params['initial_' + utm_key] = utm_value;
|
|
11216
|
+
if (utm_value) {
|
|
11217
|
+
has_utm = true;
|
|
11218
|
+
}
|
|
11219
|
+
});
|
|
11220
|
+
if (has_utm) {
|
|
11221
|
+
instance['people'].set_once(initial_utm_params);
|
|
11222
|
+
}
|
|
11223
|
+
}
|
|
11224
|
+
|
|
11126
11225
|
// if any instance on the page has debug = true, we set the
|
|
11127
11226
|
// global debug to be true
|
|
11128
11227
|
Config.DEBUG = Config.DEBUG || instance.get_config('debug');
|
|
@@ -11154,7 +11253,7 @@ var create_mplib = function(token, config, name) {
|
|
|
11154
11253
|
* mixpanel.library_name.track(...);
|
|
11155
11254
|
*
|
|
11156
11255
|
* @param {String} token Your Mixpanel API token
|
|
11157
|
-
* @param {Object} [config] A dictionary of config options to override. <a href="https://github.com/mixpanel/mixpanel-js/blob/
|
|
11256
|
+
* @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>.
|
|
11158
11257
|
* @param {String} [name] The name for the new mixpanel instance that you want created
|
|
11159
11258
|
*/
|
|
11160
11259
|
MixpanelLib.prototype.init = function (token, config, name) {
|
|
@@ -11192,7 +11291,7 @@ MixpanelLib.prototype._init = function(token, config, name) {
|
|
|
11192
11291
|
// default to JSON payload for standard mixpanel.com API hosts
|
|
11193
11292
|
if (!('api_payload_format' in config)) {
|
|
11194
11293
|
var api_host = config['api_host'] || DEFAULT_CONFIG['api_host'];
|
|
11195
|
-
if (api_host.match(/\.mixpanel\.com
|
|
11294
|
+
if (api_host.match(/\.mixpanel\.com/)) {
|
|
11196
11295
|
variable_features['api_payload_format'] = PAYLOAD_TYPE_JSON;
|
|
11197
11296
|
}
|
|
11198
11297
|
}
|
|
@@ -11263,10 +11362,14 @@ MixpanelLib.prototype._init = function(token, config, name) {
|
|
|
11263
11362
|
// or the device id if something was already stored
|
|
11264
11363
|
// in the persitence
|
|
11265
11364
|
this.register_once({
|
|
11266
|
-
'distinct_id': uuid,
|
|
11365
|
+
'distinct_id': DEVICE_ID_PREFIX + uuid,
|
|
11267
11366
|
'$device_id': uuid
|
|
11268
11367
|
}, '');
|
|
11269
11368
|
}
|
|
11369
|
+
|
|
11370
|
+
if (this.get_config('track_pageview')) {
|
|
11371
|
+
this.track_pageview();
|
|
11372
|
+
}
|
|
11270
11373
|
};
|
|
11271
11374
|
|
|
11272
11375
|
// Private methods
|
|
@@ -11280,7 +11383,7 @@ MixpanelLib.prototype._loaded = function() {
|
|
|
11280
11383
|
MixpanelLib.prototype._set_default_superprops = function() {
|
|
11281
11384
|
this['persistence'].update_search_keyword(document$1.referrer);
|
|
11282
11385
|
if (this.get_config('store_google')) {
|
|
11283
|
-
this
|
|
11386
|
+
this.register(_.info.campaignParams(), {persistent: false});
|
|
11284
11387
|
}
|
|
11285
11388
|
if (this.get_config('save_referrer')) {
|
|
11286
11389
|
this['persistence'].update_referrer_info(document$1.referrer);
|
|
@@ -11762,6 +11865,10 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
|
|
|
11762
11865
|
|
|
11763
11866
|
this._set_default_superprops();
|
|
11764
11867
|
|
|
11868
|
+
var marketing_properties = this.get_config('track_marketing')
|
|
11869
|
+
? _.info.marketingParams()
|
|
11870
|
+
: {};
|
|
11871
|
+
|
|
11765
11872
|
// note: extend writes to the first object, so lets make sure we
|
|
11766
11873
|
// don't write to the persistence properties object and info
|
|
11767
11874
|
// properties object by passing in a new object
|
|
@@ -11770,6 +11877,7 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
|
|
|
11770
11877
|
properties = _.extend(
|
|
11771
11878
|
{},
|
|
11772
11879
|
_.info.properties(),
|
|
11880
|
+
marketing_properties,
|
|
11773
11881
|
this['persistence'].properties(),
|
|
11774
11882
|
this.unpersisted_superprops,
|
|
11775
11883
|
properties
|
|
@@ -11930,17 +12038,54 @@ MixpanelLib.prototype.get_group = function (group_key, group_id) {
|
|
|
11930
12038
|
};
|
|
11931
12039
|
|
|
11932
12040
|
/**
|
|
11933
|
-
* Track
|
|
12041
|
+
* Track a default Mixpanel page view event, which includes extra default event properties to
|
|
12042
|
+
* improve page view data. The `config.track_pageview` option for <a href="#mixpanelinit">mixpanel.init()</a>
|
|
12043
|
+
* may be turned on for tracking page loads automatically.
|
|
11934
12044
|
*
|
|
11935
|
-
*
|
|
11936
|
-
*
|
|
12045
|
+
* ### Usage
|
|
12046
|
+
*
|
|
12047
|
+
* // track a default $mp_web_page_view event
|
|
12048
|
+
* mixpanel.track_pageview();
|
|
12049
|
+
*
|
|
12050
|
+
* // track a page view event with additional event properties
|
|
12051
|
+
* mixpanel.track_pageview({'ab_test_variant': 'card-layout-b'});
|
|
12052
|
+
*
|
|
12053
|
+
* // example approach to track page views on different page types as event properties
|
|
12054
|
+
* mixpanel.track_pageview({'page': 'pricing'});
|
|
12055
|
+
* mixpanel.track_pageview({'page': 'homepage'});
|
|
12056
|
+
*
|
|
12057
|
+
* // UNCOMMON: Tracking a page view event with a custom event_name option. NOT expected to be used for
|
|
12058
|
+
* // individual pages on the same site or product. Use cases for custom event_name may be page
|
|
12059
|
+
* // views on different products or internal applications that are considered completely separate
|
|
12060
|
+
* mixpanel.track_pageview({'page': 'customer-search'}, {'event_name': '[internal] Admin Page View'});
|
|
12061
|
+
*
|
|
12062
|
+
* @param {Object} [properties] An optional set of additional properties to send with the page view event
|
|
12063
|
+
* @param {Object} [options] Page view tracking options
|
|
12064
|
+
* @param {String} [options.event_name] - Alternate name for the tracking event
|
|
12065
|
+
* @returns {Boolean|Object} If the tracking request was successfully initiated/queued, an object
|
|
12066
|
+
* with the tracking payload sent to the API server is returned; otherwise false.
|
|
11937
12067
|
*/
|
|
11938
|
-
MixpanelLib.prototype.track_pageview = function(
|
|
11939
|
-
if (
|
|
11940
|
-
|
|
12068
|
+
MixpanelLib.prototype.track_pageview = addOptOutCheckMixpanelLib(function(properties, options) {
|
|
12069
|
+
if (typeof properties !== 'object') {
|
|
12070
|
+
properties = {};
|
|
11941
12071
|
}
|
|
11942
|
-
|
|
11943
|
-
|
|
12072
|
+
options = options || {};
|
|
12073
|
+
var event_name = options['event_name'] || '$mp_web_page_view';
|
|
12074
|
+
|
|
12075
|
+
var default_page_properties = _.extend(
|
|
12076
|
+
_.info.mpPageViewProperties(),
|
|
12077
|
+
_.info.campaignParams(),
|
|
12078
|
+
_.info.clickParams()
|
|
12079
|
+
);
|
|
12080
|
+
|
|
12081
|
+
var event_properties = _.extend(
|
|
12082
|
+
{},
|
|
12083
|
+
default_page_properties,
|
|
12084
|
+
properties
|
|
12085
|
+
);
|
|
12086
|
+
|
|
12087
|
+
return this.track(event_name, event_properties);
|
|
12088
|
+
});
|
|
11944
12089
|
|
|
11945
12090
|
/**
|
|
11946
12091
|
* Track clicks on a set of document elements. Selector must be a
|
|
@@ -12189,7 +12334,15 @@ MixpanelLib.prototype.identify = function(
|
|
|
12189
12334
|
// _unset_callback:function A callback to be run if and when the People unset queue is flushed
|
|
12190
12335
|
|
|
12191
12336
|
var previous_distinct_id = this.get_distinct_id();
|
|
12192
|
-
|
|
12337
|
+
if (new_distinct_id && previous_distinct_id !== new_distinct_id) {
|
|
12338
|
+
// we allow the following condition if previous distinct_id is same as new_distinct_id
|
|
12339
|
+
// so that you can force flush people updates for anonymous profiles.
|
|
12340
|
+
if (typeof new_distinct_id === 'string' && new_distinct_id.indexOf(DEVICE_ID_PREFIX) === 0) {
|
|
12341
|
+
this.report_error('distinct_id cannot have $device: prefix');
|
|
12342
|
+
return -1;
|
|
12343
|
+
}
|
|
12344
|
+
this.register({'$user_id': new_distinct_id});
|
|
12345
|
+
}
|
|
12193
12346
|
|
|
12194
12347
|
if (!this.get_property('$device_id')) {
|
|
12195
12348
|
// The persisted distinct id might not actually be a device id at all
|
|
@@ -12230,7 +12383,7 @@ MixpanelLib.prototype.reset = function() {
|
|
|
12230
12383
|
this._flags.identify_called = false;
|
|
12231
12384
|
var uuid = _.UUID();
|
|
12232
12385
|
this.register_once({
|
|
12233
|
-
'distinct_id': uuid,
|
|
12386
|
+
'distinct_id': DEVICE_ID_PREFIX + uuid,
|
|
12234
12387
|
'$device_id': uuid
|
|
12235
12388
|
}, '');
|
|
12236
12389
|
};
|
|
@@ -12355,8 +12508,8 @@ MixpanelLib.prototype.name_tag = function(name_tag) {
|
|
|
12355
12508
|
* // batching or retry mechanisms.
|
|
12356
12509
|
* api_transport: 'XHR'
|
|
12357
12510
|
*
|
|
12358
|
-
* //
|
|
12359
|
-
* batch_requests:
|
|
12511
|
+
* // request-batching/queueing/retry
|
|
12512
|
+
* batch_requests: true,
|
|
12360
12513
|
*
|
|
12361
12514
|
* // maximum number of events/updates to send in a single
|
|
12362
12515
|
* // network request
|
|
@@ -12428,10 +12581,20 @@ MixpanelLib.prototype.name_tag = function(name_tag) {
|
|
|
12428
12581
|
* // secure, meaning they will only be transmitted over https
|
|
12429
12582
|
* secure_cookie: false
|
|
12430
12583
|
*
|
|
12584
|
+
* // disables enriching user profiles with first touch marketing data
|
|
12585
|
+
* skip_first_touch_marketing: false
|
|
12586
|
+
*
|
|
12431
12587
|
* // the amount of time track_links will
|
|
12432
12588
|
* // wait for Mixpanel's servers to respond
|
|
12433
12589
|
* track_links_timeout: 300
|
|
12434
12590
|
*
|
|
12591
|
+
* // adds any UTM parameters and click IDs present on the page to any events fired
|
|
12592
|
+
* track_marketing: true
|
|
12593
|
+
*
|
|
12594
|
+
* // enables automatic page view tracking using default page view events through
|
|
12595
|
+
* // the track_pageview() method
|
|
12596
|
+
* track_pageview: false
|
|
12597
|
+
*
|
|
12435
12598
|
* // if you set upgrade to be true, the library will check for
|
|
12436
12599
|
* // a cookie from our old js library and import super
|
|
12437
12600
|
* // properties from it, then the old cookie is deleted
|
|
@@ -14045,7 +14208,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
14045
14208
|
});
|
|
14046
14209
|
}
|
|
14047
14210
|
|
|
14048
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.32.
|
|
14211
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.32.8";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^46.9.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/lodash":"^4.17.0","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^5.3.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"49 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
14049
14212
|
|
|
14050
14213
|
/**
|
|
14051
14214
|
* Copyright (c) 2022
|