@thoughtspot/visual-embed-sdk 1.13.0-alpha.2 → 1.13.0

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 (103) hide show
  1. package/CHANGELOG.md +31 -6
  2. package/README.md +1 -1
  3. package/dist/src/auth.d.ts +4 -1
  4. package/dist/src/auth.spec.d.ts +1 -0
  5. package/dist/src/embed/app.d.ts +5 -0
  6. package/dist/src/embed/liveboard.d.ts +12 -1
  7. package/dist/src/embed/search.d.ts +5 -0
  8. package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts +1 -0
  9. package/dist/src/embed/ts-embed.d.ts +12 -3
  10. package/dist/src/errors.d.ts +2 -0
  11. package/dist/src/test/test-utils.d.ts +6 -0
  12. package/dist/src/types.d.ts +211 -4
  13. package/dist/src/utils/processTrigger.d.ts +1 -1
  14. package/dist/src/utils.d.ts +3 -1
  15. package/dist/tsembed.es.js +292 -24
  16. package/dist/tsembed.js +292 -24
  17. package/lib/package.json +4 -2
  18. package/lib/src/auth.d.ts +4 -1
  19. package/lib/src/auth.js +11 -2
  20. package/lib/src/auth.js.map +1 -1
  21. package/lib/src/auth.spec.d.ts +1 -0
  22. package/lib/src/auth.spec.js +13 -1
  23. package/lib/src/auth.spec.js.map +1 -1
  24. package/lib/src/config.spec.js +7 -0
  25. package/lib/src/config.spec.js.map +1 -1
  26. package/lib/src/embed/app.d.ts +5 -0
  27. package/lib/src/embed/app.js +1 -1
  28. package/lib/src/embed/app.js.map +1 -1
  29. package/lib/src/embed/app.spec.js +18 -6
  30. package/lib/src/embed/app.spec.js.map +1 -1
  31. package/lib/src/embed/embed.spec.js +2 -0
  32. package/lib/src/embed/embed.spec.js.map +1 -1
  33. package/lib/src/embed/events.spec.js +3 -1
  34. package/lib/src/embed/events.spec.js.map +1 -1
  35. package/lib/src/embed/liveboard.d.ts +12 -1
  36. package/lib/src/embed/liveboard.js +22 -4
  37. package/lib/src/embed/liveboard.js.map +1 -1
  38. package/lib/src/embed/liveboard.spec.js +33 -6
  39. package/lib/src/embed/liveboard.spec.js.map +1 -1
  40. package/lib/src/embed/pinboard.spec.js +7 -5
  41. package/lib/src/embed/pinboard.spec.js.map +1 -1
  42. package/lib/src/embed/search.d.ts +5 -0
  43. package/lib/src/embed/search.js +10 -2
  44. package/lib/src/embed/search.js.map +1 -1
  45. package/lib/src/embed/search.spec.js +9 -1
  46. package/lib/src/embed/search.spec.js.map +1 -1
  47. package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts +1 -0
  48. package/lib/src/embed/searchEmbed-basic-auth.spec.js +96 -0
  49. package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -0
  50. package/lib/src/embed/ts-embed.d.ts +12 -3
  51. package/lib/src/embed/ts-embed.js +29 -10
  52. package/lib/src/embed/ts-embed.js.map +1 -1
  53. package/lib/src/embed/ts-embed.spec.js +38 -5
  54. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  55. package/lib/src/errors.d.ts +2 -0
  56. package/lib/src/errors.js +2 -0
  57. package/lib/src/errors.js.map +1 -1
  58. package/lib/src/react/index.js +3 -2
  59. package/lib/src/react/index.js.map +1 -1
  60. package/lib/src/react/index.spec.js +6 -4
  61. package/lib/src/react/index.spec.js.map +1 -1
  62. package/lib/src/test/test-utils.d.ts +6 -0
  63. package/lib/src/test/test-utils.js +15 -0
  64. package/lib/src/test/test-utils.js.map +1 -1
  65. package/lib/src/types.d.ts +211 -4
  66. package/lib/src/types.js +176 -0
  67. package/lib/src/types.js.map +1 -1
  68. package/lib/src/utils/processTrigger.d.ts +1 -1
  69. package/lib/src/utils/processTrigger.js +28 -8
  70. package/lib/src/utils/processTrigger.js.map +1 -1
  71. package/lib/src/utils/processTrigger.spec.js +11 -1
  72. package/lib/src/utils/processTrigger.spec.js.map +1 -1
  73. package/lib/src/utils.d.ts +3 -1
  74. package/lib/src/utils.js +20 -0
  75. package/lib/src/utils.js.map +1 -1
  76. package/lib/src/utils.spec.js +22 -1
  77. package/lib/src/utils.spec.js.map +1 -1
  78. package/lib/src/visual-embed-sdk.d.ts +240 -9
  79. package/package.json +4 -2
  80. package/src/auth.spec.ts +20 -1
  81. package/src/auth.ts +12 -2
  82. package/src/config.spec.ts +11 -0
  83. package/src/embed/app.spec.ts +22 -3
  84. package/src/embed/app.ts +6 -0
  85. package/src/embed/embed.spec.ts +2 -0
  86. package/src/embed/events.spec.ts +3 -0
  87. package/src/embed/liveboard.spec.ts +46 -6
  88. package/src/embed/liveboard.ts +34 -2
  89. package/src/embed/pinboard.spec.ts +8 -6
  90. package/src/embed/search.spec.ts +11 -1
  91. package/src/embed/search.ts +20 -1
  92. package/src/embed/searchEmbed-basic-auth.spec.ts +115 -0
  93. package/src/embed/ts-embed.spec.ts +51 -5
  94. package/src/embed/ts-embed.ts +40 -12
  95. package/src/errors.ts +3 -0
  96. package/src/react/index.spec.tsx +7 -2
  97. package/src/react/index.tsx +3 -2
  98. package/src/test/test-utils.ts +16 -0
  99. package/src/types.ts +209 -0
  100. package/src/utils/processTrigger.spec.ts +11 -1
  101. package/src/utils/processTrigger.ts +36 -12
  102. package/src/utils.spec.ts +29 -0
  103. package/src/utils.ts +34 -1
@@ -110,6 +110,11 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
110
110
  * @hidden
111
111
  */
112
112
  liveboardV2?: boolean;
113
+ /**
114
+ * If set to true, the Search Assist feature is enabled.
115
+ * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
116
+ */
117
+ enableSearchAssist?: boolean;
113
118
  }
114
119
  /**
115
120
  * Embeds full ThoughtSpot experience in a host application.
@@ -208,7 +213,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
208
213
  * @summary Liveboard & visualization embed
209
214
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
210
215
  */
211
- import { DOMSelector } from '@thoughtspot/visual-embed-sdk/types';
216
+ import { DOMSelector, HostEvent } from '@thoughtspot/visual-embed-sdk/types';
212
217
  import { V1Embed, ViewConfig } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
213
218
  /**
214
219
  * The configuration for the embedded Liveboard or visualization page view.
@@ -271,6 +276,11 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
271
276
  * @hidden
272
277
  */
273
278
  liveboardV2?: boolean;
279
+ /**
280
+ * Tab Id of the Liveboard that is supposed to be active
281
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
282
+ */
283
+ activeTabId?: string;
274
284
  }
275
285
  /**
276
286
  * Embed a ThoughtSpot Liveboard or visualization
@@ -279,6 +289,12 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
279
289
  export class LiveboardEmbed extends V1Embed {
280
290
  protected viewConfig: LiveboardViewConfig;
281
291
  constructor(domSelector: DOMSelector, viewConfig: LiveboardViewConfig);
292
+ /**
293
+ * Triggers an event to the embedded app
294
+ * @param messageType The event type
295
+ * @param data The payload to send with the message
296
+ */
297
+ trigger(messageType: HostEvent, data?: any): Promise<any>;
282
298
  /**
283
299
  * Render an embedded ThoughtSpot Liveboard or visualization
284
300
  * @param renderOptions An object specifying the Liveboard ID,
@@ -340,8 +356,13 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search' {
340
356
  * using raw answer data.
341
357
  */
342
358
  hideResults?: boolean;
359
+ /**
360
+ * If set to true, expands all the data sources panel.
361
+ */
362
+ expandAllDataSource?: boolean;
343
363
  /**
344
364
  * If set to true, the Search Assist feature is enabled.
365
+ * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
345
366
  */
346
367
  enableSearchAssist?: boolean;
347
368
  /**
@@ -392,7 +413,6 @@ declare module '@thoughtspot/visual-embed-sdk/auth' {
392
413
  export let loggedInStatus: boolean;
393
414
  export let samlAuthWindow: Window;
394
415
  export let samlCompletionPromise: Promise<void>;
395
- export let sessionInfo: any;
396
416
  export const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-24226bf3ce5b";
397
417
  export const EndPoints: {
398
418
  AUTH_VERIFICATION: string;
@@ -426,6 +446,10 @@ declare module '@thoughtspot/visual-embed-sdk/auth' {
426
446
  */
427
447
  LOGOUT = "LOGOUT"
428
448
  }
449
+ /**
450
+ * Return releaseVersion if available
451
+ */
452
+ export function getReleaseVersion(): string;
429
453
  /**
430
454
  * Return sessionInfo if available else make a loggedIn check to fetch the sessionInfo
431
455
  */
@@ -471,8 +495,13 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
471
495
  None = "None",
472
496
  /**
473
497
  * SSO using SAML
498
+ * @deprecated Use {@link SAML} instead
474
499
  */
475
500
  SSO = "SSO_SAML",
501
+ /**
502
+ * SSO using SAML
503
+ */
504
+ SAML = "SSO_SAML",
476
505
  /**
477
506
  * SSO using OIDC
478
507
  */
@@ -490,6 +519,26 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
490
519
  Basic = "Basic"
491
520
  }
492
521
  export type DOMSelector = string | HTMLElement;
522
+ interface customCssInterface {
523
+ variables?: {
524
+ [variableName: string]: string;
525
+ };
526
+ rules_UNSTABLE?: {
527
+ [selector: string]: {
528
+ [declaration: string]: string;
529
+ };
530
+ };
531
+ }
532
+ interface CustomStyles {
533
+ customCSSUrl?: string;
534
+ customCss?: customCssInterface;
535
+ }
536
+ export interface CustomisationsInterface {
537
+ style: CustomStyles;
538
+ content: {
539
+ [key: string]: string;
540
+ };
541
+ }
493
542
  /**
494
543
  * The configuration object for embedding ThoughtSpot content.
495
544
  * It includes the ThoughtSpot hostname or IP address,
@@ -615,6 +664,16 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
615
664
  * @version SDK: 1.10.4 | ThoughtSpot: *
616
665
  */
617
666
  detectCookieAccessSlow?: boolean;
667
+ /**
668
+ * Hide beta alert warning message for SearchEmbed.
669
+ *
670
+ * @version SDK: 1.12.0 | ThoughtSpot: *
671
+ */
672
+ suppressSearchEmbedBetaWarning?: boolean;
673
+ /**
674
+ * Custom style params for embed Config
675
+ */
676
+ customisations?: CustomisationsInterface;
618
677
  }
619
678
  /**
620
679
  * MessagePayload: Embed event payload: message type, data and status (start/end)
@@ -969,7 +1028,66 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
969
1028
  * Emitted when an answer is switched to a chart or table view
970
1029
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
971
1030
  */
972
- AnswerChartSwitcher = "answerChartSwitcher"
1031
+ AnswerChartSwitcher = "answerChartSwitcher",
1032
+ /**
1033
+ *
1034
+ */
1035
+ APP_INIT = "appInit",
1036
+ /**
1037
+ * Emitted when a user clicks Show Liveboard details on a Liveboard
1038
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1039
+ */
1040
+ LiveboardInfo = "pinboardInfo",
1041
+ /**
1042
+ * Emitted when a user clicks on the Favorite icon on a Liveboard
1043
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1044
+ */
1045
+ AddToFavorites = "addToFavorites",
1046
+ /**
1047
+ * Emitted when a user clicks Schedule on a Liveboard
1048
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1049
+ */
1050
+ Schedule = "subscription",
1051
+ /**
1052
+ * Emitted when a user clicks Edit on a Liveboard or visualization
1053
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1054
+ */
1055
+ Edit = "edit",
1056
+ /**
1057
+ * Emitted when a user clicks Make a copy on a Liveboard
1058
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1059
+ */
1060
+ MakeACopy = "makeACopy",
1061
+ /**
1062
+ * Emitted when a user clicks Present on a Liveboard or visualization
1063
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1064
+ */
1065
+ Present = "present",
1066
+ /**
1067
+ * Emitted when a user clicks Delete on a Liveboard
1068
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1069
+ */
1070
+ Delete = "delete",
1071
+ /**
1072
+ * Emitted when a user clicks Manage schedules on a Liveboard
1073
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1074
+ */
1075
+ SchedulesList = "schedule-list",
1076
+ /**
1077
+ * Emitted when a user clicks Cancel in edit mode on a Liveboard
1078
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1079
+ */
1080
+ Cancel = "cancel",
1081
+ /**
1082
+ * Emitted when a user clicks Explore on a visualization
1083
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1084
+ */
1085
+ Explore = "explore",
1086
+ /**
1087
+ * Emitted when a user clicks Copy link action on a visualization
1088
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1089
+ */
1090
+ CopyLink = "embedDocument"
973
1091
  }
974
1092
  /**
975
1093
  * Event types that can be triggered by the host application
@@ -1024,7 +1142,113 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1024
1142
  * @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
1025
1143
  * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
1026
1144
  */
1027
- Navigate = "Navigate"
1145
+ Navigate = "Navigate",
1146
+ /**
1147
+ * Gets the current pinboard content.
1148
+ * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
1149
+ */
1150
+ getExportRequestForCurrentPinboard = "getExportRequestForCurrentPinboard",
1151
+ /**
1152
+ * Triggers the Pin action on an embedded object
1153
+ * @param - incase of Liveboard embed, takes in an object with vizId as a key
1154
+ * can be left empty for search and visualization embeds
1155
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1156
+ */
1157
+ Pin = "pin",
1158
+ /**
1159
+ * Triggers the Show Liveboard details action on a Liveboard
1160
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1161
+ */
1162
+ LiveboardInfo = "pinboardInfo",
1163
+ /**
1164
+ * Triggers the Schedule action on a Liveboard
1165
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1166
+ */
1167
+ Schedule = "subscription",
1168
+ /**
1169
+ * Triggers the Manage schedule action on a Liveboard
1170
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1171
+ */
1172
+ SchedulesList = "schedule-list",
1173
+ /**
1174
+ * Triggers the Export TML action on a Liveboard
1175
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1176
+ */
1177
+ ExportTML = "exportTSL",
1178
+ /**
1179
+ * Triggers the Edit TML action on a Liveboard
1180
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1181
+ */
1182
+ EditTML = "editTSL",
1183
+ /**
1184
+ * Triggers the Update TML action on a Liveboard
1185
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1186
+ */
1187
+ UpdateTML = "updateTSL",
1188
+ /**
1189
+ * Triggers the Download PDF action on a Liveboard
1190
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1191
+ */
1192
+ DownloadAsPdf = "downloadAsPdf",
1193
+ /**
1194
+ * Triggers the Make a copy action on a Liveboard
1195
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1196
+ */
1197
+ MakeACopy = "makeACopy",
1198
+ /**
1199
+ * Triggers the Delete action on a Liveboard
1200
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1201
+ */
1202
+ Remove = "delete",
1203
+ /**
1204
+ * Triggers the Explore action on a visualization
1205
+ * @param - an object with vizId as a key
1206
+ * eg: {vizId: '730496d6-6903-4601-937e-2c691821af3c'}
1207
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1208
+ */
1209
+ Explore = "explore",
1210
+ /**
1211
+ * Triggers the Create alert action on a visualization
1212
+ * @param - an object with vizId as a key
1213
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1214
+ */
1215
+ CreateMonitor = "createMonitor",
1216
+ /**
1217
+ * Triggers the Manage alert action on a visualization
1218
+ * @param - an object with vizId as a key
1219
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1220
+ */
1221
+ ManageMonitor = "manageMonitor",
1222
+ /**
1223
+ * Triggers the Edit action on a Liveboard or visualization
1224
+ * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
1225
+ * @example
1226
+ * liveboardEmbed.trigger(HostEvent.Edit)
1227
+ * liveboardEmbed.trigger(HostEvent.Edit, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1228
+ * vizEmbed.trigger((HostEvent.Edit)
1229
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1230
+ */
1231
+ Edit = "edit",
1232
+ /**
1233
+ * Triggers the Copy link action on a Liveboard or visualization
1234
+ * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
1235
+ * @example
1236
+ * liveboardEmbed.trigger(HostEvent.CopyLink)
1237
+ * liveboardEmbed.trigger(HostEvent.CopyLink, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1238
+ * vizEmbed.trigger((HostEvent.CopyLink)
1239
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1240
+ */
1241
+ CopyLink = "embedDocument",
1242
+ /**
1243
+ * Triggers the Present action on a Liveboard or visualization
1244
+ * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
1245
+ * @example
1246
+ * liveboardEmbed.trigger(HostEvent.Present)
1247
+ * liveboardEmbed.trigger(HostEvent.Present, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1248
+ * vizEmbed.trigger((HostEvent.Present)
1249
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
1250
+ */
1251
+ Present = "present"
1028
1252
  }
1029
1253
  /**
1030
1254
  * The different visual modes that the data sources panel within
@@ -1069,6 +1293,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1069
1293
  fullHeight = "isFullHeightPinboard",
1070
1294
  livedBoardEmbed = "isLiveboardEmbed",
1071
1295
  searchEmbed = "isSearchEmbed",
1296
+ vizEmbed = "isVizEmbed",
1072
1297
  Version = "sdkVersion",
1073
1298
  ViewPortHeight = "viewPortHeight",
1074
1299
  ViewPortWidth = "viewPortWidth",
@@ -1078,7 +1303,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1078
1303
  visibleVizs = "pinboardVisibleVizs",
1079
1304
  LiveboardV2Enabled = "isPinboardV2Enabled",
1080
1305
  ShowAlerts = "showAlerts",
1081
- Locale = "locale"
1306
+ Locale = "locale",
1307
+ CustomStyle = "customStyle"
1082
1308
  }
1083
1309
  /**
1084
1310
  * The list of actions that can be performed on visual ThoughtSpot
@@ -1218,7 +1444,11 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1218
1444
  /**
1219
1445
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
1220
1446
  */
1221
- CreateMonitor = "createMonitor"
1447
+ CreateMonitor = "createMonitor",
1448
+ /**
1449
+ * @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl
1450
+ */
1451
+ ReportError = "reportError"
1222
1452
  }
1223
1453
  export interface SessionInterface {
1224
1454
  sessionId: string;
@@ -1235,6 +1465,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1235
1465
  export interface AnswerServiceType {
1236
1466
  getAnswer?: (offset: number, batchSize: number) => any;
1237
1467
  }
1468
+ export {};
1238
1469
  }
1239
1470
 
1240
1471
  declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
@@ -1269,7 +1500,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
1269
1500
  * This parameters will be passed on the iframe
1270
1501
  * as is.
1271
1502
  */
1272
- [key: string]: string | number | boolean;
1503
+ [key: string]: string | number | boolean | undefined;
1273
1504
  }
1274
1505
  /**
1275
1506
  * The configuration object for an embedded view.
@@ -1379,7 +1610,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
1379
1610
  * @param isAppEmbed A Boolean parameter to specify if you are embedding
1380
1611
  * the full application.
1381
1612
  */
1382
- protected getV1EmbedBasePath(queryString: string, showPrimaryNavbar?: boolean, disableProfileAndHelp?: boolean, isAppEmbed?: boolean): string;
1613
+ protected getV1EmbedBasePath(queryString: string, showPrimaryNavbar?: boolean, disableProfileAndHelp?: boolean, isAppEmbed?: boolean, enableSearchAssist?: boolean): string;
1383
1614
  /**
1384
1615
  * Renders the embedded ThoughtSpot app in an iframe and sets up
1385
1616
  * event listeners.
@@ -1439,7 +1670,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
1439
1670
  * @param messageType The event type
1440
1671
  * @param data The payload to send with the message
1441
1672
  */
1442
- trigger(messageType: HostEvent, data: any): typeof TsEmbed.prototype;
1673
+ trigger(messageType: HostEvent, data: any): Promise<any>;
1443
1674
  /**
1444
1675
  * Marks the ThoughtSpot object to have been rendered
1445
1676
  * Needs to be overridden by subclasses to do the actual
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.13.0-alpha.2",
3
+ "version": "1.13.0",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -45,7 +45,9 @@
45
45
  "algoliasearch": "^4.10.5",
46
46
  "classnames": "^2.3.1",
47
47
  "eventemitter3": "^4.0.7",
48
- "mixpanel-browser": "^2.45.0"
48
+ "html-react-parser": "^1.4.12",
49
+ "mixpanel-browser": "^2.45.0",
50
+ "use-deep-compare-effect": "^1.8.1"
49
51
  },
50
52
  "devDependencies": {
51
53
  "@mdx-js/mdx": "^1.6.22",
package/src/auth.spec.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as authInstance from './auth';
2
2
  import * as authService from './utils/authService';
3
+ import * as checkReleaseVersionInBetaInstance from './utils';
3
4
  import { AuthType, EmbedConfig } from './types';
4
5
  import { executeAfterWait } from './test/test-utils';
5
6
 
@@ -8,7 +9,7 @@ const username = 'tsuser';
8
9
  const password = '12345678';
9
10
  const samalLoginUrl = `${thoughtSpotHost}/callosum/v1/saml/login?targetURLPath=%235e16222e-ef02-43e9-9fbd-24226bf3ce5b`;
10
11
 
11
- const embedConfig: any = {
12
+ export const embedConfig: any = {
12
13
  doTokenAuthSuccess: (token: string) => ({
13
14
  thoughtSpotHost,
14
15
  username,
@@ -48,6 +49,9 @@ const embedConfig: any = {
48
49
  SSOAuth: {
49
50
  authType: AuthType.SSO,
50
51
  },
52
+ SAMLAuth: {
53
+ authType: AuthType.SAML,
54
+ },
51
55
  OIDCAuth: {
52
56
  authType: AuthType.OIDC,
53
57
  },
@@ -242,6 +246,10 @@ describe('Unit test for auth', () => {
242
246
  });
243
247
 
244
248
  it('when user is loggedIn', async () => {
249
+ spyOn(
250
+ checkReleaseVersionInBetaInstance,
251
+ 'checkReleaseVersionInBeta',
252
+ );
245
253
  jest.spyOn(
246
254
  authService,
247
255
  'fetchSessionInfoService',
@@ -280,6 +288,10 @@ describe('Unit test for auth', () => {
280
288
  });
281
289
 
282
290
  it('when user is loggedIn & isAtSSORedirectUrl is true', async () => {
291
+ spyOn(
292
+ checkReleaseVersionInBetaInstance,
293
+ 'checkReleaseVersionInBeta',
294
+ );
283
295
  Object.defineProperty(window, 'location', {
284
296
  value: {
285
297
  href: authInstance.SSO_REDIRECTION_MARKER_GUID,
@@ -377,6 +389,13 @@ describe('Unit test for auth', () => {
377
389
  expect(authInstance.doSamlAuth).toBeCalled();
378
390
  });
379
391
 
392
+ it('authenticate: when authType is SMAL', async () => {
393
+ jest.spyOn(authInstance, 'doSamlAuth');
394
+ await authInstance.authenticate(embedConfig.SAMLAuth);
395
+ expect(window.location.hash).toBe('');
396
+ expect(authInstance.doSamlAuth).toBeCalled();
397
+ });
398
+
380
399
  it('authenticate: when authType is OIDC', async () => {
381
400
  jest.spyOn(authInstance, 'doOIDCAuth');
382
401
  await authInstance.authenticate(embedConfig.OIDCAuth);
package/src/auth.ts CHANGED
@@ -16,8 +16,8 @@ export let loggedInStatus = false;
16
16
  export let samlAuthWindow: Window = null;
17
17
  // eslint-disable-next-line import/no-mutable-exports
18
18
  export let samlCompletionPromise: Promise<void> = null;
19
- // eslint-disable-next-line import/no-mutable-exports
20
- export let sessionInfo: any = null;
19
+ let sessionInfo: any = null;
20
+ let releaseVersion = '';
21
21
 
22
22
  export const SSO_REDIRECTION_MARKER_GUID =
23
23
  '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
@@ -68,12 +68,21 @@ async function isLoggedIn(thoughtSpotHost: string): Promise<boolean> {
68
68
  let response = null;
69
69
  try {
70
70
  response = await fetchSessionInfoService(authVerificationUrl);
71
+ const sessionInfoResp = await response.json();
72
+ releaseVersion = sessionInfoResp.releaseVersion;
71
73
  } catch (e) {
72
74
  return false;
73
75
  }
74
76
  return response.status === 200;
75
77
  }
76
78
 
79
+ /**
80
+ * Return releaseVersion if available
81
+ */
82
+ export function getReleaseVersion() {
83
+ return releaseVersion;
84
+ }
85
+
77
86
  /**
78
87
  * Return sessionInfo if available else make a loggedIn check to fetch the sessionInfo
79
88
  */
@@ -323,6 +332,7 @@ export const authenticate = async (
323
332
  const { authType } = embedConfig;
324
333
  switch (authType) {
325
334
  case AuthType.SSO:
335
+ case AuthType.SAML:
326
336
  return doSamlAuth(embedConfig);
327
337
  case AuthType.OIDC:
328
338
  return doOIDCAuth(embedConfig);
@@ -64,4 +64,15 @@ describe('getThoughtSpotHost', () => {
64
64
  }),
65
65
  ).toBe('http://1.2.3.4:8088/v2');
66
66
  });
67
+
68
+ test('when authtype SAML, fully formed URL with', () => {
69
+ expect(
70
+ getThoughtSpotHost({
71
+ ...embedConfig,
72
+ authType: AuthType.SAML,
73
+ thoughtSpotHost:
74
+ 'http://1.2.3.4:8088/v2/?foo=bar&baz=42#myhash',
75
+ }),
76
+ ).toBe('http://1.2.3.4:8088/v2');
77
+ });
67
78
  });
@@ -7,6 +7,7 @@ import {
7
7
  getIFrameSrc,
8
8
  getRootEl,
9
9
  getIFrameEl,
10
+ mockMessageChannel,
10
11
  } from '../test/test-utils';
11
12
  import { version } from '../../package.json';
12
13
  import * as config from '../config';
@@ -18,8 +19,9 @@ const defaultViewConfig = {
18
19
  },
19
20
  };
20
21
  const thoughtSpotHost = 'tshost';
21
- const defaultParams = `&hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}`;
22
- const defaultParamsForPinboardEmbed = `hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}`;
22
+ const defaultParamsWithoutHiddenActions = `&hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}`;
23
+ const defaultParams = `${defaultParamsWithoutHiddenActions}&hideAction=[%22${Action.ReportError}%22]`;
24
+ const defaultParamsForPinboardEmbed = `hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&hideAction=[%22${Action.ReportError}%22]`;
23
25
  const defaultParamsPost = '&isPinboardV2Enabled=false';
24
26
 
25
27
  beforeAll(() => {
@@ -154,7 +156,7 @@ describe('App embed tests', () => {
154
156
  appEmbed.render();
155
157
  await executeAfterWait(() => {
156
158
  expect(getIFrameSrc()).toBe(
157
- `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=false&profileAndHelpInNavBarHidden=false${defaultParams}&disableAction=[%22save%22,%22update%22]&disableHint=Access%20denied&hideAction=[%22download%22]${defaultParamsPost}#/home`,
159
+ `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=false&profileAndHelpInNavBarHidden=false${defaultParamsWithoutHiddenActions}&disableAction=[%22save%22,%22update%22]&disableHint=Access%20denied&hideAction=[%22${Action.ReportError}%22,%22download%22]${defaultParamsPost}#/home`,
158
160
  );
159
161
  });
160
162
  });
@@ -174,6 +176,20 @@ describe('App embed tests', () => {
174
176
  });
175
177
  });
176
178
 
179
+ test('Should add enableSearchAssist flagto the iframe src', async () => {
180
+ const appEmbed = new AppEmbed(getRootEl(), {
181
+ ...defaultViewConfig,
182
+ enableSearchAssist: true,
183
+ } as AppViewConfig);
184
+
185
+ appEmbed.render();
186
+ await executeAfterWait(() => {
187
+ expect(getIFrameSrc()).toBe(
188
+ `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&enableSearchAssist=true${defaultParams}${defaultParamsPost}#/home`,
189
+ );
190
+ });
191
+ });
192
+
177
193
  describe('Navigate to Page API', () => {
178
194
  const path = 'pinboard/e0836cad-4fdf-42d4-bd97-567a6b2a6058';
179
195
  beforeEach(() => {
@@ -197,6 +213,7 @@ describe('App embed tests', () => {
197
213
  });
198
214
 
199
215
  test('navigateToPage with noReload should trigger the appropriate event', async () => {
216
+ mockMessageChannel();
200
217
  const appEmbed = new AppEmbed(getRootEl(), {
201
218
  frameParams: {
202
219
  width: '100%',
@@ -215,6 +232,7 @@ describe('App embed tests', () => {
215
232
  data: path,
216
233
  }),
217
234
  `http://${thoughtSpotHost}`,
235
+ expect.anything(),
218
236
  );
219
237
 
220
238
  appEmbed.navigateToPage(-1, true);
@@ -224,6 +242,7 @@ describe('App embed tests', () => {
224
242
  data: -1,
225
243
  }),
226
244
  `http://${thoughtSpotHost}`,
245
+ expect.anything(),
227
246
  );
228
247
  });
229
248
 
package/src/embed/app.ts CHANGED
@@ -91,6 +91,11 @@ export interface AppViewConfig extends ViewConfig {
91
91
  * @hidden
92
92
  */
93
93
  liveboardV2?: boolean;
94
+ /**
95
+ * If set to true, the Search Assist feature is enabled.
96
+ * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
97
+ */
98
+ enableSearchAssist?: boolean;
94
99
  }
95
100
 
96
101
  /**
@@ -141,6 +146,7 @@ export class AppEmbed extends V1Embed {
141
146
  this.viewConfig.showPrimaryNavbar,
142
147
  this.viewConfig.disableProfileAndHelp,
143
148
  true,
149
+ this.viewConfig.enableSearchAssist,
144
150
  )}/${pageId}`;
145
151
 
146
152
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
@@ -20,6 +20,7 @@ beforeAll(() => {
20
20
  thoughtSpotHost,
21
21
  authType: AuthType.None,
22
22
  });
23
+ spyOn(window, 'alert');
23
24
  });
24
25
 
25
26
  describe('test view config', () => {
@@ -48,6 +49,7 @@ describe('test view config', () => {
48
49
  });
49
50
 
50
51
  test('trying to register event handler after render should throw error', async () => {
52
+ spyOn(console, 'error');
51
53
  const onErrorSpy = jest.fn();
52
54
  const searchEmbed = new SearchEmbed(getRootEl(), defaultViewConfig);
53
55
  searchEmbed
@@ -15,6 +15,7 @@ import {
15
15
  getIFrameEl,
16
16
  getRootEl,
17
17
  getRootEl2,
18
+ mockMessageChannel,
18
19
  postMessageToParent,
19
20
  } from '../test/test-utils';
20
21
  import { LiveboardViewConfig } from './liveboard';
@@ -33,6 +34,7 @@ beforeAll(() => {
33
34
  thoughtSpotHost,
34
35
  authType: AuthType.None,
35
36
  });
37
+ spyOn(window, 'alert');
36
38
  });
37
39
 
38
40
  describe('test communication between host app and ThoughtSpot', () => {
@@ -70,6 +72,7 @@ describe('test communication between host app and ThoughtSpot', () => {
70
72
  });
71
73
 
72
74
  test('should trigger event to ThoughtSpot app', (done) => {
75
+ mockMessageChannel();
73
76
  const searchEmbed = new SearchEmbed(getRootEl(), {});
74
77
  searchEmbed.render();
75
78
  setTimeout(() => {