@thoughtspot/visual-embed-sdk 1.35.11 → 1.35.13

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 (143) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/auth.d.ts +2 -1
  3. package/cjs/src/auth.d.ts.map +1 -1
  4. package/cjs/src/auth.js +3 -1
  5. package/cjs/src/auth.js.map +1 -1
  6. package/cjs/src/embed/app.d.ts.map +1 -1
  7. package/cjs/src/embed/app.js +2 -0
  8. package/cjs/src/embed/app.js.map +1 -1
  9. package/cjs/src/embed/conversation.d.ts +44 -0
  10. package/cjs/src/embed/conversation.d.ts.map +1 -1
  11. package/cjs/src/embed/conversation.js +10 -1
  12. package/cjs/src/embed/conversation.js.map +1 -1
  13. package/cjs/src/embed/conversation.spec.js +36 -0
  14. package/cjs/src/embed/conversation.spec.js.map +1 -1
  15. package/cjs/src/embed/hostEventClient/contracts.d.ts +3 -3
  16. package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  17. package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  18. package/cjs/src/embed/hostEventClient/host-event-client.js +6 -1
  19. package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
  20. package/cjs/src/embed/liveboard.d.ts +5 -4
  21. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  22. package/cjs/src/embed/liveboard.js +11 -4
  23. package/cjs/src/embed/liveboard.js.map +1 -1
  24. package/cjs/src/embed/liveboard.spec.js +1 -1
  25. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  26. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  27. package/cjs/src/embed/search-bar.js +4 -2
  28. package/cjs/src/embed/search-bar.js.map +1 -1
  29. package/cjs/src/embed/search.d.ts.map +1 -1
  30. package/cjs/src/embed/search.js +4 -2
  31. package/cjs/src/embed/search.js.map +1 -1
  32. package/cjs/src/embed/search.spec.js +56 -3
  33. package/cjs/src/embed/search.spec.js.map +1 -1
  34. package/cjs/src/embed/ts-embed.d.ts +6 -0
  35. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  36. package/cjs/src/embed/ts-embed.js +43 -15
  37. package/cjs/src/embed/ts-embed.js.map +1 -1
  38. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  39. package/cjs/src/embed/ts-embed.spec.js +193 -81
  40. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  41. package/cjs/src/types.d.ts +85 -20
  42. package/cjs/src/types.d.ts.map +1 -1
  43. package/cjs/src/types.js +80 -9
  44. package/cjs/src/types.js.map +1 -1
  45. package/cjs/src/utils/processData.d.ts.map +1 -1
  46. package/cjs/src/utils/processData.js +9 -2
  47. package/cjs/src/utils/processData.js.map +1 -1
  48. package/cjs/src/utils/processData.spec.js +51 -0
  49. package/cjs/src/utils/processData.spec.js.map +1 -1
  50. package/dist/index-B3hd6DTM.js +7370 -0
  51. package/dist/index-D-9WUCUl.js +7370 -0
  52. package/dist/src/auth.d.ts +2 -1
  53. package/dist/src/auth.d.ts.map +1 -1
  54. package/dist/src/embed/app.d.ts.map +1 -1
  55. package/dist/src/embed/conversation.d.ts +44 -0
  56. package/dist/src/embed/conversation.d.ts.map +1 -1
  57. package/dist/src/embed/hostEventClient/contracts.d.ts +3 -3
  58. package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  59. package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  60. package/dist/src/embed/liveboard.d.ts +5 -4
  61. package/dist/src/embed/liveboard.d.ts.map +1 -1
  62. package/dist/src/embed/search-bar.d.ts.map +1 -1
  63. package/dist/src/embed/search.d.ts.map +1 -1
  64. package/dist/src/embed/ts-embed.d.ts +6 -0
  65. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  66. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  67. package/dist/src/types.d.ts +85 -20
  68. package/dist/src/types.d.ts.map +1 -1
  69. package/dist/src/utils/processData.d.ts.map +1 -1
  70. package/dist/tsembed-react.es.js +175 -40
  71. package/dist/tsembed-react.js +174 -39
  72. package/dist/tsembed.es.js +175 -40
  73. package/dist/tsembed.js +174 -39
  74. package/dist/visual-embed-sdk-react-full.d.ts +138 -27
  75. package/dist/visual-embed-sdk-react.d.ts +138 -27
  76. package/dist/visual-embed-sdk.d.ts +138 -27
  77. package/lib/package.json +1 -1
  78. package/lib/src/auth.d.ts +2 -1
  79. package/lib/src/auth.d.ts.map +1 -1
  80. package/lib/src/auth.js +3 -1
  81. package/lib/src/auth.js.map +1 -1
  82. package/lib/src/embed/app.d.ts.map +1 -1
  83. package/lib/src/embed/app.js +2 -0
  84. package/lib/src/embed/app.js.map +1 -1
  85. package/lib/src/embed/conversation.d.ts +44 -0
  86. package/lib/src/embed/conversation.d.ts.map +1 -1
  87. package/lib/src/embed/conversation.js +10 -1
  88. package/lib/src/embed/conversation.js.map +1 -1
  89. package/lib/src/embed/conversation.spec.js +36 -0
  90. package/lib/src/embed/conversation.spec.js.map +1 -1
  91. package/lib/src/embed/hostEventClient/contracts.d.ts +3 -3
  92. package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  93. package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  94. package/lib/src/embed/hostEventClient/host-event-client.js +6 -1
  95. package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
  96. package/lib/src/embed/liveboard.d.ts +5 -4
  97. package/lib/src/embed/liveboard.d.ts.map +1 -1
  98. package/lib/src/embed/liveboard.js +11 -4
  99. package/lib/src/embed/liveboard.js.map +1 -1
  100. package/lib/src/embed/liveboard.spec.js +1 -1
  101. package/lib/src/embed/liveboard.spec.js.map +1 -1
  102. package/lib/src/embed/search-bar.d.ts.map +1 -1
  103. package/lib/src/embed/search-bar.js +4 -2
  104. package/lib/src/embed/search-bar.js.map +1 -1
  105. package/lib/src/embed/search.d.ts.map +1 -1
  106. package/lib/src/embed/search.js +4 -2
  107. package/lib/src/embed/search.js.map +1 -1
  108. package/lib/src/embed/search.spec.js +56 -3
  109. package/lib/src/embed/search.spec.js.map +1 -1
  110. package/lib/src/embed/ts-embed.d.ts +6 -0
  111. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  112. package/lib/src/embed/ts-embed.js +43 -15
  113. package/lib/src/embed/ts-embed.js.map +1 -1
  114. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  115. package/lib/src/embed/ts-embed.spec.js +195 -83
  116. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  117. package/lib/src/types.d.ts +85 -20
  118. package/lib/src/types.d.ts.map +1 -1
  119. package/lib/src/types.js +80 -9
  120. package/lib/src/types.js.map +1 -1
  121. package/lib/src/utils/processData.d.ts.map +1 -1
  122. package/lib/src/utils/processData.js +9 -2
  123. package/lib/src/utils/processData.js.map +1 -1
  124. package/lib/src/utils/processData.spec.js +51 -0
  125. package/lib/src/utils/processData.spec.js.map +1 -1
  126. package/lib/src/visual-embed-sdk.d.ts +139 -28
  127. package/package.json +1 -1
  128. package/src/auth.ts +3 -1
  129. package/src/embed/app.ts +2 -0
  130. package/src/embed/conversation.spec.ts +52 -3
  131. package/src/embed/conversation.ts +60 -1
  132. package/src/embed/hostEventClient/contracts.ts +3 -3
  133. package/src/embed/hostEventClient/host-event-client.ts +7 -1
  134. package/src/embed/liveboard.spec.ts +1 -1
  135. package/src/embed/liveboard.ts +18 -12
  136. package/src/embed/search-bar.tsx +6 -4
  137. package/src/embed/search.spec.ts +71 -3
  138. package/src/embed/search.ts +6 -5
  139. package/src/embed/ts-embed.spec.ts +234 -102
  140. package/src/embed/ts-embed.ts +50 -34
  141. package/src/types.ts +89 -16
  142. package/src/utils/processData.spec.ts +63 -0
  143. package/src/utils/processData.ts +12 -2
@@ -10,8 +10,6 @@ import isEqual from 'lodash/isEqual';
10
10
  import isEmpty from 'lodash/isEmpty';
11
11
  import isObject from 'lodash/isObject';
12
12
  import {
13
- HostEventRequest,
14
- HostEventResponse,
15
13
  TriggerPayload,
16
14
  TriggerResponse,
17
15
  UIPassthroughArrayResponse,
@@ -141,8 +139,8 @@ export class TsEmbed {
141
139
  protected thoughtSpotHost: string;
142
140
 
143
141
  /*
144
- * This is the base to access ThoughtSpot V2.
145
- */
142
+ * This is the base to access ThoughtSpot V2.
143
+ */
146
144
  protected thoughtSpotV2Base: string;
147
145
 
148
146
  /**
@@ -352,7 +350,7 @@ export class TsEmbed {
352
350
  ? this.viewConfig?.hiddenHomeLeftNavItems
353
351
  : [],
354
352
  customVariablesForThirdPartyTools:
355
- this.embedConfig.customVariablesForThirdPartyTools || {},
353
+ this.embedConfig.customVariablesForThirdPartyTools || {},
356
354
  };
357
355
  }
358
356
 
@@ -403,12 +401,37 @@ export class TsEmbed {
403
401
  notifyAuthFailure(AuthFailureType.EXPIRY);
404
402
  };
405
403
 
404
+ /**
405
+ * Auto Login and send updated authToken to the iFrame to avoid user session logout
406
+ * @param _
407
+ * @param responder
408
+ */
409
+ private idleSessionTimeout = (_: any, responder: any) => {
410
+ handleAuth().then(async () => {
411
+ let authToken = '';
412
+ try {
413
+ authToken = await getAuthenticationToken(this.embedConfig);
414
+ responder({
415
+ type: EmbedEvent.IdleSessionTimeout,
416
+ data: { authToken },
417
+ });
418
+ } catch (e) {
419
+ logger.error(`${ERROR_MESSAGE.INVALID_TOKEN_ERROR} Error : ${e?.message}`);
420
+ processAuthFailure(e, this.isPreRendered ? this.preRenderWrapper : this.el);
421
+ }
422
+ }).catch((e) => {
423
+ logger.error(`Auto Login failed, Error : ${e?.message}`);
424
+ });
425
+ notifyAuthFailure(AuthFailureType.IDLE_SESSION_TIMEOUT);
426
+ };
427
+
406
428
  /**
407
429
  * Register APP_INIT event and sendback init payload
408
430
  */
409
431
  private registerAppInit = () => {
410
432
  this.on(EmbedEvent.APP_INIT, this.appInitCb, { start: false }, true);
411
433
  this.on(EmbedEvent.AuthExpire, this.updateAuthToken, { start: false }, true);
434
+ this.on(EmbedEvent.IdleSessionTimeout, this.idleSessionTimeout, { start: false }, true);
412
435
  };
413
436
 
414
437
  /**
@@ -416,7 +439,7 @@ export class TsEmbed {
416
439
  * @param query
417
440
  */
418
441
  protected getEmbedBasePath(query: string): string {
419
- let queryString = (query.startsWith('?')) ? query : `?${query}`;
442
+ let queryString = query.startsWith('?') ? query : `?${query}`;
420
443
  if (this.shouldEncodeUrlQueryParams) {
421
444
  queryString = `?base64UrlEncodedFlags=${getEncodedQueryParamsString(
422
445
  queryString.substr(1),
@@ -434,9 +457,7 @@ export class TsEmbed {
434
457
  * @param queryParams
435
458
  * @returns queryParams
436
459
  */
437
- protected getBaseQueryParams(
438
- queryParams: Record<any, any> = {},
439
- ) {
460
+ protected getBaseQueryParams(queryParams: Record<any, any> = {}) {
440
461
  let hostAppUrl = window?.location?.host || '';
441
462
 
442
463
  // The below check is needed because TS Cloud firewall, blocks
@@ -444,14 +465,15 @@ export class TsEmbed {
444
465
  if (hostAppUrl.includes('localhost') || hostAppUrl.includes('127.0.0.1')) {
445
466
  hostAppUrl = 'local-host';
446
467
  }
468
+ const blockNonEmbedFullAppAccess = this.embedConfig.blockNonEmbedFullAppAccess ?? true;
447
469
  queryParams[Param.EmbedApp] = true;
448
470
  queryParams[Param.HostAppUrl] = encodeURIComponent(hostAppUrl);
449
471
  queryParams[Param.ViewPortHeight] = window.innerHeight;
450
472
  queryParams[Param.ViewPortWidth] = window.innerWidth;
451
473
  queryParams[Param.Version] = version;
452
474
  queryParams[Param.AuthType] = this.embedConfig.authType;
453
- queryParams[Param.blockNonEmbedFullAppAccess] = this.embedConfig.blockNonEmbedFullAppAccess
454
- ?? true;
475
+ queryParams[Param.blockNonEmbedFullAppAccess] = blockNonEmbedFullAppAccess;
476
+ queryParams[Param.AutoLogin] = this.embedConfig.autoLogin;
455
477
  if (this.embedConfig.disableLoginRedirect === true || this.embedConfig.autoLogin === true) {
456
478
  queryParams[Param.DisableLoginRedirect] = true;
457
479
  }
@@ -490,7 +512,6 @@ export class TsEmbed {
490
512
  insertInToSlide,
491
513
  disableRedirectionLinksInNewTab,
492
514
  overrideOrgId,
493
- enableFlipTooltipToContextMenu = false,
494
515
  } = this.viewConfig;
495
516
 
496
517
  const { additionalFlags: additionalFlagsFromInit } = this.embedConfig;
@@ -500,10 +521,6 @@ export class TsEmbed {
500
521
  ...additionalFlagsFromView,
501
522
  };
502
523
 
503
- if (enableFlipTooltipToContextMenu) {
504
- queryParams[Param.EnableFlipTooltipToContextMenu] = enableFlipTooltipToContextMenu;
505
- }
506
-
507
524
  if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
508
525
  this.handleError('You cannot have both hidden actions and visible actions');
509
526
  return queryParams;
@@ -536,13 +553,15 @@ export class TsEmbed {
536
553
  * menu click
537
554
  */
538
555
  if (contextMenuTrigger === ContextMenuTriggerOptions.LEFT_CLICK) {
539
- queryParams[Param.ContextMenuTrigger] = true;
556
+ queryParams[Param.ContextMenuTrigger] = 'left';
540
557
  } else if (contextMenuTrigger === ContextMenuTriggerOptions.RIGHT_CLICK) {
541
- queryParams[Param.ContextMenuTrigger] = false;
558
+ queryParams[Param.ContextMenuTrigger] = 'right';
559
+ } else if (contextMenuTrigger === ContextMenuTriggerOptions.BOTH_CLICKS) {
560
+ queryParams[Param.ContextMenuTrigger] = 'both';
542
561
  }
543
562
 
544
- const spriteUrl = customizations?.iconSpriteUrl
545
- || this.embedConfig.customizations?.iconSpriteUrl;
563
+ const embedCustomizations = this.embedConfig.customizations;
564
+ const spriteUrl = customizations?.iconSpriteUrl || embedCustomizations?.iconSpriteUrl;
546
565
  if (spriteUrl) {
547
566
  queryParams[Param.IconSpriteUrl] = spriteUrl.replace('https://', '');
548
567
  }
@@ -627,11 +646,8 @@ export class TsEmbed {
627
646
  // @ts-ignore
628
647
  iFrame.allow = 'clipboard-read; clipboard-write; fullscreen;';
629
648
 
630
- const {
631
- height: frameHeight,
632
- width: frameWidth,
633
- ...restParams
634
- } = this.viewConfig.frameParams || {};
649
+ const frameParams = this.viewConfig.frameParams;
650
+ const { height: frameHeight, width: frameWidth, ...restParams } = frameParams || {};
635
651
  const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
636
652
  const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
637
653
  setAttributes(iFrame, restParams);
@@ -753,8 +769,8 @@ export class TsEmbed {
753
769
 
754
770
  protected connectPreRendered(): boolean {
755
771
  const preRenderIds = this.getPreRenderIds();
756
- this.preRenderWrapper = this.preRenderWrapper
757
- || document.getElementById(preRenderIds.wrapper);
772
+ const preRenderWrapperElement = document.getElementById(preRenderIds.wrapper);
773
+ this.preRenderWrapper = this.preRenderWrapper || preRenderWrapperElement;
758
774
 
759
775
  this.preRenderChild = this.preRenderChild || document.getElementById(preRenderIds.child);
760
776
 
@@ -1033,7 +1049,7 @@ export class TsEmbed {
1033
1049
  */
1034
1050
  public async trigger<HostEventT extends HostEvent, PayloadT>(
1035
1051
  messageType: HostEventT,
1036
- data: TriggerPayload<PayloadT, HostEventT> = ({} as any),
1052
+ data: TriggerPayload<PayloadT, HostEventT> = {} as any,
1037
1053
  ): Promise<TriggerResponse<PayloadT, HostEventT>> {
1038
1054
  uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
1039
1055
 
@@ -1182,11 +1198,11 @@ export class TsEmbed {
1182
1198
  ) {
1183
1199
  logger.warn(
1184
1200
  `${viewConfig.embedComponentType || 'Component'} was pre-rendered with `
1185
- + `"${key}" as "${JSON.stringify(preRenderedObject.viewConfig[key])}" `
1186
- + `but a different value "${JSON.stringify(viewConfig[key])}" `
1187
- + 'was passed to the Embed component. '
1188
- + 'The new value provided is ignored, the value provided during '
1189
- + 'preRender is used.',
1201
+ + `"${key}" as "${JSON.stringify(preRenderedObject.viewConfig[key])}" `
1202
+ + `but a different value "${JSON.stringify(viewConfig[key])}" `
1203
+ + 'was passed to the Embed component. '
1204
+ + 'The new value provided is ignored, the value provided during '
1205
+ + 'preRender is used.',
1190
1206
  );
1191
1207
  }
1192
1208
  });
@@ -1351,7 +1367,7 @@ export class V1Embed extends TsEmbed {
1351
1367
  const filterQuery = getFilterQuery(runtimeFilters || []);
1352
1368
  queryString = [filterQuery, queryString].filter(Boolean).join('&');
1353
1369
  }
1354
- return (this.viewConfig.enableV2Shell_experimental)
1370
+ return this.viewConfig.enableV2Shell_experimental
1355
1371
  ? this.getEmbedBasePath(queryString)
1356
1372
  : this.getV1EmbedBasePath(queryString);
1357
1373
  }
package/src/types.ts CHANGED
@@ -535,7 +535,12 @@ export interface EmbedConfig {
535
535
  suppressErrorAlerts?: boolean;
536
536
 
537
537
  /**
538
- * Log level for the SDK.
538
+ * Suppress or show specific types of logs in the console output.
539
+ * For example, `LogLevel.ERROR` shows only Visual Embed SDK and
540
+ * ThoughtSpot application errors and suppresses
541
+ * other logs such as warnings, information alerts,
542
+ * and debug messages in the console output.
543
+ *
539
544
  * @default LogLevel.ERROR
540
545
  * @example
541
546
  * ```js
@@ -1119,12 +1124,6 @@ export interface ViewConfig {
1119
1124
  * @version SDK: 1.35.0 | ThoughtSpot: 10.5.0.cl
1120
1125
  */
1121
1126
  overrideOrgId?: number;
1122
- /**
1123
- * Flag to control new flip tooltip context menu experience
1124
- * @default false
1125
- * @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
1126
- */
1127
- enableFlipTooltipToContextMenu?: boolean;
1128
1127
  }
1129
1128
 
1130
1129
  /**
@@ -1593,6 +1592,13 @@ export enum EmbedEvent {
1593
1592
  * @hidden
1594
1593
  */
1595
1594
  AuthFailure = 'ThoughtspotAuthFailure',
1595
+
1596
+ /**
1597
+ * ThoughtSpot failed to re validate the auth session.
1598
+ * @hidden
1599
+ */
1600
+ IdleSessionTimeout = 'IdleSessionTimeout',
1601
+
1596
1602
  /**
1597
1603
  * ThoughtSpot failed to validate the auth session.
1598
1604
  * @hidden
@@ -2299,6 +2305,36 @@ export enum EmbedEvent {
2299
2305
  * @version SDK : 1.29.0 | ThoughtSpot : 10.3.0.cl
2300
2306
  */
2301
2307
  ParameterChanged = 'parameterChanged',
2308
+ /**
2309
+ * Emitted when the table viz renders.
2310
+ * You can use this event as a hook to trigger
2311
+ * other events on the rendered table viz data.
2312
+ * @example
2313
+ * ```js
2314
+ * searchEmbed.on(EmbedEvent.TableVizRendered, (payload) => {
2315
+ * console.log(payload);
2316
+ * const columnDataLite = payload.data.data.columnDataLite;
2317
+ * columnDataLite[0].dataValue[0]="new fob";
2318
+ * console.log('>>> new Data', columnDataLite);
2319
+ * searchEmbed.trigger(HostEvent.TransformTableVizData, columnDataLite);
2320
+ * })
2321
+ * ```
2322
+ * @version SDK: 1.35.12 | ThoughtSpot: 10.7.0.cl
2323
+ */
2324
+ TableVizRendered = 'TableVizRendered',
2325
+ /**
2326
+ * Emitted when the liveboard is created from pin modal or liveboard list page.
2327
+ * You can use this event as a hook to trigger
2328
+ * other events on liveboard creation.
2329
+ *
2330
+ * ```js
2331
+ * liveboardEmbed.on(EmbedEvent.CreateLiveboard, (payload) => {
2332
+ * console.log('payload', payload);
2333
+ * })
2334
+ *```
2335
+ * @version SDK : 1.36.0 | ThoughtSpot : 10.8.0.cl
2336
+ */
2337
+ CreateLiveboard = 'createLiveboard',
2302
2338
  }
2303
2339
 
2304
2340
  /**
@@ -2709,7 +2745,7 @@ export enum HostEvent {
2709
2745
  * @param - an object with `vizId` as a key
2710
2746
  * @example
2711
2747
  * ```js
2712
- * liveboardEmbed.trigger(HostEvent.CreateMonitor {
2748
+ * liveboardEmbed.trigger(HostEvent.CreateMonitor, {
2713
2749
  * vizId: '730496d6-6903-4601-937e-2c691821af3c'
2714
2750
  * })
2715
2751
  * ```
@@ -3242,6 +3278,25 @@ export enum HostEvent {
3242
3278
  * @hidden
3243
3279
  */
3244
3280
  UIPassthrough = 'UiPassthrough',
3281
+ /**
3282
+ * Triggers the table viz rerender with the updated data.
3283
+ * Includes the following properties:
3284
+ * @param - columnDataLite - an array of object containing data
3285
+ * transformed from data picked from TableVizRendered event.
3286
+ * For example, { columnDataLite: []}
3287
+ * @example
3288
+ * ```js
3289
+ * searchEmbed.on(EmbedEvent.TableVizRendered, (payload) => {
3290
+ * console.log(payload);
3291
+ * const columnDataLite = payload.data.data.columnDataLite;
3292
+ * columnDataLite[0].dataValue[0]="new fob";
3293
+ * console.log('>>> new Data', columnDataLite);
3294
+ * searchEmbed.trigger(HostEvent.TransformTableVizData, columnDataLite);
3295
+ * })
3296
+ * ```
3297
+ * @version SDK: 1.35.12 | ThoughtSpot: 10.7.0.cl
3298
+ */
3299
+ TransformTableVizData = 'TransformTableVizData',
3245
3300
  }
3246
3301
 
3247
3302
  /**
@@ -3286,6 +3341,7 @@ export enum Param {
3286
3341
  HideResult = 'hideResult',
3287
3342
  UseLastSelectedDataSource = 'useLastSelectedSources',
3288
3343
  Tag = 'tag',
3344
+ AutoLogin = 'autoLogin',
3289
3345
  searchTokenString = 'searchTokenString',
3290
3346
  executeSearch = 'executeSearch',
3291
3347
  fullHeight = 'isFullHeightPinboard',
@@ -3308,7 +3364,12 @@ export enum Param {
3308
3364
  AuthType = 'authType',
3309
3365
  IconSpriteUrl = 'iconSprite',
3310
3366
  cookieless = 'cookieless',
3311
- ContextMenuTrigger = 'isContextMenuEnabledOnLeftClick',
3367
+ // Deprecated: `isContextMenuEnabledOnLeftClick`
3368
+ // Introduced: `contextMenuEnabledOnWhichClick` with values: 'left',
3369
+ // 'right', or 'both'. This update only affects ThoughtSpot URL parameters
3370
+ // and does not impact existing workflows or use cases. Added support for
3371
+ // 'both' clicks in `contextMenuTrigger` configuration.
3372
+ ContextMenuTrigger = 'contextMenuEnabledOnWhichClick',
3312
3373
  LinkOverride = 'linkOverride',
3313
3374
  blockNonEmbedFullAppAccess = 'blockNonEmbedFullAppAccess',
3314
3375
  ShowInsertToSlide = 'insertInToSlide',
@@ -3363,10 +3424,10 @@ export enum Param {
3363
3424
  SpotterEnabled = 'isSpotterExperienceEnabled',
3364
3425
  IsUnifiedSearchExperienceEnabled = 'isUnifiedSearchExperienceEnabled',
3365
3426
  OverrideOrgId = 'orgId',
3366
- EnableFlipTooltipToContextMenu = 'flipTooltipToContextMenuEnabled',
3367
3427
  OauthPollingInterval = 'oAuthPollingInterval',
3368
3428
  IsForceRedirect = 'isForceRedirect',
3369
3429
  DataSourceId = 'dataSourceId',
3430
+ ShowSpotterLimitations = 'showSpotterLimitations',
3370
3431
  }
3371
3432
 
3372
3433
  /**
@@ -4587,10 +4648,12 @@ export enum PrefetchFeatures {
4587
4648
 
4588
4649
  /**
4589
4650
  * Enum for options to change context trigger
4651
+ * BOTH_CLICKS option is introduced in 10.7
4590
4652
  */
4591
4653
  export enum ContextMenuTriggerOptions {
4592
4654
  LEFT_CLICK = 'left-click',
4593
4655
  RIGHT_CLICK = 'right-click',
4656
+ BOTH_CLICKS = 'both-clicks',
4594
4657
  }
4595
4658
 
4596
4659
  export interface ColumnValue {
@@ -4641,9 +4704,17 @@ export interface CustomActionPayload {
4641
4704
  vizId?: string;
4642
4705
  }
4643
4706
 
4707
+ /**
4708
+ * Enum options to show or suppress Visual Embed SDK and
4709
+ * ThoughtSpot application logs in the console output.
4710
+ * This attribute doesn't support suppressing
4711
+ * browser warnings or errors.
4712
+ */
4713
+
4644
4714
  export enum LogLevel {
4645
4715
  /**
4646
- * No logs will be logged in the console.
4716
+ * No application or SDK-related logs will be logged
4717
+ * in the console output.
4647
4718
  * @example
4648
4719
  * ```js
4649
4720
  * init({
@@ -4655,7 +4726,7 @@ export enum LogLevel {
4655
4726
  */
4656
4727
  SILENT = 'SILENT',
4657
4728
  /**
4658
- * Only ERROR logs will be logged in the console.
4729
+ * Log only errors in the console output.
4659
4730
  * @example
4660
4731
  * ```js
4661
4732
  * init({
@@ -4667,7 +4738,7 @@ export enum LogLevel {
4667
4738
  */
4668
4739
  ERROR = 'ERROR',
4669
4740
  /**
4670
- * Only WARN and ERROR logs will be logged in the console.
4741
+ * Log only warnings and errors in the console output.
4671
4742
  * @example
4672
4743
  * ```js
4673
4744
  * init({
@@ -4679,7 +4750,8 @@ export enum LogLevel {
4679
4750
  */
4680
4751
  WARN = 'WARN',
4681
4752
  /**
4682
- * Only INFO, WARN, and ERROR logs will be logged in the console.
4753
+ * Log only the information alerts, warnings, and errors
4754
+ * in the console output.
4683
4755
  * @example
4684
4756
  * ```js
4685
4757
  * init({
@@ -4692,7 +4764,8 @@ export enum LogLevel {
4692
4764
  INFO = 'INFO',
4693
4765
 
4694
4766
  /**
4695
- * Only DEBUG, INFO, WARN, and ERROR logs will be logged in the console.
4767
+ * Log debug messages, warnings, information alerts,
4768
+ * and errors in the console output.
4696
4769
  * @example
4697
4770
  * ```js
4698
4771
  * init({
@@ -4704,7 +4777,7 @@ export enum LogLevel {
4704
4777
  */
4705
4778
  DEBUG = 'DEBUG',
4706
4779
  /**
4707
- * All logs will be logged in the console.
4780
+ * All logs will be logged in the browser console.
4708
4781
  * @example
4709
4782
  * ```js
4710
4783
  * init({
@@ -48,6 +48,37 @@ describe('Unit test for process data', () => {
48
48
  );
49
49
  });
50
50
 
51
+ test('ProcessData, when Action is CustomAction with contextMenuPoints', async () => {
52
+ const processedData = {
53
+ type: EmbedEvent.CustomAction,
54
+ data: {
55
+ contextMenuPoints: {
56
+ selectedPoints: [{ x: 1, y: 2 }],
57
+ },
58
+ },
59
+ };
60
+ jest.spyOn(processDataInstance, 'processCustomAction').mockImplementation(async () => ({}));
61
+ expect(
62
+ processDataInstance.processEventData(
63
+ EmbedEvent.CustomAction,
64
+ processedData,
65
+ thoughtSpotHost,
66
+ null,
67
+ ),
68
+ ).toEqual(
69
+ expect.objectContaining({
70
+ ...processedData,
71
+ answerService: {
72
+ answer: {},
73
+ selectedPoints: [{ x: 1, y: 2 }],
74
+ session: undefined,
75
+ thoughtSpotHost: 'http://localhost',
76
+ tmlOverride: {},
77
+ },
78
+ }),
79
+ );
80
+ });
81
+
51
82
  test('ProcessData, when Action is non CustomAction', () => {
52
83
  const processedData = { type: EmbedEvent.Data };
53
84
  jest.spyOn(processDataInstance, 'processCustomAction').mockImplementation(async () => ({}));
@@ -188,4 +219,36 @@ describe('Unit test for process data', () => {
188
219
  expect(base.notifyAuthFailure).not.toBeCalled();
189
220
  expect(el.innerHTML).not.toBe('Hello');
190
221
  });
222
+
223
+ test('process authFailure AuthType=TrustedAuthToken and autoLogin true', () => {
224
+ const e = { type: EmbedEvent.AuthFailure };
225
+ jest.spyOn(base, 'notifyAuthFailure');
226
+ jest.spyOn(embedConfigInstance, 'getEmbedConfig').mockReturnValue({
227
+ loginFailedMessage: 'Hello',
228
+ authType: AuthType.TrustedAuthToken,
229
+ autoLogin: true,
230
+ });
231
+ const el: any = {};
232
+ expect(processDataInstance.processEventData(e.type, e, '', el)).toEqual({
233
+ type: e.type,
234
+ });
235
+ expect(base.notifyAuthFailure).toBeCalledWith(auth.AuthFailureType.IDLE_SESSION_TIMEOUT);
236
+ expect(el.innerHTML).toBe('Hello');
237
+ });
238
+
239
+ test('process authFailure with TrustedAuthTokenCookieless and autoLogin', () => {
240
+ const e = { type: EmbedEvent.AuthFailure };
241
+ jest.spyOn(base, 'notifyAuthFailure');
242
+ jest.spyOn(embedConfigInstance, 'getEmbedConfig').mockReturnValue({
243
+ loginFailedMessage: 'Hello',
244
+ authType: AuthType.TrustedAuthTokenCookieless,
245
+ autoLogin: true,
246
+ });
247
+ const el: any = {};
248
+ expect(processDataInstance.processEventData(e.type, e, '', el)).toEqual({
249
+ type: e.type,
250
+ });
251
+ expect(base.notifyAuthFailure).toBeCalledWith(auth.AuthFailureType.IDLE_SESSION_TIMEOUT);
252
+ expect(el.innerHTML).toBe('Hello');
253
+ });
191
254
  });
@@ -77,8 +77,18 @@ function processNoCookieAccess(e: any, containerEl: Element) {
77
77
  * @param containerEl
78
78
  */
79
79
  export function processAuthFailure(e: any, containerEl: Element) {
80
- const { loginFailedMessage, authType, disableLoginFailurePage } = getEmbedConfig();
81
- if (authType !== AuthType.None && !disableLoginFailurePage) {
80
+ const {
81
+ loginFailedMessage, authType, disableLoginFailurePage, autoLogin,
82
+ } = getEmbedConfig();
83
+ if (
84
+ autoLogin
85
+ && (authType === AuthType.TrustedAuthToken
86
+ || authType === AuthType.TrustedAuthTokenCookieless)
87
+ ) {
88
+ // eslint-disable-next-line no-param-reassign
89
+ containerEl.innerHTML = loginFailedMessage;
90
+ notifyAuthFailure(AuthFailureType.IDLE_SESSION_TIMEOUT);
91
+ } else if (authType !== AuthType.None && !disableLoginFailurePage) {
82
92
  // eslint-disable-next-line no-param-reassign
83
93
  containerEl.innerHTML = loginFailedMessage;
84
94
  notifyAuthFailure(AuthFailureType.OTHER);