@thoughtspot/visual-embed-sdk 1.37.1 → 1.38.0-alpha.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/README.md +1 -1
- package/cjs/package.json +1 -1
- package/cjs/src/embed/app.js +1 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.d.ts +44 -9
- package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/cjs/src/embed/bodyless-conversation.js +35 -5
- package/cjs/src/embed/bodyless-conversation.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.spec.js +290 -5
- package/cjs/src/embed/bodyless-conversation.spec.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +40 -11
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +29 -4
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +7 -7
- package/cjs/src/embed/conversation.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +21 -10
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +4 -4
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +5 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/react/all-types-export.d.ts +1 -1
- package/cjs/src/react/all-types-export.d.ts.map +1 -1
- package/cjs/src/react/all-types-export.js +3 -1
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/react/index.d.ts +53 -5
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +73 -4
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +94 -0
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +2 -1
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +1 -0
- package/cjs/src/types.js.map +1 -1
- package/dist/{index-m9UtENc9.js → index-DeFzsyFF.js} +1 -1
- package/dist/index-NZYq1Tu3.js +7370 -0
- package/dist/src/embed/bodyless-conversation.d.ts +44 -9
- package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +40 -11
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/react/all-types-export.d.ts +1 -1
- package/dist/src/react/all-types-export.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +53 -5
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +2 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +583 -21
- package/dist/tsembed-react.js +583 -19
- package/dist/tsembed.es.js +86 -22
- package/dist/tsembed.js +92 -26
- package/dist/visual-embed-sdk-react-full.d.ts +184 -72
- package/dist/visual-embed-sdk-react.d.ts +184 -72
- package/dist/visual-embed-sdk.d.ts +87 -22
- package/lib/package.json +1 -1
- package/lib/src/embed/app.js +1 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.d.ts +44 -9
- package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/lib/src/embed/bodyless-conversation.js +33 -4
- package/lib/src/embed/bodyless-conversation.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.spec.js +292 -7
- package/lib/src/embed/bodyless-conversation.spec.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +40 -11
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +27 -3
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +8 -8
- package/lib/src/embed/conversation.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +21 -10
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +4 -4
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +4 -4
- package/lib/src/index.js.map +1 -1
- package/lib/src/react/all-types-export.d.ts +1 -1
- package/lib/src/react/all-types-export.d.ts.map +1 -1
- package/lib/src/react/all-types-export.js +1 -1
- package/lib/src/react/all-types-export.js.map +1 -1
- package/lib/src/react/index.d.ts +53 -5
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +73 -4
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +96 -2
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +2 -1
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +1 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +90 -25
- package/package.json +1 -1
- package/src/embed/app.ts +1 -1
- package/src/embed/bodyless-conversation.spec.ts +314 -7
- package/src/embed/bodyless-conversation.ts +53 -8
- package/src/embed/conversation.spec.ts +16 -16
- package/src/embed/conversation.ts +44 -11
- package/src/embed/liveboard.ts +25 -10
- package/src/embed/ts-embed.spec.ts +0 -2
- package/src/index.ts +16 -5
- package/src/react/all-types-export.ts +2 -0
- package/src/react/index.spec.tsx +157 -1
- package/src/react/index.tsx +98 -11
- package/src/types.ts +1 -0
|
@@ -11,13 +11,13 @@ declare module '@thoughtspot/visual-embed-sdk' {
|
|
|
11
11
|
* @summary ThoughtSpot Visual Embed SDK
|
|
12
12
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
13
13
|
*/
|
|
14
|
-
import { AppEmbed, Page, AppViewConfig, HomePageSearchBarMode } from '@thoughtspot/visual-embed-sdk/embed/app';
|
|
14
|
+
import { AppEmbed, Page, AppViewConfig, HomePageSearchBarMode, PrimaryNavbarVersion, HomePage } from '@thoughtspot/visual-embed-sdk/embed/app';
|
|
15
15
|
import { init, prefetch, logout, executeTML, exportTML, executeTMLInput, exportTMLInput } from '@thoughtspot/visual-embed-sdk/embed/base';
|
|
16
16
|
import { PinboardEmbed, LiveboardViewConfig, LiveboardEmbed } from '@thoughtspot/visual-embed-sdk/embed/liveboard';
|
|
17
17
|
import { SearchEmbed, SearchViewConfig } from '@thoughtspot/visual-embed-sdk/embed/search';
|
|
18
18
|
import { SearchBarEmbed, SearchBarViewConfig } from '@thoughtspot/visual-embed-sdk/embed/search-bar';
|
|
19
|
-
import { BodylessConversation, BodylessConversationViewConfig } from '@thoughtspot/visual-embed-sdk/embed/bodyless-conversation';
|
|
20
|
-
import { ConversationEmbed, ConversationViewConfig } from '@thoughtspot/visual-embed-sdk/embed/conversation';
|
|
19
|
+
import { SpotterAgentEmbed, SpotterAgentEmbedViewConfig, BodylessConversation, BodylessConversationViewConfig } from '@thoughtspot/visual-embed-sdk/embed/bodyless-conversation';
|
|
20
|
+
import { SpotterEmbed, SpotterEmbedViewConfig, ConversationEmbed, ConversationViewConfig } from '@thoughtspot/visual-embed-sdk/embed/conversation';
|
|
21
21
|
import { AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter } from '@thoughtspot/visual-embed-sdk/auth';
|
|
22
22
|
import { getSessionInfo } from '@thoughtspot/visual-embed-sdk/utils/sessionInfoService';
|
|
23
23
|
import { AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, PrefetchFeatures, FrameParams, DOMSelector, HomeLeftNavItem, HomepageModule, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, ContextMenuTriggerOptions, RuntimeParameter, LogLevel, VizPoint, CustomActionPayload, ListPageColumns } from '@thoughtspot/visual-embed-sdk/types';
|
|
@@ -30,7 +30,7 @@ declare module '@thoughtspot/visual-embed-sdk' {
|
|
|
30
30
|
import { getAnswerFromQuery } from '@thoughtspot/visual-embed-sdk/utils/graphql/nlsService/nls-answer-service';
|
|
31
31
|
import { createLiveboardWithAnswers } from '@thoughtspot/visual-embed-sdk/utils/liveboardService/liveboardService';
|
|
32
32
|
import { UIPassthroughEvent } from '@thoughtspot/visual-embed-sdk/embed/hostEventClient/contracts';
|
|
33
|
-
export { init, logout, prefetch, executeTML, exportTML, executeTMLInput, exportTMLInput, getEmbedConfig as getInitConfig, getSessionInfo, tokenizedFetch, getAnswerFromQuery, createLiveboardWithAnswers, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, SageEmbed, AppEmbed,
|
|
33
|
+
export { init, logout, prefetch, executeTML, exportTML, executeTMLInput, exportTMLInput, getEmbedConfig as getInitConfig, getSessionInfo, tokenizedFetch, getAnswerFromQuery, createLiveboardWithAnswers, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, SageEmbed, AppEmbed, SpotterAgentEmbed, SpotterAgentEmbedViewConfig, BodylessConversationViewConfig, BodylessConversation, SpotterEmbed, SpotterEmbedViewConfig, ConversationViewConfig, ConversationEmbed, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, AnswerService, SessionInterface, UnderlyingDataPoint, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, SageViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, HomeLeftNavItem, HomepageModule, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, CustomCssVariables, RuntimeParameter, LogLevel, uploadMixpanelEvent, MIXPANEL_EVENT, HomePageSearchBarMode, PrimaryNavbarVersion, HomePage, VizPoint, CustomActionPayload, UIPassthroughEvent, ListPageColumns, };
|
|
34
34
|
export { resetCachedAuthToken } from '@thoughtspot/visual-embed-sdk/authToken';
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -1651,21 +1651,33 @@ declare module '@thoughtspot/visual-embed-sdk/embed/bodyless-conversation' {
|
|
|
1651
1651
|
* Configuration for bodyless conversation options.
|
|
1652
1652
|
* @group Embed components
|
|
1653
1653
|
*/
|
|
1654
|
-
export interface
|
|
1654
|
+
export interface SpotterAgentEmbedViewConfig extends ViewConfig {
|
|
1655
1655
|
/**
|
|
1656
1656
|
* The ID of the worksheet to use for the conversation.
|
|
1657
1657
|
*/
|
|
1658
1658
|
worksheetId: string;
|
|
1659
|
+
/**
|
|
1660
|
+
* Optional CSS class name to add to the container div.
|
|
1661
|
+
*/
|
|
1662
|
+
containerClassName?: string;
|
|
1663
|
+
}
|
|
1664
|
+
/**
|
|
1665
|
+
* Configuration for conversation options.
|
|
1666
|
+
* @deprecated from SDK: 1.38.0 | ThoughtSpot: 10.10.0.cl
|
|
1667
|
+
* Use {@link SpotterAgentEmbedViewConfig} instead
|
|
1668
|
+
* @group Embed components
|
|
1669
|
+
*/
|
|
1670
|
+
export interface BodylessConversationViewConfig extends SpotterAgentEmbedViewConfig {
|
|
1659
1671
|
}
|
|
1660
|
-
interface
|
|
1672
|
+
interface SpotterAgentMessageViewConfig extends SpotterAgentEmbedViewConfig {
|
|
1661
1673
|
sessionId: string;
|
|
1662
1674
|
genNo: number;
|
|
1663
1675
|
acSessionId: string;
|
|
1664
1676
|
acGenNo: number;
|
|
1665
1677
|
}
|
|
1666
1678
|
class ConversationMessage extends TsEmbed {
|
|
1667
|
-
protected viewConfig:
|
|
1668
|
-
constructor(container: HTMLElement, viewConfig:
|
|
1679
|
+
protected viewConfig: SpotterAgentMessageViewConfig;
|
|
1680
|
+
constructor(container: HTMLElement, viewConfig: SpotterAgentMessageViewConfig);
|
|
1669
1681
|
getIframeSrc(): string;
|
|
1670
1682
|
render(): Promise<ConversationMessage>;
|
|
1671
1683
|
}
|
|
@@ -1674,9 +1686,9 @@ declare module '@thoughtspot/visual-embed-sdk/embed/bodyless-conversation' {
|
|
|
1674
1686
|
* chatbots or other conversational interfaces.
|
|
1675
1687
|
* @example
|
|
1676
1688
|
* ```js
|
|
1677
|
-
* import {
|
|
1689
|
+
* import { SpotterAgentEmbed } from '@thoughtspot/visual-embed-sdk';
|
|
1678
1690
|
*
|
|
1679
|
-
* const conversation = new
|
|
1691
|
+
* const conversation = new SpotterAgentEmbed({
|
|
1680
1692
|
* worksheetId: 'worksheetId',
|
|
1681
1693
|
* });
|
|
1682
1694
|
*
|
|
@@ -1686,10 +1698,10 @@ declare module '@thoughtspot/visual-embed-sdk/embed/bodyless-conversation' {
|
|
|
1686
1698
|
* document.body.appendChild(container); // or to any other element
|
|
1687
1699
|
* ```
|
|
1688
1700
|
* @group Embed components
|
|
1689
|
-
* @version SDK: 1.
|
|
1701
|
+
* @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl
|
|
1690
1702
|
*/
|
|
1691
|
-
export class
|
|
1692
|
-
constructor(viewConfig:
|
|
1703
|
+
export class SpotterAgentEmbed {
|
|
1704
|
+
constructor(viewConfig: SpotterAgentEmbedViewConfig);
|
|
1693
1705
|
sendMessage(userMessage: string): Promise<{
|
|
1694
1706
|
error: any;
|
|
1695
1707
|
container?: undefined;
|
|
@@ -1700,6 +1712,29 @@ declare module '@thoughtspot/visual-embed-sdk/embed/bodyless-conversation' {
|
|
|
1700
1712
|
error?: undefined;
|
|
1701
1713
|
}>;
|
|
1702
1714
|
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Create a conversation embed, which can be integrated inside
|
|
1717
|
+
* chatbots or other conversational interfaces.
|
|
1718
|
+
* @deprecated from SDK: 1.38.0 | ThoughtSpot: 10.10.0.cl
|
|
1719
|
+
* Use {@link SpotterAgentEmbed} instead
|
|
1720
|
+
* @example
|
|
1721
|
+
* ```js
|
|
1722
|
+
* import { SpotterAgentEmbed } from '@thoughtspot/visual-embed-sdk';
|
|
1723
|
+
*
|
|
1724
|
+
* const conversation = new SpotterAgentEmbed({
|
|
1725
|
+
* worksheetId: 'worksheetId',
|
|
1726
|
+
* });
|
|
1727
|
+
*
|
|
1728
|
+
* const { container, error } = await conversation.sendMessage('show me sales by region');
|
|
1729
|
+
*
|
|
1730
|
+
* // append the container to the DOM
|
|
1731
|
+
* document.body.appendChild(container); // or to any other element
|
|
1732
|
+
* ```
|
|
1733
|
+
* @group Embed components
|
|
1734
|
+
*/
|
|
1735
|
+
export class BodylessConversation extends SpotterAgentEmbed {
|
|
1736
|
+
constructor(viewConfig: BodylessConversationViewConfig);
|
|
1737
|
+
}
|
|
1703
1738
|
export {};
|
|
1704
1739
|
}
|
|
1705
1740
|
|
|
@@ -1716,10 +1751,10 @@ declare module '@thoughtspot/visual-embed-sdk/embed/conversation' {
|
|
|
1716
1751
|
searchQuery: string;
|
|
1717
1752
|
}
|
|
1718
1753
|
/**
|
|
1719
|
-
* The configuration for the embedded
|
|
1754
|
+
* The configuration for the embedded spotterEmbed options.
|
|
1720
1755
|
* @group Embed components
|
|
1721
1756
|
*/
|
|
1722
|
-
export interface
|
|
1757
|
+
export interface SpotterEmbedViewConfig extends ViewConfig {
|
|
1723
1758
|
/**
|
|
1724
1759
|
* The ID of the worksheet to use for the conversation.
|
|
1725
1760
|
*/
|
|
@@ -1733,7 +1768,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/conversation' {
|
|
|
1733
1768
|
* but still display the selected data source.
|
|
1734
1769
|
* @example
|
|
1735
1770
|
* ```js
|
|
1736
|
-
* const embed = new
|
|
1771
|
+
* const embed = new SpotterEmbed('#tsEmbed', {
|
|
1737
1772
|
* ... // other options
|
|
1738
1773
|
* disableSourceSelection : true,
|
|
1739
1774
|
* })
|
|
@@ -1745,7 +1780,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/conversation' {
|
|
|
1745
1780
|
* hideSourceSelection : Hide data source selection
|
|
1746
1781
|
* @example
|
|
1747
1782
|
* ```js
|
|
1748
|
-
* const embed = new
|
|
1783
|
+
* const embed = new SpotterEmbed('#tsEmbed', {
|
|
1749
1784
|
* ... // other options
|
|
1750
1785
|
* hideSourceSelection : true,
|
|
1751
1786
|
* })
|
|
@@ -1772,7 +1807,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/conversation' {
|
|
|
1772
1807
|
* default is false.
|
|
1773
1808
|
* @example
|
|
1774
1809
|
* ```js
|
|
1775
|
-
* const embed = new
|
|
1810
|
+
* const embed = new SpotterEmbed('#tsEmbed', {
|
|
1776
1811
|
* ... // other options
|
|
1777
1812
|
* showSpotterLimitations : true,
|
|
1778
1813
|
* })
|
|
@@ -1785,7 +1820,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/conversation' {
|
|
|
1785
1820
|
* the initial screen of the conversation.
|
|
1786
1821
|
* @example
|
|
1787
1822
|
* ```js
|
|
1788
|
-
* const embed = new
|
|
1823
|
+
* const embed = new SpotterEmbed('#tsEmbed', {
|
|
1789
1824
|
* ... // other options
|
|
1790
1825
|
* hideSampleQuestions : true,
|
|
1791
1826
|
* })
|
|
@@ -1794,12 +1829,43 @@ declare module '@thoughtspot/visual-embed-sdk/embed/conversation' {
|
|
|
1794
1829
|
*/
|
|
1795
1830
|
hideSampleQuestions?: boolean;
|
|
1796
1831
|
}
|
|
1832
|
+
/**
|
|
1833
|
+
* The configuration for the embedded spotterEmbed options.
|
|
1834
|
+
* @deprecated from SDK: 1.38.0 | ThoughtSpot: 10.10.0.cl
|
|
1835
|
+
* Use {@link SpotterEmbedViewConfig} instead
|
|
1836
|
+
* @group Embed components
|
|
1837
|
+
*/
|
|
1838
|
+
export interface ConversationViewConfig extends SpotterEmbedViewConfig {
|
|
1839
|
+
}
|
|
1840
|
+
/**
|
|
1841
|
+
* Embed ThoughtSpot AI Conversation.
|
|
1842
|
+
* @group Embed components
|
|
1843
|
+
* @example
|
|
1844
|
+
* ```js
|
|
1845
|
+
* const conversation = new SpotterEmbed('#tsEmbed', {
|
|
1846
|
+
* worksheetId: 'worksheetId',
|
|
1847
|
+
* searchOptions: {
|
|
1848
|
+
* searchQuery: 'searchQuery',
|
|
1849
|
+
* },
|
|
1850
|
+
* });
|
|
1851
|
+
* conversation.render();
|
|
1852
|
+
* ```
|
|
1853
|
+
* @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl
|
|
1854
|
+
*/
|
|
1855
|
+
export class SpotterEmbed extends TsEmbed {
|
|
1856
|
+
protected viewConfig: SpotterEmbedViewConfig;
|
|
1857
|
+
constructor(container: HTMLElement, viewConfig: SpotterEmbedViewConfig);
|
|
1858
|
+
getIframeSrc(): string;
|
|
1859
|
+
render(): Promise<SpotterEmbed>;
|
|
1860
|
+
}
|
|
1797
1861
|
/**
|
|
1798
1862
|
* Embed ThoughtSpot AI Conversation.
|
|
1863
|
+
* @deprecated from SDK: 1.38.0 | ThoughtSpot: 10.10.0.cl
|
|
1864
|
+
* Use {@link SpotterEmbed} instead
|
|
1799
1865
|
* @group Embed components
|
|
1800
1866
|
* @example
|
|
1801
1867
|
* ```js
|
|
1802
|
-
* const conversation = new
|
|
1868
|
+
* const conversation = new SpotterEmbed('#tsEmbed', {
|
|
1803
1869
|
* worksheetId: 'worksheetId',
|
|
1804
1870
|
* searchOptions: {
|
|
1805
1871
|
* searchQuery: 'searchQuery',
|
|
@@ -1807,13 +1873,11 @@ declare module '@thoughtspot/visual-embed-sdk/embed/conversation' {
|
|
|
1807
1873
|
* });
|
|
1808
1874
|
* conversation.render();
|
|
1809
1875
|
* ```
|
|
1810
|
-
* @version SDK: 1.
|
|
1876
|
+
* @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl
|
|
1811
1877
|
*/
|
|
1812
|
-
export class ConversationEmbed extends
|
|
1878
|
+
export class ConversationEmbed extends SpotterEmbed {
|
|
1813
1879
|
protected viewConfig: ConversationViewConfig;
|
|
1814
1880
|
constructor(container: HTMLElement, viewConfig: ConversationViewConfig);
|
|
1815
|
-
getIframeSrc(): string;
|
|
1816
|
-
render(): Promise<ConversationEmbed>;
|
|
1817
1881
|
}
|
|
1818
1882
|
}
|
|
1819
1883
|
|
|
@@ -5707,7 +5771,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
5707
5771
|
preAuthCache = "preAuthCache",
|
|
5708
5772
|
ShowSpotterLimitations = "showSpotterLimitations",
|
|
5709
5773
|
CoverAndFilterOptionInPDF = "coverAndFilterOptionInPDF",
|
|
5710
|
-
PrimaryAction = "primaryAction"
|
|
5774
|
+
PrimaryAction = "primaryAction",
|
|
5775
|
+
isSpotterAgentEmbed = "isSpotterAgentEmbed"
|
|
5711
5776
|
}
|
|
5712
5777
|
/**
|
|
5713
5778
|
* ThoughtSpot application pages include actions and menu commands
|
package/package.json
CHANGED
package/src/embed/app.ts
CHANGED
|
@@ -788,7 +788,7 @@ export class AppEmbed extends V1Embed {
|
|
|
788
788
|
};
|
|
789
789
|
|
|
790
790
|
private setIframeHeightForNonEmbedLiveboard = (data: MessagePayload) => {
|
|
791
|
-
const { height: frameHeight
|
|
791
|
+
const { height: frameHeight } = this.viewConfig.frameParams || {};
|
|
792
792
|
|
|
793
793
|
const liveboardRelatedRoutes = [
|
|
794
794
|
'/pinboard/',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'jest-fetch-mock';
|
|
2
|
-
import {
|
|
2
|
+
import { SpotterAgentEmbed, SpotterAgentEmbedViewConfig } from './bodyless-conversation';
|
|
3
3
|
import * as authInstance from '../auth';
|
|
4
4
|
import { init } from '../index';
|
|
5
5
|
import { Action, AuthType, RuntimeFilterOp } from '../types';
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
expectUrlToHaveParamsWithValues,
|
|
15
15
|
} from '../test/test-utils';
|
|
16
16
|
|
|
17
|
-
describe('
|
|
17
|
+
describe('SpotterAgentEmbed', () => {
|
|
18
18
|
const thoughtSpotHost = 'tshost';
|
|
19
19
|
|
|
20
20
|
beforeAll(() => {
|
|
@@ -31,7 +31,7 @@ describe('BodylessConversation', () => {
|
|
|
31
31
|
fetchMock.resetMocks();
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
test('should render the
|
|
34
|
+
test('should render the SpotterAgent embed', async () => {
|
|
35
35
|
fetchMock.mockResponses(
|
|
36
36
|
JSON.stringify({
|
|
37
37
|
data: {
|
|
@@ -117,12 +117,12 @@ describe('BodylessConversation', () => {
|
|
|
117
117
|
},
|
|
118
118
|
}),
|
|
119
119
|
);
|
|
120
|
-
const viewConfig:
|
|
120
|
+
const viewConfig: SpotterAgentEmbedViewConfig = {
|
|
121
121
|
worksheetId: 'worksheetId',
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
-
const
|
|
125
|
-
const result = await
|
|
124
|
+
const spotterEmbed = new SpotterAgentEmbed(viewConfig);
|
|
125
|
+
const result = await spotterEmbed.sendMessage('userMessage');
|
|
126
126
|
const iframeSrc = getIFrameSrc(result.container);
|
|
127
127
|
expectUrlToHaveParamsWithValues(iframeSrc, {
|
|
128
128
|
sessionId: 'sessionId',
|
|
@@ -134,7 +134,314 @@ describe('BodylessConversation', () => {
|
|
|
134
134
|
fetchMock.mockRejectOnce(
|
|
135
135
|
new Error('error'),
|
|
136
136
|
);
|
|
137
|
-
const errorResult = await
|
|
137
|
+
const errorResult = await spotterEmbed.sendMessage('userMessage');
|
|
138
138
|
expect(errorResult.error instanceof Error).toBeTruthy();
|
|
139
139
|
});
|
|
140
|
+
|
|
141
|
+
test('should apply containerClassName to the container element', async () => {
|
|
142
|
+
fetchMock.mockResponses(
|
|
143
|
+
JSON.stringify({
|
|
144
|
+
data: {
|
|
145
|
+
ConvAssist__createConversation: {
|
|
146
|
+
convId: 'conversationId',
|
|
147
|
+
initialCtx: {
|
|
148
|
+
type: 'TS_ANSWER',
|
|
149
|
+
tsAnsCtx: {
|
|
150
|
+
sessionId: 'sessionId',
|
|
151
|
+
genNo: 1,
|
|
152
|
+
stateKey: {
|
|
153
|
+
transactionId: 'transactionId',
|
|
154
|
+
generationNumber: 1,
|
|
155
|
+
},
|
|
156
|
+
worksheet: {
|
|
157
|
+
worksheetId: 'worksheetId',
|
|
158
|
+
worksheetName: 'GTM',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
}),
|
|
165
|
+
JSON.stringify({
|
|
166
|
+
data: {
|
|
167
|
+
ConvAssist__sendMessage: {
|
|
168
|
+
responses: [
|
|
169
|
+
{
|
|
170
|
+
msgId: 'msgId',
|
|
171
|
+
data: {
|
|
172
|
+
asstRespData: {
|
|
173
|
+
tool: 'TS_NLS',
|
|
174
|
+
asstRespText: '',
|
|
175
|
+
nlsAnsData: {
|
|
176
|
+
sageQuerySuggestions: [
|
|
177
|
+
{
|
|
178
|
+
llmReasoning: {
|
|
179
|
+
assumptions: 'You want the total [COL|sales] for [COL|item_type] [VAL|jackets] for [VAL|this year].',
|
|
180
|
+
clarifications: '',
|
|
181
|
+
interpretation: '',
|
|
182
|
+
__typename: 'eureka_SageQuerySuggestion_LLMReasoning',
|
|
183
|
+
},
|
|
184
|
+
tokens: [
|
|
185
|
+
'sum sales',
|
|
186
|
+
"item type = 'jackets'",
|
|
187
|
+
"date = 'this year'",
|
|
188
|
+
],
|
|
189
|
+
tmlTokens: [
|
|
190
|
+
'sum [sales]',
|
|
191
|
+
"[date] = [date].'this year'",
|
|
192
|
+
"[item type] = [item type].'jackets'",
|
|
193
|
+
],
|
|
194
|
+
worksheetId: 'worksheetId',
|
|
195
|
+
description: '',
|
|
196
|
+
title: '',
|
|
197
|
+
cached: false,
|
|
198
|
+
sqlQuery: "SELECT SUM(sales) FROM __Sample_Retail_Apparel WHERE item_type = 'jackets' AND date = _this_year();",
|
|
199
|
+
sessionId: 'sessionId',
|
|
200
|
+
genNo: 2,
|
|
201
|
+
formulaInfo: [],
|
|
202
|
+
tmlPhrases: [],
|
|
203
|
+
stateKey: {
|
|
204
|
+
transactionId: 'transactionId',
|
|
205
|
+
generationNumber: 1,
|
|
206
|
+
__typename: 'sage_auto_complete_v2_ACStateKey',
|
|
207
|
+
},
|
|
208
|
+
__typename: 'eureka_SageQuerySuggestion',
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
responseType: 'ANSWER',
|
|
212
|
+
__typename: 'convassist_nls_tool_NLSToolAsstRespData',
|
|
213
|
+
},
|
|
214
|
+
__typename: 'convassist_AsstResponseData',
|
|
215
|
+
},
|
|
216
|
+
__typename: 'convassist_MessageData',
|
|
217
|
+
},
|
|
218
|
+
type: 'ASST_RESPONSE',
|
|
219
|
+
__typename: 'convassist_MessagePayload',
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
__typename: 'convassist_SendMessageResponse',
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
}),
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
const viewConfig: SpotterAgentEmbedViewConfig = {
|
|
229
|
+
worksheetId: 'worksheetId',
|
|
230
|
+
containerClassName: 'custom-conversation-container',
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
const spotterAgentEmbed = new SpotterAgentEmbed(viewConfig);
|
|
234
|
+
const result = await spotterAgentEmbed.sendMessage('userMessage');
|
|
235
|
+
|
|
236
|
+
// Verify that the container has the custom class name
|
|
237
|
+
expect(result.container.className).toBe('custom-conversation-container');
|
|
238
|
+
|
|
239
|
+
// Also verify the iframe src is correct
|
|
240
|
+
const iframeSrc = getIFrameSrc(result.container);
|
|
241
|
+
expectUrlToHaveParamsWithValues(iframeSrc, {
|
|
242
|
+
sessionId: 'sessionId',
|
|
243
|
+
genNo: 2,
|
|
244
|
+
acSessionId: 'transactionId',
|
|
245
|
+
acGenNo: 1,
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
test('should not set className when containerClassName is not provided', async () => {
|
|
250
|
+
fetchMock.mockResponses(
|
|
251
|
+
JSON.stringify({
|
|
252
|
+
data: {
|
|
253
|
+
ConvAssist__createConversation: {
|
|
254
|
+
convId: 'conversationId',
|
|
255
|
+
initialCtx: {
|
|
256
|
+
type: 'TS_ANSWER',
|
|
257
|
+
tsAnsCtx: {
|
|
258
|
+
sessionId: 'sessionId',
|
|
259
|
+
genNo: 1,
|
|
260
|
+
stateKey: {
|
|
261
|
+
transactionId: 'transactionId',
|
|
262
|
+
generationNumber: 1,
|
|
263
|
+
},
|
|
264
|
+
worksheet: {
|
|
265
|
+
worksheetId: 'worksheetId',
|
|
266
|
+
worksheetName: 'GTM',
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
}),
|
|
273
|
+
JSON.stringify({
|
|
274
|
+
data: {
|
|
275
|
+
ConvAssist__sendMessage: {
|
|
276
|
+
responses: [
|
|
277
|
+
{
|
|
278
|
+
msgId: 'msgId',
|
|
279
|
+
data: {
|
|
280
|
+
asstRespData: {
|
|
281
|
+
tool: 'TS_NLS',
|
|
282
|
+
asstRespText: '',
|
|
283
|
+
nlsAnsData: {
|
|
284
|
+
sageQuerySuggestions: [
|
|
285
|
+
{
|
|
286
|
+
llmReasoning: {
|
|
287
|
+
assumptions: 'You want the total [COL|sales] for [COL|item_type] [VAL|jackets] for [VAL|this year].',
|
|
288
|
+
clarifications: '',
|
|
289
|
+
interpretation: '',
|
|
290
|
+
__typename: 'eureka_SageQuerySuggestion_LLMReasoning',
|
|
291
|
+
},
|
|
292
|
+
tokens: [
|
|
293
|
+
'sum sales',
|
|
294
|
+
"item type = 'jackets'",
|
|
295
|
+
"date = 'this year'",
|
|
296
|
+
],
|
|
297
|
+
tmlTokens: [
|
|
298
|
+
'sum [sales]',
|
|
299
|
+
"[date] = [date].'this year'",
|
|
300
|
+
"[item type] = [item type].'jackets'",
|
|
301
|
+
],
|
|
302
|
+
worksheetId: 'worksheetId',
|
|
303
|
+
description: '',
|
|
304
|
+
title: '',
|
|
305
|
+
cached: false,
|
|
306
|
+
sqlQuery: "SELECT SUM(sales) FROM __Sample_Retail_Apparel WHERE item_type = 'jackets' AND date = _this_year();",
|
|
307
|
+
sessionId: 'sessionId',
|
|
308
|
+
genNo: 2,
|
|
309
|
+
formulaInfo: [],
|
|
310
|
+
tmlPhrases: [],
|
|
311
|
+
stateKey: {
|
|
312
|
+
transactionId: 'transactionId',
|
|
313
|
+
generationNumber: 1,
|
|
314
|
+
__typename: 'sage_auto_complete_v2_ACStateKey',
|
|
315
|
+
},
|
|
316
|
+
__typename: 'eureka_SageQuerySuggestion',
|
|
317
|
+
},
|
|
318
|
+
],
|
|
319
|
+
responseType: 'ANSWER',
|
|
320
|
+
__typename: 'convassist_nls_tool_NLSToolAsstRespData',
|
|
321
|
+
},
|
|
322
|
+
__typename: 'convassist_AsstResponseData',
|
|
323
|
+
},
|
|
324
|
+
__typename: 'convassist_MessageData',
|
|
325
|
+
},
|
|
326
|
+
type: 'ASST_RESPONSE',
|
|
327
|
+
__typename: 'convassist_MessagePayload',
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
__typename: 'convassist_SendMessageResponse',
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
}),
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
const viewConfig: SpotterAgentEmbedViewConfig = {
|
|
337
|
+
worksheetId: 'worksheetId',
|
|
338
|
+
// No containerClassName provided
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
const spotterAgentEmbed = new SpotterAgentEmbed(viewConfig);
|
|
342
|
+
const result = await spotterAgentEmbed.sendMessage('userMessage');
|
|
343
|
+
|
|
344
|
+
// Verify that the container has no class name (empty string)
|
|
345
|
+
expect(result.container.className).toBe('');
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
test('should handle hideActions parameter correctly', async () => {
|
|
349
|
+
fetchMock.mockResponses(
|
|
350
|
+
JSON.stringify({
|
|
351
|
+
data: {
|
|
352
|
+
ConvAssist__createConversation: {
|
|
353
|
+
convId: 'conversationId',
|
|
354
|
+
initialCtx: {
|
|
355
|
+
type: 'TS_ANSWER',
|
|
356
|
+
tsAnsCtx: {
|
|
357
|
+
sessionId: 'sessionId',
|
|
358
|
+
genNo: 1,
|
|
359
|
+
stateKey: {
|
|
360
|
+
transactionId: 'transactionId',
|
|
361
|
+
generationNumber: 1,
|
|
362
|
+
},
|
|
363
|
+
worksheet: {
|
|
364
|
+
worksheetId: 'worksheetId',
|
|
365
|
+
worksheetName: 'GTM',
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
}),
|
|
372
|
+
JSON.stringify({
|
|
373
|
+
data: {
|
|
374
|
+
ConvAssist__sendMessage: {
|
|
375
|
+
responses: [
|
|
376
|
+
{
|
|
377
|
+
msgId: 'msgId',
|
|
378
|
+
data: {
|
|
379
|
+
asstRespData: {
|
|
380
|
+
tool: 'TS_NLS',
|
|
381
|
+
asstRespText: '',
|
|
382
|
+
nlsAnsData: {
|
|
383
|
+
sageQuerySuggestions: [
|
|
384
|
+
{
|
|
385
|
+
llmReasoning: {
|
|
386
|
+
assumptions: 'You want the total [COL|sales] for [COL|item_type] [VAL|jackets] for [VAL|this year].',
|
|
387
|
+
clarifications: '',
|
|
388
|
+
interpretation: '',
|
|
389
|
+
__typename: 'eureka_SageQuerySuggestion_LLMReasoning',
|
|
390
|
+
},
|
|
391
|
+
tokens: [
|
|
392
|
+
'sum sales',
|
|
393
|
+
"item type = 'jackets'",
|
|
394
|
+
"date = 'this year'",
|
|
395
|
+
],
|
|
396
|
+
tmlTokens: [
|
|
397
|
+
'sum [sales]',
|
|
398
|
+
"[date] = [date].'this year'",
|
|
399
|
+
"[item type] = [item type].'jackets'",
|
|
400
|
+
],
|
|
401
|
+
worksheetId: 'worksheetId',
|
|
402
|
+
description: '',
|
|
403
|
+
title: '',
|
|
404
|
+
cached: false,
|
|
405
|
+
sqlQuery: "SELECT SUM(sales) FROM __Sample_Retail_Apparel WHERE item_type = 'jackets' AND date = _this_year();",
|
|
406
|
+
sessionId: 'sessionId',
|
|
407
|
+
genNo: 2,
|
|
408
|
+
formulaInfo: [],
|
|
409
|
+
tmlPhrases: [],
|
|
410
|
+
stateKey: {
|
|
411
|
+
transactionId: 'transactionId',
|
|
412
|
+
generationNumber: 1,
|
|
413
|
+
__typename: 'sage_auto_complete_v2_ACStateKey',
|
|
414
|
+
},
|
|
415
|
+
__typename: 'eureka_SageQuerySuggestion',
|
|
416
|
+
},
|
|
417
|
+
],
|
|
418
|
+
responseType: 'ANSWER',
|
|
419
|
+
__typename: 'convassist_nls_tool_NLSToolAsstRespData',
|
|
420
|
+
},
|
|
421
|
+
__typename: 'convassist_AsstResponseData',
|
|
422
|
+
},
|
|
423
|
+
__typename: 'convassist_MessageData',
|
|
424
|
+
},
|
|
425
|
+
type: 'ASST_RESPONSE',
|
|
426
|
+
__typename: 'convassist_MessagePayload',
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
__typename: 'convassist_SendMessageResponse',
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
}),
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
const viewConfig: SpotterAgentEmbedViewConfig = {
|
|
436
|
+
worksheetId: 'worksheetId',
|
|
437
|
+
hiddenActions: [Action.Download, Action.Save], // This should trigger the HideActions branch
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
const spotterAgentEmbed = new SpotterAgentEmbed(viewConfig);
|
|
441
|
+
const result = await spotterAgentEmbed.sendMessage('userMessage');
|
|
442
|
+
|
|
443
|
+
// Verify the iframe src contains the hideActions parameter
|
|
444
|
+
const iframeSrc = getIFrameSrc(result.container);
|
|
445
|
+
expect(iframeSrc).toContain('hideAction');
|
|
446
|
+
});
|
|
140
447
|
});
|