@thoughtspot/visual-embed-sdk 1.51.2 → 1.52.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/cjs/package.json +9 -1
- package/cjs/src/api-intercept.d.ts.map +1 -1
- package/cjs/src/api-intercept.js +1 -0
- package/cjs/src/api-intercept.js.map +1 -1
- package/cjs/src/contracts/contracts.spec.d.ts +2 -0
- package/cjs/src/contracts/contracts.spec.d.ts.map +1 -0
- package/cjs/src/contracts/contracts.spec.js +345 -0
- package/cjs/src/contracts/contracts.spec.js.map +1 -0
- package/cjs/src/contracts/embed-event-payloads.d.ts +73 -0
- package/cjs/src/contracts/embed-event-payloads.d.ts.map +1 -0
- package/cjs/src/contracts/embed-event-payloads.js +3 -0
- package/cjs/src/contracts/embed-event-payloads.js.map +1 -0
- package/cjs/src/contracts/host-event-contracts.d.ts +378 -0
- package/cjs/src/contracts/host-event-contracts.d.ts.map +1 -0
- package/cjs/src/contracts/host-event-contracts.js +3 -0
- package/cjs/src/contracts/host-event-contracts.js.map +1 -0
- package/cjs/src/contracts/index.d.ts +22 -0
- package/cjs/src/contracts/index.d.ts.map +1 -0
- package/cjs/src/contracts/index.js +33 -0
- package/cjs/src/contracts/index.js.map +1 -0
- package/cjs/src/contracts/ui-passthrough-contracts.d.ts +277 -0
- package/cjs/src/contracts/ui-passthrough-contracts.d.ts.map +1 -0
- package/cjs/src/{embed/hostEventClient/contracts.js → contracts/ui-passthrough-contracts.js} +6 -2
- package/cjs/src/contracts/ui-passthrough-contracts.js.map +1 -0
- package/cjs/src/css-variables.d.ts +1 -1
- package/cjs/src/embed/app.d.ts +17 -140
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +20 -120
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +70 -26
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +5 -5
- package/cjs/src/embed/events.spec.js +12 -2
- package/cjs/src/embed/events.spec.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts +3 -2
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.js +23 -18
- package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js +36 -36
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/cjs/src/embed/hostEventClient/utils.d.ts +1 -1
- package/cjs/src/embed/hostEventClient/utils.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/utils.js +3 -3
- package/cjs/src/embed/hostEventClient/utils.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +9 -161
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +68 -135
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +215 -32
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/search.d.ts +14 -0
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +4 -1
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/search.spec.js +65 -0
- package/cjs/src/embed/search.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +21 -25
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +105 -72
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +380 -33
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/full-height.d.ts +137 -0
- package/cjs/src/full-height.d.ts.map +1 -0
- package/cjs/src/full-height.js +272 -0
- package/cjs/src/full-height.js.map +1 -0
- package/cjs/src/full-height.spec.d.ts +2 -0
- package/cjs/src/full-height.spec.d.ts.map +1 -0
- package/cjs/src/full-height.spec.js +835 -0
- package/cjs/src/full-height.spec.js.map +1 -0
- package/cjs/src/index.d.ts +4 -3
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +5 -4
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/react/all-types-export.d.ts +1 -1
- package/cjs/src/react/all-types-export.d.ts.map +1 -1
- package/cjs/src/react/all-types-export.js +2 -1
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/react/all-types-export.parity.spec.js +55 -3
- package/cjs/src/react/all-types-export.parity.spec.js.map +1 -1
- package/cjs/src/react/index.d.ts +8 -8
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +1 -1
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +7 -7
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +664 -39
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +406 -13
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/processTrigger.d.ts +3 -1
- package/cjs/src/utils/processTrigger.d.ts.map +1 -1
- package/cjs/src/utils/processTrigger.js +19 -51
- package/cjs/src/utils/processTrigger.js.map +1 -1
- package/cjs/src/utils/transport/iframe-transport.d.ts +55 -0
- package/cjs/src/utils/transport/iframe-transport.d.ts.map +1 -0
- package/cjs/src/utils/transport/iframe-transport.js +108 -0
- package/cjs/src/utils/transport/iframe-transport.js.map +1 -0
- package/cjs/src/utils/transport/iframe-transport.spec.d.ts +2 -0
- package/cjs/src/utils/transport/iframe-transport.spec.d.ts.map +1 -0
- package/cjs/src/utils/transport/iframe-transport.spec.js +140 -0
- package/cjs/src/utils/transport/iframe-transport.spec.js.map +1 -0
- package/cjs/src/utils.d.ts +18 -0
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +39 -1
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +62 -0
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/{index-D8_Zs-Nr.js → index-C1pmYb5H.js} +1 -1
- package/dist/src/api-intercept.d.ts.map +1 -1
- package/dist/src/contracts/contracts.spec.d.ts +2 -0
- package/dist/src/contracts/contracts.spec.d.ts.map +1 -0
- package/dist/src/contracts/embed-event-payloads.d.ts +73 -0
- package/dist/src/contracts/embed-event-payloads.d.ts.map +1 -0
- package/dist/src/contracts/host-event-contracts.d.ts +378 -0
- package/dist/src/contracts/host-event-contracts.d.ts.map +1 -0
- package/dist/src/contracts/index.d.ts +22 -0
- package/dist/src/contracts/index.d.ts.map +1 -0
- package/dist/src/contracts/ui-passthrough-contracts.d.ts +277 -0
- package/dist/src/contracts/ui-passthrough-contracts.d.ts.map +1 -0
- package/dist/src/css-variables.d.ts +1 -1
- package/dist/src/embed/app.d.ts +17 -140
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +5 -5
- package/dist/src/embed/hostEventClient/host-event-client.d.ts +3 -2
- package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/utils.d.ts +1 -1
- package/dist/src/embed/hostEventClient/utils.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +9 -161
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +14 -0
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +21 -25
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/dist/src/full-height.d.ts +137 -0
- package/dist/src/full-height.d.ts.map +1 -0
- package/dist/src/full-height.spec.d.ts +2 -0
- package/dist/src/full-height.spec.d.ts.map +1 -0
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/react/all-types-export.d.ts +1 -1
- package/dist/src/react/all-types-export.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +8 -8
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +664 -39
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/processTrigger.d.ts +3 -1
- package/dist/src/utils/processTrigger.d.ts.map +1 -1
- package/dist/src/utils/transport/iframe-transport.d.ts +55 -0
- package/dist/src/utils/transport/iframe-transport.d.ts.map +1 -0
- package/dist/src/utils/transport/iframe-transport.spec.d.ts +2 -0
- package/dist/src/utils/transport/iframe-transport.spec.d.ts.map +1 -0
- package/dist/src/utils.d.ts +18 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +1031 -392
- package/dist/tsembed-react.js +1030 -391
- package/dist/tsembed.es.js +1031 -392
- package/dist/tsembed.js +1029 -390
- package/dist/visual-embed-sdk-react-full.d.ts +1483 -693
- package/dist/visual-embed-sdk-react.d.ts +1364 -647
- package/dist/visual-embed-sdk.d.ts +1426 -659
- package/lib/package.json +9 -1
- package/lib/src/api-intercept.d.ts.map +1 -1
- package/lib/src/api-intercept.js +2 -1
- package/lib/src/api-intercept.js.map +1 -1
- package/lib/src/contracts/contracts.spec.d.ts +2 -0
- package/lib/src/contracts/contracts.spec.d.ts.map +1 -0
- package/lib/src/contracts/contracts.spec.js +342 -0
- package/lib/src/contracts/contracts.spec.js.map +1 -0
- package/lib/src/contracts/embed-event-payloads.d.ts +73 -0
- package/lib/src/contracts/embed-event-payloads.d.ts.map +1 -0
- package/lib/src/contracts/embed-event-payloads.js +2 -0
- package/lib/src/contracts/embed-event-payloads.js.map +1 -0
- package/lib/src/contracts/host-event-contracts.d.ts +378 -0
- package/lib/src/contracts/host-event-contracts.d.ts.map +1 -0
- package/lib/src/contracts/host-event-contracts.js +2 -0
- package/lib/src/contracts/host-event-contracts.js.map +1 -0
- package/lib/src/contracts/index.d.ts +22 -0
- package/lib/src/contracts/index.d.ts.map +1 -0
- package/lib/src/contracts/index.js +22 -0
- package/lib/src/contracts/index.js.map +1 -0
- package/lib/src/contracts/ui-passthrough-contracts.d.ts +277 -0
- package/lib/src/contracts/ui-passthrough-contracts.d.ts.map +1 -0
- package/lib/src/{embed/hostEventClient/contracts.js → contracts/ui-passthrough-contracts.js} +6 -2
- package/lib/src/contracts/ui-passthrough-contracts.js.map +1 -0
- package/lib/src/css-variables.d.ts +1 -1
- package/lib/src/embed/app.d.ts +17 -140
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +22 -122
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +70 -26
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +5 -5
- package/lib/src/embed/events.spec.js +12 -2
- package/lib/src/embed/events.spec.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.d.ts +3 -2
- package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.js +6 -1
- package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.spec.js +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/lib/src/embed/hostEventClient/utils.d.ts +1 -1
- package/lib/src/embed/hostEventClient/utils.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/utils.js +1 -1
- package/lib/src/embed/hostEventClient/utils.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +9 -161
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +70 -137
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +215 -32
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +14 -0
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +4 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +65 -0
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +21 -25
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +106 -73
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +378 -31
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/full-height.d.ts +137 -0
- package/lib/src/full-height.d.ts.map +1 -0
- package/lib/src/full-height.js +268 -0
- package/lib/src/full-height.js.map +1 -0
- package/lib/src/full-height.spec.d.ts +2 -0
- package/lib/src/full-height.spec.d.ts.map +1 -0
- package/lib/src/full-height.spec.js +833 -0
- package/lib/src/full-height.spec.js.map +1 -0
- package/lib/src/index.d.ts +4 -3
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +3 -3
- package/lib/src/index.js.map +1 -1
- package/lib/src/react/all-types-export.d.ts +1 -1
- package/lib/src/react/all-types-export.d.ts.map +1 -1
- package/lib/src/react/all-types-export.js +1 -1
- package/lib/src/react/all-types-export.js.map +1 -1
- package/lib/src/react/all-types-export.parity.spec.js +55 -3
- package/lib/src/react/all-types-export.parity.spec.js.map +1 -1
- package/lib/src/react/index.d.ts +8 -8
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +1 -1
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +7 -7
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +664 -39
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +405 -12
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +3 -1
- package/lib/src/utils/processTrigger.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.js +19 -51
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils/transport/iframe-transport.d.ts +55 -0
- package/lib/src/utils/transport/iframe-transport.d.ts.map +1 -0
- package/lib/src/utils/transport/iframe-transport.js +101 -0
- package/lib/src/utils/transport/iframe-transport.js.map +1 -0
- package/lib/src/utils/transport/iframe-transport.spec.d.ts +2 -0
- package/lib/src/utils/transport/iframe-transport.spec.d.ts.map +1 -0
- package/lib/src/utils/transport/iframe-transport.spec.js +138 -0
- package/lib/src/utils/transport/iframe-transport.spec.js.map +1 -0
- package/lib/src/utils.d.ts +18 -0
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +37 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +63 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +1426 -659
- package/package.json +9 -1
- package/src/api-intercept.ts +2 -1
- package/src/contracts/contracts.spec.ts +392 -0
- package/src/contracts/embed-event-payloads.ts +83 -0
- package/src/contracts/host-event-contracts.ts +456 -0
- package/src/contracts/index.ts +53 -0
- package/src/contracts/ui-passthrough-contracts.ts +301 -0
- package/src/css-variables.ts +1 -1
- package/src/embed/app.spec.ts +86 -34
- package/src/embed/app.ts +37 -264
- package/src/embed/conversation.ts +5 -5
- package/src/embed/events.spec.ts +14 -2
- package/src/embed/hostEventClient/host-event-client.spec.ts +2 -2
- package/src/embed/hostEventClient/host-event-client.ts +18 -5
- package/src/embed/hostEventClient/utils.ts +2 -1
- package/src/embed/liveboard.spec.ts +261 -42
- package/src/embed/liveboard.ts +78 -297
- package/src/embed/search.spec.ts +80 -0
- package/src/embed/search.ts +20 -0
- package/src/embed/ts-embed.spec.ts +518 -31
- package/src/embed/ts-embed.ts +133 -82
- package/src/full-height.spec.ts +1008 -0
- package/src/full-height.ts +361 -0
- package/src/index.ts +95 -5
- package/src/react/all-types-export.parity.spec.ts +63 -3
- package/src/react/all-types-export.ts +46 -0
- package/src/react/index.spec.tsx +7 -7
- package/src/react/index.tsx +9 -9
- package/src/types.ts +665 -37
- package/src/utils/processTrigger.ts +28 -58
- package/src/utils/transport/iframe-transport.spec.ts +177 -0
- package/src/utils/transport/iframe-transport.ts +122 -0
- package/src/utils.spec.ts +71 -0
- package/src/utils.ts +38 -0
- package/cjs/src/embed/hostEventClient/contracts.d.ts +0 -231
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +0 -1
- package/cjs/src/embed/hostEventClient/contracts.js.map +0 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts +0 -231
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +0 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +0 -231
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +0 -1
- package/lib/src/embed/hostEventClient/contracts.js.map +0 -1
- package/src/embed/hostEventClient/contracts.ts +0 -262
package/src/embed/liveboard.ts
CHANGED
|
@@ -12,7 +12,6 @@ import { getPreview } from '../utils/graphql/preview-service';
|
|
|
12
12
|
import { ERROR_MESSAGE } from '../errors';
|
|
13
13
|
import {
|
|
14
14
|
EmbedEvent,
|
|
15
|
-
MessagePayload,
|
|
16
15
|
Param,
|
|
17
16
|
RuntimeFilter,
|
|
18
17
|
DOMSelector,
|
|
@@ -20,22 +19,29 @@ import {
|
|
|
20
19
|
SearchLiveboardCommonViewConfig as LiveboardOtherViewConfig,
|
|
21
20
|
BaseViewConfig,
|
|
22
21
|
LiveboardAppEmbedViewConfig,
|
|
22
|
+
FullHeightViewConfig,
|
|
23
23
|
ErrorDetailsTypes,
|
|
24
24
|
EmbedErrorCodes,
|
|
25
|
+
EmbedErrorSeverity,
|
|
25
26
|
ContextType,
|
|
26
27
|
DefaultAppInitData,
|
|
27
28
|
} from '../types';
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
29
|
+
import { FullHeightController } from '../full-height';
|
|
30
|
+
import { getQueryParamString, isUndefined, setParamIfDefined } from '../utils';
|
|
30
31
|
import { getAuthPromise } from './base';
|
|
31
32
|
import { TsEmbed, V1Embed } from './ts-embed';
|
|
32
33
|
import { addPreviewStylesIfNotPresent } from '../utils/global-styles';
|
|
33
|
-
import { HostEventRequest,
|
|
34
|
+
import { HostEventRequest, TriggerData, TriggerResponse } from '../contracts/host-event-contracts';
|
|
34
35
|
import { logger } from '../utils/logger';
|
|
35
36
|
import { SpotterChatViewConfig, StarterPromptsConfig } from './conversation';
|
|
36
37
|
import { buildStarterPromptsAppInitData } from './spotter-utils';
|
|
37
38
|
import { SpotterVizConfig, buildSpotterVizAppInitData } from './spotter-viz-utils';
|
|
38
39
|
|
|
40
|
+
// Home unmounts the liveboard container, which is how its state gets cleared. The
|
|
41
|
+
// settle window gives the container time to do it before we ask for the liveboard back.
|
|
42
|
+
const HOME_ROUTE = 'home';
|
|
43
|
+
const HOME_SETTLE_MS = 200;
|
|
44
|
+
|
|
39
45
|
/**
|
|
40
46
|
* APP_INIT data shape for LiveboardEmbed.
|
|
41
47
|
* @internal
|
|
@@ -52,71 +58,11 @@ export interface LiveboardEmbedAppInitData extends DefaultAppInitData {
|
|
|
52
58
|
* The configuration for the embedded Liveboard or visualization page view.
|
|
53
59
|
* @group Embed components
|
|
54
60
|
*/
|
|
55
|
-
export interface LiveboardViewConfig
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
* **Note**: Using fullHeight loads all visualizations on the
|
|
61
|
-
* Liveboard simultaneously, which results in multiple warehouse
|
|
62
|
-
* queries and potentially a longer wait for the topmost
|
|
63
|
-
* visualizations to display on the screen.
|
|
64
|
-
* Setting `fullHeight` to `false` fetches visualizations
|
|
65
|
-
* incrementally as users scroll the page to view the charts and tables.
|
|
66
|
-
*
|
|
67
|
-
* From SDK 1.52.0, enabling `fullHeight` also turns on
|
|
68
|
-
* {@link lazyLoadingForFullHeight} and
|
|
69
|
-
* {@link enableScrollableContainerLazyLoading}, so visualizations load as
|
|
70
|
-
* they scroll into view. Set either flag to `false` to opt out.
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* Supported embed types: `LiveboardEmbed`
|
|
74
|
-
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
|
|
75
|
-
* @example
|
|
76
|
-
* ```js
|
|
77
|
-
* const embed = new LiveboardEmbed('#embed', {
|
|
78
|
-
* ... // other liveboard view config
|
|
79
|
-
* fullHeight: true,
|
|
80
|
-
* });
|
|
81
|
-
* ```
|
|
82
|
-
*/
|
|
83
|
-
fullHeight?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* This is the minimum height (in pixels) for a full-height Liveboard.
|
|
86
|
-
* Setting this height helps resolve issues with empty Liveboards and
|
|
87
|
-
* other screens navigable from a Liveboard.
|
|
88
|
-
*
|
|
89
|
-
* Supported embed types: `LiveboardEmbed`
|
|
90
|
-
* @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
|
|
91
|
-
* @deprecated Use `minimumHeight` instead.
|
|
92
|
-
* @default 500
|
|
93
|
-
* @example
|
|
94
|
-
* ```js
|
|
95
|
-
* const embed = new LiveboardEmbed('#embed', {
|
|
96
|
-
* ... // other liveboard view config
|
|
97
|
-
* fullHeight: true,
|
|
98
|
-
* defaultHeight: 600,
|
|
99
|
-
* });
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
defaultHeight?: number;
|
|
103
|
-
/**
|
|
104
|
-
* This is the minimum height (in pixels) for a full-height Liveboard.
|
|
105
|
-
* Setting this height helps resolve issues with empty Liveboards and
|
|
106
|
-
* other screens navigable from a Liveboard.
|
|
107
|
-
*
|
|
108
|
-
* @version SDK: 1.44.2 | ThoughtSpot: 10.15.0.cl
|
|
109
|
-
* @default 500
|
|
110
|
-
* @example
|
|
111
|
-
* ```js
|
|
112
|
-
* const embed = new LiveboardEmbed('#embed', {
|
|
113
|
-
* ... // other liveboard view config
|
|
114
|
-
* fullHeight: true,
|
|
115
|
-
* minimumHeight: 600,
|
|
116
|
-
* });
|
|
117
|
-
* ```
|
|
118
|
-
*/
|
|
119
|
-
minimumHeight?: number;
|
|
61
|
+
export interface LiveboardViewConfig
|
|
62
|
+
extends BaseViewConfig,
|
|
63
|
+
FullHeightViewConfig,
|
|
64
|
+
LiveboardOtherViewConfig,
|
|
65
|
+
LiveboardAppEmbedViewConfig {
|
|
120
66
|
/**
|
|
121
67
|
* If set to true, the context menu in visualizations will be enabled.
|
|
122
68
|
* @version SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
|
|
@@ -462,77 +408,6 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
|
|
|
462
408
|
* ```
|
|
463
409
|
*/
|
|
464
410
|
isGranularXLSXCSVSchedulesEnabled?: boolean;
|
|
465
|
-
/**
|
|
466
|
-
* Loads visualizations only as they scroll into the viewport, instead of
|
|
467
|
-
* loading the whole full-height Liveboard at once.
|
|
468
|
-
*
|
|
469
|
-
* From SDK 1.52.0 this is enabled automatically whenever `fullHeight` is
|
|
470
|
-
* `true`. On SDK 1.51.0 and earlier it defaulted to `false` and had to be
|
|
471
|
-
* set explicitly. Set it to `false` to load every visualization upfront.
|
|
472
|
-
* The flag has no effect unless `fullHeight` is enabled.
|
|
473
|
-
*
|
|
474
|
-
* @type {boolean}
|
|
475
|
-
* @version SDK: 1.40.0 | ThoughtSpot: 10.12.0.cl
|
|
476
|
-
* @default true when `fullHeight` is enabled, from SDK 1.52.0
|
|
477
|
-
* @example
|
|
478
|
-
* ```js
|
|
479
|
-
* const embed = new LiveboardEmbed('#embed-container', {
|
|
480
|
-
* // ...other options
|
|
481
|
-
* fullHeight: true,
|
|
482
|
-
* lazyLoadingForFullHeight: true,
|
|
483
|
-
* })
|
|
484
|
-
* ```
|
|
485
|
-
*/
|
|
486
|
-
lazyLoadingForFullHeight?: boolean;
|
|
487
|
-
/**
|
|
488
|
-
* Computes the visible region of the embed against its scrollable and
|
|
489
|
-
* clipping ancestors, instead of treating the browser window as the only
|
|
490
|
-
* viewport, and tracks scroll and resize on those ancestors.
|
|
491
|
-
*
|
|
492
|
-
* From SDK 1.52.0 this is enabled automatically whenever `fullHeight` is
|
|
493
|
-
* `true`. On SDK 1.51.0 and earlier it defaulted to `false` and had to be
|
|
494
|
-
* set explicitly. Set it to `false` when the page scrolls with the window
|
|
495
|
-
* and the embed has no clipping ancestor, to skip the extra ancestor
|
|
496
|
-
* tracking.
|
|
497
|
-
*
|
|
498
|
-
* @type {boolean}
|
|
499
|
-
* @default true when `fullHeight` is enabled, from SDK 1.52.0
|
|
500
|
-
*/
|
|
501
|
-
enableScrollableContainerLazyLoading?: boolean;
|
|
502
|
-
/**
|
|
503
|
-
* How far outside the viewport a visualization starts loading, when
|
|
504
|
-
* {@link lazyLoadingForFullHeight} is enabled.
|
|
505
|
-
*
|
|
506
|
-
* For example, if the margin is set to '10px',
|
|
507
|
-
* the visualization will be loaded 10px before its top edge is visible in the
|
|
508
|
-
* viewport.
|
|
509
|
-
*
|
|
510
|
-
* The format is similar to CSS margin, so `'500px 0px'` extends the
|
|
511
|
-
* prefetch 500px above and below the viewport and not sideways. Accepted
|
|
512
|
-
* units are `px`, `em`, `rem`, `%`, `vh` and `vw`, plus bare `0` and
|
|
513
|
-
* `auto`; an invalid value is logged and ignored.
|
|
514
|
-
*
|
|
515
|
-
* From SDK 1.52.0 this defaults to `'500px 0px'` — roughly one
|
|
516
|
-
* visualization ahead of the scroll position, so a chart has usually
|
|
517
|
-
* finished loading by the time it scrolls into view. Use a smaller margin
|
|
518
|
-
* to cut warehouse queries further, or `'0px'` to load a visualization
|
|
519
|
-
* only once it is actually visible.
|
|
520
|
-
*
|
|
521
|
-
* @type {string}
|
|
522
|
-
* @version SDK: 1.40.0 | ThoughtSpot: 10.12.0.cl
|
|
523
|
-
* @default '500px 0px' when `fullHeight` is enabled, from SDK 1.52.0
|
|
524
|
-
* @example
|
|
525
|
-
* ```js
|
|
526
|
-
* const embed = new LiveboardEmbed('#embed-container', {
|
|
527
|
-
* // ...other options
|
|
528
|
-
* fullHeight: true,
|
|
529
|
-
* lazyLoadingForFullHeight: true,
|
|
530
|
-
* // Using 0px, the visualization will be only loaded when it's visible in the viewport.
|
|
531
|
-
* lazyLoadingMargin: '0px',
|
|
532
|
-
* })
|
|
533
|
-
* ```
|
|
534
|
-
*/
|
|
535
|
-
lazyLoadingMargin?: string;
|
|
536
411
|
/**
|
|
537
412
|
* showSpotterLimitations : show limitation text
|
|
538
413
|
* of the spotter underneath the chat input.
|
|
@@ -688,36 +563,26 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
|
|
|
688
563
|
export class LiveboardEmbed extends V1Embed {
|
|
689
564
|
protected viewConfig: LiveboardViewConfig;
|
|
690
565
|
|
|
691
|
-
private
|
|
692
|
-
|
|
693
|
-
private lazyLoadScrollContainers: HTMLElement[] = [];
|
|
694
|
-
|
|
695
|
-
private lazyLoadResizeObserver: ResizeObserver | undefined;
|
|
696
|
-
|
|
566
|
+
private readonly fullHeightController?: FullHeightController;
|
|
697
567
|
|
|
698
568
|
constructor(domSelector: DOMSelector, viewConfig: LiveboardViewConfig) {
|
|
699
569
|
viewConfig.embedComponentType = 'LiveboardEmbed';
|
|
700
570
|
super(domSelector, viewConfig);
|
|
701
571
|
if (this.viewConfig.fullHeight === true) {
|
|
702
572
|
if (this.viewConfig.vizId) {
|
|
703
|
-
logger.warn('Full height is currently only supported for Liveboard embeds.'
|
|
704
|
-
'Using full height with vizId might lead to unexpected behavior.');
|
|
573
|
+
logger.warn('Full height is currently only supported for Liveboard embeds.'
|
|
574
|
+
+ 'Using full height with vizId might lead to unexpected behavior.');
|
|
705
575
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
this.
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
718
|
-
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
719
|
-
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
720
|
-
this.on(EmbedEvent.RequestVisibleEmbedCoordinates, this.requestVisibleEmbedCoordinatesHandler);
|
|
576
|
+
this.fullHeightController = new FullHeightController(this.viewConfig, {
|
|
577
|
+
getIframe: () => this.iFrame,
|
|
578
|
+
setFrameHeight: (height) => this.setIFrameHeight(height),
|
|
579
|
+
on: (eventType, callback) => {
|
|
580
|
+
this.on(eventType, callback);
|
|
581
|
+
},
|
|
582
|
+
trigger: (hostEvent, data) => {
|
|
583
|
+
this.trigger(hostEvent, data);
|
|
584
|
+
},
|
|
585
|
+
});
|
|
721
586
|
}
|
|
722
587
|
}
|
|
723
588
|
|
|
@@ -742,9 +607,6 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
742
607
|
params = this.getBaseQueryParams(params);
|
|
743
608
|
const {
|
|
744
609
|
enableVizTransformations,
|
|
745
|
-
fullHeight,
|
|
746
|
-
defaultHeight,
|
|
747
|
-
minimumHeight,
|
|
748
610
|
visibleVizs,
|
|
749
611
|
liveboardV2,
|
|
750
612
|
vizId,
|
|
@@ -793,16 +655,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
793
655
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
794
656
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
795
657
|
|
|
796
|
-
|
|
797
|
-
params[Param.fullHeight] = true;
|
|
798
|
-
if (this.viewConfig.lazyLoadingForFullHeight) {
|
|
799
|
-
params[Param.IsLazyLoadingForEmbedEnabled] = true;
|
|
800
|
-
if (isValidCssMargin(this.viewConfig.lazyLoadingMargin)) {
|
|
801
|
-
params[Param.RootMarginForLazyLoad] = this.viewConfig.lazyLoadingMargin;
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
this.defaultHeight = minimumHeight || defaultHeight || this.defaultHeight;
|
|
658
|
+
this.fullHeightController?.addQueryParams(params);
|
|
806
659
|
if (enableVizTransformations !== undefined) {
|
|
807
660
|
params[Param.EnableVizTransformations] = enableVizTransformations.toString();
|
|
808
661
|
}
|
|
@@ -1017,32 +870,6 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1017
870
|
return suffix;
|
|
1018
871
|
}
|
|
1019
872
|
|
|
1020
|
-
private sendFullHeightLazyLoadData = () => {
|
|
1021
|
-
const data = calculateVisibleElementData(
|
|
1022
|
-
this.iFrame,
|
|
1023
|
-
this.viewConfig.enableScrollableContainerLazyLoading,
|
|
1024
|
-
);
|
|
1025
|
-
// this should be fired only if the lazyLoadingForFullHeight and fullHeight are true
|
|
1026
|
-
if(this.viewConfig.lazyLoadingForFullHeight && this.viewConfig.fullHeight){
|
|
1027
|
-
this.trigger(HostEvent.VisibleEmbedCoordinates, data);
|
|
1028
|
-
}
|
|
1029
|
-
};
|
|
1030
|
-
|
|
1031
|
-
/**
|
|
1032
|
-
* This is a handler for the RequestVisibleEmbedCoordinates event.
|
|
1033
|
-
* It is used to send the visible coordinates data to the host application.
|
|
1034
|
-
* @param data The event payload
|
|
1035
|
-
* @param responder The responder function
|
|
1036
|
-
*/
|
|
1037
|
-
private requestVisibleEmbedCoordinatesHandler = (data: MessagePayload, responder: any) => {
|
|
1038
|
-
logger.info('Sending RequestVisibleEmbedCoordinates', data);
|
|
1039
|
-
const visibleCoordinatesData = calculateVisibleElementData(
|
|
1040
|
-
this.iFrame,
|
|
1041
|
-
this.viewConfig.enableScrollableContainerLazyLoading,
|
|
1042
|
-
);
|
|
1043
|
-
responder({ type: EmbedEvent.RequestVisibleEmbedCoordinates, data: visibleCoordinatesData });
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
873
|
/**
|
|
1047
874
|
* Construct the URL of the embedded ThoughtSpot Liveboard or visualization
|
|
1048
875
|
* to be loaded within the iFrame.
|
|
@@ -1056,6 +883,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1056
883
|
errorType: ErrorDetailsTypes.VALIDATION_ERROR,
|
|
1057
884
|
message: ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION,
|
|
1058
885
|
code: EmbedErrorCodes.LIVEBOARD_ID_MISSING,
|
|
886
|
+
severity: EmbedErrorSeverity.SEV1,
|
|
1059
887
|
error: ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION,
|
|
1060
888
|
});
|
|
1061
889
|
}
|
|
@@ -1067,44 +895,6 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1067
895
|
)}`;
|
|
1068
896
|
}
|
|
1069
897
|
|
|
1070
|
-
/**
|
|
1071
|
-
* Set the iframe height as per the computed height received
|
|
1072
|
-
* from the ThoughtSpot app.
|
|
1073
|
-
* @param data The event payload
|
|
1074
|
-
*/
|
|
1075
|
-
private updateIFrameHeight = (data: MessagePayload) => {
|
|
1076
|
-
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
|
|
1077
|
-
this.sendFullHeightLazyLoadData();
|
|
1078
|
-
};
|
|
1079
|
-
|
|
1080
|
-
private embedIframeCenter = (data: MessagePayload, responder: any) => {
|
|
1081
|
-
const obj = this.getIframeCenter();
|
|
1082
|
-
responder({ type: EmbedEvent.EmbedIframeCenter, data: obj });
|
|
1083
|
-
};
|
|
1084
|
-
|
|
1085
|
-
private setIframeHeightForNonEmbedLiveboard = (data: MessagePayload) => {
|
|
1086
|
-
const { height: frameHeight } = this.viewConfig.frameParams || {};
|
|
1087
|
-
|
|
1088
|
-
const liveboardRelatedRoutes = [
|
|
1089
|
-
'/pinboard/',
|
|
1090
|
-
'/insights/pinboard/',
|
|
1091
|
-
'/schedules/',
|
|
1092
|
-
'/embed/viz/',
|
|
1093
|
-
'/embed/insights/viz/',
|
|
1094
|
-
'/liveboard/',
|
|
1095
|
-
'/insights/liveboard/',
|
|
1096
|
-
'/tsl-editor/PINBOARD_ANSWER_BOOK/',
|
|
1097
|
-
'/import-tsl/PINBOARD_ANSWER_BOOK/',
|
|
1098
|
-
];
|
|
1099
|
-
|
|
1100
|
-
if (liveboardRelatedRoutes.some((path) => data.data.currentPath.startsWith(path))) {
|
|
1101
|
-
// Ignore the height reset of the frame, if the navigation is
|
|
1102
|
-
// only within the liveboard page.
|
|
1103
|
-
return;
|
|
1104
|
-
}
|
|
1105
|
-
this.setIFrameHeight(frameHeight || this.defaultHeight);
|
|
1106
|
-
};
|
|
1107
|
-
|
|
1108
898
|
private setActiveTab(data: { tabId: string }) {
|
|
1109
899
|
if (!this.viewConfig.vizId) {
|
|
1110
900
|
const prefixPath = this.iFrame.src.split('#/')[1].split('/tab')[0];
|
|
@@ -1161,26 +951,55 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1161
951
|
|
|
1162
952
|
protected beforePrerenderVisible(): void {
|
|
1163
953
|
super.beforePrerenderVisible();
|
|
1164
|
-
const embedObj = this.getPreRenderObj<LiveboardEmbed>();
|
|
1165
954
|
|
|
1166
|
-
|
|
955
|
+
// Captured before showPreRender() hands the wrapper over to this instance.
|
|
956
|
+
// Itself means a hide/show, not a hand-over, so there is nothing stale to clear.
|
|
957
|
+
const previous = this.getPreRenderObj<LiveboardEmbed>();
|
|
958
|
+
const showing = previous === this ? undefined : previous?.currentLiveboardState;
|
|
959
|
+
|
|
960
|
+
this.executeAfterEmbedContainerLoaded(async () => {
|
|
961
|
+
// Without this the params callback suspends on its await and Navigate
|
|
962
|
+
// goes out first, so the container loads with the previous config's filters.
|
|
963
|
+
await this.preRenderParamsApplied;
|
|
964
|
+
if (this.isShowingLiveboardRoute(showing)) {
|
|
965
|
+
// Navigate to the route we are already on is a no-op, so the liveboard
|
|
966
|
+
// keeps its state. Home unmounts the container, which clears it.
|
|
967
|
+
this.trigger(HostEvent.Navigate, HOME_ROUTE)
|
|
968
|
+
.catch((error) => logger.warn('Could not route via home', error));
|
|
969
|
+
// Not awaited above: the container never acks Navigate, so that promise
|
|
970
|
+
// only settles on the 30s trigger timeout.
|
|
971
|
+
await new Promise((resolve) => {
|
|
972
|
+
setTimeout(resolve, HOME_SETTLE_MS);
|
|
973
|
+
});
|
|
974
|
+
}
|
|
1167
975
|
this.navigateToLiveboard(
|
|
1168
976
|
this.viewConfig.liveboardId,
|
|
1169
977
|
this.viewConfig.vizId,
|
|
1170
978
|
this.viewConfig.activeTabId,
|
|
1171
979
|
this.viewConfig.personalizedViewId,
|
|
1172
980
|
);
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
};
|
|
1180
|
-
}
|
|
981
|
+
this.currentLiveboardState = {
|
|
982
|
+
liveboardId: this.viewConfig.liveboardId,
|
|
983
|
+
vizId: this.viewConfig.vizId,
|
|
984
|
+
activeTabId: this.viewConfig.activeTabId,
|
|
985
|
+
personalizedViewId: this.viewConfig.personalizedViewId,
|
|
986
|
+
};
|
|
1181
987
|
});
|
|
1182
988
|
}
|
|
1183
989
|
|
|
990
|
+
// The whole route, not just the liveboard id: the path is built from the viz, tab
|
|
991
|
+
// and view too, so a same-liveboard show onto another tab is a real navigation.
|
|
992
|
+
private isShowingLiveboardRoute(showing?: LiveboardEmbed['currentLiveboardState']): boolean {
|
|
993
|
+
if (!showing?.liveboardId) return false;
|
|
994
|
+
const {
|
|
995
|
+
liveboardId, vizId, activeTabId, personalizedViewId,
|
|
996
|
+
} = this.viewConfig;
|
|
997
|
+
return showing.liveboardId === liveboardId
|
|
998
|
+
&& showing.vizId === vizId
|
|
999
|
+
&& showing.activeTabId === activeTabId
|
|
1000
|
+
&& showing.personalizedViewId === personalizedViewId;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1184
1003
|
protected async handleRenderForPrerender(): Promise<TsEmbed> {
|
|
1185
1004
|
if (isUndefined(this.viewConfig.liveboardId)) {
|
|
1186
1005
|
return this.prerenderGeneric();
|
|
@@ -1190,8 +1009,10 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1190
1009
|
|
|
1191
1010
|
/**
|
|
1192
1011
|
* Triggers an event to the embedded app
|
|
1012
|
+
* Payload typing follows {@link TsEmbed.trigger}: unknown fields fail to compile
|
|
1013
|
+
* from SDK 1.52.0; strict contract checks land in SDK 1.54.0.
|
|
1193
1014
|
* @param {HostEvent} messageType The event type
|
|
1194
|
-
* @param {
|
|
1015
|
+
* @param {TriggerData} data The payload, typed against the event's contract
|
|
1195
1016
|
* @returns A promise that resolves with the response from the embedded app
|
|
1196
1017
|
*/
|
|
1197
1018
|
public trigger<
|
|
@@ -1202,7 +1023,9 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1202
1023
|
ContextT extends ContextType = ContextType,
|
|
1203
1024
|
>(
|
|
1204
1025
|
messageType: HostEventT,
|
|
1205
|
-
|
|
1026
|
+
// Mirror TsEmbed.trigger: contract shape is the contextual type and
|
|
1027
|
+
// unknown fields on object literals are flagged. Strict in SDK 1.54.0.
|
|
1028
|
+
data: TriggerData<HostEventT> = ({} as any),
|
|
1206
1029
|
context?: ContextT,
|
|
1207
1030
|
): Promise<TriggerResponse<PayloadT, HostEventT, ContextT>> {
|
|
1208
1031
|
const dataWithVizId: any = data;
|
|
@@ -1221,53 +1044,11 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1221
1044
|
*/
|
|
1222
1045
|
public destroy() {
|
|
1223
1046
|
super.destroy();
|
|
1224
|
-
this.
|
|
1047
|
+
this.fullHeightController?.destroy();
|
|
1225
1048
|
}
|
|
1226
1049
|
|
|
1227
1050
|
private postRender() {
|
|
1228
|
-
this.
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
private registerLazyLoadEvents() {
|
|
1232
|
-
if(!this.iFrame) {
|
|
1233
|
-
return;
|
|
1234
|
-
}
|
|
1235
|
-
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
1236
|
-
this.unregisterLazyLoadEvents();
|
|
1237
|
-
// TODO: Use passive: true, install modernizr to check for passive
|
|
1238
|
-
window.addEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
1239
|
-
window.addEventListener('scroll', this.sendFullHeightLazyLoadData, true);
|
|
1240
|
-
if (!this.viewConfig.enableScrollableContainerLazyLoading) {
|
|
1241
|
-
return;
|
|
1242
|
-
}
|
|
1243
|
-
this.lazyLoadScrollContainers = getScrollableAncestors(this.iFrame);
|
|
1244
|
-
this.lazyLoadScrollContainers.forEach((scrollContainer) => {
|
|
1245
|
-
scrollContainer.addEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
1246
|
-
});
|
|
1247
|
-
if (typeof ResizeObserver !== 'undefined') {
|
|
1248
|
-
const resizeTargets = new Set([
|
|
1249
|
-
this.iFrame.parentElement,
|
|
1250
|
-
...getEffectiveClippingAncestors(this.iFrame),
|
|
1251
|
-
].filter(Boolean) as HTMLElement[]);
|
|
1252
|
-
this.lazyLoadResizeObserver = new ResizeObserver(this.sendFullHeightLazyLoadData);
|
|
1253
|
-
resizeTargets.forEach((resizeTarget) => {
|
|
1254
|
-
this.lazyLoadResizeObserver.observe(resizeTarget);
|
|
1255
|
-
});
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
private unregisterLazyLoadEvents() {
|
|
1261
|
-
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
1262
|
-
window.removeEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
1263
|
-
window.removeEventListener('scroll', this.sendFullHeightLazyLoadData, true);
|
|
1264
|
-
this.lazyLoadResizeObserver?.disconnect();
|
|
1265
|
-
this.lazyLoadResizeObserver = undefined;
|
|
1266
|
-
this.lazyLoadScrollContainers.forEach((scrollContainer) => {
|
|
1267
|
-
scrollContainer.removeEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
1268
|
-
});
|
|
1269
|
-
this.lazyLoadScrollContainers = [];
|
|
1270
|
-
}
|
|
1051
|
+
this.fullHeightController?.onRender();
|
|
1271
1052
|
}
|
|
1272
1053
|
|
|
1273
1054
|
/**
|
|
@@ -1299,7 +1080,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1299
1080
|
this.viewConfig.personalizedViewId = personalizedViewId;
|
|
1300
1081
|
if (this.isRendered) {
|
|
1301
1082
|
this.trigger(HostEvent.Navigate, path.substring(1));
|
|
1302
|
-
} else if (this.getPreRenderConfig().
|
|
1083
|
+
} else if (this.getPreRenderConfig().id) {
|
|
1303
1084
|
this.preRender(true);
|
|
1304
1085
|
} else {
|
|
1305
1086
|
this.render();
|
package/src/embed/search.spec.ts
CHANGED
|
@@ -438,6 +438,58 @@ describe('Search embed tests', () => {
|
|
|
438
438
|
});
|
|
439
439
|
});
|
|
440
440
|
|
|
441
|
+
test('should set visibility and disable state for Chart Settings V2 menu items', async () => {
|
|
442
|
+
expect(Action.ChartTypeSettings).toBe('CHART_TYPE');
|
|
443
|
+
expect(Action.LayoutSettings).toBe('LAYOUT');
|
|
444
|
+
expect(Action.ColumnSettings).toBe('COLUMN');
|
|
445
|
+
expect(Action.AxisSettings).toBe('AXIS');
|
|
446
|
+
expect(Action.DataLabelSettings).toBe('DATA_LABEL');
|
|
447
|
+
expect(Action.TooltipSettings).toBe('TOOLTIP');
|
|
448
|
+
expect(Action.LegendSettings).toBe('LEGEND');
|
|
449
|
+
expect(Action.DisplaySettings).toBe('DISPLAY');
|
|
450
|
+
expect(Action.QuerySettings).toBe('QUERY_DETAILS');
|
|
451
|
+
expect(Action.CustomSettings).toBe('CUSTOM_ACTION');
|
|
452
|
+
expect(Action.MuzeAiSettings).toBe('MUZE_AI');
|
|
453
|
+
expect(Action.RAnalysisSettings).toBe('R_ANALYSIS');
|
|
454
|
+
|
|
455
|
+
const chartSettingsActions = [
|
|
456
|
+
Action.ChartTypeSettings,
|
|
457
|
+
Action.LayoutSettings,
|
|
458
|
+
Action.ColumnSettings,
|
|
459
|
+
Action.AxisSettings,
|
|
460
|
+
Action.DataLabelSettings,
|
|
461
|
+
Action.TooltipSettings,
|
|
462
|
+
Action.LegendSettings,
|
|
463
|
+
Action.DisplaySettings,
|
|
464
|
+
Action.QuerySettings,
|
|
465
|
+
Action.CustomSettings,
|
|
466
|
+
Action.MuzeAiSettings,
|
|
467
|
+
Action.RAnalysisSettings,
|
|
468
|
+
];
|
|
469
|
+
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
470
|
+
hiddenActions: chartSettingsActions,
|
|
471
|
+
disabledActions: chartSettingsActions,
|
|
472
|
+
disabledActionReason: 'Access denied',
|
|
473
|
+
...defaultViewConfig,
|
|
474
|
+
answerId,
|
|
475
|
+
});
|
|
476
|
+
searchEmbed.render();
|
|
477
|
+
const hideActionUrl = fixedEncodeURI(
|
|
478
|
+
JSON.stringify([
|
|
479
|
+
Action.ReportError,
|
|
480
|
+
...chartSettingsActions,
|
|
481
|
+
...HiddenActionItemByDefaultForSearchEmbed,
|
|
482
|
+
]),
|
|
483
|
+
);
|
|
484
|
+
const disableActionUrl = fixedEncodeURI(JSON.stringify(chartSettingsActions));
|
|
485
|
+
await executeAfterWait(() => {
|
|
486
|
+
expectUrlMatchesWithParams(
|
|
487
|
+
getIFrameSrc(),
|
|
488
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&disableAction=${disableActionUrl}&disableHint=Access%20denied&hideAction=${hideActionUrl}&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
|
|
489
|
+
);
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
|
|
441
493
|
test('should load saved answer', async () => {
|
|
442
494
|
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
443
495
|
...defaultViewConfig,
|
|
@@ -584,6 +636,34 @@ describe('Search embed tests', () => {
|
|
|
584
636
|
});
|
|
585
637
|
});
|
|
586
638
|
|
|
639
|
+
test('Should add showAnswerEditPanel flag set to false to the iframe src when hideAnswerEditPanel is true', async () => {
|
|
640
|
+
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
641
|
+
...defaultViewConfig,
|
|
642
|
+
hideAnswerEditPanel: true,
|
|
643
|
+
});
|
|
644
|
+
searchEmbed.render();
|
|
645
|
+
await executeAfterWait(() => {
|
|
646
|
+
expectUrlMatchesWithParams(
|
|
647
|
+
getIFrameSrc(),
|
|
648
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&showAnswerEditPanel=false&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
|
|
649
|
+
);
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
test('Should add showAnswerEditPanel flag set to true to the iframe src when hideAnswerEditPanel is false', async () => {
|
|
654
|
+
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
655
|
+
...defaultViewConfig,
|
|
656
|
+
hideAnswerEditPanel: false,
|
|
657
|
+
});
|
|
658
|
+
searchEmbed.render();
|
|
659
|
+
await executeAfterWait(() => {
|
|
660
|
+
expectUrlMatchesWithParams(
|
|
661
|
+
getIFrameSrc(),
|
|
662
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&showAnswerEditPanel=true&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
|
|
663
|
+
);
|
|
664
|
+
});
|
|
665
|
+
});
|
|
666
|
+
|
|
587
667
|
test('should set dataPanelCustomGroupsAccordionInitialState to EXPAND_FIRST when passed', async () => {
|
|
588
668
|
const searchEmbed = new SearchBarEmbed(getRootEl() as any, {
|
|
589
669
|
...defaultViewConfig,
|
package/src/embed/search.ts
CHANGED
|
@@ -192,6 +192,22 @@ export interface SearchViewConfig
|
|
|
192
192
|
* ```
|
|
193
193
|
*/
|
|
194
194
|
dataSource?: string;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* If set to `true`, the answer edit panel is hidden.
|
|
198
|
+
*
|
|
199
|
+
* Supported embed types: `SearchEmbed`
|
|
200
|
+
* @version SDK: 1.54.0 | ThoughtSpot Cloud: 26.11.0.cl
|
|
201
|
+
* @example
|
|
202
|
+
* ```js
|
|
203
|
+
* const embed = new SearchEmbed('#tsEmbed', {
|
|
204
|
+
* ... // other embed view config
|
|
205
|
+
* hideAnswerEditPanel: true,
|
|
206
|
+
* })
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
hideAnswerEditPanel?: boolean;
|
|
210
|
+
|
|
195
211
|
/**
|
|
196
212
|
* The initial search query to load the answer with.
|
|
197
213
|
* Use {@link searchOptions} instead.
|
|
@@ -443,6 +459,7 @@ export class SearchEmbed extends TsEmbed {
|
|
|
443
459
|
collapseSearchBar = true,
|
|
444
460
|
isThisPeriodInDateFiltersEnabled,
|
|
445
461
|
newChartsLibrary,
|
|
462
|
+
hideAnswerEditPanel,
|
|
446
463
|
} = this.viewConfig;
|
|
447
464
|
const queryParams = this.getBaseQueryParams();
|
|
448
465
|
|
|
@@ -470,6 +487,9 @@ export class SearchEmbed extends TsEmbed {
|
|
|
470
487
|
if (enableSearchAssist) {
|
|
471
488
|
queryParams[Param.EnableSearchAssist] = true;
|
|
472
489
|
}
|
|
490
|
+
if (hideAnswerEditPanel !== undefined) {
|
|
491
|
+
queryParams[Param.ShowAnswerEditPanel] = !hideAnswerEditPanel;
|
|
492
|
+
}
|
|
473
493
|
if (hideResults) {
|
|
474
494
|
queryParams[Param.HideResult] = true;
|
|
475
495
|
}
|