@thoughtspot/visual-embed-sdk 1.44.3 → 1.44.4-HE-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cjs/package.json +1 -1
- package/cjs/src/embed/app.d.ts +44 -32
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +7 -0
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +9 -0
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +20 -3
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js +6 -1
- package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts +8 -8
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.js +18 -18
- package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js +7 -7
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +10 -4
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +12 -2
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +1 -1
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +7 -0
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +9 -0
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/search-bar.d.ts +7 -0
- package/cjs/src/embed/search-bar.d.ts.map +1 -1
- package/cjs/src/embed/search-bar.js +9 -0
- package/cjs/src/embed/search-bar.js.map +1 -1
- package/cjs/src/embed/search.d.ts +7 -0
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +9 -0
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +9 -3
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +41 -8
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +156 -24
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/errors.d.ts +1 -0
- package/cjs/src/errors.d.ts.map +1 -1
- package/cjs/src/errors.js +1 -0
- package/cjs/src/errors.js.map +1 -1
- package/cjs/src/index.d.ts +2 -2
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +5 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/types.d.ts +142 -45
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +91 -16
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/logger.spec.d.ts +20 -5
- package/cjs/src/utils/logger.spec.d.ts.map +1 -1
- package/cjs/src/utils/processTrigger.d.ts +3 -2
- package/cjs/src/utils/processTrigger.d.ts.map +1 -1
- package/cjs/src/utils/processTrigger.js +4 -2
- package/cjs/src/utils/processTrigger.js.map +1 -1
- package/cjs/src/utils.d.ts +5 -1
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +10 -2
- package/cjs/src/utils.js.map +1 -1
- package/dist/index-BFdRRz03.js +7371 -0
- package/dist/index-BUfrYJ3w.js +7371 -0
- package/dist/index-CI6s4VMY.js +7371 -0
- package/dist/{index-D0n5LIka.js → index-CWQnMX2L.js} +1 -1
- package/dist/index-CaW-1mu5.js +7371 -0
- package/dist/index-CcSgNJVi.js +7371 -0
- package/dist/index-Djtv-y7A.js +7371 -0
- package/dist/index-UY-4yjBN.js +7371 -0
- package/dist/src/embed/app.d.ts +44 -32
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +7 -0
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts +20 -3
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/host-event-client.d.ts +8 -8
- package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +10 -4
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +7 -0
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +7 -0
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +7 -0
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +9 -3
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/errors.d.ts +1 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +142 -45
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/logger.spec.d.ts +20 -5
- package/dist/src/utils/logger.spec.d.ts.map +1 -1
- package/dist/src/utils/processTrigger.d.ts +3 -2
- package/dist/src/utils/processTrigger.d.ts.map +1 -1
- package/dist/src/utils.d.ts +5 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +218 -50
- package/dist/tsembed-react.js +217 -49
- package/dist/tsembed.es.js +219 -51
- package/dist/tsembed.js +244 -76
- package/dist/visual-embed-sdk-react-full.d.ts +245 -82
- package/dist/visual-embed-sdk-react.d.ts +251 -90
- package/dist/visual-embed-sdk.d.ts +298 -92
- package/lib/package.json +1 -1
- package/lib/src/embed/app.d.ts +44 -32
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +7 -0
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +9 -0
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +20 -3
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js +5 -0
- package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.d.ts +8 -8
- package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.js +18 -18
- package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.spec.js +7 -7
- package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +10 -4
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +12 -2
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +1 -1
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/sage.d.ts +7 -0
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +9 -0
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts +7 -0
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +9 -0
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts +7 -0
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +9 -0
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +9 -3
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +41 -8
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +156 -24
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts +1 -0
- package/lib/src/errors.d.ts.map +1 -1
- package/lib/src/errors.js +1 -0
- package/lib/src/errors.js.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/types.d.ts +142 -45
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +90 -15
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/logger.spec.d.ts +20 -5
- package/lib/src/utils/logger.spec.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +3 -2
- package/lib/src/utils/processTrigger.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.js +4 -2
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils.d.ts +5 -1
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +8 -1
- package/lib/src/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/embed/app.ts +45 -32
- package/src/embed/conversation.ts +11 -0
- package/src/embed/hostEventClient/contracts.ts +23 -4
- package/src/embed/hostEventClient/host-event-client.spec.ts +7 -1
- package/src/embed/hostEventClient/host-event-client.ts +22 -11
- package/src/embed/liveboard.spec.ts +1 -1
- package/src/embed/liveboard.ts +18 -5
- package/src/embed/sage.ts +11 -0
- package/src/embed/search-bar.tsx +11 -0
- package/src/embed/search.ts +11 -0
- package/src/embed/ts-embed.spec.ts +205 -18
- package/src/embed/ts-embed.ts +45 -9
- package/src/errors.ts +1 -0
- package/src/index.ts +6 -0
- package/src/types.ts +146 -43
- package/src/utils/processTrigger.ts +6 -3
- package/src/utils.ts +10 -1
package/src/embed/app.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
AllEmbedViewConfig,
|
|
20
20
|
} from '../types';
|
|
21
21
|
import { V1Embed } from './ts-embed';
|
|
22
|
+
import { PageContextOptions } from './hostEventClient/contracts';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Pages within the ThoughtSpot app that can be embedded.
|
|
@@ -172,14 +173,14 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
172
173
|
*/
|
|
173
174
|
showPrimaryNavbar?: boolean;
|
|
174
175
|
/**
|
|
175
|
-
* Control the visibility of the left navigation
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
176
|
+
* Control the visibility of the left navigation panel on the home page
|
|
177
|
+
* in the V2 and V3 navigation and home page experience.
|
|
178
|
+
* If `showPrimaryNavbar` is true, that is, if the Global and Homepage
|
|
179
|
+
* navigation bars are visible, this flag will only hide the left navigation bar
|
|
180
|
+
* on the home page.
|
|
181
|
+
* The `showPrimaryNavbar` flag takes precedence over the `hideHomepageLeftNav`.
|
|
179
182
|
*
|
|
180
|
-
* **Note**: This
|
|
181
|
-
* To access the updated modular homepage, set
|
|
182
|
-
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
183
|
+
* **Note**: This attribute is not supported in the classic (V1) experience.
|
|
183
184
|
*
|
|
184
185
|
* Supported embed types: `AppEmbed`
|
|
185
186
|
* @default false
|
|
@@ -194,8 +195,10 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
194
195
|
*/
|
|
195
196
|
hideHomepageLeftNav?: boolean;
|
|
196
197
|
/**
|
|
197
|
-
* Control the visibility of the help (?) and profile
|
|
198
|
-
*
|
|
198
|
+
* Control the visibility of the help (?) and profile
|
|
199
|
+
* buttons on the top navigation bar.
|
|
200
|
+
* These buttons are visible if the
|
|
201
|
+
* navigation bar is not hidden via `showPrimaryNavbar`.
|
|
199
202
|
*
|
|
200
203
|
* Supported embed types: `AppEmbed`
|
|
201
204
|
* @default false
|
|
@@ -212,7 +215,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
212
215
|
/**
|
|
213
216
|
* @version SDK: 1.36.3 | ThoughtSpot: 10.1.0.cl
|
|
214
217
|
* @default true
|
|
215
|
-
* Whether the help menu in the top
|
|
218
|
+
* Whether the help menu in the top navigation bar should be served
|
|
216
219
|
* from Pendo or ThoughtSpot's internal help items.
|
|
217
220
|
*
|
|
218
221
|
* Supported embed types: `AppEmbed`
|
|
@@ -226,8 +229,8 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
226
229
|
*/
|
|
227
230
|
enablePendoHelp?: boolean
|
|
228
231
|
/**
|
|
229
|
-
* Control the visibility of the hamburger icon on
|
|
230
|
-
*
|
|
232
|
+
* Control the visibility of the hamburger icon on
|
|
233
|
+
* the top navigation bar in the V3 navigation experience.
|
|
231
234
|
*
|
|
232
235
|
* Supported embed types: `AppEmbed`
|
|
233
236
|
* @default false
|
|
@@ -242,8 +245,12 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
242
245
|
*/
|
|
243
246
|
hideHamburger?: boolean;
|
|
244
247
|
/**
|
|
245
|
-
* Control the visibility of the
|
|
246
|
-
*
|
|
248
|
+
* Control the visibility of the object search
|
|
249
|
+
* on the top navigation bar in the
|
|
250
|
+
* V2 and V3 navigation experience.
|
|
251
|
+
*
|
|
252
|
+
* **Note**: This attribute is not supported
|
|
253
|
+
* in the classic (V1) experience.
|
|
247
254
|
*
|
|
248
255
|
* Supported embed types: `AppEmbed`
|
|
249
256
|
* @default true
|
|
@@ -258,8 +265,11 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
258
265
|
*/
|
|
259
266
|
hideObjectSearch?: boolean;
|
|
260
267
|
/**
|
|
261
|
-
* Control the visibility of the notification
|
|
262
|
-
*
|
|
268
|
+
* Control the visibility of the notification icon
|
|
269
|
+
* on the top navigation bar in V3 navigation experience.
|
|
270
|
+
*
|
|
271
|
+
* **Note**: This attribute is not supported
|
|
272
|
+
* in the classic (V1) and V2 experience modes.
|
|
263
273
|
*
|
|
264
274
|
* Supported embed types: `AppEmbed`
|
|
265
275
|
* @default true
|
|
@@ -274,12 +284,14 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
274
284
|
*/
|
|
275
285
|
hideNotification?: boolean;
|
|
276
286
|
/**
|
|
277
|
-
* Control the visibility of the application
|
|
278
|
-
*
|
|
287
|
+
* Control the visibility of the application selection menu
|
|
288
|
+
* in the top navigation bar in the V2 experience.
|
|
289
|
+
* In the V3 experience, it shows or hides application selection
|
|
290
|
+
* icons on the left navigation panel.
|
|
291
|
+
* By default, the application selection menu and icons are
|
|
292
|
+
* shown in the UI
|
|
279
293
|
*
|
|
280
|
-
* **Note**: This
|
|
281
|
-
* To access the updated modular homepage, set
|
|
282
|
-
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
294
|
+
* **Note**: This attribute is not supported in the classic (V1) experience.
|
|
283
295
|
*
|
|
284
296
|
* Supported embed types: `AppEmbed`
|
|
285
297
|
* @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl
|
|
@@ -297,9 +309,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
297
309
|
* Control the visibility of the Org switcher button on the nav-bar.
|
|
298
310
|
* By default, the Org switcher button is shown.
|
|
299
311
|
*
|
|
300
|
-
* **Note**: This
|
|
301
|
-
* To access the updated modular homepage, set
|
|
302
|
-
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
312
|
+
* **Note**: This attribute is not supported in the classic (V1) experience.
|
|
303
313
|
*
|
|
304
314
|
* Supported embed types: `AppEmbed`
|
|
305
315
|
* @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl
|
|
@@ -452,8 +462,9 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
452
462
|
*/
|
|
453
463
|
fullHeight?: boolean;
|
|
454
464
|
/**
|
|
455
|
-
*
|
|
456
|
-
*
|
|
465
|
+
* Enables the V2 navigation and modular home page experience.
|
|
466
|
+
* For more information,
|
|
467
|
+
* see link:https://developers.thoughtspot.com/docs/full-app-customize[full app embed documentation].
|
|
457
468
|
* Supported embed types: `AppEmbed`
|
|
458
469
|
* @default false
|
|
459
470
|
* @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl
|
|
@@ -467,18 +478,20 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
467
478
|
*/
|
|
468
479
|
modularHomeExperience?: boolean;
|
|
469
480
|
/**
|
|
470
|
-
*
|
|
471
|
-
*
|
|
481
|
+
* Configures the V3 navigation and home page experience.
|
|
482
|
+
* For more information, see
|
|
483
|
+
* link:https://developers.thoughtspot.com/docs/full-app-customize[full app embed documentation].
|
|
472
484
|
* Supported embed types: `AppEmbed`
|
|
473
485
|
* @default false
|
|
474
486
|
* @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
475
487
|
* @example
|
|
476
488
|
* ```js
|
|
477
489
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
478
|
-
*
|
|
490
|
+
* // Enable V3 navigation and home page experience
|
|
479
491
|
* discoveryExperience : {
|
|
480
|
-
* primaryNavbarVersion: PrimaryNavbarVersion.Sliding,
|
|
481
|
-
* homePage: HomePage.
|
|
492
|
+
* primaryNavbarVersion: PrimaryNavbarVersion.Sliding, // Enable V3 navigation
|
|
493
|
+
* homePage: HomePage.ModularWithStylingChanges, // Enable V3 modular home page
|
|
494
|
+
* ... // other embed view config
|
|
482
495
|
* },
|
|
483
496
|
* })
|
|
484
497
|
* ```
|
|
@@ -631,7 +644,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
631
644
|
* Setting this height helps resolve issues with empty Apps and
|
|
632
645
|
* other screens navigable from an App.
|
|
633
646
|
*
|
|
634
|
-
* @version SDK: 1.44.2 | ThoughtSpot:
|
|
647
|
+
* @version SDK: 1.44.2 | ThoughtSpot: 10.15.0.cl
|
|
635
648
|
* @default 500
|
|
636
649
|
* @example
|
|
637
650
|
* ```js
|
|
@@ -3,6 +3,7 @@ import { ERROR_MESSAGE } from '../errors';
|
|
|
3
3
|
import { Param, BaseViewConfig, RuntimeFilter, RuntimeParameter, ErrorDetailsTypes, EmbedErrorCodes } from '../types';
|
|
4
4
|
import { TsEmbed } from './ts-embed';
|
|
5
5
|
import { getQueryParamString, getFilterQuery, getRuntimeParameters } from '../utils';
|
|
6
|
+
import { PageContextOptions } from './hostEventClient/contracts';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Configuration for search options
|
|
@@ -328,6 +329,16 @@ export class SpotterEmbed extends TsEmbed {
|
|
|
328
329
|
await this.renderIFrame(src);
|
|
329
330
|
return this;
|
|
330
331
|
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Get the current context of the embedded SpotterEmbed.
|
|
335
|
+
* @returns The current context object containing the page type and object ids.
|
|
336
|
+
* @version SDK: 1.46.0 | ThoughtSpot: 26.3.0.cl
|
|
337
|
+
*/
|
|
338
|
+
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
339
|
+
const context = await super.getCurrentContext();
|
|
340
|
+
return context;
|
|
341
|
+
}
|
|
331
342
|
}
|
|
332
343
|
|
|
333
344
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HostEvent } from '../../types';
|
|
1
|
+
import { ContextType, HostEvent } from '../../types';
|
|
2
2
|
|
|
3
3
|
export enum UIPassthroughEvent {
|
|
4
4
|
PinAnswerToLiveboard = 'addVizToPinboard',
|
|
@@ -103,7 +103,7 @@ export type HostEventRequest<HostEventT extends HostEvent> =
|
|
|
103
103
|
? UIPassthroughRequest<EmbedApiHostEventMapping[HostEventT]>
|
|
104
104
|
: any;
|
|
105
105
|
|
|
106
|
-
export type HostEventResponse<HostEventT extends HostEvent> =
|
|
106
|
+
export type HostEventResponse<HostEventT extends HostEvent, ContextT extends ContextType> =
|
|
107
107
|
HostEventT extends keyof EmbedApiHostEventMapping
|
|
108
108
|
? UIPassthroughResponse<EmbedApiHostEventMapping[HostEventT]>
|
|
109
109
|
: any;
|
|
@@ -111,5 +111,24 @@ export type HostEventResponse<HostEventT extends HostEvent> =
|
|
|
111
111
|
// trigger response and request
|
|
112
112
|
export type TriggerPayload<PayloadT, HostEventT extends HostEvent> =
|
|
113
113
|
PayloadT | HostEventRequest<HostEventT>;
|
|
114
|
-
export type TriggerResponse<PayloadT, HostEventT extends HostEvent> =
|
|
115
|
-
PayloadT extends HostEventRequest<HostEventT> ? HostEventResponse<HostEventT> : any;
|
|
114
|
+
export type TriggerResponse<PayloadT, HostEventT extends HostEvent, ContextT extends ContextType> =
|
|
115
|
+
PayloadT extends HostEventRequest<HostEventT> ? HostEventResponse<HostEventT, ContextT> : any;
|
|
116
|
+
|
|
117
|
+
export enum PageType {
|
|
118
|
+
PAGE = 'page',
|
|
119
|
+
DIALOG = 'dialog',
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface Objects {
|
|
123
|
+
answerId?: string;
|
|
124
|
+
liveboardId?: string;
|
|
125
|
+
vizIds?: string[];
|
|
126
|
+
dataModelIds?: string[];
|
|
127
|
+
modalTitle?: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface PageContextOptions {
|
|
131
|
+
page: ContextType;
|
|
132
|
+
pageType: PageType;
|
|
133
|
+
objects: Objects;
|
|
134
|
+
}
|
|
@@ -54,6 +54,7 @@ describe('HostEventClient', () => {
|
|
|
54
54
|
type: apiName,
|
|
55
55
|
parameters,
|
|
56
56
|
},
|
|
57
|
+
undefined,
|
|
57
58
|
);
|
|
58
59
|
expect(result).toEqual(await triggerResponse);
|
|
59
60
|
});
|
|
@@ -148,6 +149,7 @@ describe('HostEventClient', () => {
|
|
|
148
149
|
HostEvent.UIPassthrough,
|
|
149
150
|
'http://localhost',
|
|
150
151
|
{ parameters: payload, type: UIPassthroughEvent.PinAnswerToLiveboard },
|
|
152
|
+
undefined,
|
|
151
153
|
);
|
|
152
154
|
expect(result).toEqual(mockResponse.value);
|
|
153
155
|
});
|
|
@@ -185,6 +187,7 @@ describe('HostEventClient', () => {
|
|
|
185
187
|
parameters: payload,
|
|
186
188
|
type: 'saveAnswer',
|
|
187
189
|
},
|
|
190
|
+
undefined,
|
|
188
191
|
);
|
|
189
192
|
expect(result).toEqual({ answerId: 'newAnswer', ...mockResponse[0].value });
|
|
190
193
|
});
|
|
@@ -198,7 +201,7 @@ describe('HostEventClient', () => {
|
|
|
198
201
|
|
|
199
202
|
const result = await client.triggerHostEvent(hostEvent, payload);
|
|
200
203
|
|
|
201
|
-
expect(client.hostEventFallback).toHaveBeenCalledWith(hostEvent, payload);
|
|
204
|
+
expect(client.hostEventFallback).toHaveBeenCalledWith(hostEvent, payload, undefined);
|
|
202
205
|
expect(result).toEqual(mockResponse);
|
|
203
206
|
});
|
|
204
207
|
|
|
@@ -223,6 +226,7 @@ describe('HostEventClient', () => {
|
|
|
223
226
|
HostEvent.Pin,
|
|
224
227
|
mockThoughtSpotHost,
|
|
225
228
|
{},
|
|
229
|
+
undefined,
|
|
226
230
|
);
|
|
227
231
|
expect(result).toEqual([mockResponse]);
|
|
228
232
|
});
|
|
@@ -248,6 +252,7 @@ describe('HostEventClient', () => {
|
|
|
248
252
|
HostEvent.Save,
|
|
249
253
|
mockThoughtSpotHost,
|
|
250
254
|
{},
|
|
255
|
+
undefined,
|
|
251
256
|
);
|
|
252
257
|
expect(result).toEqual([mockResponse]);
|
|
253
258
|
});
|
|
@@ -303,6 +308,7 @@ describe('HostEventClient', () => {
|
|
|
303
308
|
parameters: { ...payload, pinboardId: 'test', newPinboardName: 'testLiveboard' },
|
|
304
309
|
type: 'addVizToPinboard',
|
|
305
310
|
},
|
|
311
|
+
undefined,
|
|
306
312
|
);
|
|
307
313
|
expect(result).toEqual({
|
|
308
314
|
pinboardId: 'testLiveboard',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HostEvent } from '../../types';
|
|
1
|
+
import { ContextType, HostEvent } from '../../types';
|
|
2
2
|
import { processTrigger as processTriggerService } from '../../utils/processTrigger';
|
|
3
3
|
import { getEmbedConfig } from '../embedConfig';
|
|
4
4
|
import {
|
|
@@ -23,7 +23,7 @@ export class HostEventClient {
|
|
|
23
23
|
* @param {any} data Data to send with the host event
|
|
24
24
|
* @returns {Promise<any>} - the response from the process trigger
|
|
25
25
|
*/
|
|
26
|
-
protected async processTrigger(message: HostEvent, data: any): Promise<any> {
|
|
26
|
+
protected async processTrigger(message: HostEvent, data: any, context?: ContextType): Promise<any> {
|
|
27
27
|
if (!this.iFrame) {
|
|
28
28
|
throw new Error('Iframe element is not set');
|
|
29
29
|
}
|
|
@@ -34,14 +34,16 @@ export class HostEventClient {
|
|
|
34
34
|
message,
|
|
35
35
|
thoughtspotHost,
|
|
36
36
|
data,
|
|
37
|
+
context,
|
|
37
38
|
);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
public async handleHostEventWithParam<UIPassthroughEventT extends UIPassthroughEvent>(
|
|
41
42
|
apiName: UIPassthroughEventT,
|
|
42
43
|
parameters: UIPassthroughRequest<UIPassthroughEventT>,
|
|
44
|
+
context?: ContextType,
|
|
43
45
|
): Promise<UIPassthroughResponse<UIPassthroughEventT>> {
|
|
44
|
-
const response = (await this.triggerUIPassthroughApi(apiName, parameters))
|
|
46
|
+
const response = (await this.triggerUIPassthroughApi(apiName, parameters, context as ContextType))
|
|
45
47
|
?.filter?.((r) => r.error || r.value)[0];
|
|
46
48
|
|
|
47
49
|
if (!response) {
|
|
@@ -65,8 +67,9 @@ export class HostEventClient {
|
|
|
65
67
|
public async hostEventFallback(
|
|
66
68
|
hostEvent: HostEvent,
|
|
67
69
|
data: any,
|
|
70
|
+
context?: ContextType,
|
|
68
71
|
): Promise<any> {
|
|
69
|
-
return this.processTrigger(hostEvent, data);
|
|
72
|
+
return this.processTrigger(hostEvent, data, context);
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
/**
|
|
@@ -80,20 +83,22 @@ export class HostEventClient {
|
|
|
80
83
|
public async triggerUIPassthroughApi<UIPassthroughEventT extends UIPassthroughEvent>(
|
|
81
84
|
apiName: UIPassthroughEventT,
|
|
82
85
|
parameters: UIPassthroughRequest<UIPassthroughEventT>,
|
|
86
|
+
context?: ContextType,
|
|
83
87
|
): Promise<UIPassthroughArrayResponse<UIPassthroughEventT>> {
|
|
84
88
|
const res = await this.processTrigger(HostEvent.UIPassthrough, {
|
|
85
89
|
type: apiName,
|
|
86
90
|
parameters,
|
|
87
|
-
});
|
|
91
|
+
}, context);
|
|
88
92
|
|
|
89
93
|
return res;
|
|
90
94
|
}
|
|
91
95
|
|
|
92
96
|
protected async handlePinEvent(
|
|
93
97
|
payload: HostEventRequest<HostEvent.Pin>,
|
|
94
|
-
|
|
98
|
+
context?: ContextType,
|
|
99
|
+
): Promise<HostEventResponse<HostEvent.Pin, ContextType>> {
|
|
95
100
|
if (!payload || !('newVizName' in payload)) {
|
|
96
|
-
return this.hostEventFallback(HostEvent.Pin, payload);
|
|
101
|
+
return this.hostEventFallback(HostEvent.Pin, payload, context);
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
const formattedPayload = {
|
|
@@ -104,6 +109,7 @@ export class HostEventClient {
|
|
|
104
109
|
|
|
105
110
|
const data = await this.handleHostEventWithParam(
|
|
106
111
|
UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload,
|
|
112
|
+
context as ContextType,
|
|
107
113
|
);
|
|
108
114
|
|
|
109
115
|
return {
|
|
@@ -114,14 +120,16 @@ export class HostEventClient {
|
|
|
114
120
|
|
|
115
121
|
protected async handleSaveAnswerEvent(
|
|
116
122
|
payload: HostEventRequest<HostEvent.SaveAnswer>,
|
|
123
|
+
context?: ContextType,
|
|
117
124
|
): Promise<any> {
|
|
118
125
|
if (!payload || !('name' in payload) || !('description' in payload)) {
|
|
119
126
|
// Save is the fallback for SaveAnswer
|
|
120
|
-
return this.hostEventFallback(HostEvent.Save, payload);
|
|
127
|
+
return this.hostEventFallback(HostEvent.Save, payload, context);
|
|
121
128
|
}
|
|
122
129
|
|
|
123
130
|
const data = await this.handleHostEventWithParam(
|
|
124
131
|
UIPassthroughEvent.SaveAnswer, payload,
|
|
132
|
+
context as ContextType,
|
|
125
133
|
);
|
|
126
134
|
return {
|
|
127
135
|
...data,
|
|
@@ -132,19 +140,22 @@ export class HostEventClient {
|
|
|
132
140
|
public async triggerHostEvent<
|
|
133
141
|
HostEventT extends HostEvent,
|
|
134
142
|
PayloadT,
|
|
143
|
+
ContextT extends ContextType,
|
|
135
144
|
>(
|
|
136
145
|
hostEvent: HostEventT,
|
|
137
146
|
payload?: TriggerPayload<PayloadT, HostEventT>,
|
|
138
|
-
|
|
147
|
+
context?: ContextT,
|
|
148
|
+
): Promise<TriggerResponse<PayloadT, HostEventT, ContextType>> {
|
|
139
149
|
switch (hostEvent) {
|
|
140
150
|
case HostEvent.Pin:
|
|
141
|
-
return this.handlePinEvent(payload as HostEventRequest<HostEvent.Pin
|
|
151
|
+
return this.handlePinEvent(payload as HostEventRequest<HostEvent.Pin>, context as ContextType) as any;
|
|
142
152
|
case HostEvent.SaveAnswer:
|
|
143
153
|
return this.handleSaveAnswerEvent(
|
|
144
154
|
payload as HostEventRequest<HostEvent.SaveAnswer>,
|
|
155
|
+
context as ContextType,
|
|
145
156
|
) as any;
|
|
146
157
|
default:
|
|
147
|
-
return this.hostEventFallback(hostEvent, payload);
|
|
158
|
+
return this.hostEventFallback(hostEvent, payload, context);
|
|
148
159
|
}
|
|
149
160
|
}
|
|
150
161
|
}
|
|
@@ -1495,7 +1495,7 @@ describe('Liveboard/viz embed tests', () => {
|
|
|
1495
1495
|
await liveboardEmbed.trigger(HostEvent.Save);
|
|
1496
1496
|
expect(mockProcessTrigger).toHaveBeenCalledWith(HostEvent.Save, {
|
|
1497
1497
|
vizId: 'testViz',
|
|
1498
|
-
});
|
|
1498
|
+
}, undefined);
|
|
1499
1499
|
});
|
|
1500
1500
|
});
|
|
1501
1501
|
});
|
package/src/embed/liveboard.ts
CHANGED
|
@@ -22,12 +22,13 @@ import {
|
|
|
22
22
|
LiveboardAppEmbedViewConfig,
|
|
23
23
|
ErrorDetailsTypes,
|
|
24
24
|
EmbedErrorCodes,
|
|
25
|
+
ContextType,
|
|
25
26
|
} from '../types';
|
|
26
27
|
import { calculateVisibleElementData, getQueryParamString, isUndefined, isValidCssMargin } from '../utils';
|
|
27
28
|
import { getAuthPromise } from './base';
|
|
28
29
|
import { TsEmbed, V1Embed } from './ts-embed';
|
|
29
30
|
import { addPreviewStylesIfNotPresent } from '../utils/global-styles';
|
|
30
|
-
import { TriggerPayload, TriggerResponse } from './hostEventClient/contracts';
|
|
31
|
+
import { TriggerPayload, TriggerResponse, PageContextOptions } from './hostEventClient/contracts';
|
|
31
32
|
import { logger } from '../utils/logger';
|
|
32
33
|
|
|
33
34
|
|
|
@@ -83,7 +84,7 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
|
|
|
83
84
|
* Setting this height helps resolve issues with empty Liveboards and
|
|
84
85
|
* other screens navigable from a Liveboard.
|
|
85
86
|
*
|
|
86
|
-
* @version SDK: 1.44.2 | ThoughtSpot:
|
|
87
|
+
* @version SDK: 1.44.2 | ThoughtSpot: 10.15.0.cl
|
|
87
88
|
* @default 500
|
|
88
89
|
* @example
|
|
89
90
|
* ```js
|
|
@@ -642,6 +643,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
642
643
|
}
|
|
643
644
|
|
|
644
645
|
private sendFullHeightLazyLoadData = () => {
|
|
646
|
+
console.log('sendFullHeightLazyLoadData', this.iFrame);
|
|
645
647
|
const data = calculateVisibleElementData(this.iFrame);
|
|
646
648
|
this.trigger(HostEvent.VisibleEmbedCoordinates, data);
|
|
647
649
|
}
|
|
@@ -800,10 +802,11 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
800
802
|
* @param {any} data The payload to send with the message
|
|
801
803
|
* @returns A promise that resolves with the response from the embedded app
|
|
802
804
|
*/
|
|
803
|
-
public trigger<HostEventT extends HostEvent, PayloadT>(
|
|
805
|
+
public trigger<HostEventT extends HostEvent, PayloadT, ContextT extends ContextType>(
|
|
804
806
|
messageType: HostEventT,
|
|
805
807
|
data: TriggerPayload<PayloadT, HostEventT> = ({} as any),
|
|
806
|
-
|
|
808
|
+
context?: ContextT,
|
|
809
|
+
): Promise<TriggerResponse<PayloadT, HostEventT, ContextT>> {
|
|
807
810
|
const dataWithVizId: any = data;
|
|
808
811
|
if (messageType === HostEvent.SetActiveTab) {
|
|
809
812
|
this.setActiveTab(data as { tabId: string });
|
|
@@ -812,7 +815,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
812
815
|
if (typeof dataWithVizId === 'object' && this.viewConfig.vizId) {
|
|
813
816
|
dataWithVizId.vizId = this.viewConfig.vizId;
|
|
814
817
|
}
|
|
815
|
-
return super.trigger(messageType, dataWithVizId);
|
|
818
|
+
return super.trigger(messageType, dataWithVizId, context);
|
|
816
819
|
}
|
|
817
820
|
/**
|
|
818
821
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
@@ -889,6 +892,16 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
889
892
|
|
|
890
893
|
return url;
|
|
891
894
|
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* Get the current context of the embedded liveboard.
|
|
898
|
+
* @returns The current context object containing the page type and object ids.
|
|
899
|
+
* @version SDK: 1.46.0 | ThoughtSpot: 26.3.0.cl
|
|
900
|
+
*/
|
|
901
|
+
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
902
|
+
const context = await super.getCurrentContext();
|
|
903
|
+
return context;
|
|
904
|
+
}
|
|
892
905
|
}
|
|
893
906
|
|
|
894
907
|
/**
|
package/src/embed/sage.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @author Mourya Balabhadra <mourya.balabhadra@thoughtspot.com>
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { PageContextOptions } from './hostEventClient/contracts';
|
|
9
10
|
import { DOMSelector, Param, BaseViewConfig, SearchLiveboardCommonViewConfig } from '../types';
|
|
10
11
|
import { getQueryParamString } from '../utils';
|
|
11
12
|
import { V1Embed } from './ts-embed';
|
|
@@ -229,4 +230,14 @@ export class SageEmbed extends V1Embed {
|
|
|
229
230
|
|
|
230
231
|
return this;
|
|
231
232
|
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Get the current context of the embedded SageEmbed.
|
|
236
|
+
* @returns The current context object containing the page type and object ids.
|
|
237
|
+
* @version SDK: 1.46.0 | ThoughtSpot: 26.3.0.cl
|
|
238
|
+
*/
|
|
239
|
+
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
240
|
+
const context = await super.getCurrentContext();
|
|
241
|
+
return context;
|
|
242
|
+
}
|
|
232
243
|
}
|
package/src/embed/search-bar.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { SearchLiveboardCommonViewConfig, BaseViewConfig, DefaultAppInitData, Pa
|
|
|
2
2
|
import { getQueryParamString } from '../utils';
|
|
3
3
|
import { TsEmbed } from './ts-embed';
|
|
4
4
|
import { SearchOptions } from './search';
|
|
5
|
+
import { PageContextOptions } from './hostEventClient/contracts';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @group Embed components
|
|
@@ -198,4 +199,14 @@ export class SearchBarEmbed extends TsEmbed {
|
|
|
198
199
|
const defaultAppInitData = await super.getAppInitData();
|
|
199
200
|
return { ...defaultAppInitData, ...this.getSearchInitData() };
|
|
200
201
|
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Get the current context of the embedded search bar.
|
|
205
|
+
* @returns The current context object containing the page type and object ids.
|
|
206
|
+
* @version SDK: 1.46.0 | ThoughtSpot: 26.3.0.cl
|
|
207
|
+
*/
|
|
208
|
+
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
209
|
+
const context = await super.getCurrentContext();
|
|
210
|
+
return context;
|
|
211
|
+
}
|
|
201
212
|
}
|
package/src/embed/search.ts
CHANGED
|
@@ -27,6 +27,7 @@ import { getAuthPromise } from './base';
|
|
|
27
27
|
import { getReleaseVersion } from '../auth';
|
|
28
28
|
import { getEmbedConfig } from './embedConfig';
|
|
29
29
|
import { getInterceptInitData } from '../api-intercept';
|
|
30
|
+
import { PageContextOptions } from './hostEventClient/contracts';
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* Configuration for search options.
|
|
@@ -523,4 +524,14 @@ export class SearchEmbed extends TsEmbed {
|
|
|
523
524
|
});
|
|
524
525
|
return this;
|
|
525
526
|
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Get the current context of the embedded search.
|
|
530
|
+
* @returns The current context object containing the page type and object ids.
|
|
531
|
+
* @version SDK: 1.46.0 | ThoughtSpot: 26.3.0.cl
|
|
532
|
+
*/
|
|
533
|
+
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
534
|
+
const context = await super.getCurrentContext();
|
|
535
|
+
return context;
|
|
536
|
+
}
|
|
526
537
|
}
|