@thoughtspot/visual-embed-sdk 1.29.1-alpha.0 → 1.29.1
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 +9 -15
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/base.spec.js +3 -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/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.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/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.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 +3690 -3922
- package/dist/tsembed.js +15218 -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 +8 -14
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +4 -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/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.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 +3 -1
- package/src/auth.spec.ts +72 -66
- package/src/auth.ts +53 -54
- package/src/authToken.spec.ts +31 -0
- package/src/authToken.ts +12 -12
- package/src/config.ts +0 -2
- package/src/embed/app.spec.ts +39 -5
- package/src/embed/app.ts +108 -50
- package/src/embed/base.spec.ts +5 -4
- package/src/embed/base.ts +30 -36
- package/src/embed/embed.spec.ts +0 -2
- package/src/embed/embedConfig.ts +0 -2
- package/src/embed/events.spec.ts +0 -2
- package/src/embed/liveboard.spec.ts +104 -11
- package/src/embed/liveboard.ts +25 -38
- package/src/embed/pinboard.spec.ts +0 -2
- package/src/embed/sage.spec.ts +20 -38
- package/src/embed/sage.ts +5 -38
- package/src/embed/search-bar.tsx +0 -11
- package/src/embed/search.spec.ts +48 -2
- package/src/embed/search.ts +94 -38
- package/src/embed/ts-embed-trigger.spec.ts +0 -3
- package/src/embed/ts-embed.spec.ts +109 -32
- package/src/embed/ts-embed.ts +68 -79
- package/src/errors.ts +1 -1
- package/src/index.ts +1 -3
- package/src/mixpanel-service.spec.ts +3 -4
- package/src/mixpanel-service.ts +1 -4
- package/src/react/index.spec.tsx +48 -67
- package/src/react/index.tsx +1 -13
- 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 +8 -13
- package/src/utils/authService/authService.ts +0 -2
- package/src/utils/authService/tokenizedAuthService.ts +8 -38
- 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 +3 -4
- package/src/utils/processData.ts +4 -2
- package/src/utils/processTrigger.ts +0 -2
- package/src/utils.ts +21 -13
- package/cjs/src/utils/sessionInfoService.d.ts +0 -66
- package/cjs/src/utils/sessionInfoService.d.ts.map +0 -1
- package/cjs/src/utils/sessionInfoService.js +0 -92
- package/cjs/src/utils/sessionInfoService.js.map +0 -1
- package/lib/src/utils/sessionInfoService.d.ts +0 -66
- package/lib/src/utils/sessionInfoService.d.ts.map +0 -1
- package/lib/src/utils/sessionInfoService.js +0 -85
- package/lib/src/utils/sessionInfoService.js.map +0 -1
- package/src/utils/sessionInfoService.ts +0 -101
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
EndPoints,
|
|
3
|
+
fetchAuthPostService,
|
|
4
4
|
fetchAuthService,
|
|
5
|
+
fetchAuthTokenService,
|
|
5
6
|
fetchBasicAuthService,
|
|
6
|
-
|
|
7
|
+
fetchSessionInfoService,
|
|
7
8
|
verifyTokenService,
|
|
8
|
-
EndPoints,
|
|
9
9
|
} from '.';
|
|
10
10
|
import { logger } from '../logger';
|
|
11
11
|
|
|
@@ -26,10 +26,9 @@ describe('Unit test for authService', () => {
|
|
|
26
26
|
status: 200,
|
|
27
27
|
ok: true,
|
|
28
28
|
}));
|
|
29
|
-
const response = await fetchSessionInfoService(
|
|
30
|
-
expect(response.
|
|
29
|
+
const response = await fetchSessionInfoService(authVerificationUrl);
|
|
30
|
+
expect(response.status).toBe(200);
|
|
31
31
|
expect(fetch).toHaveBeenCalledTimes(1);
|
|
32
|
-
expect(fetch).toBeCalledWith(`${thoughtSpotHost}${EndPoints.SESSION_INFO}`, {});
|
|
33
32
|
});
|
|
34
33
|
|
|
35
34
|
test('fetchAuthTokenService', async () => {
|
|
@@ -109,12 +108,8 @@ describe('Unit test for authService', () => {
|
|
|
109
108
|
status: 500,
|
|
110
109
|
ok: false,
|
|
111
110
|
}));
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
} catch (e) {
|
|
115
|
-
expect(e.message).toContain('Failed to fetch session info');
|
|
116
|
-
}
|
|
117
|
-
expect(logger.error).toHaveBeenCalledWith('Failed to fetch http://localhost:3000/callosum/v1/session/info', 'error');
|
|
111
|
+
await fetchSessionInfoService(authVerificationUrl);
|
|
112
|
+
expect(logger.error).toHaveBeenCalledWith('Failure', 'error');
|
|
118
113
|
});
|
|
119
114
|
|
|
120
115
|
test('verifyTokenService', async () => {
|
|
@@ -2,7 +2,6 @@ import { logger } from '../logger';
|
|
|
2
2
|
|
|
3
3
|
export const EndPoints = {
|
|
4
4
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
5
|
-
SESSION_INFO: '/callosum/v1/session/info',
|
|
6
5
|
SAML_LOGIN_TEMPLATE: (targetUrl: string) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
7
6
|
OIDC_LOGIN_TEMPLATE: (targetUrl: string) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
8
7
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
@@ -29,7 +28,6 @@ function failureLoggedFetch(url: string, options: RequestInit = {}): Promise<Res
|
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
* Service to validate a auth token against a ThoughtSpot host.
|
|
32
|
-
*
|
|
33
31
|
* @param thoughtSpotHost : ThoughtSpot host to verify the token against.
|
|
34
32
|
* @param authToken : Auth token to verify.
|
|
35
33
|
*/
|
|
@@ -7,33 +7,23 @@ import { EndPoints } from './authService';
|
|
|
7
7
|
* @param url
|
|
8
8
|
* @param options
|
|
9
9
|
*/
|
|
10
|
-
function
|
|
10
|
+
function tokenisedFailureLoggedFetch(url: string, options: RequestInit = {}): Promise<Response> {
|
|
11
11
|
return tokenizedFetch(url, options).then(async (r) => {
|
|
12
12
|
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
13
|
-
logger.error(
|
|
13
|
+
logger.error('Failure', await r.text?.());
|
|
14
14
|
}
|
|
15
15
|
return r;
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Fetches the session info from the ThoughtSpot server.
|
|
21
20
|
*
|
|
22
|
-
* @param
|
|
23
|
-
* @returns {Promise<any>}
|
|
24
|
-
* @example
|
|
25
|
-
* ```js
|
|
26
|
-
* const response = await sessionInfoService();
|
|
27
|
-
* ```
|
|
21
|
+
* @param authVerificationUrl
|
|
28
22
|
*/
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
throw new Error(`Failed to fetch session info: ${response.statusText}`);
|
|
34
|
-
}
|
|
35
|
-
const data = await response.json();
|
|
36
|
-
return data;
|
|
23
|
+
export function fetchSessionInfoService(authVerificationUrl: string): Promise<any> {
|
|
24
|
+
return tokenisedFailureLoggedFetch(authVerificationUrl, {
|
|
25
|
+
credentials: 'include',
|
|
26
|
+
});
|
|
37
27
|
}
|
|
38
28
|
|
|
39
29
|
/**
|
|
@@ -41,7 +31,7 @@ export async function fetchSessionInfoService(thoughtspotHost: string): Promise<
|
|
|
41
31
|
* @param thoughtSpotHost
|
|
42
32
|
*/
|
|
43
33
|
export async function fetchLogoutService(thoughtSpotHost: string): Promise<any> {
|
|
44
|
-
return
|
|
34
|
+
return tokenisedFailureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
|
|
45
35
|
credentials: 'include',
|
|
46
36
|
method: 'POST',
|
|
47
37
|
headers: {
|
|
@@ -49,23 +39,3 @@ export async function fetchLogoutService(thoughtSpotHost: string): Promise<any>
|
|
|
49
39
|
},
|
|
50
40
|
});
|
|
51
41
|
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Is active service to check if the user is logged in.
|
|
55
|
-
*
|
|
56
|
-
* @param thoughtSpotHost
|
|
57
|
-
* @version SDK: 1.28.4 | ThoughtSpot: *
|
|
58
|
-
*/
|
|
59
|
-
export async function isActiveService(thoughtSpotHost: string): Promise<boolean> {
|
|
60
|
-
const isActiveUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
61
|
-
try {
|
|
62
|
-
const res = await tokenizedFetch(isActiveUrl, {
|
|
63
|
-
credentials: 'include',
|
|
64
|
-
});
|
|
65
|
-
return res.ok;
|
|
66
|
-
} catch (e) {
|
|
67
|
-
logger.warn(`Is Logged In Service failed : ${e.message}`);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
@@ -53,6 +53,64 @@ export const addColumns = `
|
|
|
53
53
|
}
|
|
54
54
|
`;
|
|
55
55
|
|
|
56
|
+
export const addFilter = `
|
|
57
|
+
mutation AddUpdateFilter($session: BachSessionIdInput!, $params: AddUpdateFilterInput!) {
|
|
58
|
+
Answer__addUpdateFilter(session: $session, params: $params) {
|
|
59
|
+
${bachSessionId}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
export const getAnswer = `
|
|
65
|
+
query GetAnswer($session: BachSessionIdInput!) {
|
|
66
|
+
getAnswer(session: $session) {
|
|
67
|
+
${bachSessionId}
|
|
68
|
+
answer {
|
|
69
|
+
id
|
|
70
|
+
sources {
|
|
71
|
+
header {
|
|
72
|
+
guid
|
|
73
|
+
displayName
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
filterGroups {
|
|
77
|
+
columnInfo {
|
|
78
|
+
name
|
|
79
|
+
referencedColumns {
|
|
80
|
+
guid
|
|
81
|
+
displayName
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
filters {
|
|
85
|
+
filterContent {
|
|
86
|
+
filterType
|
|
87
|
+
negate
|
|
88
|
+
value {
|
|
89
|
+
key
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
visualizations {
|
|
95
|
+
... on TableViz {
|
|
96
|
+
columns {
|
|
97
|
+
column {
|
|
98
|
+
id
|
|
99
|
+
name
|
|
100
|
+
referencedColumns {
|
|
101
|
+
guid
|
|
102
|
+
displayName
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
`;
|
|
113
|
+
|
|
56
114
|
export const getAnswerData = `
|
|
57
115
|
query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
|
|
58
116
|
getAnswer(session: $session) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'jest-fetch-mock';
|
|
2
|
-
import { AuthType, VizPoint } from '../../../types';
|
|
2
|
+
import { AuthType, RuntimeFilterOp, VizPoint } from '../../../types';
|
|
3
3
|
import { AnswerService } from './answerService';
|
|
4
|
-
import { getAnswerData, removeColumns } from './answer-queries';
|
|
4
|
+
import { getAnswerData, removeColumns, addFilter } from './answer-queries';
|
|
5
5
|
import * as authTokenInstance from '../../../authToken';
|
|
6
6
|
import * as tokenizedFetch from '../../../tokenizedFetch';
|
|
7
7
|
import * as embedConfigInstance from '../../../embed/embedConfig';
|
|
@@ -266,4 +266,90 @@ describe('Answer service tests', () => {
|
|
|
266
266
|
const answerService = createAnswerService({}, null);
|
|
267
267
|
await expect(answerService.getUnderlyingDataForPoint(['col2'])).rejects.toThrow();
|
|
268
268
|
});
|
|
269
|
+
|
|
270
|
+
test('addFilter should call the right API', async () => {
|
|
271
|
+
fetchMock.mockResponses(
|
|
272
|
+
JSON.stringify({
|
|
273
|
+
data: {
|
|
274
|
+
getSourceDetailById: [{
|
|
275
|
+
columns: [{
|
|
276
|
+
id: 'id1',
|
|
277
|
+
name: 'col1',
|
|
278
|
+
}],
|
|
279
|
+
}],
|
|
280
|
+
},
|
|
281
|
+
}),
|
|
282
|
+
JSON.stringify({
|
|
283
|
+
data: {
|
|
284
|
+
Answer__addUpdateFilter: {
|
|
285
|
+
id: {
|
|
286
|
+
genNo: 2,
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
}),
|
|
291
|
+
);
|
|
292
|
+
const answerService = createAnswerService({
|
|
293
|
+
sources: [{
|
|
294
|
+
header: {
|
|
295
|
+
guid: 'source1',
|
|
296
|
+
},
|
|
297
|
+
}],
|
|
298
|
+
});
|
|
299
|
+
const session = await answerService.addFilter('col1', RuntimeFilterOp.IN, [2]);
|
|
300
|
+
expect(fetchMock).toHaveBeenCalledWith(
|
|
301
|
+
'https://tshost/prism/?op=AddUpdateFilter',
|
|
302
|
+
expect.objectContaining({
|
|
303
|
+
body: JSON.stringify({
|
|
304
|
+
operationName: 'AddUpdateFilter',
|
|
305
|
+
query: addFilter,
|
|
306
|
+
variables: {
|
|
307
|
+
session: defaultSession,
|
|
308
|
+
params: {
|
|
309
|
+
filterContent: [{
|
|
310
|
+
filterType: 'IN',
|
|
311
|
+
value: [{
|
|
312
|
+
type: 'DOUBLE',
|
|
313
|
+
doubleValue: 2,
|
|
314
|
+
}],
|
|
315
|
+
}],
|
|
316
|
+
filterGroupId: {
|
|
317
|
+
logicalColumnId: 'id1',
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
}),
|
|
322
|
+
}),
|
|
323
|
+
);
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
test('Should fetch answer if not passed', async () => {
|
|
327
|
+
fetchMock.mockResponses(JSON.stringify({
|
|
328
|
+
data: {
|
|
329
|
+
getAnswer: {
|
|
330
|
+
id: {},
|
|
331
|
+
answer: {
|
|
332
|
+
visualizations: [{
|
|
333
|
+
columns: [{
|
|
334
|
+
column: {
|
|
335
|
+
id: 'id1',
|
|
336
|
+
name: 'col1',
|
|
337
|
+
},
|
|
338
|
+
}],
|
|
339
|
+
}],
|
|
340
|
+
sources: [{
|
|
341
|
+
header: {
|
|
342
|
+
guid: 'source1',
|
|
343
|
+
displayName: 'source1',
|
|
344
|
+
},
|
|
345
|
+
}],
|
|
346
|
+
filterGroups: [],
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
}));
|
|
351
|
+
const answerService = new AnswerService(defaultSession, null, 'https://tshost');
|
|
352
|
+
const answer = await answerService.getAnswer();
|
|
353
|
+
expect(answer.sources[0].header.guid).toBe('source1');
|
|
354
|
+
});
|
|
269
355
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { tokenizedFetch } from '../../../tokenizedFetch';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type {
|
|
3
|
+
ColumnValue, RuntimeFilter, RuntimeFilterOp, VizPoint,
|
|
4
|
+
} from '../../../types';
|
|
5
|
+
import { deepMerge, getTypeFromValue, removeTypename } from '../../../utils';
|
|
4
6
|
import { graphqlQuery } from '../graphql-request';
|
|
5
7
|
import { getSourceDetail } from '../sourceService';
|
|
6
8
|
import * as queries from './answer-queries';
|
|
@@ -27,7 +29,6 @@ export interface UnderlyingDataPoint {
|
|
|
27
29
|
* custom action payload. This service could be used to run
|
|
28
30
|
* graphql queries in the context of the answer on which the
|
|
29
31
|
* custom action was triggered.
|
|
30
|
-
*
|
|
31
32
|
* @example
|
|
32
33
|
* ```js
|
|
33
34
|
* embed.on(EmbedEvent.CustomAction, e => {
|
|
@@ -37,13 +38,24 @@ export interface UnderlyingDataPoint {
|
|
|
37
38
|
* const data = await underlying.fetchData(0, 100);
|
|
38
39
|
* })
|
|
39
40
|
* ```
|
|
41
|
+
* @example
|
|
42
|
+
* ```js
|
|
43
|
+
* embed.on(EmbedEvent.Data, async (e) => {
|
|
44
|
+
* const service = await embed.getAnswerService();
|
|
45
|
+
* await service.addColumns([
|
|
46
|
+
* "<column guid>"
|
|
47
|
+
* ]);
|
|
48
|
+
* console.log(await service.fetchData());
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
40
51
|
* @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
|
|
41
52
|
* @group Events
|
|
42
53
|
*/
|
|
43
54
|
export class AnswerService {
|
|
55
|
+
private answer: Promise<any>;
|
|
56
|
+
|
|
44
57
|
/**
|
|
45
58
|
* Should not need to be called directly.
|
|
46
|
-
*
|
|
47
59
|
* @param session
|
|
48
60
|
* @param answer
|
|
49
61
|
* @param thoughtSpotHost
|
|
@@ -51,11 +63,19 @@ export class AnswerService {
|
|
|
51
63
|
*/
|
|
52
64
|
constructor(
|
|
53
65
|
private session: SessionInterface,
|
|
54
|
-
|
|
66
|
+
answer: any,
|
|
55
67
|
private thoughtSpotHost: string,
|
|
56
68
|
private selectedPoints?: VizPoint[],
|
|
57
69
|
) {
|
|
58
70
|
this.session = removeTypename(session);
|
|
71
|
+
if (!answer) {
|
|
72
|
+
this.answer = this.executeQuery(
|
|
73
|
+
queries.getAnswer,
|
|
74
|
+
{},
|
|
75
|
+
).then((data) => data?.answer);
|
|
76
|
+
} else {
|
|
77
|
+
this.answer = answer;
|
|
78
|
+
}
|
|
59
79
|
}
|
|
60
80
|
|
|
61
81
|
/**
|
|
@@ -63,7 +83,7 @@ export class AnswerService {
|
|
|
63
83
|
* This can be used to get the list of all columns in the data source for example.
|
|
64
84
|
*/
|
|
65
85
|
public async getSourceDetail() {
|
|
66
|
-
const sourceId = this.answer.sources[0].header.guid;
|
|
86
|
+
const sourceId = (await this.answer).sources[0].header.guid;
|
|
67
87
|
return getSourceDetail(
|
|
68
88
|
this.thoughtSpotHost,
|
|
69
89
|
sourceId,
|
|
@@ -72,7 +92,6 @@ export class AnswerService {
|
|
|
72
92
|
|
|
73
93
|
/**
|
|
74
94
|
* Remove columnIds and return updated answer session.
|
|
75
|
-
*
|
|
76
95
|
* @param columnIds
|
|
77
96
|
* @returns
|
|
78
97
|
*/
|
|
@@ -87,7 +106,6 @@ export class AnswerService {
|
|
|
87
106
|
|
|
88
107
|
/**
|
|
89
108
|
* Add columnIds and return updated answer session.
|
|
90
|
-
*
|
|
91
109
|
* @param columnIds
|
|
92
110
|
* @returns
|
|
93
111
|
*/
|
|
@@ -100,9 +118,63 @@ export class AnswerService {
|
|
|
100
118
|
);
|
|
101
119
|
}
|
|
102
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Add columns by names and return updated answer session.
|
|
123
|
+
* @param columnNames
|
|
124
|
+
* @returns
|
|
125
|
+
* @example
|
|
126
|
+
* ```js
|
|
127
|
+
* embed.on(EmbedEvent.Data, async (e) => {
|
|
128
|
+
* const service = await embed.getAnswerService();
|
|
129
|
+
* await service.addColumnsByNames([
|
|
130
|
+
* "col name 1",
|
|
131
|
+
* "col name 2"
|
|
132
|
+
* ]);
|
|
133
|
+
* console.log(await service.fetchData());
|
|
134
|
+
* });
|
|
135
|
+
*/
|
|
136
|
+
public async addColumnsByNames(columnNames: string[]) {
|
|
137
|
+
const sourceDetail = await this.getSourceDetail();
|
|
138
|
+
const columnGuids = getGuidsFromColumnNames(sourceDetail, columnNames);
|
|
139
|
+
return this.addColumns([...columnGuids]);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Add a filter to the answer.
|
|
144
|
+
* @param columnName
|
|
145
|
+
* @param operator
|
|
146
|
+
* @param values
|
|
147
|
+
* @returns
|
|
148
|
+
*/
|
|
149
|
+
public async addFilter(columnName: string, operator: RuntimeFilterOp, values: RuntimeFilter['values']) {
|
|
150
|
+
const sourceDetail = await this.getSourceDetail();
|
|
151
|
+
const columnGuids = getGuidsFromColumnNames(sourceDetail, [columnName]);
|
|
152
|
+
return this.executeQuery(
|
|
153
|
+
queries.addFilter,
|
|
154
|
+
{
|
|
155
|
+
params: {
|
|
156
|
+
filterContent: [{
|
|
157
|
+
filterType: operator,
|
|
158
|
+
value: values.map(
|
|
159
|
+
(v) => {
|
|
160
|
+
const [type, prefix] = getTypeFromValue(v);
|
|
161
|
+
return {
|
|
162
|
+
type: type.toUpperCase(),
|
|
163
|
+
[`${prefix}Value`]: v,
|
|
164
|
+
};
|
|
165
|
+
},
|
|
166
|
+
),
|
|
167
|
+
}],
|
|
168
|
+
filterGroupId: {
|
|
169
|
+
logicalColumnId: columnGuids.values().next().value,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
103
176
|
/**
|
|
104
177
|
* Fetch data from the answer.
|
|
105
|
-
*
|
|
106
178
|
* @param offset
|
|
107
179
|
* @param size
|
|
108
180
|
* @returns
|
|
@@ -131,7 +203,6 @@ export class AnswerService {
|
|
|
131
203
|
/**
|
|
132
204
|
* Fetch the data for the answer as a CSV blob. This might be
|
|
133
205
|
* quicker for larger data.
|
|
134
|
-
*
|
|
135
206
|
* @param userLocale
|
|
136
207
|
* @param includeInfo Include the CSV header in the output
|
|
137
208
|
* @returns Response
|
|
@@ -146,7 +217,6 @@ export class AnswerService {
|
|
|
146
217
|
/**
|
|
147
218
|
* Just get the internal URL for this answer's data
|
|
148
219
|
* as a CSV blob.
|
|
149
|
-
*
|
|
150
220
|
* @param userLocale
|
|
151
221
|
* @param includeInfo
|
|
152
222
|
* @returns
|
|
@@ -159,7 +229,6 @@ export class AnswerService {
|
|
|
159
229
|
* Get underlying data given a point and the output column names.
|
|
160
230
|
* In case of a context menu action, the selectedPoints are
|
|
161
231
|
* automatically passed.
|
|
162
|
-
*
|
|
163
232
|
* @param outputColumnNames
|
|
164
233
|
* @param selectedPoints
|
|
165
234
|
* @example
|
|
@@ -224,7 +293,6 @@ export class AnswerService {
|
|
|
224
293
|
|
|
225
294
|
/**
|
|
226
295
|
* Execute a custom graphql query in the context of the answer.
|
|
227
|
-
*
|
|
228
296
|
* @param query graphql query
|
|
229
297
|
* @param variables graphql variables
|
|
230
298
|
* @returns
|
|
@@ -246,12 +314,15 @@ export class AnswerService {
|
|
|
246
314
|
|
|
247
315
|
/**
|
|
248
316
|
* Get the internal session details for the answer.
|
|
249
|
-
*
|
|
250
317
|
* @returns
|
|
251
318
|
*/
|
|
252
319
|
public getSession() {
|
|
253
320
|
return this.session;
|
|
254
321
|
}
|
|
322
|
+
|
|
323
|
+
public getAnswer() {
|
|
324
|
+
return this.answer;
|
|
325
|
+
}
|
|
255
326
|
}
|
|
256
327
|
|
|
257
328
|
/**
|
|
@@ -261,12 +332,12 @@ export class AnswerService {
|
|
|
261
332
|
*/
|
|
262
333
|
function getGuidsFromColumnNames(sourceDetail: any, colNames: string[]) {
|
|
263
334
|
const cols = sourceDetail.columns.reduce((colSet: any, col: any) => {
|
|
264
|
-
colSet[col.name] = col;
|
|
335
|
+
colSet[col.name.toLowerCase()] = col;
|
|
265
336
|
return colSet;
|
|
266
337
|
}, {});
|
|
267
338
|
|
|
268
339
|
return new Set(colNames.map((colName) => {
|
|
269
|
-
const col = cols[colName];
|
|
340
|
+
const col = cols[colName.toLowerCase()];
|
|
270
341
|
return col.id;
|
|
271
342
|
}));
|
|
272
343
|
}
|
package/src/utils/logger.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import isUndefined from '
|
|
2
|
-
import noop from 'lodash/noop';
|
|
1
|
+
import { isUndefined } from '../utils';
|
|
3
2
|
import { LogLevel } from '../types';
|
|
4
3
|
|
|
5
4
|
const logFunctions: {
|
|
6
5
|
[key: string]: (...args: any[]) => void;
|
|
7
6
|
} = {
|
|
8
|
-
[LogLevel.SILENT]:
|
|
7
|
+
[LogLevel.SILENT]: () => undefined,
|
|
9
8
|
[LogLevel.ERROR]: console.error,
|
|
10
9
|
[LogLevel.WARN]: console.warn,
|
|
11
10
|
[LogLevel.INFO]: console.info,
|
|
@@ -4,11 +4,9 @@ import * as auth from '../auth';
|
|
|
4
4
|
import * as base from '../embed/base';
|
|
5
5
|
import * as embedConfigInstance from '../embed/embedConfig';
|
|
6
6
|
import { EmbedEvent, AuthType } from '../types';
|
|
7
|
-
import * as sessionInfoService from './sessionInfoService';
|
|
8
7
|
|
|
9
8
|
describe('Unit test for process data', () => {
|
|
10
9
|
beforeAll(() => {
|
|
11
|
-
jest.spyOn(auth, 'postLoginService').mockImplementation(() => Promise.resolve({}));
|
|
12
10
|
base.init({
|
|
13
11
|
thoughtSpotHost: 'https://tshost',
|
|
14
12
|
authType: AuthType.None,
|
|
@@ -37,7 +35,7 @@ describe('Unit test for process data', () => {
|
|
|
37
35
|
expect.objectContaining({
|
|
38
36
|
...processedData,
|
|
39
37
|
answerService: {
|
|
40
|
-
answer:
|
|
38
|
+
answer: {},
|
|
41
39
|
selectedPoints: undefined,
|
|
42
40
|
session: undefined,
|
|
43
41
|
thoughtSpotHost: 'http://localhost',
|
|
@@ -60,14 +58,15 @@ describe('Unit test for process data', () => {
|
|
|
60
58
|
isPublicUser: false,
|
|
61
59
|
};
|
|
62
60
|
const e = { type: EmbedEvent.AuthInit, data: sessionInfo };
|
|
61
|
+
jest.spyOn(auth, 'initSession').mockReturnValue(null);
|
|
63
62
|
jest.spyOn(base, 'notifyAuthSuccess');
|
|
64
|
-
jest.spyOn(sessionInfoService, 'getSessionInfoSync').mockReturnValue(sessionInfo);
|
|
65
63
|
expect(processDataInstance.processEventData(e.type, e, '', null)).toEqual({
|
|
66
64
|
type: e.type,
|
|
67
65
|
data: {
|
|
68
66
|
userGUID: sessionInfo.userGUID,
|
|
69
67
|
},
|
|
70
68
|
});
|
|
69
|
+
expect(auth.initSession).toBeCalledWith(sessionInfo);
|
|
71
70
|
expect(base.notifyAuthSuccess).toBeCalled();
|
|
72
71
|
});
|
|
73
72
|
|
package/src/utils/processData.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
notifyAuthSuccess,
|
|
6
6
|
notifyLogout,
|
|
7
7
|
} from '../embed/base';
|
|
8
|
-
import { AuthFailureType } from '../auth';
|
|
8
|
+
import { AuthFailureType, initSession } from '../auth';
|
|
9
9
|
import { AuthType, CustomActionPayload, EmbedEvent } from '../types';
|
|
10
10
|
import { AnswerService } from './graphql/answerService/answerService';
|
|
11
11
|
import { resetCachedAuthToken } from '../authToken';
|
|
@@ -19,7 +19,7 @@ export function processCustomAction(e: any, thoughtSpotHost: string) {
|
|
|
19
19
|
const { session, embedAnswerData, contextMenuPoints } = e.data as CustomActionPayload;
|
|
20
20
|
const answerService = new AnswerService(
|
|
21
21
|
session,
|
|
22
|
-
embedAnswerData,
|
|
22
|
+
embedAnswerData || {},
|
|
23
23
|
thoughtSpotHost,
|
|
24
24
|
contextMenuPoints?.selectedPoints,
|
|
25
25
|
);
|
|
@@ -34,6 +34,8 @@ export function processCustomAction(e: any, thoughtSpotHost: string) {
|
|
|
34
34
|
* @param e
|
|
35
35
|
*/
|
|
36
36
|
function processAuthInit(e: any) {
|
|
37
|
+
// Store user session details sent by app.
|
|
38
|
+
initSession(e.data);
|
|
37
39
|
notifyAuthSuccess();
|
|
38
40
|
|
|
39
41
|
// Expose only allowed details (eg: userGUID) back to SDK users.
|
|
@@ -3,7 +3,6 @@ import { HostEvent } from '../types';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Reloads the ThoughtSpot iframe.
|
|
6
|
-
*
|
|
7
6
|
* @param iFrame
|
|
8
7
|
*/
|
|
9
8
|
export const reload = (iFrame: HTMLIFrameElement) => {
|
|
@@ -16,7 +15,6 @@ export const reload = (iFrame: HTMLIFrameElement) => {
|
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* Post iframe message.
|
|
19
|
-
*
|
|
20
18
|
* @param iFrame
|
|
21
19
|
* @param message
|
|
22
20
|
* @param message.type
|