@thoughtspot/visual-embed-sdk 1.29.0-alpha.fullH → 1.29.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.
- package/README.md +1 -1
- package/cjs/package.json +2 -1
- package/cjs/src/auth.d.ts +0 -15
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +2 -13
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/authToken.d.ts +1 -2
- package/cjs/src/authToken.d.ts.map +1 -1
- package/cjs/src/authToken.js +9 -3
- package/cjs/src/authToken.js.map +1 -1
- package/cjs/src/authToken.spec.d.ts +2 -0
- package/cjs/src/authToken.spec.d.ts.map +1 -0
- package/cjs/src/authToken.spec.js +29 -0
- package/cjs/src/authToken.spec.js.map +1 -0
- package/cjs/src/config.d.ts +0 -1
- package/cjs/src/config.d.ts.map +1 -1
- package/cjs/src/config.js +0 -2
- package/cjs/src/config.js.map +1 -1
- package/cjs/src/embed/app.d.ts +73 -43
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +45 -12
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +21 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/base.d.ts +1 -7
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +7 -15
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/base.spec.js +1 -1
- package/cjs/src/embed/base.spec.js.map +1 -1
- package/cjs/src/embed/embedConfig.d.ts +0 -2
- package/cjs/src/embed/embedConfig.d.ts.map +1 -1
- package/cjs/src/embed/embedConfig.js +0 -2
- package/cjs/src/embed/embedConfig.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +14 -28
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +9 -9
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +79 -4
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +5 -21
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +2 -23
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/sage.spec.js +20 -31
- package/cjs/src/embed/sage.spec.js.map +1 -1
- package/cjs/src/embed/search-bar.d.ts +0 -11
- package/cjs/src/embed/search-bar.d.ts.map +1 -1
- package/cjs/src/embed/search-bar.js +0 -2
- package/cjs/src/embed/search-bar.js.map +1 -1
- package/cjs/src/embed/search.d.ts +60 -29
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +43 -9
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/search.spec.js +34 -0
- package/cjs/src/embed/search.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +1 -31
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +34 -43
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +83 -9
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/errors.js +1 -1
- package/cjs/src/errors.js.map +1 -1
- package/cjs/src/index.d.ts +0 -1
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +0 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts +0 -1
- package/cjs/src/mixpanel-service.d.ts.map +1 -1
- package/cjs/src/mixpanel-service.js +0 -1
- package/cjs/src/mixpanel-service.js.map +1 -1
- package/cjs/src/react/index.d.ts +1 -12
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +1 -11
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +15 -3
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/test/test-utils.d.ts +0 -2
- package/cjs/src/test/test-utils.d.ts.map +1 -1
- package/cjs/src/test/test-utils.js +0 -2
- package/cjs/src/test/test-utils.js.map +1 -1
- package/cjs/src/tokenizedFetch.d.ts +0 -1
- package/cjs/src/tokenizedFetch.d.ts.map +1 -1
- package/cjs/src/tokenizedFetch.js +0 -1
- package/cjs/src/tokenizedFetch.js.map +1 -1
- package/cjs/src/types.d.ts +245 -366
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +196 -296
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/authService/authService.d.ts +0 -1
- package/cjs/src/utils/authService/authService.d.ts.map +1 -1
- package/cjs/src/utils/authService/authService.js +0 -1
- package/cjs/src/utils/authService/authService.js.map +1 -1
- package/cjs/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
- package/cjs/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
- package/cjs/src/utils/authService/tokenizedAuthService.spec.js +32 -0
- package/cjs/src/utils/authService/tokenizedAuthService.spec.js.map +1 -0
- package/cjs/src/utils/graphql/answerService/answer-queries.d.ts +2 -0
- package/cjs/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
- package/cjs/src/utils/graphql/answerService/answer-queries.js +57 -1
- package/cjs/src/utils/graphql/answerService/answer-queries.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.d.ts +37 -12
- package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.js +70 -14
- package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.spec.js +78 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/cjs/src/utils/logger.d.ts.map +1 -1
- package/cjs/src/utils/logger.js +3 -5
- package/cjs/src/utils/logger.js.map +1 -1
- package/cjs/src/utils/processData.js +1 -1
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +1 -1
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils/processTrigger.d.ts +0 -1
- package/cjs/src/utils/processTrigger.d.ts.map +1 -1
- package/cjs/src/utils/processTrigger.js +0 -2
- package/cjs/src/utils/processTrigger.js.map +1 -1
- package/cjs/src/utils/sessionInfoService.d.ts +2 -2
- package/cjs/src/utils/sessionInfoService.d.ts.map +1 -1
- package/cjs/src/utils/sessionInfoService.js +4 -4
- package/cjs/src/utils/sessionInfoService.js.map +1 -1
- package/cjs/src/utils.d.ts +2 -10
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +19 -13
- package/cjs/src/utils.js.map +1 -1
- package/dist/src/auth.d.ts +0 -15
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/authToken.d.ts +1 -2
- package/dist/src/authToken.d.ts.map +1 -1
- package/dist/src/authToken.spec.d.ts +2 -0
- package/dist/src/authToken.spec.d.ts.map +1 -0
- package/dist/src/config.d.ts +0 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +73 -43
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +1 -7
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/embedConfig.d.ts +0 -2
- package/dist/src/embed/embedConfig.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +14 -28
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +5 -21
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +0 -11
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +60 -29
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +1 -31
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts +0 -1
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +1 -12
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/test/test-utils.d.ts +0 -2
- package/dist/src/test/test-utils.d.ts.map +1 -1
- package/dist/src/tokenizedFetch.d.ts +0 -1
- package/dist/src/tokenizedFetch.d.ts.map +1 -1
- package/dist/src/types.d.ts +245 -366
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/authService/authService.d.ts +0 -1
- package/dist/src/utils/authService/authService.d.ts.map +1 -1
- package/dist/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
- package/dist/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
- package/dist/src/utils/graphql/answerService/answer-queries.d.ts +2 -0
- package/dist/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
- package/dist/src/utils/graphql/answerService/answerService.d.ts +37 -12
- package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/dist/src/utils/logger.d.ts.map +1 -1
- package/dist/src/utils/processTrigger.d.ts +0 -1
- package/dist/src/utils/processTrigger.d.ts.map +1 -1
- package/dist/src/utils/sessionInfoService.d.ts +66 -0
- package/dist/src/utils/sessionInfoService.d.ts.map +1 -0
- package/dist/src/utils.d.ts +2 -10
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +2331 -2358
- package/dist/tsembed-react.js +3475 -3498
- package/dist/tsembed.es.js +3688 -3922
- package/dist/tsembed.js +15216 -15442
- package/dist/visual-embed-sdk-react-full.d.ts +431 -564
- package/dist/visual-embed-sdk-react.d.ts +434 -567
- package/dist/visual-embed-sdk.d.ts +430 -552
- package/lib/package.json +2 -1
- package/lib/src/auth.d.ts +0 -15
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +3 -14
- package/lib/src/auth.js.map +1 -1
- package/lib/src/authToken.d.ts +1 -2
- package/lib/src/authToken.d.ts.map +1 -1
- package/lib/src/authToken.js +9 -3
- package/lib/src/authToken.js.map +1 -1
- package/lib/src/authToken.spec.d.ts +2 -0
- package/lib/src/authToken.spec.d.ts.map +1 -0
- package/lib/src/authToken.spec.js +26 -0
- package/lib/src/authToken.spec.js.map +1 -0
- package/lib/src/config.d.ts +0 -1
- package/lib/src/config.d.ts.map +1 -1
- package/lib/src/config.js +0 -2
- package/lib/src/config.js.map +1 -1
- package/lib/src/embed/app.d.ts +73 -43
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +44 -11
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +22 -1
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +1 -7
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +6 -14
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +2 -2
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/embedConfig.d.ts +0 -2
- package/lib/src/embed/embedConfig.d.ts.map +1 -1
- package/lib/src/embed/embedConfig.js +0 -2
- package/lib/src/embed/embedConfig.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +14 -28
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +10 -10
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +79 -4
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/sage.d.ts +5 -21
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +2 -23
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/sage.spec.js +20 -31
- package/lib/src/embed/sage.spec.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts +0 -11
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +0 -2
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts +60 -29
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +43 -9
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +35 -1
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +1 -31
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +37 -46
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +83 -9
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.js +1 -1
- package/lib/src/errors.js.map +1 -1
- package/lib/src/index.d.ts +0 -1
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +0 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts +0 -1
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +0 -1
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/react/index.d.ts +1 -12
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +1 -11
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +16 -4
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/test/test-utils.d.ts +0 -2
- package/lib/src/test/test-utils.d.ts.map +1 -1
- package/lib/src/test/test-utils.js +0 -2
- package/lib/src/test/test-utils.js.map +1 -1
- package/lib/src/tokenizedFetch.d.ts +0 -1
- package/lib/src/tokenizedFetch.d.ts.map +1 -1
- package/lib/src/tokenizedFetch.js +0 -1
- package/lib/src/tokenizedFetch.js.map +1 -1
- package/lib/src/types.d.ts +245 -366
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +196 -296
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/authService/authService.d.ts +0 -1
- package/lib/src/utils/authService/authService.d.ts.map +1 -1
- package/lib/src/utils/authService/authService.js +0 -1
- package/lib/src/utils/authService/authService.js.map +1 -1
- package/lib/src/utils/authService/authService.spec.js +1 -1
- package/lib/src/utils/authService/authService.spec.js.map +1 -1
- package/lib/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
- package/lib/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
- package/lib/src/utils/authService/tokenizedAuthService.spec.js +29 -0
- package/lib/src/utils/authService/tokenizedAuthService.spec.js.map +1 -0
- package/lib/src/utils/graphql/answerService/answer-queries.d.ts +2 -0
- package/lib/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
- package/lib/src/utils/graphql/answerService/answer-queries.js +56 -0
- package/lib/src/utils/graphql/answerService/answer-queries.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.d.ts +37 -12
- package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.js +71 -15
- package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.spec.js +80 -2
- package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/lib/src/utils/logger.d.ts.map +1 -1
- package/lib/src/utils/logger.js +2 -3
- package/lib/src/utils/logger.js.map +1 -1
- package/lib/src/utils/processData.js +1 -1
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +1 -1
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +0 -1
- package/lib/src/utils/processTrigger.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.js +0 -2
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils/sessionInfoService.d.ts +2 -2
- package/lib/src/utils/sessionInfoService.d.ts.map +1 -1
- package/lib/src/utils/sessionInfoService.js +2 -2
- package/lib/src/utils/sessionInfoService.js.map +1 -1
- package/lib/src/utils.d.ts +2 -10
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +17 -12
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +436 -558
- package/package.json +2 -1
- package/src/auth.ts +6 -23
- package/src/authToken.spec.ts +31 -0
- package/src/authToken.ts +9 -3
- package/src/config.ts +0 -2
- package/src/embed/app.spec.ts +37 -1
- package/src/embed/app.ts +108 -50
- package/src/embed/base.spec.ts +3 -3
- package/src/embed/base.ts +15 -22
- package/src/embed/embedConfig.ts +0 -2
- package/src/embed/liveboard.spec.ts +104 -9
- package/src/embed/liveboard.ts +26 -39
- package/src/embed/sage.spec.ts +20 -35
- package/src/embed/sage.ts +5 -38
- package/src/embed/search-bar.tsx +0 -11
- package/src/embed/search.spec.ts +48 -1
- package/src/embed/search.ts +94 -38
- package/src/embed/ts-embed.spec.ts +109 -24
- package/src/embed/ts-embed.ts +68 -78
- package/src/errors.ts +1 -1
- package/src/index.ts +0 -1
- package/src/mixpanel-service.ts +0 -1
- package/src/react/index.spec.tsx +48 -60
- package/src/react/index.tsx +1 -12
- package/src/test/test-utils.ts +0 -2
- package/src/tokenizedFetch.ts +0 -1
- package/src/types.ts +245 -365
- package/src/utils/authService/authService.spec.ts +4 -4
- package/src/utils/authService/authService.ts +0 -1
- package/src/utils/graphql/answerService/answer-queries.ts +58 -0
- package/src/utils/graphql/answerService/answerService.spec.ts +88 -2
- package/src/utils/graphql/answerService/answerService.ts +87 -16
- package/src/utils/logger.ts +2 -3
- package/src/utils/processData.spec.ts +1 -1
- package/src/utils/processData.ts +1 -1
- package/src/utils/processTrigger.ts +0 -2
- package/src/utils.ts +21 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thoughtspot/visual-embed-sdk",
|
|
3
|
-
"version": "1.29.0
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"description": "ThoughtSpot Embed SDK",
|
|
5
5
|
"module": "lib/src/index.js",
|
|
6
6
|
"main": "dist/tsembed.js",
|
|
@@ -175,6 +175,7 @@
|
|
|
175
175
|
"keywords": [
|
|
176
176
|
"thoughtspot",
|
|
177
177
|
"everywhere",
|
|
178
|
+
"embedded",
|
|
178
179
|
"embed",
|
|
179
180
|
"sdk",
|
|
180
181
|
"analytics"
|
package/src/auth.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import EventEmitter from 'eventemitter3';
|
|
2
|
+
import { getAuthenticationToken, resetCachedAuthToken } from './authToken';
|
|
2
3
|
import { initMixpanel } from './mixpanel-service';
|
|
3
4
|
import {
|
|
4
|
-
AuthType, DOMSelector, EmbedConfig, EmbedEvent,
|
|
5
|
+
AuthType, DOMSelector, EmbedConfig, EmbedEvent,
|
|
5
6
|
} from './types';
|
|
6
7
|
import { getDOMNode, getRedirectUrl } from './utils';
|
|
7
8
|
import {
|
|
8
|
-
|
|
9
|
+
EndPoints,
|
|
10
|
+
fetchAuthPostService,
|
|
9
11
|
fetchAuthService,
|
|
10
12
|
fetchBasicAuthService,
|
|
11
13
|
fetchLogoutService,
|
|
12
|
-
|
|
13
|
-
EndPoints,
|
|
14
|
+
fetchSessionInfoService,
|
|
14
15
|
} from './utils/authService';
|
|
15
|
-
import { getAuthenticationToken, resetCachedAuthToken } from './authToken';
|
|
16
16
|
import { logger } from './utils/logger';
|
|
17
17
|
import { getEmbedConfig } from './embed/embedConfig';
|
|
18
18
|
|
|
@@ -41,7 +41,6 @@ interface sessionInfoInterface {
|
|
|
41
41
|
/**
|
|
42
42
|
* Enum for auth failure types. This is the parameter passed to the listner
|
|
43
43
|
* of {@link AuthStatus.FAILURE}.
|
|
44
|
-
*
|
|
45
44
|
* @group Authentication / Init
|
|
46
45
|
*/
|
|
47
46
|
export enum AuthFailureType {
|
|
@@ -53,7 +52,6 @@ export enum AuthFailureType {
|
|
|
53
52
|
|
|
54
53
|
/**
|
|
55
54
|
* Enum for auth status emitted by the emitter returned from {@link init}.
|
|
56
|
-
*
|
|
57
55
|
* @group Authentication / Init
|
|
58
56
|
*/
|
|
59
57
|
export enum AuthStatus {
|
|
@@ -77,7 +75,6 @@ export enum AuthStatus {
|
|
|
77
75
|
* Emitted when inPopup is true in the SAMLRedirect flow and the
|
|
78
76
|
* popup is waiting to be triggered either programmatically
|
|
79
77
|
* or by the trigger button.
|
|
80
|
-
*
|
|
81
78
|
* @version SDK: 1.19.0
|
|
82
79
|
*/
|
|
83
80
|
WAITING_FOR_POPUP = 'WAITING_FOR_POPUP',
|
|
@@ -85,20 +82,17 @@ export enum AuthStatus {
|
|
|
85
82
|
|
|
86
83
|
/**
|
|
87
84
|
* Event emitter returned from {@link init}.
|
|
88
|
-
*
|
|
89
85
|
* @group Authentication / Init
|
|
90
86
|
*/
|
|
91
87
|
export interface AuthEventEmitter {
|
|
92
88
|
/**
|
|
93
89
|
* Register a listener on Auth failure.
|
|
94
|
-
*
|
|
95
90
|
* @param event
|
|
96
91
|
* @param listener
|
|
97
92
|
*/
|
|
98
93
|
on(event: AuthStatus.FAILURE, listener: (failureType: AuthFailureType) => void): this;
|
|
99
94
|
/**
|
|
100
95
|
* Register a listener on Auth SDK success.
|
|
101
|
-
*
|
|
102
96
|
* @param event
|
|
103
97
|
* @param listener
|
|
104
98
|
*/
|
|
@@ -115,13 +109,11 @@ export interface AuthEventEmitter {
|
|
|
115
109
|
once(event: AuthStatus.SUCCESS, listener: (sessionInfo: any) => void): this;
|
|
116
110
|
/**
|
|
117
111
|
* Trigger an event on the emitter returned from init.
|
|
118
|
-
*
|
|
119
112
|
* @param {@link AuthEvent}
|
|
120
113
|
*/
|
|
121
114
|
emit(event: AuthEvent, ...args: any[]): boolean;
|
|
122
115
|
/**
|
|
123
116
|
* Remove listener from the emitter returned from init.
|
|
124
|
-
*
|
|
125
117
|
* @param event
|
|
126
118
|
* @param listener
|
|
127
119
|
* @param context
|
|
@@ -130,7 +122,6 @@ export interface AuthEventEmitter {
|
|
|
130
122
|
off(event: AuthStatus, listener: (...args: any[]) => void, context: any, once: boolean): this;
|
|
131
123
|
/**
|
|
132
124
|
* Remove all the event listeners
|
|
133
|
-
*
|
|
134
125
|
* @param event
|
|
135
126
|
*/
|
|
136
127
|
removeAllListeners(event: AuthStatus): this;
|
|
@@ -138,7 +129,6 @@ export interface AuthEventEmitter {
|
|
|
138
129
|
|
|
139
130
|
/**
|
|
140
131
|
* Events which can be triggered on the emitter returned from {@link init}.
|
|
141
|
-
*
|
|
142
132
|
* @group Authentication / Init
|
|
143
133
|
*/
|
|
144
134
|
export enum AuthEvent {
|
|
@@ -241,7 +231,6 @@ export const getSessionDetails = (sessionInfoResp: any): sessionInfoInterface =>
|
|
|
241
231
|
|
|
242
232
|
/**
|
|
243
233
|
* Check if we are logged into the ThoughtSpot cluster
|
|
244
|
-
*
|
|
245
234
|
* @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
|
|
246
235
|
*/
|
|
247
236
|
async function isLoggedIn(thoughtSpotHost: string): Promise<boolean> {
|
|
@@ -270,7 +259,6 @@ export function getReleaseVersion() {
|
|
|
270
259
|
/**
|
|
271
260
|
* Return a promise that resolves with the session information when
|
|
272
261
|
* authentication is successful. And info is available.
|
|
273
|
-
*
|
|
274
262
|
* @group Global methods
|
|
275
263
|
*/
|
|
276
264
|
export function getSessionInfo(): Promise<sessionInfoInterface> {
|
|
@@ -298,7 +286,6 @@ function removeSSORedirectUrlMarker(): void {
|
|
|
298
286
|
|
|
299
287
|
/**
|
|
300
288
|
* Perform token based authentication
|
|
301
|
-
*
|
|
302
289
|
* @param embedConfig The embed configuration
|
|
303
290
|
*/
|
|
304
291
|
export const doTokenAuth = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
|
@@ -330,7 +317,6 @@ export const doTokenAuth = async (embedConfig: EmbedConfig): Promise<boolean> =>
|
|
|
330
317
|
|
|
331
318
|
/**
|
|
332
319
|
* Validate embedConfig parameters required for cookielessTokenAuth
|
|
333
|
-
*
|
|
334
320
|
* @param embedConfig The embed configuration
|
|
335
321
|
*/
|
|
336
322
|
export const doCookielessTokenAuth = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
|
@@ -357,7 +343,6 @@ export const doCookielessTokenAuth = async (embedConfig: EmbedConfig): Promise<b
|
|
|
357
343
|
*
|
|
358
344
|
* Warning: This feature is primarily intended for developer testing. It is
|
|
359
345
|
* strongly advised not to use this authentication method in production.
|
|
360
|
-
*
|
|
361
346
|
* @param embedConfig The embed configuration
|
|
362
347
|
*/
|
|
363
348
|
export const doBasicAuth = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
|
@@ -417,7 +402,6 @@ async function samlPopupFlow(ssoURL: string, triggerContainer: DOMSelector, trig
|
|
|
417
402
|
|
|
418
403
|
/**
|
|
419
404
|
* Perform SAML authentication
|
|
420
|
-
*
|
|
421
405
|
* @param embedConfig The embed configuration
|
|
422
406
|
* @param ssoEndPoint
|
|
423
407
|
*/
|
|
@@ -492,7 +476,7 @@ export const logout = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
|
|
492
476
|
const { thoughtSpotHost } = embedConfig;
|
|
493
477
|
await fetchLogoutService(thoughtSpotHost);
|
|
494
478
|
resetCachedAuthToken();
|
|
495
|
-
const thoughtspotIframes = document.querySelectorAll(
|
|
479
|
+
const thoughtspotIframes = document.querySelectorAll("[data-ts-iframe='true']");
|
|
496
480
|
if (thoughtspotIframes?.length) {
|
|
497
481
|
thoughtspotIframes.forEach((el) => {
|
|
498
482
|
el.parentElement.innerHTML = embedConfig.loginFailedMessage;
|
|
@@ -504,7 +488,6 @@ export const logout = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
|
|
504
488
|
|
|
505
489
|
/**
|
|
506
490
|
* Perform authentication on the ThoughtSpot cluster
|
|
507
|
-
*
|
|
508
491
|
* @param embedConfig The embed configuration
|
|
509
492
|
*/
|
|
510
493
|
export const authenticate = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getAuthenticationToken, resetCachedAuthToken } from './authToken';
|
|
2
|
+
import * as authServiceInstance from './utils/authService/authService';
|
|
3
|
+
import { EmbedConfig } from './types';
|
|
4
|
+
|
|
5
|
+
describe('AuthToken Unit tests', () => {
|
|
6
|
+
test('getAuthenticationToken: When verification is disabled', async () => {
|
|
7
|
+
jest.spyOn(authServiceInstance, 'verifyTokenService');
|
|
8
|
+
|
|
9
|
+
const token = await getAuthenticationToken({
|
|
10
|
+
getAuthToken: async () => 'abc3',
|
|
11
|
+
disableTokenVerification: true,
|
|
12
|
+
} as EmbedConfig);
|
|
13
|
+
|
|
14
|
+
expect(token).toBe('abc3');
|
|
15
|
+
expect(authServiceInstance.verifyTokenService).not.toBeCalled();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test.only('getAuthenticationToken: When verification is enabled', async () => {
|
|
19
|
+
resetCachedAuthToken();
|
|
20
|
+
jest.clearAllMocks();
|
|
21
|
+
jest.spyOn(authServiceInstance, 'verifyTokenService').mockImplementation(() => true);
|
|
22
|
+
const token = await getAuthenticationToken({
|
|
23
|
+
thoughtSpotHost: 'test',
|
|
24
|
+
getAuthToken: async () => 'abc2',
|
|
25
|
+
disableTokenVerification: false,
|
|
26
|
+
} as EmbedConfig);
|
|
27
|
+
|
|
28
|
+
expect(token).toBe('abc2');
|
|
29
|
+
expect(authServiceInstance.verifyTokenService).toBeCalledWith('test', 'abc2');
|
|
30
|
+
});
|
|
31
|
+
});
|
package/src/authToken.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EmbedConfig } from './types';
|
|
2
2
|
import { fetchAuthTokenService, verifyTokenService } from './utils/authService/authService';
|
|
3
|
+
import { logger } from './utils/logger';
|
|
3
4
|
|
|
4
5
|
const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every time getAuthToken callback is called.'
|
|
5
6
|
+ 'See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.';
|
|
@@ -10,7 +11,9 @@ let cachedAuthToken: string | null = null;
|
|
|
10
11
|
|
|
11
12
|
// This method can be used to get the authToken using the embedConfig
|
|
12
13
|
export const getAuthenticationToken = async (embedConfig: EmbedConfig): Promise<string> => {
|
|
13
|
-
if
|
|
14
|
+
// Since we don't have token validation enabled , we cannot tell if the
|
|
15
|
+
// cached token is valid or not. So we will always fetch a new token.
|
|
16
|
+
if (cachedAuthToken && !embedConfig.disableTokenVerification) {
|
|
14
17
|
let isCachedTokenStillValid;
|
|
15
18
|
try {
|
|
16
19
|
isCachedTokenStillValid = await validateAuthToken(embedConfig, cachedAuthToken, true);
|
|
@@ -43,6 +46,10 @@ const validateAuthToken = async (
|
|
|
43
46
|
authToken: string,
|
|
44
47
|
suppressAlert?: boolean,
|
|
45
48
|
): Promise<boolean> => {
|
|
49
|
+
if (embedConfig.disableTokenVerification) {
|
|
50
|
+
logger.info('Token verification is disabled. Assuming token is valid.');
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
46
53
|
try {
|
|
47
54
|
const isTokenValid = await verifyTokenService(embedConfig.thoughtSpotHost, authToken);
|
|
48
55
|
if (isTokenValid) return true;
|
|
@@ -63,12 +70,11 @@ const validateAuthToken = async (
|
|
|
63
70
|
|
|
64
71
|
/**
|
|
65
72
|
* Resets the auth token and a new token will be fetched on the next request.
|
|
66
|
-
*
|
|
67
73
|
* @example
|
|
68
74
|
* ```js
|
|
69
75
|
* resetCachedAuthToken();
|
|
70
76
|
* ```
|
|
71
|
-
* @version SDK: 1.28.
|
|
77
|
+
* @version SDK: 1.28.2 | ThoughtSpot: *
|
|
72
78
|
* @group Authentication / Init
|
|
73
79
|
*/
|
|
74
80
|
export const resetCachedAuthToken = (): void => {
|
package/src/config.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { EmbedConfig } from './types';
|
|
|
5
5
|
* Copyright (c) 2023
|
|
6
6
|
*
|
|
7
7
|
* Utilities related to reading configuration objects
|
|
8
|
-
*
|
|
9
8
|
* @summary Config-related utils
|
|
10
9
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
11
10
|
*/
|
|
@@ -23,7 +22,6 @@ const urlRegex = new RegExp(
|
|
|
23
22
|
/**
|
|
24
23
|
* Parse and construct the ThoughtSpot hostname or IP address
|
|
25
24
|
* from the embed configuration object.
|
|
26
|
-
*
|
|
27
25
|
* @param config
|
|
28
26
|
*/
|
|
29
27
|
export const getThoughtSpotHost = (config: EmbedConfig): string => {
|
package/src/embed/app.spec.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AppEmbed,
|
|
3
|
+
AppViewConfig,
|
|
4
|
+
DataPanelCustomColumnGroupsAccordionState,
|
|
5
|
+
Page,
|
|
6
|
+
} from './app';
|
|
2
7
|
import { init } from '../index';
|
|
3
8
|
import {
|
|
4
9
|
Action, AuthType, EmbedEvent, HostEvent, RuntimeFilterOp,
|
|
@@ -289,6 +294,21 @@ describe('App embed tests', () => {
|
|
|
289
294
|
});
|
|
290
295
|
});
|
|
291
296
|
|
|
297
|
+
test('should set enable2ColumnLayout to true in url', async () => {
|
|
298
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
299
|
+
...defaultViewConfig,
|
|
300
|
+
enable2ColumnLayout: true,
|
|
301
|
+
} as AppViewConfig);
|
|
302
|
+
|
|
303
|
+
appEmbed.render();
|
|
304
|
+
await executeAfterWait(() => {
|
|
305
|
+
expectUrlMatchesWithParams(
|
|
306
|
+
getIFrameSrc(),
|
|
307
|
+
`http://${thoughtSpotHost}/?embedApp=true&profileAndHelpInNavBarHidden=false&enable2ColumnLayout=true${defaultParamsPost}#/home`,
|
|
308
|
+
);
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
|
|
292
312
|
test('Should add the tag to the iframe src', async () => {
|
|
293
313
|
const appEmbed = new AppEmbed(getRootEl(), {
|
|
294
314
|
...defaultViewConfig,
|
|
@@ -409,6 +429,22 @@ describe('App embed tests', () => {
|
|
|
409
429
|
});
|
|
410
430
|
});
|
|
411
431
|
|
|
432
|
+
test('Should add dataPanelCustomGroupsAccordionInitialState flag to the iframe src', async () => {
|
|
433
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
434
|
+
...defaultViewConfig,
|
|
435
|
+
// eslint-disable-next-line max-len
|
|
436
|
+
dataPanelCustomGroupsAccordionInitialState: DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST,
|
|
437
|
+
} as AppViewConfig);
|
|
438
|
+
|
|
439
|
+
appEmbed.render();
|
|
440
|
+
await executeAfterWait(() => {
|
|
441
|
+
expectUrlMatchesWithParams(
|
|
442
|
+
getIFrameSrc(),
|
|
443
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_FIRST${defaultParams}${defaultParamsPost}#/home`,
|
|
444
|
+
);
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
|
|
412
448
|
test('should register event handlers to adjust iframe height', async () => {
|
|
413
449
|
const onSpy = jest.spyOn(AppEmbed.prototype, 'on')
|
|
414
450
|
.mockImplementation((event, callback) => {
|