@thoughtspot/visual-embed-sdk 1.52.0 → 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/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/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/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 +66 -134
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +211 -28
- 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 +17 -22
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +82 -56
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +325 -17
- 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 +3 -3
- 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.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/types.d.ts +540 -3
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +326 -1
- 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-BMppCU63.js → index-C1pmYb5H.js} +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/embed/app.d.ts +17 -140
- package/dist/src/embed/app.d.ts.map +1 -1
- 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 +17 -22
- package/dist/src/embed/ts-embed.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/types.d.ts +540 -3
- 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 +925 -363
- package/dist/tsembed-react.js +924 -362
- package/dist/tsembed.es.js +925 -363
- package/dist/tsembed.js +924 -362
- package/dist/visual-embed-sdk-react-full.d.ts +1357 -656
- package/dist/visual-embed-sdk-react.d.ts +1257 -606
- package/dist/visual-embed-sdk.d.ts +1320 -642
- package/lib/package.json +9 -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/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/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 +67 -135
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +211 -28
- 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 +17 -22
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +82 -56
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +322 -14
- 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 +1 -1
- 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.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/types.d.ts +540 -3
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +326 -1
- 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 +1320 -642
- package/package.json +9 -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/embed/app.spec.ts +86 -34
- package/src/embed/app.ts +37 -264
- 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 +257 -38
- package/src/embed/liveboard.ts +75 -296
- package/src/embed/search.spec.ts +80 -0
- package/src/embed/search.ts +20 -0
- package/src/embed/ts-embed.spec.ts +448 -15
- package/src/embed/ts-embed.ts +109 -66
- package/src/full-height.spec.ts +1008 -0
- package/src/full-height.ts +361 -0
- package/src/index.ts +93 -5
- package/src/react/all-types-export.parity.spec.ts +63 -3
- package/src/react/all-types-export.ts +45 -0
- package/src/types.ts +540 -1
- 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,23 +19,29 @@ import {
|
|
|
20
19
|
SearchLiveboardCommonViewConfig as LiveboardOtherViewConfig,
|
|
21
20
|
BaseViewConfig,
|
|
22
21
|
LiveboardAppEmbedViewConfig,
|
|
22
|
+
FullHeightViewConfig,
|
|
23
23
|
ErrorDetailsTypes,
|
|
24
24
|
EmbedErrorCodes,
|
|
25
25
|
EmbedErrorSeverity,
|
|
26
26
|
ContextType,
|
|
27
27
|
DefaultAppInitData,
|
|
28
28
|
} from '../types';
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
29
|
+
import { FullHeightController } from '../full-height';
|
|
30
|
+
import { getQueryParamString, isUndefined, setParamIfDefined } from '../utils';
|
|
31
31
|
import { getAuthPromise } from './base';
|
|
32
32
|
import { TsEmbed, V1Embed } from './ts-embed';
|
|
33
33
|
import { addPreviewStylesIfNotPresent } from '../utils/global-styles';
|
|
34
|
-
import { HostEventRequest,
|
|
34
|
+
import { HostEventRequest, TriggerData, TriggerResponse } from '../contracts/host-event-contracts';
|
|
35
35
|
import { logger } from '../utils/logger';
|
|
36
36
|
import { SpotterChatViewConfig, StarterPromptsConfig } from './conversation';
|
|
37
37
|
import { buildStarterPromptsAppInitData } from './spotter-utils';
|
|
38
38
|
import { SpotterVizConfig, buildSpotterVizAppInitData } from './spotter-viz-utils';
|
|
39
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
|
+
|
|
40
45
|
/**
|
|
41
46
|
* APP_INIT data shape for LiveboardEmbed.
|
|
42
47
|
* @internal
|
|
@@ -53,71 +58,11 @@ export interface LiveboardEmbedAppInitData extends DefaultAppInitData {
|
|
|
53
58
|
* The configuration for the embedded Liveboard or visualization page view.
|
|
54
59
|
* @group Embed components
|
|
55
60
|
*/
|
|
56
|
-
export interface LiveboardViewConfig
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
* **Note**: Using fullHeight loads all visualizations on the
|
|
62
|
-
* Liveboard simultaneously, which results in multiple warehouse
|
|
63
|
-
* queries and potentially a longer wait for the topmost
|
|
64
|
-
* visualizations to display on the screen.
|
|
65
|
-
* Setting `fullHeight` to `false` fetches visualizations
|
|
66
|
-
* incrementally as users scroll the page to view the charts and tables.
|
|
67
|
-
*
|
|
68
|
-
* From SDK 1.52.0, enabling `fullHeight` also turns on
|
|
69
|
-
* {@link lazyLoadingForFullHeight} and
|
|
70
|
-
* {@link enableScrollableContainerLazyLoading}, so visualizations load as
|
|
71
|
-
* they scroll into view. Set either flag to `false` to opt out.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* Supported embed types: `LiveboardEmbed`
|
|
75
|
-
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
|
|
76
|
-
* @example
|
|
77
|
-
* ```js
|
|
78
|
-
* const embed = new LiveboardEmbed('#embed', {
|
|
79
|
-
* ... // other liveboard view config
|
|
80
|
-
* fullHeight: true,
|
|
81
|
-
* });
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
fullHeight?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* This is the minimum height (in pixels) for a full-height Liveboard.
|
|
87
|
-
* Setting this height helps resolve issues with empty Liveboards and
|
|
88
|
-
* other screens navigable from a Liveboard.
|
|
89
|
-
*
|
|
90
|
-
* Supported embed types: `LiveboardEmbed`
|
|
91
|
-
* @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
|
|
92
|
-
* @deprecated Use `minimumHeight` instead.
|
|
93
|
-
* @default 500
|
|
94
|
-
* @example
|
|
95
|
-
* ```js
|
|
96
|
-
* const embed = new LiveboardEmbed('#embed', {
|
|
97
|
-
* ... // other liveboard view config
|
|
98
|
-
* fullHeight: true,
|
|
99
|
-
* defaultHeight: 600,
|
|
100
|
-
* });
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
defaultHeight?: number;
|
|
104
|
-
/**
|
|
105
|
-
* This is the minimum height (in pixels) for a full-height Liveboard.
|
|
106
|
-
* Setting this height helps resolve issues with empty Liveboards and
|
|
107
|
-
* other screens navigable from a Liveboard.
|
|
108
|
-
*
|
|
109
|
-
* @version SDK: 1.44.2 | ThoughtSpot: 10.15.0.cl
|
|
110
|
-
* @default 500
|
|
111
|
-
* @example
|
|
112
|
-
* ```js
|
|
113
|
-
* const embed = new LiveboardEmbed('#embed', {
|
|
114
|
-
* ... // other liveboard view config
|
|
115
|
-
* fullHeight: true,
|
|
116
|
-
* minimumHeight: 600,
|
|
117
|
-
* });
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
minimumHeight?: number;
|
|
61
|
+
export interface LiveboardViewConfig
|
|
62
|
+
extends BaseViewConfig,
|
|
63
|
+
FullHeightViewConfig,
|
|
64
|
+
LiveboardOtherViewConfig,
|
|
65
|
+
LiveboardAppEmbedViewConfig {
|
|
121
66
|
/**
|
|
122
67
|
* If set to true, the context menu in visualizations will be enabled.
|
|
123
68
|
* @version SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
|
|
@@ -463,77 +408,6 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
|
|
|
463
408
|
* ```
|
|
464
409
|
*/
|
|
465
410
|
isGranularXLSXCSVSchedulesEnabled?: boolean;
|
|
466
|
-
/**
|
|
467
|
-
* Loads visualizations only as they scroll into the viewport, instead of
|
|
468
|
-
* loading the whole full-height Liveboard at once.
|
|
469
|
-
*
|
|
470
|
-
* From SDK 1.52.0 this is enabled automatically whenever `fullHeight` is
|
|
471
|
-
* `true`. On SDK 1.51.0 and earlier it defaulted to `false` and had to be
|
|
472
|
-
* set explicitly. Set it to `false` to load every visualization upfront.
|
|
473
|
-
* The flag has no effect unless `fullHeight` is enabled.
|
|
474
|
-
*
|
|
475
|
-
* @type {boolean}
|
|
476
|
-
* @version SDK: 1.40.0 | ThoughtSpot: 10.12.0.cl
|
|
477
|
-
* @default true when `fullHeight` is enabled, from SDK 1.52.0
|
|
478
|
-
* @example
|
|
479
|
-
* ```js
|
|
480
|
-
* const embed = new LiveboardEmbed('#embed-container', {
|
|
481
|
-
* // ...other options
|
|
482
|
-
* fullHeight: true,
|
|
483
|
-
* lazyLoadingForFullHeight: true,
|
|
484
|
-
* })
|
|
485
|
-
* ```
|
|
486
|
-
*/
|
|
487
|
-
lazyLoadingForFullHeight?: boolean;
|
|
488
|
-
/**
|
|
489
|
-
* Computes the visible region of the embed against its scrollable and
|
|
490
|
-
* clipping ancestors, instead of treating the browser window as the only
|
|
491
|
-
* viewport, and tracks scroll and resize on those ancestors.
|
|
492
|
-
*
|
|
493
|
-
* From SDK 1.52.0 this is enabled automatically whenever `fullHeight` is
|
|
494
|
-
* `true`. On SDK 1.51.0 and earlier it defaulted to `false` and had to be
|
|
495
|
-
* set explicitly. Set it to `false` when the page scrolls with the window
|
|
496
|
-
* and the embed has no clipping ancestor, to skip the extra ancestor
|
|
497
|
-
* tracking.
|
|
498
|
-
*
|
|
499
|
-
* @type {boolean}
|
|
500
|
-
* @default true when `fullHeight` is enabled, from SDK 1.52.0
|
|
501
|
-
*/
|
|
502
|
-
enableScrollableContainerLazyLoading?: boolean;
|
|
503
|
-
/**
|
|
504
|
-
* How far outside the viewport a visualization starts loading, when
|
|
505
|
-
* {@link lazyLoadingForFullHeight} is enabled.
|
|
506
|
-
*
|
|
507
|
-
* For example, if the margin is set to '10px',
|
|
508
|
-
* the visualization will be loaded 10px before its top edge is visible in the
|
|
509
|
-
* viewport.
|
|
510
|
-
*
|
|
511
|
-
* The format is similar to CSS margin, so `'500px 0px'` extends the
|
|
512
|
-
* prefetch 500px above and below the viewport and not sideways. Accepted
|
|
513
|
-
* units are `px`, `em`, `rem`, `%`, `vh` and `vw`, plus bare `0` and
|
|
514
|
-
* `auto`; an invalid value is logged and ignored.
|
|
515
|
-
*
|
|
516
|
-
* From SDK 1.52.0 this defaults to `'500px 0px'` — roughly one
|
|
517
|
-
* visualization ahead of the scroll position, so a chart has usually
|
|
518
|
-
* finished loading by the time it scrolls into view. Use a smaller margin
|
|
519
|
-
* to cut warehouse queries further, or `'0px'` to load a visualization
|
|
520
|
-
* only once it is actually visible.
|
|
521
|
-
*
|
|
522
|
-
* @type {string}
|
|
523
|
-
* @version SDK: 1.40.0 | ThoughtSpot: 10.12.0.cl
|
|
524
|
-
* @default '500px 0px' when `fullHeight` is enabled, from SDK 1.52.0
|
|
525
|
-
* @example
|
|
526
|
-
* ```js
|
|
527
|
-
* const embed = new LiveboardEmbed('#embed-container', {
|
|
528
|
-
* // ...other options
|
|
529
|
-
* fullHeight: true,
|
|
530
|
-
* lazyLoadingForFullHeight: true,
|
|
531
|
-
* // Using 0px, the visualization will be only loaded when it's visible in the viewport.
|
|
532
|
-
* lazyLoadingMargin: '0px',
|
|
533
|
-
* })
|
|
534
|
-
* ```
|
|
535
|
-
*/
|
|
536
|
-
lazyLoadingMargin?: string;
|
|
537
411
|
/**
|
|
538
412
|
* showSpotterLimitations : show limitation text
|
|
539
413
|
* of the spotter underneath the chat input.
|
|
@@ -689,36 +563,26 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
|
|
|
689
563
|
export class LiveboardEmbed extends V1Embed {
|
|
690
564
|
protected viewConfig: LiveboardViewConfig;
|
|
691
565
|
|
|
692
|
-
private
|
|
693
|
-
|
|
694
|
-
private lazyLoadScrollContainers: HTMLElement[] = [];
|
|
695
|
-
|
|
696
|
-
private lazyLoadResizeObserver: ResizeObserver | undefined;
|
|
697
|
-
|
|
566
|
+
private readonly fullHeightController?: FullHeightController;
|
|
698
567
|
|
|
699
568
|
constructor(domSelector: DOMSelector, viewConfig: LiveboardViewConfig) {
|
|
700
569
|
viewConfig.embedComponentType = 'LiveboardEmbed';
|
|
701
570
|
super(domSelector, viewConfig);
|
|
702
571
|
if (this.viewConfig.fullHeight === true) {
|
|
703
572
|
if (this.viewConfig.vizId) {
|
|
704
|
-
logger.warn('Full height is currently only supported for Liveboard embeds.'
|
|
705
|
-
'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.');
|
|
706
575
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
this.
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
719
|
-
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
720
|
-
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
721
|
-
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
|
+
});
|
|
722
586
|
}
|
|
723
587
|
}
|
|
724
588
|
|
|
@@ -743,9 +607,6 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
743
607
|
params = this.getBaseQueryParams(params);
|
|
744
608
|
const {
|
|
745
609
|
enableVizTransformations,
|
|
746
|
-
fullHeight,
|
|
747
|
-
defaultHeight,
|
|
748
|
-
minimumHeight,
|
|
749
610
|
visibleVizs,
|
|
750
611
|
liveboardV2,
|
|
751
612
|
vizId,
|
|
@@ -794,16 +655,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
794
655
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
795
656
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
796
657
|
|
|
797
|
-
|
|
798
|
-
params[Param.fullHeight] = true;
|
|
799
|
-
if (this.viewConfig.lazyLoadingForFullHeight) {
|
|
800
|
-
params[Param.IsLazyLoadingForEmbedEnabled] = true;
|
|
801
|
-
if (isValidCssMargin(this.viewConfig.lazyLoadingMargin)) {
|
|
802
|
-
params[Param.RootMarginForLazyLoad] = this.viewConfig.lazyLoadingMargin;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
this.defaultHeight = minimumHeight || defaultHeight || this.defaultHeight;
|
|
658
|
+
this.fullHeightController?.addQueryParams(params);
|
|
807
659
|
if (enableVizTransformations !== undefined) {
|
|
808
660
|
params[Param.EnableVizTransformations] = enableVizTransformations.toString();
|
|
809
661
|
}
|
|
@@ -1018,32 +870,6 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1018
870
|
return suffix;
|
|
1019
871
|
}
|
|
1020
872
|
|
|
1021
|
-
private sendFullHeightLazyLoadData = () => {
|
|
1022
|
-
const data = calculateVisibleElementData(
|
|
1023
|
-
this.iFrame,
|
|
1024
|
-
this.viewConfig.enableScrollableContainerLazyLoading,
|
|
1025
|
-
);
|
|
1026
|
-
// this should be fired only if the lazyLoadingForFullHeight and fullHeight are true
|
|
1027
|
-
if(this.viewConfig.lazyLoadingForFullHeight && this.viewConfig.fullHeight){
|
|
1028
|
-
this.trigger(HostEvent.VisibleEmbedCoordinates, data);
|
|
1029
|
-
}
|
|
1030
|
-
};
|
|
1031
|
-
|
|
1032
|
-
/**
|
|
1033
|
-
* This is a handler for the RequestVisibleEmbedCoordinates event.
|
|
1034
|
-
* It is used to send the visible coordinates data to the host application.
|
|
1035
|
-
* @param data The event payload
|
|
1036
|
-
* @param responder The responder function
|
|
1037
|
-
*/
|
|
1038
|
-
private requestVisibleEmbedCoordinatesHandler = (data: MessagePayload, responder: any) => {
|
|
1039
|
-
logger.info('Sending RequestVisibleEmbedCoordinates', data);
|
|
1040
|
-
const visibleCoordinatesData = calculateVisibleElementData(
|
|
1041
|
-
this.iFrame,
|
|
1042
|
-
this.viewConfig.enableScrollableContainerLazyLoading,
|
|
1043
|
-
);
|
|
1044
|
-
responder({ type: EmbedEvent.RequestVisibleEmbedCoordinates, data: visibleCoordinatesData });
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
873
|
/**
|
|
1048
874
|
* Construct the URL of the embedded ThoughtSpot Liveboard or visualization
|
|
1049
875
|
* to be loaded within the iFrame.
|
|
@@ -1069,44 +895,6 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1069
895
|
)}`;
|
|
1070
896
|
}
|
|
1071
897
|
|
|
1072
|
-
/**
|
|
1073
|
-
* Set the iframe height as per the computed height received
|
|
1074
|
-
* from the ThoughtSpot app.
|
|
1075
|
-
* @param data The event payload
|
|
1076
|
-
*/
|
|
1077
|
-
private updateIFrameHeight = (data: MessagePayload) => {
|
|
1078
|
-
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
|
|
1079
|
-
this.sendFullHeightLazyLoadData();
|
|
1080
|
-
};
|
|
1081
|
-
|
|
1082
|
-
private embedIframeCenter = (data: MessagePayload, responder: any) => {
|
|
1083
|
-
const obj = this.getIframeCenter();
|
|
1084
|
-
responder({ type: EmbedEvent.EmbedIframeCenter, data: obj });
|
|
1085
|
-
};
|
|
1086
|
-
|
|
1087
|
-
private setIframeHeightForNonEmbedLiveboard = (data: MessagePayload) => {
|
|
1088
|
-
const { height: frameHeight } = this.viewConfig.frameParams || {};
|
|
1089
|
-
|
|
1090
|
-
const liveboardRelatedRoutes = [
|
|
1091
|
-
'/pinboard/',
|
|
1092
|
-
'/insights/pinboard/',
|
|
1093
|
-
'/schedules/',
|
|
1094
|
-
'/embed/viz/',
|
|
1095
|
-
'/embed/insights/viz/',
|
|
1096
|
-
'/liveboard/',
|
|
1097
|
-
'/insights/liveboard/',
|
|
1098
|
-
'/tsl-editor/PINBOARD_ANSWER_BOOK/',
|
|
1099
|
-
'/import-tsl/PINBOARD_ANSWER_BOOK/',
|
|
1100
|
-
];
|
|
1101
|
-
|
|
1102
|
-
if (liveboardRelatedRoutes.some((path) => data.data.currentPath.startsWith(path))) {
|
|
1103
|
-
// Ignore the height reset of the frame, if the navigation is
|
|
1104
|
-
// only within the liveboard page.
|
|
1105
|
-
return;
|
|
1106
|
-
}
|
|
1107
|
-
this.setIFrameHeight(frameHeight || this.defaultHeight);
|
|
1108
|
-
};
|
|
1109
|
-
|
|
1110
898
|
private setActiveTab(data: { tabId: string }) {
|
|
1111
899
|
if (!this.viewConfig.vizId) {
|
|
1112
900
|
const prefixPath = this.iFrame.src.split('#/')[1].split('/tab')[0];
|
|
@@ -1163,26 +951,55 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1163
951
|
|
|
1164
952
|
protected beforePrerenderVisible(): void {
|
|
1165
953
|
super.beforePrerenderVisible();
|
|
1166
|
-
const embedObj = this.getPreRenderObj<LiveboardEmbed>();
|
|
1167
954
|
|
|
1168
|
-
|
|
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
|
+
}
|
|
1169
975
|
this.navigateToLiveboard(
|
|
1170
976
|
this.viewConfig.liveboardId,
|
|
1171
977
|
this.viewConfig.vizId,
|
|
1172
978
|
this.viewConfig.activeTabId,
|
|
1173
979
|
this.viewConfig.personalizedViewId,
|
|
1174
980
|
);
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
};
|
|
1182
|
-
}
|
|
981
|
+
this.currentLiveboardState = {
|
|
982
|
+
liveboardId: this.viewConfig.liveboardId,
|
|
983
|
+
vizId: this.viewConfig.vizId,
|
|
984
|
+
activeTabId: this.viewConfig.activeTabId,
|
|
985
|
+
personalizedViewId: this.viewConfig.personalizedViewId,
|
|
986
|
+
};
|
|
1183
987
|
});
|
|
1184
988
|
}
|
|
1185
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
|
+
|
|
1186
1003
|
protected async handleRenderForPrerender(): Promise<TsEmbed> {
|
|
1187
1004
|
if (isUndefined(this.viewConfig.liveboardId)) {
|
|
1188
1005
|
return this.prerenderGeneric();
|
|
@@ -1192,8 +1009,10 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1192
1009
|
|
|
1193
1010
|
/**
|
|
1194
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.
|
|
1195
1014
|
* @param {HostEvent} messageType The event type
|
|
1196
|
-
* @param {
|
|
1015
|
+
* @param {TriggerData} data The payload, typed against the event's contract
|
|
1197
1016
|
* @returns A promise that resolves with the response from the embedded app
|
|
1198
1017
|
*/
|
|
1199
1018
|
public trigger<
|
|
@@ -1204,7 +1023,9 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1204
1023
|
ContextT extends ContextType = ContextType,
|
|
1205
1024
|
>(
|
|
1206
1025
|
messageType: HostEventT,
|
|
1207
|
-
|
|
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),
|
|
1208
1029
|
context?: ContextT,
|
|
1209
1030
|
): Promise<TriggerResponse<PayloadT, HostEventT, ContextT>> {
|
|
1210
1031
|
const dataWithVizId: any = data;
|
|
@@ -1223,53 +1044,11 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
1223
1044
|
*/
|
|
1224
1045
|
public destroy() {
|
|
1225
1046
|
super.destroy();
|
|
1226
|
-
this.
|
|
1047
|
+
this.fullHeightController?.destroy();
|
|
1227
1048
|
}
|
|
1228
1049
|
|
|
1229
1050
|
private postRender() {
|
|
1230
|
-
this.
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
private registerLazyLoadEvents() {
|
|
1234
|
-
if(!this.iFrame) {
|
|
1235
|
-
return;
|
|
1236
|
-
}
|
|
1237
|
-
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
1238
|
-
this.unregisterLazyLoadEvents();
|
|
1239
|
-
// TODO: Use passive: true, install modernizr to check for passive
|
|
1240
|
-
window.addEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
1241
|
-
window.addEventListener('scroll', this.sendFullHeightLazyLoadData, true);
|
|
1242
|
-
if (!this.viewConfig.enableScrollableContainerLazyLoading) {
|
|
1243
|
-
return;
|
|
1244
|
-
}
|
|
1245
|
-
this.lazyLoadScrollContainers = getScrollableAncestors(this.iFrame);
|
|
1246
|
-
this.lazyLoadScrollContainers.forEach((scrollContainer) => {
|
|
1247
|
-
scrollContainer.addEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
1248
|
-
});
|
|
1249
|
-
if (typeof ResizeObserver !== 'undefined') {
|
|
1250
|
-
const resizeTargets = new Set([
|
|
1251
|
-
this.iFrame.parentElement,
|
|
1252
|
-
...getEffectiveClippingAncestors(this.iFrame),
|
|
1253
|
-
].filter(Boolean) as HTMLElement[]);
|
|
1254
|
-
this.lazyLoadResizeObserver = new ResizeObserver(this.sendFullHeightLazyLoadData);
|
|
1255
|
-
resizeTargets.forEach((resizeTarget) => {
|
|
1256
|
-
this.lazyLoadResizeObserver.observe(resizeTarget);
|
|
1257
|
-
});
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
private unregisterLazyLoadEvents() {
|
|
1263
|
-
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
1264
|
-
window.removeEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
1265
|
-
window.removeEventListener('scroll', this.sendFullHeightLazyLoadData, true);
|
|
1266
|
-
this.lazyLoadResizeObserver?.disconnect();
|
|
1267
|
-
this.lazyLoadResizeObserver = undefined;
|
|
1268
|
-
this.lazyLoadScrollContainers.forEach((scrollContainer) => {
|
|
1269
|
-
scrollContainer.removeEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
1270
|
-
});
|
|
1271
|
-
this.lazyLoadScrollContainers = [];
|
|
1272
|
-
}
|
|
1051
|
+
this.fullHeightController?.onRender();
|
|
1273
1052
|
}
|
|
1274
1053
|
|
|
1275
1054
|
/**
|
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
|
}
|