@thoughtspot/visual-embed-sdk 1.11.0-auth.12 → 1.11.0-auth.17

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 (42) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/src/embed/base.d.ts +17 -1
  3. package/dist/src/types.d.ts +14 -0
  4. package/dist/src/utils.d.ts +1 -0
  5. package/dist/tsembed.es.js +52 -14
  6. package/dist/tsembed.js +52 -14
  7. package/lib/package.json +1 -1
  8. package/lib/src/auth.js +3 -4
  9. package/lib/src/auth.js.map +1 -1
  10. package/lib/src/embed/base.d.ts +17 -1
  11. package/lib/src/embed/base.js +32 -9
  12. package/lib/src/embed/base.js.map +1 -1
  13. package/lib/src/embed/base.spec.js +15 -2
  14. package/lib/src/embed/base.spec.js.map +1 -1
  15. package/lib/src/types.d.ts +14 -0
  16. package/lib/src/types.js +5 -0
  17. package/lib/src/types.js.map +1 -1
  18. package/lib/src/utils/authService.js +4 -1
  19. package/lib/src/utils/authService.js.map +1 -1
  20. package/lib/src/utils/authService.spec.js +10 -0
  21. package/lib/src/utils/authService.spec.js.map +1 -1
  22. package/lib/src/utils/processData.js +11 -1
  23. package/lib/src/utils/processData.js.map +1 -1
  24. package/lib/src/utils/processData.spec.js +21 -0
  25. package/lib/src/utils/processData.spec.js.map +1 -1
  26. package/lib/src/utils.d.ts +1 -0
  27. package/lib/src/utils.js +4 -0
  28. package/lib/src/utils.js.map +1 -1
  29. package/lib/src/utils.spec.js +14 -1
  30. package/lib/src/utils.spec.js.map +1 -1
  31. package/lib/src/visual-embed-sdk.d.ts +31 -1
  32. package/package.json +1 -1
  33. package/src/auth.ts +11 -4
  34. package/src/embed/base.spec.ts +16 -2
  35. package/src/embed/base.ts +34 -9
  36. package/src/types.ts +15 -0
  37. package/src/utils/authService.spec.ts +13 -0
  38. package/src/utils/authService.ts +4 -1
  39. package/src/utils/processData.spec.ts +25 -0
  40. package/src/utils/processData.ts +13 -0
  41. package/src/utils.spec.ts +26 -0
  42. package/src/utils.ts +5 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ This project follows Semantic Versioning.
7
7
 
8
8
  ### New Features
9
9
  - Events for all actions on Search Embed
10
+
11
+ ## 1.10.2 (05-01-2022)
12
+ - Ability to configure `redirectPath` on the origin when using SSO auth. [Ref doc](https://developers.thoughtspot.com/docs/typedoc/interfaces/EmbedConfig.html#redirectPath)
13
+
14
+ ## 1.10.1 (05-01-2022)
15
+
16
+ ### New features
17
+ - `logout` method exposed from the SDK. This can be used to log the user out. [Ref doc](https://developers.thoughtspot.com/docs/typedoc/modules.html#logout)
18
+
19
+ ### Updated
20
+ - When login fails the user is presented with a `Not logged in` message, which is configurable using `loginFailedMessage` property on `init`. [Ref doc](https://developers.thoughtspot.com/docs/typedoc/interfaces/EmbedConfig.html#loginFailedMessage)
21
+ - `init` now returns a event emitter which can be used to listen to Login `failures` and `success`. [Ref doc](https://developers.thoughtspot.com/docs/typedoc/modules.html#init)
22
+
10
23
  ## 1.10.0 (04-22-2022)
11
24
 
12
25
  - Release to support TS version 8.2.0.cl
@@ -30,12 +30,28 @@ export declare const prefetch: (url?: string) => void;
30
30
  * @param embedConfig The configuration object containing ThoughtSpot host,
31
31
  * authentication mechanism and so on.
32
32
  *
33
- * @returns authPromise Promise which resolves when authentication is complete.
33
+ * eg: authStatus = init(config);
34
+ * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
35
+ *
36
+ * @returns event emitter which emits events on authentication success, failure and logout. {@link AuthStatus}
34
37
  */
35
38
  export declare const init: (embedConfig: EmbedConfig) => EventEmitter;
39
+ export declare function disableAutoLogin(): void;
40
+ /**
41
+ * Logout from ThoughtSpot. This also sets the autoLogin flag to false, to prevent
42
+ * the SDK from automatically logging in again.
43
+ *
44
+ * You can call the `init` method again to re login, if autoLogin is set to true in this
45
+ * second call it will be honored.
46
+ *
47
+ * @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
48
+ * @returns Promise which resolves when logout completes.
49
+ * @version SDK: 1.10.1 | ThoughtSpot: *
50
+ */
36
51
  export declare const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolean>;
37
52
  /**
38
53
  * Renders functions in a queue, resolves to next function only after the callback next is called
39
54
  * @param fn The function being registered
40
55
  */
41
56
  export declare const renderInQueue: (fn: (next?: (val?: any) => void) => void) => void;
57
+ export declare function reset(): void;
@@ -90,6 +90,15 @@ export interface EmbedConfig {
90
90
  * @default false
91
91
  */
92
92
  noRedirect?: boolean;
93
+ /**
94
+ * [SSO] For SSO Authentication, one can supply an optional path param,
95
+ * this will be the path on the host origin where the SAML flow will be
96
+ * terminated.
97
+ *
98
+ * Eg: "/dashboard", "#/foo" [Do not include the host]
99
+ * @version SDK: 1.10.2 | ThoughtSpot: *
100
+ */
101
+ redirectPath?: string;
93
102
  /** @internal */
94
103
  basepath?: string;
95
104
  /**
@@ -342,6 +351,11 @@ export declare enum EmbedEvent {
342
351
  * @hidden
343
352
  */
344
353
  AuthFailure = "ThoughtspotAuthFailure",
354
+ /**
355
+ * ThoughtSpot failed to validate the auth session.
356
+ * @hidden
357
+ */
358
+ AuthLogout = "ThoughtspotAuthLogout",
345
359
  /**
346
360
  * The height of the embedded Liveboard or visualization has been computed.
347
361
  * @return data - The height of the embedded Liveboard or visualization
@@ -32,6 +32,7 @@ export declare const getCssDimension: (value: number | string) => string;
32
32
  * @param stringToAppend The string to append to the URL hash
33
33
  */
34
34
  export declare const appendToUrlHash: (url: string, stringToAppend: string) => string;
35
+ export declare function getRedirectUrl(url: string, stringToAppend: string, path?: string): string;
35
36
  export declare const getEncodedQueryParamsString: (queryString: string) => string;
36
37
  export declare const getOffsetTop: (element: any) => any;
37
38
  export declare const embedEventStatus: {
@@ -96,6 +96,10 @@ const appendToUrlHash = (url, stringToAppend) => {
96
96
  }
97
97
  return outputUrl;
98
98
  };
99
+ function getRedirectUrl(url, stringToAppend, path = '') {
100
+ const targetUrl = path ? new URL(path, window.location.origin).href : url;
101
+ return appendToUrlHash(targetUrl, stringToAppend);
102
+ }
99
103
  const getEncodedQueryParamsString = (queryString) => {
100
104
  if (!queryString) {
101
105
  return queryString;
@@ -311,6 +315,11 @@ var EmbedEvent;
311
315
  * @hidden
312
316
  */
313
317
  EmbedEvent["AuthFailure"] = "ThoughtspotAuthFailure";
318
+ /**
319
+ * ThoughtSpot failed to validate the auth session.
320
+ * @hidden
321
+ */
322
+ EmbedEvent["AuthLogout"] = "ThoughtspotAuthLogout";
314
323
  /**
315
324
  * The height of the embedded Liveboard or visualization has been computed.
316
325
  * @return data - The height of the embedded Liveboard or visualization
@@ -9073,7 +9082,10 @@ async function fetchBasicAuthService(thoughtSpotHost, username, password) {
9073
9082
  async function fetchLogoutService(thoughtSpotHost) {
9074
9083
  return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
9075
9084
  credentials: 'include',
9076
- mode: 'no-cors',
9085
+ method: 'POST',
9086
+ headers: {
9087
+ 'x-requested-by': 'ThoughtSpot',
9088
+ },
9077
9089
  });
9078
9090
  }
9079
9091
 
@@ -9247,7 +9259,6 @@ const doSSOAuth = async (embedConfig, ssoEndPoint) => {
9247
9259
  const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
9248
9260
  if (embedConfig.noRedirect) {
9249
9261
  await samlPopupFlow(ssoURL);
9250
- console.log('here');
9251
9262
  loggedInStatus = true;
9252
9263
  return;
9253
9264
  }
@@ -9259,7 +9270,7 @@ const doSamlAuth = async (embedConfig) => {
9259
9270
  // again and the same JS will execute again.
9260
9271
  const ssoRedirectUrl = embedConfig.noRedirect
9261
9272
  ? `${thoughtSpotHost}/v2/#/embed/saml-complete`
9262
- : appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
9273
+ : getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
9263
9274
  // bring back the page to the same URL
9264
9275
  const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
9265
9276
  await doSSOAuth(embedConfig, ssoEndPoint);
@@ -9271,7 +9282,7 @@ const doOIDCAuth = async (embedConfig) => {
9271
9282
  // again and the same JS will execute again.
9272
9283
  const ssoRedirectUrl = embedConfig.noRedirect
9273
9284
  ? `${thoughtSpotHost}/v2/#/embed/saml-complete`
9274
- : appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
9285
+ : getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
9275
9286
  // bring back the page to the same URL
9276
9287
  const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
9277
9288
  await doSSOAuth(embedConfig, ssoEndPoint);
@@ -9306,7 +9317,7 @@ const authenticate = async (embedConfig) => {
9306
9317
  /* eslint-disable import/no-mutable-exports */
9307
9318
  let config = {};
9308
9319
  const CONFIG_DEFAULTS = {
9309
- loginFailedMessage: 'Login failed',
9320
+ loginFailedMessage: 'Not logged in',
9310
9321
  authType: AuthType.None,
9311
9322
  };
9312
9323
  let authPromise;
@@ -9338,11 +9349,7 @@ function notifyLogout() {
9338
9349
  * Perform authentication on the ThoughtSpot app as applicable.
9339
9350
  */
9340
9351
  const handleAuth = () => {
9341
- const authConfig = {
9342
- ...config,
9343
- thoughtSpotHost: getThoughtSpotHost(config),
9344
- };
9345
- authPromise = authenticate(authConfig);
9352
+ authPromise = authenticate(config);
9346
9353
  authPromise.then((isLoggedIn) => {
9347
9354
  if (!isLoggedIn) {
9348
9355
  notifyAuthFailure(AuthFailureType.SDK);
@@ -9377,10 +9384,17 @@ const prefetch = (url) => {
9377
9384
  * @param embedConfig The configuration object containing ThoughtSpot host,
9378
9385
  * authentication mechanism and so on.
9379
9386
  *
9380
- * @returns authPromise Promise which resolves when authentication is complete.
9387
+ * eg: authStatus = init(config);
9388
+ * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
9389
+ *
9390
+ * @returns event emitter which emits events on authentication success, failure and logout. {@link AuthStatus}
9381
9391
  */
9382
9392
  const init = (embedConfig) => {
9383
- config = { ...CONFIG_DEFAULTS, ...embedConfig };
9393
+ config = {
9394
+ ...CONFIG_DEFAULTS,
9395
+ ...embedConfig,
9396
+ thoughtSpotHost: getThoughtSpotHost(embedConfig),
9397
+ };
9384
9398
  authEE = new eventemitter3();
9385
9399
  handleAuth();
9386
9400
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
@@ -9392,9 +9406,23 @@ const init = (embedConfig) => {
9392
9406
  }
9393
9407
  return authEE;
9394
9408
  };
9409
+ function disableAutoLogin() {
9410
+ config.autoLogin = false;
9411
+ }
9412
+ /**
9413
+ * Logout from ThoughtSpot. This also sets the autoLogin flag to false, to prevent
9414
+ * the SDK from automatically logging in again.
9415
+ *
9416
+ * You can call the `init` method again to re login, if autoLogin is set to true in this
9417
+ * second call it will be honored.
9418
+ *
9419
+ * @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
9420
+ * @returns Promise which resolves when logout completes.
9421
+ * @version SDK: 1.10.1 | ThoughtSpot: *
9422
+ */
9395
9423
  const logout$1 = (doNotDisableAutoLogin = false) => {
9396
9424
  if (!doNotDisableAutoLogin) {
9397
- config.autoLogin = false;
9425
+ disableAutoLogin();
9398
9426
  }
9399
9427
  return logout(config).then((isLoggedIn) => {
9400
9428
  notifyLogout();
@@ -9520,6 +9548,14 @@ function processAuthFailure(e, containerEl) {
9520
9548
  notifyAuthFailure(AuthFailureType.OTHER);
9521
9549
  return e;
9522
9550
  }
9551
+ function processAuthLogout(e, containerEl) {
9552
+ const { loginFailedMessage } = getEmbedConfig();
9553
+ // eslint-disable-next-line no-param-reassign
9554
+ containerEl.innerHTML = loginFailedMessage;
9555
+ disableAutoLogin();
9556
+ notifyLogout();
9557
+ return e;
9558
+ }
9523
9559
  function processEventData(type, e, thoughtSpotHost, containerEl) {
9524
9560
  switch (type) {
9525
9561
  case EmbedEvent.CustomAction:
@@ -9532,6 +9568,8 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
9532
9568
  return processNoCookieAccess(e, containerEl);
9533
9569
  case EmbedEvent.AuthFailure:
9534
9570
  return processAuthFailure(e, containerEl);
9571
+ case EmbedEvent.AuthLogout:
9572
+ return processAuthLogout(e, containerEl);
9535
9573
  }
9536
9574
  return e;
9537
9575
  }
@@ -9560,7 +9598,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
9560
9598
  }
9561
9599
  }
9562
9600
 
9563
- var name="@thoughtspot/visual-embed-sdk";var version="1.11.0-auth.12";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.41.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};
9601
+ var name="@thoughtspot/visual-embed-sdk";var version="1.11.0-auth.17";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.41.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};
9564
9602
 
9565
9603
  /**
9566
9604
  * Copyright (c) 2022
package/dist/tsembed.js CHANGED
@@ -102,6 +102,10 @@
102
102
  }
103
103
  return outputUrl;
104
104
  };
105
+ function getRedirectUrl(url, stringToAppend, path = '') {
106
+ const targetUrl = path ? new URL(path, window.location.origin).href : url;
107
+ return appendToUrlHash(targetUrl, stringToAppend);
108
+ }
105
109
  const getEncodedQueryParamsString = (queryString) => {
106
110
  if (!queryString) {
107
111
  return queryString;
@@ -301,6 +305,11 @@
301
305
  * @hidden
302
306
  */
303
307
  EmbedEvent["AuthFailure"] = "ThoughtspotAuthFailure";
308
+ /**
309
+ * ThoughtSpot failed to validate the auth session.
310
+ * @hidden
311
+ */
312
+ EmbedEvent["AuthLogout"] = "ThoughtspotAuthLogout";
304
313
  /**
305
314
  * The height of the embedded Liveboard or visualization has been computed.
306
315
  * @return data - The height of the embedded Liveboard or visualization
@@ -9042,7 +9051,10 @@
9042
9051
  async function fetchLogoutService(thoughtSpotHost) {
9043
9052
  return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
9044
9053
  credentials: 'include',
9045
- mode: 'no-cors',
9054
+ method: 'POST',
9055
+ headers: {
9056
+ 'x-requested-by': 'ThoughtSpot',
9057
+ },
9046
9058
  });
9047
9059
  }
9048
9060
 
@@ -9214,7 +9226,6 @@
9214
9226
  const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
9215
9227
  if (embedConfig.noRedirect) {
9216
9228
  await samlPopupFlow(ssoURL);
9217
- console.log('here');
9218
9229
  loggedInStatus = true;
9219
9230
  return;
9220
9231
  }
@@ -9226,7 +9237,7 @@
9226
9237
  // again and the same JS will execute again.
9227
9238
  const ssoRedirectUrl = embedConfig.noRedirect
9228
9239
  ? `${thoughtSpotHost}/v2/#/embed/saml-complete`
9229
- : appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
9240
+ : getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
9230
9241
  // bring back the page to the same URL
9231
9242
  const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
9232
9243
  await doSSOAuth(embedConfig, ssoEndPoint);
@@ -9238,7 +9249,7 @@
9238
9249
  // again and the same JS will execute again.
9239
9250
  const ssoRedirectUrl = embedConfig.noRedirect
9240
9251
  ? `${thoughtSpotHost}/v2/#/embed/saml-complete`
9241
- : appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
9252
+ : getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
9242
9253
  // bring back the page to the same URL
9243
9254
  const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
9244
9255
  await doSSOAuth(embedConfig, ssoEndPoint);
@@ -9273,7 +9284,7 @@
9273
9284
  /* eslint-disable import/no-mutable-exports */
9274
9285
  let config = {};
9275
9286
  const CONFIG_DEFAULTS = {
9276
- loginFailedMessage: 'Login failed',
9287
+ loginFailedMessage: 'Not logged in',
9277
9288
  authType: exports.AuthType.None,
9278
9289
  };
9279
9290
  let authPromise;
@@ -9305,11 +9316,7 @@
9305
9316
  * Perform authentication on the ThoughtSpot app as applicable.
9306
9317
  */
9307
9318
  const handleAuth = () => {
9308
- const authConfig = {
9309
- ...config,
9310
- thoughtSpotHost: getThoughtSpotHost(config),
9311
- };
9312
- authPromise = authenticate(authConfig);
9319
+ authPromise = authenticate(config);
9313
9320
  authPromise.then((isLoggedIn) => {
9314
9321
  if (!isLoggedIn) {
9315
9322
  notifyAuthFailure(exports.AuthFailureType.SDK);
@@ -9344,10 +9351,17 @@
9344
9351
  * @param embedConfig The configuration object containing ThoughtSpot host,
9345
9352
  * authentication mechanism and so on.
9346
9353
  *
9347
- * @returns authPromise Promise which resolves when authentication is complete.
9354
+ * eg: authStatus = init(config);
9355
+ * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
9356
+ *
9357
+ * @returns event emitter which emits events on authentication success, failure and logout. {@link AuthStatus}
9348
9358
  */
9349
9359
  const init = (embedConfig) => {
9350
- config = { ...CONFIG_DEFAULTS, ...embedConfig };
9360
+ config = {
9361
+ ...CONFIG_DEFAULTS,
9362
+ ...embedConfig,
9363
+ thoughtSpotHost: getThoughtSpotHost(embedConfig),
9364
+ };
9351
9365
  authEE = new eventemitter3();
9352
9366
  handleAuth();
9353
9367
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
@@ -9359,9 +9373,23 @@
9359
9373
  }
9360
9374
  return authEE;
9361
9375
  };
9376
+ function disableAutoLogin() {
9377
+ config.autoLogin = false;
9378
+ }
9379
+ /**
9380
+ * Logout from ThoughtSpot. This also sets the autoLogin flag to false, to prevent
9381
+ * the SDK from automatically logging in again.
9382
+ *
9383
+ * You can call the `init` method again to re login, if autoLogin is set to true in this
9384
+ * second call it will be honored.
9385
+ *
9386
+ * @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
9387
+ * @returns Promise which resolves when logout completes.
9388
+ * @version SDK: 1.10.1 | ThoughtSpot: *
9389
+ */
9362
9390
  const logout$1 = (doNotDisableAutoLogin = false) => {
9363
9391
  if (!doNotDisableAutoLogin) {
9364
- config.autoLogin = false;
9392
+ disableAutoLogin();
9365
9393
  }
9366
9394
  return logout(config).then((isLoggedIn) => {
9367
9395
  notifyLogout();
@@ -9487,6 +9515,14 @@
9487
9515
  notifyAuthFailure(exports.AuthFailureType.OTHER);
9488
9516
  return e;
9489
9517
  }
9518
+ function processAuthLogout(e, containerEl) {
9519
+ const { loginFailedMessage } = getEmbedConfig();
9520
+ // eslint-disable-next-line no-param-reassign
9521
+ containerEl.innerHTML = loginFailedMessage;
9522
+ disableAutoLogin();
9523
+ notifyLogout();
9524
+ return e;
9525
+ }
9490
9526
  function processEventData(type, e, thoughtSpotHost, containerEl) {
9491
9527
  switch (type) {
9492
9528
  case exports.EmbedEvent.CustomAction:
@@ -9499,6 +9535,8 @@
9499
9535
  return processNoCookieAccess(e, containerEl);
9500
9536
  case exports.EmbedEvent.AuthFailure:
9501
9537
  return processAuthFailure(e, containerEl);
9538
+ case exports.EmbedEvent.AuthLogout:
9539
+ return processAuthLogout(e, containerEl);
9502
9540
  }
9503
9541
  return e;
9504
9542
  }
@@ -9527,7 +9565,7 @@
9527
9565
  }
9528
9566
  }
9529
9567
 
9530
- var name="@thoughtspot/visual-embed-sdk";var version="1.11.0-auth.12";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.41.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};
9568
+ var name="@thoughtspot/visual-embed-sdk";var version="1.11.0-auth.17";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.41.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};
9531
9569
 
9532
9570
  /**
9533
9571
  * Copyright (c) 2022
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.11.0-auth.12",
3
+ "version": "1.11.0-auth.17",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
package/lib/src/auth.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { initMixpanel } from './mixpanel-service';
2
2
  import { AuthType, EmbedEvent } from './types';
3
- import { appendToUrlHash } from './utils';
3
+ import { getRedirectUrl } from './utils';
4
4
  // eslint-disable-next-line import/no-cycle
5
5
  import { fetchSessionInfoService, fetchAuthTokenService, fetchAuthService, fetchBasicAuthService, fetchLogoutService, } from './utils/authService';
6
6
  // eslint-disable-next-line import/no-mutable-exports
@@ -179,7 +179,6 @@ const doSSOAuth = async (embedConfig, ssoEndPoint) => {
179
179
  const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
180
180
  if (embedConfig.noRedirect) {
181
181
  await samlPopupFlow(ssoURL);
182
- console.log('here');
183
182
  loggedInStatus = true;
184
183
  return;
185
184
  }
@@ -191,7 +190,7 @@ export const doSamlAuth = async (embedConfig) => {
191
190
  // again and the same JS will execute again.
192
191
  const ssoRedirectUrl = embedConfig.noRedirect
193
192
  ? `${thoughtSpotHost}/v2/#/embed/saml-complete`
194
- : appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
193
+ : getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
195
194
  // bring back the page to the same URL
196
195
  const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
197
196
  await doSSOAuth(embedConfig, ssoEndPoint);
@@ -203,7 +202,7 @@ export const doOIDCAuth = async (embedConfig) => {
203
202
  // again and the same JS will execute again.
204
203
  const ssoRedirectUrl = embedConfig.noRedirect
205
204
  ? `${thoughtSpotHost}/v2/#/embed/saml-complete`
206
- : appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
205
+ : getRedirectUrl(window.location.href, SSO_REDIRECTION_MARKER_GUID, embedConfig.redirectPath);
207
206
  // bring back the page to the same URL
208
207
  const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
209
208
  await doSSOAuth(embedConfig, ssoEndP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,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACpC;AACL,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAY,EAAE,CAAC,cAAc,CAAC"}
@@ -30,12 +30,28 @@ export declare const prefetch: (url?: string) => void;
30
30
  * @param embedConfig The configuration object containing ThoughtSpot host,
31
31
  * authentication mechanism and so on.
32
32
  *
33
- * @returns authPromise Promise which resolves when authentication is complete.
33
+ * eg: authStatus = init(config);
34
+ * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
35
+ *
36
+ * @returns event emitter which emits events on authentication success, failure and logout. {@link AuthStatus}
34
37
  */
35
38
  export declare const init: (embedConfig: EmbedConfig) => EventEmitter;
39
+ export declare function disableAutoLogin(): void;
40
+ /**
41
+ * Logout from ThoughtSpot. This also sets the autoLogin flag to false, to prevent
42
+ * the SDK from automatically logging in again.
43
+ *
44
+ * You can call the `init` method again to re login, if autoLogin is set to true in this
45
+ * second call it will be honored.
46
+ *
47
+ * @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
48
+ * @returns Promise which resolves when logout completes.
49
+ * @version SDK: 1.10.1 | ThoughtSpot: *
50
+ */
36
51
  export declare const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolean>;
37
52
  /**
38
53
  * Renders functions in a queue, resolves to next function only after the callback next is called
39
54
  * @param fn The function being registered
40
55
  */
41
56
  export declare const renderInQueue: (fn: (next?: (val?: any) => void) => void) => void;
57
+ export declare function reset(): void;
@@ -14,7 +14,7 @@ import { authenticate, logout as _logout, AuthFailureType, AuthStatus, } from '.
14
14
  import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
15
15
  let config = {};
16
16
  const CONFIG_DEFAULTS = {
17
- loginFailedMessage: 'Login failed',
17
+ loginFailedMessage: 'Not logged in',
18
18
  authType: AuthType.None,
19
19
  };
20
20
  export let authPromise;
@@ -46,11 +46,7 @@ export function notifyLogout() {
46
46
  * Perform authentication on the ThoughtSpot app as applicable.
47
47
  */
48
48
  export const handleAuth = () => {
49
- const authConfig = {
50
- ...config,
51
- thoughtSpotHost: getThoughtSpotHost(config),
52
- };
53
- authPromise = authenticate(authConfig);
49
+ authPromise = authenticate(config);
54
50
  authPromise.then((isLoggedIn) => {
55
51
  if (!isLoggedIn) {
56
52
  notifyAuthFailure(AuthFailureType.SDK);
@@ -85,10 +81,17 @@ export const prefetch = (url) => {
85
81
  * @param embedConfig The configuration object containing ThoughtSpot host,
86
82
  * authentication mechanism and so on.
87
83
  *
88
- * @returns authPromise Promise which resolves when authentication is complete.
84
+ * eg: authStatus = init(config);
85
+ * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
86
+ *
87
+ * @returns event emitter which emits events on authentication success, failure and logout. {@link AuthStatus}
89
88
  */
90
89
  export const init = (embedConfig) => {
91
- config = { ...CONFIG_DEFAULTS, ...embedConfig };
90
+ config = {
91
+ ...CONFIG_DEFAULTS,
92
+ ...embedConfig,
93
+ thoughtSpotHost: getThoughtSpotHost(embedConfig),
94
+ };
92
95
  authEE = new EventEmitter();
93
96
  handleAuth();
94
97
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
@@ -100,9 +103,23 @@ export const init = (embedConfig) => {
100
103
  }
101
104
  return authEE;
102
105
  };
106
+ export function disableAutoLogin() {
107
+ config.autoLogin = false;
108
+ }
109
+ /**
110
+ * Logout from ThoughtSpot. This also sets the autoLogin flag to false, to prevent
111
+ * the SDK from automatically logging in again.
112
+ *
113
+ * You can call the `init` method again to re login, if autoLogin is set to true in this
114
+ * second call it will be honored.
115
+ *
116
+ * @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
117
+ * @returns Promise which resolves when logout completes.
118
+ * @version SDK: 1.10.1 | ThoughtSpot: *
119
+ */
103
120
  export const logout = (doNotDisableAutoLogin = false) => {
104
121
  if (!doNotDisableAutoLogin) {
105
- config.autoLogin = false;
122
+ disableAutoLogin();
106
123
  }
107
124
  return _logout(config).then((isLoggedIn) => {
108
125
  notifyLogout();
@@ -124,4 +141,10 @@ export const renderInQueue = (fn) => {
124
141
  fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
125
142
  }
126
143
  };
144
+ // For testing purposes only
145
+ export function reset() {
146
+ config = {};
147
+ authEE = null;
148
+ authPromise = null;
149
+ }
127
150
  //# sourceMappingURL=base.js.map