@thoughtspot/visual-embed-sdk 1.39.1 → 1.39.2-spotter-agent

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.
Files changed (181) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/config.spec.js +9 -0
  3. package/cjs/src/config.spec.js.map +1 -1
  4. package/cjs/src/embed/app.d.ts.map +1 -1
  5. package/cjs/src/embed/app.js +2 -1
  6. package/cjs/src/embed/app.js.map +1 -1
  7. package/cjs/src/embed/app.spec.js +18 -8
  8. package/cjs/src/embed/app.spec.js.map +1 -1
  9. package/cjs/src/embed/bodyless-conversation.d.ts +19 -7
  10. package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
  11. package/cjs/src/embed/bodyless-conversation.js +24 -4
  12. package/cjs/src/embed/bodyless-conversation.js.map +1 -1
  13. package/cjs/src/embed/bodyless-conversation.spec.js +8 -190
  14. package/cjs/src/embed/bodyless-conversation.spec.js.map +1 -1
  15. package/cjs/src/embed/conversation.spec.js +28 -0
  16. package/cjs/src/embed/conversation.spec.js.map +1 -1
  17. package/cjs/src/embed/embedConfig.d.ts +9 -7
  18. package/cjs/src/embed/embedConfig.d.ts.map +1 -1
  19. package/cjs/src/embed/embedConfig.js +9 -7
  20. package/cjs/src/embed/embedConfig.js.map +1 -1
  21. package/cjs/src/embed/liveboard.d.ts +0 -17
  22. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  23. package/cjs/src/embed/liveboard.js +2 -4
  24. package/cjs/src/embed/liveboard.js.map +1 -1
  25. package/cjs/src/embed/liveboard.spec.js +12 -11
  26. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  27. package/cjs/src/embed/ts-embed.d.ts +5 -0
  28. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  29. package/cjs/src/embed/ts-embed.js +16 -1
  30. package/cjs/src/embed/ts-embed.js.map +1 -1
  31. package/cjs/src/embed/ts-embed.spec.js +164 -0
  32. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  33. package/cjs/src/errors.d.ts +1 -0
  34. package/cjs/src/errors.d.ts.map +1 -1
  35. package/cjs/src/errors.js +1 -0
  36. package/cjs/src/errors.js.map +1 -1
  37. package/cjs/src/pages/embed-test.page.d.ts +8 -0
  38. package/cjs/src/pages/embed-test.page.d.ts.map +1 -0
  39. package/cjs/src/pages/embed-test.page.js +20 -0
  40. package/cjs/src/pages/embed-test.page.js.map +1 -0
  41. package/cjs/src/pages/home.page.d.ts +6 -0
  42. package/cjs/src/pages/home.page.d.ts.map +1 -0
  43. package/cjs/src/pages/home.page.js +12 -0
  44. package/cjs/src/pages/home.page.js.map +1 -0
  45. package/cjs/src/pages/login.page.d.ts +15 -0
  46. package/cjs/src/pages/login.page.d.ts.map +1 -0
  47. package/cjs/src/pages/login.page.js +22 -0
  48. package/cjs/src/pages/login.page.js.map +1 -0
  49. package/cjs/src/react/all-types-export.d.ts +1 -1
  50. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  51. package/cjs/src/react/all-types-export.js +3 -2
  52. package/cjs/src/react/all-types-export.js.map +1 -1
  53. package/cjs/src/react/index.d.ts +71 -20
  54. package/cjs/src/react/index.d.ts.map +1 -1
  55. package/cjs/src/react/index.js +79 -42
  56. package/cjs/src/react/index.js.map +1 -1
  57. package/cjs/src/react/index.spec.js +436 -100
  58. package/cjs/src/react/index.spec.js.map +1 -1
  59. package/cjs/src/tests/auth.test.d.ts +1 -0
  60. package/cjs/src/tests/auth.test.d.ts.map +1 -0
  61. package/cjs/src/tests/auth.test.js +1 -0
  62. package/cjs/src/tests/auth.test.js.map +1 -0
  63. package/cjs/src/tests/e2e/auth.spec.d.ts +2 -0
  64. package/cjs/src/tests/e2e/auth.spec.d.ts.map +1 -0
  65. package/cjs/src/tests/e2e/auth.spec.js +54 -0
  66. package/cjs/src/tests/e2e/auth.spec.js.map +1 -0
  67. package/cjs/src/types.d.ts +34 -2
  68. package/cjs/src/types.d.ts.map +1 -1
  69. package/cjs/src/types.js +17 -1
  70. package/cjs/src/types.js.map +1 -1
  71. package/cjs/src/utils/graphql/nlsService/conversation-service.d.ts.map +1 -1
  72. package/cjs/src/utils/graphql/nlsService/conversation-service.js +2 -0
  73. package/cjs/src/utils/graphql/nlsService/conversation-service.js.map +1 -1
  74. package/cjs/src/utils.spec.js +25 -0
  75. package/cjs/src/utils.spec.js.map +1 -1
  76. package/dist/index-2QHwuA-G.js +7371 -0
  77. package/dist/index-Cj4BVGHL.js +7371 -0
  78. package/dist/index-DUaG1OG2.js +7447 -0
  79. package/dist/{index-JaFaxrvQ.js → index-DnIvX1FR.js} +1 -1
  80. package/dist/index-Fhk1V_Gw.js +7371 -0
  81. package/dist/index-OuiZF3zE.js +7371 -0
  82. package/dist/src/embed/app.d.ts.map +1 -1
  83. package/dist/src/embed/bodyless-conversation.d.ts +19 -7
  84. package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
  85. package/dist/src/embed/embedConfig.d.ts +9 -7
  86. package/dist/src/embed/embedConfig.d.ts.map +1 -1
  87. package/dist/src/embed/liveboard.d.ts +0 -17
  88. package/dist/src/embed/liveboard.d.ts.map +1 -1
  89. package/dist/src/embed/ts-embed.d.ts +5 -0
  90. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  91. package/dist/src/errors.d.ts +1 -0
  92. package/dist/src/errors.d.ts.map +1 -1
  93. package/dist/src/react/all-types-export.d.ts +1 -1
  94. package/dist/src/react/all-types-export.d.ts.map +1 -1
  95. package/dist/src/react/index.d.ts +71 -20
  96. package/dist/src/react/index.d.ts.map +1 -1
  97. package/dist/src/types.d.ts +34 -2
  98. package/dist/src/types.d.ts.map +1 -1
  99. package/dist/src/utils/graphql/nlsService/conversation-service.d.ts.map +1 -1
  100. package/dist/tsembed-react.es.js +157 -68
  101. package/dist/tsembed-react.js +157 -66
  102. package/dist/tsembed.es.js +74 -20
  103. package/dist/tsembed.js +73 -19
  104. package/dist/visual-embed-sdk-react-full.d.ts +132 -52
  105. package/dist/visual-embed-sdk-react.d.ts +132 -52
  106. package/dist/visual-embed-sdk.d.ts +62 -33
  107. package/lib/package.json +1 -1
  108. package/lib/src/config.spec.js +9 -0
  109. package/lib/src/config.spec.js.map +1 -1
  110. package/lib/src/embed/app.d.ts.map +1 -1
  111. package/lib/src/embed/app.js +2 -1
  112. package/lib/src/embed/app.js.map +1 -1
  113. package/lib/src/embed/app.spec.js +19 -9
  114. package/lib/src/embed/app.spec.js.map +1 -1
  115. package/lib/src/embed/bodyless-conversation.d.ts +19 -7
  116. package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
  117. package/lib/src/embed/bodyless-conversation.js +23 -4
  118. package/lib/src/embed/bodyless-conversation.js.map +1 -1
  119. package/lib/src/embed/bodyless-conversation.spec.js +9 -191
  120. package/lib/src/embed/bodyless-conversation.spec.js.map +1 -1
  121. package/lib/src/embed/conversation.spec.js +30 -2
  122. package/lib/src/embed/conversation.spec.js.map +1 -1
  123. package/lib/src/embed/embedConfig.d.ts +9 -7
  124. package/lib/src/embed/embedConfig.d.ts.map +1 -1
  125. package/lib/src/embed/embedConfig.js +9 -7
  126. package/lib/src/embed/embedConfig.js.map +1 -1
  127. package/lib/src/embed/liveboard.d.ts +0 -17
  128. package/lib/src/embed/liveboard.d.ts.map +1 -1
  129. package/lib/src/embed/liveboard.js +2 -4
  130. package/lib/src/embed/liveboard.js.map +1 -1
  131. package/lib/src/embed/liveboard.spec.js +12 -11
  132. package/lib/src/embed/liveboard.spec.js.map +1 -1
  133. package/lib/src/embed/ts-embed.d.ts +5 -0
  134. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  135. package/lib/src/embed/ts-embed.js +16 -1
  136. package/lib/src/embed/ts-embed.js.map +1 -1
  137. package/lib/src/embed/ts-embed.spec.js +164 -0
  138. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  139. package/lib/src/errors.d.ts +1 -0
  140. package/lib/src/errors.d.ts.map +1 -1
  141. package/lib/src/errors.js +1 -0
  142. package/lib/src/errors.js.map +1 -1
  143. package/lib/src/react/all-types-export.d.ts +1 -1
  144. package/lib/src/react/all-types-export.d.ts.map +1 -1
  145. package/lib/src/react/all-types-export.js +1 -1
  146. package/lib/src/react/all-types-export.js.map +1 -1
  147. package/lib/src/react/index.d.ts +71 -20
  148. package/lib/src/react/index.d.ts.map +1 -1
  149. package/lib/src/react/index.js +79 -43
  150. package/lib/src/react/index.js.map +1 -1
  151. package/lib/src/react/index.spec.js +439 -103
  152. package/lib/src/react/index.spec.js.map +1 -1
  153. package/lib/src/types.d.ts +34 -2
  154. package/lib/src/types.d.ts.map +1 -1
  155. package/lib/src/types.js +17 -1
  156. package/lib/src/types.js.map +1 -1
  157. package/lib/src/utils/graphql/nlsService/conversation-service.d.ts.map +1 -1
  158. package/lib/src/utils/graphql/nlsService/conversation-service.js +2 -0
  159. package/lib/src/utils/graphql/nlsService/conversation-service.js.map +1 -1
  160. package/lib/src/utils.spec.js +26 -1
  161. package/lib/src/utils.spec.js.map +1 -1
  162. package/lib/src/visual-embed-sdk.d.ts +62 -33
  163. package/package.json +1 -1
  164. package/src/config.spec.ts +11 -0
  165. package/src/embed/app.spec.ts +36 -23
  166. package/src/embed/app.ts +2 -0
  167. package/src/embed/bodyless-conversation.spec.ts +9 -203
  168. package/src/embed/bodyless-conversation.ts +24 -10
  169. package/src/embed/conversation.spec.ts +40 -2
  170. package/src/embed/embedConfig.ts +10 -8
  171. package/src/embed/liveboard.spec.ts +5 -4
  172. package/src/embed/liveboard.ts +2 -22
  173. package/src/embed/ts-embed.spec.ts +225 -0
  174. package/src/embed/ts-embed.ts +19 -0
  175. package/src/errors.ts +1 -0
  176. package/src/react/all-types-export.ts +2 -1
  177. package/src/react/index.spec.tsx +556 -157
  178. package/src/react/index.tsx +117 -51
  179. package/src/types.ts +75 -43
  180. package/src/utils/graphql/nlsService/conversation-service.ts +2 -0
  181. package/src/utils.spec.ts +29 -0
@@ -985,23 +985,6 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
985
985
  * })
986
986
  */
987
987
  dataSourceId?: string;
988
- /**
989
- * This flag is for show/hide checkboxes for include or exclude
990
- * cover page and filters in the Liveboard PDF.
991
- *
992
- * Supported embed types: `LiveboardEmbed`
993
- * @version SDK: 1.37.0 | ThoughtSpot:10.8.0.cl
994
- * @default true
995
- * Supported embed types: `LiveboardEmbed`
996
- * @example
997
- * ```js
998
- * const embed = new LiveboardEmbed('#tsEmbed', {
999
- * ... //other embed view config
1000
- * coverAndFilterOptionInPDF: false,
1001
- * })
1002
- * ```
1003
- */
1004
- coverAndFilterOptionInPDF?: boolean;
1005
988
  /**
1006
989
  * The list of tab IDs to hide from the embedded.
1007
990
  * This Tabs will be hidden from their respective LBs.
@@ -1581,10 +1564,6 @@ declare module '@thoughtspot/visual-embed-sdk/embed/bodyless-conversation' {
1581
1564
  * The ID of the worksheet to use for the conversation.
1582
1565
  */
1583
1566
  worksheetId: string;
1584
- /**
1585
- * Optional CSS class name to add to the container div.
1586
- */
1587
- containerClassName?: string;
1588
1567
  }
1589
1568
  /**
1590
1569
  * Configuration for conversation options.
@@ -1594,13 +1573,13 @@ declare module '@thoughtspot/visual-embed-sdk/embed/bodyless-conversation' {
1594
1573
  */
1595
1574
  export interface BodylessConversationViewConfig extends SpotterAgentEmbedViewConfig {
1596
1575
  }
1597
- interface SpotterAgentMessageViewConfig extends SpotterAgentEmbedViewConfig {
1576
+ export interface SpotterAgentMessageViewConfig extends SpotterAgentEmbedViewConfig {
1598
1577
  sessionId: string;
1599
1578
  genNo: number;
1600
1579
  acSessionId: string;
1601
1580
  acGenNo: number;
1602
1581
  }
1603
- class ConversationMessage extends TsEmbed {
1582
+ export class ConversationMessage extends TsEmbed {
1604
1583
  protected viewConfig: SpotterAgentMessageViewConfig;
1605
1584
  constructor(container: HTMLElement, viewConfig: SpotterAgentMessageViewConfig);
1606
1585
  getIframeSrc(): string;
@@ -1636,6 +1615,23 @@ declare module '@thoughtspot/visual-embed-sdk/embed/bodyless-conversation' {
1636
1615
  viz: ConversationMessage;
1637
1616
  error?: undefined;
1638
1617
  }>;
1618
+ /**
1619
+ * Send a message to the conversation service and return only the data.
1620
+ * @param userMessage - The message to send to the conversation service.
1621
+ * @returns The data from the conversation service.
1622
+ */
1623
+ sendMessageData(userMessage: string): Promise<{
1624
+ error: any;
1625
+ data?: undefined;
1626
+ } | {
1627
+ data: {
1628
+ sessionId: any;
1629
+ genNo: any;
1630
+ acSessionId: any;
1631
+ acGenNo: any;
1632
+ };
1633
+ error?: undefined;
1634
+ }>;
1639
1635
  }
1640
1636
  /**
1641
1637
  * Create a conversation embed, which can be integrated inside
@@ -1660,7 +1656,6 @@ declare module '@thoughtspot/visual-embed-sdk/embed/bodyless-conversation' {
1660
1656
  export class BodylessConversation extends SpotterAgentEmbed {
1661
1657
  constructor(viewConfig: BodylessConversationViewConfig);
1662
1658
  }
1663
- export {};
1664
1659
  }
1665
1660
 
1666
1661
  declare module '@thoughtspot/visual-embed-sdk/embed/conversation' {
@@ -3465,6 +3460,22 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
3465
3460
  * ```
3466
3461
  */
3467
3462
  enableAskSage?: boolean;
3463
+ /**
3464
+ * This flag is used to show or hide checkboxes for including or excluding
3465
+ * the cover and filters pages in the Liveboard PDF.
3466
+ *
3467
+ * Supported embed types: `AppEmbed`, `LiveboardEmbed`
3468
+ * @version SDK: 1.40.0 | ThoughtSpot:10.8.0.cl
3469
+ * @example
3470
+ * ```js
3471
+ * // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
3472
+ * const embed = new <EmbedComponent>('#tsEmbed', {
3473
+ * ... // other embed view config
3474
+ * coverAndFilterOptionInPDF: false,
3475
+ * })
3476
+ * ```
3477
+ */
3478
+ coverAndFilterOptionInPDF?: boolean;
3468
3479
  }
3469
3480
  export interface AllEmbedViewConfig extends BaseViewConfig, SearchLiveboardCommonViewConfig, HomePageConfig, LiveboardAppEmbedViewConfig {
3470
3481
  }
@@ -5936,7 +5947,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
5936
5947
  DataSourceId = "dataSourceId",
5937
5948
  preAuthCache = "preAuthCache",
5938
5949
  ShowSpotterLimitations = "showSpotterLimitations",
5939
- CoverAndFilterOptionInPDF = "coverAndFilterOptionInPDF",
5950
+ CoverAndFilterOptionInPDF = "arePdfCoverFilterPageCheckboxesEnabled",
5940
5951
  PrimaryAction = "primaryAction",
5941
5952
  isSpotterAgentEmbed = "isSpotterAgentEmbed",
5942
5953
  IsLiveboardStylingAndGroupingEnabled = "isLiveboardStylingAndGroupingEnabled"
@@ -7159,7 +7170,23 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
7159
7170
  * ```
7160
7171
  * @version SDK: 1.37.0 | ThoughtSpot Cloud: 10.8.0.cl
7161
7172
  */
7162
- CoverAndFilterOptionInPDF = "coverAndFilterOptionInPDF"
7173
+ CoverAndFilterOptionInPDF = "coverAndFilterOptionInPDF",
7174
+ /**
7175
+ * Action ID for hide or disable the
7176
+ * Spotter in conversation training widget.
7177
+ * The Add to Coaching feature is currently in beta
7178
+ * and is disabled by default on embed deployments.
7179
+ * To enable this feature on your instance,
7180
+ * contact ThoughtSpot Support.
7181
+ * @example
7182
+ * ```js
7183
+ * hiddenAction: [Action.InConversationTraining]
7184
+ * disabledActions: [Action.InConversationTraining]
7185
+ *
7186
+ * ```
7187
+ * @version SDK: 1.39.0 | ThoughtSpot Cloud: 10.10.0.cl
7188
+ */
7189
+ InConversationTraining = "InConversationTraining"
7163
7190
  }
7164
7191
  export interface AnswerServiceType {
7165
7192
  getAnswer?: (offset: number, batchSize: number) => any;
@@ -8083,13 +8110,14 @@ declare module '@thoughtspot/visual-embed-sdk/embed/embedConfig' {
8083
8110
  *
8084
8111
  * @example
8085
8112
  * ```js
8113
+ * import { getInitConfig } from '@thoughtspot/visual-embed-sdk';
8114
+ * // Call the getInitConfig method to retrieve the embed configuration
8086
8115
  * const config = getInitConfig();
8116
+ * // Log the configuration settings
8087
8117
  * console.log(config);
8088
8118
  * ```
8089
- * @example
8090
- *
8091
- * Returns the `EmbedConfig` object, which
8092
- * contains the configuration settings used to
8119
+ * Returns the link:https://developers.thoughtspot.com/docs/Interface_EmbedConfig[EmbedConfig]
8120
+ * object, which contains the configuration settings used to
8093
8121
  * initialize the SDK, including the following:
8094
8122
  *
8095
8123
  * - `thoughtSpotHost` - ThoughtSpot host URL
@@ -8098,9 +8126,10 @@ declare module '@thoughtspot/visual-embed-sdk/embed/embedConfig' {
8098
8126
  * - `customizations` - Style, text, and icon customization settings
8099
8127
  * that were applied during the SDK initialization.
8100
8128
  *
8101
- * For a comprehensive list of embed configuration settings,
8102
- * see link:https://developers.thoughtspot.com/docs/Interface_EmbedConfig[Developer Documentation].
8129
+ * The following JSON output shows the embed configuration
8130
+ * settings returned from the code in the previous example:
8103
8131
  *
8132
+ * @example
8104
8133
  * ```json
8105
8134
  * {
8106
8135
  * "thoughtSpotHost": "https://{ThoughtSpot-Host}",
@@ -8122,7 +8151,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/embedConfig' {
8122
8151
  * "authTriggerContainer": "#your-own-div"
8123
8152
  * }
8124
8153
  * ```
8125
- * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.cl, and later
8154
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw, and later
8126
8155
  * @group Global methods
8127
8156
  */
8128
8157
  export const getEmbedConfig: () => EmbedConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.39.1",
3
+ "version": "1.39.2-spotter-agent",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -21,6 +21,17 @@ describe('getThoughtSpotHost', () => {
21
21
  expect(testFn).toThrow(Error);
22
22
  });
23
23
 
24
+ test('invalid URL format', () => {
25
+ const testFn = () => {
26
+ getThoughtSpotHost({
27
+ ...embedConfig,
28
+ thoughtSpotHost: '',
29
+ });
30
+ };
31
+
32
+ expect(testFn).toThrow('Error parsing ThoughtSpot host. Please provide a valid URL.');
33
+ });
34
+
24
35
  test('IP address/hostname only', () => {
25
36
  expect(
26
37
  getThoughtSpotHost({
@@ -8,9 +8,7 @@ import {
8
8
  HomePage,
9
9
  } from './app';
10
10
  import { init } from '../index';
11
- import {
12
- Action, AuthType, EmbedEvent, HostEvent, RuntimeFilterOp,
13
- } from '../types';
11
+ import { Action, AuthType, EmbedEvent, HostEvent, RuntimeFilterOp } from '../types';
14
12
  import {
15
13
  executeAfterWait,
16
14
  getDocumentBody,
@@ -45,12 +43,13 @@ beforeAll(() => {
45
43
  authType: AuthType.None,
46
44
  });
47
45
  jest.spyOn(auth, 'postLoginService').mockImplementation(() => Promise.resolve({}));
48
- (window as any).ResizeObserver = window.ResizeObserver
49
- || jest.fn().mockImplementation(() => ({
50
- disconnect: jest.fn(),
51
- observe: jest.fn(),
52
- unobserve: jest.fn(),
53
- }));
46
+ (window as any).ResizeObserver =
47
+ window.ResizeObserver ||
48
+ jest.fn().mockImplementation(() => ({
49
+ disconnect: jest.fn(),
50
+ observe: jest.fn(),
51
+ unobserve: jest.fn(),
52
+ }));
54
53
  });
55
54
 
56
55
  const cleanUp = () => {
@@ -316,6 +315,20 @@ describe('App embed tests', () => {
316
315
  });
317
316
  });
318
317
 
318
+ test('should set coverAndFilterOptionInPDF to false in url', async () => {
319
+ const appEmbed = new AppEmbed(getRootEl(), {
320
+ ...defaultViewConfig,
321
+ coverAndFilterOptionInPDF: false,
322
+ } as AppViewConfig);
323
+ appEmbed.render();
324
+ await executeAfterWait(() => {
325
+ expectUrlMatchesWithParams(
326
+ getIFrameSrc(),
327
+ `http://${thoughtSpotHost}/?embedApp=true&profileAndHelpInNavBarHidden=false&arePdfCoverFilterPageCheckboxesEnabled=false${defaultParamsPost}#/home`,
328
+ );
329
+ });
330
+ });
331
+
319
332
  test('should set isLiveboardStylingAndGroupingEnabled to true in url', async () => {
320
333
  const appEmbed = new AppEmbed(getRootEl(), {
321
334
  ...defaultViewConfig,
@@ -687,7 +700,8 @@ describe('App embed tests', () => {
687
700
  const appEmbed = new AppEmbed(getRootEl(), {
688
701
  ...defaultViewConfig,
689
702
  // eslint-disable-next-line max-len
690
- dataPanelCustomGroupsAccordionInitialState: DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST,
703
+ dataPanelCustomGroupsAccordionInitialState:
704
+ DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST,
691
705
  } as AppViewConfig);
692
706
 
693
707
  appEmbed.render();
@@ -700,19 +714,18 @@ describe('App embed tests', () => {
700
714
  });
701
715
 
702
716
  test('should register event handlers to adjust iframe height', async () => {
703
- const onSpy = jest.spyOn(AppEmbed.prototype, 'on')
704
- .mockImplementation((event, callback) => {
705
- if (event === EmbedEvent.RouteChange) {
706
- callback({ data: { currentPath: '/answers' } }, jest.fn());
707
- }
708
- if (event === EmbedEvent.EmbedHeight) {
709
- callback({ data: '100%' });
710
- }
711
- if (event === EmbedEvent.EmbedIframeCenter) {
712
- callback({}, jest.fn());
713
- }
714
- return null;
715
- });
717
+ const onSpy = jest.spyOn(AppEmbed.prototype, 'on').mockImplementation((event, callback) => {
718
+ if (event === EmbedEvent.RouteChange) {
719
+ callback({ data: { currentPath: '/answers' } }, jest.fn());
720
+ }
721
+ if (event === EmbedEvent.EmbedHeight) {
722
+ callback({ data: '100%' });
723
+ }
724
+ if (event === EmbedEvent.EmbedIframeCenter) {
725
+ callback({}, jest.fn());
726
+ }
727
+ return null;
728
+ });
716
729
  jest.spyOn(TsEmbed.prototype as any, 'getIframeCenter').mockReturnValue({});
717
730
  jest.spyOn(TsEmbed.prototype as any, 'setIFrameHeight').mockReturnValue({});
718
731
  const appEmbed = new AppEmbed(getRootEl(), {
package/src/embed/app.ts CHANGED
@@ -588,6 +588,7 @@ export class AppEmbed extends V1Embed {
588
588
  isUnifiedSearchExperienceEnabled = true,
589
589
  enablePendoHelp = true,
590
590
  discoveryExperience,
591
+ coverAndFilterOptionInPDF = false,
591
592
  isLiveboardStylingAndGroupingEnabled,
592
593
  } = this.viewConfig;
593
594
 
@@ -606,6 +607,7 @@ export class AppEmbed extends V1Embed {
606
607
  params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
607
608
  params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
608
609
  params[Param.IsUnifiedSearchExperienceEnabled] = isUnifiedSearchExperienceEnabled;
610
+ params[Param.CoverAndFilterOptionInPDF] = !!coverAndFilterOptionInPDF;
609
611
 
610
612
  params = this.getBaseQueryParams(params);
611
613
 
@@ -1,5 +1,5 @@
1
1
  import 'jest-fetch-mock';
2
- import { SpotterAgentEmbed, SpotterAgentEmbedViewConfig } from './bodyless-conversation';
2
+ import { SpotterAgentEmbed, SpotterAgentEmbedViewConfig, ConversationMessage } from './bodyless-conversation';
3
3
  import * as authInstance from '../auth';
4
4
  import { init } from '../index';
5
5
  import { Action, AuthType, RuntimeFilterOp } from '../types';
@@ -138,7 +138,7 @@ describe('SpotterAgentEmbed', () => {
138
138
  expect(errorResult.error instanceof Error).toBeTruthy();
139
139
  });
140
140
 
141
- test('should apply containerClassName to the container element', async () => {
141
+ test('should handle hideActions parameter correctly', async () => {
142
142
  fetchMock.mockResponses(
143
143
  JSON.stringify({
144
144
  data: {
@@ -227,221 +227,27 @@ describe('SpotterAgentEmbed', () => {
227
227
 
228
228
  const viewConfig: SpotterAgentEmbedViewConfig = {
229
229
  worksheetId: 'worksheetId',
230
- containerClassName: 'custom-conversation-container',
230
+ hiddenActions: [Action.Download, Action.Save], // This should trigger the HideActions branch
231
231
  };
232
232
 
233
233
  const spotterAgentEmbed = new SpotterAgentEmbed(viewConfig);
234
234
  const result = await spotterAgentEmbed.sendMessage('userMessage');
235
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
236
+ // Verify the iframe src contains the hideActions parameter
240
237
  const iframeSrc = getIFrameSrc(result.container);
241
- expectUrlToHaveParamsWithValues(iframeSrc, {
242
- sessionId: 'sessionId',
243
- genNo: 2,
244
- acSessionId: 'transactionId',
245
- acGenNo: 1,
246
- });
238
+ expect(iframeSrc).toContain('hideAction');
247
239
  });
248
240
 
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
-
241
+ test('should have sendMessageData method', () => {
336
242
  const viewConfig: SpotterAgentEmbedViewConfig = {
337
243
  worksheetId: 'worksheetId',
338
- // No containerClassName provided
339
244
  };
340
245
 
341
246
  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('');
247
+ expect(typeof spotterAgentEmbed.sendMessageData).toBe('function');
346
248
  });
347
249
 
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');
250
+ test('should export ConversationMessage class', () => {
251
+ expect(typeof ConversationMessage).toBe('function');
446
252
  });
447
253
  });
@@ -13,11 +13,6 @@ export interface SpotterAgentEmbedViewConfig extends Omit<BaseViewConfig, 'prima
13
13
  * The ID of the worksheet to use for the conversation.
14
14
  */
15
15
  worksheetId: string;
16
-
17
- /**
18
- * Optional CSS class name to add to the container div.
19
- */
20
- containerClassName?: string;
21
16
  }
22
17
 
23
18
  /**
@@ -29,14 +24,14 @@ export interface SpotterAgentEmbedViewConfig extends Omit<BaseViewConfig, 'prima
29
24
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
30
25
  export interface BodylessConversationViewConfig extends SpotterAgentEmbedViewConfig {}
31
26
 
32
- interface SpotterAgentMessageViewConfig extends SpotterAgentEmbedViewConfig {
27
+ export interface SpotterAgentMessageViewConfig extends SpotterAgentEmbedViewConfig {
33
28
  sessionId: string;
34
29
  genNo: number;
35
30
  acSessionId: string;
36
31
  acGenNo: number;
37
32
  }
38
33
 
39
- class ConversationMessage extends TsEmbed {
34
+ export class ConversationMessage extends TsEmbed {
40
35
  constructor(container: HTMLElement, protected viewConfig: SpotterAgentMessageViewConfig) {
41
36
  viewConfig.embedComponentType = 'bodyless-conversation';
42
37
  super(container, viewConfig);
@@ -116,9 +111,6 @@ export class SpotterAgentEmbed {
116
111
  }
117
112
 
118
113
  const container = document.createElement('div');
119
- if (this.viewConfig.containerClassName) {
120
- container.className = this.viewConfig.containerClassName;
121
- }
122
114
 
123
115
  const embed = new ConversationMessage(container, {
124
116
  ...this.viewConfig,
@@ -130,6 +122,28 @@ export class SpotterAgentEmbed {
130
122
  await embed.render();
131
123
  return { container, viz: embed };
132
124
  }
125
+
126
+ /**
127
+ * Send a message to the conversation service and return only the data.
128
+ * @param userMessage - The message to send to the conversation service.
129
+ * @returns The data from the conversation service.
130
+ */
131
+ public async sendMessageData(userMessage: string) {
132
+ try {
133
+ const { data, error } = await this.conversationService.sendMessage(userMessage);
134
+ if (error) {
135
+ return { error };
136
+ }
137
+ return { data: {
138
+ sessionId: data.sessionId,
139
+ genNo: data.genNo,
140
+ acSessionId: data.stateKey.transactionId,
141
+ acGenNo: data.stateKey.generationNumber,
142
+ } };
143
+ } catch (error) {
144
+ return { error: error as Error };
145
+ }
146
+ }
133
147
  }
134
148
 
135
149
  /**