@thoughtspot/visual-embed-sdk 1.45.3 → 1.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cjs/package.json +2 -2
- package/cjs/src/auth.d.ts +35 -2
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +36 -3
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/embed/app.d.ts +1 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +6 -6
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +87 -119
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +1 -1
- package/cjs/src/embed/liveboard.d.ts +2 -2
- package/cjs/src/embed/liveboard.js +2 -2
- package/cjs/src/embed/search.d.ts +3 -2
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +3 -2
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +1 -1
- package/cjs/src/embed/ts-embed.js +1 -1
- package/cjs/src/react/index.d.ts +1 -1
- package/cjs/src/types.d.ts +408 -66
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +116 -52
- package/cjs/src/types.js.map +1 -1
- package/dist/{index-BuwECGdm.js → index-Vyh6Ha5f.js} +1 -1
- package/dist/src/auth.d.ts +35 -2
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +1 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +1 -1
- package/dist/src/embed/liveboard.d.ts +2 -2
- package/dist/src/embed/search.d.ts +3 -2
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +1 -1
- package/dist/src/react/index.d.ts +1 -1
- package/dist/src/types.d.ts +408 -66
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +167 -69
- package/dist/tsembed-react.js +166 -68
- package/dist/tsembed.es.js +167 -69
- package/dist/tsembed.js +166 -68
- package/dist/visual-embed-sdk-react-full.d.ts +446 -71
- package/dist/visual-embed-sdk-react.d.ts +439 -67
- package/dist/visual-embed-sdk.d.ts +445 -70
- package/lib/package.json +2 -2
- package/lib/src/auth.d.ts +35 -2
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +36 -3
- package/lib/src/auth.js.map +1 -1
- package/lib/src/embed/app.d.ts +1 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +6 -6
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +87 -119
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +1 -1
- package/lib/src/embed/liveboard.d.ts +2 -2
- package/lib/src/embed/liveboard.js +2 -2
- package/lib/src/embed/search.d.ts +3 -2
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +3 -2
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +1 -1
- package/lib/src/embed/ts-embed.js +1 -1
- package/lib/src/react/index.d.ts +1 -1
- package/lib/src/types.d.ts +408 -66
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +116 -52
- package/lib/src/types.js.map +1 -1
- package/package.json +2 -2
- package/src/auth.ts +36 -3
- package/src/embed/app.spec.ts +171 -211
- package/src/embed/app.ts +16 -11
- package/src/embed/conversation.ts +1 -1
- package/src/embed/liveboard.ts +2 -2
- package/src/embed/search.ts +3 -2
- package/src/embed/ts-embed.ts +1 -1
- package/src/react/index.tsx +1 -1
- package/src/types.ts +409 -67
package/src/embed/app.spec.ts
CHANGED
|
@@ -37,6 +37,72 @@ const defaultViewConfig = {
|
|
|
37
37
|
const thoughtSpotHost = 'tshost';
|
|
38
38
|
const defaultParamsPost = '';
|
|
39
39
|
|
|
40
|
+
// Helper function to create and render AppEmbed with config
|
|
41
|
+
const createAndRenderAppEmbed = async (viewConfig: AppViewConfig) => {
|
|
42
|
+
const appEmbed = new AppEmbed(getRootEl(), viewConfig);
|
|
43
|
+
appEmbed.render();
|
|
44
|
+
return appEmbed;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Helper function to test URL parameters
|
|
48
|
+
const testUrlParams = async (viewConfig: AppViewConfig, expectedUrl: string) => {
|
|
49
|
+
await createAndRenderAppEmbed(viewConfig);
|
|
50
|
+
await executeAfterWait(() => {
|
|
51
|
+
expectUrlMatchesWithParams(getIFrameSrc(), expectedUrl);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Helper function to test setIframeHeightForNonEmbedLiveboard behavior
|
|
56
|
+
const testSetIframeHeightBehavior = (
|
|
57
|
+
currentPath: string,
|
|
58
|
+
shouldBeCalled: boolean
|
|
59
|
+
) => {
|
|
60
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
61
|
+
...defaultViewConfig,
|
|
62
|
+
fullHeight: true,
|
|
63
|
+
} as AppViewConfig) as any;
|
|
64
|
+
|
|
65
|
+
const spySetIFrameHeight = shouldBeCalled
|
|
66
|
+
? jest.spyOn(appEmbed, 'setIFrameHeight').mockImplementation(jest.fn())
|
|
67
|
+
: jest.spyOn(appEmbed, 'setIFrameHeight');
|
|
68
|
+
|
|
69
|
+
appEmbed.render();
|
|
70
|
+
appEmbed.setIframeHeightForNonEmbedLiveboard({
|
|
71
|
+
data: { currentPath },
|
|
72
|
+
type: 'Route',
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
if (shouldBeCalled) {
|
|
76
|
+
expect(spySetIFrameHeight).toHaveBeenCalled();
|
|
77
|
+
} else {
|
|
78
|
+
expect(spySetIFrameHeight).not.toHaveBeenCalled();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// Helper function to create mock iframe with default getBoundingClientRect
|
|
83
|
+
const createMockIFrame = (rect = {
|
|
84
|
+
top: 100,
|
|
85
|
+
left: 150,
|
|
86
|
+
bottom: 600,
|
|
87
|
+
right: 800,
|
|
88
|
+
width: 650,
|
|
89
|
+
height: 500,
|
|
90
|
+
}): HTMLIFrameElement => {
|
|
91
|
+
const mockIFrame = document.createElement('iframe');
|
|
92
|
+
mockIFrame.getBoundingClientRect = jest.fn().mockReturnValue(rect);
|
|
93
|
+
return mockIFrame;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// Helper function to setup iframe creation spy
|
|
97
|
+
const setupIFrameCreationSpy = (mockIFrame: HTMLIFrameElement) => {
|
|
98
|
+
jest.spyOn(document, 'createElement').mockImplementation((tagName) => {
|
|
99
|
+
if (tagName === 'iframe') {
|
|
100
|
+
return mockIFrame;
|
|
101
|
+
}
|
|
102
|
+
return document.createElement(tagName);
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
40
106
|
const originalResizeObserver = window.ResizeObserver;
|
|
41
107
|
beforeAll(() => {
|
|
42
108
|
init({
|
|
@@ -913,192 +979,137 @@ describe('App embed tests', () => {
|
|
|
913
979
|
});
|
|
914
980
|
|
|
915
981
|
test('Should add navigationVersion=v3 when primaryNavbarVersion is Sliding to the iframe src', async () => {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
expectUrlMatchesWithParams(
|
|
927
|
-
getIFrameSrc(),
|
|
928
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3${defaultParams}${defaultParamsPost}#/home`,
|
|
929
|
-
);
|
|
930
|
-
});
|
|
982
|
+
await testUrlParams(
|
|
983
|
+
{
|
|
984
|
+
...defaultViewConfig,
|
|
985
|
+
discoveryExperience: {
|
|
986
|
+
primaryNavbarVersion: PrimaryNavbarVersion.Sliding,
|
|
987
|
+
homePage: HomePage.Modular,
|
|
988
|
+
},
|
|
989
|
+
} as AppViewConfig,
|
|
990
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3${defaultParams}${defaultParamsPost}#/home`
|
|
991
|
+
);
|
|
931
992
|
});
|
|
932
993
|
|
|
933
994
|
test('Should not add navigationVersion=v3 when primaryNavbarVersion is not added to the iframe src', async () => {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
expectUrlMatchesWithParams(
|
|
944
|
-
getIFrameSrc(),
|
|
945
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true${defaultParams}${defaultParamsPost}#/home`,
|
|
946
|
-
);
|
|
947
|
-
});
|
|
995
|
+
await testUrlParams(
|
|
996
|
+
{
|
|
997
|
+
...defaultViewConfig,
|
|
998
|
+
discoveryExperience: {
|
|
999
|
+
homePage: HomePage.Modular,
|
|
1000
|
+
},
|
|
1001
|
+
} as AppViewConfig,
|
|
1002
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true${defaultParams}${defaultParamsPost}#/home`
|
|
1003
|
+
);
|
|
948
1004
|
});
|
|
949
1005
|
|
|
950
1006
|
test('Should add navigationVersion=v3 & modularHomeExperience=true when primaryNavbarVersion is Sliding to the iframe src', async () => {
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
expectUrlMatchesWithParams(
|
|
962
|
-
getIFrameSrc(),
|
|
963
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3${defaultParams}${defaultParamsPost}#/home`,
|
|
964
|
-
);
|
|
965
|
-
});
|
|
1007
|
+
await testUrlParams(
|
|
1008
|
+
{
|
|
1009
|
+
...defaultViewConfig,
|
|
1010
|
+
// homePage v2 config not included under discoveryExperience
|
|
1011
|
+
discoveryExperience: {
|
|
1012
|
+
primaryNavbarVersion: PrimaryNavbarVersion.Sliding,
|
|
1013
|
+
},
|
|
1014
|
+
} as AppViewConfig,
|
|
1015
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3${defaultParams}${defaultParamsPost}#/home`
|
|
1016
|
+
);
|
|
966
1017
|
});
|
|
967
1018
|
|
|
968
1019
|
test('Should add homepageVersion=v3 & navigationVersion=v3 & modularHomeExperience=true when Sliding and ModularWithStylingChanges configured in the iframe src', async () => {
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
expectUrlMatchesWithParams(
|
|
980
|
-
getIFrameSrc(),
|
|
981
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3&homepageVersion=v3${defaultParams}${defaultParamsPost}#/home`,
|
|
982
|
-
);
|
|
983
|
-
});
|
|
1020
|
+
await testUrlParams(
|
|
1021
|
+
{
|
|
1022
|
+
...defaultViewConfig,
|
|
1023
|
+
discoveryExperience: {
|
|
1024
|
+
primaryNavbarVersion: PrimaryNavbarVersion.Sliding,
|
|
1025
|
+
homePage: HomePage.ModularWithStylingChanges,
|
|
1026
|
+
},
|
|
1027
|
+
} as AppViewConfig,
|
|
1028
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3&homepageVersion=v3${defaultParams}${defaultParamsPost}#/home`
|
|
1029
|
+
);
|
|
984
1030
|
});
|
|
985
1031
|
|
|
986
1032
|
test('Should add homepageVersion=v3 & navigationVersion=v3 & modularHomeExperience=true when homePage is ModularWithStylingChanges to the iframe src', async () => {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
getIFrameSrc(),
|
|
1000
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2&homepageVersion=v3${defaultParams}${defaultParamsPost}#/home`,
|
|
1001
|
-
);
|
|
1002
|
-
});
|
|
1033
|
+
await testUrlParams(
|
|
1034
|
+
{
|
|
1035
|
+
...defaultViewConfig,
|
|
1036
|
+
// primaryNavbarVersion is not included under
|
|
1037
|
+
// discoveryExperience, then it set navigationVersion=v2 and
|
|
1038
|
+
// modularHomeExperience=false.
|
|
1039
|
+
discoveryExperience: {
|
|
1040
|
+
homePage: HomePage.ModularWithStylingChanges,
|
|
1041
|
+
},
|
|
1042
|
+
} as AppViewConfig,
|
|
1043
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2&homepageVersion=v3${defaultParams}${defaultParamsPost}#/home`
|
|
1044
|
+
);
|
|
1003
1045
|
});
|
|
1004
1046
|
|
|
1005
1047
|
test('Should add navigationVersion=v2 when primaryNavbarVersion is not added to the iframe src', async () => {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
expectUrlMatchesWithParams(
|
|
1013
|
-
getIFrameSrc(),
|
|
1014
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2${defaultParams}${defaultParamsPost}#/home`,
|
|
1015
|
-
);
|
|
1016
|
-
});
|
|
1048
|
+
await testUrlParams(
|
|
1049
|
+
{
|
|
1050
|
+
...defaultViewConfig,
|
|
1051
|
+
} as AppViewConfig,
|
|
1052
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2${defaultParams}${defaultParamsPost}#/home`
|
|
1053
|
+
);
|
|
1017
1054
|
});
|
|
1018
1055
|
|
|
1019
1056
|
test('Should add enableAskSage flag to the iframe src', async () => {
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
expectUrlMatchesWithParams(
|
|
1028
|
-
getIFrameSrc(),
|
|
1029
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&enableAskSage=true${defaultParams}${defaultParamsPost}#/home`,
|
|
1030
|
-
);
|
|
1031
|
-
});
|
|
1057
|
+
await testUrlParams(
|
|
1058
|
+
{
|
|
1059
|
+
...defaultViewConfig,
|
|
1060
|
+
enableAskSage: true,
|
|
1061
|
+
} as AppViewConfig,
|
|
1062
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&enableAskSage=true${defaultParams}${defaultParamsPost}#/home`
|
|
1063
|
+
);
|
|
1032
1064
|
});
|
|
1033
1065
|
|
|
1034
1066
|
test('Should add listpageVersion=v3 when listPageVersion is ListWithUXChanges to the iframe src', async () => {
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
expectUrlMatchesWithParams(
|
|
1045
|
-
getIFrameSrc(),
|
|
1046
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&listpageVersion=v3${defaultParams}${defaultParamsPost}#/home`,
|
|
1047
|
-
);
|
|
1048
|
-
});
|
|
1067
|
+
await testUrlParams(
|
|
1068
|
+
{
|
|
1069
|
+
...defaultViewConfig,
|
|
1070
|
+
discoveryExperience: {
|
|
1071
|
+
listPageVersion: ListPage.ListWithUXChanges,
|
|
1072
|
+
},
|
|
1073
|
+
} as AppViewConfig,
|
|
1074
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&listpageVersion=v3${defaultParams}${defaultParamsPost}#/home`
|
|
1075
|
+
);
|
|
1049
1076
|
});
|
|
1050
1077
|
|
|
1051
|
-
|
|
1052
1078
|
test('Should add listpageVersion=v2 by default when no discoveryExperience is provided', async () => {
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
expectUrlMatchesWithParams(
|
|
1060
|
-
getIFrameSrc(),
|
|
1061
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2&listpageVersion=v2${defaultParams}${defaultParamsPost}#/home`,
|
|
1062
|
-
);
|
|
1063
|
-
});
|
|
1079
|
+
await testUrlParams(
|
|
1080
|
+
{
|
|
1081
|
+
...defaultViewConfig,
|
|
1082
|
+
} as AppViewConfig,
|
|
1083
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2${defaultParams}${defaultParamsPost}#/home`
|
|
1084
|
+
);
|
|
1064
1085
|
});
|
|
1065
1086
|
|
|
1066
1087
|
test('Should add listpageVersion=v2 by default when discoveryExperience is provided but listPageVersion is not specified', async () => {
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
expectUrlMatchesWithParams(
|
|
1078
|
-
getIFrameSrc(),
|
|
1079
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3&listpageVersion=v2${defaultParams}${defaultParamsPost}#/home`,
|
|
1080
|
-
);
|
|
1081
|
-
});
|
|
1088
|
+
await testUrlParams(
|
|
1089
|
+
{
|
|
1090
|
+
...defaultViewConfig,
|
|
1091
|
+
discoveryExperience: {
|
|
1092
|
+
primaryNavbarVersion: PrimaryNavbarVersion.Sliding,
|
|
1093
|
+
homePage: HomePage.Modular,
|
|
1094
|
+
},
|
|
1095
|
+
} as AppViewConfig,
|
|
1096
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3${defaultParams}${defaultParamsPost}#/home`
|
|
1097
|
+
);
|
|
1082
1098
|
});
|
|
1083
1099
|
|
|
1084
1100
|
|
|
1085
1101
|
test('Should add listpageVersion=v3 combined with other discoveryExperience options to the iframe src', async () => {
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
expectUrlMatchesWithParams(
|
|
1098
|
-
getIFrameSrc(),
|
|
1099
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3&listpageVersion=v3${defaultParams}${defaultParamsPost}#/home`,
|
|
1100
|
-
);
|
|
1101
|
-
});
|
|
1102
|
+
await testUrlParams(
|
|
1103
|
+
{
|
|
1104
|
+
...defaultViewConfig,
|
|
1105
|
+
discoveryExperience: {
|
|
1106
|
+
primaryNavbarVersion: PrimaryNavbarVersion.Sliding,
|
|
1107
|
+
homePage: HomePage.Modular,
|
|
1108
|
+
listPageVersion: ListPage.ListWithUXChanges,
|
|
1109
|
+
},
|
|
1110
|
+
} as AppViewConfig,
|
|
1111
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3&listpageVersion=v3${defaultParams}${defaultParamsPost}#/home`
|
|
1112
|
+
);
|
|
1102
1113
|
});
|
|
1103
1114
|
|
|
1104
1115
|
test('Should add enablePendoHelp flag to the iframe src conditional on navbar', async () => {
|
|
@@ -1319,21 +1330,8 @@ describe('App embed tests', () => {
|
|
|
1319
1330
|
let mockIFrame: HTMLIFrameElement;
|
|
1320
1331
|
|
|
1321
1332
|
beforeEach(() => {
|
|
1322
|
-
mockIFrame =
|
|
1323
|
-
mockIFrame
|
|
1324
|
-
top: 100,
|
|
1325
|
-
left: 150,
|
|
1326
|
-
bottom: 600,
|
|
1327
|
-
right: 800,
|
|
1328
|
-
width: 650,
|
|
1329
|
-
height: 500,
|
|
1330
|
-
});
|
|
1331
|
-
jest.spyOn(document, 'createElement').mockImplementation((tagName) => {
|
|
1332
|
-
if (tagName === 'iframe') {
|
|
1333
|
-
return mockIFrame;
|
|
1334
|
-
}
|
|
1335
|
-
return document.createElement(tagName);
|
|
1336
|
-
});
|
|
1333
|
+
mockIFrame = createMockIFrame();
|
|
1334
|
+
setupIFrameCreationSpy(mockIFrame);
|
|
1337
1335
|
});
|
|
1338
1336
|
|
|
1339
1337
|
afterEach(() => {
|
|
@@ -1610,53 +1608,15 @@ describe('App embed tests', () => {
|
|
|
1610
1608
|
});
|
|
1611
1609
|
|
|
1612
1610
|
test('should not call setIFrameHeight if currentPath starts with "/embed/viz/"', () => {
|
|
1613
|
-
|
|
1614
|
-
...defaultViewConfig,
|
|
1615
|
-
fullHeight: true,
|
|
1616
|
-
} as AppViewConfig) as any;
|
|
1617
|
-
const spySetIFrameHeight = jest.spyOn(appEmbed, 'setIFrameHeight');
|
|
1618
|
-
|
|
1619
|
-
appEmbed.render();
|
|
1620
|
-
appEmbed.setIframeHeightForNonEmbedLiveboard({
|
|
1621
|
-
data: { currentPath: '/embed/viz/' },
|
|
1622
|
-
type: 'Route',
|
|
1623
|
-
});
|
|
1624
|
-
|
|
1625
|
-
expect(spySetIFrameHeight).not.toHaveBeenCalled();
|
|
1611
|
+
testSetIframeHeightBehavior('/embed/viz/', false);
|
|
1626
1612
|
});
|
|
1627
1613
|
|
|
1628
1614
|
test('should not call setIFrameHeight if currentPath starts with "/embed/insights/viz/"', () => {
|
|
1629
|
-
|
|
1630
|
-
...defaultViewConfig,
|
|
1631
|
-
fullHeight: true,
|
|
1632
|
-
} as AppViewConfig) as any;
|
|
1633
|
-
const spySetIFrameHeight = jest.spyOn(appEmbed, 'setIFrameHeight');
|
|
1634
|
-
|
|
1635
|
-
appEmbed.render();
|
|
1636
|
-
appEmbed.setIframeHeightForNonEmbedLiveboard({
|
|
1637
|
-
data: { currentPath: '/embed/insights/viz/' },
|
|
1638
|
-
type: 'Route',
|
|
1639
|
-
});
|
|
1640
|
-
|
|
1641
|
-
expect(spySetIFrameHeight).not.toHaveBeenCalled();
|
|
1615
|
+
testSetIframeHeightBehavior('/embed/insights/viz/', false);
|
|
1642
1616
|
});
|
|
1643
1617
|
|
|
1644
1618
|
test('should call setIFrameHeight if currentPath starts with "/some/other/path/"', () => {
|
|
1645
|
-
|
|
1646
|
-
...defaultViewConfig,
|
|
1647
|
-
fullHeight: true,
|
|
1648
|
-
} as AppViewConfig) as any;
|
|
1649
|
-
const spySetIFrameHeight = jest
|
|
1650
|
-
.spyOn(appEmbed, 'setIFrameHeight')
|
|
1651
|
-
.mockImplementation(jest.fn());
|
|
1652
|
-
|
|
1653
|
-
appEmbed.render();
|
|
1654
|
-
appEmbed.setIframeHeightForNonEmbedLiveboard({
|
|
1655
|
-
data: { currentPath: '/some/other/path/' },
|
|
1656
|
-
type: 'Route',
|
|
1657
|
-
});
|
|
1658
|
-
|
|
1659
|
-
expect(spySetIFrameHeight).toHaveBeenCalled();
|
|
1619
|
+
testSetIframeHeightBehavior('/some/other/path/', true);
|
|
1660
1620
|
});
|
|
1661
1621
|
|
|
1662
1622
|
test('should update iframe height correctly', async () => {
|
package/src/embed/app.ts
CHANGED
|
@@ -60,11 +60,11 @@ export enum Page {
|
|
|
60
60
|
/**
|
|
61
61
|
* Monitor Alerts Page
|
|
62
62
|
*/
|
|
63
|
-
Monitor = 'monitor'
|
|
63
|
+
Monitor = 'monitor',
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* Define the initial state
|
|
67
|
+
* Define the initial state of column custom group accordions
|
|
68
68
|
* in data panel v2.
|
|
69
69
|
*/
|
|
70
70
|
export enum DataPanelCustomColumnGroupsAccordionState {
|
|
@@ -230,7 +230,7 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
230
230
|
* });
|
|
231
231
|
* ```
|
|
232
232
|
*/
|
|
233
|
-
enablePendoHelp?: boolean
|
|
233
|
+
enablePendoHelp?: boolean;
|
|
234
234
|
/**
|
|
235
235
|
* Control the visibility of the hamburger icon on
|
|
236
236
|
* the top navigation bar in the V3 navigation experience.
|
|
@@ -740,7 +740,6 @@ export class AppEmbed extends V1Embed {
|
|
|
740
740
|
|
|
741
741
|
private defaultHeight = 500;
|
|
742
742
|
|
|
743
|
-
|
|
744
743
|
constructor(domSelector: DOMSelector, viewConfig: AppViewConfig) {
|
|
745
744
|
viewConfig.embedComponentType = 'AppEmbed';
|
|
746
745
|
super(domSelector, viewConfig);
|
|
@@ -748,7 +747,10 @@ export class AppEmbed extends V1Embed {
|
|
|
748
747
|
this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
749
748
|
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
750
749
|
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
751
|
-
this.on(
|
|
750
|
+
this.on(
|
|
751
|
+
EmbedEvent.RequestVisibleEmbedCoordinates,
|
|
752
|
+
this.requestVisibleEmbedCoordinatesHandler,
|
|
753
|
+
);
|
|
752
754
|
}
|
|
753
755
|
}
|
|
754
756
|
|
|
@@ -942,7 +944,9 @@ export class AppEmbed extends V1Embed {
|
|
|
942
944
|
}
|
|
943
945
|
|
|
944
946
|
if (isLiveboardStylingAndGroupingEnabled !== undefined) {
|
|
945
|
-
params[
|
|
947
|
+
params[
|
|
948
|
+
Param.IsLiveboardStylingAndGroupingEnabled
|
|
949
|
+
] = isLiveboardStylingAndGroupingEnabled;
|
|
946
950
|
}
|
|
947
951
|
|
|
948
952
|
if (isPNGInScheduledEmailsEnabled !== undefined) {
|
|
@@ -996,6 +1000,10 @@ export class AppEmbed extends V1Embed {
|
|
|
996
1000
|
params[Param.DataPanelCustomGroupsAccordionInitialState] = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL;
|
|
997
1001
|
}
|
|
998
1002
|
|
|
1003
|
+
if (modularHomeExperience !== undefined) {
|
|
1004
|
+
params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
999
1007
|
// Set navigation to v2 by default to avoid problems like the app
|
|
1000
1008
|
// switcher (9-dot menu) not showing when v3 navigation is turned on
|
|
1001
1009
|
// at the cluster level.
|
|
@@ -1005,9 +1013,6 @@ export class AppEmbed extends V1Embed {
|
|
|
1005
1013
|
// Set homePageVersion to v2 by default to reset the LD flag value
|
|
1006
1014
|
// for the homepageVersion.
|
|
1007
1015
|
params[Param.HomepageVersion] = 'v2';
|
|
1008
|
-
// Set listpageVersion to v2 by default to reset the LD flag value
|
|
1009
|
-
// for the listpageVersion.
|
|
1010
|
-
params[Param.ListPageVersion] = ListPage.List;
|
|
1011
1016
|
if (discoveryExperience) {
|
|
1012
1017
|
// primaryNavbarVersion v3 will enabled the new left navigation
|
|
1013
1018
|
if (discoveryExperience.primaryNavbarVersion === PrimaryNavbarVersion.Sliding) {
|
|
@@ -1029,8 +1034,8 @@ export class AppEmbed extends V1Embed {
|
|
|
1029
1034
|
params[Param.HomepageVersion] = HomePage.ModularWithStylingChanges;
|
|
1030
1035
|
}
|
|
1031
1036
|
|
|
1032
|
-
// listPageVersion
|
|
1033
|
-
if (discoveryExperience.listPageVersion
|
|
1037
|
+
// listPageVersion can be changed to v2 or v3
|
|
1038
|
+
if (discoveryExperience.listPageVersion !== undefined) {
|
|
1034
1039
|
params[Param.ListPageVersion] = discoveryExperience.listPageVersion;
|
|
1035
1040
|
}
|
|
1036
1041
|
}
|
|
@@ -162,7 +162,7 @@ export interface SpotterEmbedViewConfig extends Omit<BaseViewConfig, 'primaryAct
|
|
|
162
162
|
*
|
|
163
163
|
* Supported embed types: `SageEmbed`, `AppEmbed`, `SearchBarEmbed`, `LiveboardEmbed`, `SearchEmbed`
|
|
164
164
|
* @default true
|
|
165
|
-
* @
|
|
165
|
+
* @deprecated from SDK 1.46.0 | ThoughtSpot Cloud: 26.3.0.cl
|
|
166
166
|
* @example
|
|
167
167
|
* ```js
|
|
168
168
|
* // Replace <EmbedComponent> with embed component name. For example, SageEmbed, AppEmbed, or SearchBarEmbed
|
package/src/embed/liveboard.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) 2022
|
|
3
3
|
*
|
|
4
4
|
* Embed a ThoughtSpot Liveboard or visualization
|
|
5
|
-
* https://developers.thoughtspot.com/docs
|
|
6
|
-
* https://developers.thoughtspot.com/docs
|
|
5
|
+
* https://developers.thoughtspot.com/docs/embed-liveboard
|
|
6
|
+
* https://developers.thoughtspot.com/docs/embed-a-viz
|
|
7
7
|
* @summary Liveboard & visualization embed
|
|
8
8
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
9
9
|
*/
|
package/src/embed/search.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2022
|
|
3
3
|
*
|
|
4
|
-
* Embed ThoughtSpot search or a saved answer
|
|
4
|
+
* Embed ThoughtSpot search or a saved answer.
|
|
5
|
+
* https://developers.thoughtspot.com/docs/search-embed
|
|
5
6
|
* @summary Search embed
|
|
6
7
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
7
8
|
*/
|
|
@@ -47,7 +48,7 @@ export interface SearchOptions {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
|
-
* Define the initial state
|
|
51
|
+
* Define the initial state of column custom group accordions
|
|
51
52
|
* in data panel v2.
|
|
52
53
|
*/
|
|
53
54
|
export enum DataPanelCustomColumnGroupsAccordionState {
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -83,7 +83,7 @@ import { getHostEventsConfig } from '../utils';
|
|
|
83
83
|
const { version } = pkgInfo;
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* Global prefix for all
|
|
86
|
+
* Global prefix for all ThoughtSpot postHash Params.
|
|
87
87
|
*/
|
|
88
88
|
export const THOUGHTSPOT_PARAM_PREFIX = 'ts-';
|
|
89
89
|
const TS_EMBED_ID = '_thoughtspot-embed';
|
package/src/react/index.tsx
CHANGED
|
@@ -131,7 +131,7 @@ interface PreRenderProps {
|
|
|
131
131
|
* return <LiveboardEmbed preRenderId="someId" liveboardId="libId" />
|
|
132
132
|
* }
|
|
133
133
|
* ```
|
|
134
|
-
* @version SDK: 1.25.0 |
|
|
134
|
+
* @version SDK: 1.25.0 | ThoughtSpot: 9.6.0.cl
|
|
135
135
|
*/
|
|
136
136
|
preRenderId: string;
|
|
137
137
|
}
|