@thoughtspot/visual-embed-sdk 1.35.3 → 1.35.4

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 (209) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/auth.spec.js +12 -0
  3. package/cjs/src/auth.spec.js.map +1 -1
  4. package/cjs/src/authToken.spec.js +1 -1
  5. package/cjs/src/authToken.spec.js.map +1 -1
  6. package/cjs/src/embed/app.d.ts +1 -1
  7. package/cjs/src/embed/app.d.ts.map +1 -1
  8. package/cjs/src/embed/app.js +4 -3
  9. package/cjs/src/embed/app.js.map +1 -1
  10. package/cjs/src/embed/base.d.ts +1 -1
  11. package/cjs/src/embed/base.js +1 -1
  12. package/cjs/src/embed/bodyless-conversation.spec.js +0 -1
  13. package/cjs/src/embed/bodyless-conversation.spec.js.map +1 -1
  14. package/cjs/src/embed/hostEventClient/contracts.d.ts +79 -0
  15. package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -0
  16. package/cjs/src/embed/hostEventClient/contracts.js +14 -0
  17. package/cjs/src/embed/hostEventClient/contracts.js.map +1 -0
  18. package/cjs/src/embed/hostEventClient/host-event-client.d.ts +25 -0
  19. package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -0
  20. package/cjs/src/embed/hostEventClient/host-event-client.js +89 -0
  21. package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -0
  22. package/cjs/src/embed/hostEventClient/host-event-client.spec.d.ts +2 -0
  23. package/cjs/src/embed/hostEventClient/host-event-client.spec.d.ts.map +1 -0
  24. package/cjs/src/embed/hostEventClient/host-event-client.spec.js +191 -0
  25. package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -0
  26. package/cjs/src/embed/liveboard.d.ts +10 -8
  27. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  28. package/cjs/src/embed/liveboard.js +3 -3
  29. package/cjs/src/embed/liveboard.js.map +1 -1
  30. package/cjs/src/embed/liveboard.spec.js +34 -2
  31. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  32. package/cjs/src/embed/search.spec.js +11 -0
  33. package/cjs/src/embed/search.spec.js.map +1 -1
  34. package/cjs/src/embed/searchEmbed-basic-auth.spec.d.ts +2 -0
  35. package/cjs/src/embed/searchEmbed-basic-auth.spec.d.ts.map +1 -0
  36. package/cjs/src/embed/searchEmbed-basic-auth.spec.js +104 -0
  37. package/cjs/src/embed/searchEmbed-basic-auth.spec.js.map +1 -0
  38. package/cjs/src/embed/ts-embed.d.ts +21 -4
  39. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  40. package/cjs/src/embed/ts-embed.js +30 -9
  41. package/cjs/src/embed/ts-embed.js.map +1 -1
  42. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  43. package/cjs/src/embed/ts-embed.spec.js +26 -1
  44. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  45. package/cjs/src/hostEventsTypeMapping.d.ts +2 -0
  46. package/cjs/src/hostEventsTypeMapping.d.ts.map +1 -0
  47. package/cjs/src/hostEventsTypeMapping.js +4 -0
  48. package/cjs/src/hostEventsTypeMapping.js.map +1 -0
  49. package/cjs/src/index.d.ts +2 -1
  50. package/cjs/src/index.d.ts.map +1 -1
  51. package/cjs/src/index.js +3 -1
  52. package/cjs/src/index.js.map +1 -1
  53. package/cjs/src/react/all-types-export.d.ts +1 -1
  54. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  55. package/cjs/src/react/all-types-export.js +2 -1
  56. package/cjs/src/react/all-types-export.js.map +1 -1
  57. package/cjs/src/types.d.ts +38 -23
  58. package/cjs/src/types.d.ts.map +1 -1
  59. package/cjs/src/types.js +31 -20
  60. package/cjs/src/types.js.map +1 -1
  61. package/cjs/src/utils/embedApi/contracts.d.ts +101 -0
  62. package/cjs/src/utils/embedApi/contracts.d.ts.map +1 -0
  63. package/cjs/src/utils/embedApi/contracts.js +17 -0
  64. package/cjs/src/utils/embedApi/contracts.js.map +1 -0
  65. package/cjs/src/utils/embedApi/embedApiClient.d.ts +12 -0
  66. package/cjs/src/utils/embedApi/embedApiClient.d.ts.map +1 -0
  67. package/cjs/src/utils/embedApi/embedApiClient.js +46 -0
  68. package/cjs/src/utils/embedApi/embedApiClient.js.map +1 -0
  69. package/cjs/src/utils/embedApi/processEmbedApi.d.ts +9 -0
  70. package/cjs/src/utils/embedApi/processEmbedApi.d.ts.map +1 -0
  71. package/cjs/src/utils/embedApi/processEmbedApi.js +18 -0
  72. package/cjs/src/utils/embedApi/processEmbedApi.js.map +1 -0
  73. package/dist/{index-BaGHDCpW.js → index-BBBimG1x.js} +1 -1
  74. package/dist/index-CENLvayL.js +7370 -0
  75. package/dist/index-CbltIawo.js +7370 -0
  76. package/dist/index-CoQfqaHj.js +7370 -0
  77. package/dist/index-CzwzS0P4.js +7370 -0
  78. package/dist/index-DFwi_pV_.js +7370 -0
  79. package/dist/index-DOIjN0N_.js +7370 -0
  80. package/dist/index-DYBx8SuE.js +7370 -0
  81. package/dist/index-DaLHJaLd.js +7370 -0
  82. package/dist/index-nWevLycs.js +7370 -0
  83. package/dist/src/embed/app.d.ts +1 -1
  84. package/dist/src/embed/app.d.ts.map +1 -1
  85. package/dist/src/embed/base.d.ts +1 -1
  86. package/dist/src/embed/hostEventClient/contracts.d.ts +79 -0
  87. package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -0
  88. package/dist/src/embed/hostEventClient/host-event-client.d.ts +25 -0
  89. package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -0
  90. package/dist/src/embed/hostEventClient/host-event-client.spec.d.ts +2 -0
  91. package/dist/src/embed/hostEventClient/host-event-client.spec.d.ts.map +1 -0
  92. package/dist/src/embed/liveboard.d.ts +10 -8
  93. package/dist/src/embed/liveboard.d.ts.map +1 -1
  94. package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts +2 -0
  95. package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts.map +1 -0
  96. package/dist/src/embed/ts-embed.d.ts +21 -4
  97. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  98. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  99. package/dist/src/hostEventsTypeMapping.d.ts +2 -0
  100. package/dist/src/hostEventsTypeMapping.d.ts.map +1 -0
  101. package/dist/src/index.d.ts +2 -1
  102. package/dist/src/index.d.ts.map +1 -1
  103. package/dist/src/react/all-types-export.d.ts +1 -1
  104. package/dist/src/react/all-types-export.d.ts.map +1 -1
  105. package/dist/src/types.d.ts +38 -23
  106. package/dist/src/types.d.ts.map +1 -1
  107. package/dist/src/utils/embedApi/contracts.d.ts +101 -0
  108. package/dist/src/utils/embedApi/contracts.d.ts.map +1 -0
  109. package/dist/src/utils/embedApi/embedApiClient.d.ts +12 -0
  110. package/dist/src/utils/embedApi/embedApiClient.d.ts.map +1 -0
  111. package/dist/src/utils/embedApi/processEmbedApi.d.ts +9 -0
  112. package/dist/src/utils/embedApi/processEmbedApi.d.ts.map +1 -0
  113. package/dist/tsembed-react.es.js +161 -37
  114. package/dist/tsembed-react.js +160 -36
  115. package/dist/tsembed.es.js +163 -39
  116. package/dist/tsembed.js +161 -37
  117. package/dist/visual-embed-sdk-react-full.d.ts +170 -38
  118. package/dist/visual-embed-sdk-react.d.ts +170 -38
  119. package/dist/visual-embed-sdk.d.ts +170 -38
  120. package/lib/package.json +1 -1
  121. package/lib/src/auth.spec.js +12 -0
  122. package/lib/src/auth.spec.js.map +1 -1
  123. package/lib/src/authToken.spec.js +1 -1
  124. package/lib/src/authToken.spec.js.map +1 -1
  125. package/lib/src/embed/app.d.ts +1 -1
  126. package/lib/src/embed/app.d.ts.map +1 -1
  127. package/lib/src/embed/app.js +4 -3
  128. package/lib/src/embed/app.js.map +1 -1
  129. package/lib/src/embed/base.d.ts +1 -1
  130. package/lib/src/embed/base.js +1 -1
  131. package/lib/src/embed/bodyless-conversation.spec.js +0 -1
  132. package/lib/src/embed/bodyless-conversation.spec.js.map +1 -1
  133. package/lib/src/embed/hostEventClient/contracts.d.ts +79 -0
  134. package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -0
  135. package/lib/src/embed/hostEventClient/contracts.js +11 -0
  136. package/lib/src/embed/hostEventClient/contracts.js.map +1 -0
  137. package/lib/src/embed/hostEventClient/host-event-client.d.ts +25 -0
  138. package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -0
  139. package/lib/src/embed/hostEventClient/host-event-client.js +85 -0
  140. package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -0
  141. package/lib/src/embed/hostEventClient/host-event-client.spec.d.ts +2 -0
  142. package/lib/src/embed/hostEventClient/host-event-client.spec.d.ts.map +1 -0
  143. package/lib/src/embed/hostEventClient/host-event-client.spec.js +188 -0
  144. package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -0
  145. package/lib/src/embed/liveboard.d.ts +10 -8
  146. package/lib/src/embed/liveboard.d.ts.map +1 -1
  147. package/lib/src/embed/liveboard.js +3 -3
  148. package/lib/src/embed/liveboard.js.map +1 -1
  149. package/lib/src/embed/liveboard.spec.js +34 -2
  150. package/lib/src/embed/liveboard.spec.js.map +1 -1
  151. package/lib/src/embed/search.spec.js +11 -0
  152. package/lib/src/embed/search.spec.js.map +1 -1
  153. package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts +2 -0
  154. package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts.map +1 -0
  155. package/lib/src/embed/searchEmbed-basic-auth.spec.js +101 -0
  156. package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -0
  157. package/lib/src/embed/ts-embed.d.ts +21 -4
  158. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  159. package/lib/src/embed/ts-embed.js +30 -9
  160. package/lib/src/embed/ts-embed.js.map +1 -1
  161. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  162. package/lib/src/embed/ts-embed.spec.js +28 -3
  163. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  164. package/lib/src/hostEventsTypeMapping.d.ts +2 -0
  165. package/lib/src/hostEventsTypeMapping.d.ts.map +1 -0
  166. package/lib/src/hostEventsTypeMapping.js +2 -0
  167. package/lib/src/hostEventsTypeMapping.js.map +1 -0
  168. package/lib/src/index.d.ts +2 -1
  169. package/lib/src/index.d.ts.map +1 -1
  170. package/lib/src/index.js +2 -1
  171. package/lib/src/index.js.map +1 -1
  172. package/lib/src/react/all-types-export.d.ts +1 -1
  173. package/lib/src/react/all-types-export.d.ts.map +1 -1
  174. package/lib/src/react/all-types-export.js +1 -1
  175. package/lib/src/react/all-types-export.js.map +1 -1
  176. package/lib/src/types.d.ts +38 -23
  177. package/lib/src/types.d.ts.map +1 -1
  178. package/lib/src/types.js +31 -20
  179. package/lib/src/types.js.map +1 -1
  180. package/lib/src/utils/embedApi/contracts.d.ts +101 -0
  181. package/lib/src/utils/embedApi/contracts.d.ts.map +1 -0
  182. package/lib/src/utils/embedApi/contracts.js +14 -0
  183. package/lib/src/utils/embedApi/contracts.js.map +1 -0
  184. package/lib/src/utils/embedApi/embedApiClient.d.ts +12 -0
  185. package/lib/src/utils/embedApi/embedApiClient.d.ts.map +1 -0
  186. package/lib/src/utils/embedApi/embedApiClient.js +42 -0
  187. package/lib/src/utils/embedApi/embedApiClient.js.map +1 -0
  188. package/lib/src/utils/embedApi/processEmbedApi.d.ts +9 -0
  189. package/lib/src/utils/embedApi/processEmbedApi.d.ts.map +1 -0
  190. package/lib/src/utils/embedApi/processEmbedApi.js +14 -0
  191. package/lib/src/utils/embedApi/processEmbedApi.js.map +1 -0
  192. package/lib/src/visual-embed-sdk.d.ts +181 -38
  193. package/package.json +1 -1
  194. package/src/auth.spec.ts +13 -0
  195. package/src/authToken.spec.ts +1 -1
  196. package/src/embed/app.ts +7 -4
  197. package/src/embed/base.ts +1 -1
  198. package/src/embed/bodyless-conversation.spec.ts +0 -1
  199. package/src/embed/hostEventClient/contracts.ts +105 -0
  200. package/src/embed/hostEventClient/host-event-client.spec.ts +254 -0
  201. package/src/embed/hostEventClient/host-event-client.ts +139 -0
  202. package/src/embed/liveboard.spec.ts +36 -2
  203. package/src/embed/liveboard.ts +13 -8
  204. package/src/embed/search.spec.ts +15 -0
  205. package/src/embed/ts-embed.spec.ts +40 -1
  206. package/src/embed/ts-embed.ts +57 -16
  207. package/src/index.ts +2 -0
  208. package/src/react/all-types-export.ts +1 -0
  209. package/src/types.ts +37 -22
@@ -29,7 +29,8 @@ declare module '@thoughtspot/visual-embed-sdk' {
29
29
  import { tokenizedFetch } from '@thoughtspot/visual-embed-sdk/tokenizedFetch';
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
- export { init, logout, prefetch, executeTML, exportTML, executeTMLInput, exportTMLInput, getEmbedConfig as getInitConfig, getSessionInfo, tokenizedFetch, getAnswerFromQuery, createLiveboardWithAnswers, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, SageEmbed, AppEmbed, BodylessConversation, BodylessConversationViewConfig, ConversationEmbed, ConversationViewConfig, 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, VizPoint, CustomActionPayload, };
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, BodylessConversation, BodylessConversationViewConfig, ConversationEmbed, ConversationViewConfig, 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, VizPoint, CustomActionPayload, UIPassthroughEvent, };
33
34
  export { resetCachedAuthToken } from '@thoughtspot/visual-embed-sdk/authToken';
34
35
  }
35
36
 
@@ -440,7 +441,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
440
441
  */
441
442
  showLiveboardVerifiedBadge?: boolean;
442
443
  /**
443
- * This flag is used to enable/disable hide irrelevant filters in liveboard tab
444
+ * This flag is used to enable/disable hide irrelevant filters in Liveboard tab
444
445
  * @type {boolean}
445
446
  * @default false
446
447
  * @version SDK: 1.36.0 | ThoughtSpot:10.6.0.cl
@@ -566,7 +567,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/base' {
566
567
  /**
567
568
  * Initializes the Visual Embed SDK globally and perform
568
569
  * authentication if applicable. This function needs to be called before any ThoughtSpot
569
- * component like liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
570
+ * component like Liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
570
571
  * to actually embed. That is handled internally.
571
572
  * @param embedConfig The configuration object containing ThoughtSpot host,
572
573
  * authentication mechanism and so on.
@@ -679,6 +680,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
679
680
  */
680
681
  import { DOMSelector, HostEvent, ViewConfig } from '@thoughtspot/visual-embed-sdk/types';
681
682
  import { V1Embed } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
683
+ import { HostEventRequest, HostEventResponse } from '@thoughtspot/visual-embed-sdk/embed/hostEventClient/contracts';
682
684
  /**
683
685
  * The configuration for the embedded Liveboard or visualization page view.
684
686
  * @group Embed components
@@ -899,7 +901,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
899
901
  */
900
902
  enableAskSage?: boolean;
901
903
  /**
902
- * This flag is used to enable the 2 column layout in liveboard
904
+ * This flag is used to enable the 2 column layout on a Liveboard
903
905
  * @type {boolean}
904
906
  * @default false
905
907
  * @version SDK: 1.32.0 | ThoughtSpot:10.1.0.cl
@@ -934,7 +936,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
934
936
  */
935
937
  showPreviewLoader?: boolean;
936
938
  /**
937
- * This flag is used to enable the compact header in liveboard
939
+ * This flag is used to enable the compact header on a Liveboard
938
940
  * @type {boolean}
939
941
  * @default false
940
942
  * @version SDK: 1.35.0 | ThoughtSpot:10.3.0.cl
@@ -948,7 +950,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
948
950
  */
949
951
  isLiveboardCompactHeaderEnabled?: boolean;
950
952
  /**
951
- * This flag is used to show/hide verified Icon in liveboard compact header
953
+ * This flag is used to show/hide verified icon in the Liveboard compact header
952
954
  * @type {boolean}
953
955
  * @default true
954
956
  * @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
@@ -962,7 +964,8 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
962
964
  */
963
965
  showLiveboardVerifiedBadge?: boolean;
964
966
  /**
965
- * This flag is used to show/hide re-verify banner in liveboard compact header
967
+ * This flag is used to show/hide the re-verify banner
968
+ * in Liveboard compact header
966
969
  * @type {boolean}
967
970
  * @default true
968
971
  * @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
@@ -976,7 +979,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
976
979
  */
977
980
  showLiveboardReverifyBanner?: boolean;
978
981
  /**
979
- * This flag is used to enable/disable hide irrelevant filters in liveboard tab
982
+ * This flag is used to enable/disable hide irrelevant filters in a Liveboard tab
980
983
  * @type {boolean}
981
984
  * @default false
982
985
  * @version SDK: 1.36.0 | ThoughtSpot:10.6.0.cl
@@ -1056,7 +1059,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
1056
1059
  * @param messageType The event type
1057
1060
  * @param data The payload to send with the message
1058
1061
  */
1059
- trigger(messageType: HostEvent, data?: any): Promise<any>;
1062
+ trigger<HostEventT extends HostEvent>(messageType: HostEventT, data?: HostEventRequest<HostEventT>): Promise<HostEventResponse<HostEventT>>;
1060
1063
  /**
1061
1064
  * Render an embedded ThoughtSpot Liveboard or visualization
1062
1065
  * @param renderOptions An object specifying the Liveboard ID,
@@ -1065,8 +1068,8 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
1065
1068
  render(): Promise<LiveboardEmbed>;
1066
1069
  navigateToLiveboard(liveboardId: string, vizId?: string, activeTabId?: string): void;
1067
1070
  /**
1068
- * Returns the full url of the liveboard/viz which can be used to open
1069
- * this liveboard inside the full Thoughtspot application in a new tab.
1071
+ * Returns the full url of the Liveboard/visualization which can be used to open
1072
+ * this Liveboard inside the full Thoughtspot application in a new tab.
1070
1073
  * @returns url string
1071
1074
  */
1072
1075
  getLiveboardUrl(): string;
@@ -2857,8 +2860,12 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
2857
2860
  */
2858
2861
  enableCustomColumnGroups?: boolean;
2859
2862
  /**
2860
- * View content for another org directly without having to use the org switcher
2861
- * This flag is honoured if orgPerUrl feature is enabled for the ThoughtSpot cluster
2863
+ * Overrides an Org context for embedding application users.
2864
+ * This parameter allows a user authenticated to one Org to view the
2865
+ * objects from another Org.
2866
+ * The `overrideOrgId` setting is honoured only if the
2867
+ * Per Org URL feature is enabled on your ThoughtSpot instance.
2868
+ *
2862
2869
  * @example
2863
2870
  * ```js
2864
2871
  * const embed = new LiveboardEmbed('#embed', {
@@ -3466,8 +3473,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
3466
3473
  *
3467
3474
  * **Note**: This event is deprecated in v1.21.0.
3468
3475
  * To fire an event when a download action is initiated on a chart or table,
3469
- * use `EmbedEvent.DownloadAsPng`, `EmbedEvent.DownloadAsPDF`, `EmbedEvent.DownloadAsCSV`,
3470
- * or `EmbedEvent.DownloadAsXLSX`
3476
+ * use `EmbedEvent.DownloadAsPng`, `EmbedEvent.DownloadAsPDF`,
3477
+ * `EmbedEvent.DownloadAsCSV`, or `EmbedEvent.DownloadAsXLSX`
3471
3478
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
3472
3479
  * @example
3473
3480
  *```js
@@ -4115,7 +4122,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
4115
4122
  * @param - autoDrillDown - Optional. If true, the drill down will be
4116
4123
  * done automatically on the most popular column.
4117
4124
  * @param - vizId [TS >= 9.8.0] - Optional. The GUID of the visualization to drill
4118
- * in case of a liveboard.
4125
+ * in case of a Liveboard.
4119
4126
  * @example
4120
4127
  * ```js
4121
4128
  * searchEmbed.on(EmbedEvent.VizPointDoubleClick, (payload) => {
@@ -4202,26 +4209,26 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
4202
4209
  */
4203
4210
  SetActiveTab = "SetActiveTab",
4204
4211
  /**
4205
- * Update runtime filters applied on a Saved Answer or Liveboard. The
4206
- * runtime filters passed here are appended to the existing runtime
4207
- * filters.
4212
+ * Updates the runtime filters applied on a Liveboard. The filter
4213
+ * attributes passed with this event are appended to the existing runtime
4214
+ * filters applied on a Liveboard.
4215
+ *
4208
4216
  * Pass an array of runtime filters with the following attributes:
4209
4217
  *
4210
- * `columnName`
4211
- * _String_. The name of the column to filter on.
4218
+ * `columnName` - _String_. The name of the column to filter on.
4212
4219
  *
4213
- * `operator`
4214
- * Runtime filter operator to apply. For information,
4220
+ * `operator` - Runtime filter operator to apply. For more information,
4215
4221
  * see link:https://developers.thoughtspot.com/docs/?pageid=runtime-filters#rtOperator[Developer Documentation].
4216
4222
  *
4217
- * `values`
4218
- * List of operands. Some operators such as EQ, LE allow a single value, whereas
4219
- * operators such as BW and IN accept multiple operands.
4223
+ * `values` - List of operands. Some operators such as EQ and LE allow a
4224
+ * single value, whereas BW and IN accept multiple values.
4225
+ *
4226
+ * **Note**: `HostEvent.UpdateRuntimeFilters` is supported in `LiveboardEmbed`
4227
+ * and `AppEmbed` only. In full application embedding, this event updates
4228
+ * the runtime filters applied on the Liveboard and saved Answer objects.
4220
4229
  *
4221
- * **Note**: `HostEvent.UpdateRuntimeFilters` is not supported in
4222
- * Search embedding (SearchEmbed) and Natural Language Search
4223
- * embedding (SageEmbed).
4224
4230
  * @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
4231
+ *
4225
4232
  * @example
4226
4233
  * ```js
4227
4234
  * liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
@@ -4920,7 +4927,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
4920
4927
  */
4921
4928
  ResetLiveboardPersonalisedView = "ResetLiveboardPersonalisedView",
4922
4929
  /**
4923
- * Triggers Update RuntimeParameters for answers and liveboard
4930
+ * Triggers an event to Update Parameter values for Answers and Liveboard
4924
4931
  * @example
4925
4932
  * ```js
4926
4933
  * liveboardEmbed.trigger(HostEvent.UpdateParameters, [{
@@ -4942,13 +4949,23 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
4942
4949
  */
4943
4950
  GetParameters = "GetParameters",
4944
4951
  /**
4945
- * Triggers update of persoanlised view for a liveboard
4952
+ * Triggers an event to update a persoanlised view of a Liveboard
4946
4953
  * ```js
4947
4954
  * liveboardEmbed.trigger(HostEvent.UpdatePersonalisedView, {viewId: '1234'})
4948
4955
  * ```
4949
4956
  * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
4950
4957
  */
4951
- UpdatePersonalisedView = "UpdatePersonalisedView"
4958
+ UpdatePersonalisedView = "UpdatePersonalisedView",
4959
+ /**
4960
+ * Triggers the action to get the current view of the liveboard
4961
+ * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
4962
+ */
4963
+ SaveAnswer = "saveAnswer",
4964
+ /**
4965
+ * EmbedApi
4966
+ * @hidden
4967
+ */
4968
+ UIPassthrough = "UiPassthrough"
4952
4969
  }
4953
4970
  /**
4954
4971
  * The different visual modes that the data sources panel within
@@ -5921,7 +5938,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
5921
5938
  */
5922
5939
  ModifySageAnswer = "modifySageAnswer",
5923
5940
  /**
5924
- * The **Move to Tab** menu action on visualizations in liveboard edit mode.
5941
+ * The **Move to Tab** menu action on visualizations in Liveboard edit mode.
5925
5942
  * Allows moving a visualization to a different tab.
5926
5943
  * @example
5927
5944
  * ```js
@@ -5974,7 +5991,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
5974
5991
  */
5975
5992
  TML = "tml",
5976
5993
  /**
5977
- * Action Id for CreateLiveboard for liveboard list page & Pin Modal
5994
+ * Action ID for the create Liveboard option on the Liveboard list page
5995
+ * and Pin modal
5978
5996
  * @example
5979
5997
  * ```js
5980
5998
  * hiddenAction: [Action.CreateLiveboard]
@@ -7131,6 +7149,87 @@ declare module '@thoughtspot/visual-embed-sdk/utils/liveboardService/liveboardSe
7131
7149
  export const createLiveboardWithAnswers: (answers: AnswerService[], name: string) => Promise<any>;
7132
7150
  }
7133
7151
 
7152
+ declare module '@thoughtspot/visual-embed-sdk/embed/hostEventClient/contracts' {
7153
+ import { HostEvent } from '@thoughtspot/visual-embed-sdk/types';
7154
+ export enum UIPassthroughEvent {
7155
+ PinAnswerToLiveboard = "addVizToPinboard",
7156
+ SaveAnswer = "saveAnswer",
7157
+ GetDiscoverabilityStatus = "getDiscoverabilityStatus",
7158
+ GetAvailableUIPassthroughs = "getAvailableUIPassthroughs",
7159
+ GetAnswerConfig = "getAnswerPageConfig",
7160
+ GetLiveboardConfig = "getPinboardPageConfig"
7161
+ }
7162
+ export type UIPassthroughContractBase = {
7163
+ [UIPassthroughEvent.PinAnswerToLiveboard]: {
7164
+ request: {
7165
+ vizId?: string;
7166
+ newVizName: string;
7167
+ newVizDescription?: string;
7168
+ pinboardId?: string;
7169
+ tabId?: string;
7170
+ newPinboardName?: string;
7171
+ newTabName?: string;
7172
+ };
7173
+ response: {
7174
+ pinboardId: string;
7175
+ tabId: string;
7176
+ vizId: string;
7177
+ };
7178
+ };
7179
+ [UIPassthroughEvent.SaveAnswer]: {
7180
+ request: {
7181
+ name: string;
7182
+ description: string;
7183
+ vizId?: string;
7184
+ isDiscoverable?: boolean;
7185
+ };
7186
+ response: {
7187
+ answerId: string;
7188
+ saveResponse?: any;
7189
+ shareResponse?: any;
7190
+ };
7191
+ };
7192
+ [UIPassthroughEvent.GetDiscoverabilityStatus]: {
7193
+ request: any;
7194
+ response: {
7195
+ shouldShowDiscoverability: boolean;
7196
+ isDiscoverabilityCheckboxUnselectedPerOrg: boolean;
7197
+ };
7198
+ };
7199
+ [UIPassthroughEvent.GetAvailableUIPassthroughs]: {
7200
+ request: any;
7201
+ response: {
7202
+ keys: string[];
7203
+ };
7204
+ };
7205
+ [UIPassthroughEvent.GetAnswerConfig]: {
7206
+ request: {
7207
+ vizId?: string;
7208
+ };
7209
+ response: any;
7210
+ };
7211
+ [UIPassthroughEvent.GetLiveboardConfig]: {
7212
+ request: any;
7213
+ response: any;
7214
+ };
7215
+ };
7216
+ export type UIPassthroughRequest<T extends keyof UIPassthroughContractBase> = UIPassthroughContractBase[T]['request'];
7217
+ export type UIPassthroughResponse<T extends keyof UIPassthroughContractBase> = UIPassthroughContractBase[T]['response'];
7218
+ export type UIPassthroughArrayResponse<ApiName extends keyof UIPassthroughContractBase> = Array<{
7219
+ redId?: string;
7220
+ value?: UIPassthroughResponse<ApiName>;
7221
+ error?: any;
7222
+ }>;
7223
+ export type EmbedApiHostEventMapping = {
7224
+ [HostEvent.Pin]: UIPassthroughEvent.PinAnswerToLiveboard;
7225
+ [HostEvent.SaveAnswer]: UIPassthroughEvent.SaveAnswer;
7226
+ };
7227
+ export type HostEventRequest<HostEventT extends HostEvent> = HostEventT extends keyof EmbedApiHostEventMapping ? UIPassthroughRequest<EmbedApiHostEventMapping[HostEventT]> : any;
7228
+ export type HostEventResponse<HostEventT extends HostEvent> = HostEventT extends keyof EmbedApiHostEventMapping ? UIPassthroughResponse<EmbedApiHostEventMapping[HostEventT]> : any;
7229
+ export type TriggerPayload<PayloadT, HostEventT extends HostEvent> = PayloadT | HostEventRequest<HostEventT>;
7230
+ export type TriggerResponse<PayloadT, HostEventT extends HostEvent> = PayloadT extends HostEventRequest<HostEventT> ? HostEventResponse<HostEventT> : any;
7231
+ }
7232
+
7134
7233
  declare module '@thoughtspot/visual-embed-sdk/authToken' {
7135
7234
  import { EmbedConfig } from '@thoughtspot/visual-embed-sdk/types';
7136
7235
  /**
@@ -7158,8 +7257,10 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
7158
7257
  * @summary Base classes
7159
7258
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
7160
7259
  */
7260
+ import { TriggerPayload, TriggerResponse, UIPassthroughArrayResponse, UIPassthroughEvent, UIPassthroughRequest } from '@thoughtspot/visual-embed-sdk/embed/hostEventClient/contracts';
7161
7261
  import { AnswerService } from '@thoughtspot/visual-embed-sdk/utils/graphql/answerService/answerService';
7162
7262
  import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, EmbedConfig, MessageOptions, ViewConfig } from '@thoughtspot/visual-embed-sdk/types';
7263
+ import { HostEventClient } from '@thoughtspot/visual-embed-sdk/embed/hostEventClient/host-event-client';
7163
7264
  /**
7164
7265
  * Global prefix for all Thoughtspot postHash Params.
7165
7266
  */
@@ -7191,6 +7292,11 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
7191
7292
  * will be rendered.
7192
7293
  */
7193
7294
  protected iFrame: HTMLIFrameElement;
7295
+ /**
7296
+ * Setter for the iframe element
7297
+ * @param {HTMLIFrameElement} iFrame HTMLIFrameElement
7298
+ */
7299
+ protected setIframeElement(iFrame: HTMLIFrameElement): void;
7194
7300
  protected viewConfig: ViewConfig;
7195
7301
  protected embedConfig: EmbedConfig;
7196
7302
  /**
@@ -7202,6 +7308,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
7202
7308
  * A flag that is set to true post render.
7203
7309
  */
7204
7310
  protected isRendered: boolean;
7311
+ protected hostEventClient: HostEventClient;
7205
7312
  constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
7206
7313
  /**
7207
7314
  * Handles errors within the SDK
@@ -7321,10 +7428,19 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
7321
7428
  off(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
7322
7429
  /**
7323
7430
  * Triggers an event to the embedded app
7324
- * @param messageType The event type
7325
- * @param data The payload to send with the message
7431
+ * @param {HostEvent} messageType The event type
7432
+ * @param {any} data The payload to send with the message
7433
+ * @returns A promise that resolves with the response from the embedded app
7434
+ */
7435
+ trigger<HostEventT extends HostEvent, PayloadT>(messageType: HostEventT, data?: TriggerPayload<PayloadT, HostEventT>): Promise<TriggerResponse<PayloadT, HostEventT>>;
7436
+ /**
7437
+ * Triggers an event to the embedded app, skipping the UI flow.
7438
+ * @param {UIPassthroughEvent} apiName - The name of the API to be triggered.
7439
+ * @param {UIPassthroughRequest} parameters - The parameters to be passed to the API.
7440
+ * @returns {Promise<UIPassthroughRequest>} - A promise that resolves with the response
7441
+ * from the embedded app.
7326
7442
  */
7327
- trigger(messageType: HostEvent, data?: any): Promise<any>;
7443
+ triggerUIPassThrough<UIPassthroughEventT extends UIPassthroughEvent>(apiName: UIPassthroughEventT, parameters: UIPassthroughRequest<UIPassthroughEventT>): Promise<UIPassthroughArrayResponse<UIPassthroughEventT>>;
7328
7444
  /**
7329
7445
  * Marks the ThoughtSpot object to have been rendered
7330
7446
  * Needs to be overridden by subclasses to do the actual
@@ -7398,7 +7514,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
7398
7514
  /**
7399
7515
  * Returns the answerService which can be used to make arbitrary graphql calls on top
7400
7516
  * session.
7401
- * @param vizId [Optional] to get for a specific viz in case of a liveboard.
7517
+ * @param vizId [Optional] to get for a specific viz in case of a Liveboard.
7402
7518
  * @version SDK: 1.25.0 / ThoughtSpot 9.10.0
7403
7519
  */
7404
7520
  getAnswerService(vizId?: string): Promise<AnswerService>;
@@ -7444,3 +7560,30 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
7444
7560
  }
7445
7561
  }
7446
7562
 
7563
+ declare module '@thoughtspot/visual-embed-sdk/embed/hostEventClient/host-event-client' {
7564
+ import { HostEvent } from '@thoughtspot/visual-embed-sdk/types';
7565
+ import { UIPassthroughArrayResponse, UIPassthroughEvent, HostEventRequest, HostEventResponse, UIPassthroughRequest, UIPassthroughResponse, TriggerPayload, TriggerResponse } from '@thoughtspot/visual-embed-sdk/embed/hostEventClient/contracts';
7566
+ export class HostEventClient {
7567
+ iFrame: HTMLIFrameElement;
7568
+ constructor(iFrame?: HTMLIFrameElement);
7569
+ /**
7570
+ * A wrapper over process trigger to
7571
+ * @param {HostEvent} message Host event to send
7572
+ * @param {any} data Data to send with the host event
7573
+ * @returns {Promise<any>} - the response from the process trigger
7574
+ */
7575
+ protected processTrigger(message: HostEvent, data: any): Promise<any>;
7576
+ handleHostEventWithParam<UIPassthroughEventT extends UIPassthroughEvent>(apiName: UIPassthroughEventT, parameters: UIPassthroughRequest<UIPassthroughEventT>): Promise<UIPassthroughResponse<UIPassthroughEventT>>;
7577
+ hostEventFallback(hostEvent: HostEvent, data: any): Promise<any>;
7578
+ /**
7579
+ * Setter for the iframe element used for host events
7580
+ * @param {HTMLIFrameElement} iFrame - the iframe element to set
7581
+ */
7582
+ setIframeElement(iFrame: HTMLIFrameElement): void;
7583
+ triggerUIPassthroughApi<UIPassthroughEventT extends UIPassthroughEvent>(apiName: UIPassthroughEventT, parameters: UIPassthroughRequest<UIPassthroughEventT>): Promise<UIPassthroughArrayResponse<UIPassthroughEventT>>;
7584
+ protected handlePinEvent(payload: HostEventRequest<HostEvent.Pin>): Promise<HostEventResponse<HostEvent.Pin>>;
7585
+ protected handleSaveAnswerEvent(payload: HostEventRequest<HostEvent.SaveAnswer>): Promise<any>;
7586
+ triggerHostEvent<HostEventT extends HostEvent, PayloadT>(hostEvent: HostEventT, payload?: TriggerPayload<PayloadT, HostEventT>): Promise<TriggerResponse<PayloadT, HostEventT>>;
7587
+ }
7588
+ }
7589
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.35.3",
3
+ "version": "1.35.4",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
package/src/auth.spec.ts CHANGED
@@ -125,6 +125,7 @@ describe('Unit test for auth', () => {
125
125
  afterEach(() => {
126
126
  authTokenService.resetCachedAuthToken();
127
127
  SessionService.resetCachedSessionInfo();
128
+ jest.resetAllMocks();
128
129
  });
129
130
  test('endpoints, SAML_LOGIN_TEMPLATE', () => {
130
131
  const ssoTemplateUrl = authService.EndPoints.SAML_LOGIN_TEMPLATE(thoughtSpotHost);
@@ -137,6 +138,8 @@ describe('Unit test for auth', () => {
137
138
  expect(sessionInfo.mixpanelToken).toEqual('prodKey');
138
139
  expect(sessionInfo.isPublicUser).toEqual(false);
139
140
  await SessionService.getSessionInfo();
141
+ const cachedInfo = SessionService.getCachedSessionInfo();
142
+ expect(cachedInfo).toEqual(sessionInfo);
140
143
  expect(tokenAuthService.fetchSessionInfoService).toHaveBeenCalledTimes(1);
141
144
  });
142
145
 
@@ -148,6 +151,16 @@ describe('Unit test for auth', () => {
148
151
  expect(mixPanelService.initMixpanel).not.toBeCalled();
149
152
  });
150
153
 
154
+ test('Log error is postLogin faild', async () => {
155
+ jest.spyOn(mixPanelService, 'initMixpanel');
156
+ jest.spyOn(SessionService, 'getSessionInfo').mockRejectedValueOnce(mockSessionInfo);
157
+ jest.spyOn(EmbedConfig, 'getEmbedConfig').mockReturnValue({ disableSDKTracking: true });
158
+ jest.spyOn(logger, 'error').mockResolvedValue(true);
159
+ await authInstance.postLoginService();
160
+ expect(mixPanelService.initMixpanel).not.toBeCalled();
161
+ expect(logger.error).toBeCalled();
162
+ });
163
+
151
164
  test('doCookielessTokenAuth: when authEndpoint and getAuthToken are not there, it throw error', async () => {
152
165
  try {
153
166
  await authInstance.doCookielessTokenAuth(
@@ -15,7 +15,7 @@ describe('AuthToken Unit tests', () => {
15
15
  expect(authServiceInstance.verifyTokenService).not.toBeCalled();
16
16
  });
17
17
 
18
- test.only('getAuthenticationToken: When verification is enabled', async () => {
18
+ test('getAuthenticationToken: When verification is enabled', async () => {
19
19
  resetCachedAuthToken();
20
20
  jest.clearAllMocks();
21
21
  jest.spyOn(authServiceInstance, 'verifyTokenService').mockImplementation(() => true);
package/src/embed/app.ts CHANGED
@@ -418,7 +418,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
418
418
  */
419
419
  showLiveboardVerifiedBadge?: boolean;
420
420
  /**
421
- * This flag is used to enable/disable hide irrelevant filters in liveboard tab
421
+ * This flag is used to enable/disable hide irrelevant filters in Liveboard tab
422
422
  * @type {boolean}
423
423
  * @default false
424
424
  * @version SDK: 1.36.0 | ThoughtSpot:10.6.0.cl
@@ -627,10 +627,13 @@ export class AppEmbed extends V1Embed {
627
627
  };
628
628
 
629
629
  private setIframeHeightForNonEmbedLiveboard = (data: MessagePayload) => {
630
- const { height: frameHeight, ...restParams } = this.viewConfig.frameParams || {};
631
- if (!data.data.currentPath.startsWith('/pinboard/')) {
632
- this.setIFrameHeight(frameHeight || this.defaultHeight);
630
+ if (
631
+ data.data.currentPath.startsWith('/embed/viz/')
632
+ || data.data.currentPath.startsWith('/embed/insights/viz/')
633
+ ) {
634
+ return;
633
635
  }
636
+ this.setIFrameHeight(this.defaultHeight);
634
637
  };
635
638
 
636
639
  /**
package/src/embed/base.ts CHANGED
@@ -174,7 +174,7 @@ function backwardCompat(embedConfig: EmbedConfig): EmbedConfig {
174
174
  /**
175
175
  * Initializes the Visual Embed SDK globally and perform
176
176
  * authentication if applicable. This function needs to be called before any ThoughtSpot
177
- * component like liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
177
+ * component like Liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
178
178
  * to actually embed. That is handled internally.
179
179
  * @param embedConfig The configuration object containing ThoughtSpot host,
180
180
  * authentication mechanism and so on.
@@ -123,7 +123,6 @@ describe('BodylessConversation', () => {
123
123
 
124
124
  const conversationEmbed = new BodylessConversation(viewConfig);
125
125
  const result = await conversationEmbed.sendMessage('userMessage');
126
- console.log(result.container);
127
126
  const iframeSrc = getIFrameSrc(result.container);
128
127
  expectUrlToHaveParamsWithValues(iframeSrc, {
129
128
  sessionId: 'sessionId',
@@ -0,0 +1,105 @@
1
+ import { HostEvent } from '../../types';
2
+
3
+ export enum UIPassthroughEvent {
4
+ PinAnswerToLiveboard = 'addVizToPinboard',
5
+ SaveAnswer = 'saveAnswer',
6
+ GetDiscoverabilityStatus = 'getDiscoverabilityStatus',
7
+ GetAvailableUIPassthroughs = 'getAvailableUIPassthroughs',
8
+ GetAnswerConfig = 'getAnswerPageConfig',
9
+ GetLiveboardConfig = 'getPinboardPageConfig',
10
+ }
11
+
12
+ // UI Passthrough Contract
13
+ export type UIPassthroughContractBase = {
14
+ [UIPassthroughEvent.PinAnswerToLiveboard]: {
15
+ request: {
16
+ vizId?: string;
17
+ newVizName: string;
18
+ newVizDescription?: string;
19
+ pinboardId?: string;
20
+ tabId?: string;
21
+ newPinboardName?: string;
22
+ newTabName?: string;
23
+ };
24
+ response: {
25
+ pinboardId: string;
26
+ tabId: string;
27
+ vizId: string;
28
+ };
29
+ };
30
+ [UIPassthroughEvent.SaveAnswer]: {
31
+ request: {
32
+ name: string;
33
+ description: string;
34
+ vizId?: string;
35
+ isDiscoverable?: boolean;
36
+ };
37
+ response: {
38
+ answerId: string,
39
+ saveResponse?: any;
40
+ shareResponse?: any;
41
+ };
42
+ };
43
+ [UIPassthroughEvent.GetDiscoverabilityStatus]: {
44
+ request: any;
45
+ response: {
46
+ shouldShowDiscoverability: boolean;
47
+ isDiscoverabilityCheckboxUnselectedPerOrg: boolean;
48
+ };
49
+ };
50
+ [UIPassthroughEvent.GetAvailableUIPassthroughs]: {
51
+ request: any;
52
+ response: {
53
+ keys: string[];
54
+ };
55
+ };
56
+ [UIPassthroughEvent.GetAnswerConfig]: {
57
+ request: {
58
+ vizId?: string;
59
+ };
60
+ response: any;
61
+ };
62
+ [UIPassthroughEvent.GetLiveboardConfig]: {
63
+ request: any;
64
+ response: any;
65
+ };
66
+ };
67
+
68
+ // UI Passthrough Request and Response
69
+ export type UIPassthroughRequest<T
70
+ extends keyof UIPassthroughContractBase
71
+ > = UIPassthroughContractBase[T]['request'];
72
+
73
+ export type UIPassthroughResponse<
74
+ T extends keyof UIPassthroughContractBase
75
+ > = UIPassthroughContractBase[T]['response'];
76
+
77
+ export type UIPassthroughArrayResponse<ApiName extends keyof UIPassthroughContractBase> =
78
+ Array<{
79
+ redId?: string;
80
+ value?: UIPassthroughResponse<ApiName>;
81
+ error?: any;
82
+ }>
83
+
84
+ // Host event and UI Passthrough Event Mapping
85
+ export type EmbedApiHostEventMapping = {
86
+ [HostEvent.Pin]: UIPassthroughEvent.PinAnswerToLiveboard;
87
+ [HostEvent.SaveAnswer]: UIPassthroughEvent.SaveAnswer;
88
+ }
89
+
90
+ // Host Event Request and Response
91
+ export type HostEventRequest<HostEventT extends HostEvent> =
92
+ HostEventT extends keyof EmbedApiHostEventMapping
93
+ ? UIPassthroughRequest<EmbedApiHostEventMapping[HostEventT]>
94
+ : any;
95
+
96
+ export type HostEventResponse<HostEventT extends HostEvent> =
97
+ HostEventT extends keyof EmbedApiHostEventMapping
98
+ ? UIPassthroughResponse<EmbedApiHostEventMapping[HostEventT]>
99
+ : any;
100
+
101
+ // trigger response and request
102
+ export type TriggerPayload<PayloadT, HostEventT extends HostEvent> =
103
+ PayloadT | HostEventRequest<HostEventT>;
104
+ export type TriggerResponse<PayloadT, HostEventT extends HostEvent> =
105
+ PayloadT extends HostEventRequest<HostEventT> ? HostEventResponse<HostEventT> : any;