@thoughtspot/visual-embed-sdk 1.42.1-alpha.7 → 1.42.1
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 +4 -3
- package/cjs/src/embed/app.d.ts +20 -0
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +5 -4
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +32 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +1 -11
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js +0 -1
- package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts +3 -3
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.js +6 -6
- package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +1 -3
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +1 -3
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +16 -44
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +0 -2
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +3 -3
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +1 -2
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/react/all-types-export.d.ts +1 -2
- package/cjs/src/react/all-types-export.d.ts.map +1 -1
- package/cjs/src/react/all-types-export.js +3 -3
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/react/all-types-export.spec.js +0 -8
- package/cjs/src/react/all-types-export.spec.js.map +1 -1
- package/cjs/src/react/index.d.ts +1 -2
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +2 -1
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/util.d.ts +1 -0
- package/cjs/src/react/util.d.ts.map +1 -1
- package/cjs/src/types.d.ts +105 -143
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +103 -98
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/processData.d.ts +1 -1
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +8 -8
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils/processTrigger.d.ts +2 -1
- package/cjs/src/utils/processTrigger.d.ts.map +1 -1
- package/cjs/src/utils/processTrigger.js +4 -2
- package/cjs/src/utils/processTrigger.js.map +1 -1
- package/dist/{index-DvNA626T.js → index-CWQnMX2L.js} +1 -1
- package/dist/src/embed/app.d.ts +20 -0
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts +1 -11
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/host-event-client.d.ts +3 -3
- package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +1 -3
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/react/all-types-export.d.ts +1 -2
- package/dist/src/react/all-types-export.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +1 -2
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/react/util.d.ts +1 -0
- package/dist/src/react/util.d.ts.map +1 -1
- package/dist/src/types.d.ts +105 -143
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/processData.d.ts +1 -1
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/src/utils/processTrigger.d.ts +2 -1
- package/dist/src/utils/processTrigger.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +157 -280
- package/dist/tsembed-react.js +301 -500
- package/dist/tsembed.es.js +156 -280
- package/dist/tsembed.js +299 -499
- package/dist/visual-embed-sdk-react-full.d.ts +129 -160
- package/dist/visual-embed-sdk-react.d.ts +129 -157
- package/dist/visual-embed-sdk.d.ts +129 -160
- package/lib/package.json +4 -3
- package/lib/src/embed/app.d.ts +20 -0
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +5 -4
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +32 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +1 -11
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js +0 -1
- package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.d.ts +3 -3
- package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.js +6 -6
- package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +1 -3
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +1 -3
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +16 -44
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +0 -2
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +3 -3
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/react/all-types-export.d.ts +1 -2
- package/lib/src/react/all-types-export.d.ts.map +1 -1
- package/lib/src/react/all-types-export.js +2 -2
- package/lib/src/react/all-types-export.js.map +1 -1
- package/lib/src/react/all-types-export.spec.js +0 -8
- package/lib/src/react/all-types-export.spec.js.map +1 -1
- package/lib/src/react/index.d.ts +1 -2
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +4 -3
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/util.d.ts +1 -0
- package/lib/src/react/util.d.ts.map +1 -1
- package/lib/src/types.d.ts +105 -143
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +102 -97
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/processData.d.ts +1 -1
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +8 -8
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +2 -1
- package/lib/src/utils/processTrigger.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.js +4 -2
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/package.json +4 -3
- package/src/embed/app.spec.ts +45 -0
- package/src/embed/app.ts +26 -4
- package/src/embed/hostEventClient/contracts.ts +0 -10
- package/src/embed/hostEventClient/host-event-client.ts +7 -3
- package/src/embed/search.ts +1 -3
- package/src/embed/ts-embed.spec.ts +7 -9
- package/src/embed/ts-embed.ts +33 -68
- package/src/index.ts +3 -4
- package/src/react/all-types-export.spec.ts +1 -9
- package/src/react/all-types-export.ts +6 -10
- package/src/react/index.tsx +130 -155
- package/src/types.ts +104 -145
- package/src/utils/processData.spec.ts +1 -0
- package/src/utils/processData.ts +11 -11
- package/src/utils/processTrigger.ts +5 -2
- package/cjs/src/api-intercept.d.ts +0 -31
- package/cjs/src/api-intercept.d.ts.map +0 -1
- package/cjs/src/api-intercept.js +0 -119
- package/cjs/src/api-intercept.js.map +0 -1
- package/cjs/src/api-intercept.spec.d.ts +0 -2
- package/cjs/src/api-intercept.spec.d.ts.map +0 -1
- package/cjs/src/api-intercept.spec.js +0 -122
- package/cjs/src/api-intercept.spec.js.map +0 -1
- package/dist/index-BCC3Z072.js +0 -7371
- package/dist/index-BEzW4MDA.js +0 -7371
- package/dist/index-BaESA9rq.js +0 -7371
- package/dist/index-CFNZIcKr.js +0 -7447
- package/dist/index-CqKTa1Fe.js +0 -7447
- package/dist/index-DFnPKcjZ.js +0 -7447
- package/dist/index-DhFH7b7U.js +0 -7447
- package/dist/src/api-intercept.d.ts +0 -31
- package/dist/src/api-intercept.d.ts.map +0 -1
- package/dist/src/api-intercept.spec.d.ts +0 -2
- package/dist/src/api-intercept.spec.d.ts.map +0 -1
- package/lib/src/api-intercept.d.ts +0 -31
- package/lib/src/api-intercept.d.ts.map +0 -1
- package/lib/src/api-intercept.js +0 -112
- package/lib/src/api-intercept.js.map +0 -1
- package/lib/src/api-intercept.spec.d.ts +0 -2
- package/lib/src/api-intercept.spec.d.ts.map +0 -1
- package/lib/src/api-intercept.spec.js +0 -119
- package/lib/src/api-intercept.spec.js.map +0 -1
- package/src/api-intercept.ts +0 -139
package/dist/tsembed.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.42.1
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.42.1 */
|
|
2
2
|
'use client';
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
|
@@ -916,7 +916,7 @@ var EmbedEvent;
|
|
|
916
916
|
*/
|
|
917
917
|
EmbedEvent["Load"] = "load";
|
|
918
918
|
/**
|
|
919
|
-
* Data pertaining to an Answer or
|
|
919
|
+
* Data pertaining to an Answer, Liveboard or Spotter visualization is received.
|
|
920
920
|
* The event payload includes the raw data of the object.
|
|
921
921
|
* @return data - Answer of Liveboard data
|
|
922
922
|
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
@@ -1999,21 +1999,6 @@ var EmbedEvent;
|
|
|
1999
1999
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
2000
2000
|
*/
|
|
2001
2001
|
EmbedEvent["OrgSwitched"] = "orgSwitched";
|
|
2002
|
-
/**
|
|
2003
|
-
* Emitted when the user intercepts a URL.
|
|
2004
|
-
*
|
|
2005
|
-
* Supported on all embed types.
|
|
2006
|
-
*
|
|
2007
|
-
* @example
|
|
2008
|
-
* ```js
|
|
2009
|
-
* embed.on(EmbedEvent.ApiIntercept, (payload) => {
|
|
2010
|
-
* console.log('payload', payload);
|
|
2011
|
-
* })
|
|
2012
|
-
* ```
|
|
2013
|
-
*
|
|
2014
|
-
* @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
|
|
2015
|
-
*/
|
|
2016
|
-
EmbedEvent["ApiIntercept"] = "ApiIntercept";
|
|
2017
2002
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
2018
2003
|
/**
|
|
2019
2004
|
* Event types that can be triggered by the host application
|
|
@@ -2302,7 +2287,7 @@ var HostEvent;
|
|
|
2302
2287
|
* the following parameters:
|
|
2303
2288
|
*
|
|
2304
2289
|
* @param
|
|
2305
|
-
* `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
|
|
2290
|
+
* `vizId`- GUID of the saved Answer or Spotter visualization ID to pin to a Liveboard.
|
|
2306
2291
|
* Optional when pinning a new chart or table generated from a Search query.
|
|
2307
2292
|
* **Required** in Spotter Embed.
|
|
2308
2293
|
* @param
|
|
@@ -2354,10 +2339,16 @@ var HostEvent;
|
|
|
2354
2339
|
* ```
|
|
2355
2340
|
* @example
|
|
2356
2341
|
* ```js
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2342
|
+
|
|
2343
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
|
|
2344
|
+
* let latestSpotterVizId = '';
|
|
2345
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2346
|
+
* latestSpotterVizId = payload.data.id;
|
|
2347
|
+
* });
|
|
2348
|
+
*
|
|
2349
|
+
* spotterEmbed.trigger(HostEvent.Pin, { vizId: latestSpotterVizId });
|
|
2350
|
+
* ```
|
|
2351
|
+
*
|
|
2361
2352
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2362
2353
|
*/
|
|
2363
2354
|
HostEvent["Pin"] = "pin";
|
|
@@ -2432,10 +2423,15 @@ var HostEvent;
|
|
|
2432
2423
|
* ```
|
|
2433
2424
|
* @example
|
|
2434
2425
|
* ```js
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2426
|
+
|
|
2427
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPdf host event.
|
|
2428
|
+
* let latestSpotterVizId = '';
|
|
2429
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2430
|
+
* latestSpotterVizId = payload.data.id;
|
|
2431
|
+
* });
|
|
2432
|
+
*
|
|
2433
|
+
* spotterEmbed.trigger(HostEvent.DownloadAsPdf, { vizId: latestSpotterVizId });
|
|
2434
|
+
* ```
|
|
2439
2435
|
*
|
|
2440
2436
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2441
2437
|
*/
|
|
@@ -2462,10 +2458,14 @@ var HostEvent;
|
|
|
2462
2458
|
* ```
|
|
2463
2459
|
* @example
|
|
2464
2460
|
* ```js
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2461
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in MakeACopy host event.
|
|
2462
|
+
* let latestSpotterVizId = '';
|
|
2463
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2464
|
+
* latestSpotterVizId = payload.data.id;
|
|
2465
|
+
* });
|
|
2466
|
+
*
|
|
2467
|
+
* spotterEmbed.trigger(HostEvent.MakeACopy, { vizId: latestSpotterVizId });
|
|
2468
|
+
* ```
|
|
2469
2469
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2470
2470
|
*/
|
|
2471
2471
|
HostEvent["MakeACopy"] = "makeACopy";
|
|
@@ -2550,15 +2550,7 @@ var HostEvent;
|
|
|
2550
2550
|
* ```
|
|
2551
2551
|
* @example
|
|
2552
2552
|
* ```js
|
|
2553
|
-
*
|
|
2554
|
-
* vizId:'730496d6-6903-4601-937e-2c691821af3c'
|
|
2555
|
-
* });
|
|
2556
|
-
* ```
|
|
2557
|
-
* @example
|
|
2558
|
-
* ```js
|
|
2559
|
-
* const editResponse = await spotterEmbed.trigger(HostEvent.Edit, {
|
|
2560
|
-
* vizId:'730496d6-6903-4601-937e-2c691821af3c'
|
|
2561
|
-
* });
|
|
2553
|
+
* spotterEmbed.trigger(HostEvent.Edit);
|
|
2562
2554
|
* ```
|
|
2563
2555
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2564
2556
|
*/
|
|
@@ -2607,16 +2599,23 @@ var HostEvent;
|
|
|
2607
2599
|
* );
|
|
2608
2600
|
* })
|
|
2609
2601
|
* ```
|
|
2610
|
-
* @example
|
|
2602
|
+
* * @example
|
|
2611
2603
|
* ```js
|
|
2612
|
-
|
|
2613
|
-
|
|
2604
|
+
|
|
2605
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
|
|
2606
|
+
* let latestSpotterVizId = '';
|
|
2607
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2608
|
+
* latestSpotterVizId = payload.data.id;
|
|
2609
|
+
* });
|
|
2610
|
+
*
|
|
2611
|
+
* spotterEmbed.trigger(HostEvent.GetTML, {
|
|
2612
|
+
* vizId: latestSpotterVizId
|
|
2614
2613
|
* }).then((tml) => {
|
|
2615
2614
|
* console.log(
|
|
2616
2615
|
* tml.answer.search_query // TML representation of the search query
|
|
2617
2616
|
* );
|
|
2618
2617
|
* })
|
|
2619
|
-
|
|
2618
|
+
* ```
|
|
2620
2619
|
* @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1.sw
|
|
2621
2620
|
* @important
|
|
2622
2621
|
*/
|
|
@@ -2680,7 +2679,7 @@ var HostEvent;
|
|
|
2680
2679
|
/**
|
|
2681
2680
|
* Trigger the **Download** action on charts in
|
|
2682
2681
|
* the embedded view.
|
|
2683
|
-
* @param - `vizId` refers to the
|
|
2682
|
+
* @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
|
|
2684
2683
|
* @example
|
|
2685
2684
|
* ```js
|
|
2686
2685
|
* liveboardEmbed.trigger(HostEvent.Download, {vizId:
|
|
@@ -2690,10 +2689,14 @@ var HostEvent;
|
|
|
2690
2689
|
* embed.trigger(HostEvent.Download)
|
|
2691
2690
|
* ```
|
|
2692
2691
|
* ```js
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2692
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in Download host event.
|
|
2693
|
+
* let latestSpotterVizId = '';
|
|
2694
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2695
|
+
* latestSpotterVizId = payload.data.id;
|
|
2696
|
+
* });
|
|
2697
|
+
*
|
|
2698
|
+
* spotterEmbed.trigger(HostEvent.Download, { vizId: latestSpotterVizId });
|
|
2699
|
+
* ```
|
|
2697
2700
|
* @deprecated from SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl ,9.4.1.sw
|
|
2698
2701
|
* Use {@link DownloadAsPng}
|
|
2699
2702
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
|
|
@@ -2711,9 +2714,13 @@ var HostEvent;
|
|
|
2711
2714
|
*
|
|
2712
2715
|
* searchEmbed.trigger(HostEvent.DownloadAsPng)
|
|
2713
2716
|
*
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPng host event.
|
|
2718
|
+
* let latestSpotterVizId = '';
|
|
2719
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2720
|
+
* latestSpotterVizId = payload.data.id;
|
|
2721
|
+
* });
|
|
2722
|
+
*
|
|
2723
|
+
* spotterEmbed.trigger(HostEvent.DownloadAsPng, { vizId: latestSpotterVizId });
|
|
2717
2724
|
* ```
|
|
2718
2725
|
*
|
|
2719
2726
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1.sw
|
|
@@ -2722,7 +2729,7 @@ var HostEvent;
|
|
|
2722
2729
|
/**
|
|
2723
2730
|
* Trigger the **Download** > **CSV** action on tables in
|
|
2724
2731
|
* the embedded view.
|
|
2725
|
-
* @param - `vizId` refers to the
|
|
2732
|
+
* @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
|
|
2726
2733
|
* @example
|
|
2727
2734
|
* ```js
|
|
2728
2735
|
* liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
|
|
@@ -2735,9 +2742,13 @@ var HostEvent;
|
|
|
2735
2742
|
* searchEmbed.trigger(HostEvent.DownloadAsCsv)
|
|
2736
2743
|
* ```
|
|
2737
2744
|
* ```js
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2745
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsCsv host event.
|
|
2746
|
+
* let latestSpotterVizId = '';
|
|
2747
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2748
|
+
* latestSpotterVizId = payload.data.id;
|
|
2749
|
+
* });
|
|
2750
|
+
*
|
|
2751
|
+
* spotterEmbed.trigger(HostEvent.DownloadAsCsv, { vizId: latestSpotterVizId });
|
|
2741
2752
|
* ```
|
|
2742
2753
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
|
|
2743
2754
|
*/
|
|
@@ -2745,7 +2756,7 @@ var HostEvent;
|
|
|
2745
2756
|
/**
|
|
2746
2757
|
* Trigger the **Download** > **XLSX** action on tables
|
|
2747
2758
|
* in the embedded view.
|
|
2748
|
-
* @param - `vizId` refers to the
|
|
2759
|
+
* @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
|
|
2749
2760
|
* @example
|
|
2750
2761
|
* ```js
|
|
2751
2762
|
* liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
|
|
@@ -2758,9 +2769,13 @@ var HostEvent;
|
|
|
2758
2769
|
* searchEmbed.trigger(HostEvent.DownloadAsXlsx)
|
|
2759
2770
|
* ```
|
|
2760
2771
|
* ```js
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2772
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsXlsx host event.
|
|
2773
|
+
* let latestSpotterVizId = '';
|
|
2774
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2775
|
+
* latestSpotterVizId = payload.data.id;
|
|
2776
|
+
* });
|
|
2777
|
+
*
|
|
2778
|
+
* spotterEmbed.trigger(HostEvent.DownloadAsXlsx, { vizId: latestSpotterVizId });
|
|
2764
2779
|
* ```
|
|
2765
2780
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
|
|
2766
2781
|
*/
|
|
@@ -2797,7 +2812,7 @@ var HostEvent;
|
|
|
2797
2812
|
* ```
|
|
2798
2813
|
*
|
|
2799
2814
|
* ```js
|
|
2800
|
-
* // Save
|
|
2815
|
+
* // Save a Visualization in Spotter (requires vizId)
|
|
2801
2816
|
* spotterEmbed.trigger(HostEvent.Save, {
|
|
2802
2817
|
* vizId: "730496d6-6903-4601-937e-2c691821af3c"
|
|
2803
2818
|
* })
|
|
@@ -3119,11 +3134,13 @@ var HostEvent;
|
|
|
3119
3134
|
* });
|
|
3120
3135
|
*```
|
|
3121
3136
|
*```js
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3137
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in GetParameters host event.
|
|
3138
|
+
* let latestSpotterVizId = '';
|
|
3139
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3140
|
+
* latestSpotterVizId = payload.data.id;
|
|
3141
|
+
* });
|
|
3142
|
+
*
|
|
3143
|
+
* spotterEmbed.trigger(HostEvent.GetParameters, { vizId: latestSpotterVizId });
|
|
3127
3144
|
*```
|
|
3128
3145
|
* @version SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
|
|
3129
3146
|
*/
|
|
@@ -3166,11 +3183,13 @@ var HostEvent;
|
|
|
3166
3183
|
* ```
|
|
3167
3184
|
* @example
|
|
3168
3185
|
* ```js
|
|
3169
|
-
*
|
|
3170
|
-
*
|
|
3171
|
-
*
|
|
3172
|
-
*
|
|
3186
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in SaveAnswer host event.
|
|
3187
|
+
* let latestSpotterVizId = '';
|
|
3188
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3189
|
+
* latestSpotterVizId = payload.data.id;
|
|
3173
3190
|
* });
|
|
3191
|
+
*
|
|
3192
|
+
* spotterEmbed.trigger(HostEvent.SaveAnswer, { vizId: latestSpotterVizId });
|
|
3174
3193
|
* ```
|
|
3175
3194
|
* @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
|
|
3176
3195
|
*/
|
|
@@ -3254,12 +3273,15 @@ var HostEvent;
|
|
|
3254
3273
|
HostEvent["DeleteLastPrompt"] = "DeleteLastPrompt";
|
|
3255
3274
|
/**
|
|
3256
3275
|
* Toggle the visualization to chart or table view.
|
|
3257
|
-
* @param - `vizId ` refers to the
|
|
3276
|
+
* @param - `vizId ` refers to the Visualization ID in Spotter embed and is required.
|
|
3258
3277
|
* @example
|
|
3259
3278
|
* ```js
|
|
3260
|
-
*
|
|
3261
|
-
*
|
|
3279
|
+
* let latestSpotterVizId = '';
|
|
3280
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3281
|
+
* latestSpotterVizId = payload.data.id;
|
|
3262
3282
|
* });
|
|
3283
|
+
*
|
|
3284
|
+
* spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, { vizId: latestSpotterVizId });
|
|
3263
3285
|
*```
|
|
3264
3286
|
* @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
3265
3287
|
*/
|
|
@@ -3288,12 +3310,16 @@ var HostEvent;
|
|
|
3288
3310
|
*/
|
|
3289
3311
|
HostEvent["VisibleEmbedCoordinates"] = "visibleEmbedCoordinates";
|
|
3290
3312
|
/**
|
|
3291
|
-
* Trigger the *
|
|
3292
|
-
* @param - `vizId` refers to the
|
|
3313
|
+
* Trigger the *Spotter* action for visualizations present on the liveboard's vizzes.
|
|
3314
|
+
* @param - `vizId` refers to the Visualization ID in Spotter embed and is required.
|
|
3293
3315
|
* @example
|
|
3294
3316
|
* ```js
|
|
3295
|
-
*
|
|
3296
|
-
* {
|
|
3317
|
+
* let latestSpotterVizId = '';
|
|
3318
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3319
|
+
* latestSpotterVizId = payload.data.id;
|
|
3320
|
+
* });
|
|
3321
|
+
*
|
|
3322
|
+
* spotterEmbed.trigger(HostEvent.AskSpotter, { vizId: latestSpotterVizId });
|
|
3297
3323
|
* ```
|
|
3298
3324
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
3299
3325
|
*/
|
|
@@ -3351,6 +3377,7 @@ var Param;
|
|
|
3351
3377
|
Param["HideResult"] = "hideResult";
|
|
3352
3378
|
Param["UseLastSelectedDataSource"] = "useLastSelectedSources";
|
|
3353
3379
|
Param["Tag"] = "tag";
|
|
3380
|
+
Param["HideTagFilterChips"] = "hideTagFilterChips";
|
|
3354
3381
|
Param["AutoLogin"] = "autoLogin";
|
|
3355
3382
|
Param["searchTokenString"] = "searchTokenString";
|
|
3356
3383
|
Param["executeSearch"] = "executeSearch";
|
|
@@ -4881,29 +4908,7 @@ var LogLevel;
|
|
|
4881
4908
|
* @version SDK: 1.26.7 | ThoughtSpot Cloud: 9.10.0.cl
|
|
4882
4909
|
*/
|
|
4883
4910
|
LogLevel["TRACE"] = "TRACE";
|
|
4884
|
-
})(LogLevel || (LogLevel = {}));
|
|
4885
|
-
/**
|
|
4886
|
-
* Enum for the type of API intercepted
|
|
4887
|
-
*/
|
|
4888
|
-
var InterceptedApiType;
|
|
4889
|
-
(function (InterceptedApiType) {
|
|
4890
|
-
/**
|
|
4891
|
-
* The apis that are use to get the metadata for the embed
|
|
4892
|
-
*/
|
|
4893
|
-
InterceptedApiType["METADATA"] = "METADATA";
|
|
4894
|
-
/**
|
|
4895
|
-
* The apis that are use to get the data for the embed
|
|
4896
|
-
*/
|
|
4897
|
-
InterceptedApiType["ANSWER_DATA"] = "ANSWER_DATA";
|
|
4898
|
-
/**
|
|
4899
|
-
* This will intercept all the apis
|
|
4900
|
-
*/
|
|
4901
|
-
InterceptedApiType["ALL"] = "ALL";
|
|
4902
|
-
/**
|
|
4903
|
-
* The apis that are use to get the data for the liveboard
|
|
4904
|
-
*/
|
|
4905
|
-
InterceptedApiType["LIVEBOARD_DATA"] = "LIVEBOARD_DATA";
|
|
4906
|
-
})(InterceptedApiType || (InterceptedApiType = {}));
|
|
4911
|
+
})(LogLevel || (LogLevel = {}));
|
|
4907
4912
|
|
|
4908
4913
|
const logFunctions = {
|
|
4909
4914
|
[LogLevel.SILENT]: () => undefined,
|
|
@@ -7249,17 +7254,6 @@ function isEmpty(value) {
|
|
|
7249
7254
|
|
|
7250
7255
|
var isEmpty_1 = isEmpty;
|
|
7251
7256
|
|
|
7252
|
-
var UIPassthroughEvent;
|
|
7253
|
-
(function (UIPassthroughEvent) {
|
|
7254
|
-
UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
|
|
7255
|
-
UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
|
|
7256
|
-
UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
|
|
7257
|
-
UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
|
|
7258
|
-
UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
|
|
7259
|
-
UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
|
|
7260
|
-
UIPassthroughEvent["GetUnsavedAnswerTML"] = "getUnsavedAnswerTML";
|
|
7261
|
-
})(UIPassthroughEvent || (UIPassthroughEvent = {}));
|
|
7262
|
-
|
|
7263
7257
|
const ERROR_MESSAGE = {
|
|
7264
7258
|
INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
|
|
7265
7259
|
SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a worksheet to get started',
|
|
@@ -8191,7 +8185,7 @@ class AnswerService {
|
|
|
8191
8185
|
async getTML() {
|
|
8192
8186
|
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8193
8187
|
const edoc = object[0].edoc;
|
|
8194
|
-
const YAML = await import('./index-
|
|
8188
|
+
const YAML = await import('./index-CWQnMX2L.js');
|
|
8195
8189
|
const parsedDoc = YAML.parse(edoc);
|
|
8196
8190
|
return {
|
|
8197
8191
|
answer: {
|
|
@@ -17510,27 +17504,27 @@ function processAuthLogout(e, containerEl) {
|
|
|
17510
17504
|
* @param thoughtSpotHost
|
|
17511
17505
|
* @param containerEl
|
|
17512
17506
|
*/
|
|
17513
|
-
function processEventData(type,
|
|
17507
|
+
function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
17514
17508
|
switch (type) {
|
|
17515
17509
|
case EmbedEvent.CustomAction:
|
|
17516
|
-
return processCustomAction(
|
|
17510
|
+
return processCustomAction(e, thoughtSpotHost);
|
|
17517
17511
|
case EmbedEvent.AuthInit:
|
|
17518
|
-
return processAuthInit(
|
|
17512
|
+
return processAuthInit(e);
|
|
17519
17513
|
case EmbedEvent.NoCookieAccess:
|
|
17520
|
-
return processNoCookieAccess(
|
|
17514
|
+
return processNoCookieAccess(e, containerEl);
|
|
17521
17515
|
case EmbedEvent.AuthFailure:
|
|
17522
|
-
return processAuthFailure(
|
|
17516
|
+
return processAuthFailure(e, containerEl);
|
|
17523
17517
|
case EmbedEvent.AuthLogout:
|
|
17524
|
-
return processAuthLogout(
|
|
17518
|
+
return processAuthLogout(e, containerEl);
|
|
17525
17519
|
case EmbedEvent.ExitPresentMode:
|
|
17526
17520
|
return processExitPresentMode();
|
|
17527
17521
|
case EmbedEvent.CLEAR_INFO_CACHE:
|
|
17528
17522
|
return processClearInfoCache();
|
|
17529
17523
|
}
|
|
17530
|
-
return
|
|
17524
|
+
return e;
|
|
17531
17525
|
}
|
|
17532
17526
|
|
|
17533
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.42.1
|
|
17527
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.42.1";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 tsconfig.build.json --incremental false; tsc -p tsconfig.build.json --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle-generator --config ./dts-config/dts-bundle-file.config.js","bundle-dts":"dts-bundle-generator --config ./dts-config/dts-bundle.config.js","bundle-dts-react":"dts-bundle-generator --config ./dts-config/dts-bundle-react.config.js","bundle-dts-react-full":"dts-bundle-generator --config ./dts-config/dts-bundle-react-full.config.js",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.build.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 | npx coveralls-next","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && 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={classnames:"^2.3.1",eventemitter3:"^4.0.7",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",yaml:"^2.5.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":"^11.2.0","@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/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",ajv:"^8.17.1",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1","coveralls-next":"^5.0.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle-generator":"^9.5.1",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^2.0.0",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.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:"4.24.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","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};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$1,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"32 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};
|
|
17534
17528
|
|
|
17535
17529
|
/**
|
|
17536
17530
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -17549,6 +17543,7 @@ const reload = (iFrame) => {
|
|
|
17549
17543
|
* @param message
|
|
17550
17544
|
* @param message.type
|
|
17551
17545
|
* @param message.data
|
|
17546
|
+
* @param message.context
|
|
17552
17547
|
* @param thoughtSpotHost
|
|
17553
17548
|
* @param channel
|
|
17554
17549
|
*/
|
|
@@ -17563,8 +17558,9 @@ const TRIGGER_TIMEOUT = 30000;
|
|
|
17563
17558
|
* @param messageType
|
|
17564
17559
|
* @param thoughtSpotHost
|
|
17565
17560
|
* @param data
|
|
17561
|
+
* @param context
|
|
17566
17562
|
*/
|
|
17567
|
-
function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
17563
|
+
function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
|
|
17568
17564
|
return new Promise((res, rej) => {
|
|
17569
17565
|
var _a;
|
|
17570
17566
|
if (messageType === HostEvent.Reload) {
|
|
@@ -17598,10 +17594,20 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
17598
17594
|
channel.port1.close();
|
|
17599
17595
|
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
17600
17596
|
}, TRIGGER_TIMEOUT);
|
|
17601
|
-
return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
|
|
17597
|
+
return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
|
|
17602
17598
|
});
|
|
17603
17599
|
}
|
|
17604
17600
|
|
|
17601
|
+
var UIPassthroughEvent;
|
|
17602
|
+
(function (UIPassthroughEvent) {
|
|
17603
|
+
UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
|
|
17604
|
+
UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
|
|
17605
|
+
UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
|
|
17606
|
+
UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
|
|
17607
|
+
UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
|
|
17608
|
+
UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
|
|
17609
|
+
})(UIPassthroughEvent || (UIPassthroughEvent = {}));
|
|
17610
|
+
|
|
17605
17611
|
class HostEventClient {
|
|
17606
17612
|
constructor(iFrame) {
|
|
17607
17613
|
this.iFrame = iFrame;
|
|
@@ -17612,12 +17618,12 @@ class HostEventClient {
|
|
|
17612
17618
|
* @param {any} data Data to send with the host event
|
|
17613
17619
|
* @returns {Promise<any>} - the response from the process trigger
|
|
17614
17620
|
*/
|
|
17615
|
-
async processTrigger(message, data) {
|
|
17621
|
+
async processTrigger(message, data, context) {
|
|
17616
17622
|
if (!this.iFrame) {
|
|
17617
17623
|
throw new Error('Iframe element is not set');
|
|
17618
17624
|
}
|
|
17619
17625
|
const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
|
|
17620
|
-
return processTrigger(this.iFrame, message, thoughtspotHost, data);
|
|
17626
|
+
return processTrigger(this.iFrame, message, thoughtspotHost, data, context);
|
|
17621
17627
|
}
|
|
17622
17628
|
async handleHostEventWithParam(apiName, parameters) {
|
|
17623
17629
|
var _a, _b, _c, _d;
|
|
@@ -17636,8 +17642,8 @@ class HostEventClient {
|
|
|
17636
17642
|
}
|
|
17637
17643
|
return { ...response.value };
|
|
17638
17644
|
}
|
|
17639
|
-
async hostEventFallback(hostEvent, data) {
|
|
17640
|
-
return this.processTrigger(hostEvent, data);
|
|
17645
|
+
async hostEventFallback(hostEvent, data, context) {
|
|
17646
|
+
return this.processTrigger(hostEvent, data, context);
|
|
17641
17647
|
}
|
|
17642
17648
|
/**
|
|
17643
17649
|
* Setter for the iframe element used for host events
|
|
@@ -17681,123 +17687,18 @@ class HostEventClient {
|
|
|
17681
17687
|
answerId: (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.saveResponse) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.Answer__save) === null || _c === void 0 ? void 0 : _c.answer) === null || _d === void 0 ? void 0 : _d.id,
|
|
17682
17688
|
};
|
|
17683
17689
|
}
|
|
17684
|
-
async triggerHostEvent(hostEvent, payload) {
|
|
17690
|
+
async triggerHostEvent(hostEvent, payload, context) {
|
|
17685
17691
|
switch (hostEvent) {
|
|
17686
17692
|
case HostEvent.Pin:
|
|
17687
17693
|
return this.handlePinEvent(payload);
|
|
17688
17694
|
case HostEvent.SaveAnswer:
|
|
17689
17695
|
return this.handleSaveAnswerEvent(payload);
|
|
17690
17696
|
default:
|
|
17691
|
-
return this.hostEventFallback(hostEvent, payload);
|
|
17697
|
+
return this.hostEventFallback(hostEvent, payload, context);
|
|
17692
17698
|
}
|
|
17693
17699
|
}
|
|
17694
17700
|
}
|
|
17695
17701
|
|
|
17696
|
-
const defaultUrls = {
|
|
17697
|
-
[InterceptedApiType.METADATA]: [
|
|
17698
|
-
'/prism/?op=CreateAnswerSession',
|
|
17699
|
-
'/prism/?op=GetV2SourceDetail',
|
|
17700
|
-
],
|
|
17701
|
-
[InterceptedApiType.ANSWER_DATA]: [
|
|
17702
|
-
'/prism/?op=GetChartWithData',
|
|
17703
|
-
'/prism/?op=GetTableWithHeadlineData',
|
|
17704
|
-
],
|
|
17705
|
-
[InterceptedApiType.LIVEBOARD_DATA]: [
|
|
17706
|
-
'/prism/?op=LoadContextBook'
|
|
17707
|
-
],
|
|
17708
|
-
};
|
|
17709
|
-
const formatInterceptUrl = (url) => {
|
|
17710
|
-
const host = getThoughtSpotHost(getEmbedConfig());
|
|
17711
|
-
if (url.startsWith('/'))
|
|
17712
|
-
return `${host}${url}`;
|
|
17713
|
-
return url;
|
|
17714
|
-
};
|
|
17715
|
-
const processInterceptUrls = (interceptUrls) => {
|
|
17716
|
-
let processedUrls = [...interceptUrls];
|
|
17717
|
-
Object.entries(defaultUrls).forEach(([apiType, apiTypeUrls]) => {
|
|
17718
|
-
if (!processedUrls.includes(apiType))
|
|
17719
|
-
return;
|
|
17720
|
-
processedUrls = processedUrls.filter(url => url !== apiType);
|
|
17721
|
-
processedUrls = [...processedUrls, ...apiTypeUrls];
|
|
17722
|
-
});
|
|
17723
|
-
return processedUrls.map(url => formatInterceptUrl(url));
|
|
17724
|
-
};
|
|
17725
|
-
const getInterceptInitData = (embedConfig, viewConfig) => {
|
|
17726
|
-
const enableApiIntercept = (embedConfig.enableApiIntercept || viewConfig.enableApiIntercept) && (viewConfig.enableApiIntercept !== false);
|
|
17727
|
-
if (!enableApiIntercept)
|
|
17728
|
-
return {
|
|
17729
|
-
enableApiIntercept: false,
|
|
17730
|
-
};
|
|
17731
|
-
const combinedUrls = [...(embedConfig.interceptUrls || []), ...(viewConfig.interceptUrls || [])];
|
|
17732
|
-
if (viewConfig.isOnBeforeGetVizDataInterceptEnabled) {
|
|
17733
|
-
combinedUrls.push(InterceptedApiType.ANSWER_DATA);
|
|
17734
|
-
}
|
|
17735
|
-
const shouldInterceptAll = combinedUrls.includes(InterceptedApiType.ALL);
|
|
17736
|
-
const interceptUrls = shouldInterceptAll ? [InterceptedApiType.ALL] : processInterceptUrls(combinedUrls);
|
|
17737
|
-
const interceptTimeout = embedConfig.interceptTimeout || viewConfig.interceptTimeout;
|
|
17738
|
-
return {
|
|
17739
|
-
interceptUrls,
|
|
17740
|
-
interceptTimeout,
|
|
17741
|
-
enableApiIntercept,
|
|
17742
|
-
};
|
|
17743
|
-
};
|
|
17744
|
-
/**
|
|
17745
|
-
*
|
|
17746
|
-
* @param fetchInit
|
|
17747
|
-
*/
|
|
17748
|
-
const parseInterceptData = (eventDataString) => {
|
|
17749
|
-
try {
|
|
17750
|
-
const { input, init } = JSON.parse(eventDataString);
|
|
17751
|
-
init.body = JSON.parse(init.body);
|
|
17752
|
-
const parsedInit = { input, init };
|
|
17753
|
-
return [parsedInit, null];
|
|
17754
|
-
}
|
|
17755
|
-
catch (error) {
|
|
17756
|
-
return [null, error];
|
|
17757
|
-
}
|
|
17758
|
-
};
|
|
17759
|
-
const handleInterceptEvent = async (params) => {
|
|
17760
|
-
var _a, _b, _c, _d, _e;
|
|
17761
|
-
const { eventData, executeEvent, viewConfig, getUnsavedAnswerTml } = params;
|
|
17762
|
-
const [interceptData, bodyParseError] = parseInterceptData(eventData.data);
|
|
17763
|
-
if (bodyParseError) {
|
|
17764
|
-
executeEvent(EmbedEvent.Error, {
|
|
17765
|
-
error: 'Error parsing api intercept body',
|
|
17766
|
-
});
|
|
17767
|
-
logger$3.error('Error parsing request body', bodyParseError);
|
|
17768
|
-
return;
|
|
17769
|
-
}
|
|
17770
|
-
const { input: requestUrl, init } = interceptData;
|
|
17771
|
-
const sessionId = (_c = (_b = (_a = init === null || init === void 0 ? void 0 : init.body) === null || _a === void 0 ? void 0 : _a.variables) === null || _b === void 0 ? void 0 : _b.session) === null || _c === void 0 ? void 0 : _c.sessionId;
|
|
17772
|
-
const vizId = (_e = (_d = init === null || init === void 0 ? void 0 : init.body) === null || _d === void 0 ? void 0 : _d.variables) === null || _e === void 0 ? void 0 : _e.contextBookId;
|
|
17773
|
-
if (defaultUrls.ANSWER_DATA.includes(requestUrl) && viewConfig.isOnBeforeGetVizDataInterceptEnabled) {
|
|
17774
|
-
const answerTml = await getUnsavedAnswerTml({ sessionId, vizId });
|
|
17775
|
-
executeEvent(EmbedEvent.OnBeforeGetVizDataIntercept, { data: { data: answerTml } });
|
|
17776
|
-
}
|
|
17777
|
-
executeEvent(EmbedEvent.ApiIntercept, interceptData);
|
|
17778
|
-
};
|
|
17779
|
-
const processLegacyInterceptResponse = (payload) => {
|
|
17780
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
17781
|
-
const errorText = ((_a = payload === null || payload === void 0 ? void 0 : payload.data) === null || _a === void 0 ? void 0 : _a.errorText) || ((_c = (_b = payload === null || payload === void 0 ? void 0 : payload.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.errorText);
|
|
17782
|
-
const errorDescription = ((_d = payload === null || payload === void 0 ? void 0 : payload.data) === null || _d === void 0 ? void 0 : _d.errorDescription) || ((_f = (_e = payload === null || payload === void 0 ? void 0 : payload.data) === null || _e === void 0 ? void 0 : _e.error) === null || _f === void 0 ? void 0 : _f.errorDescription);
|
|
17783
|
-
const payloadToSend = {
|
|
17784
|
-
execute: (_g = payload === null || payload === void 0 ? void 0 : payload.data) === null || _g === void 0 ? void 0 : _g.execute,
|
|
17785
|
-
response: {
|
|
17786
|
-
body: {
|
|
17787
|
-
errors: [
|
|
17788
|
-
{
|
|
17789
|
-
title: errorText,
|
|
17790
|
-
description: errorDescription,
|
|
17791
|
-
isUserError: true,
|
|
17792
|
-
},
|
|
17793
|
-
],
|
|
17794
|
-
data: {},
|
|
17795
|
-
},
|
|
17796
|
-
},
|
|
17797
|
-
};
|
|
17798
|
-
return { data: payloadToSend };
|
|
17799
|
-
};
|
|
17800
|
-
|
|
17801
17702
|
/**
|
|
17802
17703
|
* Copyright (c) 2022
|
|
17803
17704
|
*
|
|
@@ -17851,27 +17752,6 @@ class TsEmbed {
|
|
|
17851
17752
|
*/
|
|
17852
17753
|
this.fullscreenChangeHandler = null;
|
|
17853
17754
|
this.subscribedListeners = {};
|
|
17854
|
-
this.messageEventListener = async (event) => {
|
|
17855
|
-
const eventType = this.getEventType(event);
|
|
17856
|
-
const eventPort = this.getEventPort(event);
|
|
17857
|
-
const eventData = this.formatEventData(event, eventType);
|
|
17858
|
-
if (event.source === this.iFrame.contentWindow) {
|
|
17859
|
-
const processedEventData = await processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
17860
|
-
const executeEvent = (_eventType, data) => {
|
|
17861
|
-
this.executeCallbacks(_eventType, data, eventPort);
|
|
17862
|
-
};
|
|
17863
|
-
if (eventType === EmbedEvent.ApiIntercept && this.viewConfig.enableApiIntercept) {
|
|
17864
|
-
const getUnsavedAnswerTml = async (props) => {
|
|
17865
|
-
var _a;
|
|
17866
|
-
const response = await this.triggerUIPassThrough(UIPassthroughEvent.GetUnsavedAnswerTML, props);
|
|
17867
|
-
return (_a = response[0]) === null || _a === void 0 ? void 0 : _a.value;
|
|
17868
|
-
};
|
|
17869
|
-
handleInterceptEvent({ eventData: processedEventData, executeEvent, embedConfig: this.embedConfig, viewConfig: this.viewConfig, getUnsavedAnswerTml });
|
|
17870
|
-
return;
|
|
17871
|
-
}
|
|
17872
|
-
this.executeCallbacks(eventType, processedEventData, eventPort);
|
|
17873
|
-
}
|
|
17874
|
-
};
|
|
17875
17755
|
/**
|
|
17876
17756
|
* Send Custom style as part of payload of APP_INIT
|
|
17877
17757
|
* @param _
|
|
@@ -17956,18 +17836,6 @@ class TsEmbed {
|
|
|
17956
17836
|
this.on(EmbedEvent.AuthInit, authInitHandler, { start: false }, true);
|
|
17957
17837
|
};
|
|
17958
17838
|
this.showPreRenderByDefault = false;
|
|
17959
|
-
this.createEmbedEventResponder = (eventPort, eventType) => {
|
|
17960
|
-
const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
|
|
17961
|
-
if (eventType === EmbedEvent.OnBeforeGetVizDataIntercept && enableApiIntercept) {
|
|
17962
|
-
return (payload) => {
|
|
17963
|
-
const payloadToSend = processLegacyInterceptResponse(payload);
|
|
17964
|
-
this.triggerEventOnPort(eventPort, payloadToSend);
|
|
17965
|
-
};
|
|
17966
|
-
}
|
|
17967
|
-
return (payload) => {
|
|
17968
|
-
this.triggerEventOnPort(eventPort, payload);
|
|
17969
|
-
};
|
|
17970
|
-
};
|
|
17971
17839
|
/**
|
|
17972
17840
|
* @hidden
|
|
17973
17841
|
* Internal state to track if the embed container is loaded.
|
|
@@ -18153,8 +18021,16 @@ class TsEmbed {
|
|
|
18153
18021
|
*/
|
|
18154
18022
|
subscribeToMessageEvents() {
|
|
18155
18023
|
this.unsubscribeToMessageEvents();
|
|
18156
|
-
|
|
18157
|
-
|
|
18024
|
+
const messageEventListener = (event) => {
|
|
18025
|
+
const eventType = this.getEventType(event);
|
|
18026
|
+
const eventPort = this.getEventPort(event);
|
|
18027
|
+
const eventData = this.formatEventData(event, eventType);
|
|
18028
|
+
if (event.source === this.iFrame.contentWindow) {
|
|
18029
|
+
this.executeCallbacks(eventType, processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el), eventPort);
|
|
18030
|
+
}
|
|
18031
|
+
};
|
|
18032
|
+
window.addEventListener('message', messageEventListener);
|
|
18033
|
+
this.subscribedListeners.message = messageEventListener;
|
|
18158
18034
|
}
|
|
18159
18035
|
/**
|
|
18160
18036
|
* Adds event listeners for both network and message events.
|
|
@@ -18215,7 +18091,7 @@ class TsEmbed {
|
|
|
18215
18091
|
message: customActionsResult.errors,
|
|
18216
18092
|
});
|
|
18217
18093
|
}
|
|
18218
|
-
|
|
18094
|
+
return {
|
|
18219
18095
|
customisations: getCustomisations(this.embedConfig, this.viewConfig),
|
|
18220
18096
|
authToken,
|
|
18221
18097
|
runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
|
|
@@ -18233,9 +18109,7 @@ class TsEmbed {
|
|
|
18233
18109
|
customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
|
|
18234
18110
|
hiddenListColumns: this.viewConfig.hiddenListColumns || [],
|
|
18235
18111
|
customActions: customActionsResult.actions,
|
|
18236
|
-
...getInterceptInitData(this.embedConfig, this.viewConfig),
|
|
18237
18112
|
};
|
|
18238
|
-
return baseInitData;
|
|
18239
18113
|
}
|
|
18240
18114
|
async getAppInitData() {
|
|
18241
18115
|
return this.getDefaultAppInitData();
|
|
@@ -18664,8 +18538,9 @@ class TsEmbed {
|
|
|
18664
18538
|
// When start status is false it trigger only end releated
|
|
18665
18539
|
// payload
|
|
18666
18540
|
|| (!callbackObj.options.start && dataStatus === embedEventStatus.END)) {
|
|
18667
|
-
|
|
18668
|
-
|
|
18541
|
+
callbackObj.callback(data, (payload) => {
|
|
18542
|
+
this.triggerEventOnPort(eventPort, payload);
|
|
18543
|
+
});
|
|
18669
18544
|
}
|
|
18670
18545
|
});
|
|
18671
18546
|
}
|
|
@@ -18840,7 +18715,7 @@ class TsEmbed {
|
|
|
18840
18715
|
* @param {any} data The payload to send with the message
|
|
18841
18716
|
* @returns A promise that resolves with the response from the embedded app
|
|
18842
18717
|
*/
|
|
18843
|
-
async trigger(messageType, data = {}) {
|
|
18718
|
+
async trigger(messageType, data = {}, context = {}) {
|
|
18844
18719
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
18845
18720
|
if (!this.isRendered) {
|
|
18846
18721
|
this.handleError('Please call render before triggering events');
|
|
@@ -18857,7 +18732,7 @@ class TsEmbed {
|
|
|
18857
18732
|
return null;
|
|
18858
18733
|
}
|
|
18859
18734
|
// send an empty object, this is needed for liveboard default handlers
|
|
18860
|
-
return this.hostEventClient.triggerHostEvent(messageType, data);
|
|
18735
|
+
return this.hostEventClient.triggerHostEvent(messageType, data, context);
|
|
18861
18736
|
}
|
|
18862
18737
|
/**
|
|
18863
18738
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
@@ -19375,7 +19250,7 @@ class AppEmbed extends V1Embed {
|
|
|
19375
19250
|
* embedded Liveboard or visualization.
|
|
19376
19251
|
*/
|
|
19377
19252
|
getEmbedParams() {
|
|
19378
|
-
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = true, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState$1.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, isLinkParametersEnabled, } = this.viewConfig;
|
|
19253
|
+
const { tag, hideTagFilterChips, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = true, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState$1.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, isLinkParametersEnabled, } = this.viewConfig;
|
|
19379
19254
|
let params = {};
|
|
19380
19255
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
19381
19256
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
@@ -19428,8 +19303,7 @@ class AppEmbed extends V1Embed {
|
|
|
19428
19303
|
if (enableAskSage) {
|
|
19429
19304
|
params[Param.enableAskSage] = enableAskSage;
|
|
19430
19305
|
}
|
|
19431
|
-
|
|
19432
|
-
if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
|
|
19306
|
+
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
19433
19307
|
params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
19434
19308
|
}
|
|
19435
19309
|
if (homePageSearchBarMode) {
|
|
@@ -19444,6 +19318,9 @@ class AppEmbed extends V1Embed {
|
|
|
19444
19318
|
if (isPNGInScheduledEmailsEnabled !== undefined) {
|
|
19445
19319
|
params[Param.isPNGInScheduledEmailsEnabled] = isPNGInScheduledEmailsEnabled;
|
|
19446
19320
|
}
|
|
19321
|
+
if (hideTagFilterChips !== undefined) {
|
|
19322
|
+
params[Param.HideTagFilterChips] = hideTagFilterChips;
|
|
19323
|
+
}
|
|
19447
19324
|
if (isLinkParametersEnabled !== undefined) {
|
|
19448
19325
|
params[Param.isLinkParametersEnabled] = isLinkParametersEnabled;
|
|
19449
19326
|
}
|
|
@@ -20155,8 +20032,7 @@ class SearchEmbed extends TsEmbed {
|
|
|
20155
20032
|
if (hideSearchBar) {
|
|
20156
20033
|
queryParams[Param.HideSearchBar] = true;
|
|
20157
20034
|
}
|
|
20158
|
-
|
|
20159
|
-
if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
|
|
20035
|
+
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
20160
20036
|
queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
20161
20037
|
}
|
|
20162
20038
|
if (!focusSearchBarOnRender) {
|
|
@@ -21550,4 +21426,4 @@ const createLiveboardWithAnswers = async (answers, name) => {
|
|
|
21550
21426
|
return result;
|
|
21551
21427
|
};
|
|
21552
21428
|
|
|
21553
|
-
export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ConversationEmbed, CustomActionTarget, CustomActionsPosition, DataPanelCustomColumnGroupsAccordionState$1 as DataPanelCustomColumnGroupsAccordionState, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomePage, HomePageSearchBarMode, HomepageModule, HostEvent,
|
|
21429
|
+
export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ConversationEmbed, CustomActionTarget, CustomActionsPosition, DataPanelCustomColumnGroupsAccordionState$1 as DataPanelCustomColumnGroupsAccordionState, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomePage, HomePageSearchBarMode, HomepageModule, HostEvent, ListPage, ListPageColumns, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, PrimaryNavbarVersion, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, SpotterAgentEmbed, SpotterEmbed, UIPassthroughEvent, createLiveboardWithAnswers, executeTML, exportTML, getAnswerFromQuery, getEmbedConfig as getInitConfig, getSessionInfo, init, logout, prefetch, resetCachedAuthToken, tokenizedFetch, uploadMixpanelEvent };
|