@thoughtspot/visual-embed-sdk 1.42.2 → 1.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/package.json +1 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +2 -0
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +17 -2
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +134 -41
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/types.d.ts +159 -69
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +146 -68
- package/cjs/src/types.js.map +1 -1
- package/dist/{index-CjbriUI0.js → index-HZ94j9Ey.js} +1 -1
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/types.d.ts +159 -69
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +168 -73
- package/dist/tsembed-react.js +167 -72
- package/dist/tsembed.es.js +168 -73
- package/dist/tsembed.js +167 -72
- package/dist/visual-embed-sdk-react-full.d.ts +159 -69
- package/dist/visual-embed-sdk-react.d.ts +159 -69
- package/dist/visual-embed-sdk.d.ts +159 -69
- package/lib/package.json +1 -1
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +2 -0
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +17 -2
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +134 -41
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/types.d.ts +159 -69
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +146 -68
- package/lib/src/types.js.map +1 -1
- package/package.json +1 -1
- package/src/embed/base.ts +2 -0
- package/src/embed/ts-embed.spec.ts +168 -44
- package/src/embed/ts-embed.ts +14 -1
- package/src/types.ts +159 -68
|
@@ -2428,50 +2428,6 @@ describe('Unit test case for ts embed', () => {
|
|
|
2428
2428
|
});
|
|
2429
2429
|
});
|
|
2430
2430
|
|
|
2431
|
-
describe('When destroyed', () => {
|
|
2432
|
-
it('should remove the iframe', async () => {
|
|
2433
|
-
const appEmbed = new AppEmbed(getRootEl(), {
|
|
2434
|
-
frameParams: {
|
|
2435
|
-
width: '100%',
|
|
2436
|
-
height: '100%',
|
|
2437
|
-
},
|
|
2438
|
-
});
|
|
2439
|
-
await appEmbed.render();
|
|
2440
|
-
expect(getIFrameEl()).toBeTruthy();
|
|
2441
|
-
appEmbed.destroy();
|
|
2442
|
-
expect(getIFrameEl()).toBeFalsy();
|
|
2443
|
-
});
|
|
2444
|
-
|
|
2445
|
-
it('should remove the iframe when insertAsSibling is true', async () => {
|
|
2446
|
-
const appEmbed = new AppEmbed(getRootEl(), {
|
|
2447
|
-
frameParams: {
|
|
2448
|
-
width: '100%',
|
|
2449
|
-
height: '100%',
|
|
2450
|
-
},
|
|
2451
|
-
insertAsSibling: true,
|
|
2452
|
-
});
|
|
2453
|
-
await appEmbed.render();
|
|
2454
|
-
expect(getIFrameEl()).toBeTruthy();
|
|
2455
|
-
appEmbed.destroy();
|
|
2456
|
-
expect(getIFrameEl()).toBeFalsy();
|
|
2457
|
-
});
|
|
2458
|
-
|
|
2459
|
-
it("Should remove the error message on destroy if it's present", async () => {
|
|
2460
|
-
jest.spyOn(baseInstance, 'getAuthPromise').mockResolvedValueOnce(false);
|
|
2461
|
-
const appEmbed = new AppEmbed(getRootEl(), {
|
|
2462
|
-
frameParams: {
|
|
2463
|
-
width: '100%',
|
|
2464
|
-
height: '100%',
|
|
2465
|
-
},
|
|
2466
|
-
insertAsSibling: true,
|
|
2467
|
-
});
|
|
2468
|
-
await appEmbed.render();
|
|
2469
|
-
expect(getRootEl().nextElementSibling.innerHTML).toContain('Not logged in');
|
|
2470
|
-
appEmbed.destroy();
|
|
2471
|
-
expect(getRootEl().nextElementSibling.innerHTML).toBe('');
|
|
2472
|
-
});
|
|
2473
|
-
});
|
|
2474
|
-
|
|
2475
2431
|
describe('validate getThoughtSpotPostUrlParams', () => {
|
|
2476
2432
|
const { location } = window;
|
|
2477
2433
|
|
|
@@ -3456,4 +3412,172 @@ describe('Unit test case for ts embed', () => {
|
|
|
3456
3412
|
triggerSpy.mockReset();
|
|
3457
3413
|
});
|
|
3458
3414
|
});
|
|
3415
|
+
|
|
3416
|
+
describe('When destroyed', () => {
|
|
3417
|
+
it('should remove the iframe', async () => {
|
|
3418
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
3419
|
+
frameParams: {
|
|
3420
|
+
width: '100%',
|
|
3421
|
+
height: '100%',
|
|
3422
|
+
},
|
|
3423
|
+
});
|
|
3424
|
+
await appEmbed.render();
|
|
3425
|
+
expect(getIFrameEl()).toBeTruthy();
|
|
3426
|
+
appEmbed.destroy();
|
|
3427
|
+
expect(getIFrameEl()).toBeFalsy();
|
|
3428
|
+
});
|
|
3429
|
+
|
|
3430
|
+
it('should remove the iframe when insertAsSibling is true', async () => {
|
|
3431
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
3432
|
+
frameParams: {
|
|
3433
|
+
width: '100%',
|
|
3434
|
+
height: '100%',
|
|
3435
|
+
},
|
|
3436
|
+
insertAsSibling: true,
|
|
3437
|
+
});
|
|
3438
|
+
await appEmbed.render();
|
|
3439
|
+
expect(getIFrameEl()).toBeTruthy();
|
|
3440
|
+
appEmbed.destroy();
|
|
3441
|
+
expect(getIFrameEl()).toBeFalsy();
|
|
3442
|
+
});
|
|
3443
|
+
|
|
3444
|
+
it("Should remove the error message on destroy if it's present", async () => {
|
|
3445
|
+
jest.spyOn(baseInstance, 'getAuthPromise').mockResolvedValueOnce(false);
|
|
3446
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
3447
|
+
frameParams: {
|
|
3448
|
+
width: '100%',
|
|
3449
|
+
height: '100%',
|
|
3450
|
+
},
|
|
3451
|
+
insertAsSibling: true,
|
|
3452
|
+
});
|
|
3453
|
+
await appEmbed.render();
|
|
3454
|
+
expect(getRootEl().nextElementSibling.innerHTML).toContain('Not logged in');
|
|
3455
|
+
appEmbed.destroy();
|
|
3456
|
+
expect(getRootEl().nextElementSibling.innerHTML).toBe('');
|
|
3457
|
+
});
|
|
3458
|
+
|
|
3459
|
+
describe('with waitForCleanupOnDestroy configuration', () => {
|
|
3460
|
+
let originalEmbedConfig: any;
|
|
3461
|
+
|
|
3462
|
+
beforeEach(() => {
|
|
3463
|
+
originalEmbedConfig = embedConfig.getEmbedConfig();
|
|
3464
|
+
});
|
|
3465
|
+
|
|
3466
|
+
afterEach(() => {
|
|
3467
|
+
embedConfig.setEmbedConfig(originalEmbedConfig);
|
|
3468
|
+
});
|
|
3469
|
+
|
|
3470
|
+
it('should trigger DestroyEmbed event immediately when waitForCleanupOnDestroy is false', async () => {
|
|
3471
|
+
embedConfig.setEmbedConfig({
|
|
3472
|
+
...originalEmbedConfig,
|
|
3473
|
+
waitForCleanupOnDestroy: false,
|
|
3474
|
+
});
|
|
3475
|
+
|
|
3476
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
3477
|
+
frameParams: {
|
|
3478
|
+
width: '100%',
|
|
3479
|
+
height: '100%',
|
|
3480
|
+
},
|
|
3481
|
+
});
|
|
3482
|
+
await appEmbed.render();
|
|
3483
|
+
|
|
3484
|
+
const triggerSpy = jest.spyOn(appEmbed, 'trigger').mockResolvedValue(null);
|
|
3485
|
+
const removeChildSpy = jest.spyOn(Node.prototype, 'removeChild').mockImplementation(() => getRootEl());
|
|
3486
|
+
|
|
3487
|
+
appEmbed.destroy();
|
|
3488
|
+
|
|
3489
|
+
expect(triggerSpy).toHaveBeenCalledWith(HostEvent.DestroyEmbed);
|
|
3490
|
+
expect(removeChildSpy).toHaveBeenCalled();
|
|
3491
|
+
});
|
|
3492
|
+
|
|
3493
|
+
it('should trigger DestroyEmbed event and wait for cleanup when waitForCleanupOnDestroy is true', async () => {
|
|
3494
|
+
embedConfig.setEmbedConfig({
|
|
3495
|
+
...originalEmbedConfig,
|
|
3496
|
+
waitForCleanupOnDestroy: true,
|
|
3497
|
+
cleanupTimeout: 1000,
|
|
3498
|
+
});
|
|
3499
|
+
|
|
3500
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
3501
|
+
frameParams: {
|
|
3502
|
+
width: '100%',
|
|
3503
|
+
height: '100%',
|
|
3504
|
+
},
|
|
3505
|
+
});
|
|
3506
|
+
await appEmbed.render();
|
|
3507
|
+
|
|
3508
|
+
const triggerSpy = jest.spyOn(appEmbed, 'trigger').mockResolvedValue(null);
|
|
3509
|
+
const removeChildSpy = jest.spyOn(Node.prototype, 'removeChild').mockImplementation(() => getRootEl());
|
|
3510
|
+
|
|
3511
|
+
appEmbed.destroy();
|
|
3512
|
+
|
|
3513
|
+
// Should be called immediately when waitForCleanupOnDestroy is true
|
|
3514
|
+
expect(triggerSpy).toHaveBeenCalledWith(HostEvent.DestroyEmbed);
|
|
3515
|
+
|
|
3516
|
+
// Wait for the timeout to complete
|
|
3517
|
+
await new Promise(resolve => setTimeout(resolve, 1100));
|
|
3518
|
+
|
|
3519
|
+
expect(removeChildSpy).toHaveBeenCalled();
|
|
3520
|
+
});
|
|
3521
|
+
|
|
3522
|
+
it('should handle Promise.race with successful cleanup completion', async () => {
|
|
3523
|
+
embedConfig.setEmbedConfig({
|
|
3524
|
+
...originalEmbedConfig,
|
|
3525
|
+
waitForCleanupOnDestroy: true,
|
|
3526
|
+
cleanupTimeout: 2000,
|
|
3527
|
+
});
|
|
3528
|
+
|
|
3529
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
3530
|
+
frameParams: {
|
|
3531
|
+
width: '100%',
|
|
3532
|
+
height: '100%',
|
|
3533
|
+
},
|
|
3534
|
+
});
|
|
3535
|
+
await appEmbed.render();
|
|
3536
|
+
|
|
3537
|
+
// Mock trigger to resolve quickly (before timeout)
|
|
3538
|
+
const triggerSpy = jest.spyOn(appEmbed, 'trigger').mockImplementation(() =>
|
|
3539
|
+
new Promise(resolve => setTimeout(() => resolve(null), 100))
|
|
3540
|
+
);
|
|
3541
|
+
const removeChildSpy = jest.spyOn(Node.prototype, 'removeChild').mockImplementation(() => getRootEl());
|
|
3542
|
+
|
|
3543
|
+
appEmbed.destroy();
|
|
3544
|
+
|
|
3545
|
+
// Wait for the trigger to complete
|
|
3546
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
3547
|
+
|
|
3548
|
+
expect(triggerSpy).toHaveBeenCalledWith(HostEvent.DestroyEmbed);
|
|
3549
|
+
expect(removeChildSpy).toHaveBeenCalled();
|
|
3550
|
+
});
|
|
3551
|
+
|
|
3552
|
+
it('should handle Promise.race with timeout when cleanup takes too long', async () => {
|
|
3553
|
+
embedConfig.setEmbedConfig({
|
|
3554
|
+
...originalEmbedConfig,
|
|
3555
|
+
waitForCleanupOnDestroy: true,
|
|
3556
|
+
cleanupTimeout: 100,
|
|
3557
|
+
});
|
|
3558
|
+
|
|
3559
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
3560
|
+
frameParams: {
|
|
3561
|
+
width: '100%',
|
|
3562
|
+
height: '100%',
|
|
3563
|
+
},
|
|
3564
|
+
});
|
|
3565
|
+
await appEmbed.render();
|
|
3566
|
+
|
|
3567
|
+
// Mock trigger to take longer than timeout
|
|
3568
|
+
const triggerSpy = jest.spyOn(appEmbed, 'trigger').mockImplementation(() =>
|
|
3569
|
+
new Promise(resolve => setTimeout(() => resolve(null), 500))
|
|
3570
|
+
);
|
|
3571
|
+
const removeChildSpy = jest.spyOn(Node.prototype, 'removeChild').mockImplementation(() => getRootEl());
|
|
3572
|
+
|
|
3573
|
+
appEmbed.destroy();
|
|
3574
|
+
|
|
3575
|
+
// Wait for the timeout to complete
|
|
3576
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
3577
|
+
|
|
3578
|
+
expect(triggerSpy).toHaveBeenCalledWith(HostEvent.DestroyEmbed);
|
|
3579
|
+
expect(removeChildSpy).toHaveBeenCalled();
|
|
3580
|
+
});
|
|
3581
|
+
});
|
|
3582
|
+
});
|
|
3459
3583
|
});
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -1396,8 +1396,21 @@ export class TsEmbed {
|
|
|
1396
1396
|
public destroy(): void {
|
|
1397
1397
|
try {
|
|
1398
1398
|
this.removeFullscreenChangeHandler();
|
|
1399
|
-
this.insertedDomEl?.parentNode.removeChild(this.insertedDomEl);
|
|
1400
1399
|
this.unsubscribeToEvents();
|
|
1400
|
+
if (!getEmbedConfig().waitForCleanupOnDestroy) {
|
|
1401
|
+
this.trigger(HostEvent.DestroyEmbed)
|
|
1402
|
+
this.insertedDomEl?.parentNode?.removeChild(this.insertedDomEl);
|
|
1403
|
+
} else {
|
|
1404
|
+
const cleanupTimeout = getEmbedConfig().cleanupTimeout;
|
|
1405
|
+
Promise.race([
|
|
1406
|
+
this.trigger(HostEvent.DestroyEmbed),
|
|
1407
|
+
new Promise((resolve) => setTimeout(resolve, cleanupTimeout)),
|
|
1408
|
+
]).then(() => {
|
|
1409
|
+
this.insertedDomEl?.parentNode?.removeChild(this.insertedDomEl);
|
|
1410
|
+
}).catch((e) => {
|
|
1411
|
+
logger.log('Error destroying TS Embed', e);
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1401
1414
|
} catch (e) {
|
|
1402
1415
|
logger.log('Error destroying TS Embed', e);
|
|
1403
1416
|
}
|
package/src/types.ts
CHANGED
|
@@ -692,6 +692,19 @@ export interface EmbedConfig {
|
|
|
692
692
|
* ```
|
|
693
693
|
*/
|
|
694
694
|
customActions?: CustomAction[];
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Wait for the cleanup to be completed before destroying the embed.
|
|
698
|
+
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
699
|
+
* @default false
|
|
700
|
+
*/
|
|
701
|
+
waitForCleanupOnDestroy?: boolean;
|
|
702
|
+
/**
|
|
703
|
+
* The timeout for the cleanup to be completed before destroying the embed.
|
|
704
|
+
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
705
|
+
* @default 5000
|
|
706
|
+
*/
|
|
707
|
+
cleanupTimeout?: number;
|
|
695
708
|
}
|
|
696
709
|
|
|
697
710
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
@@ -1868,7 +1881,7 @@ export enum EmbedEvent {
|
|
|
1868
1881
|
*/
|
|
1869
1882
|
Load = 'load',
|
|
1870
1883
|
/**
|
|
1871
|
-
* Data pertaining to an Answer or
|
|
1884
|
+
* Data pertaining to an Answer, Liveboard or Spotter visualization is received.
|
|
1872
1885
|
* The event payload includes the raw data of the object.
|
|
1873
1886
|
* @return data - Answer of Liveboard data
|
|
1874
1887
|
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
@@ -2289,6 +2302,17 @@ export enum EmbedEvent {
|
|
|
2289
2302
|
*```
|
|
2290
2303
|
*/
|
|
2291
2304
|
AnswerDelete = 'answerDelete',
|
|
2305
|
+
/**
|
|
2306
|
+
* Emitted when the AI Highlights action is triggered on a Liveboard
|
|
2307
|
+
* @version SDK: 1.44.0 | ThoughtSpot: 10.15.0.cl
|
|
2308
|
+
* @example
|
|
2309
|
+
*```js
|
|
2310
|
+
* liveboardEmbed.on(EmbedEvent.AIHighlights, (payload) => {
|
|
2311
|
+
* console.log('AI Highlights', payload);
|
|
2312
|
+
* })
|
|
2313
|
+
*```
|
|
2314
|
+
*/
|
|
2315
|
+
AIHighlights = 'AIHighlights',
|
|
2292
2316
|
/**
|
|
2293
2317
|
* Emitted when a user initiates the Pin action to
|
|
2294
2318
|
* add an Answer to a Liveboard.
|
|
@@ -3240,7 +3264,7 @@ export enum HostEvent {
|
|
|
3240
3264
|
* the following parameters:
|
|
3241
3265
|
*
|
|
3242
3266
|
* @param
|
|
3243
|
-
* `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
|
|
3267
|
+
* `vizId`- GUID of the saved Answer or Spotter visualization ID to pin to a Liveboard.
|
|
3244
3268
|
* Optional when pinning a new chart or table generated from a Search query.
|
|
3245
3269
|
* **Required** in Spotter Embed.
|
|
3246
3270
|
* @param
|
|
@@ -3292,10 +3316,16 @@ export enum HostEvent {
|
|
|
3292
3316
|
* ```
|
|
3293
3317
|
* @example
|
|
3294
3318
|
* ```js
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3319
|
+
|
|
3320
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
|
|
3321
|
+
* let latestSpotterVizId = '';
|
|
3322
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3323
|
+
* latestSpotterVizId = payload.data.id;
|
|
3324
|
+
* });
|
|
3325
|
+
*
|
|
3326
|
+
* spotterEmbed.trigger(HostEvent.Pin, { vizId: latestSpotterVizId });
|
|
3327
|
+
* ```
|
|
3328
|
+
*
|
|
3299
3329
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
3300
3330
|
*/
|
|
3301
3331
|
Pin = 'pin',
|
|
@@ -3370,14 +3400,29 @@ export enum HostEvent {
|
|
|
3370
3400
|
* ```
|
|
3371
3401
|
* @example
|
|
3372
3402
|
* ```js
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3403
|
+
|
|
3404
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPdf host event.
|
|
3405
|
+
* let latestSpotterVizId = '';
|
|
3406
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3407
|
+
* latestSpotterVizId = payload.data.id;
|
|
3408
|
+
* });
|
|
3409
|
+
*
|
|
3410
|
+
* spotterEmbed.trigger(HostEvent.DownloadAsPdf, { vizId: latestSpotterVizId });
|
|
3411
|
+
* ```
|
|
3377
3412
|
*
|
|
3378
3413
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
3379
3414
|
*/
|
|
3380
3415
|
DownloadAsPdf = 'downloadAsPdf',
|
|
3416
|
+
/**
|
|
3417
|
+
* Trigger the **AI Highlights** action on an embedded Liveboard
|
|
3418
|
+
*
|
|
3419
|
+
* @example
|
|
3420
|
+
* ```js
|
|
3421
|
+
* liveboardEmbed.trigger(HostEvent.AIHighlights)
|
|
3422
|
+
* ```
|
|
3423
|
+
* @version SDK: 1.44.0 | ThoughtSpot: 10.15.0.cl
|
|
3424
|
+
*/
|
|
3425
|
+
AIHighlights = 'AIHighlights',
|
|
3381
3426
|
/**
|
|
3382
3427
|
* Trigger the **Make a copy** action on a Liveboard,
|
|
3383
3428
|
* visualization, or Answer page.
|
|
@@ -3400,10 +3445,14 @@ export enum HostEvent {
|
|
|
3400
3445
|
* ```
|
|
3401
3446
|
* @example
|
|
3402
3447
|
* ```js
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3448
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in MakeACopy host event.
|
|
3449
|
+
* let latestSpotterVizId = '';
|
|
3450
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3451
|
+
* latestSpotterVizId = payload.data.id;
|
|
3452
|
+
* });
|
|
3453
|
+
*
|
|
3454
|
+
* spotterEmbed.trigger(HostEvent.MakeACopy, { vizId: latestSpotterVizId });
|
|
3455
|
+
* ```
|
|
3407
3456
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
3408
3457
|
*/
|
|
3409
3458
|
MakeACopy = 'makeACopy',
|
|
@@ -3488,15 +3537,7 @@ export enum HostEvent {
|
|
|
3488
3537
|
* ```
|
|
3489
3538
|
* @example
|
|
3490
3539
|
* ```js
|
|
3491
|
-
*
|
|
3492
|
-
* vizId:'730496d6-6903-4601-937e-2c691821af3c'
|
|
3493
|
-
* });
|
|
3494
|
-
* ```
|
|
3495
|
-
* @example
|
|
3496
|
-
* ```js
|
|
3497
|
-
* const editResponse = await spotterEmbed.trigger(HostEvent.Edit, {
|
|
3498
|
-
* vizId:'730496d6-6903-4601-937e-2c691821af3c'
|
|
3499
|
-
* });
|
|
3540
|
+
* spotterEmbed.trigger(HostEvent.Edit);
|
|
3500
3541
|
* ```
|
|
3501
3542
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
3502
3543
|
*/
|
|
@@ -3545,16 +3586,23 @@ export enum HostEvent {
|
|
|
3545
3586
|
* );
|
|
3546
3587
|
* })
|
|
3547
3588
|
* ```
|
|
3548
|
-
* @example
|
|
3589
|
+
* * @example
|
|
3549
3590
|
* ```js
|
|
3550
|
-
|
|
3551
|
-
|
|
3591
|
+
|
|
3592
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
|
|
3593
|
+
* let latestSpotterVizId = '';
|
|
3594
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3595
|
+
* latestSpotterVizId = payload.data.id;
|
|
3596
|
+
* });
|
|
3597
|
+
*
|
|
3598
|
+
* spotterEmbed.trigger(HostEvent.GetTML, {
|
|
3599
|
+
* vizId: latestSpotterVizId
|
|
3552
3600
|
* }).then((tml) => {
|
|
3553
3601
|
* console.log(
|
|
3554
3602
|
* tml.answer.search_query // TML representation of the search query
|
|
3555
3603
|
* );
|
|
3556
3604
|
* })
|
|
3557
|
-
|
|
3605
|
+
* ```
|
|
3558
3606
|
* @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1.sw
|
|
3559
3607
|
* @important
|
|
3560
3608
|
*/
|
|
@@ -3618,7 +3666,7 @@ export enum HostEvent {
|
|
|
3618
3666
|
/**
|
|
3619
3667
|
* Trigger the **Download** action on charts in
|
|
3620
3668
|
* the embedded view.
|
|
3621
|
-
* @param - `vizId` refers to the
|
|
3669
|
+
* @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
|
|
3622
3670
|
* @example
|
|
3623
3671
|
* ```js
|
|
3624
3672
|
* liveboardEmbed.trigger(HostEvent.Download, {vizId:
|
|
@@ -3628,10 +3676,14 @@ export enum HostEvent {
|
|
|
3628
3676
|
* embed.trigger(HostEvent.Download)
|
|
3629
3677
|
* ```
|
|
3630
3678
|
* ```js
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3679
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in Download host event.
|
|
3680
|
+
* let latestSpotterVizId = '';
|
|
3681
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3682
|
+
* latestSpotterVizId = payload.data.id;
|
|
3683
|
+
* });
|
|
3684
|
+
*
|
|
3685
|
+
* spotterEmbed.trigger(HostEvent.Download, { vizId: latestSpotterVizId });
|
|
3686
|
+
* ```
|
|
3635
3687
|
* @deprecated from SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl ,9.4.1.sw
|
|
3636
3688
|
* Use {@link DownloadAsPng}
|
|
3637
3689
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
|
|
@@ -3649,9 +3701,13 @@ export enum HostEvent {
|
|
|
3649
3701
|
*
|
|
3650
3702
|
* searchEmbed.trigger(HostEvent.DownloadAsPng)
|
|
3651
3703
|
*
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3704
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPng host event.
|
|
3705
|
+
* let latestSpotterVizId = '';
|
|
3706
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3707
|
+
* latestSpotterVizId = payload.data.id;
|
|
3708
|
+
* });
|
|
3709
|
+
*
|
|
3710
|
+
* spotterEmbed.trigger(HostEvent.DownloadAsPng, { vizId: latestSpotterVizId });
|
|
3655
3711
|
* ```
|
|
3656
3712
|
*
|
|
3657
3713
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1.sw
|
|
@@ -3660,7 +3716,7 @@ export enum HostEvent {
|
|
|
3660
3716
|
/**
|
|
3661
3717
|
* Trigger the **Download** > **CSV** action on tables in
|
|
3662
3718
|
* the embedded view.
|
|
3663
|
-
* @param - `vizId` refers to the
|
|
3719
|
+
* @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
|
|
3664
3720
|
* @example
|
|
3665
3721
|
* ```js
|
|
3666
3722
|
* liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
|
|
@@ -3673,9 +3729,13 @@ export enum HostEvent {
|
|
|
3673
3729
|
* searchEmbed.trigger(HostEvent.DownloadAsCsv)
|
|
3674
3730
|
* ```
|
|
3675
3731
|
* ```js
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3732
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsCsv host event.
|
|
3733
|
+
* let latestSpotterVizId = '';
|
|
3734
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3735
|
+
* latestSpotterVizId = payload.data.id;
|
|
3736
|
+
* });
|
|
3737
|
+
*
|
|
3738
|
+
* spotterEmbed.trigger(HostEvent.DownloadAsCsv, { vizId: latestSpotterVizId });
|
|
3679
3739
|
* ```
|
|
3680
3740
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
|
|
3681
3741
|
*/
|
|
@@ -3683,7 +3743,7 @@ export enum HostEvent {
|
|
|
3683
3743
|
/**
|
|
3684
3744
|
* Trigger the **Download** > **XLSX** action on tables
|
|
3685
3745
|
* in the embedded view.
|
|
3686
|
-
* @param - `vizId` refers to the
|
|
3746
|
+
* @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
|
|
3687
3747
|
* @example
|
|
3688
3748
|
* ```js
|
|
3689
3749
|
* liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
|
|
@@ -3696,9 +3756,13 @@ export enum HostEvent {
|
|
|
3696
3756
|
* searchEmbed.trigger(HostEvent.DownloadAsXlsx)
|
|
3697
3757
|
* ```
|
|
3698
3758
|
* ```js
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3759
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsXlsx host event.
|
|
3760
|
+
* let latestSpotterVizId = '';
|
|
3761
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
3762
|
+
* latestSpotterVizId = payload.data.id;
|
|
3763
|
+
* });
|
|
3764
|
+
*
|
|
3765
|
+
* spotterEmbed.trigger(HostEvent.DownloadAsXlsx, { vizId: latestSpotterVizId });
|
|
3702
3766
|
* ```
|
|
3703
3767
|
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
|
|
3704
3768
|
*/
|
|
@@ -3735,7 +3799,7 @@ export enum HostEvent {
|
|
|
3735
3799
|
* ```
|
|
3736
3800
|
*
|
|
3737
3801
|
* ```js
|
|
3738
|
-
* // Save
|
|
3802
|
+
* // Save a Visualization in Spotter (requires vizId)
|
|
3739
3803
|
* spotterEmbed.trigger(HostEvent.Save, {
|
|
3740
3804
|
* vizId: "730496d6-6903-4601-937e-2c691821af3c"
|
|
3741
3805
|
* })
|
|
@@ -4036,15 +4100,21 @@ export enum HostEvent {
|
|
|
4036
4100
|
ResetLiveboardPersonalisedView = 'ResetLiveboardPersonalisedView',
|
|
4037
4101
|
/**
|
|
4038
4102
|
* Triggers an action to update Parameter values on embedded
|
|
4039
|
-
* Answers, Liveboard and Spotter answer in Edit mode.
|
|
4103
|
+
* Answers, Liveboard, and Spotter answer in Edit mode.
|
|
4104
|
+
* @param - `name` - Name of the Parameter
|
|
4105
|
+
* @param - `value` - The value to set for the Parameter.
|
|
4106
|
+
*
|
|
4107
|
+
* Optionally, to control the visibility of the Parameter chip,
|
|
4108
|
+
* use the `isVisibleToUser` attribute when applying an override.
|
|
4040
4109
|
*
|
|
4041
4110
|
* @example
|
|
4042
4111
|
* ```js
|
|
4043
4112
|
* liveboardEmbed.trigger(HostEvent.UpdateParameters, [{
|
|
4044
|
-
*
|
|
4045
|
-
*
|
|
4113
|
+
* name: "Integer Range Param",
|
|
4114
|
+
* value: 10,
|
|
4115
|
+
* isVisibleToUser: false
|
|
4046
4116
|
* }])
|
|
4047
|
-
*
|
|
4117
|
+
* ```
|
|
4048
4118
|
* @version SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
|
|
4049
4119
|
*/
|
|
4050
4120
|
UpdateParameters = 'UpdateParameters',
|
|
@@ -4057,11 +4127,13 @@ export enum HostEvent {
|
|
|
4057
4127
|
* });
|
|
4058
4128
|
*```
|
|
4059
4129
|
*```js
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4130
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in GetParameters host event.
|
|
4131
|
+
* let latestSpotterVizId = '';
|
|
4132
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
4133
|
+
* latestSpotterVizId = payload.data.id;
|
|
4134
|
+
* });
|
|
4135
|
+
*
|
|
4136
|
+
* spotterEmbed.trigger(HostEvent.GetParameters, { vizId: latestSpotterVizId });
|
|
4065
4137
|
*```
|
|
4066
4138
|
* @version SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
|
|
4067
4139
|
*/
|
|
@@ -4091,10 +4163,11 @@ export enum HostEvent {
|
|
|
4091
4163
|
* If no parameters are specified, the save action is
|
|
4092
4164
|
* triggered with a modal to prompt users to
|
|
4093
4165
|
* add a name and description for the Answer.
|
|
4094
|
-
* @param -
|
|
4095
|
-
*
|
|
4096
|
-
*
|
|
4097
|
-
* @param - `
|
|
4166
|
+
* @param - `vizId` refers to the Answer ID in Spotter embed
|
|
4167
|
+
* and is required in Spotter embed.
|
|
4168
|
+
* Optional attributes to set Answer properties include:
|
|
4169
|
+
* @param - `name` - Name string for the Answer.
|
|
4170
|
+
* @param - `description` - Description text for the Answer.
|
|
4098
4171
|
* @example
|
|
4099
4172
|
* ```js
|
|
4100
4173
|
* const saveAnswerResponse = await searchEmbed.trigger(HostEvent.SaveAnswer, {
|
|
@@ -4104,11 +4177,13 @@ export enum HostEvent {
|
|
|
4104
4177
|
* ```
|
|
4105
4178
|
* @example
|
|
4106
4179
|
* ```js
|
|
4107
|
-
*
|
|
4108
|
-
*
|
|
4109
|
-
*
|
|
4110
|
-
*
|
|
4180
|
+
* // You can use the Data event dispatched on each answer creation to get the vizId and use in SaveAnswer host event.
|
|
4181
|
+
* let latestSpotterVizId = '';
|
|
4182
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
4183
|
+
* latestSpotterVizId = payload.data.id;
|
|
4111
4184
|
* });
|
|
4185
|
+
*
|
|
4186
|
+
* spotterEmbed.trigger(HostEvent.SaveAnswer, { vizId: latestSpotterVizId });
|
|
4112
4187
|
* ```
|
|
4113
4188
|
* @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
|
|
4114
4189
|
*/
|
|
@@ -4192,12 +4267,15 @@ export enum HostEvent {
|
|
|
4192
4267
|
DeleteLastPrompt = 'DeleteLastPrompt',
|
|
4193
4268
|
/**
|
|
4194
4269
|
* Toggle the visualization to chart or table view.
|
|
4195
|
-
* @param - `vizId ` refers to the
|
|
4270
|
+
* @param - `vizId ` refers to the Visualization ID in Spotter embed and is required.
|
|
4196
4271
|
* @example
|
|
4197
4272
|
* ```js
|
|
4198
|
-
*
|
|
4199
|
-
*
|
|
4273
|
+
* let latestSpotterVizId = '';
|
|
4274
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
4275
|
+
* latestSpotterVizId = payload.data.id;
|
|
4200
4276
|
* });
|
|
4277
|
+
*
|
|
4278
|
+
* spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, { vizId: latestSpotterVizId });
|
|
4201
4279
|
*```
|
|
4202
4280
|
* @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
4203
4281
|
*/
|
|
@@ -4226,12 +4304,16 @@ export enum HostEvent {
|
|
|
4226
4304
|
*/
|
|
4227
4305
|
VisibleEmbedCoordinates = 'visibleEmbedCoordinates',
|
|
4228
4306
|
/**
|
|
4229
|
-
* Trigger the *
|
|
4230
|
-
* @param - `vizId` refers to the
|
|
4307
|
+
* Trigger the *Spotter* action for visualizations present on the liveboard's vizzes.
|
|
4308
|
+
* @param - `vizId` refers to the Visualization ID in Spotter embed and is required.
|
|
4231
4309
|
* @example
|
|
4232
4310
|
* ```js
|
|
4233
|
-
*
|
|
4234
|
-
* {
|
|
4311
|
+
* let latestSpotterVizId = '';
|
|
4312
|
+
* spotterEmbed.on(EmbedEvent.Data, (payload) => {
|
|
4313
|
+
* latestSpotterVizId = payload.data.id;
|
|
4314
|
+
* });
|
|
4315
|
+
*
|
|
4316
|
+
* spotterEmbed.trigger(HostEvent.AskSpotter, { vizId: latestSpotterVizId });
|
|
4235
4317
|
* ```
|
|
4236
4318
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
4237
4319
|
*/
|
|
@@ -4247,6 +4329,15 @@ export enum HostEvent {
|
|
|
4247
4329
|
* ```
|
|
4248
4330
|
*/
|
|
4249
4331
|
UpdateEmbedParams = 'updateEmbedParams',
|
|
4332
|
+
/**
|
|
4333
|
+
* Triggered when the embed is needed to be destroyed. This is used to clean up any embed related resources internally.
|
|
4334
|
+
* @example
|
|
4335
|
+
* ```js
|
|
4336
|
+
* liveboardEmbed.trigger(HostEvent.DestroyEmbed);
|
|
4337
|
+
* ```
|
|
4338
|
+
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
4339
|
+
*/
|
|
4340
|
+
DestroyEmbed = 'EmbedDestroyed',
|
|
4250
4341
|
}
|
|
4251
4342
|
|
|
4252
4343
|
/**
|