@thoughtspot/visual-embed-sdk 1.11.0-auth.11 → 1.11.0-auth.14

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 (47) hide show
  1. package/dist/src/embed/base.d.ts +4 -1
  2. package/dist/src/index.d.ts +2 -1
  3. package/dist/src/types.d.ts +5 -0
  4. package/dist/tsembed.es.js +51 -24
  5. package/dist/tsembed.js +59 -34
  6. package/lib/package.json +1 -1
  7. package/lib/src/auth.js +4 -8
  8. package/lib/src/auth.js.map +1 -1
  9. package/lib/src/auth.spec.js +54 -1
  10. package/lib/src/auth.spec.js.map +1 -1
  11. package/lib/src/embed/base.d.ts +4 -1
  12. package/lib/src/embed/base.js +30 -8
  13. package/lib/src/embed/base.js.map +1 -1
  14. package/lib/src/embed/base.spec.js +28 -0
  15. package/lib/src/embed/base.spec.js.map +1 -1
  16. package/lib/src/embed/embed.spec.js +1 -1
  17. package/lib/src/embed/embed.spec.js.map +1 -1
  18. package/lib/src/embed/ts-embed.js +1 -1
  19. package/lib/src/embed/ts-embed.js.map +1 -1
  20. package/lib/src/index.d.ts +2 -1
  21. package/lib/src/index.js +2 -1
  22. package/lib/src/index.js.map +1 -1
  23. package/lib/src/types.d.ts +5 -0
  24. package/lib/src/types.js +5 -0
  25. package/lib/src/types.js.map +1 -1
  26. package/lib/src/utils/authService.js +5 -5
  27. package/lib/src/utils/authService.js.map +1 -1
  28. package/lib/src/utils/authService.spec.js +10 -0
  29. package/lib/src/utils/authService.spec.js.map +1 -1
  30. package/lib/src/utils/processData.js +11 -1
  31. package/lib/src/utils/processData.js.map +1 -1
  32. package/lib/src/utils/processData.spec.js +21 -0
  33. package/lib/src/utils/processData.spec.js.map +1 -1
  34. package/lib/src/visual-embed-sdk.d.ts +70 -61
  35. package/package.json +1 -1
  36. package/src/auth.spec.ts +67 -1
  37. package/src/auth.ts +4 -7
  38. package/src/embed/base.spec.ts +33 -0
  39. package/src/embed/base.ts +33 -8
  40. package/src/embed/embed.spec.ts +1 -1
  41. package/src/embed/ts-embed.ts +1 -1
  42. package/src/index.ts +3 -0
  43. package/src/types.ts +5 -0
  44. package/src/utils/authService.spec.ts +13 -0
  45. package/src/utils/authService.ts +4 -5
  46. package/src/utils/processData.spec.ts +25 -0
  47. package/src/utils/processData.ts +13 -0
@@ -14,6 +14,7 @@ export declare const getEmbedConfig: () => EmbedConfig;
14
14
  export declare const getAuthPromise: () => Promise<boolean>;
15
15
  export declare function notifyAuthSuccess(): void;
16
16
  export declare function notifyAuthFailure(failureType: AuthFailureType): void;
17
+ export declare function notifyLogout(): void;
17
18
  /**
18
19
  * Perform authentication on the ThoughtSpot app as applicable.
19
20
  */
@@ -32,9 +33,11 @@ export declare const prefetch: (url?: string) => void;
32
33
  * @returns authPromise Promise which resolves when authentication is complete.
33
34
  */
34
35
  export declare const init: (embedConfig: EmbedConfig) => EventEmitter;
35
- export declare const logout: () => Promise<boolean>;
36
+ export declare function disableAutoLogin(): void;
37
+ export declare const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolean>;
36
38
  /**
37
39
  * Renders functions in a queue, resolves to next function only after the callback next is called
38
40
  * @param fn The function being registered
39
41
  */
40
42
  export declare const renderInQueue: (fn: (next?: (val?: any) => void) => void) => void;
43
+ export declare function reset(): void;
@@ -11,5 +11,6 @@ import { AppEmbed, Page, AppViewConfig } from './embed/app';
11
11
  import { init, prefetch, logout } from './embed/base';
12
12
  import { PinboardEmbed, LiveboardViewConfig, LiveboardEmbed } from './embed/liveboard';
13
13
  import { SearchEmbed, SearchViewConfig } from './embed/search';
14
+ import { AuthFailureType, AuthStatus } from './auth';
14
15
  import { AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig } from './types';
15
- export { init, logout, prefetch, SearchEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, SearchViewConfig, LiveboardViewConfig, AppViewConfig, };
16
+ export { init, logout, prefetch, SearchEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, AuthFailureType, AuthStatus, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, SearchViewConfig, LiveboardViewConfig, AppViewConfig, };
@@ -342,6 +342,11 @@ export declare enum EmbedEvent {
342
342
  * @hidden
343
343
  */
344
344
  AuthFailure = "ThoughtspotAuthFailure",
345
+ /**
346
+ * ThoughtSpot failed to validate the auth session.
347
+ * @hidden
348
+ */
349
+ AuthLogout = "ThoughtspotAuthLogout",
345
350
  /**
346
351
  * The height of the embedded Liveboard or visualization has been computed.
347
352
  * @return data - The height of the embedded Liveboard or visualization
@@ -311,6 +311,11 @@ var EmbedEvent;
311
311
  * @hidden
312
312
  */
313
313
  EmbedEvent["AuthFailure"] = "ThoughtspotAuthFailure";
314
+ /**
315
+ * ThoughtSpot failed to validate the auth session.
316
+ * @hidden
317
+ */
318
+ EmbedEvent["AuthLogout"] = "ThoughtspotAuthLogout";
314
319
  /**
315
320
  * The height of the embedded Liveboard or visualization has been computed.
316
321
  * @return data - The height of the embedded Liveboard or visualization
@@ -9037,8 +9042,9 @@ EventEmitter.EventEmitter = EventEmitter;
9037
9042
  // eslint-disable-next-line import/no-cycle
9038
9043
  function failureLoggedFetch(url, options = {}) {
9039
9044
  return fetch(url, options).then(async (r) => {
9040
- if (!r.ok && r.type !== 'opaqueredirect') {
9041
- console.error('Failure', await r.text());
9045
+ var _a;
9046
+ if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
9047
+ console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
9042
9048
  }
9043
9049
  return r;
9044
9050
  });
@@ -9072,9 +9078,8 @@ async function fetchBasicAuthService(thoughtSpotHost, username, password) {
9072
9078
  async function fetchLogoutService(thoughtSpotHost) {
9073
9079
  return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
9074
9080
  credentials: 'include',
9075
- headers: {
9076
- 'x-requested-by': 'ThoughtSpot',
9077
- },
9081
+ mode: 'no-cors',
9082
+ method: 'POST',
9078
9083
  });
9079
9084
  }
9080
9085
 
@@ -9163,8 +9168,8 @@ const doTokenAuth = async (embedConfig) => {
9163
9168
  if (!authEndpoint && !getAuthToken) {
9164
9169
  throw new Error('Either auth endpoint or getAuthToken function must be provided');
9165
9170
  }
9166
- const loggedIn = await isLoggedIn(thoughtSpotHost);
9167
- if (!loggedIn) {
9171
+ loggedInStatus = await isLoggedIn(thoughtSpotHost);
9172
+ if (!loggedInStatus) {
9168
9173
  let authToken = null;
9169
9174
  if (getAuthToken) {
9170
9175
  authToken = await getAuthToken();
@@ -9178,9 +9183,6 @@ const doTokenAuth = async (embedConfig) => {
9178
9183
  // token login issues a 302 when successful
9179
9184
  loggedInStatus = resp.ok || resp.type === 'opaqueredirect';
9180
9185
  }
9181
- else {
9182
- loggedInStatus = true;
9183
- }
9184
9186
  return loggedInStatus;
9185
9187
  };
9186
9188
  /**
@@ -9251,6 +9253,7 @@ const doSSOAuth = async (embedConfig, ssoEndPoint) => {
9251
9253
  const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
9252
9254
  if (embedConfig.noRedirect) {
9253
9255
  await samlPopupFlow(ssoURL);
9256
+ loggedInStatus = true;
9254
9257
  return;
9255
9258
  }
9256
9259
  window.location.href = ssoURL;
@@ -9282,9 +9285,7 @@ const doOIDCAuth = async (embedConfig) => {
9282
9285
  const logout = async (embedConfig) => {
9283
9286
  const { thoughtSpotHost } = embedConfig;
9284
9287
  const response = await fetchLogoutService(thoughtSpotHost);
9285
- if (response.ok || response.status === 401) {
9286
- loggedInStatus = false;
9287
- }
9288
+ loggedInStatus = false;
9288
9289
  return loggedInStatus;
9289
9290
  };
9290
9291
  /**
@@ -9331,15 +9332,18 @@ function notifyAuthFailure(failureType) {
9331
9332
  }
9332
9333
  authEE.emit(AuthStatus.FAILURE, failureType);
9333
9334
  }
9335
+ function notifyLogout() {
9336
+ if (!authEE) {
9337
+ console.error('SDK not initialized');
9338
+ return;
9339
+ }
9340
+ authEE.emit(AuthStatus.LOGOUT);
9341
+ }
9334
9342
  /**
9335
9343
  * Perform authentication on the ThoughtSpot app as applicable.
9336
9344
  */
9337
9345
  const handleAuth = () => {
9338
- const authConfig = {
9339
- ...config,
9340
- thoughtSpotHost: getThoughtSpotHost(config),
9341
- };
9342
- authPromise = authenticate(authConfig);
9346
+ authPromise = authenticate(config);
9343
9347
  authPromise.then((isLoggedIn) => {
9344
9348
  if (!isLoggedIn) {
9345
9349
  notifyAuthFailure(AuthFailureType.SDK);
@@ -9377,7 +9381,11 @@ const prefetch = (url) => {
9377
9381
  * @returns authPromise Promise which resolves when authentication is complete.
9378
9382
  */
9379
9383
  const init = (embedConfig) => {
9380
- config = { ...CONFIG_DEFAULTS, ...embedConfig };
9384
+ config = {
9385
+ ...CONFIG_DEFAULTS,
9386
+ ...embedConfig,
9387
+ thoughtSpotHost: getThoughtSpotHost(embedConfig),
9388
+ };
9381
9389
  authEE = new eventemitter3();
9382
9390
  handleAuth();
9383
9391
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
@@ -9389,8 +9397,17 @@ const init = (embedConfig) => {
9389
9397
  }
9390
9398
  return authEE;
9391
9399
  };
9392
- const logout$1 = () => {
9393
- return logout(config);
9400
+ function disableAutoLogin() {
9401
+ config.autoLogin = false;
9402
+ }
9403
+ const logout$1 = (doNotDisableAutoLogin = false) => {
9404
+ if (!doNotDisableAutoLogin) {
9405
+ disableAutoLogin();
9406
+ }
9407
+ return logout(config).then((isLoggedIn) => {
9408
+ notifyLogout();
9409
+ return isLoggedIn;
9410
+ });
9394
9411
  };
9395
9412
  let renderQueue = Promise.resolve();
9396
9413
  /**
@@ -9511,6 +9528,14 @@ function processAuthFailure(e, containerEl) {
9511
9528
  notifyAuthFailure(AuthFailureType.OTHER);
9512
9529
  return e;
9513
9530
  }
9531
+ function processAuthLogout(e, containerEl) {
9532
+ const { loginFailedMessage } = getEmbedConfig();
9533
+ // eslint-disable-next-line no-param-reassign
9534
+ containerEl.innerHTML = loginFailedMessage;
9535
+ disableAutoLogin();
9536
+ notifyLogout();
9537
+ return e;
9538
+ }
9514
9539
  function processEventData(type, e, thoughtSpotHost, containerEl) {
9515
9540
  switch (type) {
9516
9541
  case EmbedEvent.CustomAction:
@@ -9523,6 +9548,8 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
9523
9548
  return processNoCookieAccess(e, containerEl);
9524
9549
  case EmbedEvent.AuthFailure:
9525
9550
  return processAuthFailure(e, containerEl);
9551
+ case EmbedEvent.AuthLogout:
9552
+ return processAuthLogout(e, containerEl);
9526
9553
  }
9527
9554
  return e;
9528
9555
  }
@@ -9551,7 +9578,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
9551
9578
  }
9552
9579
  }
9553
9580
 
9554
- var name="@thoughtspot/visual-embed-sdk";var version="1.11.0-auth.11";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};
9581
+ var name="@thoughtspot/visual-embed-sdk";var version="1.11.0-auth.14";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};
9555
9582
 
9556
9583
  /**
9557
9584
  * Copyright (c) 2022
@@ -9813,7 +9840,7 @@ class TsEmbed {
9813
9840
  this.iFrame.mozallowfullscreen = true;
9814
9841
  const { height: frameHeight, width: frameWidth, ...restParams } = frameOptions;
9815
9842
  const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
9816
- const height = getCssDimension(frameWidth || DEFAULT_EMBED_HEIGHT);
9843
+ const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
9817
9844
  setAttributes(this.iFrame, restParams);
9818
9845
  this.iFrame.style.width = `${width}`;
9819
9846
  this.iFrame.style.height = `${height}`;
@@ -10419,4 +10446,4 @@ class SearchEmbed extends TsEmbed {
10419
10446
  }
10420
10447
  }
10421
10448
 
10422
- export { Action, AppEmbed, AuthType, DataSourceVisualMode, EmbedEvent, HostEvent, LiveboardEmbed, Page, PinboardEmbed, RuntimeFilterOp, SearchEmbed, init, logout$1 as logout, prefetch };
10449
+ export { Action, AppEmbed, AuthFailureType, AuthStatus, AuthType, DataSourceVisualMode, EmbedEvent, HostEvent, LiveboardEmbed, Page, PinboardEmbed, RuntimeFilterOp, SearchEmbed, init, logout$1 as logout, prefetch };
package/dist/tsembed.js CHANGED
@@ -301,6 +301,11 @@
301
301
  * @hidden
302
302
  */
303
303
  EmbedEvent["AuthFailure"] = "ThoughtspotAuthFailure";
304
+ /**
305
+ * ThoughtSpot failed to validate the auth session.
306
+ * @hidden
307
+ */
308
+ EmbedEvent["AuthLogout"] = "ThoughtspotAuthLogout";
304
309
  /**
305
310
  * The height of the embedded Liveboard or visualization has been computed.
306
311
  * @return data - The height of the embedded Liveboard or visualization
@@ -9006,8 +9011,9 @@
9006
9011
  // eslint-disable-next-line import/no-cycle
9007
9012
  function failureLoggedFetch(url, options = {}) {
9008
9013
  return fetch(url, options).then(async (r) => {
9009
- if (!r.ok && r.type !== 'opaqueredirect') {
9010
- console.error('Failure', await r.text());
9014
+ var _a;
9015
+ if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
9016
+ console.error('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
9011
9017
  }
9012
9018
  return r;
9013
9019
  });
@@ -9041,9 +9047,8 @@
9041
9047
  async function fetchLogoutService(thoughtSpotHost) {
9042
9048
  return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
9043
9049
  credentials: 'include',
9044
- headers: {
9045
- 'x-requested-by': 'ThoughtSpot',
9046
- },
9050
+ mode: 'no-cors',
9051
+ method: 'POST',
9047
9052
  });
9048
9053
  }
9049
9054
 
@@ -9064,19 +9069,17 @@
9064
9069
  BASIC_LOGIN: '/callosum/v1/session/login',
9065
9070
  LOGOUT: '/callosum/v1/session/logout',
9066
9071
  };
9067
- var AuthFailureType;
9068
9072
  (function (AuthFailureType) {
9069
9073
  AuthFailureType["SDK"] = "SDK";
9070
9074
  AuthFailureType["NO_COOKIE_ACCESS"] = "NO_COOKIE_ACCESS";
9071
9075
  AuthFailureType["EXPIRY"] = "EXPIRY";
9072
9076
  AuthFailureType["OTHER"] = "OTHER";
9073
- })(AuthFailureType || (AuthFailureType = {}));
9074
- var AuthStatus;
9077
+ })(exports.AuthFailureType || (exports.AuthFailureType = {}));
9075
9078
  (function (AuthStatus) {
9076
9079
  AuthStatus["FAILURE"] = "FAILURE";
9077
9080
  AuthStatus["SUCCESS"] = "SUCCESS";
9078
9081
  AuthStatus["LOGOUT"] = "LOGOUT";
9079
- })(AuthStatus || (AuthStatus = {}));
9082
+ })(exports.AuthStatus || (exports.AuthStatus = {}));
9080
9083
  /**
9081
9084
  * Check if we are logged into the ThoughtSpot cluster
9082
9085
  * @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
@@ -9132,8 +9135,8 @@
9132
9135
  if (!authEndpoint && !getAuthToken) {
9133
9136
  throw new Error('Either auth endpoint or getAuthToken function must be provided');
9134
9137
  }
9135
- const loggedIn = await isLoggedIn(thoughtSpotHost);
9136
- if (!loggedIn) {
9138
+ loggedInStatus = await isLoggedIn(thoughtSpotHost);
9139
+ if (!loggedInStatus) {
9137
9140
  let authToken = null;
9138
9141
  if (getAuthToken) {
9139
9142
  authToken = await getAuthToken();
@@ -9147,9 +9150,6 @@
9147
9150
  // token login issues a 302 when successful
9148
9151
  loggedInStatus = resp.ok || resp.type === 'opaqueredirect';
9149
9152
  }
9150
- else {
9151
- loggedInStatus = true;
9152
- }
9153
9153
  return loggedInStatus;
9154
9154
  };
9155
9155
  /**
@@ -9220,6 +9220,7 @@
9220
9220
  const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
9221
9221
  if (embedConfig.noRedirect) {
9222
9222
  await samlPopupFlow(ssoURL);
9223
+ loggedInStatus = true;
9223
9224
  return;
9224
9225
  }
9225
9226
  window.location.href = ssoURL;
@@ -9251,9 +9252,7 @@
9251
9252
  const logout = async (embedConfig) => {
9252
9253
  const { thoughtSpotHost } = embedConfig;
9253
9254
  const response = await fetchLogoutService(thoughtSpotHost);
9254
- if (response.ok || response.status === 401) {
9255
- loggedInStatus = false;
9256
- }
9255
+ loggedInStatus = false;
9257
9256
  return loggedInStatus;
9258
9257
  };
9259
9258
  /**
@@ -9291,30 +9290,33 @@
9291
9290
  console.error('SDK not initialized');
9292
9291
  return;
9293
9292
  }
9294
- authEE.emit(AuthStatus.SUCCESS);
9293
+ authEE.emit(exports.AuthStatus.SUCCESS);
9295
9294
  }
9296
9295
  function notifyAuthFailure(failureType) {
9297
9296
  if (!authEE) {
9298
9297
  console.error('SDK not initialized');
9299
9298
  return;
9300
9299
  }
9301
- authEE.emit(AuthStatus.FAILURE, failureType);
9300
+ authEE.emit(exports.AuthStatus.FAILURE, failureType);
9301
+ }
9302
+ function notifyLogout() {
9303
+ if (!authEE) {
9304
+ console.error('SDK not initialized');
9305
+ return;
9306
+ }
9307
+ authEE.emit(exports.AuthStatus.LOGOUT);
9302
9308
  }
9303
9309
  /**
9304
9310
  * Perform authentication on the ThoughtSpot app as applicable.
9305
9311
  */
9306
9312
  const handleAuth = () => {
9307
- const authConfig = {
9308
- ...config,
9309
- thoughtSpotHost: getThoughtSpotHost(config),
9310
- };
9311
- authPromise = authenticate(authConfig);
9313
+ authPromise = authenticate(config);
9312
9314
  authPromise.then((isLoggedIn) => {
9313
9315
  if (!isLoggedIn) {
9314
- notifyAuthFailure(AuthFailureType.SDK);
9316
+ notifyAuthFailure(exports.AuthFailureType.SDK);
9315
9317
  }
9316
9318
  }, () => {
9317
- notifyAuthFailure(AuthFailureType.SDK);
9319
+ notifyAuthFailure(exports.AuthFailureType.SDK);
9318
9320
  });
9319
9321
  return authPromise;
9320
9322
  };
@@ -9346,7 +9348,11 @@
9346
9348
  * @returns authPromise Promise which resolves when authentication is complete.
9347
9349
  */
9348
9350
  const init = (embedConfig) => {
9349
- config = { ...CONFIG_DEFAULTS, ...embedConfig };
9351
+ config = {
9352
+ ...CONFIG_DEFAULTS,
9353
+ ...embedConfig,
9354
+ thoughtSpotHost: getThoughtSpotHost(embedConfig),
9355
+ };
9350
9356
  authEE = new eventemitter3();
9351
9357
  handleAuth();
9352
9358
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
@@ -9358,8 +9364,17 @@
9358
9364
  }
9359
9365
  return authEE;
9360
9366
  };
9361
- const logout$1 = () => {
9362
- return logout(config);
9367
+ function disableAutoLogin() {
9368
+ config.autoLogin = false;
9369
+ }
9370
+ const logout$1 = (doNotDisableAutoLogin = false) => {
9371
+ if (!doNotDisableAutoLogin) {
9372
+ disableAutoLogin();
9373
+ }
9374
+ return logout(config).then((isLoggedIn) => {
9375
+ notifyLogout();
9376
+ return isLoggedIn;
9377
+ });
9363
9378
  };
9364
9379
  let renderQueue = Promise.resolve();
9365
9380
  /**
@@ -9459,7 +9474,7 @@
9459
9474
  if (autoLogin) {
9460
9475
  handleAuth();
9461
9476
  }
9462
- notifyAuthFailure(AuthFailureType.EXPIRY);
9477
+ notifyAuthFailure(exports.AuthFailureType.EXPIRY);
9463
9478
  return e;
9464
9479
  }
9465
9480
  function processNoCookieAccess(e, containerEl) {
@@ -9470,14 +9485,22 @@
9470
9485
  }
9471
9486
  // eslint-disable-next-line no-param-reassign
9472
9487
  containerEl.innerHTML = loginFailedMessage;
9473
- notifyAuthFailure(AuthFailureType.NO_COOKIE_ACCESS);
9488
+ notifyAuthFailure(exports.AuthFailureType.NO_COOKIE_ACCESS);
9474
9489
  return e;
9475
9490
  }
9476
9491
  function processAuthFailure(e, containerEl) {
9477
9492
  const { loginFailedMessage } = getEmbedConfig();
9478
9493
  // eslint-disable-next-line no-param-reassign
9479
9494
  containerEl.innerHTML = loginFailedMessage;
9480
- notifyAuthFailure(AuthFailureType.OTHER);
9495
+ notifyAuthFailure(exports.AuthFailureType.OTHER);
9496
+ return e;
9497
+ }
9498
+ function processAuthLogout(e, containerEl) {
9499
+ const { loginFailedMessage } = getEmbedConfig();
9500
+ // eslint-disable-next-line no-param-reassign
9501
+ containerEl.innerHTML = loginFailedMessage;
9502
+ disableAutoLogin();
9503
+ notifyLogout();
9481
9504
  return e;
9482
9505
  }
9483
9506
  function processEventData(type, e, thoughtSpotHost, containerEl) {
@@ -9492,6 +9515,8 @@
9492
9515
  return processNoCookieAccess(e, containerEl);
9493
9516
  case exports.EmbedEvent.AuthFailure:
9494
9517
  return processAuthFailure(e, containerEl);
9518
+ case exports.EmbedEvent.AuthLogout:
9519
+ return processAuthLogout(e, containerEl);
9495
9520
  }
9496
9521
  return e;
9497
9522
  }
@@ -9520,7 +9545,7 @@
9520
9545
  }
9521
9546
  }
9522
9547
 
9523
- var name="@thoughtspot/visual-embed-sdk";var version="1.11.0-auth.11";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};
9548
+ var name="@thoughtspot/visual-embed-sdk";var version="1.11.0-auth.14";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};
9524
9549
 
9525
9550
  /**
9526
9551
  * Copyright (c) 2022
@@ -9782,7 +9807,7 @@
9782
9807
  this.iFrame.mozallowfullscreen = true;
9783
9808
  const { height: frameHeight, width: frameWidth, ...restParams } = frameOptions;
9784
9809
  const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
9785
- const height = getCssDimension(frameWidth || DEFAULT_EMBED_HEIGHT);
9810
+ const height = getCssDimension(frameHeight || DEFAULT_EMBED_HEIGHT);
9786
9811
  setAttributes(this.iFrame, restParams);
9787
9812
  this.iFrame.style.width = `${width}`;
9788
9813
  this.iFrame.style.height = `${height}`;
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.11.0-auth.11",
3
+ "version": "1.11.0-auth.14",
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
@@ -94,8 +94,8 @@ export const doTokenAuth = async (embedConfig) => {
94
94
  if (!authEndpoint && !getAuthToken) {
95
95
  throw new Error('Either auth endpoint or getAuthToken function must be provided');
96
96
  }
97
- const loggedIn = await isLoggedIn(thoughtSpotHost);
98
- if (!loggedIn) {
97
+ loggedInStatus = await isLoggedIn(thoughtSpotHost);
98
+ if (!loggedInStatus) {
99
99
  let authToken = null;
100
100
  if (getAuthToken) {
101
101
  authToken = await getAuthToken();
@@ -109,9 +109,6 @@ export const doTokenAuth = async (embedConfig) => {
109
109
  // token login issues a 302 when successful
110
110
  loggedInStatus = resp.ok || resp.type === 'opaqueredirect';
111
111
  }
112
- else {
113
- loggedInStatus = true;
114
- }
115
112
  return loggedInStatus;
116
113
  };
117
114
  /**
@@ -182,6 +179,7 @@ const doSSOAuth = async (embedConfig, ssoEndPoint) => {
182
179
  const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
183
180
  if (embedConfig.noRedirect) {
184
181
  await samlPopupFlow(ssoURL);
182
+ loggedInStatus = true;
185
183
  return;
186
184
  }
187
185
  window.location.href = ssoURL;
@@ -213,9 +211,7 @@ export const doOIDCAuth = async (embedConfig) => {
213
211
  export const logout = async (embedConfig) => {
214
212
  const { thoughtSpotHost } = embedConfig;
215
213
  const response = await fetchLogoutService(thoughtSpotHost);
216
- if (response.ok || response.status === 401) {
217
- loggedInStatus = false;
218
- }
214
+ loggedInStatus = false;
219
215
  return loggedInStatus;
220
216
  };
221
217
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAe,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC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