@thoughtspot/visual-embed-sdk 1.12.0-alpha.1 → 1.13.0-alpha.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 (85) hide show
  1. package/CHANGELOG.md +22 -4
  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/liveboard.d.ts +7 -1
  6. package/dist/src/embed/search.d.ts +1 -0
  7. package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts +1 -0
  8. package/dist/src/embed/ts-embed.d.ts +2 -1
  9. package/dist/src/errors.d.ts +2 -0
  10. package/dist/src/types.d.ts +19 -2
  11. package/dist/src/utils.d.ts +1 -0
  12. package/dist/tsembed.es.js +60 -6
  13. package/dist/tsembed.js +60 -6
  14. package/lib/package.json +4 -2
  15. package/lib/src/auth.d.ts +4 -1
  16. package/lib/src/auth.js +10 -2
  17. package/lib/src/auth.js.map +1 -1
  18. package/lib/src/auth.spec.d.ts +1 -0
  19. package/lib/src/auth.spec.js +4 -1
  20. package/lib/src/auth.spec.js.map +1 -1
  21. package/lib/src/embed/app.spec.js +4 -3
  22. package/lib/src/embed/app.spec.js.map +1 -1
  23. package/lib/src/embed/embed.spec.js +2 -0
  24. package/lib/src/embed/embed.spec.js.map +1 -1
  25. package/lib/src/embed/events.spec.js +1 -0
  26. package/lib/src/embed/events.spec.js.map +1 -1
  27. package/lib/src/embed/liveboard.d.ts +7 -1
  28. package/lib/src/embed/liveboard.js +12 -0
  29. package/lib/src/embed/liveboard.js.map +1 -1
  30. package/lib/src/embed/liveboard.spec.js +18 -4
  31. package/lib/src/embed/liveboard.spec.js.map +1 -1
  32. package/lib/src/embed/pinboard.spec.js +4 -3
  33. package/lib/src/embed/pinboard.spec.js.map +1 -1
  34. package/lib/src/embed/search.d.ts +1 -0
  35. package/lib/src/embed/search.js +9 -1
  36. package/lib/src/embed/search.js.map +1 -1
  37. package/lib/src/embed/search.spec.js +9 -1
  38. package/lib/src/embed/search.spec.js.map +1 -1
  39. package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts +1 -0
  40. package/lib/src/embed/searchEmbed-basic-auth.spec.js +90 -0
  41. package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -0
  42. package/lib/src/embed/ts-embed.d.ts +2 -1
  43. package/lib/src/embed/ts-embed.js +7 -5
  44. package/lib/src/embed/ts-embed.js.map +1 -1
  45. package/lib/src/embed/ts-embed.spec.js +12 -5
  46. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  47. package/lib/src/errors.d.ts +2 -0
  48. package/lib/src/errors.js +2 -0
  49. package/lib/src/errors.js.map +1 -1
  50. package/lib/src/react/index.js +3 -2
  51. package/lib/src/react/index.js.map +1 -1
  52. package/lib/src/react/index.spec.js +3 -2
  53. package/lib/src/react/index.spec.js.map +1 -1
  54. package/lib/src/types.d.ts +19 -2
  55. package/lib/src/types.js +11 -0
  56. package/lib/src/types.js.map +1 -1
  57. package/lib/src/utils/processTrigger.js +7 -0
  58. package/lib/src/utils/processTrigger.js.map +1 -1
  59. package/lib/src/utils.d.ts +1 -0
  60. package/lib/src/utils.js +8 -0
  61. package/lib/src/utils.js.map +1 -1
  62. package/lib/src/utils.spec.js +16 -1
  63. package/lib/src/utils.spec.js.map +1 -1
  64. package/lib/src/visual-embed-sdk.d.ts +32 -5
  65. package/package.json +4 -2
  66. package/src/auth.spec.ts +10 -1
  67. package/src/auth.ts +11 -2
  68. package/src/embed/app.spec.ts +4 -3
  69. package/src/embed/embed.spec.ts +2 -0
  70. package/src/embed/events.spec.ts +1 -0
  71. package/src/embed/liveboard.spec.ts +27 -4
  72. package/src/embed/liveboard.ts +13 -0
  73. package/src/embed/pinboard.spec.ts +4 -3
  74. package/src/embed/search.spec.ts +11 -1
  75. package/src/embed/search.ts +15 -1
  76. package/src/embed/searchEmbed-basic-auth.spec.ts +110 -0
  77. package/src/embed/ts-embed.spec.ts +19 -5
  78. package/src/embed/ts-embed.ts +8 -5
  79. package/src/errors.ts +3 -0
  80. package/src/react/index.spec.tsx +4 -2
  81. package/src/react/index.tsx +3 -2
  82. package/src/types.ts +17 -0
  83. package/src/utils/processTrigger.ts +9 -0
  84. package/src/utils.spec.ts +21 -0
  85. package/src/utils.ts +13 -0
package/CHANGELOG.md CHANGED
@@ -6,7 +6,25 @@ This project follows Semantic Versioning.
6
6
  ## Unreleased
7
7
 
8
8
  ### New Features
9
- - Events for all actions on Search Embed
9
+ - Event for navigating to a specific page in App embed without any reload
10
+ - Ability to turn on search assist in Search embed
11
+ - Set of new Host events to drive interactions on the embed programatically
12
+
13
+ ## 1.12.0 (06-21-2022)
14
+ - Release to support TS version 8.4.0.cl
15
+ - Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=embed-sdk-changelog)
16
+
17
+ ## 1.11.2 (06-10-2022)
18
+ ### Fixed
19
+ - Typescript build that was affecting some Angular project configurations
20
+
21
+ ## 1.11.1 (05-30-2022)
22
+ ### Fixed
23
+ - Whitelabeling - new [action](https://developers.thoughtspot.com/docs/typedoc/enums/Action.html#ReportError) for the ability to turn off TS specific error reporting by end users.
24
+
25
+ ## 1.11.0 (05-20-2022)
26
+ - Release to support TS version 8.3.0.cl
27
+ - Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=embed-sdk-changelog)
10
28
 
11
29
  ## 1.10.4 (05-06-2022)
12
30
  ### New Features
@@ -32,7 +50,7 @@ This project follows Semantic Versioning.
32
50
  ## 1.10.0 (04-22-2022)
33
51
 
34
52
  - Release to support TS version 8.2.0.cl
35
- - Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=whats-new)
53
+ - Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=embed-sdk-changelog)
36
54
 
37
55
  ## 1.9.5 (04-06-2022)
38
56
 
@@ -73,7 +91,7 @@ This project follows Semantic Versioning.
73
91
  ## 1.9.0
74
92
 
75
93
  - Release to support TS version 8.1.0.cl
76
- - Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=whats-new)
94
+ - Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=embed-sdk-changelog)
77
95
 
78
96
 
79
97
  ## 1.8.1
@@ -94,4 +112,4 @@ This project follows Semantic Versioning.
94
112
 
95
113
  ## 1.7.0 (and earlier)
96
114
 
97
- - Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=whats-new)
115
+ - Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=embed-sdk-changelog)
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  <br/>
6
6
 
7
- # ThoughtSpot Visual Embed SDK <br/> [![Coverage Status](https://coveralls.io/repos/github/ts-blink/embed-sdk/badge.svg?branch=main)](https://coveralls.io/github/ts-blink/embed-sdk?branch=main) ![npm (scoped with tag)](https://img.shields.io/npm/v/@thoughtspot/visual-embed-sdk) [![](https://data.jsdelivr.com/v1/package/npm/@thoughtspot/visual-embed-sdk/badge?style=rounded)](https://www.jsdelivr.com/package/npm/@thoughtspot/visual-embed-sdk) ![npm](https://img.shields.io/npm/dm/@thoughtspot/visual-embed-sdk?label=npm%20downloads&style=flat-square) [![Featured on Openbase](https://badges.openbase.com/js/featured/@thoughtspot/visual-embed-sdk.svg?token=IoqZUwE8aX7LYNedeuBLM2w5Wt52hu+Dh0eyKjlpC0E=)](https://openbase.com/js/@thoughtspot/visual-embed-sdk?utm_source=embedded&amp;utm_medium=badge&amp;utm_campaign=rate-badge)
7
+ # ThoughtSpot Visual Embed SDK <br/> [![Coverage Status](https://coveralls.io/repos/github/ts-blink/embed-sdk/badge.svg?branch=main)](https://coveralls.io/github/ts-blink/embed-sdk?branch=main) ![npm (scoped with tag)](https://img.shields.io/npm/v/@thoughtspot/visual-embed-sdk) [![](https://data.jsdelivr.com/v1/package/npm/@thoughtspot/visual-embed-sdk/badge?style=rounded)](https://www.jsdelivr.com/package/npm/@thoughtspot/visual-embed-sdk) ![npm](https://img.shields.io/npm/dm/@thoughtspot/visual-embed-sdk?label=npm%20downloads&style=flat-square) [![Featured on Openbase](https://badges.openbase.com/js/featured/@thoughtspot/visual-embed-sdk.svg?token=IoqZUwE8aX7LYNedeuBLM2w5Wt52hu+Dh0eyKjlpC0E=)](https://openbase.com/js/@thoughtspot/visual-embed-sdk?utm_source=embedded&amp;utm_medium=badge&amp;utm_campaign=rate-badge) ![npm bundle size (scoped)](https://img.shields.io/bundlephobia/minzip/@thoughtspot/visual-embed-sdk?style=flat-square)
8
8
 
9
9
 
10
10
  SDK to embed ThoughtSpot into your web apps.
@@ -2,7 +2,6 @@ import { EmbedConfig } from './types';
2
2
  export declare let loggedInStatus: boolean;
3
3
  export declare let samlAuthWindow: Window;
4
4
  export declare let samlCompletionPromise: Promise<void>;
5
- export declare let sessionInfo: any;
6
5
  export declare const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-24226bf3ce5b";
7
6
  export declare const EndPoints: {
8
7
  AUTH_VERIFICATION: string;
@@ -23,6 +22,10 @@ export declare enum AuthStatus {
23
22
  SUCCESS = "SUCCESS",
24
23
  LOGOUT = "LOGOUT"
25
24
  }
25
+ /**
26
+ * Return releaseVersion if available
27
+ */
28
+ export declare function getReleaseVersion(): string;
26
29
  /**
27
30
  * Return sessionInfo if available else make a loggedIn check to fetch the sessionInfo
28
31
  */
@@ -1,3 +1,4 @@
1
+ export declare const embedConfig: any;
1
2
  export declare const mockSessionInfo: {
2
3
  sessionId: string;
3
4
  genNo: number;
@@ -8,7 +8,7 @@
8
8
  * @summary Liveboard & visualization embed
9
9
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
10
10
  */
11
- import { DOMSelector } from '../types';
11
+ import { DOMSelector, HostEvent } from '../types';
12
12
  import { V1Embed, ViewConfig } from './ts-embed';
13
13
  /**
14
14
  * The configuration for the embedded Liveboard or visualization page view.
@@ -102,6 +102,12 @@ export declare class LiveboardEmbed extends V1Embed {
102
102
  private updateIFrameHeight;
103
103
  private embedIframeCenter;
104
104
  private setIframeHeightForNonEmbedLiveboard;
105
+ /**
106
+ * Triggers an event to the embedded app
107
+ * @param messageType The event type
108
+ * @param data The payload to send with the message
109
+ */
110
+ trigger(messageType: HostEvent, data?: any): Promise<any>;
105
111
  /**
106
112
  * Render an embedded ThoughtSpot Liveboard or visualization
107
113
  * @param renderOptions An object specifying the Liveboard ID,
@@ -46,6 +46,7 @@ export interface SearchViewConfig extends ViewConfig {
46
46
  hideResults?: boolean;
47
47
  /**
48
48
  * If set to true, the Search Assist feature is enabled.
49
+ * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
49
50
  */
50
51
  enableSearchAssist?: boolean;
51
52
  /**
@@ -0,0 +1 @@
1
+ export {};
@@ -29,7 +29,7 @@ export interface FrameParams {
29
29
  * This parameters will be passed on the iframe
30
30
  * as is.
31
31
  */
32
- [key: string]: string | number | boolean;
32
+ [key: string]: string | number | boolean | undefined;
33
33
  }
34
34
  /**
35
35
  * The configuration object for an embedded view.
@@ -142,6 +142,7 @@ export declare class TsEmbed {
142
142
  * @default false
143
143
  */
144
144
  private shouldEncodeUrlQueryParams;
145
+ private defaultHiddenActions;
145
146
  constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
146
147
  /**
147
148
  * Gets a reference to the root DOM node where
@@ -1,4 +1,6 @@
1
1
  export declare const ERROR_MESSAGE: {
2
2
  INVALID_THOUGHTSPOT_HOST: string;
3
3
  LIVEBOARD_VIZ_ID_VALIDATION: string;
4
+ TRIGGER_TIMED_OUT: string;
5
+ SEARCHEMBED_BETA_WRANING_MESSAGE: string;
4
6
  };
@@ -161,6 +161,12 @@ export interface EmbedConfig {
161
161
  * @version SDK: 1.10.4 | ThoughtSpot: *
162
162
  */
163
163
  detectCookieAccessSlow?: boolean;
164
+ /**
165
+ * Hide beta alert warning message for SearchEmbed.
166
+ *
167
+ * @version SDK: 1.12.0 | ThoughtSpot: *
168
+ */
169
+ suppressSearchEmbedBetaWarning?: boolean;
164
170
  }
165
171
  /**
166
172
  * MessagePayload: Embed event payload: message type, data and status (start/end)
@@ -575,7 +581,14 @@ export declare enum HostEvent {
575
581
  * Gets the current pinboard content.
576
582
  * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
577
583
  */
578
- getExportRequestForCurrentPinboard = "getExportRequestForCurrentPinboard"
584
+ getExportRequestForCurrentPinboard = "getExportRequestForCurrentPinboard",
585
+ /**
586
+ * Fires the pin action on an embedded object
587
+ * @param - incase of liveboard embed, takes in an object with vizId as a key
588
+ * can be left empty for search and viz embeds
589
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
590
+ */
591
+ Pin = "pin"
579
592
  }
580
593
  /**
581
594
  * The different visual modes that the data sources panel within
@@ -769,7 +782,11 @@ export declare enum Action {
769
782
  /**
770
783
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
771
784
  */
772
- CreateMonitor = "createMonitor"
785
+ CreateMonitor = "createMonitor",
786
+ /**
787
+ * @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl
788
+ */
789
+ ReportError = "reportError"
773
790
  }
774
791
  export interface SessionInterface {
775
792
  sessionId: string;
@@ -42,3 +42,4 @@ export declare const embedEventStatus: {
42
42
  export declare const setAttributes: (element: HTMLElement, attributes: {
43
43
  [key: string]: string | number | boolean;
44
44
  }) => void;
45
+ export declare const checkReleaseVersionInBeta: (releaseVersion: string, suppressBetaWarning: boolean) => boolean;
@@ -121,6 +121,14 @@ const setAttributes = (element, attributes) => {
121
121
  Object.keys(attributes).forEach((key) => {
122
122
  element.setAttribute(key, attributes[key].toString());
123
123
  });
124
+ };
125
+ /* For Search Embed: ReleaseVersionInBeta */
126
+ const checkReleaseVersionInBeta = (releaseVersion, suppressBetaWarning) => {
127
+ const splittedReleaseVersion = releaseVersion.split('.'); // splitting releasonversion
128
+ const majorVersion = Number(splittedReleaseVersion[0]);
129
+ const minorVersion = Number(splittedReleaseVersion[1]);
130
+ const isBetaVersion = majorVersion < 8 || (majorVersion === 8 && minorVersion < 4);
131
+ return !suppressBetaWarning && isBetaVersion;
124
132
  };
125
133
 
126
134
  /**
@@ -534,6 +542,13 @@ var HostEvent;
534
542
  * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
535
543
  */
536
544
  HostEvent["getExportRequestForCurrentPinboard"] = "getExportRequestForCurrentPinboard";
545
+ /**
546
+ * Fires the pin action on an embedded object
547
+ * @param - incase of liveboard embed, takes in an object with vizId as a key
548
+ * can be left empty for search and viz embeds
549
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
550
+ */
551
+ HostEvent["Pin"] = "pin";
537
552
  })(HostEvent || (HostEvent = {}));
538
553
  /**
539
554
  * The different visual modes that the data sources panel within
@@ -734,6 +749,10 @@ var Action;
734
749
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
735
750
  */
736
751
  Action["CreateMonitor"] = "createMonitor";
752
+ /**
753
+ * @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl
754
+ */
755
+ Action["ReportError"] = "reportError";
737
756
  })(Action || (Action = {}));
738
757
  // eslint-disable-next-line no-shadow
739
758
  var OperationType;
@@ -745,6 +764,8 @@ var OperationType;
745
764
  const ERROR_MESSAGE = {
746
765
  INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
747
766
  LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
767
+ TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
768
+ SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
748
769
  };
749
770
 
750
771
  /**
@@ -7232,8 +7253,8 @@ let loggedInStatus = false;
7232
7253
  let samlAuthWindow = null;
7233
7254
  // eslint-disable-next-line import/no-mutable-exports
7234
7255
  let samlCompletionPromise = null;
7235
- // eslint-disable-next-line import/no-mutable-exports
7236
7256
  let sessionInfo = null;
7257
+ let releaseVersion = '';
7237
7258
  const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
7238
7259
  const EndPoints = {
7239
7260
  AUTH_VERIFICATION: '/callosum/v1/session/info',
@@ -7265,12 +7286,20 @@ async function isLoggedIn(thoughtSpotHost) {
7265
7286
  let response = null;
7266
7287
  try {
7267
7288
  response = await fetchSessionInfoService(authVerificationUrl);
7289
+ const sessionInfoResp = await response.json();
7290
+ releaseVersion = sessionInfoResp.releaseVersion;
7268
7291
  }
7269
7292
  catch (e) {
7270
7293
  return false;
7271
7294
  }
7272
7295
  return response.status === 200;
7273
7296
  }
7297
+ /**
7298
+ * Return releaseVersion if available
7299
+ */
7300
+ function getReleaseVersion() {
7301
+ return releaseVersion;
7302
+ }
7274
7303
  function initSession(sessionDetails) {
7275
7304
  sessionInfo = sessionDetails;
7276
7305
  initMixpanel(sessionInfo);
@@ -7736,6 +7765,7 @@ function postIframeMessage(iFrame, message, thoughtSpotHost, channel) {
7736
7765
  channel === null || channel === void 0 ? void 0 : channel.port2,
7737
7766
  ]);
7738
7767
  }
7768
+ const TRIGGER_TIMEOUT = 30000;
7739
7769
  function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
7740
7770
  return new Promise((res, rej) => {
7741
7771
  if (messageType === HostEvent.Reload) {
@@ -7752,11 +7782,16 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
7752
7782
  res(responseData);
7753
7783
  }
7754
7784
  };
7785
+ // Close the messageChannel and resolve the promise if timeout.
7786
+ setTimeout(() => {
7787
+ channel.port1.close();
7788
+ res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
7789
+ }, TRIGGER_TIMEOUT);
7755
7790
  return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
7756
7791
  });
7757
7792
  }
7758
7793
 
7759
- var name="@thoughtspot/visual-embed-sdk";var version="1.12.0-alpha.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",eventemitter3:"^4.0.7","mixpanel-browser":"^2.45.0"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
7794
+ var name="@thoughtspot/visual-embed-sdk";var version="1.13.0-alpha.0";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",eventemitter3:"^4.0.7","html-react-parser":"^1.4.12","mixpanel-browser":"^2.45.0","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
7760
7795
 
7761
7796
  /**
7762
7797
  * Copyright (c) 2022
@@ -7794,6 +7829,7 @@ class TsEmbed {
7794
7829
  * @default false
7795
7830
  */
7796
7831
  this.shouldEncodeUrlQueryParams = false;
7832
+ this.defaultHiddenActions = [Action.ReportError];
7797
7833
  this.el = this.getDOMNode(domSelector);
7798
7834
  // TODO: handle error
7799
7835
  this.embedConfig = getEmbedConfig();
@@ -7830,7 +7866,7 @@ class TsEmbed {
7830
7866
  error,
7831
7867
  });
7832
7868
  // Log error
7833
- console.log(error);
7869
+ console.error(error);
7834
7870
  }
7835
7871
  /**
7836
7872
  * Extracts the type field from the event payload
@@ -7936,9 +7972,10 @@ class TsEmbed {
7936
7972
  if (disabledActionReason) {
7937
7973
  queryParams[Param.DisableActionReason] = disabledActionReason;
7938
7974
  }
7939
- if (hiddenActions === null || hiddenActions === void 0 ? void 0 : hiddenActions.length) {
7940
- queryParams[Param.HideActions] = hiddenActions;
7941
- }
7975
+ queryParams[Param.HideActions] = [
7976
+ ...this.defaultHiddenActions,
7977
+ ...(hiddenActions !== null && hiddenActions !== void 0 ? hiddenActions : []),
7978
+ ];
7942
7979
  if (Array.isArray(visibleActions)) {
7943
7980
  queryParams[Param.VisibleActions] = visibleActions;
7944
7981
  }
@@ -8499,6 +8536,18 @@ class LiveboardEmbed extends V1Embed {
8499
8536
  url = `${url}${tsPostHashParams}`;
8500
8537
  return url;
8501
8538
  }
8539
+ /**
8540
+ * Triggers an event to the embedded app
8541
+ * @param messageType The event type
8542
+ * @param data The payload to send with the message
8543
+ */
8544
+ trigger(messageType, data = {}) {
8545
+ const dataWithVizId = data;
8546
+ if (this.viewConfig.vizId) {
8547
+ dataWithVizId.vizId = this.viewConfig.vizId;
8548
+ }
8549
+ return super.trigger(messageType, dataWithVizId);
8550
+ }
8502
8551
  /**
8503
8552
  * Render an embedded ThoughtSpot Liveboard or visualization
8504
8553
  * @param renderOptions An object specifying the Liveboard ID,
@@ -8619,6 +8668,11 @@ class SearchEmbed extends TsEmbed {
8619
8668
  const { answerId, dataSources } = this.viewConfig;
8620
8669
  const src = this.getIFrameSrc(answerId, dataSources);
8621
8670
  this.renderIFrame(src, this.viewConfig.frameParams);
8671
+ getAuthPromise().then(() => {
8672
+ if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
8673
+ alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
8674
+ }
8675
+ });
8622
8676
  return this;
8623
8677
  }
8624
8678
  }
package/dist/tsembed.js CHANGED
@@ -127,6 +127,14 @@
127
127
  Object.keys(attributes).forEach((key) => {
128
128
  element.setAttribute(key, attributes[key].toString());
129
129
  });
130
+ };
131
+ /* For Search Embed: ReleaseVersionInBeta */
132
+ const checkReleaseVersionInBeta = (releaseVersion, suppressBetaWarning) => {
133
+ const splittedReleaseVersion = releaseVersion.split('.'); // splitting releasonversion
134
+ const majorVersion = Number(splittedReleaseVersion[0]);
135
+ const minorVersion = Number(splittedReleaseVersion[1]);
136
+ const isBetaVersion = majorVersion < 8 || (majorVersion === 8 && minorVersion < 4);
137
+ return !suppressBetaWarning && isBetaVersion;
130
138
  };
131
139
 
132
140
  /**
@@ -515,6 +523,13 @@
515
523
  * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
516
524
  */
517
525
  HostEvent["getExportRequestForCurrentPinboard"] = "getExportRequestForCurrentPinboard";
526
+ /**
527
+ * Fires the pin action on an embedded object
528
+ * @param - incase of liveboard embed, takes in an object with vizId as a key
529
+ * can be left empty for search and viz embeds
530
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
531
+ */
532
+ HostEvent["Pin"] = "pin";
518
533
  })(exports.HostEvent || (exports.HostEvent = {}));
519
534
  (function (DataSourceVisualMode) {
520
535
  /**
@@ -703,6 +718,10 @@
703
718
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
704
719
  */
705
720
  Action["CreateMonitor"] = "createMonitor";
721
+ /**
722
+ * @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl
723
+ */
724
+ Action["ReportError"] = "reportError";
706
725
  })(exports.Action || (exports.Action = {}));
707
726
  // eslint-disable-next-line no-shadow
708
727
  var OperationType;
@@ -714,6 +733,8 @@
714
733
  const ERROR_MESSAGE = {
715
734
  INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
716
735
  LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
736
+ TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
737
+ SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
717
738
  };
718
739
 
719
740
  /**
@@ -7201,8 +7222,8 @@
7201
7222
  let samlAuthWindow = null;
7202
7223
  // eslint-disable-next-line import/no-mutable-exports
7203
7224
  let samlCompletionPromise = null;
7204
- // eslint-disable-next-line import/no-mutable-exports
7205
7225
  let sessionInfo = null;
7226
+ let releaseVersion = '';
7206
7227
  const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
7207
7228
  const EndPoints = {
7208
7229
  AUTH_VERIFICATION: '/callosum/v1/session/info',
@@ -7232,12 +7253,20 @@
7232
7253
  let response = null;
7233
7254
  try {
7234
7255
  response = await fetchSessionInfoService(authVerificationUrl);
7256
+ const sessionInfoResp = await response.json();
7257
+ releaseVersion = sessionInfoResp.releaseVersion;
7235
7258
  }
7236
7259
  catch (e) {
7237
7260
  return false;
7238
7261
  }
7239
7262
  return response.status === 200;
7240
7263
  }
7264
+ /**
7265
+ * Return releaseVersion if available
7266
+ */
7267
+ function getReleaseVersion() {
7268
+ return releaseVersion;
7269
+ }
7241
7270
  function initSession(sessionDetails) {
7242
7271
  sessionInfo = sessionDetails;
7243
7272
  initMixpanel(sessionInfo);
@@ -7703,6 +7732,7 @@
7703
7732
  channel === null || channel === void 0 ? void 0 : channel.port2,
7704
7733
  ]);
7705
7734
  }
7735
+ const TRIGGER_TIMEOUT = 30000;
7706
7736
  function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
7707
7737
  return new Promise((res, rej) => {
7708
7738
  if (messageType === exports.HostEvent.Reload) {
@@ -7719,11 +7749,16 @@
7719
7749
  res(responseData);
7720
7750
  }
7721
7751
  };
7752
+ // Close the messageChannel and resolve the promise if timeout.
7753
+ setTimeout(() => {
7754
+ channel.port1.close();
7755
+ res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
7756
+ }, TRIGGER_TIMEOUT);
7722
7757
  return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
7723
7758
  });
7724
7759
  }
7725
7760
 
7726
- var name="@thoughtspot/visual-embed-sdk";var version="1.12.0-alpha.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports$1={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",eventemitter3:"^4.0.7","mixpanel-browser":"^2.45.0"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
7761
+ var name="@thoughtspot/visual-embed-sdk";var version="1.13.0-alpha.0";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports$1={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",eventemitter3:"^4.0.7","html-react-parser":"^1.4.12","mixpanel-browser":"^2.45.0","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
7727
7762
 
7728
7763
  /**
7729
7764
  * Copyright (c) 2022
@@ -7761,6 +7796,7 @@
7761
7796
  * @default false
7762
7797
  */
7763
7798
  this.shouldEncodeUrlQueryParams = false;
7799
+ this.defaultHiddenActions = [exports.Action.ReportError];
7764
7800
  this.el = this.getDOMNode(domSelector);
7765
7801
  // TODO: handle error
7766
7802
  this.embedConfig = getEmbedConfig();
@@ -7797,7 +7833,7 @@
7797
7833
  error,
7798
7834
  });
7799
7835
  // Log error
7800
- console.log(error);
7836
+ console.error(error);
7801
7837
  }
7802
7838
  /**
7803
7839
  * Extracts the type field from the event payload
@@ -7903,9 +7939,10 @@
7903
7939
  if (disabledActionReason) {
7904
7940
  queryParams[Param.DisableActionReason] = disabledActionReason;
7905
7941
  }
7906
- if (hiddenActions === null || hiddenActions === void 0 ? void 0 : hiddenActions.length) {
7907
- queryParams[Param.HideActions] = hiddenActions;
7908
- }
7942
+ queryParams[Param.HideActions] = [
7943
+ ...this.defaultHiddenActions,
7944
+ ...(hiddenActions !== null && hiddenActions !== void 0 ? hiddenActions : []),
7945
+ ];
7909
7946
  if (Array.isArray(visibleActions)) {
7910
7947
  queryParams[Param.VisibleActions] = visibleActions;
7911
7948
  }
@@ -8461,6 +8498,18 @@
8461
8498
  url = `${url}${tsPostHashParams}`;
8462
8499
  return url;
8463
8500
  }
8501
+ /**
8502
+ * Triggers an event to the embedded app
8503
+ * @param messageType The event type
8504
+ * @param data The payload to send with the message
8505
+ */
8506
+ trigger(messageType, data = {}) {
8507
+ const dataWithVizId = data;
8508
+ if (this.viewConfig.vizId) {
8509
+ dataWithVizId.vizId = this.viewConfig.vizId;
8510
+ }
8511
+ return super.trigger(messageType, dataWithVizId);
8512
+ }
8464
8513
  /**
8465
8514
  * Render an embedded ThoughtSpot Liveboard or visualization
8466
8515
  * @param renderOptions An object specifying the Liveboard ID,
@@ -8581,6 +8630,11 @@
8581
8630
  const { answerId, dataSources } = this.viewConfig;
8582
8631
  const src = this.getIFrameSrc(answerId, dataSources);
8583
8632
  this.renderIFrame(src, this.viewConfig.frameParams);
8633
+ getAuthPromise().then(() => {
8634
+ if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
8635
+ alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
8636
+ }
8637
+ });
8584
8638
  return this;
8585
8639
  }
8586
8640
  }
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.12.0-alpha.1",
3
+ "version": "1.13.0-alpha.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/lib/src/auth.d.ts CHANGED
@@ -2,7 +2,6 @@ import { EmbedConfig } from './types';
2
2
  export declare let loggedInStatus: boolean;
3
3
  export declare let samlAuthWindow: Window;
4
4
  export declare let samlCompletionPromise: Promise<void>;
5
- export declare let sessionInfo: any;
6
5
  export declare const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-24226bf3ce5b";
7
6
  export declare const EndPoints: {
8
7
  AUTH_VERIFICATION: string;
@@ -23,6 +22,10 @@ export declare enum AuthStatus {
23
22
  SUCCESS = "SUCCESS",
24
23
  LOGOUT = "LOGOUT"
25
24
  }
25
+ /**
26
+ * Return releaseVersion if available
27
+ */
28
+ export declare function getReleaseVersion(): string;
26
29
  /**
27
30
  * Return sessionInfo if available else make a loggedIn check to fetch the sessionInfo
28
31
  */
package/lib/src/auth.js CHANGED
@@ -9,8 +9,8 @@ export let loggedInStatus = false;
9
9
  export let samlAuthWindow = null;
10
10
  // eslint-disable-next-line import/no-mutable-exports
11
11
  export let samlCompletionPromise = null;
12
- // eslint-disable-next-line import/no-mutable-exports
13
- export let sessionInfo = null;
12
+ let sessionInfo = null;
13
+ let releaseVersion = '';
14
14
  export const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
15
15
  export const EndPoints = {
16
16
  AUTH_VERIFICATION: '/callosum/v1/session/info',
@@ -42,12 +42,20 @@ async function isLoggedIn(thoughtSpotHost) {
42
42
  let response = null;
43
43
  try {
44
44
  response = await fetchSessionInfoService(authVerificationUrl);
45
+ const sessionInfoResp = await response.json();
46
+ releaseVersion = sessionInfoResp.releaseVersion;
45
47
  }
46
48
  catch (e) {
47
49
  return false;
48
50
  }
49
51
  return response.status === 200;
50
52
  }
53
+ /**
54
+ * Return releaseVersion if available
55
+ */
56
+ export function getReleaseVersion() {
57
+ return releaseVersion;
58
+ }
51
59
  /**
52
60
  * Return sessionInfo if available else make a loggedIn check to fetch the sessionInfo
53
61
  */