@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
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026
|
|
3
|
+
*
|
|
4
|
+
* Typed contracts for {@link HostEvent} requests and responses.
|
|
5
|
+
*
|
|
6
|
+
* This module is the single source of truth for host event payload shapes.
|
|
7
|
+
* It is published under the `@thoughtspot/visual-embed-sdk/contracts` subpath
|
|
8
|
+
* so the ThoughtSpot app (host) can consume the exact same contract types the
|
|
9
|
+
* SDK compiles against, preventing SDK <-> host contract drift.
|
|
10
|
+
*
|
|
11
|
+
* Contract evolution rules (enforced by contracts.spec.ts snapshot):
|
|
12
|
+
* - Additive only: new events and new OPTIONAL fields may be added.
|
|
13
|
+
* - Never remove or rename an event key, or change an existing field's type.
|
|
14
|
+
* - An event absent from the maps below intentionally resolves to `any`
|
|
15
|
+
* (untyped, backward compatible) until it is audited and added.
|
|
16
|
+
* @module contracts
|
|
17
|
+
*/
|
|
18
|
+
import type {
|
|
19
|
+
ContextType,
|
|
20
|
+
HostEvent,
|
|
21
|
+
RuntimeFilter,
|
|
22
|
+
RuntimeParameter,
|
|
23
|
+
} from '../types';
|
|
24
|
+
import type {
|
|
25
|
+
Applicability,
|
|
26
|
+
EmbedApiHostEventMapping,
|
|
27
|
+
UIPassthroughContractBase,
|
|
28
|
+
UIPassthroughRequest,
|
|
29
|
+
UIPassthroughResponse,
|
|
30
|
+
} from './ui-passthrough-contracts';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Request for host events that MAY target a specific visualization.
|
|
34
|
+
* Omitting vizId targets the current answer/liveboard as a whole.
|
|
35
|
+
* (In some contexts, e.g. Spotter, the app requires vizId at runtime.)
|
|
36
|
+
*/
|
|
37
|
+
export interface VizScopedRequest {
|
|
38
|
+
vizId?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Request for host events that MUST target a specific visualization.
|
|
43
|
+
*/
|
|
44
|
+
export interface RequiredVizRequest {
|
|
45
|
+
vizId: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Request for Spotter conversation-scoped host events.
|
|
50
|
+
*/
|
|
51
|
+
export interface ConversationScopedRequest {
|
|
52
|
+
conversationId: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Request payload for {@link HostEvent.OpenFilter}. Field requirements
|
|
57
|
+
* vary by context (Search requires columnId/type/dataType/name); the
|
|
58
|
+
* contract is the cross-context superset — the app validates per context
|
|
59
|
+
* at runtime. Per-context views: {@link OpenFilterLiveboardRequest},
|
|
60
|
+
* {@link OpenFilterSpotterRequest}, {@link OpenFilterSearchRequest}.
|
|
61
|
+
*/
|
|
62
|
+
export interface OpenFilterRequest {
|
|
63
|
+
column: {
|
|
64
|
+
columnId?: string;
|
|
65
|
+
columnName?: string;
|
|
66
|
+
type?: string;
|
|
67
|
+
dataType?: string;
|
|
68
|
+
name?: string;
|
|
69
|
+
isStrictDateColumn?: boolean;
|
|
70
|
+
};
|
|
71
|
+
applicability?: Applicability;
|
|
72
|
+
visualizationId?: string;
|
|
73
|
+
liveboardId?: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* `OpenFilter` in Liveboard context: full column plus scoping fields.
|
|
78
|
+
* A per-context view of {@link OpenFilterRequest} (documentation only today;
|
|
79
|
+
* `trigger()` accepts the superset).
|
|
80
|
+
*/
|
|
81
|
+
export interface OpenFilterLiveboardRequest {
|
|
82
|
+
column: { columnId?: string; columnName?: string };
|
|
83
|
+
applicability?: Applicability;
|
|
84
|
+
visualizationId?: string;
|
|
85
|
+
liveboardId?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* `OpenFilter` in Spotter context: only the column identity is accepted.
|
|
90
|
+
*/
|
|
91
|
+
export interface OpenFilterSpotterRequest {
|
|
92
|
+
column: { columnId?: string; columnName?: string };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* `OpenFilter` in Search/Answer context: column identity plus column metadata.
|
|
97
|
+
*/
|
|
98
|
+
export interface OpenFilterSearchRequest {
|
|
99
|
+
column: {
|
|
100
|
+
columnId?: string;
|
|
101
|
+
columnName?: string;
|
|
102
|
+
type?: string;
|
|
103
|
+
dataType?: string;
|
|
104
|
+
name?: string;
|
|
105
|
+
isStrictDateColumn?: boolean;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Request payload for {@link HostEvent.DrillDown}. Drills on selected or
|
|
111
|
+
* clicked points of a visualization. In Liveboard context `vizId` is required
|
|
112
|
+
* at runtime (documentation only today; `trigger()` is not yet type-enforced).
|
|
113
|
+
*/
|
|
114
|
+
export interface DrillDownRequest {
|
|
115
|
+
points: {
|
|
116
|
+
clickedPoint?: object;
|
|
117
|
+
selectedPoints?: object[];
|
|
118
|
+
};
|
|
119
|
+
columnGuid?: string;
|
|
120
|
+
autoDrillDown?: boolean;
|
|
121
|
+
vizId?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Request payload for {@link HostEvent.OpenParameter}. One of parameterId
|
|
126
|
+
* or parameterName must be provided (validated at runtime).
|
|
127
|
+
*/
|
|
128
|
+
export interface OpenParameterRequest {
|
|
129
|
+
parameter: {
|
|
130
|
+
parameterId?: string;
|
|
131
|
+
parameterName?: string;
|
|
132
|
+
};
|
|
133
|
+
applicability?: Applicability;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Request payload for {@link HostEvent.Search}.
|
|
138
|
+
*/
|
|
139
|
+
export interface SearchRequest {
|
|
140
|
+
searchQuery: string;
|
|
141
|
+
dataSources: string[];
|
|
142
|
+
execute?: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Request payload for {@link HostEvent.SpotterSearch}.
|
|
147
|
+
*/
|
|
148
|
+
export interface SpotterSearchRequest {
|
|
149
|
+
query: string;
|
|
150
|
+
executeSearch: boolean;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* A single cross-filter condition for {@link HostEvent.UpdateCrossFilter}.
|
|
155
|
+
*/
|
|
156
|
+
export interface CrossFilterCondition {
|
|
157
|
+
columnName?: string;
|
|
158
|
+
operator?: string;
|
|
159
|
+
values: Array<string | number | boolean>;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Request payload for {@link HostEvent.UpdateCrossFilter}.
|
|
164
|
+
*/
|
|
165
|
+
export interface UpdateCrossFilterRequest {
|
|
166
|
+
vizId: string;
|
|
167
|
+
conditions: CrossFilterCondition[];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* A single filter entry for {@link HostEvent.UpdateFilters}. Supports both
|
|
172
|
+
* the current (columnName/operator) and legacy (column/oper) field names.
|
|
173
|
+
*/
|
|
174
|
+
export interface HostFilterUpdate {
|
|
175
|
+
columnName?: string;
|
|
176
|
+
columnId?: string;
|
|
177
|
+
operator?: string;
|
|
178
|
+
values: Array<string | number | boolean>;
|
|
179
|
+
type?: string;
|
|
180
|
+
datePeriod?: string;
|
|
181
|
+
negate?: boolean;
|
|
182
|
+
/** Legacy field name for columnName. */
|
|
183
|
+
column?: string;
|
|
184
|
+
/** Legacy field name for operator. */
|
|
185
|
+
oper?: string;
|
|
186
|
+
applicability?: Applicability;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Request payload for {@link HostEvent.UpdateFilters} (singular or plural
|
|
191
|
+
* form).
|
|
192
|
+
*/
|
|
193
|
+
export interface UpdateFiltersRequest {
|
|
194
|
+
filter?: HostFilterUpdate;
|
|
195
|
+
filters?: HostFilterUpdate[];
|
|
196
|
+
/**
|
|
197
|
+
* Scope the update to a specific visualization on a Liveboard.
|
|
198
|
+
* @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
|
|
199
|
+
*/
|
|
200
|
+
visualizationId?: string;
|
|
201
|
+
/**
|
|
202
|
+
* Scope the update to a specific Liveboard.
|
|
203
|
+
* @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
|
|
204
|
+
*/
|
|
205
|
+
liveboardId?: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Request payload for personalised-view host events.
|
|
210
|
+
*/
|
|
211
|
+
export interface PersonalisedViewRequest {
|
|
212
|
+
viewId?: string;
|
|
213
|
+
viewName?: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Request payload for schedule-email related host events.
|
|
218
|
+
*/
|
|
219
|
+
export interface ScheduleEmailRequest {
|
|
220
|
+
sendToSelf?: boolean;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Object form of the {@link HostEvent.Navigate} payload.
|
|
225
|
+
*/
|
|
226
|
+
export interface NavigateRequest {
|
|
227
|
+
/**
|
|
228
|
+
* Route to navigate to, or a history delta such as `1` or `-1`.
|
|
229
|
+
*/
|
|
230
|
+
path: string | number;
|
|
231
|
+
/**
|
|
232
|
+
* When `true`, replaces the current history entry instead of pushing.
|
|
233
|
+
*/
|
|
234
|
+
replace?: boolean;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Request payload for {@link HostEvent.SetActiveTab}.
|
|
239
|
+
*/
|
|
240
|
+
export interface SetActiveTabRequest {
|
|
241
|
+
/**
|
|
242
|
+
* Id of the liveboard tab to make active.
|
|
243
|
+
*/
|
|
244
|
+
tabId: string;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Typed request payloads for host events that do not go through the UI
|
|
249
|
+
* passthrough pipeline (`HostEvent` member → request type; `void` = no payload).
|
|
250
|
+
*
|
|
251
|
+
* Shapes are transcribed from the host's runtime validation schemas
|
|
252
|
+
* (embed-util HostEventContract) — what the ThoughtSpot app actually enforces —
|
|
253
|
+
* flattened across contexts to the permissive superset (context-specific
|
|
254
|
+
* requirements are validated at runtime).
|
|
255
|
+
*
|
|
256
|
+
* Responses are typed only for UI-passthrough-backed events today (see
|
|
257
|
+
* {@link HostEventResponse}). Add a response map alongside this one when the
|
|
258
|
+
* first explicit response shape is specified; tightening later is additive.
|
|
259
|
+
*
|
|
260
|
+
* Deliberately absent (do not add without an audit):
|
|
261
|
+
* - DrillDown: the runtime schema (object-shaped points) and the UI
|
|
262
|
+
* passthrough contract (string-shaped points) disagree — resolve the
|
|
263
|
+
* drift first.
|
|
264
|
+
* - GetAnswerSession/GetParameters/GetTML: typed via the UI passthrough
|
|
265
|
+
* mapping; their Spotter-context vizId requirement is runtime-only.
|
|
266
|
+
*/
|
|
267
|
+
export interface HostEventRequestMap {
|
|
268
|
+
// ==================== FILTERS AND PARAMETERS ====================
|
|
269
|
+
[HostEvent.UpdateRuntimeFilters]: RuntimeFilter[];
|
|
270
|
+
[HostEvent.UpdateParameters]: RuntimeParameter[];
|
|
271
|
+
[HostEvent.UpdateFilters]: UpdateFiltersRequest;
|
|
272
|
+
[HostEvent.UpdateCrossFilter]: UpdateCrossFilterRequest;
|
|
273
|
+
[HostEvent.OpenFilter]: OpenFilterRequest;
|
|
274
|
+
[HostEvent.OpenParameter]: OpenParameterRequest;
|
|
275
|
+
|
|
276
|
+
// ==================== TABS AND VIZS ====================
|
|
277
|
+
[HostEvent.SetVisibleVizs]: string[];
|
|
278
|
+
[HostEvent.SetVisibleTabs]: string[];
|
|
279
|
+
[HostEvent.SetHiddenTabs]: string[];
|
|
280
|
+
[HostEvent.SetActiveTab]: SetActiveTabRequest;
|
|
281
|
+
|
|
282
|
+
// ==================== NAVIGATION ====================
|
|
283
|
+
[HostEvent.Navigate]: string | number | NavigateRequest;
|
|
284
|
+
|
|
285
|
+
// ==================== SEARCH AND COLUMNS ====================
|
|
286
|
+
[HostEvent.Search]: SearchRequest;
|
|
287
|
+
[HostEvent.ResetSearch]: void;
|
|
288
|
+
[HostEvent.AddColumns]: { columnIds: string[] };
|
|
289
|
+
[HostEvent.RemoveColumn]: { columnId: string };
|
|
290
|
+
|
|
291
|
+
// ==================== VIZ-SCOPED ACTIONS ====================
|
|
292
|
+
// vizId optional in most contexts; some contexts require it at runtime.
|
|
293
|
+
[HostEvent.Edit]: VizScopedRequest;
|
|
294
|
+
[HostEvent.Save]: VizScopedRequest;
|
|
295
|
+
[HostEvent.Delete]: VizScopedRequest;
|
|
296
|
+
[HostEvent.Share]: VizScopedRequest;
|
|
297
|
+
[HostEvent.Present]: VizScopedRequest;
|
|
298
|
+
[HostEvent.CopyLink]: VizScopedRequest;
|
|
299
|
+
[HostEvent.ExportTML]: VizScopedRequest;
|
|
300
|
+
[HostEvent.EditTML]: VizScopedRequest;
|
|
301
|
+
[HostEvent.UpdateTML]: VizScopedRequest;
|
|
302
|
+
[HostEvent.SchedulesList]: VizScopedRequest;
|
|
303
|
+
[HostEvent.Schedule]: VizScopedRequest;
|
|
304
|
+
[HostEvent.SpotIQAnalyze]: VizScopedRequest;
|
|
305
|
+
[HostEvent.ShowUnderlyingData]: VizScopedRequest;
|
|
306
|
+
[HostEvent.CreateMonitor]: VizScopedRequest;
|
|
307
|
+
[HostEvent.ManageMonitor]: VizScopedRequest;
|
|
308
|
+
[HostEvent.SyncToSheets]: VizScopedRequest;
|
|
309
|
+
[HostEvent.SyncToOtherApps]: VizScopedRequest;
|
|
310
|
+
[HostEvent.ManagePipelines]: VizScopedRequest;
|
|
311
|
+
// Download shares the downloadAsPng wire value with DownloadAsPng.
|
|
312
|
+
[HostEvent.DownloadAsPng]: VizScopedRequest;
|
|
313
|
+
[HostEvent.DownloadAsCsv]: VizScopedRequest;
|
|
314
|
+
[HostEvent.DownloadAsXlsx]: VizScopedRequest;
|
|
315
|
+
[HostEvent.DownloadAsPdf]: VizScopedRequest & { liveboardId?: string };
|
|
316
|
+
|
|
317
|
+
// Viz id required in every context.
|
|
318
|
+
[HostEvent.Explore]: RequiredVizRequest;
|
|
319
|
+
[HostEvent.AskSage]: RequiredVizRequest;
|
|
320
|
+
[HostEvent.AskSpotter]: RequiredVizRequest;
|
|
321
|
+
[HostEvent.AnswerChartSwitcher]: RequiredVizRequest;
|
|
322
|
+
|
|
323
|
+
// ==================== LIVEBOARD ====================
|
|
324
|
+
[HostEvent.UpdatePersonalisedView]: Pick<PersonalisedViewRequest, 'viewId'>;
|
|
325
|
+
[HostEvent.SelectPersonalizedView]: PersonalisedViewRequest;
|
|
326
|
+
[HostEvent.ResetLiveboardPersonalisedView]: void;
|
|
327
|
+
[HostEvent.AIHighlights]: void;
|
|
328
|
+
[HostEvent.SendTestScheduleEmail]: ScheduleEmailRequest;
|
|
329
|
+
[HostEvent.RefreshLiveboardBrowserCache]: ScheduleEmailRequest;
|
|
330
|
+
|
|
331
|
+
// ==================== SPOTTER ====================
|
|
332
|
+
[HostEvent.SpotterSearch]: SpotterSearchRequest;
|
|
333
|
+
[HostEvent.ResetSpotterConversation]: void;
|
|
334
|
+
[HostEvent.ShareSpotterConversation]: ConversationScopedRequest;
|
|
335
|
+
[HostEvent.CloseSpotterShareConversation]: void;
|
|
336
|
+
[HostEvent.ExitSpotterSharedConversation]: void;
|
|
337
|
+
[HostEvent.PinSpotterConversation]: ConversationScopedRequest;
|
|
338
|
+
[HostEvent.UnpinSpotterConversation]: ConversationScopedRequest;
|
|
339
|
+
[HostEvent.EditLastPrompt]: string;
|
|
340
|
+
[HostEvent.DeleteLastPrompt]: void;
|
|
341
|
+
[HostEvent.PreviewSpotterData]: void;
|
|
342
|
+
[HostEvent.SpotterVizSendUserMessage]: { query: string };
|
|
343
|
+
[HostEvent.InitSpotterVizConversation]: void;
|
|
344
|
+
[HostEvent.OpenSpotterVizPanel]: void;
|
|
345
|
+
[HostEvent.CloseSpotterVizPanel]: void;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Per-context request shapes for events whose payload varies by
|
|
350
|
+
/**
|
|
351
|
+
* Resolves the typed request payload for a host event.
|
|
352
|
+
* Resolution order:
|
|
353
|
+
* 1. Explicitly typed request in {@link HostEventRequestMap}
|
|
354
|
+
* 2. UI passthrough backed contract ({@link EmbedApiHostEventMapping})
|
|
355
|
+
* 3. `any` (event not audited/typed yet — backward compatible)
|
|
356
|
+
*
|
|
357
|
+
* Requests are the cross-context superset today. The per-context `*Request`
|
|
358
|
+
* interfaces (e.g. {@link OpenFilterLiveboardRequest}) document how the shape
|
|
359
|
+
* narrows by context; a later release may thread the caller's context to
|
|
360
|
+
* enforce it.
|
|
361
|
+
*/
|
|
362
|
+
export type HostEventRequest<HostEventT extends HostEvent> =
|
|
363
|
+
HostEventT extends keyof HostEventRequestMap
|
|
364
|
+
? HostEventRequestMap[HostEventT]
|
|
365
|
+
: HostEventT extends keyof EmbedApiHostEventMapping
|
|
366
|
+
? UIPassthroughRequest<EmbedApiHostEventMapping[HostEventT]>
|
|
367
|
+
: any;
|
|
368
|
+
/**
|
|
369
|
+
* Resolves the typed response payload for a host event. Only UI passthrough
|
|
370
|
+
* backed events have typed responses today; everything else resolves to `any`.
|
|
371
|
+
*/
|
|
372
|
+
export type HostEventResponse<
|
|
373
|
+
HostEventT extends HostEvent,
|
|
374
|
+
// Reserved for context-dependent response shapes (additive change later).
|
|
375
|
+
ContextT extends ContextType = ContextType,
|
|
376
|
+
> = HostEventT extends keyof EmbedApiHostEventMapping
|
|
377
|
+
? UIPassthroughResponse<EmbedApiHostEventMapping[HostEventT]>
|
|
378
|
+
: any;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Payload type accepted by `embed.trigger()`. Keeps the historical
|
|
382
|
+
* `PayloadT` escape hatch so untyped existing call sites keep compiling.
|
|
383
|
+
*/
|
|
384
|
+
export type TriggerPayload<PayloadT, HostEventT extends HostEvent> =
|
|
385
|
+
PayloadT | HostEventRequest<HostEventT>;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Deep `Partial` of a request type: every field optional at every depth, with no
|
|
389
|
+
* index signature — so object literals carrying unknown fields are flagged.
|
|
390
|
+
*/
|
|
391
|
+
export type DeepPartial<T> =
|
|
392
|
+
T extends (infer U)[]
|
|
393
|
+
? DeepPartial<U>[]
|
|
394
|
+
: T extends object
|
|
395
|
+
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
396
|
+
: T;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* `trigger()`'s `data` type: an all-optional view of the event's request type.
|
|
400
|
+
* See {@link HostEventRequest} and the `*Request` interfaces, e.g. {@link SearchRequest}.
|
|
401
|
+
* No-payload events take `{}`. SDK 1.54.0 makes this strict (required fields enforced).
|
|
402
|
+
*/
|
|
403
|
+
export type TriggerData<HostEventT extends HostEvent> =
|
|
404
|
+
HostEventRequest<HostEventT> extends void
|
|
405
|
+
? Record<string, never>
|
|
406
|
+
: DeepPartial<HostEventRequest<HostEventT>>;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Response type returned by `embed.trigger()`.
|
|
410
|
+
*/
|
|
411
|
+
export type TriggerResponse<
|
|
412
|
+
PayloadT,
|
|
413
|
+
HostEventT extends HostEvent,
|
|
414
|
+
ContextT extends ContextType = ContextType,
|
|
415
|
+
> = PayloadT extends HostEventRequest<HostEventT>
|
|
416
|
+
? HostEventResponse<HostEventT, ContextT>
|
|
417
|
+
: any;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* String-name keyed views of the contracts, for the host (ThoughtSpot app)
|
|
421
|
+
* side, which addresses events by their wire value (e.g.
|
|
422
|
+
* 'UpdateRuntimeFilters') rather than the {@link HostEvent} enum member.
|
|
423
|
+
*/
|
|
424
|
+
export type HostEventName = `${HostEvent}`;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Resolves a host event's request type from its wire name.
|
|
428
|
+
*/
|
|
429
|
+
export type HostEventRequestByName<NameT extends string> = {
|
|
430
|
+
[EventT in HostEvent]: `${EventT}` extends NameT
|
|
431
|
+
? HostEventRequest<EventT>
|
|
432
|
+
: never;
|
|
433
|
+
}[HostEvent] extends never
|
|
434
|
+
? any
|
|
435
|
+
: {
|
|
436
|
+
[EventT in HostEvent]: `${EventT}` extends NameT
|
|
437
|
+
? HostEventRequest<EventT>
|
|
438
|
+
: never;
|
|
439
|
+
}[HostEvent];
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Resolves a host event's response type from its wire name.
|
|
443
|
+
*/
|
|
444
|
+
export type HostEventResponseByName<NameT extends string> = {
|
|
445
|
+
[EventT in HostEvent]: `${EventT}` extends NameT
|
|
446
|
+
? HostEventResponse<EventT>
|
|
447
|
+
: never;
|
|
448
|
+
}[HostEvent] extends never
|
|
449
|
+
? any
|
|
450
|
+
: {
|
|
451
|
+
[EventT in HostEvent]: `${EventT}` extends NameT
|
|
452
|
+
? HostEventResponse<EventT>
|
|
453
|
+
: never;
|
|
454
|
+
}[HostEvent];
|
|
455
|
+
|
|
456
|
+
export type { UIPassthroughContractBase, EmbedApiHostEventMapping };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026
|
|
3
|
+
*
|
|
4
|
+
* `@thoughtspot/visual-embed-sdk/contracts`
|
|
5
|
+
*
|
|
6
|
+
* Single source of truth for the Visual Embed SDK <-> ThoughtSpot app event
|
|
7
|
+
* contracts. Consumed by:
|
|
8
|
+
* - the SDK itself (compile-time types for `trigger()` / `on()`),
|
|
9
|
+
* - the ThoughtSpot app (host-side handler typing + runtime validation),
|
|
10
|
+
* - documentation generation.
|
|
11
|
+
*
|
|
12
|
+
* Evolution policy: ADDITIVE ONLY. See host-event-contracts.ts header.
|
|
13
|
+
* @module contracts
|
|
14
|
+
*/
|
|
15
|
+
export {
|
|
16
|
+
HostEvent,
|
|
17
|
+
EmbedEvent,
|
|
18
|
+
ContextType,
|
|
19
|
+
} from '../types';
|
|
20
|
+
export type {
|
|
21
|
+
RuntimeFilter,
|
|
22
|
+
RuntimeParameter,
|
|
23
|
+
MessagePayload,
|
|
24
|
+
// Code-based custom action config (sent to the host at init as
|
|
25
|
+
// DefaultAppInitData.customActions) + the click event payload.
|
|
26
|
+
CustomAction,
|
|
27
|
+
CustomActionPayload,
|
|
28
|
+
} from '../types';
|
|
29
|
+
export {
|
|
30
|
+
CustomActionsPosition,
|
|
31
|
+
CustomActionTarget,
|
|
32
|
+
} from '../types';
|
|
33
|
+
|
|
34
|
+
export * from './host-event-contracts';
|
|
35
|
+
export * from './embed-event-payloads';
|
|
36
|
+
|
|
37
|
+
// UI passthrough contracts remain in their historical home; re-exported so
|
|
38
|
+
// the contracts subpath is self-sufficient for host-side consumers.
|
|
39
|
+
export {
|
|
40
|
+
UIPassthroughEvent,
|
|
41
|
+
ApplicabilityLevel,
|
|
42
|
+
} from './ui-passthrough-contracts';
|
|
43
|
+
export type {
|
|
44
|
+
Applicability,
|
|
45
|
+
FilterUpdate,
|
|
46
|
+
LiveboardFilter,
|
|
47
|
+
LiveboardParameter,
|
|
48
|
+
LiveboardTab,
|
|
49
|
+
LiveboardGroup,
|
|
50
|
+
UIPassthroughRequest,
|
|
51
|
+
UIPassthroughResponse,
|
|
52
|
+
UIPassthroughArrayResponse,
|
|
53
|
+
} from './ui-passthrough-contracts';
|