@thoughtspot/visual-embed-sdk 1.32.4 → 1.32.7
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/app.d.ts +42 -0
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +4 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +30 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/base.d.ts +12 -12
- package/cjs/src/embed/base.js +12 -12
- package/cjs/src/embed/liveboard.d.ts +42 -0
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +4 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +33 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +0 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +1 -2
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/types.d.ts +66 -8
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +59 -7
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.d.ts +14 -0
- package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.js +21 -0
- package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/cjs/src/utils/processData.js +2 -2
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +14 -0
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/dist/src/embed/app.d.ts +42 -0
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +12 -12
- package/dist/src/embed/liveboard.d.ts +42 -0
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +0 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/types.d.ts +66 -8
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/graphql/answerService/answerService.d.ts +14 -0
- package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +92 -14
- package/dist/tsembed-react.js +92 -14
- package/dist/tsembed.es.js +104 -26
- package/dist/tsembed.js +104 -26
- package/dist/visual-embed-sdk-react-full.d.ts +176 -21
- package/dist/visual-embed-sdk-react.d.ts +176 -21
- package/dist/visual-embed-sdk.d.ts +176 -21
- package/lib/package.json +1 -1
- package/lib/src/embed/app.d.ts +42 -0
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +4 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +30 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +12 -12
- package/lib/src/embed/base.js +12 -12
- package/lib/src/embed/liveboard.d.ts +42 -0
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +4 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +33 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +0 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +1 -2
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/types.d.ts +66 -8
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +59 -7
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.d.ts +14 -0
- package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.js +21 -0
- package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/lib/src/utils/processData.js +2 -2
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +14 -0
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +176 -21
- package/package.json +1 -1
- package/src/embed/app.spec.ts +45 -0
- package/src/embed/app.ts +48 -0
- package/src/embed/base.ts +12 -12
- package/src/embed/liveboard.spec.ts +48 -0
- package/src/embed/liveboard.ts +48 -0
- package/src/embed/ts-embed.ts +1 -2
- package/src/types.ts +66 -7
- package/src/utils/graphql/answerService/answerService.ts +27 -0
- package/src/utils/processData.spec.ts +16 -0
- package/src/utils/processData.ts +2 -2
package/src/embed/app.spec.ts
CHANGED
|
@@ -375,6 +375,51 @@ describe('App embed tests', () => {
|
|
|
375
375
|
});
|
|
376
376
|
});
|
|
377
377
|
|
|
378
|
+
test('Should add isLiveboardCompactHeaderEnabled flag to the iframe src', async () => {
|
|
379
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
380
|
+
...defaultViewConfig,
|
|
381
|
+
isLiveboardCompactHeaderEnabled: false,
|
|
382
|
+
} as AppViewConfig);
|
|
383
|
+
|
|
384
|
+
appEmbed.render();
|
|
385
|
+
await executeAfterWait(() => {
|
|
386
|
+
expectUrlMatchesWithParams(
|
|
387
|
+
getIFrameSrc(),
|
|
388
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&isLiveboardHeaderV2Enabled=false${defaultParams}${defaultParamsPost}#/home`,
|
|
389
|
+
);
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
test('Should add showLiveboardReverifyBanner flag to the iframe src', async () => {
|
|
394
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
395
|
+
...defaultViewConfig,
|
|
396
|
+
showLiveboardReverifyBanner: false,
|
|
397
|
+
} as AppViewConfig);
|
|
398
|
+
|
|
399
|
+
appEmbed.render();
|
|
400
|
+
await executeAfterWait(() => {
|
|
401
|
+
expectUrlMatchesWithParams(
|
|
402
|
+
getIFrameSrc(),
|
|
403
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&showLiveboardReverifyBanner=false${defaultParams}${defaultParamsPost}#/home`,
|
|
404
|
+
);
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
test('Should add showLiveboardVerifiedBadge flag to the iframe src', async () => {
|
|
409
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
410
|
+
...defaultViewConfig,
|
|
411
|
+
showLiveboardVerifiedBadge: false,
|
|
412
|
+
} as AppViewConfig);
|
|
413
|
+
|
|
414
|
+
appEmbed.render();
|
|
415
|
+
await executeAfterWait(() => {
|
|
416
|
+
expectUrlMatchesWithParams(
|
|
417
|
+
getIFrameSrc(),
|
|
418
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&showLiveboardVerifiedBadge=false${defaultParams}${defaultParamsPost}#/home`,
|
|
419
|
+
);
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
|
|
378
423
|
test('Should add default values of flags to the iframe src', async () => {
|
|
379
424
|
const appEmbed = new AppEmbed(getRootEl(), {
|
|
380
425
|
...defaultViewConfig,
|
package/src/embed/app.ts
CHANGED
|
@@ -402,6 +402,48 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
402
402
|
* @version SDK : 1.33.0 | Thoughtspot : 10.2.0.cl
|
|
403
403
|
*/
|
|
404
404
|
homePageSearchBarMode?: HomePageSearchBarMode;
|
|
405
|
+
/**
|
|
406
|
+
* This flag is used to enable the compact header in liveboard
|
|
407
|
+
* @type {boolean}
|
|
408
|
+
* @default false
|
|
409
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.3.0.cl
|
|
410
|
+
* @example
|
|
411
|
+
* ```js
|
|
412
|
+
* const embed = new AppEmbed('#embed-container', {
|
|
413
|
+
* ... // other options
|
|
414
|
+
* isLiveboardCompactHeaderEnabled: true,
|
|
415
|
+
* })
|
|
416
|
+
* ```
|
|
417
|
+
*/
|
|
418
|
+
isLiveboardCompactHeaderEnabled?: boolean;
|
|
419
|
+
/**
|
|
420
|
+
* This flag is used to show/hide verified Icon in liveboard compact header
|
|
421
|
+
* @type {boolean}
|
|
422
|
+
* @default true
|
|
423
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
|
|
424
|
+
* @example
|
|
425
|
+
* ```js
|
|
426
|
+
* const embed = new AppEmbed('#embed-container', {
|
|
427
|
+
* ... // other options
|
|
428
|
+
* showLiveboardVerifiedBadge: true,
|
|
429
|
+
* })
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
showLiveboardVerifiedBadge?: boolean;
|
|
433
|
+
/**
|
|
434
|
+
* This flag is used to show/hide re-verify banner in liveboard compact header
|
|
435
|
+
* @type {boolean}
|
|
436
|
+
* @default true
|
|
437
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
|
|
438
|
+
* @example
|
|
439
|
+
* ```js
|
|
440
|
+
* const embed = new AppEmbed('#embed-container', {
|
|
441
|
+
* ... // other options
|
|
442
|
+
* showLiveboardReverifyBanner: true,
|
|
443
|
+
* })
|
|
444
|
+
* ```
|
|
445
|
+
*/
|
|
446
|
+
showLiveboardReverifyBanner?: boolean;
|
|
405
447
|
}
|
|
406
448
|
|
|
407
449
|
/**
|
|
@@ -454,6 +496,9 @@ export class AppEmbed extends V1Embed {
|
|
|
454
496
|
/* eslint-disable-next-line max-len */
|
|
455
497
|
dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL,
|
|
456
498
|
collapseSearchBar = true,
|
|
499
|
+
isLiveboardCompactHeaderEnabled = false,
|
|
500
|
+
showLiveboardVerifiedBadge = true,
|
|
501
|
+
showLiveboardReverifyBanner = true,
|
|
457
502
|
homePageSearchBarMode,
|
|
458
503
|
} = this.viewConfig;
|
|
459
504
|
|
|
@@ -468,6 +513,9 @@ export class AppEmbed extends V1Embed {
|
|
|
468
513
|
params[Param.ShowLiveboardDescription] = !!showLiveboardDescription;
|
|
469
514
|
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
|
|
470
515
|
params[Param.IsFullAppEmbed] = true;
|
|
516
|
+
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
|
|
517
|
+
params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
|
|
518
|
+
params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
|
|
471
519
|
|
|
472
520
|
params = this.getBaseQueryParams(params);
|
|
473
521
|
|
package/src/embed/base.ts
CHANGED
|
@@ -263,18 +263,18 @@ export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>):
|
|
|
263
263
|
* ```js
|
|
264
264
|
* executeTML({
|
|
265
265
|
* //Array of metadata Tmls
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
266
|
+
metadata_tmls: [
|
|
267
|
+
"'\''{\"guid\":\"9bd202f5-d431-44bf-9a07-b4f7be372125\",
|
|
268
|
+
\"liveboard\":{\"name\":\"Parameters Liveboard\"}}'\''"
|
|
269
|
+
],
|
|
270
|
+
import_policy: 'PARTIAL', // Specifies the import policy for the TML import.
|
|
271
|
+
create_new: false, // If selected, creates TML objects with new GUIDs.
|
|
272
|
+
}).then(result => {
|
|
273
|
+
console.log(result);
|
|
274
|
+
}).catch(error => {
|
|
275
|
+
console.error(error);
|
|
276
|
+
});
|
|
277
|
+
*```
|
|
278
278
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
279
279
|
* @group Global methods
|
|
280
280
|
*/
|
|
@@ -241,6 +241,54 @@ describe('Liveboard/viz embed tests', () => {
|
|
|
241
241
|
});
|
|
242
242
|
});
|
|
243
243
|
|
|
244
|
+
test('Should add isLiveboardCompactHeaderEnabled flag to the iframe src', async () => {
|
|
245
|
+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
246
|
+
...defaultViewConfig,
|
|
247
|
+
liveboardId,
|
|
248
|
+
isLiveboardCompactHeaderEnabled: false,
|
|
249
|
+
} as LiveboardViewConfig);
|
|
250
|
+
|
|
251
|
+
liveboardEmbed.render();
|
|
252
|
+
await executeAfterWait(() => {
|
|
253
|
+
expectUrlMatchesWithParams(
|
|
254
|
+
getIFrameSrc(),
|
|
255
|
+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isLiveboardHeaderV2Enabled=false${prefixParams}#/embed/viz/${liveboardId}`,
|
|
256
|
+
);
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
test('Should add showLiveboardReverifyBanner flag to the iframe src', async () => {
|
|
261
|
+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
262
|
+
...defaultViewConfig,
|
|
263
|
+
liveboardId,
|
|
264
|
+
showLiveboardReverifyBanner: false,
|
|
265
|
+
} as LiveboardViewConfig);
|
|
266
|
+
|
|
267
|
+
liveboardEmbed.render();
|
|
268
|
+
await executeAfterWait(() => {
|
|
269
|
+
expectUrlMatchesWithParams(
|
|
270
|
+
getIFrameSrc(),
|
|
271
|
+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}&showLiveboardReverifyBanner=false${prefixParams}#/embed/viz/${liveboardId}`,
|
|
272
|
+
);
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
test('Should add showLiveboardVerifiedBadge flag to the iframe src', async () => {
|
|
277
|
+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
278
|
+
...defaultViewConfig,
|
|
279
|
+
liveboardId,
|
|
280
|
+
showLiveboardVerifiedBadge: false,
|
|
281
|
+
} as LiveboardViewConfig);
|
|
282
|
+
|
|
283
|
+
liveboardEmbed.render();
|
|
284
|
+
await executeAfterWait(() => {
|
|
285
|
+
expectUrlMatchesWithParams(
|
|
286
|
+
getIFrameSrc(),
|
|
287
|
+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}&showLiveboardVerifiedBadge=false${prefixParams}#/embed/viz/${liveboardId}`,
|
|
288
|
+
);
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
|
|
244
292
|
test('should not append runtime filters in URL if excludeRuntimeFiltersfromURL is true', async () => {
|
|
245
293
|
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
246
294
|
...defaultViewConfig,
|
package/src/embed/liveboard.ts
CHANGED
|
@@ -284,6 +284,48 @@ export interface LiveboardViewConfig
|
|
|
284
284
|
* @version SDK: 1.32.0 | ThoughtSpot: 10.0.0.cl
|
|
285
285
|
*/
|
|
286
286
|
showPreviewLoader?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* This flag is used to enable the compact header in liveboard
|
|
289
|
+
* @type {boolean}
|
|
290
|
+
* @default false
|
|
291
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.3.0.cl
|
|
292
|
+
* @example
|
|
293
|
+
* ```js
|
|
294
|
+
* const embed = new LiveboardEmbed('#embed-container', {
|
|
295
|
+
* ... // other options
|
|
296
|
+
* isLiveboardCompactHeaderEnabled: true,
|
|
297
|
+
* })
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
isLiveboardCompactHeaderEnabled?: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* This flag is used to show/hide verified Icon in liveboard compact header
|
|
303
|
+
* @type {boolean}
|
|
304
|
+
* @default true
|
|
305
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
|
|
306
|
+
* @example
|
|
307
|
+
* ```js
|
|
308
|
+
* const embed = new LiveboardEmbed('#embed-container', {
|
|
309
|
+
* ... // other options
|
|
310
|
+
* showLiveboardVerifiedBadge: true,
|
|
311
|
+
* })
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
showLiveboardVerifiedBadge?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* This flag is used to show/hide re-verify banner in liveboard compact header
|
|
317
|
+
* @type {boolean}
|
|
318
|
+
* @default true
|
|
319
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
|
|
320
|
+
* @example
|
|
321
|
+
* ```js
|
|
322
|
+
* const embed = new LiveboardEmbed('#embed-container', {
|
|
323
|
+
* ... // other options
|
|
324
|
+
* showLiveboardReverifyBanner: true,
|
|
325
|
+
* })
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
328
|
+
showLiveboardReverifyBanner?: boolean;
|
|
287
329
|
}
|
|
288
330
|
|
|
289
331
|
/**
|
|
@@ -338,6 +380,9 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
338
380
|
showLiveboardDescription,
|
|
339
381
|
showLiveboardTitle,
|
|
340
382
|
isLiveboardHeaderSticky = true,
|
|
383
|
+
isLiveboardCompactHeaderEnabled = false,
|
|
384
|
+
showLiveboardVerifiedBadge = true,
|
|
385
|
+
showLiveboardReverifyBanner = true,
|
|
341
386
|
enableAskSage,
|
|
342
387
|
enable2ColumnLayout,
|
|
343
388
|
dataPanelV2 = true,
|
|
@@ -388,6 +433,9 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
388
433
|
}
|
|
389
434
|
|
|
390
435
|
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
|
|
436
|
+
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
|
|
437
|
+
params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
|
|
438
|
+
params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
|
|
391
439
|
|
|
392
440
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
393
441
|
const queryParams = getQueryParamString(params, true);
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -1214,7 +1214,7 @@ export class TsEmbed {
|
|
|
1214
1214
|
* @version SDK: 1.25.0 / ThoughtSpot 9.10.0
|
|
1215
1215
|
*/
|
|
1216
1216
|
public async getAnswerService(vizId?: string): Promise<AnswerService> {
|
|
1217
|
-
const { session } = await this.trigger(HostEvent.GetAnswerSession, vizId);
|
|
1217
|
+
const { session } = await this.trigger(HostEvent.GetAnswerSession, vizId ? { vizId } : {});
|
|
1218
1218
|
|
|
1219
1219
|
return new AnswerService(session, null, this.embedConfig.thoughtSpotHost);
|
|
1220
1220
|
}
|
|
@@ -1291,7 +1291,6 @@ export class V1Embed extends TsEmbed {
|
|
|
1291
1291
|
|
|
1292
1292
|
/**
|
|
1293
1293
|
* Only for testing purposes.
|
|
1294
|
-
*
|
|
1295
1294
|
* @hidden
|
|
1296
1295
|
*/
|
|
1297
1296
|
// eslint-disable-next-line camelcase
|
package/src/types.ts
CHANGED
|
@@ -581,6 +581,13 @@ export interface EmbedConfig {
|
|
|
581
581
|
* @version SDK: 1.28.5 | Thoughtspot: *
|
|
582
582
|
*/
|
|
583
583
|
disableTokenVerification?: boolean;
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* This flag is used to disable showing the login failure page in the embedded app.
|
|
587
|
+
*
|
|
588
|
+
* @version SDK 1.32.3 | Thoughtspot: *
|
|
589
|
+
*/
|
|
590
|
+
disableLoginFailurePage?: boolean;
|
|
584
591
|
}
|
|
585
592
|
|
|
586
593
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
@@ -2126,21 +2133,61 @@ export enum EmbedEvent {
|
|
|
2126
2133
|
*/
|
|
2127
2134
|
Rename = 'rename',
|
|
2128
2135
|
/**
|
|
2129
|
-
* Emitted
|
|
2136
|
+
* Emitted if the user wants to intercept the search execution
|
|
2137
|
+
* and implement logic to decide whether to run the search or not
|
|
2138
|
+
*
|
|
2139
|
+
* Prerequisite: Set isOnBeforeGetVizDataInterceptEnabled : true
|
|
2140
|
+
* for this embed event to get emitted.
|
|
2141
|
+
*
|
|
2142
|
+
* Parameter: payload
|
|
2143
|
+
* Parameter: responder
|
|
2144
|
+
* Contains elements that lets developers define whether ThoughtSpot
|
|
2145
|
+
* will run the search or not, and if not, which error message to provide.
|
|
2130
2146
|
*
|
|
2131
|
-
*
|
|
2132
|
-
*
|
|
2147
|
+
* execute: When execute returns true, the search will be run.
|
|
2148
|
+
* When execute returns false, the search will not be executed.
|
|
2149
|
+
*
|
|
2150
|
+
* error: Developers can customize the user facing message when execute is
|
|
2151
|
+
* set to false using the error parameter in responder
|
|
2152
|
+
*
|
|
2153
|
+
* @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
|
|
2133
2154
|
*
|
|
2134
2155
|
*```js
|
|
2135
|
-
*
|
|
2156
|
+
* .on(EmbedEvent.OnBeforeGetVizDataIntercept,
|
|
2136
2157
|
* (payload, responder) => {
|
|
2137
2158
|
* responder({
|
|
2138
2159
|
* data: {
|
|
2139
|
-
* execute:
|
|
2140
|
-
*
|
|
2160
|
+
* execute:false,
|
|
2161
|
+
* error: {
|
|
2162
|
+
* //Provide a custom error message to explain to your end user
|
|
2163
|
+
* //why their search did not run
|
|
2164
|
+
* errorText: "This search query cannot be run.
|
|
2165
|
+
* Please contact your administrator for more details."
|
|
2166
|
+
* }
|
|
2167
|
+
* }})
|
|
2168
|
+
* })
|
|
2169
|
+
* ```
|
|
2170
|
+
*
|
|
2171
|
+
*```js
|
|
2172
|
+
* .on(EmbedEvent.OnBeforeGetVizDataIntercept,
|
|
2173
|
+
* (payload, responder) => {
|
|
2174
|
+
* const query = payload.data.data.answer.search_query
|
|
2175
|
+
* responder({
|
|
2176
|
+
* data: {
|
|
2177
|
+
* // returns true as long as the query does not include
|
|
2178
|
+
* // both the 'sales' AND the 'county' column
|
|
2179
|
+
* execute: !(query.includes("sales")&&query.includes("county")),
|
|
2180
|
+
* error: {
|
|
2181
|
+
* //Provide a custom error message to explain to your end user
|
|
2182
|
+
* // why their search did not run, and which searches are accepted by your custom logic.
|
|
2183
|
+
* errorText: "You can't use this query :" + query + ".
|
|
2184
|
+
* The 'sales' measures can never be used at the 'county' level.
|
|
2185
|
+
* Please try another measure, or remove 'county' from your search."
|
|
2186
|
+
* }
|
|
2187
|
+
* }})
|
|
2141
2188
|
* })
|
|
2142
2189
|
*```
|
|
2143
|
-
*
|
|
2190
|
+
*
|
|
2144
2191
|
*/
|
|
2145
2192
|
OnBeforeGetVizDataIntercept = 'onBeforeGetVizDataIntercept',
|
|
2146
2193
|
/**
|
|
@@ -2260,6 +2307,15 @@ export enum HostEvent {
|
|
|
2260
2307
|
* @hidden
|
|
2261
2308
|
*/
|
|
2262
2309
|
Reload = 'reload',
|
|
2310
|
+
/**
|
|
2311
|
+
* Get current iframe src
|
|
2312
|
+
* @example
|
|
2313
|
+
* ```js
|
|
2314
|
+
* const frameUrl = AppEmbed.trigger(HostEvent.GetIframeUrl)
|
|
2315
|
+
* ```
|
|
2316
|
+
* @version SDK: 1.35.0 | Thoughtspot: 10.4.0.cl
|
|
2317
|
+
*/
|
|
2318
|
+
GetIframeUrl = 'GetIframeUrl',
|
|
2263
2319
|
/**
|
|
2264
2320
|
* Display specific visualizations on a Liveboard.
|
|
2265
2321
|
* @param - An array of GUIDs of the visualization to show. The visualization IDs not passed
|
|
@@ -3130,6 +3186,9 @@ export enum Param {
|
|
|
3130
3186
|
FocusSearchBarOnRender = 'focusSearchBarOnRender',
|
|
3131
3187
|
DisableRedirectionLinksInNewTab = 'disableRedirectionLinksInNewTab',
|
|
3132
3188
|
HomePageSearchBarMode = 'homePageSearchBarMode',
|
|
3189
|
+
ShowLiveboardVerifiedBadge = 'showLiveboardVerifiedBadge',
|
|
3190
|
+
ShowLiveboardReverifyBanner = 'showLiveboardReverifyBanner',
|
|
3191
|
+
LiveboardHeaderV2 = 'isLiveboardHeaderV2Enabled',
|
|
3133
3192
|
}
|
|
3134
3193
|
|
|
3135
3194
|
/**
|
|
@@ -222,6 +222,25 @@ export class AnswerService {
|
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
/**
|
|
226
|
+
* Fetch the data for the answer as a PNG blob. This might be
|
|
227
|
+
* quicker for larger data.
|
|
228
|
+
* @param userLocale
|
|
229
|
+
* @param omitBackground Omit the background in the PNG
|
|
230
|
+
* @param deviceScaleFactor The scale factor for the PNG
|
|
231
|
+
* @return Response
|
|
232
|
+
*/
|
|
233
|
+
public async fetchPNGBlob(userLocale = 'en-us', includeInfo = false, omitBackground = false, deviceScaleFactor = 2): Promise<Response> {
|
|
234
|
+
const fetchUrl = this.getFetchPNGBlobUrl(
|
|
235
|
+
userLocale,
|
|
236
|
+
omitBackground,
|
|
237
|
+
deviceScaleFactor,
|
|
238
|
+
);
|
|
239
|
+
return tokenizedFetch(fetchUrl, {
|
|
240
|
+
credentials: 'include',
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
225
244
|
/**
|
|
226
245
|
* Just get the internal URL for this answer's data
|
|
227
246
|
* as a CSV blob.
|
|
@@ -233,6 +252,14 @@ export class AnswerService {
|
|
|
233
252
|
return `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&hideCsvHeader=${!includeInfo}`;
|
|
234
253
|
}
|
|
235
254
|
|
|
255
|
+
/**
|
|
256
|
+
* Just get the internal URL for this answer's data
|
|
257
|
+
* as a PNG blob.
|
|
258
|
+
*/
|
|
259
|
+
public getFetchPNGBlobUrl(userLocale = 'en-us', omitBackground = false, deviceScaleFactor = 2): string {
|
|
260
|
+
return `${this.thoughtSpotHost}/prism/download/answer/png?sessionId=${this.session.sessionId}&deviceScaleFactor=${deviceScaleFactor}&omitBackground=${omitBackground}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data`;
|
|
261
|
+
}
|
|
262
|
+
|
|
236
263
|
/**
|
|
237
264
|
* Get underlying data given a point and the output column names.
|
|
238
265
|
* In case of a context menu action, the selectedPoints are
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { disable } from 'mixpanel-browser';
|
|
1
2
|
import * as processDataInstance from './processData';
|
|
2
3
|
import * as answerServiceInstance from './graphql/answerService/answerService';
|
|
3
4
|
import * as auth from '../auth';
|
|
@@ -171,4 +172,19 @@ describe('Unit test for process data', () => {
|
|
|
171
172
|
expect(el.innerHTML).toBe('Hello');
|
|
172
173
|
expect(embedConfigInstance.getEmbedConfig().autoLogin).toBe(false);
|
|
173
174
|
});
|
|
175
|
+
|
|
176
|
+
test('process authFailure AuthType=None', () => {
|
|
177
|
+
const e = { type: EmbedEvent.AuthFailure };
|
|
178
|
+
jest.spyOn(embedConfigInstance, 'getEmbedConfig').mockReturnValue({
|
|
179
|
+
loginFailedMessage: 'Hello',
|
|
180
|
+
authType: AuthType.EmbeddedSSO,
|
|
181
|
+
disableLoginFailurePage: true,
|
|
182
|
+
});
|
|
183
|
+
const el: any = {};
|
|
184
|
+
expect(processDataInstance.processEventData(e.type, e, '', el)).toEqual({
|
|
185
|
+
type: e.type,
|
|
186
|
+
});
|
|
187
|
+
expect(base.notifyAuthFailure).not.toBeCalled();
|
|
188
|
+
expect(el.innerHTML).not.toBe('Hello');
|
|
189
|
+
});
|
|
174
190
|
});
|
package/src/utils/processData.ts
CHANGED
|
@@ -78,8 +78,8 @@ function processNoCookieAccess(e: any, containerEl: Element) {
|
|
|
78
78
|
* @param containerEl
|
|
79
79
|
*/
|
|
80
80
|
export function processAuthFailure(e: any, containerEl: Element) {
|
|
81
|
-
const { loginFailedMessage, authType } = getEmbedConfig();
|
|
82
|
-
if (authType !== AuthType.None) {
|
|
81
|
+
const { loginFailedMessage, authType, disableLoginFailurePage } = getEmbedConfig();
|
|
82
|
+
if (authType !== AuthType.None && !disableLoginFailurePage) {
|
|
83
83
|
// eslint-disable-next-line no-param-reassign
|
|
84
84
|
containerEl.innerHTML = loginFailedMessage;
|
|
85
85
|
notifyAuthFailure(AuthFailureType.OTHER);
|