@thoughtspot/visual-embed-sdk 1.40.1 → 1.40.3
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.map +1 -1
- package/cjs/src/embed/app.js +5 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +33 -3
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +2 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +22 -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 +12 -0
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +122 -0
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/errors.d.ts +10 -0
- package/cjs/src/errors.d.ts.map +1 -1
- package/cjs/src/errors.js +11 -1
- 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 +3 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/react/index.d.ts +1 -1
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +2 -1
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/types.d.ts +131 -5
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +39 -11
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/custom-actions.d.ts +12 -0
- package/cjs/src/utils/custom-actions.d.ts.map +1 -0
- package/cjs/src/utils/custom-actions.js +180 -0
- package/cjs/src/utils/custom-actions.js.map +1 -0
- package/cjs/src/utils/custom-actions.spec.d.ts +2 -0
- package/cjs/src/utils/custom-actions.spec.d.ts.map +1 -0
- package/cjs/src/utils/custom-actions.spec.js +399 -0
- package/cjs/src/utils/custom-actions.spec.js.map +1 -0
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +10 -0
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +11 -0
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils.d.ts +7 -0
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +11 -1
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +28 -0
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/{index-P5YjBOuJ.js → index-BICLzyVL.js} +1 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/src/errors.d.ts +10 -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/react/index.d.ts +1 -1
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +131 -5
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/custom-actions.d.ts +12 -0
- package/dist/src/utils/custom-actions.d.ts.map +1 -0
- package/dist/src/utils/custom-actions.spec.d.ts +2 -0
- package/dist/src/utils/custom-actions.spec.d.ts.map +1 -0
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/src/utils.d.ts +7 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +1705 -203
- package/dist/tsembed-react.js +1704 -202
- package/dist/tsembed.es.js +1653 -151
- package/dist/tsembed.js +1652 -150
- package/dist/visual-embed-sdk-react-full.d.ts +132 -6
- package/dist/visual-embed-sdk-react.d.ts +132 -6
- package/dist/visual-embed-sdk.d.ts +132 -6
- package/lib/package.json +1 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +5 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +33 -3
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +2 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +22 -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 +12 -0
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +123 -1
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts +10 -0
- package/lib/src/errors.d.ts.map +1 -1
- package/lib/src/errors.js +10 -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/react/index.d.ts +1 -1
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +1 -1
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/types.d.ts +131 -5
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +38 -10
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/custom-actions.d.ts +12 -0
- package/lib/src/utils/custom-actions.d.ts.map +1 -0
- package/lib/src/utils/custom-actions.js +175 -0
- package/lib/src/utils/custom-actions.js.map +1 -0
- package/lib/src/utils/custom-actions.spec.d.ts +2 -0
- package/lib/src/utils/custom-actions.spec.d.ts.map +1 -0
- package/lib/src/utils/custom-actions.spec.js +397 -0
- package/lib/src/utils/custom-actions.spec.js.map +1 -0
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +10 -0
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +11 -0
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils.d.ts +7 -0
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +9 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +29 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +133 -7
- package/package.json +1 -1
- package/src/embed/app.spec.ts +48 -3
- package/src/embed/app.ts +5 -0
- package/src/embed/liveboard.spec.ts +30 -0
- package/src/embed/liveboard.ts +2 -0
- package/src/embed/ts-embed.spec.ts +135 -1
- package/src/embed/ts-embed.ts +12 -0
- package/src/errors.ts +11 -0
- package/src/index.ts +4 -0
- package/src/react/index.tsx +1 -0
- package/src/types.ts +147 -16
- package/src/utils/custom-actions.spec.ts +431 -0
- package/src/utils/custom-actions.ts +217 -0
- package/src/utils/processData.spec.ts +12 -0
- package/src/utils/processData.ts +10 -0
- package/src/utils.spec.ts +34 -0
- package/src/utils.ts +10 -0
|
@@ -2,7 +2,7 @@ import { resetValueFromWindow } from '../utils';
|
|
|
2
2
|
import { ERROR_MESSAGE } from '../errors';
|
|
3
3
|
import { resetCachedAuthToken } from '../authToken';
|
|
4
4
|
import { AuthType, init, EmbedEvent, SearchEmbed, PinboardEmbed, AppEmbed, LiveboardEmbed, SageEmbed, AnswerService, } from '../index';
|
|
5
|
-
import { Action, HomeLeftNavItem, RuntimeFilterOp, HomepageModule, HostEvent, ContextMenuTriggerOptions, } from '../types';
|
|
5
|
+
import { Action, HomeLeftNavItem, RuntimeFilterOp, HomepageModule, HostEvent, ContextMenuTriggerOptions, CustomActionTarget, CustomActionsPosition, } from '../types';
|
|
6
6
|
import { executeAfterWait, getDocumentBody, getIFrameEl, getIFrameSrc, getRootEl, postMessageToParent, defaultParamsForPinboardEmbed, waitFor, expectUrlMatchesWithParams, expectUrlToHaveParamsWithValues, mockMessageChannel, createRootEleForEmbed, expectUrlMatch, fixedEncodeURI, } from '../test/test-utils';
|
|
7
7
|
import * as config from '../config';
|
|
8
8
|
import * as embedConfig from './embedConfig';
|
|
@@ -253,6 +253,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
253
253
|
hiddenHomeLeftNavItems: [],
|
|
254
254
|
hiddenHomepageModules: [],
|
|
255
255
|
hiddenListColumns: [],
|
|
256
|
+
customActions: [],
|
|
256
257
|
hostConfig: undefined,
|
|
257
258
|
reorderedHomepageModules: [],
|
|
258
259
|
customVariablesForThirdPartyTools,
|
|
@@ -288,6 +289,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
288
289
|
hiddenHomeLeftNavItems: [],
|
|
289
290
|
hiddenHomepageModules: [],
|
|
290
291
|
hiddenListColumns: [],
|
|
292
|
+
customActions: [],
|
|
291
293
|
hostConfig: undefined,
|
|
292
294
|
reorderedHomepageModules: [],
|
|
293
295
|
customVariablesForThirdPartyTools,
|
|
@@ -328,6 +330,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
328
330
|
hiddenHomeLeftNavItems: [],
|
|
329
331
|
hiddenHomepageModules: [HomepageModule.MyLibrary, HomepageModule.Learning],
|
|
330
332
|
hiddenListColumns: [],
|
|
333
|
+
customActions: [],
|
|
331
334
|
reorderedHomepageModules: [],
|
|
332
335
|
customVariablesForThirdPartyTools,
|
|
333
336
|
},
|
|
@@ -362,6 +365,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
362
365
|
hiddenHomeLeftNavItems: [],
|
|
363
366
|
hiddenHomepageModules: [],
|
|
364
367
|
hiddenListColumns: [],
|
|
368
|
+
customActions: [],
|
|
365
369
|
reorderedHomepageModules: [],
|
|
366
370
|
customVariablesForThirdPartyTools,
|
|
367
371
|
},
|
|
@@ -401,6 +405,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
401
405
|
hiddenHomeLeftNavItems: [],
|
|
402
406
|
hiddenHomepageModules: [],
|
|
403
407
|
hiddenListColumns: [],
|
|
408
|
+
customActions: [],
|
|
404
409
|
reorderedHomepageModules: [HomepageModule.MyLibrary, HomepageModule.Watchlist],
|
|
405
410
|
customVariablesForThirdPartyTools,
|
|
406
411
|
},
|
|
@@ -442,6 +447,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
442
447
|
hiddenHomeLeftNavItems: [],
|
|
443
448
|
hiddenHomepageModules: [],
|
|
444
449
|
hiddenListColumns: [],
|
|
450
|
+
customActions: [],
|
|
445
451
|
hostConfig: undefined,
|
|
446
452
|
reorderedHomepageModules: [],
|
|
447
453
|
customVariablesForThirdPartyTools,
|
|
@@ -485,6 +491,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
485
491
|
hiddenHomeLeftNavItems: [],
|
|
486
492
|
hiddenHomepageModules: [],
|
|
487
493
|
hiddenListColumns: [],
|
|
494
|
+
customActions: [],
|
|
488
495
|
hostConfig: undefined,
|
|
489
496
|
reorderedHomepageModules: [],
|
|
490
497
|
customVariablesForThirdPartyTools,
|
|
@@ -527,6 +534,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
527
534
|
hiddenHomeLeftNavItems: [],
|
|
528
535
|
hiddenHomepageModules: [],
|
|
529
536
|
hiddenListColumns: [],
|
|
537
|
+
customActions: [],
|
|
530
538
|
hostConfig: undefined,
|
|
531
539
|
reorderedHomepageModules: [],
|
|
532
540
|
customVariablesForThirdPartyTools,
|
|
@@ -570,6 +578,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
570
578
|
hiddenHomeLeftNavItems: [],
|
|
571
579
|
hiddenHomepageModules: [],
|
|
572
580
|
hiddenListColumns: [],
|
|
581
|
+
customActions: [],
|
|
573
582
|
hostConfig: undefined,
|
|
574
583
|
reorderedHomepageModules: [],
|
|
575
584
|
customVariablesForThirdPartyTools,
|
|
@@ -610,6 +619,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
610
619
|
hiddenHomeLeftNavItems: [HomeLeftNavItem.Home, HomeLeftNavItem.MonitorSubscription],
|
|
611
620
|
hiddenHomepageModules: [],
|
|
612
621
|
hiddenListColumns: [],
|
|
622
|
+
customActions: [],
|
|
613
623
|
reorderedHomepageModules: [],
|
|
614
624
|
customVariablesForThirdPartyTools,
|
|
615
625
|
},
|
|
@@ -755,6 +765,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
755
765
|
hiddenHomeLeftNavItems: [],
|
|
756
766
|
hiddenHomepageModules: [],
|
|
757
767
|
hiddenListColumns: [],
|
|
768
|
+
customActions: [],
|
|
758
769
|
hostConfig: undefined,
|
|
759
770
|
reorderedHomepageModules: [],
|
|
760
771
|
customVariablesForThirdPartyTools: {},
|
|
@@ -833,6 +844,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
833
844
|
hiddenHomeLeftNavItems: [],
|
|
834
845
|
hiddenHomepageModules: [],
|
|
835
846
|
hiddenListColumns: [],
|
|
847
|
+
customActions: [],
|
|
836
848
|
hostConfig: undefined,
|
|
837
849
|
reorderedHomepageModules: [],
|
|
838
850
|
customVariablesForThirdPartyTools: {},
|
|
@@ -864,6 +876,116 @@ describe('Unit test case for ts embed', () => {
|
|
|
864
876
|
});
|
|
865
877
|
});
|
|
866
878
|
});
|
|
879
|
+
describe('getDefaultAppInitData with CustomActionsValidationResult', () => {
|
|
880
|
+
beforeEach(() => {
|
|
881
|
+
jest.spyOn(authInstance, 'doCookielessTokenAuth').mockResolvedValueOnce(true);
|
|
882
|
+
jest.spyOn(authService, 'verifyTokenService').mockResolvedValue(true);
|
|
883
|
+
init({
|
|
884
|
+
thoughtSpotHost: 'tshost',
|
|
885
|
+
authType: AuthType.TrustedAuthTokenCookieless,
|
|
886
|
+
getAuthToken: () => Promise.resolve('test_auth_token1'),
|
|
887
|
+
});
|
|
888
|
+
});
|
|
889
|
+
afterEach(() => {
|
|
890
|
+
baseInstance.reset();
|
|
891
|
+
jest.clearAllMocks();
|
|
892
|
+
});
|
|
893
|
+
test('should handle valid custom actions and sort them by name in getDefaultAppInitData', async () => {
|
|
894
|
+
const mockEmbedEventPayload = {
|
|
895
|
+
type: EmbedEvent.APP_INIT,
|
|
896
|
+
data: {},
|
|
897
|
+
};
|
|
898
|
+
// Create a SearchEmbed with valid custom actions to test
|
|
899
|
+
// CustomActionsValidationResult
|
|
900
|
+
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
901
|
+
...defaultViewConfig,
|
|
902
|
+
customActions: [
|
|
903
|
+
{
|
|
904
|
+
id: 'action1',
|
|
905
|
+
name: 'Valid Action',
|
|
906
|
+
target: CustomActionTarget.LIVEBOARD,
|
|
907
|
+
position: CustomActionsPosition.PRIMARY,
|
|
908
|
+
metadataIds: { liveboardIds: ['lb123'] }
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
id: 'action2',
|
|
912
|
+
name: 'Another Valid Action',
|
|
913
|
+
target: CustomActionTarget.VIZ,
|
|
914
|
+
position: CustomActionsPosition.MENU,
|
|
915
|
+
metadataIds: { vizIds: ['viz456'] }
|
|
916
|
+
}
|
|
917
|
+
]
|
|
918
|
+
});
|
|
919
|
+
searchEmbed.render();
|
|
920
|
+
const mockPort = {
|
|
921
|
+
postMessage: jest.fn(),
|
|
922
|
+
};
|
|
923
|
+
await executeAfterWait(() => {
|
|
924
|
+
const iframe = getIFrameEl();
|
|
925
|
+
postMessageToParent(iframe.contentWindow, mockEmbedEventPayload, mockPort);
|
|
926
|
+
});
|
|
927
|
+
await executeAfterWait(() => {
|
|
928
|
+
expect(mockPort.postMessage).toHaveBeenCalledWith({
|
|
929
|
+
type: EmbedEvent.APP_INIT,
|
|
930
|
+
data: {
|
|
931
|
+
customisations: {
|
|
932
|
+
content: {},
|
|
933
|
+
style: {
|
|
934
|
+
customCSS: {},
|
|
935
|
+
customCSSUrl: undefined,
|
|
936
|
+
},
|
|
937
|
+
},
|
|
938
|
+
authToken: 'test_auth_token1',
|
|
939
|
+
runtimeFilterParams: null,
|
|
940
|
+
runtimeParameterParams: null,
|
|
941
|
+
hiddenHomeLeftNavItems: [],
|
|
942
|
+
hiddenHomepageModules: [],
|
|
943
|
+
hiddenListColumns: [],
|
|
944
|
+
customActions: [
|
|
945
|
+
{
|
|
946
|
+
id: 'action2',
|
|
947
|
+
name: 'Another Valid Action',
|
|
948
|
+
target: CustomActionTarget.VIZ,
|
|
949
|
+
position: CustomActionsPosition.MENU,
|
|
950
|
+
metadataIds: { vizIds: ['viz456'] }
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
id: 'action1',
|
|
954
|
+
name: 'Valid Action',
|
|
955
|
+
target: CustomActionTarget.LIVEBOARD,
|
|
956
|
+
position: CustomActionsPosition.PRIMARY,
|
|
957
|
+
metadataIds: { liveboardIds: ['lb123'] }
|
|
958
|
+
}
|
|
959
|
+
],
|
|
960
|
+
hostConfig: undefined,
|
|
961
|
+
reorderedHomepageModules: [],
|
|
962
|
+
customVariablesForThirdPartyTools: {},
|
|
963
|
+
},
|
|
964
|
+
});
|
|
965
|
+
// Verify that CustomActionsValidationResult structure is
|
|
966
|
+
// correct
|
|
967
|
+
const appInitData = mockPort.postMessage.mock.calls[0][0].data;
|
|
968
|
+
expect(appInitData.customActions).toHaveLength(2);
|
|
969
|
+
expect(appInitData.customActions).toEqual(expect.arrayContaining([
|
|
970
|
+
expect.objectContaining({
|
|
971
|
+
id: 'action1',
|
|
972
|
+
name: 'Valid Action',
|
|
973
|
+
target: CustomActionTarget.LIVEBOARD,
|
|
974
|
+
position: CustomActionsPosition.PRIMARY
|
|
975
|
+
}),
|
|
976
|
+
expect.objectContaining({
|
|
977
|
+
id: 'action2',
|
|
978
|
+
name: 'Another Valid Action',
|
|
979
|
+
target: CustomActionTarget.VIZ,
|
|
980
|
+
position: CustomActionsPosition.MENU
|
|
981
|
+
})
|
|
982
|
+
]));
|
|
983
|
+
// Verify actions are sorted by name (alphabetically)
|
|
984
|
+
expect(appInitData.customActions[0].name).toBe('Another Valid Action');
|
|
985
|
+
expect(appInitData.customActions[1].name).toBe('Valid Action');
|
|
986
|
+
});
|
|
987
|
+
});
|
|
988
|
+
});
|
|
867
989
|
describe('Token fetch fails in cookieless authentication authType', () => {
|
|
868
990
|
beforeEach(() => {
|
|
869
991
|
jest.spyOn(authInstance, 'doCookielessTokenAuth').mockResolvedValueOnce(true);
|