@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/src/embed/ts-embed.ts
CHANGED
|
@@ -2,63 +2,59 @@
|
|
|
2
2
|
* Copyright (c) 2022
|
|
3
3
|
*
|
|
4
4
|
* Base classes
|
|
5
|
-
*
|
|
6
5
|
* @summary Base classes
|
|
7
6
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
import isEqual from 'lodash/isEqual';
|
|
11
|
-
import
|
|
10
|
+
import pkgInfo from '../../package.json';
|
|
11
|
+
import { AuthFailureType } from '../auth';
|
|
12
12
|
import { getAuthenticationToken } from '../authToken';
|
|
13
|
-
import { AnswerService } from '../utils/graphql/answerService/answerService';
|
|
14
13
|
import {
|
|
15
|
-
getEncodedQueryParamsString,
|
|
16
|
-
getCssDimension,
|
|
17
|
-
getOffsetTop,
|
|
18
|
-
embedEventStatus,
|
|
19
|
-
setAttributes,
|
|
20
|
-
getCustomisations,
|
|
21
|
-
getRuntimeFilters,
|
|
22
|
-
getDOMNode,
|
|
23
|
-
getFilterQuery,
|
|
24
|
-
getQueryParamString,
|
|
25
|
-
getRuntimeParameters,
|
|
26
|
-
setStyleProperties,
|
|
27
|
-
removeStyleProperties,
|
|
28
|
-
isUndefined,
|
|
29
|
-
} from '../utils';
|
|
30
|
-
import {
|
|
31
|
-
getThoughtSpotHost,
|
|
32
|
-
URL_MAX_LENGTH,
|
|
33
|
-
DEFAULT_EMBED_WIDTH,
|
|
34
14
|
DEFAULT_EMBED_HEIGHT,
|
|
15
|
+
DEFAULT_EMBED_WIDTH,
|
|
16
|
+
URL_MAX_LENGTH,
|
|
17
|
+
getThoughtSpotHost,
|
|
35
18
|
getV2BasePath,
|
|
36
19
|
} from '../config';
|
|
20
|
+
import { MIXPANEL_EVENT, uploadMixpanelEvent } from '../mixpanel-service';
|
|
37
21
|
import {
|
|
22
|
+
Action,
|
|
38
23
|
AuthType,
|
|
24
|
+
ContextMenuTriggerOptions,
|
|
39
25
|
DOMSelector,
|
|
40
|
-
|
|
26
|
+
EmbedConfig,
|
|
41
27
|
EmbedEvent,
|
|
28
|
+
HostEvent,
|
|
42
29
|
MessageCallback,
|
|
43
|
-
Action,
|
|
44
|
-
Param,
|
|
45
|
-
EmbedConfig,
|
|
46
|
-
MessageOptions,
|
|
47
|
-
MessagePayload,
|
|
48
30
|
MessageCallbackObj,
|
|
31
|
+
MessageOptions,
|
|
32
|
+
Param,
|
|
49
33
|
ViewConfig,
|
|
50
|
-
FrameParams,
|
|
51
|
-
ContextMenuTriggerOptions,
|
|
52
|
-
RuntimeFilter,
|
|
53
34
|
} from '../types';
|
|
54
|
-
import {
|
|
55
|
-
|
|
35
|
+
import {
|
|
36
|
+
embedEventStatus,
|
|
37
|
+
getCssDimension,
|
|
38
|
+
getCustomisations,
|
|
39
|
+
getDOMNode,
|
|
40
|
+
getEncodedQueryParamsString,
|
|
41
|
+
getFilterQuery,
|
|
42
|
+
getOffsetTop,
|
|
43
|
+
getQueryParamString,
|
|
44
|
+
getRuntimeFilters,
|
|
45
|
+
getRuntimeParameters,
|
|
46
|
+
isUndefined,
|
|
47
|
+
removeStyleProperties,
|
|
48
|
+
setAttributes,
|
|
49
|
+
setStyleProperties,
|
|
50
|
+
} from '../utils';
|
|
51
|
+
import { AnswerService } from '../utils/graphql/answerService/answerService';
|
|
52
|
+
import { logger } from '../utils/logger';
|
|
53
|
+
import { processAuthFailure, processEventData } from '../utils/processData';
|
|
56
54
|
import { processTrigger } from '../utils/processTrigger';
|
|
57
|
-
import pkgInfo from '../../package.json';
|
|
58
55
|
import {
|
|
59
|
-
getAuthPromise,
|
|
56
|
+
getAuthPromise, handleAuth, notifyAuthFailure, renderInQueue,
|
|
60
57
|
} from './base';
|
|
61
|
-
import { AuthFailureType } from '../auth';
|
|
62
58
|
import { getEmbedConfig } from './embedConfig';
|
|
63
59
|
|
|
64
60
|
const { version } = pkgInfo;
|
|
@@ -73,7 +69,6 @@ const TS_EMBED_ID = '_thoughtspot-embed';
|
|
|
73
69
|
* The event id map from v2 event names to v1 event id
|
|
74
70
|
* v1 events are the classic embed events implemented in Blink v1
|
|
75
71
|
* We cannot rename v1 event types to maintain backward compatibility
|
|
76
|
-
*
|
|
77
72
|
* @internal
|
|
78
73
|
*/
|
|
79
74
|
const V1EventMap = {};
|
|
@@ -150,7 +145,6 @@ export class TsEmbed {
|
|
|
150
145
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
151
146
|
* will generate for embedding. This provides additional security to
|
|
152
147
|
* thoughtspot clusters against Cross site scripting attacks.
|
|
153
|
-
*
|
|
154
148
|
* @default false
|
|
155
149
|
*/
|
|
156
150
|
private shouldEncodeUrlQueryParams = false;
|
|
@@ -170,7 +164,11 @@ export class TsEmbed {
|
|
|
170
164
|
this.thoughtSpotV2Base = getV2BasePath(this.embedConfig);
|
|
171
165
|
this.eventHandlerMap = new Map();
|
|
172
166
|
this.isError = false;
|
|
173
|
-
this.viewConfig = {
|
|
167
|
+
this.viewConfig = {
|
|
168
|
+
excludeRuntimeFiltersfromURL: false,
|
|
169
|
+
excludeRuntimeParametersfromURL: false,
|
|
170
|
+
...viewConfig,
|
|
171
|
+
};
|
|
174
172
|
this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
|
|
175
173
|
this.registerAppInit();
|
|
176
174
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
@@ -187,7 +185,6 @@ export class TsEmbed {
|
|
|
187
185
|
|
|
188
186
|
/**
|
|
189
187
|
* Handles errors within the SDK
|
|
190
|
-
*
|
|
191
188
|
* @param error The error message or object
|
|
192
189
|
*/
|
|
193
190
|
protected handleError(error: string | Record<string, unknown>) {
|
|
@@ -201,7 +198,6 @@ export class TsEmbed {
|
|
|
201
198
|
|
|
202
199
|
/**
|
|
203
200
|
* Extracts the type field from the event payload
|
|
204
|
-
*
|
|
205
201
|
* @param event The window message event
|
|
206
202
|
*/
|
|
207
203
|
private getEventType(event: MessageEvent) {
|
|
@@ -211,7 +207,6 @@ export class TsEmbed {
|
|
|
211
207
|
|
|
212
208
|
/**
|
|
213
209
|
* Extracts the port field from the event payload
|
|
214
|
-
*
|
|
215
210
|
* @param event The window message event
|
|
216
211
|
* @returns
|
|
217
212
|
*/
|
|
@@ -225,7 +220,6 @@ export class TsEmbed {
|
|
|
225
220
|
/**
|
|
226
221
|
* fix for ts7.sep.cl
|
|
227
222
|
* will be removed for ts7.oct.cl
|
|
228
|
-
*
|
|
229
223
|
* @param event
|
|
230
224
|
* @param eventType
|
|
231
225
|
* @hidden
|
|
@@ -299,7 +293,6 @@ export class TsEmbed {
|
|
|
299
293
|
|
|
300
294
|
/**
|
|
301
295
|
* Send Custom style as part of payload of APP_INIT
|
|
302
|
-
*
|
|
303
296
|
* @param _
|
|
304
297
|
* @param responder
|
|
305
298
|
*/
|
|
@@ -322,6 +315,9 @@ export class TsEmbed {
|
|
|
322
315
|
runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
|
|
323
316
|
? getRuntimeFilters(this.viewConfig.runtimeFilters)
|
|
324
317
|
: null,
|
|
318
|
+
runtimeParameterParams: this.viewConfig.excludeRuntimeParametersfromURL
|
|
319
|
+
? getRuntimeParameters(this.viewConfig.runtimeParameters || [])
|
|
320
|
+
: null,
|
|
325
321
|
hiddenHomepageModules: this.viewConfig.hiddenHomepageModules || [],
|
|
326
322
|
reorderedHomepageModules: this.viewConfig.reorderedHomepageModules || [],
|
|
327
323
|
hostConfig: this.embedConfig.hostConfig,
|
|
@@ -334,7 +330,6 @@ export class TsEmbed {
|
|
|
334
330
|
|
|
335
331
|
/**
|
|
336
332
|
* Sends updated auth token to the iFrame to avoid user logout
|
|
337
|
-
*
|
|
338
333
|
* @param _
|
|
339
334
|
* @param responder
|
|
340
335
|
*/
|
|
@@ -367,7 +362,6 @@ export class TsEmbed {
|
|
|
367
362
|
|
|
368
363
|
/**
|
|
369
364
|
* Constructs the base URL string to load the ThoughtSpot app.
|
|
370
|
-
*
|
|
371
365
|
* @param query
|
|
372
366
|
*/
|
|
373
367
|
protected getEmbedBasePath(query: string): string {
|
|
@@ -386,7 +380,6 @@ export class TsEmbed {
|
|
|
386
380
|
|
|
387
381
|
/**
|
|
388
382
|
* Common query params set for all the embed modes.
|
|
389
|
-
*
|
|
390
383
|
* @param queryParams
|
|
391
384
|
* @returns queryParams
|
|
392
385
|
*/
|
|
@@ -417,6 +410,15 @@ export class TsEmbed {
|
|
|
417
410
|
if (this.embedConfig.pendoTrackingKey) {
|
|
418
411
|
queryParams[Param.PendoTrackingKey] = this.embedConfig.pendoTrackingKey;
|
|
419
412
|
}
|
|
413
|
+
if (this.embedConfig.numberFormatLocale) {
|
|
414
|
+
queryParams[Param.NumberFormatLocale] = this.embedConfig.numberFormatLocale;
|
|
415
|
+
}
|
|
416
|
+
if (this.embedConfig.dateFormatLocale) {
|
|
417
|
+
queryParams[Param.DateFormatLocale] = this.embedConfig.dateFormatLocale;
|
|
418
|
+
}
|
|
419
|
+
if (this.embedConfig.currencyFormat) {
|
|
420
|
+
queryParams[Param.CurrencyFormat] = this.embedConfig.currencyFormat;
|
|
421
|
+
}
|
|
420
422
|
|
|
421
423
|
const {
|
|
422
424
|
disabledActions,
|
|
@@ -509,7 +511,6 @@ export class TsEmbed {
|
|
|
509
511
|
/**
|
|
510
512
|
* Constructs the base URL string to load v1 of the ThoughtSpot app.
|
|
511
513
|
* This is used for embedding Liveboards, visualizations, and full application.
|
|
512
|
-
*
|
|
513
514
|
* @param queryString The query string to append to the URL.
|
|
514
515
|
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
515
516
|
* the full application.
|
|
@@ -584,10 +585,10 @@ export class TsEmbed {
|
|
|
584
585
|
/**
|
|
585
586
|
* Renders the embedded ThoughtSpot app in an iframe and sets up
|
|
586
587
|
* event listeners.
|
|
587
|
-
*
|
|
588
588
|
* @param url - The URL of the embedded ThoughtSpot app.
|
|
589
589
|
*/
|
|
590
590
|
protected async renderIFrame(url: string): Promise<any> {
|
|
591
|
+
console.log('here 7');
|
|
591
592
|
if (this.isError) {
|
|
592
593
|
return null;
|
|
593
594
|
}
|
|
@@ -597,8 +598,10 @@ export class TsEmbed {
|
|
|
597
598
|
if (url.length > URL_MAX_LENGTH) {
|
|
598
599
|
// warn: The URL is too long
|
|
599
600
|
}
|
|
601
|
+
console.log('here 8');
|
|
600
602
|
|
|
601
603
|
return renderInQueue((nextInQueue) => {
|
|
604
|
+
console.log('here 6');
|
|
602
605
|
const initTimestamp = Date.now();
|
|
603
606
|
|
|
604
607
|
this.executeCallbacks(EmbedEvent.Init, {
|
|
@@ -611,6 +614,7 @@ export class TsEmbed {
|
|
|
611
614
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
|
|
612
615
|
return getAuthPromise()
|
|
613
616
|
?.then((isLoggedIn: boolean) => {
|
|
617
|
+
console.log('here 9', isLoggedIn);
|
|
614
618
|
if (!isLoggedIn) {
|
|
615
619
|
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
|
|
616
620
|
return;
|
|
@@ -635,7 +639,9 @@ export class TsEmbed {
|
|
|
635
639
|
this.iFrame.addEventListener('error', () => {
|
|
636
640
|
nextInQueue();
|
|
637
641
|
});
|
|
642
|
+
console.log('here 10', this.iFrame);
|
|
638
643
|
this.handleInsertionIntoDOM(this.iFrame);
|
|
644
|
+
console.log('here 11', document.body.innerHTML);
|
|
639
645
|
const prefetchIframe = document.querySelectorAll('.prefetchIframe');
|
|
640
646
|
if (prefetchIframe.length) {
|
|
641
647
|
prefetchIframe.forEach((el) => {
|
|
@@ -679,7 +685,7 @@ export class TsEmbed {
|
|
|
679
685
|
protected connectPreRendered(): boolean {
|
|
680
686
|
const preRenderIds = this.getPreRenderIds();
|
|
681
687
|
this.preRenderWrapper = this.preRenderWrapper
|
|
682
|
-
|
|
688
|
+
|| document.getElementById(preRenderIds.wrapper);
|
|
683
689
|
|
|
684
690
|
this.preRenderChild = this.preRenderChild || document.getElementById(preRenderIds.child);
|
|
685
691
|
|
|
@@ -776,7 +782,6 @@ export class TsEmbed {
|
|
|
776
782
|
|
|
777
783
|
/**
|
|
778
784
|
* Sets the height of the iframe
|
|
779
|
-
*
|
|
780
785
|
* @param height The height in pixels
|
|
781
786
|
*/
|
|
782
787
|
protected setIFrameHeight(height: number | string): void {
|
|
@@ -785,7 +790,6 @@ export class TsEmbed {
|
|
|
785
790
|
|
|
786
791
|
/**
|
|
787
792
|
* Executes all registered event handlers for a particular event type
|
|
788
|
-
*
|
|
789
793
|
* @param eventType The event type
|
|
790
794
|
* @param data The payload invoked with the event handler
|
|
791
795
|
* @param eventPort The event Port for a specific MessageChannel
|
|
@@ -824,7 +828,6 @@ export class TsEmbed {
|
|
|
824
828
|
|
|
825
829
|
/**
|
|
826
830
|
* Gets the v1 event type (if applicable) for the EmbedEvent type
|
|
827
|
-
*
|
|
828
831
|
* @param eventType The v2 event type
|
|
829
832
|
* @returns The corresponding v1 event type if one exists
|
|
830
833
|
* or else the v2 event type itself
|
|
@@ -837,7 +840,6 @@ export class TsEmbed {
|
|
|
837
840
|
* Calculates the iframe center for the current visible viewPort
|
|
838
841
|
* of iframe using Scroll position of Host App, offsetTop for iframe
|
|
839
842
|
* in Host app. ViewPort height of the tab.
|
|
840
|
-
*
|
|
841
843
|
* @returns iframe Center in visible viewport,
|
|
842
844
|
* Iframe height,
|
|
843
845
|
* View port height.
|
|
@@ -872,7 +874,6 @@ export class TsEmbed {
|
|
|
872
874
|
/**
|
|
873
875
|
* Registers an event listener to trigger an alert when the ThoughtSpot app
|
|
874
876
|
* sends an event of a particular message type to the host application.
|
|
875
|
-
*
|
|
876
877
|
* @param messageType The message type
|
|
877
878
|
* @param callback A callback as a function
|
|
878
879
|
* @param options The message options
|
|
@@ -913,7 +914,6 @@ export class TsEmbed {
|
|
|
913
914
|
|
|
914
915
|
/**
|
|
915
916
|
* Removes an event listener for a particular event type.
|
|
916
|
-
*
|
|
917
917
|
* @param messageType The message type
|
|
918
918
|
* @param callback The callback to remove
|
|
919
919
|
* @example
|
|
@@ -935,7 +935,6 @@ export class TsEmbed {
|
|
|
935
935
|
/**
|
|
936
936
|
* Triggers an event on specific Port registered against
|
|
937
937
|
* for the EmbedEvent
|
|
938
|
-
*
|
|
939
938
|
* @param eventType The message type
|
|
940
939
|
* @param data The payload to send
|
|
941
940
|
* @param eventPort
|
|
@@ -959,7 +958,6 @@ export class TsEmbed {
|
|
|
959
958
|
|
|
960
959
|
/**
|
|
961
960
|
* Triggers an event to the embedded app
|
|
962
|
-
*
|
|
963
961
|
* @param messageType The event type
|
|
964
962
|
* @param data The payload to send with the message
|
|
965
963
|
*/
|
|
@@ -982,7 +980,6 @@ export class TsEmbed {
|
|
|
982
980
|
* Marks the ThoughtSpot object to have been rendered
|
|
983
981
|
* Needs to be overridden by subclasses to do the actual
|
|
984
982
|
* rendering of the iframe.
|
|
985
|
-
*
|
|
986
983
|
* @param args
|
|
987
984
|
*/
|
|
988
985
|
public async render(): Promise<TsEmbed> {
|
|
@@ -1001,7 +998,6 @@ export class TsEmbed {
|
|
|
1001
998
|
|
|
1002
999
|
/**
|
|
1003
1000
|
* Creates the preRender shell
|
|
1004
|
-
*
|
|
1005
1001
|
* @param showPreRenderByDefault - Show the preRender after render, hidden by default
|
|
1006
1002
|
*/
|
|
1007
1003
|
public preRender(showPreRenderByDefault = false): TsEmbed {
|
|
@@ -1019,7 +1015,6 @@ export class TsEmbed {
|
|
|
1019
1015
|
* Get the Post Url Params for THOUGHTSPOT from the current
|
|
1020
1016
|
* host app URL.
|
|
1021
1017
|
* THOUGHTSPOT URL params starts with a prefix "ts-"
|
|
1022
|
-
*
|
|
1023
1018
|
* @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
|
|
1024
1019
|
*/
|
|
1025
1020
|
public getThoughtSpotPostUrlParams(): string {
|
|
@@ -1047,7 +1042,6 @@ export class TsEmbed {
|
|
|
1047
1042
|
|
|
1048
1043
|
/**
|
|
1049
1044
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
1050
|
-
*
|
|
1051
1045
|
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
1052
1046
|
*/
|
|
1053
1047
|
public destroy(): void {
|
|
@@ -1067,7 +1061,6 @@ export class TsEmbed {
|
|
|
1067
1061
|
* Prerenders a generic instance of the TS component.
|
|
1068
1062
|
* This means without the path but with the flags already applied.
|
|
1069
1063
|
* This is useful for prerendering the component in the background.
|
|
1070
|
-
*
|
|
1071
1064
|
* @version SDK: 1.22.0
|
|
1072
1065
|
* @returns
|
|
1073
1066
|
*/
|
|
@@ -1097,11 +1090,11 @@ export class TsEmbed {
|
|
|
1097
1090
|
) {
|
|
1098
1091
|
logger.warn(
|
|
1099
1092
|
`${viewConfig.embedComponentType || 'Component'} was pre-rendered with `
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1093
|
+
+ `"${key}" as "${JSON.stringify(preRenderedObject.viewConfig[key])}" `
|
|
1094
|
+
+ `but a different value "${JSON.stringify(viewConfig[key])}" `
|
|
1095
|
+
+ 'was passed to the Embed component. '
|
|
1096
|
+
+ 'The new value provided is ignored, the value provided during '
|
|
1097
|
+
+ 'preRender is used.',
|
|
1105
1098
|
);
|
|
1106
1099
|
}
|
|
1107
1100
|
});
|
|
@@ -1159,7 +1152,6 @@ export class TsEmbed {
|
|
|
1159
1152
|
* element. This function adjusts the position, width, and height of the PreRender
|
|
1160
1153
|
* component
|
|
1161
1154
|
* to match the dimensions and position of the embedding element.
|
|
1162
|
-
*
|
|
1163
1155
|
* @throws {Error} Throws an error if the embedding element (passed as domSelector)
|
|
1164
1156
|
* is not defined or not found.
|
|
1165
1157
|
*/
|
|
@@ -1206,7 +1198,6 @@ export class TsEmbed {
|
|
|
1206
1198
|
/**
|
|
1207
1199
|
* Retrieves unique HTML element IDs for PreRender-related elements.
|
|
1208
1200
|
* These IDs are constructed based on the provided 'preRenderId' from 'viewConfig'.
|
|
1209
|
-
*
|
|
1210
1201
|
* @returns {object} An object containing the IDs for the PreRender elements.
|
|
1211
1202
|
* @property {string} wrapper - The HTML element ID for the PreRender wrapper.
|
|
1212
1203
|
* @property {string} child - The HTML element ID for the PreRender child.
|
|
@@ -1221,13 +1212,13 @@ export class TsEmbed {
|
|
|
1221
1212
|
/**
|
|
1222
1213
|
* Returns the answerService which can be used to make arbitrary graphql calls on top
|
|
1223
1214
|
* session.
|
|
1224
|
-
*
|
|
1225
1215
|
* @param vizId [Optional] to get for a specific viz in case of a liveboard.
|
|
1226
1216
|
* @version SDK: 1.25.0 / ThoughtSpot 9.10.0
|
|
1227
1217
|
*/
|
|
1228
1218
|
public async getAnswerService(vizId?: string): Promise<AnswerService> {
|
|
1229
|
-
const { session
|
|
1230
|
-
|
|
1219
|
+
const { session } = await this.trigger(HostEvent.GetAnswerSession, vizId);
|
|
1220
|
+
|
|
1221
|
+
return new AnswerService(session, null, this.embedConfig.thoughtSpotHost);
|
|
1231
1222
|
}
|
|
1232
1223
|
}
|
|
1233
1224
|
|
|
@@ -1235,7 +1226,6 @@ export class TsEmbed {
|
|
|
1235
1226
|
* Base class for embedding v1 experience
|
|
1236
1227
|
* Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
|
|
1237
1228
|
* which is currently under migration to v2
|
|
1238
|
-
*
|
|
1239
1229
|
* @inheritdoc
|
|
1240
1230
|
*/
|
|
1241
1231
|
export class V1Embed extends TsEmbed {
|
|
@@ -1248,7 +1238,6 @@ export class V1Embed extends TsEmbed {
|
|
|
1248
1238
|
|
|
1249
1239
|
/**
|
|
1250
1240
|
* Render the app in an iframe and set up event handlers
|
|
1251
|
-
*
|
|
1252
1241
|
* @param iframeSrc
|
|
1253
1242
|
*/
|
|
1254
1243
|
protected renderV1Embed(iframeSrc: string): Promise<any> {
|
|
@@ -1258,9 +1247,10 @@ export class V1Embed extends TsEmbed {
|
|
|
1258
1247
|
protected getRootIframeSrc(): string {
|
|
1259
1248
|
const queryParams = this.getEmbedParams();
|
|
1260
1249
|
let queryString = queryParams;
|
|
1261
|
-
|
|
1262
|
-
if (
|
|
1263
|
-
const
|
|
1250
|
+
|
|
1251
|
+
if (!this.viewConfig.excludeRuntimeParametersfromURL) {
|
|
1252
|
+
const runtimeParameters = this.viewConfig.runtimeParameters;
|
|
1253
|
+
const parameterQuery = getRuntimeParameters(runtimeParameters || []);
|
|
1264
1254
|
queryString = [parameterQuery, queryParams].filter(Boolean).join('&');
|
|
1265
1255
|
}
|
|
1266
1256
|
|
package/src/errors.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const ERROR_MESSAGE = {
|
|
2
2
|
INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
|
|
3
|
-
LIVEBOARD_VIZ_ID_VALIDATION: 'Please
|
|
3
|
+
LIVEBOARD_VIZ_ID_VALIDATION: 'Please select a liveboard to embed.',
|
|
4
4
|
TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
|
|
5
5
|
SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
|
|
6
6
|
SAGE_EMBED_BETA_WARNING_MESSAGE: 'Sage Embed is in Beta in this release.',
|
package/src/index.ts
CHANGED
package/src/mixpanel-service.ts
CHANGED
package/src/react/index.spec.tsx
CHANGED
|
@@ -15,12 +15,15 @@ import {
|
|
|
15
15
|
mockMessageChannel,
|
|
16
16
|
} from '../test/test-utils';
|
|
17
17
|
import {
|
|
18
|
-
SearchEmbed,
|
|
18
|
+
SearchEmbed,
|
|
19
|
+
AppEmbed,
|
|
20
|
+
LiveboardEmbed,
|
|
21
|
+
useEmbedRef,
|
|
22
|
+
SearchBarEmbed,
|
|
23
|
+
PreRenderedLiveboardEmbed,
|
|
19
24
|
} from './index';
|
|
20
25
|
import * as allExports from './index';
|
|
21
|
-
import {
|
|
22
|
-
AuthType, init,
|
|
23
|
-
} from '../index';
|
|
26
|
+
import { AuthType, init } from '../index';
|
|
24
27
|
|
|
25
28
|
import { version } from '../../package.json';
|
|
26
29
|
|
|
@@ -43,13 +46,11 @@ describe('React Components', () => {
|
|
|
43
46
|
|
|
44
47
|
await waitFor(() => getIFrameEl(container));
|
|
45
48
|
|
|
46
|
-
expect(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
),
|
|
50
|
-
).toBe(true);
|
|
49
|
+
expect(getIFrameEl(container).parentElement.classList.contains('embedClass')).toBe(
|
|
50
|
+
true,
|
|
51
|
+
);
|
|
51
52
|
expect(getIFrameSrc(container)).toBe(
|
|
52
|
-
`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&enableDataPanelV2=false&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true&collapseSearchBarInitially=false#/embed/answer`,
|
|
53
|
+
`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&enableDataPanelV2=false&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true&collapseSearchBarInitially=false&enableCustomColumnGroups=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_ALL#/embed/answer`,
|
|
53
54
|
);
|
|
54
55
|
});
|
|
55
56
|
|
|
@@ -144,60 +145,53 @@ describe('React Components', () => {
|
|
|
144
145
|
});
|
|
145
146
|
|
|
146
147
|
it('Should have the correct container element', async () => {
|
|
147
|
-
const { container } = render(
|
|
148
|
-
<LiveboardEmbed liveboardId="abcd" className="def" />,
|
|
149
|
-
);
|
|
148
|
+
const { container } = render(<LiveboardEmbed liveboardId="abcd" className="def" />);
|
|
150
149
|
|
|
151
150
|
await waitFor(() => getIFrameEl(container));
|
|
152
151
|
expect(container.querySelector('div')).not.toBe(null);
|
|
153
|
-
expect(
|
|
154
|
-
container.querySelector('div').classList.contains('def'),
|
|
155
|
-
).toBe(true);
|
|
152
|
+
expect(container.querySelector('div').classList.contains('def')).toBe(true);
|
|
156
153
|
|
|
157
154
|
const { container: containerSibling } = render(
|
|
158
|
-
<LiveboardEmbed
|
|
159
|
-
liveboardId="abcd"
|
|
160
|
-
className="def"
|
|
161
|
-
insertAsSibling={true}
|
|
162
|
-
/>,
|
|
155
|
+
<LiveboardEmbed liveboardId="abcd" className="def" insertAsSibling={true} />,
|
|
163
156
|
);
|
|
164
157
|
await waitFor(() => getIFrameEl(containerSibling));
|
|
165
158
|
expect(containerSibling.querySelector('span')).not.toBe(null);
|
|
166
|
-
expect(containerSibling.querySelector('span').style.position).toBe(
|
|
167
|
-
|
|
168
|
-
);
|
|
169
|
-
expect(
|
|
170
|
-
getIFrameEl(containerSibling).classList.contains('def'),
|
|
171
|
-
).toBe(true);
|
|
159
|
+
expect(containerSibling.querySelector('span').style.position).toBe('absolute');
|
|
160
|
+
expect(getIFrameEl(containerSibling).classList.contains('def')).toBe(true);
|
|
172
161
|
expect(containerSibling.querySelector('div')).toBe(null);
|
|
173
162
|
});
|
|
174
163
|
|
|
175
164
|
it('Should have the correct container element', async () => {
|
|
176
|
-
const { container } = render(
|
|
177
|
-
<LiveboardEmbed liveboardId="abcd" className="def" />,
|
|
178
|
-
);
|
|
165
|
+
const { container } = render(<LiveboardEmbed liveboardId="abcd" className="def" />);
|
|
179
166
|
|
|
180
167
|
await waitFor(() => getIFrameEl(container));
|
|
181
168
|
expect(container.querySelector('div')).not.toBe(null);
|
|
182
|
-
expect(
|
|
183
|
-
container.querySelector('div').classList.contains('def'),
|
|
184
|
-
).toBe(true);
|
|
169
|
+
expect(container.querySelector('div').classList.contains('def')).toBe(true);
|
|
185
170
|
|
|
186
171
|
const { container: containerSibling } = render(
|
|
187
|
-
<LiveboardEmbed
|
|
188
|
-
liveboardId="abcd"
|
|
189
|
-
className="def"
|
|
190
|
-
insertAsSibling={true}
|
|
191
|
-
/>,
|
|
172
|
+
<LiveboardEmbed liveboardId="abcd" className="def" insertAsSibling={true} />,
|
|
192
173
|
);
|
|
193
174
|
await waitFor(() => getIFrameEl(containerSibling));
|
|
194
175
|
expect(containerSibling.querySelector('span')).not.toBe(null);
|
|
195
|
-
expect(containerSibling.querySelector('span').style.position).toBe(
|
|
196
|
-
|
|
176
|
+
expect(containerSibling.querySelector('span').style.position).toBe('absolute');
|
|
177
|
+
expect(getIFrameEl(containerSibling).classList.contains('def')).toBe(true);
|
|
178
|
+
expect(containerSibling.querySelector('div')).toBe(null);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('Should have the correct container element', async () => {
|
|
182
|
+
const { container } = render(<LiveboardEmbed liveboardId="abcd" className="def" />);
|
|
183
|
+
|
|
184
|
+
await waitFor(() => getIFrameEl(container));
|
|
185
|
+
expect(container.querySelector('div')).not.toBe(null);
|
|
186
|
+
expect(container.querySelector('div').classList.contains('def')).toBe(true);
|
|
187
|
+
|
|
188
|
+
const { container: containerSibling } = render(
|
|
189
|
+
<LiveboardEmbed liveboardId="abcd" className="def" insertAsSibling={true} />,
|
|
197
190
|
);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
).toBe(
|
|
191
|
+
await waitFor(() => getIFrameEl(containerSibling));
|
|
192
|
+
expect(containerSibling.querySelector('span')).not.toBe(null);
|
|
193
|
+
expect(containerSibling.querySelector('span').style.position).toBe('absolute');
|
|
194
|
+
expect(getIFrameEl(containerSibling).classList.contains('def')).toBe(true);
|
|
201
195
|
expect(containerSibling.querySelector('div')).toBe(null);
|
|
202
196
|
});
|
|
203
197
|
});
|
|
@@ -217,11 +211,9 @@ describe('React Components', () => {
|
|
|
217
211
|
|
|
218
212
|
await waitFor(() => getIFrameEl(container));
|
|
219
213
|
|
|
220
|
-
expect(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
),
|
|
224
|
-
).toBe(true);
|
|
214
|
+
expect(getIFrameEl(container).parentElement.classList.contains('embedClass')).toBe(
|
|
215
|
+
true,
|
|
216
|
+
);
|
|
225
217
|
expect(getIFrameSrc(container)).toBe(
|
|
226
218
|
`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&dataSources=[%22test%22]&searchTokenString=%5Brevenue%5D&executeSearch=true&useLastSelectedSources=false&isSearchEmbed=true#/embed/search-bar-embed`,
|
|
227
219
|
);
|
|
@@ -241,7 +233,9 @@ describe('React Components', () => {
|
|
|
241
233
|
);
|
|
242
234
|
|
|
243
235
|
await waitFor(() => getIFrameEl());
|
|
244
|
-
const preRenderWrapper = document.body.querySelector(
|
|
236
|
+
const preRenderWrapper = document.body.querySelector(
|
|
237
|
+
`#${preRenderId}`,
|
|
238
|
+
) as HTMLDivElement;
|
|
245
239
|
|
|
246
240
|
expect(preRenderWrapper).toBeInstanceOf(HTMLDivElement);
|
|
247
241
|
expect((preRenderWrapper as HTMLDivElement).childElementCount).toBe(1);
|
|
@@ -256,11 +250,7 @@ describe('React Components', () => {
|
|
|
256
250
|
unobserve: jest.fn(),
|
|
257
251
|
}));
|
|
258
252
|
const { container: libContainer } = render(
|
|
259
|
-
<LiveboardEmbed
|
|
260
|
-
className="embedClass"
|
|
261
|
-
preRenderId="test"
|
|
262
|
-
liveboardId="libId"
|
|
263
|
-
/>,
|
|
253
|
+
<LiveboardEmbed className="embedClass" preRenderId="test" liveboardId="libId" />,
|
|
264
254
|
);
|
|
265
255
|
|
|
266
256
|
expect(preRenderWrapper.style.opacity).toBe('');
|
|
@@ -276,11 +266,9 @@ describe('allExports', () => {
|
|
|
276
266
|
});
|
|
277
267
|
|
|
278
268
|
it('should not have undefined exports', () => {
|
|
279
|
-
Object.keys(allExports)
|
|
280
|
-
(
|
|
281
|
-
Boolean(allExports[exportKey]),
|
|
282
|
-
)
|
|
283
|
-
.toBe(true),
|
|
284
|
-
);
|
|
269
|
+
Object.keys(allExports)
|
|
270
|
+
.forEach(
|
|
271
|
+
(exportKey) => expect(Boolean(allExports[exportKey])).toBe(true),
|
|
272
|
+
);
|
|
285
273
|
});
|
|
286
274
|
});
|