@thoughtspot/visual-embed-sdk 1.33.4 → 1.33.6

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 (122) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/config.d.ts.map +1 -1
  3. package/cjs/src/config.js.map +1 -1
  4. package/cjs/src/embed/app.d.ts +14 -0
  5. package/cjs/src/embed/app.d.ts.map +1 -1
  6. package/cjs/src/embed/app.js +2 -2
  7. package/cjs/src/embed/app.js.map +1 -1
  8. package/cjs/src/embed/app.spec.js +10 -0
  9. package/cjs/src/embed/app.spec.js.map +1 -1
  10. package/cjs/src/embed/base.d.ts +4 -1
  11. package/cjs/src/embed/base.d.ts.map +1 -1
  12. package/cjs/src/embed/base.js +14 -6
  13. package/cjs/src/embed/base.js.map +1 -1
  14. package/cjs/src/embed/base.spec.js +45 -3
  15. package/cjs/src/embed/base.spec.js.map +1 -1
  16. package/cjs/src/embed/bodyless-conversation.d.ts +17 -0
  17. package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
  18. package/cjs/src/embed/bodyless-conversation.js +14 -0
  19. package/cjs/src/embed/bodyless-conversation.js.map +1 -1
  20. package/cjs/src/embed/conversation.d.ts.map +1 -1
  21. package/cjs/src/embed/conversation.js +1 -0
  22. package/cjs/src/embed/conversation.js.map +1 -1
  23. package/cjs/src/embed/liveboard.d.ts +14 -0
  24. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  25. package/cjs/src/embed/liveboard.js +2 -2
  26. package/cjs/src/embed/liveboard.js.map +1 -1
  27. package/cjs/src/embed/liveboard.spec.js +11 -0
  28. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  29. package/cjs/src/embed/sage.d.ts.map +1 -1
  30. package/cjs/src/embed/sage.js +0 -1
  31. package/cjs/src/embed/sage.js.map +1 -1
  32. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  33. package/cjs/src/embed/ts-embed.js +13 -2
  34. package/cjs/src/embed/ts-embed.js.map +1 -1
  35. package/cjs/src/embed/ts-embed.spec.js +40 -0
  36. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  37. package/cjs/src/react/index.spec.js +2 -2
  38. package/cjs/src/react/index.spec.js.map +1 -1
  39. package/cjs/src/types.d.ts +54 -6
  40. package/cjs/src/types.d.ts.map +1 -1
  41. package/cjs/src/types.js +15 -3
  42. package/cjs/src/types.js.map +1 -1
  43. package/dist/{index-Cl8Rsh6W.js → index-CbltIawo.js} +1 -1
  44. package/dist/src/config.d.ts.map +1 -1
  45. package/dist/src/embed/app.d.ts +14 -0
  46. package/dist/src/embed/app.d.ts.map +1 -1
  47. package/dist/src/embed/base.d.ts +4 -1
  48. package/dist/src/embed/base.d.ts.map +1 -1
  49. package/dist/src/embed/bodyless-conversation.d.ts +17 -0
  50. package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
  51. package/dist/src/embed/conversation.d.ts.map +1 -1
  52. package/dist/src/embed/liveboard.d.ts +14 -0
  53. package/dist/src/embed/liveboard.d.ts.map +1 -1
  54. package/dist/src/embed/sage.d.ts.map +1 -1
  55. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  56. package/dist/src/types.d.ts +54 -6
  57. package/dist/src/types.d.ts.map +1 -1
  58. package/dist/tsembed-react.es.js +157 -67
  59. package/dist/tsembed-react.js +156 -66
  60. package/dist/tsembed.es.js +180 -69
  61. package/dist/tsembed.js +179 -68
  62. package/dist/visual-embed-sdk-react-full.d.ts +103 -7
  63. package/dist/visual-embed-sdk-react.d.ts +103 -7
  64. package/dist/visual-embed-sdk.d.ts +103 -7
  65. package/lib/package.json +1 -1
  66. package/lib/src/config.d.ts.map +1 -1
  67. package/lib/src/config.js.map +1 -1
  68. package/lib/src/embed/app.d.ts +14 -0
  69. package/lib/src/embed/app.d.ts.map +1 -1
  70. package/lib/src/embed/app.js +2 -2
  71. package/lib/src/embed/app.js.map +1 -1
  72. package/lib/src/embed/app.spec.js +10 -0
  73. package/lib/src/embed/app.spec.js.map +1 -1
  74. package/lib/src/embed/base.d.ts +4 -1
  75. package/lib/src/embed/base.d.ts.map +1 -1
  76. package/lib/src/embed/base.js +15 -7
  77. package/lib/src/embed/base.js.map +1 -1
  78. package/lib/src/embed/base.spec.js +45 -3
  79. package/lib/src/embed/base.spec.js.map +1 -1
  80. package/lib/src/embed/bodyless-conversation.d.ts +17 -0
  81. package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
  82. package/lib/src/embed/bodyless-conversation.js +14 -0
  83. package/lib/src/embed/bodyless-conversation.js.map +1 -1
  84. package/lib/src/embed/conversation.d.ts.map +1 -1
  85. package/lib/src/embed/conversation.js +1 -0
  86. package/lib/src/embed/conversation.js.map +1 -1
  87. package/lib/src/embed/liveboard.d.ts +14 -0
  88. package/lib/src/embed/liveboard.d.ts.map +1 -1
  89. package/lib/src/embed/liveboard.js +2 -2
  90. package/lib/src/embed/liveboard.js.map +1 -1
  91. package/lib/src/embed/liveboard.spec.js +11 -0
  92. package/lib/src/embed/liveboard.spec.js.map +1 -1
  93. package/lib/src/embed/sage.d.ts.map +1 -1
  94. package/lib/src/embed/sage.js +0 -1
  95. package/lib/src/embed/sage.js.map +1 -1
  96. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  97. package/lib/src/embed/ts-embed.js +13 -2
  98. package/lib/src/embed/ts-embed.js.map +1 -1
  99. package/lib/src/embed/ts-embed.spec.js +41 -1
  100. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  101. package/lib/src/react/index.spec.js +2 -2
  102. package/lib/src/react/index.spec.js.map +1 -1
  103. package/lib/src/types.d.ts +54 -6
  104. package/lib/src/types.d.ts.map +1 -1
  105. package/lib/src/types.js +15 -3
  106. package/lib/src/types.js.map +1 -1
  107. package/lib/src/visual-embed-sdk.d.ts +103 -7
  108. package/package.json +1 -1
  109. package/src/config.ts +0 -1
  110. package/src/embed/app.spec.ts +15 -0
  111. package/src/embed/app.ts +16 -1
  112. package/src/embed/base.spec.ts +48 -3
  113. package/src/embed/base.ts +21 -7
  114. package/src/embed/bodyless-conversation.ts +18 -0
  115. package/src/embed/conversation.ts +1 -0
  116. package/src/embed/liveboard.spec.ts +16 -0
  117. package/src/embed/liveboard.ts +16 -1
  118. package/src/embed/sage.ts +0 -1
  119. package/src/embed/ts-embed.spec.ts +47 -0
  120. package/src/embed/ts-embed.ts +16 -2
  121. package/src/react/index.spec.tsx +2 -2
  122. package/src/types.ts +51 -4
@@ -13,6 +13,7 @@ import {
13
13
  import {
14
14
  Action, HomeLeftNavItem, RuntimeFilter, RuntimeFilterOp, HomepageModule, HostEvent,
15
15
  RuntimeParameter,
16
+ Param,
16
17
  } from '../types';
17
18
  import {
18
19
  executeAfterWait,
@@ -24,10 +25,12 @@ import {
24
25
  defaultParamsForPinboardEmbed,
25
26
  waitFor,
26
27
  expectUrlMatchesWithParams,
28
+ expectUrlToHaveParamsWithValues,
27
29
  mockMessageChannel,
28
30
  createRootEleForEmbed,
29
31
  } from '../test/test-utils';
30
32
  import * as config from '../config';
33
+ import * as embedConfig from './embedConfig';
31
34
  import * as tsEmbedInstance from './ts-embed';
32
35
  import * as mixpanelInstance from '../mixpanel-service';
33
36
  import * as authInstance from '../auth';
@@ -1274,6 +1277,36 @@ describe('Unit test case for ts embed', () => {
1274
1277
  );
1275
1278
  });
1276
1279
 
1280
+ it('should set the additional flags correctly on the iframe src from init and view config', async () => {
1281
+ init({
1282
+ thoughtSpotHost: 'http://tshost',
1283
+ authType: AuthType.None,
1284
+ additionalFlags: {
1285
+ foo: 'bar1',
1286
+ foo2: 'bar2',
1287
+ foo3: false,
1288
+ },
1289
+ });
1290
+ const appEmbed = new AppEmbed(getRootEl(), {
1291
+ frameParams: {
1292
+ width: '100%',
1293
+ height: '100%',
1294
+ },
1295
+ additionalFlags: {
1296
+ foo: 'bar',
1297
+ baz: 1,
1298
+ bool: true,
1299
+ },
1300
+ });
1301
+ await appEmbed.render();
1302
+ console.log('val ', getIFrameSrc());
1303
+ expectUrlMatchesWithParams(
1304
+ getIFrameSrc(),
1305
+ `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
1306
+ + `&foo=bar&foo2=bar2&foo3=false&baz=1&bool=true${defaultParamsPost}#/home`,
1307
+ );
1308
+ });
1309
+
1277
1310
  it('Sets the showAlerts param', async () => {
1278
1311
  const appEmbed = new AppEmbed(getRootEl(), {
1279
1312
  frameParams: {
@@ -1407,6 +1440,20 @@ describe('Unit test case for ts embed', () => {
1407
1440
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&numberFormatLocale=en-US&dateFormatLocale=en-IN&currencyFormat=USD${defaultParamsPost}#/home`,
1408
1441
  );
1409
1442
  });
1443
+ it('Sets the overrideOrgId param', async () => {
1444
+ const overrideOrgId = 142536;
1445
+ const appEmbed = new AppEmbed(getRootEl(), {
1446
+ frameParams: {
1447
+ width: '100%',
1448
+ height: '100%',
1449
+ },
1450
+ overrideOrgId,
1451
+ });
1452
+ await appEmbed.render();
1453
+ expectUrlToHaveParamsWithValues(getIFrameSrc(), {
1454
+ orgId: overrideOrgId,
1455
+ });
1456
+ });
1410
1457
  });
1411
1458
 
1412
1459
  describe('When destroyed', () => {
@@ -7,6 +7,8 @@
7
7
  */
8
8
 
9
9
  import isEqual from 'lodash/isEqual';
10
+ import isEmpty from 'lodash/isEmpty';
11
+ import isObject from 'lodash/isObject';
10
12
  import { logger } from '../utils/logger';
11
13
  import { getAuthenticationToken } from '../authToken';
12
14
  import { AnswerService } from '../utils/graphql/answerService/answerService';
@@ -398,6 +400,7 @@ export class TsEmbed {
398
400
  if (hostAppUrl.includes('localhost') || hostAppUrl.includes('127.0.0.1')) {
399
401
  hostAppUrl = 'local-host';
400
402
  }
403
+ queryParams[Param.EmbedApp] = true;
401
404
  queryParams[Param.HostAppUrl] = encodeURIComponent(hostAppUrl);
402
405
  queryParams[Param.ViewPortHeight] = window.innerHeight;
403
406
  queryParams[Param.ViewPortWidth] = window.innerWidth;
@@ -435,15 +438,23 @@ export class TsEmbed {
435
438
  hiddenTabs,
436
439
  visibleTabs,
437
440
  showAlerts,
438
- additionalFlags,
441
+ additionalFlags: additionalFlagsFromView,
439
442
  locale,
440
443
  customizations,
441
444
  contextMenuTrigger,
442
445
  linkOverride,
443
446
  insertInToSlide,
444
447
  disableRedirectionLinksInNewTab,
448
+ overrideOrgId,
445
449
  } = this.viewConfig;
446
450
 
451
+ const { additionalFlags: additionalFlagsFromInit } = this.embedConfig;
452
+
453
+ const additionalFlags = {
454
+ ...additionalFlagsFromInit,
455
+ ...additionalFlagsFromView,
456
+ };
457
+
447
458
  if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
448
459
  this.handleError('You cannot have both hidden actions and visible actions');
449
460
  return queryParams;
@@ -503,11 +514,14 @@ export class TsEmbed {
503
514
  if (disableRedirectionLinksInNewTab) {
504
515
  queryParams[Param.DisableRedirectionLinksInNewTab] = disableRedirectionLinksInNewTab;
505
516
  }
517
+ if (overrideOrgId !== undefined) {
518
+ queryParams[Param.OverrideOrgId] = overrideOrgId;
519
+ }
506
520
 
507
521
  queryParams[Param.OverrideNativeConsole] = true;
508
522
  queryParams[Param.ClientLogLevel] = this.embedConfig.logLevel;
509
523
 
510
- if (additionalFlags && additionalFlags.constructor.name === 'Object') {
524
+ if (isObject(additionalFlags) && !isEmpty(additionalFlags)) {
511
525
  Object.assign(queryParams, additionalFlags);
512
526
  }
513
527
 
@@ -56,7 +56,7 @@ describe('React Components', () => {
56
56
  ),
57
57
  ).toBe(true);
58
58
  expect(getIFrameSrc(container)).toBe(
59
- `http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&enableDataPanelV2=false&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true&collapseSearchBarInitially=true&enableCustomColumnGroups=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_ALL#/embed/answer`,
59
+ `http://${thoughtSpotHost}/?embedApp=true&hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&enableDataPanelV2=false&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true&collapseSearchBarInitially=true&enableCustomColumnGroups=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_ALL#/embed/answer`,
60
60
  );
61
61
  });
62
62
 
@@ -230,7 +230,7 @@ describe('React Components', () => {
230
230
  ),
231
231
  ).toBe(true);
232
232
  expect(getIFrameSrc(container)).toBe(
233
- `http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&dataSources=[%22test%22]&searchTokenString=%5Brevenue%5D&executeSearch=true&useLastSelectedSources=false&isSearchEmbed=true#/embed/search-bar-embed`,
233
+ `http://${thoughtSpotHost}/?embedApp=true&hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&dataSources=[%22test%22]&searchTokenString=%5Brevenue%5D&executeSearch=true&useLastSelectedSources=false&isSearchEmbed=true#/embed/search-bar-embed`,
234
234
  );
235
235
  });
236
236
  });
package/src/types.ts CHANGED
@@ -588,6 +588,26 @@ export interface EmbedConfig {
588
588
  * @version SDK 1.32.3 | Thoughtspot: *
589
589
  */
590
590
  disableLoginFailurePage?: boolean;
591
+ /**
592
+ * This is an object (key/val) of override flags which will be applied
593
+ * to the internal embedded object. This can be used to add any
594
+ * URL flag.
595
+ * Warning: This option is for advanced use only and is used internally
596
+ * to control embed behavior in non-regular ways. We do not publish the
597
+ * list of supported keys and values associated with each.
598
+ * @example
599
+ * ```js
600
+ * const embed = new LiveboardEmbed('#embed', {
601
+ * ... // other liveboard view config
602
+ * additionalFlags: {
603
+ * flag1: 'value1',
604
+ * flag2: 'value2'
605
+ * }
606
+ * });
607
+ * ```
608
+ * @version SDK: 1.33.5 | ThoughtSpot: *
609
+ */
610
+ additionalFlags?: { [key: string]: string | number | boolean };
591
611
  }
592
612
 
593
613
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -779,6 +799,7 @@ export interface ViewConfig {
779
799
  * This is an object (key/val) of override flags which will be applied
780
800
  * to the internal embedded object. This can be used to add any
781
801
  * URL flag.
802
+ * If the same flags are passed in init, they will be overriden by the values here.
782
803
  * Warning: This option is for advanced use only and is used internally
783
804
  * to control embed behavior in non-regular ways. We do not publish the
784
805
  * list of supported keys and values associated with each.
@@ -1066,6 +1087,19 @@ export interface ViewConfig {
1066
1087
  * ```
1067
1088
  */
1068
1089
  enableCustomColumnGroups?: boolean;
1090
+ /**
1091
+ * View content for another org directly without having to use the org switcher
1092
+ * This flag is honoured if orgPerUrl feature is enabled for the ThoughtSpot cluster
1093
+ * @example
1094
+ * ```js
1095
+ * const embed = new LiveboardEmbed('#embed', {
1096
+ * ... // other options
1097
+ * overrideOrgId: 142536
1098
+ * });
1099
+ * ```
1100
+ * @version SDK: 1.35.0 | ThoughtSpot: 10.5.0.cl
1101
+ */
1102
+ overrideOrgId?: number;
1069
1103
  }
1070
1104
 
1071
1105
  /**
@@ -1121,7 +1155,7 @@ export type MessageCallbackObj = {
1121
1155
  export type GenericCallbackFn = (...args: any[]) => any;
1122
1156
 
1123
1157
  export type QueryParams = {
1124
- [key: string]: string;
1158
+ [key: string]: string | boolean | number;
1125
1159
  };
1126
1160
 
1127
1161
  /**
@@ -2965,12 +2999,13 @@ export enum HostEvent {
2965
2999
  * see link:https://developers.thoughtspot.com/docs/runtime-filters#rtOperator[Developer Documentation].
2966
3000
  *
2967
3001
  * `values` - An array of one or several values. The value definition on the
2968
- * data type you choose to filter on. For a complete list of supported data types, see
2969
- * link:https://developers.thoughtspot.com/docs/runtime-filters#_supported_data_types[Supported data types].
3002
+ * data type you choose to filter on. For a complete list of supported data types,
3003
+ * see
3004
+ * link:https://developers.thoughtspot.com/docs/runtime-filters#_supported_data_types[Supported
3005
+ * data types].
2970
3006
  *
2971
3007
  * `type` - To update filters for date time, specify the date format type.
2972
3008
  * For more information and examples, see link:https://developers.thoughtspot.com/docs/embed-liveboard#_date_filters[Date filters].
2973
- *
2974
3009
  * @example
2975
3010
  * ```js
2976
3011
  *
@@ -3260,8 +3295,10 @@ export enum Param {
3260
3295
  ShowLiveboardVerifiedBadge = 'showLiveboardVerifiedBadge',
3261
3296
  ShowLiveboardReverifyBanner = 'showLiveboardReverifyBanner',
3262
3297
  LiveboardHeaderV2 = 'isLiveboardHeaderV2Enabled',
3298
+ HideIrrelevantFiltersInTab = 'hideIrrelevantFiltersAtTabLevel',
3263
3299
  SpotterEnabled = 'isSpotterExperienceEnabled',
3264
3300
  IsUnifiedSearchExperienceEnabled = 'isUnifiedSearchExperienceEnabled',
3301
+ OverrideOrgId = 'orgId',
3265
3302
  }
3266
3303
 
3267
3304
  /**
@@ -4320,6 +4357,16 @@ export enum Action {
4320
4357
  * @version SDK: 1.35.0 | Thoughtspot: 10.5.0.cl
4321
4358
  */
4322
4359
  DisableChipReorder = 'disableChipReorder',
4360
+
4361
+ /**
4362
+ * Action ID for Hide Irrelevant filters button
4363
+ * @example
4364
+ * ```js
4365
+ * hiddenAction: [Action.ChangeFilterVisibilityInTab]
4366
+ * ```
4367
+ * @version SDK: 1.35.0 | Thoughtspot: 10.5.0.cl
4368
+ */
4369
+ ChangeFilterVisibilityInTab = 'changeFilterVisibilityInTab',
4323
4370
  }
4324
4371
 
4325
4372
  export interface AnswerServiceType {