@thoughtspot/visual-embed-sdk 1.35.14 → 1.36.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/cjs/package.json +2 -3
- package/cjs/src/auth.d.ts +5 -0
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +7 -0
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/css-variables.d.ts +8 -0
- package/cjs/src/css-variables.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.js +8 -3
- package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js +54 -0
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +6 -0
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +27 -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 +73 -1
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/react/index.spec.js +2 -2
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +82 -7
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +81 -7
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/authService/authService.d.ts +1 -0
- package/cjs/src/utils/authService/authService.d.ts.map +1 -1
- package/cjs/src/utils/authService/authService.js +1 -0
- package/cjs/src/utils/authService/authService.js.map +1 -1
- package/cjs/src/utils/authService/index.d.ts +1 -1
- package/cjs/src/utils/authService/index.d.ts.map +1 -1
- package/cjs/src/utils/authService/index.js +2 -1
- package/cjs/src/utils/authService/index.js.map +1 -1
- package/cjs/src/utils/authService/tokenizedAuthService.d.ts +10 -0
- package/cjs/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
- package/cjs/src/utils/authService/tokenizedAuthService.js +27 -1
- package/cjs/src/utils/authService/tokenizedAuthService.js.map +1 -1
- package/cjs/src/utils/authService/tokenizedAuthService.spec.js +58 -1
- package/cjs/src/utils/authService/tokenizedAuthService.spec.js.map +1 -1
- package/cjs/src/utils/sessionInfoService.d.ts +30 -0
- package/cjs/src/utils/sessionInfoService.d.ts.map +1 -1
- package/cjs/src/utils/sessionInfoService.js +59 -1
- package/cjs/src/utils/sessionInfoService.js.map +1 -1
- package/dist/index-CR5u7BMC.js +7370 -0
- package/dist/src/auth.d.ts +5 -0
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/css-variables.d.ts +8 -0
- package/dist/src/css-variables.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +6 -0
- 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/types.d.ts +82 -7
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/authService/authService.d.ts +1 -0
- package/dist/src/utils/authService/authService.d.ts.map +1 -1
- package/dist/src/utils/authService/index.d.ts +1 -1
- package/dist/src/utils/authService/index.d.ts.map +1 -1
- package/dist/src/utils/authService/tokenizedAuthService.d.ts +10 -0
- package/dist/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
- package/dist/src/utils/sessionInfoService.d.ts +30 -0
- package/dist/src/utils/sessionInfoService.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +206 -13
- package/dist/tsembed-react.js +205 -12
- package/dist/tsembed.es.js +207 -13
- package/dist/tsembed.js +206 -12
- package/dist/visual-embed-sdk-react-full.d.ts +125 -7
- package/dist/visual-embed-sdk-react.d.ts +125 -7
- package/dist/visual-embed-sdk.d.ts +125 -7
- package/lib/package.json +2 -3
- package/lib/src/auth.d.ts +5 -0
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +8 -1
- package/lib/src/auth.js.map +1 -1
- package/lib/src/css-variables.d.ts +8 -0
- package/lib/src/css-variables.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.js +8 -3
- package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.spec.js +54 -0
- package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +6 -0
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +27 -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 +73 -1
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/react/index.spec.js +2 -2
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +82 -7
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +81 -7
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/authService/authService.d.ts +1 -0
- package/lib/src/utils/authService/authService.d.ts.map +1 -1
- package/lib/src/utils/authService/authService.js +1 -0
- package/lib/src/utils/authService/authService.js.map +1 -1
- package/lib/src/utils/authService/index.d.ts +1 -1
- package/lib/src/utils/authService/index.d.ts.map +1 -1
- package/lib/src/utils/authService/index.js +1 -1
- package/lib/src/utils/authService/index.js.map +1 -1
- package/lib/src/utils/authService/tokenizedAuthService.d.ts +10 -0
- package/lib/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
- package/lib/src/utils/authService/tokenizedAuthService.js +25 -0
- package/lib/src/utils/authService/tokenizedAuthService.js.map +1 -1
- package/lib/src/utils/authService/tokenizedAuthService.spec.js +59 -2
- package/lib/src/utils/authService/tokenizedAuthService.spec.js.map +1 -1
- package/lib/src/utils/sessionInfoService.d.ts +30 -0
- package/lib/src/utils/sessionInfoService.d.ts.map +1 -1
- package/lib/src/utils/sessionInfoService.js +57 -1
- package/lib/src/utils/sessionInfoService.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +125 -7
- package/package.json +2 -3
- package/src/auth.ts +8 -1
- package/src/css-variables.ts +10 -0
- package/src/embed/hostEventClient/host-event-client.spec.ts +61 -0
- package/src/embed/hostEventClient/host-event-client.ts +8 -3
- package/src/embed/ts-embed.spec.ts +95 -1
- package/src/embed/ts-embed.ts +31 -0
- package/src/react/index.spec.tsx +2 -2
- package/src/types.ts +83 -7
- package/src/utils/authService/authService.ts +1 -0
- package/src/utils/authService/index.ts +5 -1
- package/src/utils/authService/tokenizedAuthService.spec.ts +66 -2
- package/src/utils/authService/tokenizedAuthService.ts +26 -0
- package/src/utils/sessionInfoService.ts +64 -1
package/dist/tsembed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.36.1 */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -1948,16 +1948,63 @@
|
|
|
1948
1948
|
*/
|
|
1949
1949
|
HostEvent["getExportRequestForCurrentPinboard"] = "getExportRequestForCurrentPinboard";
|
|
1950
1950
|
/**
|
|
1951
|
-
* Trigger
|
|
1952
|
-
*
|
|
1953
|
-
*
|
|
1954
|
-
* a
|
|
1951
|
+
* Trigger **Pin** action on an embedded object.
|
|
1952
|
+
* If no parameters are defined, the pin action is triggered
|
|
1953
|
+
* for the Answer that the user is currently on
|
|
1954
|
+
* and a modal opens for Liveboard selection.
|
|
1955
|
+
* To add an Answer or visualization to a Liveboard programmatically without
|
|
1956
|
+
* showing requiring additional user input via *Pin to Liveboard* modal, define
|
|
1957
|
+
* the following parameters:
|
|
1958
|
+
*
|
|
1959
|
+
* @param
|
|
1960
|
+
* `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
|
|
1961
|
+
* Optional when pinning a new chart or table generated from a Search query.
|
|
1962
|
+
* @param
|
|
1963
|
+
* `liveboardID` - GUID of the Liveboard to pin an Answer. If there is no Liveboard,
|
|
1964
|
+
* specify the `newLiveboardName` parameter to create a new Liveboard.
|
|
1965
|
+
* @param
|
|
1966
|
+
* `tabId` - GUID of the Liveboard tab. Adds the Answer to the Liveboard tab
|
|
1967
|
+
* specified in the code.
|
|
1968
|
+
* @param
|
|
1969
|
+
* `newVizName` - Name string for the Answer or visualization. If defined,
|
|
1970
|
+
* this parameter adds a new visualization object or creates a copy of the
|
|
1971
|
+
* Answer or visualization specified in `vizId`.
|
|
1972
|
+
* Required attribute.
|
|
1973
|
+
* @param
|
|
1974
|
+
* `newLiveboardName` - Name string for the Liveboard.
|
|
1975
|
+
* Creates a new Liveboard object with the specified name.
|
|
1976
|
+
* @param
|
|
1977
|
+
* `newTabName` - Name of the tab. Adds a new tab Liveboard specified
|
|
1978
|
+
* in the code.
|
|
1979
|
+
*
|
|
1955
1980
|
* @example
|
|
1956
1981
|
* ```js
|
|
1957
|
-
* appEmbed.trigger(HostEvent.Pin
|
|
1982
|
+
* const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
|
|
1983
|
+
* vizId: "123",
|
|
1984
|
+
* newVizName: "Sales by region",
|
|
1985
|
+
* liveboardId: "123",
|
|
1986
|
+
* tabId: "123"
|
|
1987
|
+
* });
|
|
1988
|
+
* ```
|
|
1989
|
+
* @example
|
|
1990
|
+
* ```js
|
|
1991
|
+
* const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
|
|
1992
|
+
* newVizName: "Total sales of Jackets",
|
|
1993
|
+
* liveboardId: "123"
|
|
1994
|
+
* });
|
|
1995
|
+
* ```
|
|
1996
|
+
*
|
|
1997
|
+
* @example
|
|
1998
|
+
* ```js
|
|
1999
|
+
* const pinResponse = await searchEmbed.trigger(HostEvent.Pin, {
|
|
2000
|
+
* newVizName: "Sales by state",
|
|
2001
|
+
* newLiveboardName: "Sales",
|
|
2002
|
+
* newTabName: "Products"
|
|
2003
|
+
* });
|
|
1958
2004
|
* ```
|
|
2005
|
+
* @example
|
|
1959
2006
|
* ```js
|
|
1960
|
-
*
|
|
2007
|
+
* appEmbed.trigger(HostEvent.Pin)
|
|
1961
2008
|
* ```
|
|
1962
2009
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1963
2010
|
*/
|
|
@@ -2604,7 +2651,33 @@
|
|
|
2604
2651
|
*/
|
|
2605
2652
|
HostEvent["UpdatePersonalisedView"] = "UpdatePersonalisedView";
|
|
2606
2653
|
/**
|
|
2607
|
-
*
|
|
2654
|
+
* @hidden
|
|
2655
|
+
* Notify when info call is completed successfully
|
|
2656
|
+
* ```js
|
|
2657
|
+
* liveboardEmbed.trigger(HostEvent.InfoSuccess, data);
|
|
2658
|
+
*```
|
|
2659
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
2660
|
+
*/
|
|
2661
|
+
HostEvent["InfoSuccess"] = "InfoSuccess";
|
|
2662
|
+
/**
|
|
2663
|
+
* Trigger the save action for an Answer.
|
|
2664
|
+
* To programmatically save an answer without opening the
|
|
2665
|
+
* *Describe your Answer* modal, define the `name` and `description`
|
|
2666
|
+
* properties.
|
|
2667
|
+
* If no parameters are specified, the save action is
|
|
2668
|
+
* triggered with a modal to prompt users to
|
|
2669
|
+
* add a name and description for the Answer.
|
|
2670
|
+
* @param - optional attributes to set Answer properties.
|
|
2671
|
+
* `name` - Name string for the Answer.
|
|
2672
|
+
* `description` - Description text for the Answer.
|
|
2673
|
+
*
|
|
2674
|
+
* @example
|
|
2675
|
+
* ```js
|
|
2676
|
+
* const saveAnswerResponse = await searchEmbed.trigger(HostEvent.SaveAnswer, {
|
|
2677
|
+
* name: "Sales by states",
|
|
2678
|
+
* description: "Total sales by states in MidWest"
|
|
2679
|
+
* });
|
|
2680
|
+
* ```
|
|
2608
2681
|
* @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
|
|
2609
2682
|
*/
|
|
2610
2683
|
HostEvent["SaveAnswer"] = "saveAnswer";
|
|
@@ -2762,6 +2835,7 @@
|
|
|
2762
2835
|
Param["OauthPollingInterval"] = "oAuthPollingInterval";
|
|
2763
2836
|
Param["IsForceRedirect"] = "isForceRedirect";
|
|
2764
2837
|
Param["DataSourceId"] = "dataSourceId";
|
|
2838
|
+
Param["preAuthCache"] = "preAuthCache";
|
|
2765
2839
|
Param["ShowSpotterLimitations"] = "showSpotterLimitations";
|
|
2766
2840
|
})(Param || (Param = {}));
|
|
2767
2841
|
/**
|
|
@@ -6421,6 +6495,7 @@
|
|
|
6421
6495
|
const EndPoints = {
|
|
6422
6496
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
6423
6497
|
SESSION_INFO: '/callosum/v1/session/info',
|
|
6498
|
+
PREAUTH_INFO: '/prism/preauth/info',
|
|
6424
6499
|
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
6425
6500
|
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
6426
6501
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
@@ -14018,6 +14093,31 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14018
14093
|
return r;
|
|
14019
14094
|
});
|
|
14020
14095
|
}
|
|
14096
|
+
/**
|
|
14097
|
+
* Fetches the session info from the ThoughtSpot server.
|
|
14098
|
+
* @param thoughtspotHost
|
|
14099
|
+
* @returns {Promise<any>}
|
|
14100
|
+
* @example
|
|
14101
|
+
* ```js
|
|
14102
|
+
* const response = await sessionInfoService();
|
|
14103
|
+
* ```
|
|
14104
|
+
*/
|
|
14105
|
+
async function fetchPreauthInfoService(thoughtspotHost) {
|
|
14106
|
+
const sessionInfoPath = `${thoughtspotHost}${EndPoints.PREAUTH_INFO}`;
|
|
14107
|
+
const handleError = (e) => {
|
|
14108
|
+
const error = new Error(`Failed to fetch auth info: ${e.message || e.statusText}`);
|
|
14109
|
+
error.status = e.status; // Attach the status code to the error object
|
|
14110
|
+
throw error;
|
|
14111
|
+
};
|
|
14112
|
+
try {
|
|
14113
|
+
const response = await tokenizedFailureLoggedFetch(sessionInfoPath);
|
|
14114
|
+
return response;
|
|
14115
|
+
}
|
|
14116
|
+
catch (e) {
|
|
14117
|
+
handleError(e);
|
|
14118
|
+
return null;
|
|
14119
|
+
}
|
|
14120
|
+
}
|
|
14021
14121
|
/**
|
|
14022
14122
|
* Fetches the session info from the ThoughtSpot server.
|
|
14023
14123
|
* @param thoughtspotHost
|
|
@@ -14069,6 +14169,62 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14069
14169
|
}
|
|
14070
14170
|
|
|
14071
14171
|
let sessionInfo = null;
|
|
14172
|
+
let preauthInfo = null;
|
|
14173
|
+
/**
|
|
14174
|
+
* Processes the session info response and returns the session info object.
|
|
14175
|
+
* @param preauthInfoResp {any} Response from the session info API.
|
|
14176
|
+
* @returns {PreauthInfo} The session info object.
|
|
14177
|
+
* @example ```js
|
|
14178
|
+
* const preauthInfoResp = await fetch(sessionInfoPath);
|
|
14179
|
+
* const sessionInfo = await formatPreauthInfo(preauthInfoResp);
|
|
14180
|
+
* console.log(sessionInfo);
|
|
14181
|
+
* ```
|
|
14182
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
14183
|
+
*/
|
|
14184
|
+
const formatPreauthInfo = async (preauthInfoResp) => {
|
|
14185
|
+
var _a;
|
|
14186
|
+
try {
|
|
14187
|
+
// Convert Headers to a plain object
|
|
14188
|
+
const headers = {};
|
|
14189
|
+
(_a = preauthInfoResp === null || preauthInfoResp === void 0 ? void 0 : preauthInfoResp.headers) === null || _a === void 0 ? void 0 : _a.forEach((value, key) => {
|
|
14190
|
+
headers[key] = value;
|
|
14191
|
+
});
|
|
14192
|
+
const data = await preauthInfoResp.json();
|
|
14193
|
+
return {
|
|
14194
|
+
...data,
|
|
14195
|
+
status: 200,
|
|
14196
|
+
headers,
|
|
14197
|
+
};
|
|
14198
|
+
}
|
|
14199
|
+
catch (error) {
|
|
14200
|
+
return null;
|
|
14201
|
+
}
|
|
14202
|
+
};
|
|
14203
|
+
/**
|
|
14204
|
+
* Returns the session info object and caches it for future use.
|
|
14205
|
+
* Once fetched the session info object is cached and returned from the cache on
|
|
14206
|
+
* subsequent calls.
|
|
14207
|
+
* @example ```js
|
|
14208
|
+
* const preauthInfo = await getPreauthInfo();
|
|
14209
|
+
* console.log(preauthInfo);
|
|
14210
|
+
* ```
|
|
14211
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
14212
|
+
* @returns {Promise<SessionInfo>} The session info object.
|
|
14213
|
+
*/
|
|
14214
|
+
async function getPreauthInfo(allowCache = true) {
|
|
14215
|
+
if (!allowCache || !preauthInfo) {
|
|
14216
|
+
try {
|
|
14217
|
+
const host = getEmbedConfig().thoughtSpotHost;
|
|
14218
|
+
const sessionResponse = await fetchPreauthInfoService(host);
|
|
14219
|
+
const processedPreauthInfo = await formatPreauthInfo(sessionResponse);
|
|
14220
|
+
preauthInfo = processedPreauthInfo;
|
|
14221
|
+
}
|
|
14222
|
+
catch (error) {
|
|
14223
|
+
return null;
|
|
14224
|
+
}
|
|
14225
|
+
}
|
|
14226
|
+
return preauthInfo;
|
|
14227
|
+
}
|
|
14072
14228
|
/**
|
|
14073
14229
|
* Returns the session info object and caches it for future use.
|
|
14074
14230
|
* Once fetched the session info object is cached and returned from the cache on
|
|
@@ -14152,6 +14308,11 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14152
14308
|
* Emits when the SDK authenticates successfully
|
|
14153
14309
|
*/
|
|
14154
14310
|
AuthStatus["SDK_SUCCESS"] = "SDK_SUCCESS";
|
|
14311
|
+
/**
|
|
14312
|
+
* @hidden
|
|
14313
|
+
* Emits when iframe is loaded and session info is available
|
|
14314
|
+
*/
|
|
14315
|
+
AuthStatus["SESSION_INFO_SUCCESS"] = "SESSION_INFO_SUCCESS";
|
|
14155
14316
|
/**
|
|
14156
14317
|
* Emits when the app sends an authentication success message
|
|
14157
14318
|
*/
|
|
@@ -14207,6 +14368,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14207
14368
|
return;
|
|
14208
14369
|
}
|
|
14209
14370
|
try {
|
|
14371
|
+
getPreauthInfo();
|
|
14210
14372
|
const sessionInfo = await getSessionInfo();
|
|
14211
14373
|
authEE.emit(exports.AuthStatus.SUCCESS, sessionInfo);
|
|
14212
14374
|
}
|
|
@@ -14261,6 +14423,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14261
14423
|
*/
|
|
14262
14424
|
async function postLoginService() {
|
|
14263
14425
|
try {
|
|
14426
|
+
getPreauthInfo();
|
|
14264
14427
|
const sessionInfo = await getSessionInfo();
|
|
14265
14428
|
releaseVersion = sessionInfo.releaseVersion;
|
|
14266
14429
|
const embedConfig = getEmbedConfig();
|
|
@@ -14928,7 +15091,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14928
15091
|
return e;
|
|
14929
15092
|
}
|
|
14930
15093
|
|
|
14931
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.
|
|
15094
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.36.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-comment-length":"1.7.3","eslint-plugin-jsdoc":"^46.9.0","fs-extra":"^10.0.0","gh-pages":"6.3.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^5.3.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
14932
15095
|
|
|
14933
15096
|
/**
|
|
14934
15097
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -15050,15 +15213,20 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15050
15213
|
return res;
|
|
15051
15214
|
}
|
|
15052
15215
|
async handlePinEvent(payload) {
|
|
15216
|
+
var _a, _b;
|
|
15053
15217
|
if (!payload || !('newVizName' in payload)) {
|
|
15054
15218
|
return this.hostEventFallback(exports.HostEvent.Pin, payload);
|
|
15055
15219
|
}
|
|
15056
15220
|
const formattedPayload = {
|
|
15057
15221
|
...payload,
|
|
15058
|
-
pinboardId: payload.liveboardId,
|
|
15059
|
-
newPinboardName: payload.newLiveboardName,
|
|
15222
|
+
pinboardId: (_a = payload.liveboardId) !== null && _a !== void 0 ? _a : payload.pinboardId,
|
|
15223
|
+
newPinboardName: (_b = payload.newLiveboardName) !== null && _b !== void 0 ? _b : payload.newPinboardName,
|
|
15224
|
+
};
|
|
15225
|
+
const data = await this.handleHostEventWithParam(exports.UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload);
|
|
15226
|
+
return {
|
|
15227
|
+
...data,
|
|
15228
|
+
liveboardId: data.pinboardId,
|
|
15060
15229
|
};
|
|
15061
|
-
return this.handleHostEventWithParam(exports.UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload);
|
|
15062
15230
|
}
|
|
15063
15231
|
async handleSaveAnswerEvent(payload) {
|
|
15064
15232
|
var _a, _b, _c, _d;
|
|
@@ -15291,6 +15459,21 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15291
15459
|
}
|
|
15292
15460
|
return null;
|
|
15293
15461
|
}
|
|
15462
|
+
/**
|
|
15463
|
+
* Checks if preauth cache is enabled
|
|
15464
|
+
* from the view config and embed config
|
|
15465
|
+
* @returns boolean
|
|
15466
|
+
*/
|
|
15467
|
+
isPreAuthCacheEnabled() {
|
|
15468
|
+
// Disable preauth cache when:
|
|
15469
|
+
// 1. overrideOrgId is present since:
|
|
15470
|
+
// - cached auth info would be for wrong org
|
|
15471
|
+
// - info call response changes for each different overrideOrgId
|
|
15472
|
+
// 2. disablePreauthCache is explicitly set to true
|
|
15473
|
+
const isDisabled = (this.viewConfig.overrideOrgId !== undefined
|
|
15474
|
+
|| this.embedConfig.disablePreauthCache === true);
|
|
15475
|
+
return !isDisabled;
|
|
15476
|
+
}
|
|
15294
15477
|
/**
|
|
15295
15478
|
* fix for ts7.sep.cl
|
|
15296
15479
|
* will be removed for ts7.oct.cl
|
|
@@ -15509,6 +15692,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15509
15692
|
if (overrideOrgId !== undefined) {
|
|
15510
15693
|
queryParams[Param.OverrideOrgId] = overrideOrgId;
|
|
15511
15694
|
}
|
|
15695
|
+
if (this.isPreAuthCacheEnabled()) {
|
|
15696
|
+
queryParams[Param.preAuthCache] = true;
|
|
15697
|
+
}
|
|
15512
15698
|
queryParams[Param.OverrideNativeConsole] = true;
|
|
15513
15699
|
queryParams[Param.ClientLogLevel] = this.embedConfig.logLevel;
|
|
15514
15700
|
if (isObject_1(additionalFlags) && !isEmpty_1(additionalFlags)) {
|
|
@@ -15627,6 +15813,14 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15627
15813
|
elHeight: this.iFrame.clientHeight,
|
|
15628
15814
|
timeTookToLoad: loadTimestamp - initTimestamp,
|
|
15629
15815
|
});
|
|
15816
|
+
// Send info event if preauth cache is enabled
|
|
15817
|
+
if (this.isPreAuthCacheEnabled()) {
|
|
15818
|
+
getPreauthInfo().then((data) => {
|
|
15819
|
+
if (data === null || data === void 0 ? void 0 : data.info) {
|
|
15820
|
+
this.trigger(exports.HostEvent.InfoSuccess, data);
|
|
15821
|
+
}
|
|
15822
|
+
});
|
|
15823
|
+
}
|
|
15630
15824
|
});
|
|
15631
15825
|
this.iFrame.addEventListener('error', () => {
|
|
15632
15826
|
nextInQueue();
|
|
@@ -2057,6 +2057,11 @@ export declare enum AuthStatus {
|
|
|
2057
2057
|
* Emits when the SDK authenticates successfully
|
|
2058
2058
|
*/
|
|
2059
2059
|
SDK_SUCCESS = "SDK_SUCCESS",
|
|
2060
|
+
/**
|
|
2061
|
+
* @hidden
|
|
2062
|
+
* Emits when iframe is loaded and session info is available
|
|
2063
|
+
*/
|
|
2064
|
+
SESSION_INFO_SUCCESS = "SESSION_INFO_SUCCESS",
|
|
2060
2065
|
/**
|
|
2061
2066
|
* Emits when the app sends an authentication success message
|
|
2062
2067
|
*/
|
|
@@ -2209,6 +2214,36 @@ export type SessionInfo = {
|
|
|
2209
2214
|
clusterName: string;
|
|
2210
2215
|
[key: string]: any;
|
|
2211
2216
|
};
|
|
2217
|
+
export type PreauthInfo = {
|
|
2218
|
+
info?: SessionInfo;
|
|
2219
|
+
headers: Record<string, string>;
|
|
2220
|
+
status: number;
|
|
2221
|
+
[key: string]: any;
|
|
2222
|
+
};
|
|
2223
|
+
/**
|
|
2224
|
+
* Processes the session info response and returns the session info object.
|
|
2225
|
+
* @param preauthInfoResp {any} Response from the session info API.
|
|
2226
|
+
* @returns {PreauthInfo} The session info object.
|
|
2227
|
+
* @example ```js
|
|
2228
|
+
* const preauthInfoResp = await fetch(sessionInfoPath);
|
|
2229
|
+
* const sessionInfo = await formatPreauthInfo(preauthInfoResp);
|
|
2230
|
+
* console.log(sessionInfo);
|
|
2231
|
+
* ```
|
|
2232
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
2233
|
+
*/
|
|
2234
|
+
export declare const formatPreauthInfo: (preauthInfoResp: any) => Promise<PreauthInfo>;
|
|
2235
|
+
/**
|
|
2236
|
+
* Returns the session info object and caches it for future use.
|
|
2237
|
+
* Once fetched the session info object is cached and returned from the cache on
|
|
2238
|
+
* subsequent calls.
|
|
2239
|
+
* @example ```js
|
|
2240
|
+
* const preauthInfo = await getPreauthInfo();
|
|
2241
|
+
* console.log(preauthInfo);
|
|
2242
|
+
* ```
|
|
2243
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
2244
|
+
* @returns {Promise<SessionInfo>} The session info object.
|
|
2245
|
+
*/
|
|
2246
|
+
export declare function getPreauthInfo(allowCache?: boolean): Promise<PreauthInfo>;
|
|
2212
2247
|
/**
|
|
2213
2248
|
* Returns the session info object and caches it for future use.
|
|
2214
2249
|
* Once fetched the session info object is cached and returned from the cache on
|
|
@@ -2863,6 +2898,7 @@ export interface EmbedConfig {
|
|
|
2863
2898
|
* @version SDK 1.37.0 | ThoughtSpot: 10.7.0.cl
|
|
2864
2899
|
*/
|
|
2865
2900
|
customVariablesForThirdPartyTools?: Record<string, any>;
|
|
2901
|
+
disablePreauthCache?: boolean;
|
|
2866
2902
|
}
|
|
2867
2903
|
export interface LayoutConfig {
|
|
2868
2904
|
}
|
|
@@ -4822,16 +4858,63 @@ export declare enum HostEvent {
|
|
|
4822
4858
|
*/
|
|
4823
4859
|
getExportRequestForCurrentPinboard = "getExportRequestForCurrentPinboard",
|
|
4824
4860
|
/**
|
|
4825
|
-
* Trigger
|
|
4826
|
-
*
|
|
4827
|
-
*
|
|
4828
|
-
* a
|
|
4861
|
+
* Trigger **Pin** action on an embedded object.
|
|
4862
|
+
* If no parameters are defined, the pin action is triggered
|
|
4863
|
+
* for the Answer that the user is currently on
|
|
4864
|
+
* and a modal opens for Liveboard selection.
|
|
4865
|
+
* To add an Answer or visualization to a Liveboard programmatically without
|
|
4866
|
+
* showing requiring additional user input via *Pin to Liveboard* modal, define
|
|
4867
|
+
* the following parameters:
|
|
4868
|
+
*
|
|
4869
|
+
* @param
|
|
4870
|
+
* `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
|
|
4871
|
+
* Optional when pinning a new chart or table generated from a Search query.
|
|
4872
|
+
* @param
|
|
4873
|
+
* `liveboardID` - GUID of the Liveboard to pin an Answer. If there is no Liveboard,
|
|
4874
|
+
* specify the `newLiveboardName` parameter to create a new Liveboard.
|
|
4875
|
+
* @param
|
|
4876
|
+
* `tabId` - GUID of the Liveboard tab. Adds the Answer to the Liveboard tab
|
|
4877
|
+
* specified in the code.
|
|
4878
|
+
* @param
|
|
4879
|
+
* `newVizName` - Name string for the Answer or visualization. If defined,
|
|
4880
|
+
* this parameter adds a new visualization object or creates a copy of the
|
|
4881
|
+
* Answer or visualization specified in `vizId`.
|
|
4882
|
+
* Required attribute.
|
|
4883
|
+
* @param
|
|
4884
|
+
* `newLiveboardName` - Name string for the Liveboard.
|
|
4885
|
+
* Creates a new Liveboard object with the specified name.
|
|
4886
|
+
* @param
|
|
4887
|
+
* `newTabName` - Name of the tab. Adds a new tab Liveboard specified
|
|
4888
|
+
* in the code.
|
|
4889
|
+
*
|
|
4829
4890
|
* @example
|
|
4830
4891
|
* ```js
|
|
4831
|
-
* appEmbed.trigger(HostEvent.Pin
|
|
4892
|
+
* const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
|
|
4893
|
+
* vizId: "123",
|
|
4894
|
+
* newVizName: "Sales by region",
|
|
4895
|
+
* liveboardId: "123",
|
|
4896
|
+
* tabId: "123"
|
|
4897
|
+
* });
|
|
4832
4898
|
* ```
|
|
4899
|
+
* @example
|
|
4900
|
+
* ```js
|
|
4901
|
+
* const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
|
|
4902
|
+
* newVizName: "Total sales of Jackets",
|
|
4903
|
+
* liveboardId: "123"
|
|
4904
|
+
* });
|
|
4905
|
+
* ```
|
|
4906
|
+
*
|
|
4907
|
+
* @example
|
|
4833
4908
|
* ```js
|
|
4834
|
-
* searchEmbed.trigger(HostEvent.Pin
|
|
4909
|
+
* const pinResponse = await searchEmbed.trigger(HostEvent.Pin, {
|
|
4910
|
+
* newVizName: "Sales by state",
|
|
4911
|
+
* newLiveboardName: "Sales",
|
|
4912
|
+
* newTabName: "Products"
|
|
4913
|
+
* });
|
|
4914
|
+
* ```
|
|
4915
|
+
* @example
|
|
4916
|
+
* ```js
|
|
4917
|
+
* appEmbed.trigger(HostEvent.Pin)
|
|
4835
4918
|
* ```
|
|
4836
4919
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
4837
4920
|
*/
|
|
@@ -5478,7 +5561,33 @@ export declare enum HostEvent {
|
|
|
5478
5561
|
*/
|
|
5479
5562
|
UpdatePersonalisedView = "UpdatePersonalisedView",
|
|
5480
5563
|
/**
|
|
5481
|
-
*
|
|
5564
|
+
* @hidden
|
|
5565
|
+
* Notify when info call is completed successfully
|
|
5566
|
+
* ```js
|
|
5567
|
+
* liveboardEmbed.trigger(HostEvent.InfoSuccess, data);
|
|
5568
|
+
*```
|
|
5569
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
5570
|
+
*/
|
|
5571
|
+
InfoSuccess = "InfoSuccess",
|
|
5572
|
+
/**
|
|
5573
|
+
* Trigger the save action for an Answer.
|
|
5574
|
+
* To programmatically save an answer without opening the
|
|
5575
|
+
* *Describe your Answer* modal, define the `name` and `description`
|
|
5576
|
+
* properties.
|
|
5577
|
+
* If no parameters are specified, the save action is
|
|
5578
|
+
* triggered with a modal to prompt users to
|
|
5579
|
+
* add a name and description for the Answer.
|
|
5580
|
+
* @param - optional attributes to set Answer properties.
|
|
5581
|
+
* `name` - Name string for the Answer.
|
|
5582
|
+
* `description` - Description text for the Answer.
|
|
5583
|
+
*
|
|
5584
|
+
* @example
|
|
5585
|
+
* ```js
|
|
5586
|
+
* const saveAnswerResponse = await searchEmbed.trigger(HostEvent.SaveAnswer, {
|
|
5587
|
+
* name: "Sales by states",
|
|
5588
|
+
* description: "Total sales by states in MidWest"
|
|
5589
|
+
* });
|
|
5590
|
+
* ```
|
|
5482
5591
|
* @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
|
|
5483
5592
|
*/
|
|
5484
5593
|
SaveAnswer = "saveAnswer",
|
|
@@ -5626,6 +5735,7 @@ export declare enum Param {
|
|
|
5626
5735
|
OauthPollingInterval = "oAuthPollingInterval",
|
|
5627
5736
|
IsForceRedirect = "isForceRedirect",
|
|
5628
5737
|
DataSourceId = "dataSourceId",
|
|
5738
|
+
preAuthCache = "preAuthCache",
|
|
5629
5739
|
ShowSpotterLimitations = "showSpotterLimitations"
|
|
5630
5740
|
}
|
|
5631
5741
|
/**
|
|
@@ -7061,6 +7171,14 @@ export interface CustomCssVariables {
|
|
|
7061
7171
|
* panel.
|
|
7062
7172
|
*/
|
|
7063
7173
|
'--ts-var-search-auto-complete-subtext-font-color'?: string;
|
|
7174
|
+
/**
|
|
7175
|
+
* Background color of the input box in the Spotter page.
|
|
7176
|
+
*/
|
|
7177
|
+
'--ts-var-spotter-input-background'?: string;
|
|
7178
|
+
/**
|
|
7179
|
+
* Background color of the previously asked prompt message in the Spotter page.
|
|
7180
|
+
*/
|
|
7181
|
+
'--ts-var-spotter-prompt-background': string;
|
|
7064
7182
|
/**
|
|
7065
7183
|
* Background color of the data panel.
|
|
7066
7184
|
*/
|