@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.
- 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 +40 -37
- 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 +80 -8
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +76 -6
- 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/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +3 -1
- package/cjs/src/utils.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 +80 -8
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +314 -82
- package/dist/tsembed-react.js +257 -81
- package/dist/tsembed.es.js +354 -119
- package/dist/tsembed.js +297 -118
- package/dist/visual-embed-sdk-react-full.d.ts +132 -43
- package/dist/visual-embed-sdk-react.d.ts +132 -43
- package/dist/visual-embed-sdk.d.ts +132 -43
- 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 +40 -37
- 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 +80 -8
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +76 -6
- 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/utils.d.ts.map +1 -1
- package/lib/src/utils.js +3 -1
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +132 -43
- package/package.json +3 -3
- package/src/css-variables.ts +21 -3
- package/src/embed/base.ts +35 -32
- package/src/tokenizedFetch.ts +5 -1
- package/src/types.ts +80 -8
- package/src/utils/authService/authService.spec.ts +3 -1
- package/src/utils.ts +3 -0
package/dist/tsembed-react.es.js
CHANGED
|
@@ -313,7 +313,7 @@ const checkReleaseVersionInBeta = (releaseVersion, suppressBetaWarning) => {
|
|
|
313
313
|
return false;
|
|
314
314
|
};
|
|
315
315
|
const getCustomisations = (embedConfig, viewConfig) => {
|
|
316
|
-
var _a, _b;
|
|
316
|
+
var _a, _b, _c, _d;
|
|
317
317
|
const customizationsFromViewConfig = viewConfig.customizations;
|
|
318
318
|
const customizationsFromEmbedConfig = embedConfig.customizations
|
|
319
319
|
|| embedConfig.customisations;
|
|
@@ -325,6 +325,8 @@ const getCustomisations = (embedConfig, viewConfig) => {
|
|
|
325
325
|
...(_a = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _a === void 0 ? void 0 : _a.customCSS,
|
|
326
326
|
...(_b = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _b === void 0 ? void 0 : _b.customCSS,
|
|
327
327
|
},
|
|
328
|
+
customCSSUrl: ((_c = customizationsFromViewConfig === null || customizationsFromViewConfig === void 0 ? void 0 : customizationsFromViewConfig.style) === null || _c === void 0 ? void 0 : _c.customCSSUrl)
|
|
329
|
+
|| ((_d = customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.style) === null || _d === void 0 ? void 0 : _d.customCSSUrl),
|
|
328
330
|
},
|
|
329
331
|
content: {
|
|
330
332
|
...customizationsFromEmbedConfig === null || customizationsFromEmbedConfig === void 0 ? void 0 : customizationsFromEmbedConfig.content,
|
|
@@ -744,6 +746,28 @@ var HomepageModule;
|
|
|
744
746
|
* console.log('Drilldown event', drilldown);
|
|
745
747
|
* }));
|
|
746
748
|
* ```
|
|
749
|
+
*
|
|
750
|
+
* If you are using React components for embedding, you can register to any
|
|
751
|
+
* events from the `EmbedEvent` list by using the `on<EventName>` convention.
|
|
752
|
+
* For example,`onAlert`, `onCopyToClipboard` and so on.
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* ```js
|
|
756
|
+
* // ...
|
|
757
|
+
* const MyComponent = ({ dataSources }) => {
|
|
758
|
+
* const onLoad = () => {
|
|
759
|
+
* console.log(EmbedEvent.Load, {});
|
|
760
|
+
* };
|
|
761
|
+
*
|
|
762
|
+
* return (
|
|
763
|
+
* <SearchEmbed
|
|
764
|
+
* dataSources={dataSources}
|
|
765
|
+
* onLoad = {logEvent("Load")}
|
|
766
|
+
* />
|
|
767
|
+
* );
|
|
768
|
+
* };
|
|
769
|
+
* ```
|
|
770
|
+
*
|
|
747
771
|
* @group Events
|
|
748
772
|
*/
|
|
749
773
|
// eslint-disable-next-line no-shadow
|
|
@@ -1620,8 +1644,8 @@ var EmbedEvent;
|
|
|
1620
1644
|
* Prerequisite: Set isOnBeforeGetVizDataInterceptEnabled : true
|
|
1621
1645
|
* for this embed event to get emitted.
|
|
1622
1646
|
*
|
|
1623
|
-
*
|
|
1624
|
-
*
|
|
1647
|
+
* @param: payload
|
|
1648
|
+
* @param: responder
|
|
1625
1649
|
* Contains elements that lets developers define whether ThoughtSpot
|
|
1626
1650
|
* will run the search or not, and if not, which error message to provide.
|
|
1627
1651
|
*
|
|
@@ -1633,6 +1657,7 @@ var EmbedEvent;
|
|
|
1633
1657
|
*
|
|
1634
1658
|
* @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
|
|
1635
1659
|
*
|
|
1660
|
+
* @example
|
|
1636
1661
|
*```js
|
|
1637
1662
|
* .on(EmbedEvent.OnBeforeGetVizDataIntercept,
|
|
1638
1663
|
* (payload, responder) => {
|
|
@@ -1668,7 +1693,6 @@ var EmbedEvent;
|
|
|
1668
1693
|
* }})
|
|
1669
1694
|
* })
|
|
1670
1695
|
*```
|
|
1671
|
-
*
|
|
1672
1696
|
*/
|
|
1673
1697
|
EmbedEvent["OnBeforeGetVizDataIntercept"] = "onBeforeGetVizDataIntercept";
|
|
1674
1698
|
/**
|
|
@@ -1686,7 +1710,7 @@ var EmbedEvent;
|
|
|
1686
1710
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
1687
1711
|
/**
|
|
1688
1712
|
* Event types that can be triggered by the host application
|
|
1689
|
-
* to the embedded ThoughtSpot app
|
|
1713
|
+
* to the embedded ThoughtSpot app.
|
|
1690
1714
|
*
|
|
1691
1715
|
* To trigger an event use the corresponding
|
|
1692
1716
|
* {@link LiveboardEmbed.trigger} or {@link AppEmbed.trigger} or {@link
|
|
@@ -1703,6 +1727,40 @@ var EmbedEvent;
|
|
|
1703
1727
|
* { columnName: 'state, operator: RuntimeFilterOp.EQ, values: ['california']}
|
|
1704
1728
|
* ]);
|
|
1705
1729
|
* ```
|
|
1730
|
+
* @example
|
|
1731
|
+
* If using React components to embed, use the format shown in this example:
|
|
1732
|
+
*
|
|
1733
|
+
* ```js
|
|
1734
|
+
* const selectVizs = () => {
|
|
1735
|
+
* embedRef.current.trigger(HostEvent.SetVisibleVizs, [
|
|
1736
|
+
* "715e4613-c891-4884-be44-aa8d13701c06",
|
|
1737
|
+
* "3f84d633-e325-44b2-be25-c6650e5a49cf"
|
|
1738
|
+
* ]);
|
|
1739
|
+
* };
|
|
1740
|
+
* ```
|
|
1741
|
+
*
|
|
1742
|
+
*
|
|
1743
|
+
* You can also attach an Embed event to a Host event to trigger
|
|
1744
|
+
* a specific action as shown in this example:
|
|
1745
|
+
*
|
|
1746
|
+
* @example
|
|
1747
|
+
* ```js
|
|
1748
|
+
* const EmbeddedComponent = () => {
|
|
1749
|
+
* const embedRef = useRef(null); // import { useRef } from react
|
|
1750
|
+
* const onLiveboardRendered = () => {
|
|
1751
|
+
* embedRef.current.trigger(HostEvent.SetVisibleVizs, ['viz1', 'viz2']);
|
|
1752
|
+
* };
|
|
1753
|
+
*
|
|
1754
|
+
* return (
|
|
1755
|
+
* <LiveboardEmbed
|
|
1756
|
+
* ref={embedRef}
|
|
1757
|
+
* liveboardId="<liveboard-guid>"
|
|
1758
|
+
* onLiveboardRendered={onLiveboardRendered}
|
|
1759
|
+
* />
|
|
1760
|
+
* );
|
|
1761
|
+
* }
|
|
1762
|
+
* ```
|
|
1763
|
+
*
|
|
1706
1764
|
* @group Events
|
|
1707
1765
|
*/
|
|
1708
1766
|
// eslint-disable-next-line no-shadow
|
|
@@ -2398,10 +2456,23 @@ var HostEvent;
|
|
|
2398
2456
|
* filter: {
|
|
2399
2457
|
* column: "item type",
|
|
2400
2458
|
* oper: "IN",
|
|
2401
|
-
* values: ["bags","shirts"]
|
|
2459
|
+
* values: ["bags","shirts"]
|
|
2460
|
+
* }
|
|
2461
|
+
* });
|
|
2462
|
+
* ```
|
|
2463
|
+
* @example
|
|
2464
|
+
* ```js
|
|
2465
|
+
*
|
|
2466
|
+
* liveboardEmbed.trigger(HostEvent.UpdateFilters, {
|
|
2467
|
+
* filter: {
|
|
2468
|
+
* column: "date",
|
|
2469
|
+
* oper: "EQ",
|
|
2470
|
+
* values: ["JULY","2023"],
|
|
2471
|
+
* type: "MONTH_YEAR"
|
|
2402
2472
|
* }
|
|
2403
2473
|
* });
|
|
2404
2474
|
* ```
|
|
2475
|
+
*
|
|
2405
2476
|
* @example
|
|
2406
2477
|
*
|
|
2407
2478
|
* ```js
|
|
@@ -2419,7 +2490,8 @@ var HostEvent;
|
|
|
2419
2490
|
* {
|
|
2420
2491
|
* column: "Date",
|
|
2421
2492
|
* oper: 'EQ',
|
|
2422
|
-
* values: ["
|
|
2493
|
+
* values: ["2023-07-31"],
|
|
2494
|
+
* types: "EXACT_DATE"
|
|
2423
2495
|
* }]
|
|
2424
2496
|
* });
|
|
2425
2497
|
* ```
|
|
@@ -6309,7 +6381,11 @@ const getEmbedConfig = () => config;
|
|
|
6309
6381
|
const tokenizedFetch = async (input, init) => {
|
|
6310
6382
|
const embedConfig = getEmbedConfig();
|
|
6311
6383
|
if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
|
|
6312
|
-
return fetch(input,
|
|
6384
|
+
return fetch(input, {
|
|
6385
|
+
// ensure cookies are included for the non cookie-less api calls.
|
|
6386
|
+
credentials: 'include',
|
|
6387
|
+
...init,
|
|
6388
|
+
});
|
|
6313
6389
|
}
|
|
6314
6390
|
const req = new Request(input, init);
|
|
6315
6391
|
const authToken = await getAuthenticationToken(embedConfig);
|
|
@@ -6976,7 +7052,7 @@ const DEFAULT_EMBED_HEIGHT = '100%';
|
|
|
6976
7052
|
|
|
6977
7053
|
var Config = {
|
|
6978
7054
|
DEBUG: false,
|
|
6979
|
-
LIB_VERSION: '2.
|
|
7055
|
+
LIB_VERSION: '2.47.0'
|
|
6980
7056
|
};
|
|
6981
7057
|
|
|
6982
7058
|
// since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
|
|
@@ -7806,20 +7882,24 @@ _.utf8Encode = function(string) {
|
|
|
7806
7882
|
|
|
7807
7883
|
_.UUID = (function() {
|
|
7808
7884
|
|
|
7809
|
-
// Time
|
|
7810
|
-
// 1*new Date() is a cross browser version of Date.now()
|
|
7885
|
+
// Time-based entropy
|
|
7811
7886
|
var T = function() {
|
|
7812
|
-
var
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7887
|
+
var time = 1 * new Date(); // cross-browser version of Date.now()
|
|
7888
|
+
var ticks;
|
|
7889
|
+
if (window$1.performance && window$1.performance.now) {
|
|
7890
|
+
ticks = window$1.performance.now();
|
|
7891
|
+
} else {
|
|
7892
|
+
// fall back to busy loop
|
|
7893
|
+
ticks = 0;
|
|
7894
|
+
|
|
7895
|
+
// this while loop figures how many browser ticks go by
|
|
7896
|
+
// before 1*new Date() returns a new number, ie the amount
|
|
7897
|
+
// of ticks that go by per millisecond
|
|
7898
|
+
while (time == 1 * new Date()) {
|
|
7899
|
+
ticks++;
|
|
7900
|
+
}
|
|
7820
7901
|
}
|
|
7821
|
-
|
|
7822
|
-
return d.toString(16) + i.toString(16);
|
|
7902
|
+
return time.toString(16) + Math.floor(ticks).toString(16);
|
|
7823
7903
|
};
|
|
7824
7904
|
|
|
7825
7905
|
// Math.Random entropy
|
|
@@ -8386,21 +8466,42 @@ _.dom_query = (function() {
|
|
|
8386
8466
|
};
|
|
8387
8467
|
})();
|
|
8388
8468
|
|
|
8469
|
+
var CAMPAIGN_KEYWORDS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'];
|
|
8470
|
+
var CLICK_IDS = ['dclid', 'fbclid', 'gclid', 'ko_click_id', 'li_fat_id', 'msclkid', 'ttclid', 'twclid', 'wbraid'];
|
|
8471
|
+
|
|
8389
8472
|
_.info = {
|
|
8390
|
-
campaignParams: function() {
|
|
8391
|
-
var
|
|
8392
|
-
kw = '',
|
|
8473
|
+
campaignParams: function(default_value) {
|
|
8474
|
+
var kw = '',
|
|
8393
8475
|
params = {};
|
|
8394
|
-
_.each(
|
|
8476
|
+
_.each(CAMPAIGN_KEYWORDS, function(kwkey) {
|
|
8395
8477
|
kw = _.getQueryParam(document$1.URL, kwkey);
|
|
8396
8478
|
if (kw.length) {
|
|
8397
8479
|
params[kwkey] = kw;
|
|
8480
|
+
} else if (default_value !== undefined) {
|
|
8481
|
+
params[kwkey] = default_value;
|
|
8398
8482
|
}
|
|
8399
8483
|
});
|
|
8400
8484
|
|
|
8401
8485
|
return params;
|
|
8402
8486
|
},
|
|
8403
8487
|
|
|
8488
|
+
clickParams: function() {
|
|
8489
|
+
var id = '',
|
|
8490
|
+
params = {};
|
|
8491
|
+
_.each(CLICK_IDS, function(idkey) {
|
|
8492
|
+
id = _.getQueryParam(document$1.URL, idkey);
|
|
8493
|
+
if (id.length) {
|
|
8494
|
+
params[idkey] = id;
|
|
8495
|
+
}
|
|
8496
|
+
});
|
|
8497
|
+
|
|
8498
|
+
return params;
|
|
8499
|
+
},
|
|
8500
|
+
|
|
8501
|
+
marketingParams: function() {
|
|
8502
|
+
return _.extend(_.info.campaignParams(), _.info.clickParams());
|
|
8503
|
+
},
|
|
8504
|
+
|
|
8404
8505
|
searchEngine: function(referrer) {
|
|
8405
8506
|
if (referrer.search('https?://(.*)google.([^/?]*)') === 0) {
|
|
8406
8507
|
return 'google';
|
|
@@ -8597,12 +8698,13 @@ _.info = {
|
|
|
8597
8698
|
});
|
|
8598
8699
|
},
|
|
8599
8700
|
|
|
8600
|
-
|
|
8701
|
+
mpPageViewProperties: function() {
|
|
8601
8702
|
return _.strip_empty_properties({
|
|
8602
|
-
'
|
|
8603
|
-
'
|
|
8604
|
-
'
|
|
8605
|
-
'
|
|
8703
|
+
'current_page_title': document$1.title,
|
|
8704
|
+
'current_domain': window$1.location.hostname,
|
|
8705
|
+
'current_url_path': window$1.location.pathname,
|
|
8706
|
+
'current_url_protocol': window$1.location.protocol,
|
|
8707
|
+
'current_url_search': window$1.location.search
|
|
8606
8708
|
});
|
|
8607
8709
|
}
|
|
8608
8710
|
};
|
|
@@ -9269,6 +9371,9 @@ var RequestBatcher = function(storageKey, options) {
|
|
|
9269
9371
|
|
|
9270
9372
|
this.stopped = !this.libConfig['batch_autostart'];
|
|
9271
9373
|
this.consecutiveRemovalFailures = 0;
|
|
9374
|
+
|
|
9375
|
+
// extra client-side dedupe
|
|
9376
|
+
this.itemIdsSentSuccessfully = {};
|
|
9272
9377
|
};
|
|
9273
9378
|
|
|
9274
9379
|
/**
|
|
@@ -9361,7 +9466,34 @@ RequestBatcher.prototype.flush = function(options) {
|
|
|
9361
9466
|
payload = this.beforeSendHook(payload);
|
|
9362
9467
|
}
|
|
9363
9468
|
if (payload) {
|
|
9364
|
-
|
|
9469
|
+
// mp_sent_by_lib_version prop captures which lib version actually
|
|
9470
|
+
// sends each event (regardless of which version originally queued
|
|
9471
|
+
// it for sending)
|
|
9472
|
+
if (payload['event'] && payload['properties']) {
|
|
9473
|
+
payload['properties'] = _.extend(
|
|
9474
|
+
{},
|
|
9475
|
+
payload['properties'],
|
|
9476
|
+
{'mp_sent_by_lib_version': Config.LIB_VERSION}
|
|
9477
|
+
);
|
|
9478
|
+
}
|
|
9479
|
+
var addPayload = true;
|
|
9480
|
+
var itemId = item['id'];
|
|
9481
|
+
if (itemId) {
|
|
9482
|
+
if ((this.itemIdsSentSuccessfully[itemId] || 0) > 5) {
|
|
9483
|
+
this.reportError('[dupe] item ID sent too many times, not sending', {
|
|
9484
|
+
item: item,
|
|
9485
|
+
batchSize: batch.length,
|
|
9486
|
+
timesSent: this.itemIdsSentSuccessfully[itemId]
|
|
9487
|
+
});
|
|
9488
|
+
addPayload = false;
|
|
9489
|
+
}
|
|
9490
|
+
} else {
|
|
9491
|
+
this.reportError('[dupe] found item with no ID', {item: item});
|
|
9492
|
+
}
|
|
9493
|
+
|
|
9494
|
+
if (addPayload) {
|
|
9495
|
+
dataForRequest.push(payload);
|
|
9496
|
+
}
|
|
9365
9497
|
}
|
|
9366
9498
|
transformedItems[item['id']] = payload;
|
|
9367
9499
|
}, this);
|
|
@@ -9444,6 +9576,24 @@ RequestBatcher.prototype.flush = function(options) {
|
|
|
9444
9576
|
}
|
|
9445
9577
|
}, this)
|
|
9446
9578
|
);
|
|
9579
|
+
|
|
9580
|
+
// client-side dedupe
|
|
9581
|
+
_.each(batch, _.bind(function(item) {
|
|
9582
|
+
var itemId = item['id'];
|
|
9583
|
+
if (itemId) {
|
|
9584
|
+
this.itemIdsSentSuccessfully[itemId] = this.itemIdsSentSuccessfully[itemId] || 0;
|
|
9585
|
+
this.itemIdsSentSuccessfully[itemId]++;
|
|
9586
|
+
if (this.itemIdsSentSuccessfully[itemId] > 5) {
|
|
9587
|
+
this.reportError('[dupe] item ID sent too many times', {
|
|
9588
|
+
item: item,
|
|
9589
|
+
batchSize: batch.length,
|
|
9590
|
+
timesSent: this.itemIdsSentSuccessfully[itemId]
|
|
9591
|
+
});
|
|
9592
|
+
}
|
|
9593
|
+
} else {
|
|
9594
|
+
this.reportError('[dupe] found item with no ID while removing', {item: item});
|
|
9595
|
+
}
|
|
9596
|
+
}, this));
|
|
9447
9597
|
}
|
|
9448
9598
|
|
|
9449
9599
|
} catch(err) {
|
|
@@ -10289,24 +10439,25 @@ MixpanelPeople.prototype.union = addOptOutCheckMixpanelPeople(function(list_name
|
|
|
10289
10439
|
});
|
|
10290
10440
|
|
|
10291
10441
|
/*
|
|
10292
|
-
* Record that you have charged the current user a certain amount
|
|
10293
|
-
* of money. Charges recorded with track_charge() will appear in the
|
|
10294
|
-
* Mixpanel revenue report.
|
|
10295
|
-
*
|
|
10296
|
-
* ### Usage:
|
|
10297
|
-
*
|
|
10298
|
-
* // charge a user $50
|
|
10299
|
-
* mixpanel.people.track_charge(50);
|
|
10300
|
-
*
|
|
10301
|
-
* // charge a user $30.50 on the 2nd of january
|
|
10302
|
-
* mixpanel.people.track_charge(30.50, {
|
|
10303
|
-
* '$time': new Date('jan 1 2012')
|
|
10304
|
-
* });
|
|
10305
|
-
*
|
|
10306
|
-
* @param {Number} amount The amount of money charged to the current user
|
|
10307
|
-
* @param {Object} [properties] An associative array of properties associated with the charge
|
|
10308
|
-
* @param {Function} [callback] If provided, the callback will be called when the server responds
|
|
10309
|
-
|
|
10442
|
+
* Record that you have charged the current user a certain amount
|
|
10443
|
+
* of money. Charges recorded with track_charge() will appear in the
|
|
10444
|
+
* Mixpanel revenue report.
|
|
10445
|
+
*
|
|
10446
|
+
* ### Usage:
|
|
10447
|
+
*
|
|
10448
|
+
* // charge a user $50
|
|
10449
|
+
* mixpanel.people.track_charge(50);
|
|
10450
|
+
*
|
|
10451
|
+
* // charge a user $30.50 on the 2nd of january
|
|
10452
|
+
* mixpanel.people.track_charge(30.50, {
|
|
10453
|
+
* '$time': new Date('jan 1 2012')
|
|
10454
|
+
* });
|
|
10455
|
+
*
|
|
10456
|
+
* @param {Number} amount The amount of money charged to the current user
|
|
10457
|
+
* @param {Object} [properties] An associative array of properties associated with the charge
|
|
10458
|
+
* @param {Function} [callback] If provided, the callback will be called when the server responds
|
|
10459
|
+
* @deprecated
|
|
10460
|
+
*/
|
|
10310
10461
|
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(amount, properties, callback) {
|
|
10311
10462
|
if (!_.isNumber(amount)) {
|
|
10312
10463
|
amount = parseFloat(amount);
|
|
@@ -10322,15 +10473,16 @@ MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(am
|
|
|
10322
10473
|
});
|
|
10323
10474
|
|
|
10324
10475
|
/*
|
|
10325
|
-
* Permanently clear all revenue report transactions from the
|
|
10326
|
-
* current user's people analytics profile.
|
|
10327
|
-
*
|
|
10328
|
-
* ### Usage:
|
|
10329
|
-
*
|
|
10330
|
-
* mixpanel.people.clear_charges();
|
|
10331
|
-
*
|
|
10332
|
-
* @param {Function} [callback] If provided, the callback will be called after tracking the event.
|
|
10333
|
-
|
|
10476
|
+
* Permanently clear all revenue report transactions from the
|
|
10477
|
+
* current user's people analytics profile.
|
|
10478
|
+
*
|
|
10479
|
+
* ### Usage:
|
|
10480
|
+
*
|
|
10481
|
+
* mixpanel.people.clear_charges();
|
|
10482
|
+
*
|
|
10483
|
+
* @param {Function} [callback] If provided, the callback will be called after tracking the event.
|
|
10484
|
+
* @deprecated
|
|
10485
|
+
*/
|
|
10334
10486
|
MixpanelPeople.prototype.clear_charges = function(callback) {
|
|
10335
10487
|
return this.set('$transactions', [], callback);
|
|
10336
10488
|
};
|
|
@@ -10730,13 +10882,6 @@ MixpanelPersistence.prototype.unregister = function(prop) {
|
|
|
10730
10882
|
}
|
|
10731
10883
|
};
|
|
10732
10884
|
|
|
10733
|
-
MixpanelPersistence.prototype.update_campaign_params = function() {
|
|
10734
|
-
if (!this.campaign_params_saved) {
|
|
10735
|
-
this.register_once(_.info.campaignParams());
|
|
10736
|
-
this.campaign_params_saved = true;
|
|
10737
|
-
}
|
|
10738
|
-
};
|
|
10739
|
-
|
|
10740
10885
|
MixpanelPersistence.prototype.update_search_keyword = function(referrer) {
|
|
10741
10886
|
this.register(_.info.searchInfo(referrer));
|
|
10742
10887
|
};
|
|
@@ -11019,6 +11164,7 @@ var NOOP_FUNC = function() {};
|
|
|
11019
11164
|
/** @const */ var PRIMARY_INSTANCE_NAME = 'mixpanel';
|
|
11020
11165
|
/** @const */ var PAYLOAD_TYPE_BASE64 = 'base64';
|
|
11021
11166
|
/** @const */ var PAYLOAD_TYPE_JSON = 'json';
|
|
11167
|
+
/** @const */ var DEVICE_ID_PREFIX = '$device:';
|
|
11022
11168
|
|
|
11023
11169
|
|
|
11024
11170
|
/*
|
|
@@ -11060,6 +11206,9 @@ var DEFAULT_CONFIG = {
|
|
|
11060
11206
|
'cookie_domain': '',
|
|
11061
11207
|
'cookie_name': '',
|
|
11062
11208
|
'loaded': NOOP_FUNC,
|
|
11209
|
+
'track_marketing': true,
|
|
11210
|
+
'track_pageview': false,
|
|
11211
|
+
'skip_first_touch_marketing': false,
|
|
11063
11212
|
'store_google': true,
|
|
11064
11213
|
'save_referrer': true,
|
|
11065
11214
|
'test': false,
|
|
@@ -11126,6 +11275,25 @@ var create_mplib = function(token, config, name) {
|
|
|
11126
11275
|
instance['people'] = new MixpanelPeople();
|
|
11127
11276
|
instance['people']._init(instance);
|
|
11128
11277
|
|
|
11278
|
+
if (!instance.get_config('skip_first_touch_marketing')) {
|
|
11279
|
+
// We need null UTM params in the object because
|
|
11280
|
+
// UTM parameters act as a tuple. If any UTM param
|
|
11281
|
+
// is present, then we set all UTM params including
|
|
11282
|
+
// empty ones together
|
|
11283
|
+
var utm_params = _.info.campaignParams(null);
|
|
11284
|
+
var initial_utm_params = {};
|
|
11285
|
+
var has_utm = false;
|
|
11286
|
+
_.each(utm_params, function(utm_value, utm_key) {
|
|
11287
|
+
initial_utm_params['initial_' + utm_key] = utm_value;
|
|
11288
|
+
if (utm_value) {
|
|
11289
|
+
has_utm = true;
|
|
11290
|
+
}
|
|
11291
|
+
});
|
|
11292
|
+
if (has_utm) {
|
|
11293
|
+
instance['people'].set_once(initial_utm_params);
|
|
11294
|
+
}
|
|
11295
|
+
}
|
|
11296
|
+
|
|
11129
11297
|
// if any instance on the page has debug = true, we set the
|
|
11130
11298
|
// global debug to be true
|
|
11131
11299
|
Config.DEBUG = Config.DEBUG || instance.get_config('debug');
|
|
@@ -11157,7 +11325,7 @@ var create_mplib = function(token, config, name) {
|
|
|
11157
11325
|
* mixpanel.library_name.track(...);
|
|
11158
11326
|
*
|
|
11159
11327
|
* @param {String} token Your Mixpanel API token
|
|
11160
|
-
* @param {Object} [config] A dictionary of config options to override. <a href="https://github.com/mixpanel/mixpanel-js/blob/
|
|
11328
|
+
* @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>.
|
|
11161
11329
|
* @param {String} [name] The name for the new mixpanel instance that you want created
|
|
11162
11330
|
*/
|
|
11163
11331
|
MixpanelLib.prototype.init = function (token, config, name) {
|
|
@@ -11195,7 +11363,7 @@ MixpanelLib.prototype._init = function(token, config, name) {
|
|
|
11195
11363
|
// default to JSON payload for standard mixpanel.com API hosts
|
|
11196
11364
|
if (!('api_payload_format' in config)) {
|
|
11197
11365
|
var api_host = config['api_host'] || DEFAULT_CONFIG['api_host'];
|
|
11198
|
-
if (api_host.match(/\.mixpanel\.com
|
|
11366
|
+
if (api_host.match(/\.mixpanel\.com/)) {
|
|
11199
11367
|
variable_features['api_payload_format'] = PAYLOAD_TYPE_JSON;
|
|
11200
11368
|
}
|
|
11201
11369
|
}
|
|
@@ -11266,10 +11434,14 @@ MixpanelLib.prototype._init = function(token, config, name) {
|
|
|
11266
11434
|
// or the device id if something was already stored
|
|
11267
11435
|
// in the persitence
|
|
11268
11436
|
this.register_once({
|
|
11269
|
-
'distinct_id': uuid,
|
|
11437
|
+
'distinct_id': DEVICE_ID_PREFIX + uuid,
|
|
11270
11438
|
'$device_id': uuid
|
|
11271
11439
|
}, '');
|
|
11272
11440
|
}
|
|
11441
|
+
|
|
11442
|
+
if (this.get_config('track_pageview')) {
|
|
11443
|
+
this.track_pageview();
|
|
11444
|
+
}
|
|
11273
11445
|
};
|
|
11274
11446
|
|
|
11275
11447
|
// Private methods
|
|
@@ -11283,7 +11455,7 @@ MixpanelLib.prototype._loaded = function() {
|
|
|
11283
11455
|
MixpanelLib.prototype._set_default_superprops = function() {
|
|
11284
11456
|
this['persistence'].update_search_keyword(document$1.referrer);
|
|
11285
11457
|
if (this.get_config('store_google')) {
|
|
11286
|
-
this
|
|
11458
|
+
this.register(_.info.campaignParams(), {persistent: false});
|
|
11287
11459
|
}
|
|
11288
11460
|
if (this.get_config('save_referrer')) {
|
|
11289
11461
|
this['persistence'].update_referrer_info(document$1.referrer);
|
|
@@ -11765,6 +11937,10 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
|
|
|
11765
11937
|
|
|
11766
11938
|
this._set_default_superprops();
|
|
11767
11939
|
|
|
11940
|
+
var marketing_properties = this.get_config('track_marketing')
|
|
11941
|
+
? _.info.marketingParams()
|
|
11942
|
+
: {};
|
|
11943
|
+
|
|
11768
11944
|
// note: extend writes to the first object, so lets make sure we
|
|
11769
11945
|
// don't write to the persistence properties object and info
|
|
11770
11946
|
// properties object by passing in a new object
|
|
@@ -11773,6 +11949,7 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
|
|
|
11773
11949
|
properties = _.extend(
|
|
11774
11950
|
{},
|
|
11775
11951
|
_.info.properties(),
|
|
11952
|
+
marketing_properties,
|
|
11776
11953
|
this['persistence'].properties(),
|
|
11777
11954
|
this.unpersisted_superprops,
|
|
11778
11955
|
properties
|
|
@@ -11933,17 +12110,54 @@ MixpanelLib.prototype.get_group = function (group_key, group_id) {
|
|
|
11933
12110
|
};
|
|
11934
12111
|
|
|
11935
12112
|
/**
|
|
11936
|
-
* Track
|
|
12113
|
+
* Track a default Mixpanel page view event, which includes extra default event properties to
|
|
12114
|
+
* improve page view data. The `config.track_pageview` option for <a href="#mixpanelinit">mixpanel.init()</a>
|
|
12115
|
+
* may be turned on for tracking page loads automatically.
|
|
11937
12116
|
*
|
|
11938
|
-
*
|
|
11939
|
-
*
|
|
12117
|
+
* ### Usage
|
|
12118
|
+
*
|
|
12119
|
+
* // track a default $mp_web_page_view event
|
|
12120
|
+
* mixpanel.track_pageview();
|
|
12121
|
+
*
|
|
12122
|
+
* // track a page view event with additional event properties
|
|
12123
|
+
* mixpanel.track_pageview({'ab_test_variant': 'card-layout-b'});
|
|
12124
|
+
*
|
|
12125
|
+
* // example approach to track page views on different page types as event properties
|
|
12126
|
+
* mixpanel.track_pageview({'page': 'pricing'});
|
|
12127
|
+
* mixpanel.track_pageview({'page': 'homepage'});
|
|
12128
|
+
*
|
|
12129
|
+
* // UNCOMMON: Tracking a page view event with a custom event_name option. NOT expected to be used for
|
|
12130
|
+
* // individual pages on the same site or product. Use cases for custom event_name may be page
|
|
12131
|
+
* // views on different products or internal applications that are considered completely separate
|
|
12132
|
+
* mixpanel.track_pageview({'page': 'customer-search'}, {'event_name': '[internal] Admin Page View'});
|
|
12133
|
+
*
|
|
12134
|
+
* @param {Object} [properties] An optional set of additional properties to send with the page view event
|
|
12135
|
+
* @param {Object} [options] Page view tracking options
|
|
12136
|
+
* @param {String} [options.event_name] - Alternate name for the tracking event
|
|
12137
|
+
* @returns {Boolean|Object} If the tracking request was successfully initiated/queued, an object
|
|
12138
|
+
* with the tracking payload sent to the API server is returned; otherwise false.
|
|
11940
12139
|
*/
|
|
11941
|
-
MixpanelLib.prototype.track_pageview = function(
|
|
11942
|
-
if (
|
|
11943
|
-
|
|
12140
|
+
MixpanelLib.prototype.track_pageview = addOptOutCheckMixpanelLib(function(properties, options) {
|
|
12141
|
+
if (typeof properties !== 'object') {
|
|
12142
|
+
properties = {};
|
|
11944
12143
|
}
|
|
11945
|
-
|
|
11946
|
-
|
|
12144
|
+
options = options || {};
|
|
12145
|
+
var event_name = options['event_name'] || '$mp_web_page_view';
|
|
12146
|
+
|
|
12147
|
+
var default_page_properties = _.extend(
|
|
12148
|
+
_.info.mpPageViewProperties(),
|
|
12149
|
+
_.info.campaignParams(),
|
|
12150
|
+
_.info.clickParams()
|
|
12151
|
+
);
|
|
12152
|
+
|
|
12153
|
+
var event_properties = _.extend(
|
|
12154
|
+
{},
|
|
12155
|
+
default_page_properties,
|
|
12156
|
+
properties
|
|
12157
|
+
);
|
|
12158
|
+
|
|
12159
|
+
return this.track(event_name, event_properties);
|
|
12160
|
+
});
|
|
11947
12161
|
|
|
11948
12162
|
/**
|
|
11949
12163
|
* Track clicks on a set of document elements. Selector must be a
|
|
@@ -12192,7 +12406,15 @@ MixpanelLib.prototype.identify = function(
|
|
|
12192
12406
|
// _unset_callback:function A callback to be run if and when the People unset queue is flushed
|
|
12193
12407
|
|
|
12194
12408
|
var previous_distinct_id = this.get_distinct_id();
|
|
12195
|
-
|
|
12409
|
+
if (new_distinct_id && previous_distinct_id !== new_distinct_id) {
|
|
12410
|
+
// we allow the following condition if previous distinct_id is same as new_distinct_id
|
|
12411
|
+
// so that you can force flush people updates for anonymous profiles.
|
|
12412
|
+
if (typeof new_distinct_id === 'string' && new_distinct_id.indexOf(DEVICE_ID_PREFIX) === 0) {
|
|
12413
|
+
this.report_error('distinct_id cannot have $device: prefix');
|
|
12414
|
+
return -1;
|
|
12415
|
+
}
|
|
12416
|
+
this.register({'$user_id': new_distinct_id});
|
|
12417
|
+
}
|
|
12196
12418
|
|
|
12197
12419
|
if (!this.get_property('$device_id')) {
|
|
12198
12420
|
// The persisted distinct id might not actually be a device id at all
|
|
@@ -12233,7 +12455,7 @@ MixpanelLib.prototype.reset = function() {
|
|
|
12233
12455
|
this._flags.identify_called = false;
|
|
12234
12456
|
var uuid = _.UUID();
|
|
12235
12457
|
this.register_once({
|
|
12236
|
-
'distinct_id': uuid,
|
|
12458
|
+
'distinct_id': DEVICE_ID_PREFIX + uuid,
|
|
12237
12459
|
'$device_id': uuid
|
|
12238
12460
|
}, '');
|
|
12239
12461
|
};
|
|
@@ -12358,8 +12580,8 @@ MixpanelLib.prototype.name_tag = function(name_tag) {
|
|
|
12358
12580
|
* // batching or retry mechanisms.
|
|
12359
12581
|
* api_transport: 'XHR'
|
|
12360
12582
|
*
|
|
12361
|
-
* //
|
|
12362
|
-
* batch_requests:
|
|
12583
|
+
* // request-batching/queueing/retry
|
|
12584
|
+
* batch_requests: true,
|
|
12363
12585
|
*
|
|
12364
12586
|
* // maximum number of events/updates to send in a single
|
|
12365
12587
|
* // network request
|
|
@@ -12431,10 +12653,20 @@ MixpanelLib.prototype.name_tag = function(name_tag) {
|
|
|
12431
12653
|
* // secure, meaning they will only be transmitted over https
|
|
12432
12654
|
* secure_cookie: false
|
|
12433
12655
|
*
|
|
12656
|
+
* // disables enriching user profiles with first touch marketing data
|
|
12657
|
+
* skip_first_touch_marketing: false
|
|
12658
|
+
*
|
|
12434
12659
|
* // the amount of time track_links will
|
|
12435
12660
|
* // wait for Mixpanel's servers to respond
|
|
12436
12661
|
* track_links_timeout: 300
|
|
12437
12662
|
*
|
|
12663
|
+
* // adds any UTM parameters and click IDs present on the page to any events fired
|
|
12664
|
+
* track_marketing: true
|
|
12665
|
+
*
|
|
12666
|
+
* // enables automatic page view tracking using default page view events through
|
|
12667
|
+
* // the track_pageview() method
|
|
12668
|
+
* track_pageview: false
|
|
12669
|
+
*
|
|
12438
12670
|
* // if you set upgrade to be true, the library will check for
|
|
12439
12671
|
* // a cookie from our old js library and import super
|
|
12440
12672
|
* // properties from it, then the old cookie is deleted
|
|
@@ -14048,7 +14280,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
14048
14280
|
});
|
|
14049
14281
|
}
|
|
14050
14282
|
|
|
14051
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.32.
|
|
14283
|
+
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={".":{"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};
|
|
14052
14284
|
|
|
14053
14285
|
/**
|
|
14054
14286
|
* Copyright (c) 2022
|