@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-react.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
|
import * as React from 'react';
|
|
4
4
|
import React__default, { useRef, useCallback } from 'react';
|
|
@@ -614,7 +614,7 @@ var EmbedEvent;
|
|
|
614
614
|
*/
|
|
615
615
|
EmbedEvent["Load"] = "load";
|
|
616
616
|
/**
|
|
617
|
-
* Data pertaining to an Answer or
|
|
617
|
+
* Data pertaining to an Answer, Liveboard or Spotter visualization is received.
|
|
618
618
|
* The event payload includes the raw data of the object.
|
|
619
619
|
* @return data - Answer of Liveboard data
|
|
620
620
|
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
@@ -1697,21 +1697,6 @@ var EmbedEvent;
|
|
|
1697
1697
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
1698
1698
|
*/
|
|
1699
1699
|
EmbedEvent["OrgSwitched"] = "orgSwitched";
|
|
1700
|
-
/**
|
|
1701
|
-
* Emitted when the user intercepts a URL.
|
|
1702
|
-
*
|
|
1703
|
-
* Supported on all embed types.
|
|
1704
|
-
*
|
|
1705
|
-
* @example
|
|
1706
|
-
* ```js
|
|
1707
|
-
* embed.on(EmbedEvent.ApiIntercept, (payload) => {
|
|
1708
|
-
* console.log('payload', payload);
|
|
1709
|
-
* })
|
|
1710
|
-
* ```
|
|
1711
|
-
*
|
|
1712
|
-
* @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
|
|
1713
|
-
*/
|
|
1714
|
-
EmbedEvent["ApiIntercept"] = "ApiIntercept";
|
|
1715
1700
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
1716
1701
|
/**
|
|
1717
1702
|
* Event types that can be triggered by the host application
|
|
@@ -2000,7 +1985,7 @@ var HostEvent;
|
|
|
2000
1985
|
* the following parameters:
|
|
2001
1986
|
*
|
|
2002
1987
|
* @param
|
|
2003
|
-
* `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
|
|
1988
|
+
* `vizId`- GUID of the saved Answer or Spotter visualization ID to pin to a Liveboard.
|
|
2004
1989
|
* Optional when pinning a new chart or table generated from a Search query.
|
|
2005
1990
|
* **Required** in Spotter Embed.
|
|
2006
1991
|
* @param
|
|
@@ -2052,10 +2037,16 @@ var HostEvent;
|
|
|
2052
2037
|
* ```
|
|
2053
2038
|
* @example
|
|
2054
2039
|
* ```js
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2040
|
+
|
|
2041
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
|
|
2042
|
+
* let latestSpotterVizId = '';
|
|
2043
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2044
|
+
* latestSpotterVizId = payload.data.id;
|
|
2045
|
+
* });
|
|
2046
|
+
*
|
|
2047
|
+
* spotterEmbed.trigger(HostEvent.Pin, { vizId: latestSpotterVizId });
|
|
2048
|
+
* ```
|
|
2049
|
+
*
|
|
2059
2050
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2060
2051
|
*/
|
|
2061
2052
|
HostEvent["Pin"] = "pin";
|
|
@@ -2130,10 +2121,15 @@ var HostEvent;
|
|
|
2130
2121
|
* ```
|
|
2131
2122
|
* @example
|
|
2132
2123
|
* ```js
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2124
|
+
|
|
2125
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPdf host event.
|
|
2126
|
+
* let latestSpotterVizId = '';
|
|
2127
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2128
|
+
* latestSpotterVizId = payload.data.id;
|
|
2129
|
+
* });
|
|
2130
|
+
*
|
|
2131
|
+
* spotterEmbed.trigger(HostEvent.DownloadAsPdf, { vizId: latestSpotterVizId });
|
|
2132
|
+
* ```
|
|
2137
2133
|
*
|
|
2138
2134
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2139
2135
|
*/
|
|
@@ -2160,10 +2156,14 @@ var HostEvent;
|
|
|
2160
2156
|
* ```
|
|
2161
2157
|
* @example
|
|
2162
2158
|
* ```js
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2159
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in MakeACopy host event.
|
|
2160
|
+
* let latestSpotterVizId = '';
|
|
2161
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2162
|
+
* latestSpotterVizId = payload.data.id;
|
|
2163
|
+
* });
|
|
2164
|
+
*
|
|
2165
|
+
* spotterEmbed.trigger(HostEvent.MakeACopy, { vizId: latestSpotterVizId });
|
|
2166
|
+
* ```
|
|
2167
2167
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2168
2168
|
*/
|
|
2169
2169
|
HostEvent["MakeACopy"] = "makeACopy";
|
|
@@ -2248,15 +2248,7 @@ var HostEvent;
|
|
|
2248
2248
|
* ```
|
|
2249
2249
|
* @example
|
|
2250
2250
|
* ```js
|
|
2251
|
-
*
|
|
2252
|
-
* vizId:'730496d6-6903-4601-937e-2c691821af3c'
|
|
2253
|
-
* });
|
|
2254
|
-
* ```
|
|
2255
|
-
* @example
|
|
2256
|
-
* ```js
|
|
2257
|
-
* const editResponse = await spotterEmbed.trigger(HostEvent.Edit, {
|
|
2258
|
-
* vizId:'730496d6-6903-4601-937e-2c691821af3c'
|
|
2259
|
-
* });
|
|
2251
|
+
* spotterEmbed.trigger(HostEvent.Edit);
|
|
2260
2252
|
* ```
|
|
2261
2253
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2262
2254
|
*/
|
|
@@ -2305,16 +2297,23 @@ var HostEvent;
|
|
|
2305
2297
|
* );
|
|
2306
2298
|
* })
|
|
2307
2299
|
* ```
|
|
2308
|
-
* @example
|
|
2300
|
+
* * @example
|
|
2309
2301
|
* ```js
|
|
2310
|
-
|
|
2311
|
-
|
|
2302
|
+
|
|
2303
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
|
|
2304
|
+
* let latestSpotterVizId = '';
|
|
2305
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2306
|
+
* latestSpotterVizId = payload.data.id;
|
|
2307
|
+
* });
|
|
2308
|
+
*
|
|
2309
|
+
* spotterEmbed.trigger(HostEvent.GetTML, {
|
|
2310
|
+
* vizId: latestSpotterVizId
|
|
2312
2311
|
* }).then((tml) => {
|
|
2313
2312
|
* console.log(
|
|
2314
2313
|
* tml.answer.search_query // TML representation of the search query
|
|
2315
2314
|
* );
|
|
2316
2315
|
* })
|
|
2317
|
-
|
|
2316
|
+
* ```
|
|
2318
2317
|
* @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1.sw
|
|
2319
2318
|
* @important
|
|
2320
2319
|
*/
|
|
@@ -2378,7 +2377,7 @@ var HostEvent;
|
|
|
2378
2377
|
/**
|
|
2379
2378
|
* Trigger the **Download** action on charts in
|
|
2380
2379
|
* the embedded view.
|
|
2381
|
-
* @param - `vizId` refers to the
|
|
2380
|
+
* @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
|
|
2382
2381
|
* @example
|
|
2383
2382
|
* ```js
|
|
2384
2383
|
* liveboardEmbed.trigger(HostEvent.Download, {vizId:
|
|
@@ -2388,10 +2387,14 @@ var HostEvent;
|
|
|
2388
2387
|
* embed.trigger(HostEvent.Download)
|
|
2389
2388
|
* ```
|
|
2390
2389
|
* ```js
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2390
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in Download host event.
|
|
2391
|
+
* let latestSpotterVizId = '';
|
|
2392
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2393
|
+
* latestSpotterVizId = payload.data.id;
|
|
2394
|
+
* });
|
|
2395
|
+
*
|
|
2396
|
+
* spotterEmbed.trigger(HostEvent.Download, { vizId: latestSpotterVizId });
|
|
2397
|
+
* ```
|
|
2395
2398
|
* @deprecated from SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl ,9.4.1.sw
|
|
2396
2399
|
* Use {@link DownloadAsPng}
|
|
2397
2400
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
|
|
@@ -2409,9 +2412,13 @@ var HostEvent;
|
|
|
2409
2412
|
*
|
|
2410
2413
|
* searchEmbed.trigger(HostEvent.DownloadAsPng)
|
|
2411
2414
|
*
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPng host event.
|
|
2416
|
+
* let latestSpotterVizId = '';
|
|
2417
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2418
|
+
* latestSpotterVizId = payload.data.id;
|
|
2419
|
+
* });
|
|
2420
|
+
*
|
|
2421
|
+
* spotterEmbed.trigger(HostEvent.DownloadAsPng, { vizId: latestSpotterVizId });
|
|
2415
2422
|
* ```
|
|
2416
2423
|
*
|
|
2417
2424
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1.sw
|
|
@@ -2420,7 +2427,7 @@ var HostEvent;
|
|
|
2420
2427
|
/**
|
|
2421
2428
|
* Trigger the **Download** > **CSV** action on tables in
|
|
2422
2429
|
* the embedded view.
|
|
2423
|
-
* @param - `vizId` refers to the
|
|
2430
|
+
* @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
|
|
2424
2431
|
* @example
|
|
2425
2432
|
* ```js
|
|
2426
2433
|
* liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
|
|
@@ -2433,9 +2440,13 @@ var HostEvent;
|
|
|
2433
2440
|
* searchEmbed.trigger(HostEvent.DownloadAsCsv)
|
|
2434
2441
|
* ```
|
|
2435
2442
|
* ```js
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2443
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsCsv host event.
|
|
2444
|
+
* let latestSpotterVizId = '';
|
|
2445
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2446
|
+
* latestSpotterVizId = payload.data.id;
|
|
2447
|
+
* });
|
|
2448
|
+
*
|
|
2449
|
+
* spotterEmbed.trigger(HostEvent.DownloadAsCsv, { vizId: latestSpotterVizId });
|
|
2439
2450
|
* ```
|
|
2440
2451
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
|
|
2441
2452
|
*/
|
|
@@ -2443,7 +2454,7 @@ var HostEvent;
|
|
|
2443
2454
|
/**
|
|
2444
2455
|
* Trigger the **Download** > **XLSX** action on tables
|
|
2445
2456
|
* in the embedded view.
|
|
2446
|
-
* @param - `vizId` refers to the
|
|
2457
|
+
* @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
|
|
2447
2458
|
* @example
|
|
2448
2459
|
* ```js
|
|
2449
2460
|
* liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
|
|
@@ -2456,9 +2467,13 @@ var HostEvent;
|
|
|
2456
2467
|
* searchEmbed.trigger(HostEvent.DownloadAsXlsx)
|
|
2457
2468
|
* ```
|
|
2458
2469
|
* ```js
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2470
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsXlsx host event.
|
|
2471
|
+
* let latestSpotterVizId = '';
|
|
2472
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2473
|
+
* latestSpotterVizId = payload.data.id;
|
|
2474
|
+
* });
|
|
2475
|
+
*
|
|
2476
|
+
* spotterEmbed.trigger(HostEvent.DownloadAsXlsx, { vizId: latestSpotterVizId });
|
|
2462
2477
|
* ```
|
|
2463
2478
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
|
|
2464
2479
|
*/
|
|
@@ -2495,7 +2510,7 @@ var HostEvent;
|
|
|
2495
2510
|
* ```
|
|
2496
2511
|
*
|
|
2497
2512
|
* ```js
|
|
2498
|
-
* // Save
|
|
2513
|
+
* // Save a Visualization in Spotter (requires vizId)
|
|
2499
2514
|
* spotterEmbed.trigger(HostEvent.Save, {
|
|
2500
2515
|
* vizId: "730496d6-6903-4601-937e-2c691821af3c"
|
|
2501
2516
|
* })
|
|
@@ -2817,11 +2832,13 @@ var HostEvent;
|
|
|
2817
2832
|
* });
|
|
2818
2833
|
*```
|
|
2819
2834
|
*```js
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2835
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in GetParameters host event.
|
|
2836
|
+
* let latestSpotterVizId = '';
|
|
2837
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2838
|
+
* latestSpotterVizId = payload.data.id;
|
|
2839
|
+
* });
|
|
2840
|
+
*
|
|
2841
|
+
* spotterEmbed.trigger(HostEvent.GetParameters, { vizId: latestSpotterVizId });
|
|
2825
2842
|
*```
|
|
2826
2843
|
* @version SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
|
|
2827
2844
|
*/
|
|
@@ -2864,11 +2881,13 @@ var HostEvent;
|
|
|
2864
2881
|
* ```
|
|
2865
2882
|
* @example
|
|
2866
2883
|
* ```js
|
|
2867
|
-
*
|
|
2868
|
-
*
|
|
2869
|
-
*
|
|
2870
|
-
*
|
|
2884
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in SaveAnswer host event.
|
|
2885
|
+
* let latestSpotterVizId = '';
|
|
2886
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2887
|
+
* latestSpotterVizId = payload.data.id;
|
|
2871
2888
|
* });
|
|
2889
|
+
*
|
|
2890
|
+
* spotterEmbed.trigger(HostEvent.SaveAnswer, { vizId: latestSpotterVizId });
|
|
2872
2891
|
* ```
|
|
2873
2892
|
* @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
|
|
2874
2893
|
*/
|
|
@@ -2952,12 +2971,15 @@ var HostEvent;
|
|
|
2952
2971
|
HostEvent["DeleteLastPrompt"] = "DeleteLastPrompt";
|
|
2953
2972
|
/**
|
|
2954
2973
|
* Toggle the visualization to chart or table view.
|
|
2955
|
-
* @param - `vizId ` refers to the
|
|
2974
|
+
* @param - `vizId ` refers to the Visualization ID in Spotter embed and is required.
|
|
2956
2975
|
* @example
|
|
2957
2976
|
* ```js
|
|
2958
|
-
*
|
|
2959
|
-
*
|
|
2977
|
+
* let latestSpotterVizId = '';
|
|
2978
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
2979
|
+
* latestSpotterVizId = payload.data.id;
|
|
2960
2980
|
* });
|
|
2981
|
+
*
|
|
2982
|
+
* spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, { vizId: latestSpotterVizId });
|
|
2961
2983
|
*```
|
|
2962
2984
|
* @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
2963
2985
|
*/
|
|
@@ -2986,12 +3008,16 @@ var HostEvent;
|
|
|
2986
3008
|
*/
|
|
2987
3009
|
HostEvent["VisibleEmbedCoordinates"] = "visibleEmbedCoordinates";
|
|
2988
3010
|
/**
|
|
2989
|
-
* Trigger the *
|
|
2990
|
-
* @param - `vizId` refers to the
|
|
3011
|
+
* Trigger the *Spotter* action for visualizations present on the liveboard's vizzes.
|
|
3012
|
+
* @param - `vizId` refers to the Visualization ID in Spotter embed and is required.
|
|
2991
3013
|
* @example
|
|
2992
3014
|
* ```js
|
|
2993
|
-
*
|
|
2994
|
-
* {
|
|
3015
|
+
* let latestSpotterVizId = '';
|
|
3016
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3017
|
+
* latestSpotterVizId = payload.data.id;
|
|
3018
|
+
* });
|
|
3019
|
+
*
|
|
3020
|
+
* spotterEmbed.trigger(HostEvent.AskSpotter, { vizId: latestSpotterVizId });
|
|
2995
3021
|
* ```
|
|
2996
3022
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
2997
3023
|
*/
|
|
@@ -3049,6 +3075,7 @@ var Param;
|
|
|
3049
3075
|
Param["HideResult"] = "hideResult";
|
|
3050
3076
|
Param["UseLastSelectedDataSource"] = "useLastSelectedSources";
|
|
3051
3077
|
Param["Tag"] = "tag";
|
|
3078
|
+
Param["HideTagFilterChips"] = "hideTagFilterChips";
|
|
3052
3079
|
Param["AutoLogin"] = "autoLogin";
|
|
3053
3080
|
Param["searchTokenString"] = "searchTokenString";
|
|
3054
3081
|
Param["executeSearch"] = "executeSearch";
|
|
@@ -4579,29 +4606,7 @@ var LogLevel;
|
|
|
4579
4606
|
* @version SDK: 1.26.7 | ThoughtSpot Cloud: 9.10.0.cl
|
|
4580
4607
|
*/
|
|
4581
4608
|
LogLevel["TRACE"] = "TRACE";
|
|
4582
|
-
})(LogLevel || (LogLevel = {}));
|
|
4583
|
-
/**
|
|
4584
|
-
* Enum for the type of API intercepted
|
|
4585
|
-
*/
|
|
4586
|
-
var InterceptedApiType;
|
|
4587
|
-
(function (InterceptedApiType) {
|
|
4588
|
-
/**
|
|
4589
|
-
* The apis that are use to get the metadata for the embed
|
|
4590
|
-
*/
|
|
4591
|
-
InterceptedApiType["METADATA"] = "METADATA";
|
|
4592
|
-
/**
|
|
4593
|
-
* The apis that are use to get the data for the embed
|
|
4594
|
-
*/
|
|
4595
|
-
InterceptedApiType["ANSWER_DATA"] = "ANSWER_DATA";
|
|
4596
|
-
/**
|
|
4597
|
-
* This will intercept all the apis
|
|
4598
|
-
*/
|
|
4599
|
-
InterceptedApiType["ALL"] = "ALL";
|
|
4600
|
-
/**
|
|
4601
|
-
* The apis that are use to get the data for the liveboard
|
|
4602
|
-
*/
|
|
4603
|
-
InterceptedApiType["LIVEBOARD_DATA"] = "LIVEBOARD_DATA";
|
|
4604
|
-
})(InterceptedApiType || (InterceptedApiType = {}));
|
|
4609
|
+
})(LogLevel || (LogLevel = {}));
|
|
4605
4610
|
|
|
4606
4611
|
const logFunctions = {
|
|
4607
4612
|
[LogLevel.SILENT]: () => undefined,
|
|
@@ -7364,17 +7369,6 @@ function isEmpty(value) {
|
|
|
7364
7369
|
|
|
7365
7370
|
var isEmpty_1 = isEmpty;
|
|
7366
7371
|
|
|
7367
|
-
var UIPassthroughEvent;
|
|
7368
|
-
(function (UIPassthroughEvent) {
|
|
7369
|
-
UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
|
|
7370
|
-
UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
|
|
7371
|
-
UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
|
|
7372
|
-
UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
|
|
7373
|
-
UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
|
|
7374
|
-
UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
|
|
7375
|
-
UIPassthroughEvent["GetUnsavedAnswerTML"] = "getUnsavedAnswerTML";
|
|
7376
|
-
})(UIPassthroughEvent || (UIPassthroughEvent = {}));
|
|
7377
|
-
|
|
7378
7372
|
const ERROR_MESSAGE = {
|
|
7379
7373
|
INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
|
|
7380
7374
|
SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a worksheet to get started',
|
|
@@ -8306,7 +8300,7 @@ class AnswerService {
|
|
|
8306
8300
|
async getTML() {
|
|
8307
8301
|
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8308
8302
|
const edoc = object[0].edoc;
|
|
8309
|
-
const YAML = await import('./index-
|
|
8303
|
+
const YAML = await import('./index-CWQnMX2L.js');
|
|
8310
8304
|
const parsedDoc = YAML.parse(edoc);
|
|
8311
8305
|
return {
|
|
8312
8306
|
answer: {
|
|
@@ -17459,27 +17453,27 @@ function processAuthLogout(e, containerEl) {
|
|
|
17459
17453
|
* @param thoughtSpotHost
|
|
17460
17454
|
* @param containerEl
|
|
17461
17455
|
*/
|
|
17462
|
-
function processEventData(type,
|
|
17456
|
+
function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
17463
17457
|
switch (type) {
|
|
17464
17458
|
case EmbedEvent.CustomAction:
|
|
17465
|
-
return processCustomAction(
|
|
17459
|
+
return processCustomAction(e, thoughtSpotHost);
|
|
17466
17460
|
case EmbedEvent.AuthInit:
|
|
17467
|
-
return processAuthInit(
|
|
17461
|
+
return processAuthInit(e);
|
|
17468
17462
|
case EmbedEvent.NoCookieAccess:
|
|
17469
|
-
return processNoCookieAccess(
|
|
17463
|
+
return processNoCookieAccess(e, containerEl);
|
|
17470
17464
|
case EmbedEvent.AuthFailure:
|
|
17471
|
-
return processAuthFailure(
|
|
17465
|
+
return processAuthFailure(e, containerEl);
|
|
17472
17466
|
case EmbedEvent.AuthLogout:
|
|
17473
|
-
return processAuthLogout(
|
|
17467
|
+
return processAuthLogout(e, containerEl);
|
|
17474
17468
|
case EmbedEvent.ExitPresentMode:
|
|
17475
17469
|
return processExitPresentMode();
|
|
17476
17470
|
case EmbedEvent.CLEAR_INFO_CACHE:
|
|
17477
17471
|
return processClearInfoCache();
|
|
17478
17472
|
}
|
|
17479
|
-
return
|
|
17473
|
+
return e;
|
|
17480
17474
|
}
|
|
17481
17475
|
|
|
17482
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.42.1
|
|
17476
|
+
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};
|
|
17483
17477
|
|
|
17484
17478
|
/**
|
|
17485
17479
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -17498,6 +17492,7 @@ const reload = (iFrame) => {
|
|
|
17498
17492
|
* @param message
|
|
17499
17493
|
* @param message.type
|
|
17500
17494
|
* @param message.data
|
|
17495
|
+
* @param message.context
|
|
17501
17496
|
* @param thoughtSpotHost
|
|
17502
17497
|
* @param channel
|
|
17503
17498
|
*/
|
|
@@ -17512,8 +17507,9 @@ const TRIGGER_TIMEOUT = 30000;
|
|
|
17512
17507
|
* @param messageType
|
|
17513
17508
|
* @param thoughtSpotHost
|
|
17514
17509
|
* @param data
|
|
17510
|
+
* @param context
|
|
17515
17511
|
*/
|
|
17516
|
-
function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
17512
|
+
function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
|
|
17517
17513
|
return new Promise((res, rej) => {
|
|
17518
17514
|
var _a;
|
|
17519
17515
|
if (messageType === HostEvent.Reload) {
|
|
@@ -17547,10 +17543,20 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
17547
17543
|
channel.port1.close();
|
|
17548
17544
|
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
17549
17545
|
}, TRIGGER_TIMEOUT);
|
|
17550
|
-
return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
|
|
17546
|
+
return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
|
|
17551
17547
|
});
|
|
17552
17548
|
}
|
|
17553
17549
|
|
|
17550
|
+
var UIPassthroughEvent;
|
|
17551
|
+
(function (UIPassthroughEvent) {
|
|
17552
|
+
UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
|
|
17553
|
+
UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
|
|
17554
|
+
UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
|
|
17555
|
+
UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
|
|
17556
|
+
UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
|
|
17557
|
+
UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
|
|
17558
|
+
})(UIPassthroughEvent || (UIPassthroughEvent = {}));
|
|
17559
|
+
|
|
17554
17560
|
class HostEventClient {
|
|
17555
17561
|
constructor(iFrame) {
|
|
17556
17562
|
this.iFrame = iFrame;
|
|
@@ -17561,12 +17567,12 @@ class HostEventClient {
|
|
|
17561
17567
|
* @param {any} data Data to send with the host event
|
|
17562
17568
|
* @returns {Promise<any>} - the response from the process trigger
|
|
17563
17569
|
*/
|
|
17564
|
-
async processTrigger(message, data) {
|
|
17570
|
+
async processTrigger(message, data, context) {
|
|
17565
17571
|
if (!this.iFrame) {
|
|
17566
17572
|
throw new Error('Iframe element is not set');
|
|
17567
17573
|
}
|
|
17568
17574
|
const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
|
|
17569
|
-
return processTrigger(this.iFrame, message, thoughtspotHost, data);
|
|
17575
|
+
return processTrigger(this.iFrame, message, thoughtspotHost, data, context);
|
|
17570
17576
|
}
|
|
17571
17577
|
async handleHostEventWithParam(apiName, parameters) {
|
|
17572
17578
|
var _a, _b, _c, _d;
|
|
@@ -17585,8 +17591,8 @@ class HostEventClient {
|
|
|
17585
17591
|
}
|
|
17586
17592
|
return { ...response.value };
|
|
17587
17593
|
}
|
|
17588
|
-
async hostEventFallback(hostEvent, data) {
|
|
17589
|
-
return this.processTrigger(hostEvent, data);
|
|
17594
|
+
async hostEventFallback(hostEvent, data, context) {
|
|
17595
|
+
return this.processTrigger(hostEvent, data, context);
|
|
17590
17596
|
}
|
|
17591
17597
|
/**
|
|
17592
17598
|
* Setter for the iframe element used for host events
|
|
@@ -17630,123 +17636,18 @@ class HostEventClient {
|
|
|
17630
17636
|
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,
|
|
17631
17637
|
};
|
|
17632
17638
|
}
|
|
17633
|
-
async triggerHostEvent(hostEvent, payload) {
|
|
17639
|
+
async triggerHostEvent(hostEvent, payload, context) {
|
|
17634
17640
|
switch (hostEvent) {
|
|
17635
17641
|
case HostEvent.Pin:
|
|
17636
17642
|
return this.handlePinEvent(payload);
|
|
17637
17643
|
case HostEvent.SaveAnswer:
|
|
17638
17644
|
return this.handleSaveAnswerEvent(payload);
|
|
17639
17645
|
default:
|
|
17640
|
-
return this.hostEventFallback(hostEvent, payload);
|
|
17646
|
+
return this.hostEventFallback(hostEvent, payload, context);
|
|
17641
17647
|
}
|
|
17642
17648
|
}
|
|
17643
17649
|
}
|
|
17644
17650
|
|
|
17645
|
-
const defaultUrls = {
|
|
17646
|
-
[InterceptedApiType.METADATA]: [
|
|
17647
|
-
'/prism/?op=CreateAnswerSession',
|
|
17648
|
-
'/prism/?op=GetV2SourceDetail',
|
|
17649
|
-
],
|
|
17650
|
-
[InterceptedApiType.ANSWER_DATA]: [
|
|
17651
|
-
'/prism/?op=GetChartWithData',
|
|
17652
|
-
'/prism/?op=GetTableWithHeadlineData',
|
|
17653
|
-
],
|
|
17654
|
-
[InterceptedApiType.LIVEBOARD_DATA]: [
|
|
17655
|
-
'/prism/?op=LoadContextBook'
|
|
17656
|
-
],
|
|
17657
|
-
};
|
|
17658
|
-
const formatInterceptUrl = (url) => {
|
|
17659
|
-
const host = getThoughtSpotHost(getEmbedConfig());
|
|
17660
|
-
if (url.startsWith('/'))
|
|
17661
|
-
return `${host}${url}`;
|
|
17662
|
-
return url;
|
|
17663
|
-
};
|
|
17664
|
-
const processInterceptUrls = (interceptUrls) => {
|
|
17665
|
-
let processedUrls = [...interceptUrls];
|
|
17666
|
-
Object.entries(defaultUrls).forEach(([apiType, apiTypeUrls]) => {
|
|
17667
|
-
if (!processedUrls.includes(apiType))
|
|
17668
|
-
return;
|
|
17669
|
-
processedUrls = processedUrls.filter(url => url !== apiType);
|
|
17670
|
-
processedUrls = [...processedUrls, ...apiTypeUrls];
|
|
17671
|
-
});
|
|
17672
|
-
return processedUrls.map(url => formatInterceptUrl(url));
|
|
17673
|
-
};
|
|
17674
|
-
const getInterceptInitData = (embedConfig, viewConfig) => {
|
|
17675
|
-
const enableApiIntercept = (embedConfig.enableApiIntercept || viewConfig.enableApiIntercept) && (viewConfig.enableApiIntercept !== false);
|
|
17676
|
-
if (!enableApiIntercept)
|
|
17677
|
-
return {
|
|
17678
|
-
enableApiIntercept: false,
|
|
17679
|
-
};
|
|
17680
|
-
const combinedUrls = [...(embedConfig.interceptUrls || []), ...(viewConfig.interceptUrls || [])];
|
|
17681
|
-
if (viewConfig.isOnBeforeGetVizDataInterceptEnabled) {
|
|
17682
|
-
combinedUrls.push(InterceptedApiType.ANSWER_DATA);
|
|
17683
|
-
}
|
|
17684
|
-
const shouldInterceptAll = combinedUrls.includes(InterceptedApiType.ALL);
|
|
17685
|
-
const interceptUrls = shouldInterceptAll ? [InterceptedApiType.ALL] : processInterceptUrls(combinedUrls);
|
|
17686
|
-
const interceptTimeout = embedConfig.interceptTimeout || viewConfig.interceptTimeout;
|
|
17687
|
-
return {
|
|
17688
|
-
interceptUrls,
|
|
17689
|
-
interceptTimeout,
|
|
17690
|
-
enableApiIntercept,
|
|
17691
|
-
};
|
|
17692
|
-
};
|
|
17693
|
-
/**
|
|
17694
|
-
*
|
|
17695
|
-
* @param fetchInit
|
|
17696
|
-
*/
|
|
17697
|
-
const parseInterceptData = (eventDataString) => {
|
|
17698
|
-
try {
|
|
17699
|
-
const { input, init } = JSON.parse(eventDataString);
|
|
17700
|
-
init.body = JSON.parse(init.body);
|
|
17701
|
-
const parsedInit = { input, init };
|
|
17702
|
-
return [parsedInit, null];
|
|
17703
|
-
}
|
|
17704
|
-
catch (error) {
|
|
17705
|
-
return [null, error];
|
|
17706
|
-
}
|
|
17707
|
-
};
|
|
17708
|
-
const handleInterceptEvent = async (params) => {
|
|
17709
|
-
var _a, _b, _c, _d, _e;
|
|
17710
|
-
const { eventData, executeEvent, viewConfig, getUnsavedAnswerTml } = params;
|
|
17711
|
-
const [interceptData, bodyParseError] = parseInterceptData(eventData.data);
|
|
17712
|
-
if (bodyParseError) {
|
|
17713
|
-
executeEvent(EmbedEvent.Error, {
|
|
17714
|
-
error: 'Error parsing api intercept body',
|
|
17715
|
-
});
|
|
17716
|
-
logger$3.error('Error parsing request body', bodyParseError);
|
|
17717
|
-
return;
|
|
17718
|
-
}
|
|
17719
|
-
const { input: requestUrl, init } = interceptData;
|
|
17720
|
-
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;
|
|
17721
|
-
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;
|
|
17722
|
-
if (defaultUrls.ANSWER_DATA.includes(requestUrl) && viewConfig.isOnBeforeGetVizDataInterceptEnabled) {
|
|
17723
|
-
const answerTml = await getUnsavedAnswerTml({ sessionId, vizId });
|
|
17724
|
-
executeEvent(EmbedEvent.OnBeforeGetVizDataIntercept, { data: { data: answerTml } });
|
|
17725
|
-
}
|
|
17726
|
-
executeEvent(EmbedEvent.ApiIntercept, interceptData);
|
|
17727
|
-
};
|
|
17728
|
-
const processLegacyInterceptResponse = (payload) => {
|
|
17729
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
17730
|
-
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);
|
|
17731
|
-
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);
|
|
17732
|
-
const payloadToSend = {
|
|
17733
|
-
execute: (_g = payload === null || payload === void 0 ? void 0 : payload.data) === null || _g === void 0 ? void 0 : _g.execute,
|
|
17734
|
-
response: {
|
|
17735
|
-
body: {
|
|
17736
|
-
errors: [
|
|
17737
|
-
{
|
|
17738
|
-
title: errorText,
|
|
17739
|
-
description: errorDescription,
|
|
17740
|
-
isUserError: true,
|
|
17741
|
-
},
|
|
17742
|
-
],
|
|
17743
|
-
data: {},
|
|
17744
|
-
},
|
|
17745
|
-
},
|
|
17746
|
-
};
|
|
17747
|
-
return { data: payloadToSend };
|
|
17748
|
-
};
|
|
17749
|
-
|
|
17750
17651
|
/**
|
|
17751
17652
|
* Copyright (c) 2022
|
|
17752
17653
|
*
|
|
@@ -17800,27 +17701,6 @@ class TsEmbed {
|
|
|
17800
17701
|
*/
|
|
17801
17702
|
this.fullscreenChangeHandler = null;
|
|
17802
17703
|
this.subscribedListeners = {};
|
|
17803
|
-
this.messageEventListener = async (event) => {
|
|
17804
|
-
const eventType = this.getEventType(event);
|
|
17805
|
-
const eventPort = this.getEventPort(event);
|
|
17806
|
-
const eventData = this.formatEventData(event, eventType);
|
|
17807
|
-
if (event.source === this.iFrame.contentWindow) {
|
|
17808
|
-
const processedEventData = await processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
17809
|
-
const executeEvent = (_eventType, data) => {
|
|
17810
|
-
this.executeCallbacks(_eventType, data, eventPort);
|
|
17811
|
-
};
|
|
17812
|
-
if (eventType === EmbedEvent.ApiIntercept && this.viewConfig.enableApiIntercept) {
|
|
17813
|
-
const getUnsavedAnswerTml = async (props) => {
|
|
17814
|
-
var _a;
|
|
17815
|
-
const response = await this.triggerUIPassThrough(UIPassthroughEvent.GetUnsavedAnswerTML, props);
|
|
17816
|
-
return (_a = response[0]) === null || _a === void 0 ? void 0 : _a.value;
|
|
17817
|
-
};
|
|
17818
|
-
handleInterceptEvent({ eventData: processedEventData, executeEvent, embedConfig: this.embedConfig, viewConfig: this.viewConfig, getUnsavedAnswerTml });
|
|
17819
|
-
return;
|
|
17820
|
-
}
|
|
17821
|
-
this.executeCallbacks(eventType, processedEventData, eventPort);
|
|
17822
|
-
}
|
|
17823
|
-
};
|
|
17824
17704
|
/**
|
|
17825
17705
|
* Send Custom style as part of payload of APP_INIT
|
|
17826
17706
|
* @param _
|
|
@@ -17905,18 +17785,6 @@ class TsEmbed {
|
|
|
17905
17785
|
this.on(EmbedEvent.AuthInit, authInitHandler, { start: false }, true);
|
|
17906
17786
|
};
|
|
17907
17787
|
this.showPreRenderByDefault = false;
|
|
17908
|
-
this.createEmbedEventResponder = (eventPort, eventType) => {
|
|
17909
|
-
const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
|
|
17910
|
-
if (eventType === EmbedEvent.OnBeforeGetVizDataIntercept && enableApiIntercept) {
|
|
17911
|
-
return (payload) => {
|
|
17912
|
-
const payloadToSend = processLegacyInterceptResponse(payload);
|
|
17913
|
-
this.triggerEventOnPort(eventPort, payloadToSend);
|
|
17914
|
-
};
|
|
17915
|
-
}
|
|
17916
|
-
return (payload) => {
|
|
17917
|
-
this.triggerEventOnPort(eventPort, payload);
|
|
17918
|
-
};
|
|
17919
|
-
};
|
|
17920
17788
|
/**
|
|
17921
17789
|
* @hidden
|
|
17922
17790
|
* Internal state to track if the embed container is loaded.
|
|
@@ -18102,8 +17970,16 @@ class TsEmbed {
|
|
|
18102
17970
|
*/
|
|
18103
17971
|
subscribeToMessageEvents() {
|
|
18104
17972
|
this.unsubscribeToMessageEvents();
|
|
18105
|
-
|
|
18106
|
-
|
|
17973
|
+
const messageEventListener = (event) => {
|
|
17974
|
+
const eventType = this.getEventType(event);
|
|
17975
|
+
const eventPort = this.getEventPort(event);
|
|
17976
|
+
const eventData = this.formatEventData(event, eventType);
|
|
17977
|
+
if (event.source === this.iFrame.contentWindow) {
|
|
17978
|
+
this.executeCallbacks(eventType, processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el), eventPort);
|
|
17979
|
+
}
|
|
17980
|
+
};
|
|
17981
|
+
window.addEventListener('message', messageEventListener);
|
|
17982
|
+
this.subscribedListeners.message = messageEventListener;
|
|
18107
17983
|
}
|
|
18108
17984
|
/**
|
|
18109
17985
|
* Adds event listeners for both network and message events.
|
|
@@ -18164,7 +18040,7 @@ class TsEmbed {
|
|
|
18164
18040
|
message: customActionsResult.errors,
|
|
18165
18041
|
});
|
|
18166
18042
|
}
|
|
18167
|
-
|
|
18043
|
+
return {
|
|
18168
18044
|
customisations: getCustomisations(this.embedConfig, this.viewConfig),
|
|
18169
18045
|
authToken,
|
|
18170
18046
|
runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
|
|
@@ -18182,9 +18058,7 @@ class TsEmbed {
|
|
|
18182
18058
|
customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
|
|
18183
18059
|
hiddenListColumns: this.viewConfig.hiddenListColumns || [],
|
|
18184
18060
|
customActions: customActionsResult.actions,
|
|
18185
|
-
...getInterceptInitData(this.embedConfig, this.viewConfig),
|
|
18186
18061
|
};
|
|
18187
|
-
return baseInitData;
|
|
18188
18062
|
}
|
|
18189
18063
|
async getAppInitData() {
|
|
18190
18064
|
return this.getDefaultAppInitData();
|
|
@@ -18613,8 +18487,9 @@ class TsEmbed {
|
|
|
18613
18487
|
// When start status is false it trigger only end releated
|
|
18614
18488
|
// payload
|
|
18615
18489
|
|| (!callbackObj.options.start && dataStatus === embedEventStatus.END)) {
|
|
18616
|
-
|
|
18617
|
-
|
|
18490
|
+
callbackObj.callback(data, (payload) => {
|
|
18491
|
+
this.triggerEventOnPort(eventPort, payload);
|
|
18492
|
+
});
|
|
18618
18493
|
}
|
|
18619
18494
|
});
|
|
18620
18495
|
}
|
|
@@ -18789,7 +18664,7 @@ class TsEmbed {
|
|
|
18789
18664
|
* @param {any} data The payload to send with the message
|
|
18790
18665
|
* @returns A promise that resolves with the response from the embedded app
|
|
18791
18666
|
*/
|
|
18792
|
-
async trigger(messageType, data = {}) {
|
|
18667
|
+
async trigger(messageType, data = {}, context = {}) {
|
|
18793
18668
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
18794
18669
|
if (!this.isRendered) {
|
|
18795
18670
|
this.handleError('Please call render before triggering events');
|
|
@@ -18806,7 +18681,7 @@ class TsEmbed {
|
|
|
18806
18681
|
return null;
|
|
18807
18682
|
}
|
|
18808
18683
|
// send an empty object, this is needed for liveboard default handlers
|
|
18809
|
-
return this.hostEventClient.triggerHostEvent(messageType, data);
|
|
18684
|
+
return this.hostEventClient.triggerHostEvent(messageType, data, context);
|
|
18810
18685
|
}
|
|
18811
18686
|
/**
|
|
18812
18687
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
@@ -19398,8 +19273,7 @@ let SearchEmbed$1 = class SearchEmbed extends TsEmbed {
|
|
|
19398
19273
|
if (hideSearchBar) {
|
|
19399
19274
|
queryParams[Param.HideSearchBar] = true;
|
|
19400
19275
|
}
|
|
19401
|
-
|
|
19402
|
-
if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
|
|
19276
|
+
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
19403
19277
|
queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
19404
19278
|
}
|
|
19405
19279
|
if (!focusSearchBarOnRender) {
|
|
@@ -19660,7 +19534,7 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
19660
19534
|
* embedded Liveboard or visualization.
|
|
19661
19535
|
*/
|
|
19662
19536
|
getEmbedParams() {
|
|
19663
|
-
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.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;
|
|
19537
|
+
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.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;
|
|
19664
19538
|
let params = {};
|
|
19665
19539
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
19666
19540
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
@@ -19713,8 +19587,7 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
19713
19587
|
if (enableAskSage) {
|
|
19714
19588
|
params[Param.enableAskSage] = enableAskSage;
|
|
19715
19589
|
}
|
|
19716
|
-
|
|
19717
|
-
if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
|
|
19590
|
+
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
19718
19591
|
params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
19719
19592
|
}
|
|
19720
19593
|
if (homePageSearchBarMode) {
|
|
@@ -19729,6 +19602,9 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
19729
19602
|
if (isPNGInScheduledEmailsEnabled !== undefined) {
|
|
19730
19603
|
params[Param.isPNGInScheduledEmailsEnabled] = isPNGInScheduledEmailsEnabled;
|
|
19731
19604
|
}
|
|
19605
|
+
if (hideTagFilterChips !== undefined) {
|
|
19606
|
+
params[Param.HideTagFilterChips] = hideTagFilterChips;
|
|
19607
|
+
}
|
|
19732
19608
|
if (isLinkParametersEnabled !== undefined) {
|
|
19733
19609
|
params[Param.isLinkParametersEnabled] = isLinkParametersEnabled;
|
|
19734
19610
|
}
|
|
@@ -21017,6 +20893,7 @@ isPreRenderedComponent = false) => React__default.forwardRef((props, forwardedRe
|
|
|
21017
20893
|
});
|
|
21018
20894
|
handleRendering(tsEmbed);
|
|
21019
20895
|
if (forwardedRef) {
|
|
20896
|
+
// eslint-disable-next-line no-param-reassign
|
|
21020
20897
|
forwardedRef.current = tsEmbed;
|
|
21021
20898
|
}
|
|
21022
20899
|
return () => {
|
|
@@ -21237,7 +21114,7 @@ const ConversationMessage = componentFactory(ConversationMessage$1);
|
|
|
21237
21114
|
*/
|
|
21238
21115
|
const SpotterMessage = React__default.forwardRef((props, ref) => {
|
|
21239
21116
|
const { message, query: _, ...otherProps } = props;
|
|
21240
|
-
return React__default.createElement(ConversationMessage, { ref: ref, ...message, ...otherProps });
|
|
21117
|
+
return (React__default.createElement(ConversationMessage, { ref: ref, ...message, ...otherProps }));
|
|
21241
21118
|
});
|
|
21242
21119
|
/**
|
|
21243
21120
|
* React component for PreRendered Conversation embed.
|