@thoughtspot/visual-embed-sdk 1.33.9 → 1.33.11
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 +2 -2
- package/cjs/src/embed/conversation.d.ts +0 -2
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +36 -0
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +10 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +13 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +5 -2
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts +2 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +158 -0
- package/cjs/src/embed/ts-embed.spec.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 +2 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/types.d.ts +50 -7
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +41 -4
- package/cjs/src/types.js.map +1 -1
- package/dist/{index-BXczdQc7.js → index-CVRnW-aN.js} +1 -1
- package/dist/src/embed/conversation.d.ts +0 -2
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +36 -0
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.d.ts +2 -1
- package/dist/src/embed/ts-embed.spec.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 +50 -7
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +59 -10
- package/dist/tsembed-react.js +58 -9
- package/dist/tsembed.es.js +60 -11
- package/dist/tsembed.js +60 -11
- package/dist/visual-embed-sdk-react-full.d.ts +87 -10
- package/dist/visual-embed-sdk-react.d.ts +87 -10
- package/dist/visual-embed-sdk.d.ts +87 -10
- package/lib/package.json +2 -2
- package/lib/src/embed/conversation.d.ts +0 -2
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +36 -0
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +10 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +13 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +5 -2
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts +2 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +159 -2
- package/lib/src/embed/ts-embed.spec.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 +50 -7
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +41 -4
- package/lib/src/types.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +88 -11
- package/package.json +2 -2
- package/src/embed/conversation.ts +0 -2
- package/src/embed/liveboard.spec.ts +17 -0
- package/src/embed/liveboard.ts +54 -0
- package/src/embed/ts-embed.spec.ts +219 -0
- package/src/embed/ts-embed.ts +6 -1
- package/src/index.ts +4 -1
- package/src/types.ts +50 -4
|
@@ -172,6 +172,23 @@ describe('Liveboard/viz embed tests', () => {
|
|
|
172
172
|
});
|
|
173
173
|
});
|
|
174
174
|
|
|
175
|
+
test('should enable viz oAuthPollingInterval true', async () => {
|
|
176
|
+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
177
|
+
oAuthPollingInterval: 1000,
|
|
178
|
+
isForceRedirect: true,
|
|
179
|
+
dataSourceId: '12356',
|
|
180
|
+
...defaultViewConfig,
|
|
181
|
+
liveboardId,
|
|
182
|
+
} as LiveboardViewConfig);
|
|
183
|
+
liveboardEmbed.render();
|
|
184
|
+
await executeAfterWait(() => {
|
|
185
|
+
expectUrlMatchesWithParams(
|
|
186
|
+
getIFrameSrc(),
|
|
187
|
+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}&oAuthPollingInterval=1000&isForceRedirect=true&dataSourceId=12356${prefixParams}#/embed/viz/${liveboardId}`,
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
|
|
175
192
|
test('should disable viz transformations when enableVizTransformations false', async () => {
|
|
176
193
|
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
177
194
|
enableVizTransformations: false,
|
package/src/embed/liveboard.ts
CHANGED
|
@@ -338,6 +338,45 @@ export interface LiveboardViewConfig
|
|
|
338
338
|
* ```
|
|
339
339
|
*/
|
|
340
340
|
hideIrrelevantChipsInLiveboardTabs?: boolean;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* The Liveboard to run on regular intervals to fetch the cdw token.
|
|
344
|
+
* @hidden
|
|
345
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
|
|
346
|
+
* @example
|
|
347
|
+
* ```js
|
|
348
|
+
* const embed = new LiveboardEmbed('#embed-container', {
|
|
349
|
+
* ... // other options
|
|
350
|
+
* oAuthPollingInterval: value in milliseconds,
|
|
351
|
+
* })
|
|
352
|
+
*/
|
|
353
|
+
oAuthPollingInterval?: number;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* The Liveboard is set to force a token fetch during the initial load.
|
|
357
|
+
* @hidden
|
|
358
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
|
|
359
|
+
* @example
|
|
360
|
+
* ```js
|
|
361
|
+
* const embed = new LiveboardEmbed('#embed-container', {
|
|
362
|
+
* ... // other options
|
|
363
|
+
* isForceRedirect: false,
|
|
364
|
+
* })
|
|
365
|
+
*/
|
|
366
|
+
isForceRedirect?: boolean;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* The source connection ID for authentication.
|
|
370
|
+
* @hidden
|
|
371
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
|
|
372
|
+
* @example
|
|
373
|
+
* ```js
|
|
374
|
+
* const embed = new LiveboardEmbed('#embed-container', {
|
|
375
|
+
* ... // other options
|
|
376
|
+
* dataSourceId: '',
|
|
377
|
+
* })
|
|
378
|
+
*/
|
|
379
|
+
dataSourceId?: string;
|
|
341
380
|
}
|
|
342
381
|
|
|
343
382
|
/**
|
|
@@ -399,6 +438,9 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
399
438
|
enable2ColumnLayout,
|
|
400
439
|
dataPanelV2 = false,
|
|
401
440
|
enableCustomColumnGroups = false,
|
|
441
|
+
oAuthPollingInterval,
|
|
442
|
+
isForceRedirect,
|
|
443
|
+
dataSourceId,
|
|
402
444
|
} = this.viewConfig;
|
|
403
445
|
|
|
404
446
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
@@ -445,6 +487,18 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
445
487
|
params[Param.enableAskSage] = enableAskSage;
|
|
446
488
|
}
|
|
447
489
|
|
|
490
|
+
if (oAuthPollingInterval !== undefined) {
|
|
491
|
+
params[Param.OauthPollingInterval] = oAuthPollingInterval;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (isForceRedirect) {
|
|
495
|
+
params[Param.IsForceRedirect] = isForceRedirect;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (dataSourceId !== undefined) {
|
|
499
|
+
params[Param.DataSourceId] = dataSourceId;
|
|
500
|
+
}
|
|
501
|
+
|
|
448
502
|
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
|
|
449
503
|
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
|
|
450
504
|
params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
|
|
@@ -9,6 +9,12 @@ import {
|
|
|
9
9
|
LiveboardViewConfig,
|
|
10
10
|
AppEmbed,
|
|
11
11
|
LiveboardEmbed,
|
|
12
|
+
AppViewConfig,
|
|
13
|
+
SageEmbed,
|
|
14
|
+
SageViewConfig,
|
|
15
|
+
ConversationViewConfig,
|
|
16
|
+
ConversationEmbed,
|
|
17
|
+
SearchViewConfig,
|
|
12
18
|
} from '../index';
|
|
13
19
|
import {
|
|
14
20
|
Action, HomeLeftNavItem, RuntimeFilter, RuntimeFilterOp, HomepageModule, HostEvent,
|
|
@@ -28,6 +34,8 @@ import {
|
|
|
28
34
|
expectUrlToHaveParamsWithValues,
|
|
29
35
|
mockMessageChannel,
|
|
30
36
|
createRootEleForEmbed,
|
|
37
|
+
expectUrlMatch,
|
|
38
|
+
fixedEncodeURI,
|
|
31
39
|
} from '../test/test-utils';
|
|
32
40
|
import * as config from '../config';
|
|
33
41
|
import * as embedConfig from './embedConfig';
|
|
@@ -38,6 +46,8 @@ import * as baseInstance from './base';
|
|
|
38
46
|
import { MIXPANEL_EVENT } from '../mixpanel-service';
|
|
39
47
|
import * as authService from '../utils/authService/authService';
|
|
40
48
|
import { logger } from '../utils/logger';
|
|
49
|
+
import { version } from '../../package.json';
|
|
50
|
+
import { HiddenActionItemByDefaultForSearchEmbed } from './search';
|
|
41
51
|
|
|
42
52
|
const defaultViewConfig = {
|
|
43
53
|
frameParams: {
|
|
@@ -51,6 +61,12 @@ const tabId1 = 'eca215d4-0d2c-4a55-90e3-d81ef6848ae0';
|
|
|
51
61
|
const tabId2 = 'eca215d4-0d2c-4a55-90e3-d81ef6848ae0';
|
|
52
62
|
const thoughtSpotHost = 'tshost';
|
|
53
63
|
const defaultParamsPost = '';
|
|
64
|
+
export const defaultParamsWithoutHiddenActions = `hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=${AuthType.None}&blockNonEmbedFullAppAccess=true`;
|
|
65
|
+
export const defaultParams = `&${defaultParamsWithoutHiddenActions}&hideAction=[%22${Action.ReportError}%22]`;
|
|
66
|
+
const hideBydefault = `&hideAction=${fixedEncodeURI(
|
|
67
|
+
JSON.stringify([Action.ReportError, ...HiddenActionItemByDefaultForSearchEmbed]),
|
|
68
|
+
)}`;
|
|
69
|
+
const defaultParamsWithHiddenActions = defaultParamsWithoutHiddenActions + hideBydefault;
|
|
54
70
|
|
|
55
71
|
beforeAll(() => {
|
|
56
72
|
spyOn(window, 'alert');
|
|
@@ -89,6 +105,29 @@ describe('Unit test case for ts embed', () => {
|
|
|
89
105
|
jest.spyOn(authInstance, 'postLoginService').mockResolvedValue(true);
|
|
90
106
|
});
|
|
91
107
|
|
|
108
|
+
describe('Vaidate iframe properties', () => {
|
|
109
|
+
beforeAll(() => {
|
|
110
|
+
init({
|
|
111
|
+
thoughtSpotHost: 'tshost',
|
|
112
|
+
authType: AuthType.None,
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('should set proper allow policies', async () => {
|
|
117
|
+
// we dont have origin specific policies so just checking if
|
|
118
|
+
// policies are ending with ;
|
|
119
|
+
const searchEmbed = new SearchEmbed(getRootEl(), defaultViewConfig);
|
|
120
|
+
searchEmbed.render();
|
|
121
|
+
await executeAfterWait(() => {
|
|
122
|
+
const iframe = getIFrameEl();
|
|
123
|
+
const policiesAdded = iframe.allow.split(' ');
|
|
124
|
+
policiesAdded.forEach((policy) => {
|
|
125
|
+
expect(policy.endsWith(';')).toBe(true);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
92
131
|
describe('AuthExpire embedEvent in cookieless authentication authType', () => {
|
|
93
132
|
beforeAll(() => {
|
|
94
133
|
jest.spyOn(authInstance, 'doCookielessTokenAuth').mockResolvedValueOnce(true);
|
|
@@ -1454,6 +1493,186 @@ describe('Unit test case for ts embed', () => {
|
|
|
1454
1493
|
orgId: overrideOrgId,
|
|
1455
1494
|
});
|
|
1456
1495
|
});
|
|
1496
|
+
|
|
1497
|
+
it('AppEmbed: Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
|
|
1498
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
1499
|
+
...defaultViewConfig,
|
|
1500
|
+
enableFlipTooltipToContextMenu: true,
|
|
1501
|
+
} as AppViewConfig);
|
|
1502
|
+
|
|
1503
|
+
appEmbed.render();
|
|
1504
|
+
await executeAfterWait(() => {
|
|
1505
|
+
expectUrlMatchesWithParams(
|
|
1506
|
+
getIFrameSrc(),
|
|
1507
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&flipTooltipToContextMenuEnabled=true${defaultParams}${defaultParamsPost}#/home`,
|
|
1508
|
+
);
|
|
1509
|
+
});
|
|
1510
|
+
});
|
|
1511
|
+
|
|
1512
|
+
it('AppEmbed: Should not add flipTooltipToContextMenuEnabled flag to the iframe src when if false', async () => {
|
|
1513
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
1514
|
+
...defaultViewConfig,
|
|
1515
|
+
enableFlipTooltipToContextMenu: false,
|
|
1516
|
+
} as AppViewConfig);
|
|
1517
|
+
|
|
1518
|
+
appEmbed.render();
|
|
1519
|
+
await executeAfterWait(() => {
|
|
1520
|
+
expectUrlMatchesWithParams(
|
|
1521
|
+
getIFrameSrc(),
|
|
1522
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/home`,
|
|
1523
|
+
);
|
|
1524
|
+
});
|
|
1525
|
+
});
|
|
1526
|
+
|
|
1527
|
+
it('LiveboardEmbed: Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
|
|
1528
|
+
const appEmbed = new LiveboardEmbed(getRootEl(), {
|
|
1529
|
+
...defaultViewConfig,
|
|
1530
|
+
liveboardId,
|
|
1531
|
+
enableFlipTooltipToContextMenu: true,
|
|
1532
|
+
} as LiveboardViewConfig);
|
|
1533
|
+
|
|
1534
|
+
appEmbed.render();
|
|
1535
|
+
await executeAfterWait(() => {
|
|
1536
|
+
expectUrlMatchesWithParams(
|
|
1537
|
+
getIFrameSrc(),
|
|
1538
|
+
`http://${thoughtSpotHost}/?embedApp=true&flipTooltipToContextMenuEnabled=true${defaultParams}#/embed/viz/${liveboardId}`,
|
|
1539
|
+
);
|
|
1540
|
+
});
|
|
1541
|
+
});
|
|
1542
|
+
|
|
1543
|
+
it('LiveboardEmbed: Should not add flipTooltipToContextMenuEnabled flag to the iframe src when if false', async () => {
|
|
1544
|
+
const appEmbed = new LiveboardEmbed(getRootEl(), {
|
|
1545
|
+
...defaultViewConfig,
|
|
1546
|
+
liveboardId,
|
|
1547
|
+
enableFlipTooltipToContextMenu: false,
|
|
1548
|
+
} as LiveboardViewConfig);
|
|
1549
|
+
|
|
1550
|
+
appEmbed.render();
|
|
1551
|
+
await executeAfterWait(() => {
|
|
1552
|
+
expectUrlMatchesWithParams(
|
|
1553
|
+
getIFrameSrc(),
|
|
1554
|
+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}#/embed/viz/${liveboardId}`,
|
|
1555
|
+
);
|
|
1556
|
+
});
|
|
1557
|
+
});
|
|
1558
|
+
|
|
1559
|
+
it('SageViewConfig: Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
|
|
1560
|
+
const defaultConfig: SageViewConfig = {
|
|
1561
|
+
disableWorksheetChange: false,
|
|
1562
|
+
hideWorksheetSelector: false,
|
|
1563
|
+
hideSageAnswerHeader: false,
|
|
1564
|
+
hideAutocompleteSuggestions: false,
|
|
1565
|
+
hideSampleQuestions: false,
|
|
1566
|
+
isProductTour: false,
|
|
1567
|
+
dataPanelV2: false,
|
|
1568
|
+
};
|
|
1569
|
+
const appEmbed = new SageEmbed(getRootEl(), {
|
|
1570
|
+
...defaultConfig,
|
|
1571
|
+
enableFlipTooltipToContextMenu: true,
|
|
1572
|
+
} as SageViewConfig);
|
|
1573
|
+
|
|
1574
|
+
appEmbed.render();
|
|
1575
|
+
await executeAfterWait(() => {
|
|
1576
|
+
expectUrlMatch(
|
|
1577
|
+
getIFrameSrc(),
|
|
1578
|
+
`http://${thoughtSpotHost}/?embedApp=true&enableDataPanelV2=false&isSageEmbed=true&disableWorksheetChange=false&hideWorksheetSelector=false&hideEurekaSuggestions=false&isProductTour=false&hideSageAnswerHeader=false&hideAction=%5B%22reportError%22%5D&flipTooltipToContextMenuEnabled=true#/embed/eureka`,
|
|
1579
|
+
);
|
|
1580
|
+
});
|
|
1581
|
+
});
|
|
1582
|
+
|
|
1583
|
+
it('SageViewConfig: Should not add flipTooltipToContextMenuEnabled flag to the iframe src when if false', async () => {
|
|
1584
|
+
const defaultConfig: SageViewConfig = {
|
|
1585
|
+
disableWorksheetChange: false,
|
|
1586
|
+
hideWorksheetSelector: false,
|
|
1587
|
+
hideSageAnswerHeader: false,
|
|
1588
|
+
hideAutocompleteSuggestions: false,
|
|
1589
|
+
hideSampleQuestions: false,
|
|
1590
|
+
isProductTour: false,
|
|
1591
|
+
dataPanelV2: false,
|
|
1592
|
+
};
|
|
1593
|
+
const appEmbed = new SageEmbed(getRootEl(), {
|
|
1594
|
+
...defaultConfig,
|
|
1595
|
+
enableFlipTooltipToContextMenu: false,
|
|
1596
|
+
} as SageViewConfig);
|
|
1597
|
+
|
|
1598
|
+
appEmbed.render();
|
|
1599
|
+
await executeAfterWait(() => {
|
|
1600
|
+
expectUrlMatch(
|
|
1601
|
+
getIFrameSrc(),
|
|
1602
|
+
`http://${thoughtSpotHost}/?embedApp=true&enableDataPanelV2=false&isSageEmbed=true&disableWorksheetChange=false&hideWorksheetSelector=false&hideEurekaSuggestions=false&isProductTour=false&hideSageAnswerHeader=false&hideAction=%5B%22reportError%22%5D#/embed/eureka`,
|
|
1603
|
+
);
|
|
1604
|
+
});
|
|
1605
|
+
});
|
|
1606
|
+
|
|
1607
|
+
it('ConversationEmbed: Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
|
|
1608
|
+
const appEmbed = new ConversationEmbed(getRootEl(), {
|
|
1609
|
+
worksheetId: 'worksheetId',
|
|
1610
|
+
searchOptions: {
|
|
1611
|
+
searchQuery: 'searchQuery',
|
|
1612
|
+
},
|
|
1613
|
+
enableFlipTooltipToContextMenu: true,
|
|
1614
|
+
} as ConversationViewConfig);
|
|
1615
|
+
|
|
1616
|
+
appEmbed.render();
|
|
1617
|
+
await executeAfterWait(() => {
|
|
1618
|
+
expectUrlMatchesWithParams(
|
|
1619
|
+
getIFrameSrc(),
|
|
1620
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&flipTooltipToContextMenuEnabled=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
|
|
1621
|
+
);
|
|
1622
|
+
});
|
|
1623
|
+
});
|
|
1624
|
+
|
|
1625
|
+
it('ConversationEmbed: Should not add flipTooltipToContextMenuEnabled flag to the iframe src when flag is false', async () => {
|
|
1626
|
+
const appEmbed = new ConversationEmbed(getRootEl(), {
|
|
1627
|
+
worksheetId: 'worksheetId',
|
|
1628
|
+
searchOptions: {
|
|
1629
|
+
searchQuery: 'searchQuery',
|
|
1630
|
+
},
|
|
1631
|
+
enableFlipTooltipToContextMenu: false,
|
|
1632
|
+
} as ConversationViewConfig);
|
|
1633
|
+
|
|
1634
|
+
appEmbed.render();
|
|
1635
|
+
await executeAfterWait(() => {
|
|
1636
|
+
expectUrlMatchesWithParams(
|
|
1637
|
+
getIFrameSrc(),
|
|
1638
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
|
|
1639
|
+
);
|
|
1640
|
+
});
|
|
1641
|
+
});
|
|
1642
|
+
|
|
1643
|
+
it('SearchEmbed: Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
|
|
1644
|
+
const dataSources = ['data-source-1'];
|
|
1645
|
+
const appEmbed = new SearchEmbed(getRootEl(), {
|
|
1646
|
+
...defaultViewConfig,
|
|
1647
|
+
dataSources,
|
|
1648
|
+
enableFlipTooltipToContextMenu: true,
|
|
1649
|
+
} as SearchViewConfig);
|
|
1650
|
+
|
|
1651
|
+
appEmbed.render();
|
|
1652
|
+
await executeAfterWait(() => {
|
|
1653
|
+
expectUrlMatchesWithParams(
|
|
1654
|
+
getIFrameSrc(),
|
|
1655
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&useLastSelectedSources=false&flipTooltipToContextMenuEnabled=true#/embed/answer`,
|
|
1656
|
+
);
|
|
1657
|
+
});
|
|
1658
|
+
});
|
|
1659
|
+
|
|
1660
|
+
it('SearchEmbed: Should not add flipTooltipToContextMenuEnabled flag to the iframe src when if false', async () => {
|
|
1661
|
+
const dataSources = ['data-source-1'];
|
|
1662
|
+
const appEmbed = new SearchEmbed(getRootEl(), {
|
|
1663
|
+
...defaultViewConfig,
|
|
1664
|
+
dataSources,
|
|
1665
|
+
enableFlipTooltipToContextMenu: false,
|
|
1666
|
+
} as SearchViewConfig);
|
|
1667
|
+
|
|
1668
|
+
appEmbed.render();
|
|
1669
|
+
await executeAfterWait(() => {
|
|
1670
|
+
expectUrlMatchesWithParams(
|
|
1671
|
+
getIFrameSrc(),
|
|
1672
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&useLastSelectedSources=false#/embed/answer`,
|
|
1673
|
+
);
|
|
1674
|
+
});
|
|
1675
|
+
});
|
|
1457
1676
|
});
|
|
1458
1677
|
|
|
1459
1678
|
describe('When destroyed', () => {
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -446,6 +446,7 @@ export class TsEmbed {
|
|
|
446
446
|
insertInToSlide,
|
|
447
447
|
disableRedirectionLinksInNewTab,
|
|
448
448
|
overrideOrgId,
|
|
449
|
+
enableFlipTooltipToContextMenu = false,
|
|
449
450
|
} = this.viewConfig;
|
|
450
451
|
|
|
451
452
|
const { additionalFlags: additionalFlagsFromInit } = this.embedConfig;
|
|
@@ -455,6 +456,10 @@ export class TsEmbed {
|
|
|
455
456
|
...additionalFlagsFromView,
|
|
456
457
|
};
|
|
457
458
|
|
|
459
|
+
if (enableFlipTooltipToContextMenu) {
|
|
460
|
+
queryParams[Param.EnableFlipTooltipToContextMenu] = enableFlipTooltipToContextMenu;
|
|
461
|
+
}
|
|
462
|
+
|
|
458
463
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
459
464
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
460
465
|
return queryParams;
|
|
@@ -576,7 +581,7 @@ export class TsEmbed {
|
|
|
576
581
|
iFrame.mozallowfullscreen = true;
|
|
577
582
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
578
583
|
// @ts-ignore
|
|
579
|
-
iFrame.allow = 'clipboard-read; clipboard-write fullscreen';
|
|
584
|
+
iFrame.allow = 'clipboard-read; clipboard-write; fullscreen;';
|
|
580
585
|
|
|
581
586
|
const {
|
|
582
587
|
height: frameHeight,
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* @summary ThoughtSpot Visual Embed SDK
|
|
7
7
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
AppEmbed, Page, AppViewConfig, HomePageSearchBarMode,
|
|
11
|
+
} from './embed/app';
|
|
10
12
|
import {
|
|
11
13
|
init,
|
|
12
14
|
prefetch,
|
|
@@ -122,6 +124,7 @@ export {
|
|
|
122
124
|
LogLevel,
|
|
123
125
|
uploadMixpanelEvent,
|
|
124
126
|
MIXPANEL_EVENT,
|
|
127
|
+
HomePageSearchBarMode,
|
|
125
128
|
VizPoint,
|
|
126
129
|
CustomActionPayload,
|
|
127
130
|
};
|
package/src/types.ts
CHANGED
|
@@ -1100,6 +1100,12 @@ export interface ViewConfig {
|
|
|
1100
1100
|
* @version SDK: 1.35.0 | ThoughtSpot: 10.5.0.cl
|
|
1101
1101
|
*/
|
|
1102
1102
|
overrideOrgId?: number;
|
|
1103
|
+
/**
|
|
1104
|
+
* Flag to control new flip tooltip context menu experience
|
|
1105
|
+
* @default false
|
|
1106
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
1107
|
+
*/
|
|
1108
|
+
enableFlipTooltipToContextMenu?: boolean;
|
|
1103
1109
|
}
|
|
1104
1110
|
|
|
1105
1111
|
/**
|
|
@@ -2412,7 +2418,6 @@ export enum HostEvent {
|
|
|
2412
2418
|
* Get iframe URL for the current embed view on the playground.
|
|
2413
2419
|
* Developers can use this URL to embed a ThoughtSpot object
|
|
2414
2420
|
* in apps like Salesforce or Sharepoint.
|
|
2415
|
-
*
|
|
2416
2421
|
* @example
|
|
2417
2422
|
* ```js
|
|
2418
2423
|
* const url = embed.trigger(HostEvent.GetIframeUrl);
|
|
@@ -2535,7 +2540,6 @@ export enum HostEvent {
|
|
|
2535
2540
|
* sorting, toggling of legends, and data drill down.
|
|
2536
2541
|
* For more information, see
|
|
2537
2542
|
* link:https://developers.thoughtspot.com/docs/fetch-data-and-report-apis#transient-lb-content[Liveboard data with unsaved changes].
|
|
2538
|
-
*
|
|
2539
2543
|
* @example
|
|
2540
2544
|
* ```js
|
|
2541
2545
|
* liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard).then(
|
|
@@ -3187,6 +3191,14 @@ export enum HostEvent {
|
|
|
3187
3191
|
* @version SDK: 1.29.0 | Thoughtspot: 10.1.0.cl
|
|
3188
3192
|
*/
|
|
3189
3193
|
GetParameters = 'GetParameters',
|
|
3194
|
+
/**
|
|
3195
|
+
* Triggers update of persoanlised view for a liveboard
|
|
3196
|
+
* ```js
|
|
3197
|
+
* liveboardEmbed.trigger(HostEvent.UpdatePersonalisedView, {viewId: '1234'})
|
|
3198
|
+
* ```
|
|
3199
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
3200
|
+
*/
|
|
3201
|
+
UpdatePersonalisedView = 'UpdatePersonalisedView',
|
|
3190
3202
|
}
|
|
3191
3203
|
|
|
3192
3204
|
/**
|
|
@@ -3308,6 +3320,10 @@ export enum Param {
|
|
|
3308
3320
|
SpotterEnabled = 'isSpotterExperienceEnabled',
|
|
3309
3321
|
IsUnifiedSearchExperienceEnabled = 'isUnifiedSearchExperienceEnabled',
|
|
3310
3322
|
OverrideOrgId = 'orgId',
|
|
3323
|
+
EnableFlipTooltipToContextMenu = 'flipTooltipToContextMenuEnabled',
|
|
3324
|
+
OauthPollingInterval = 'oAuthPollingInterval',
|
|
3325
|
+
IsForceRedirect = 'isForceRedirect',
|
|
3326
|
+
DataSourceId = 'dataSourceId',
|
|
3311
3327
|
}
|
|
3312
3328
|
|
|
3313
3329
|
/**
|
|
@@ -4391,7 +4407,7 @@ export enum Action {
|
|
|
4391
4407
|
* Action ID for hide/disable reset button in spotter
|
|
4392
4408
|
* @example
|
|
4393
4409
|
* ```js
|
|
4394
|
-
* hiddenAction: [Action.
|
|
4410
|
+
* hiddenAction: [Action.ResetSpotterChat]
|
|
4395
4411
|
* ```
|
|
4396
4412
|
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
4397
4413
|
*/
|
|
@@ -4401,11 +4417,41 @@ export enum Action {
|
|
|
4401
4417
|
* Action ID for hide/disable feedback in spotter
|
|
4402
4418
|
* @example
|
|
4403
4419
|
* ```js
|
|
4404
|
-
* hiddenAction: [Action.
|
|
4420
|
+
* hiddenAction: [Action.SpotterFeedback]
|
|
4405
4421
|
* ```
|
|
4406
4422
|
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
4407
4423
|
*/
|
|
4408
4424
|
SpotterFeedback = 'spotterFeedback',
|
|
4425
|
+
|
|
4426
|
+
/**
|
|
4427
|
+
* Action ID for hide/disable editing previous prompt in spotter
|
|
4428
|
+
* @example
|
|
4429
|
+
* ```js
|
|
4430
|
+
* hiddenAction: [Action.EditPreviousPrompt]
|
|
4431
|
+
* ```
|
|
4432
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
4433
|
+
*/
|
|
4434
|
+
EditPreviousPrompt = 'editPreviousPrompt',
|
|
4435
|
+
|
|
4436
|
+
/**
|
|
4437
|
+
* Action ID for hide/disable deleting previous prompt in spotter
|
|
4438
|
+
* @example
|
|
4439
|
+
* ```js
|
|
4440
|
+
* hiddenAction: [Action.DeletePreviousPrompt]
|
|
4441
|
+
* ```
|
|
4442
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
4443
|
+
*/
|
|
4444
|
+
DeletePreviousPrompt = 'deletePreviousPrompt',
|
|
4445
|
+
|
|
4446
|
+
/**
|
|
4447
|
+
* Action ID for hide/disable edit of tokens on spotter results.
|
|
4448
|
+
* @example
|
|
4449
|
+
* ```js
|
|
4450
|
+
* hiddenAction: [Action.EditTokens]
|
|
4451
|
+
* ```
|
|
4452
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
4453
|
+
*/
|
|
4454
|
+
EditTokens = 'editTokens',
|
|
4409
4455
|
}
|
|
4410
4456
|
|
|
4411
4457
|
export interface AnswerServiceType {
|