@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.
Files changed (127) hide show
  1. package/cjs/package.json +2 -3
  2. package/cjs/src/auth.d.ts +5 -0
  3. package/cjs/src/auth.d.ts.map +1 -1
  4. package/cjs/src/auth.js +7 -0
  5. package/cjs/src/auth.js.map +1 -1
  6. package/cjs/src/css-variables.d.ts +8 -0
  7. package/cjs/src/css-variables.d.ts.map +1 -1
  8. package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  9. package/cjs/src/embed/hostEventClient/host-event-client.js +8 -3
  10. package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
  11. package/cjs/src/embed/hostEventClient/host-event-client.spec.js +54 -0
  12. package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
  13. package/cjs/src/embed/ts-embed.d.ts +6 -0
  14. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  15. package/cjs/src/embed/ts-embed.js +27 -0
  16. package/cjs/src/embed/ts-embed.js.map +1 -1
  17. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  18. package/cjs/src/embed/ts-embed.spec.js +73 -1
  19. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  20. package/cjs/src/react/index.spec.js +2 -2
  21. package/cjs/src/react/index.spec.js.map +1 -1
  22. package/cjs/src/types.d.ts +82 -7
  23. package/cjs/src/types.d.ts.map +1 -1
  24. package/cjs/src/types.js +81 -7
  25. package/cjs/src/types.js.map +1 -1
  26. package/cjs/src/utils/authService/authService.d.ts +1 -0
  27. package/cjs/src/utils/authService/authService.d.ts.map +1 -1
  28. package/cjs/src/utils/authService/authService.js +1 -0
  29. package/cjs/src/utils/authService/authService.js.map +1 -1
  30. package/cjs/src/utils/authService/index.d.ts +1 -1
  31. package/cjs/src/utils/authService/index.d.ts.map +1 -1
  32. package/cjs/src/utils/authService/index.js +2 -1
  33. package/cjs/src/utils/authService/index.js.map +1 -1
  34. package/cjs/src/utils/authService/tokenizedAuthService.d.ts +10 -0
  35. package/cjs/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
  36. package/cjs/src/utils/authService/tokenizedAuthService.js +27 -1
  37. package/cjs/src/utils/authService/tokenizedAuthService.js.map +1 -1
  38. package/cjs/src/utils/authService/tokenizedAuthService.spec.js +58 -1
  39. package/cjs/src/utils/authService/tokenizedAuthService.spec.js.map +1 -1
  40. package/cjs/src/utils/sessionInfoService.d.ts +30 -0
  41. package/cjs/src/utils/sessionInfoService.d.ts.map +1 -1
  42. package/cjs/src/utils/sessionInfoService.js +59 -1
  43. package/cjs/src/utils/sessionInfoService.js.map +1 -1
  44. package/dist/index-CR5u7BMC.js +7370 -0
  45. package/dist/src/auth.d.ts +5 -0
  46. package/dist/src/auth.d.ts.map +1 -1
  47. package/dist/src/css-variables.d.ts +8 -0
  48. package/dist/src/css-variables.d.ts.map +1 -1
  49. package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  50. package/dist/src/embed/ts-embed.d.ts +6 -0
  51. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  52. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  53. package/dist/src/types.d.ts +82 -7
  54. package/dist/src/types.d.ts.map +1 -1
  55. package/dist/src/utils/authService/authService.d.ts +1 -0
  56. package/dist/src/utils/authService/authService.d.ts.map +1 -1
  57. package/dist/src/utils/authService/index.d.ts +1 -1
  58. package/dist/src/utils/authService/index.d.ts.map +1 -1
  59. package/dist/src/utils/authService/tokenizedAuthService.d.ts +10 -0
  60. package/dist/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
  61. package/dist/src/utils/sessionInfoService.d.ts +30 -0
  62. package/dist/src/utils/sessionInfoService.d.ts.map +1 -1
  63. package/dist/tsembed-react.es.js +206 -13
  64. package/dist/tsembed-react.js +205 -12
  65. package/dist/tsembed.es.js +207 -13
  66. package/dist/tsembed.js +206 -12
  67. package/dist/visual-embed-sdk-react-full.d.ts +125 -7
  68. package/dist/visual-embed-sdk-react.d.ts +125 -7
  69. package/dist/visual-embed-sdk.d.ts +125 -7
  70. package/lib/package.json +2 -3
  71. package/lib/src/auth.d.ts +5 -0
  72. package/lib/src/auth.d.ts.map +1 -1
  73. package/lib/src/auth.js +8 -1
  74. package/lib/src/auth.js.map +1 -1
  75. package/lib/src/css-variables.d.ts +8 -0
  76. package/lib/src/css-variables.d.ts.map +1 -1
  77. package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  78. package/lib/src/embed/hostEventClient/host-event-client.js +8 -3
  79. package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
  80. package/lib/src/embed/hostEventClient/host-event-client.spec.js +54 -0
  81. package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
  82. package/lib/src/embed/ts-embed.d.ts +6 -0
  83. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  84. package/lib/src/embed/ts-embed.js +27 -0
  85. package/lib/src/embed/ts-embed.js.map +1 -1
  86. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  87. package/lib/src/embed/ts-embed.spec.js +73 -1
  88. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  89. package/lib/src/react/index.spec.js +2 -2
  90. package/lib/src/react/index.spec.js.map +1 -1
  91. package/lib/src/types.d.ts +82 -7
  92. package/lib/src/types.d.ts.map +1 -1
  93. package/lib/src/types.js +81 -7
  94. package/lib/src/types.js.map +1 -1
  95. package/lib/src/utils/authService/authService.d.ts +1 -0
  96. package/lib/src/utils/authService/authService.d.ts.map +1 -1
  97. package/lib/src/utils/authService/authService.js +1 -0
  98. package/lib/src/utils/authService/authService.js.map +1 -1
  99. package/lib/src/utils/authService/index.d.ts +1 -1
  100. package/lib/src/utils/authService/index.d.ts.map +1 -1
  101. package/lib/src/utils/authService/index.js +1 -1
  102. package/lib/src/utils/authService/index.js.map +1 -1
  103. package/lib/src/utils/authService/tokenizedAuthService.d.ts +10 -0
  104. package/lib/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
  105. package/lib/src/utils/authService/tokenizedAuthService.js +25 -0
  106. package/lib/src/utils/authService/tokenizedAuthService.js.map +1 -1
  107. package/lib/src/utils/authService/tokenizedAuthService.spec.js +59 -2
  108. package/lib/src/utils/authService/tokenizedAuthService.spec.js.map +1 -1
  109. package/lib/src/utils/sessionInfoService.d.ts +30 -0
  110. package/lib/src/utils/sessionInfoService.d.ts.map +1 -1
  111. package/lib/src/utils/sessionInfoService.js +57 -1
  112. package/lib/src/utils/sessionInfoService.js.map +1 -1
  113. package/lib/src/visual-embed-sdk.d.ts +125 -7
  114. package/package.json +2 -3
  115. package/src/auth.ts +8 -1
  116. package/src/css-variables.ts +10 -0
  117. package/src/embed/hostEventClient/host-event-client.spec.ts +61 -0
  118. package/src/embed/hostEventClient/host-event-client.ts +8 -3
  119. package/src/embed/ts-embed.spec.ts +95 -1
  120. package/src/embed/ts-embed.ts +31 -0
  121. package/src/react/index.spec.tsx +2 -2
  122. package/src/types.ts +83 -7
  123. package/src/utils/authService/authService.ts +1 -0
  124. package/src/utils/authService/index.ts +5 -1
  125. package/src/utils/authService/tokenizedAuthService.spec.ts +66 -2
  126. package/src/utils/authService/tokenizedAuthService.ts +26 -0
  127. package/src/utils/sessionInfoService.ts +64 -1
@@ -1,4 +1,4 @@
1
- /* @thoughtspot/visual-embed-sdk version 1.35.14 */
1
+ /* @thoughtspot/visual-embed-sdk version 1.36.1 */
2
2
  function _mergeNamespaces(n, m) {
3
3
  m.forEach(function (e) {
4
4
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -1942,16 +1942,63 @@ var HostEvent;
1942
1942
  */
1943
1943
  HostEvent["getExportRequestForCurrentPinboard"] = "getExportRequestForCurrentPinboard";
1944
1944
  /**
1945
- * Trigger the **Pin** action on an embedded object
1946
- * @param - Liveboard embed takes the `vizId` as a
1947
- * key. Can be left undefined when embedding Search, full app, or
1948
- * a visualization.
1945
+ * Trigger **Pin** action on an embedded object.
1946
+ * If no parameters are defined, the pin action is triggered
1947
+ * for the Answer that the user is currently on
1948
+ * and a modal opens for Liveboard selection.
1949
+ * To add an Answer or visualization to a Liveboard programmatically without
1950
+ * showing requiring additional user input via *Pin to Liveboard* modal, define
1951
+ * the following parameters:
1952
+ *
1953
+ * @param
1954
+ * `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
1955
+ * Optional when pinning a new chart or table generated from a Search query.
1956
+ * @param
1957
+ * `liveboardID` - GUID of the Liveboard to pin an Answer. If there is no Liveboard,
1958
+ * specify the `newLiveboardName` parameter to create a new Liveboard.
1959
+ * @param
1960
+ * `tabId` - GUID of the Liveboard tab. Adds the Answer to the Liveboard tab
1961
+ * specified in the code.
1962
+ * @param
1963
+ * `newVizName` - Name string for the Answer or visualization. If defined,
1964
+ * this parameter adds a new visualization object or creates a copy of the
1965
+ * Answer or visualization specified in `vizId`.
1966
+ * Required attribute.
1967
+ * @param
1968
+ * `newLiveboardName` - Name string for the Liveboard.
1969
+ * Creates a new Liveboard object with the specified name.
1970
+ * @param
1971
+ * `newTabName` - Name of the tab. Adds a new tab Liveboard specified
1972
+ * in the code.
1973
+ *
1949
1974
  * @example
1950
1975
  * ```js
1951
- * appEmbed.trigger(HostEvent.Pin)
1976
+ * const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
1977
+ * vizId: "123",
1978
+ * newVizName: "Sales by region",
1979
+ * liveboardId: "123",
1980
+ * tabId: "123"
1981
+ * });
1982
+ * ```
1983
+ * @example
1984
+ * ```js
1985
+ * const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
1986
+ * newVizName: "Total sales of Jackets",
1987
+ * liveboardId: "123"
1988
+ * });
1989
+ * ```
1990
+ *
1991
+ * @example
1992
+ * ```js
1993
+ * const pinResponse = await searchEmbed.trigger(HostEvent.Pin, {
1994
+ * newVizName: "Sales by state",
1995
+ * newLiveboardName: "Sales",
1996
+ * newTabName: "Products"
1997
+ * });
1952
1998
  * ```
1999
+ * @example
1953
2000
  * ```js
1954
- * searchEmbed.trigger(HostEvent.Pin)
2001
+ * appEmbed.trigger(HostEvent.Pin)
1955
2002
  * ```
1956
2003
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
1957
2004
  */
@@ -2598,7 +2645,33 @@ var HostEvent;
2598
2645
  */
2599
2646
  HostEvent["UpdatePersonalisedView"] = "UpdatePersonalisedView";
2600
2647
  /**
2601
- * Triggers the action to get the current view of the Liveboard.
2648
+ * @hidden
2649
+ * Notify when info call is completed successfully
2650
+ * ```js
2651
+ * liveboardEmbed.trigger(HostEvent.InfoSuccess, data);
2652
+ *```
2653
+ * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
2654
+ */
2655
+ HostEvent["InfoSuccess"] = "InfoSuccess";
2656
+ /**
2657
+ * Trigger the save action for an Answer.
2658
+ * To programmatically save an answer without opening the
2659
+ * *Describe your Answer* modal, define the `name` and `description`
2660
+ * properties.
2661
+ * If no parameters are specified, the save action is
2662
+ * triggered with a modal to prompt users to
2663
+ * add a name and description for the Answer.
2664
+ * @param - optional attributes to set Answer properties.
2665
+ * `name` - Name string for the Answer.
2666
+ * `description` - Description text for the Answer.
2667
+ *
2668
+ * @example
2669
+ * ```js
2670
+ * const saveAnswerResponse = await searchEmbed.trigger(HostEvent.SaveAnswer, {
2671
+ * name: "Sales by states",
2672
+ * description: "Total sales by states in MidWest"
2673
+ * });
2674
+ * ```
2602
2675
  * @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
2603
2676
  */
2604
2677
  HostEvent["SaveAnswer"] = "saveAnswer";
@@ -2756,6 +2829,7 @@ var Param;
2756
2829
  Param["OauthPollingInterval"] = "oAuthPollingInterval";
2757
2830
  Param["IsForceRedirect"] = "isForceRedirect";
2758
2831
  Param["DataSourceId"] = "dataSourceId";
2832
+ Param["preAuthCache"] = "preAuthCache";
2759
2833
  Param["ShowSpotterLimitations"] = "showSpotterLimitations";
2760
2834
  })(Param || (Param = {}));
2761
2835
  /**
@@ -6415,6 +6489,7 @@ const ERROR_MESSAGE = {
6415
6489
  const EndPoints = {
6416
6490
  AUTH_VERIFICATION: '/callosum/v1/session/info',
6417
6491
  SESSION_INFO: '/callosum/v1/session/info',
6492
+ PREAUTH_INFO: '/prism/preauth/info',
6418
6493
  SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
6419
6494
  OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
6420
6495
  TOKEN_LOGIN: '/callosum/v1/session/login/token',
@@ -7227,7 +7302,7 @@ class AnswerService {
7227
7302
  async getTML() {
7228
7303
  const { object } = await this.executeQuery(getAnswerTML, {});
7229
7304
  const edoc = object[0].edoc;
7230
- const YAML = await import('./index-vxW97_xb.js');
7305
+ const YAML = await import('./index-CR5u7BMC.js');
7231
7306
  const parsedDoc = YAML.parse(edoc);
7232
7307
  return {
7233
7308
  answer: {
@@ -14012,6 +14087,31 @@ function tokenizedFailureLoggedFetch(url, options = {}) {
14012
14087
  return r;
14013
14088
  });
14014
14089
  }
14090
+ /**
14091
+ * Fetches the session info from the ThoughtSpot server.
14092
+ * @param thoughtspotHost
14093
+ * @returns {Promise<any>}
14094
+ * @example
14095
+ * ```js
14096
+ * const response = await sessionInfoService();
14097
+ * ```
14098
+ */
14099
+ async function fetchPreauthInfoService(thoughtspotHost) {
14100
+ const sessionInfoPath = `${thoughtspotHost}${EndPoints.PREAUTH_INFO}`;
14101
+ const handleError = (e) => {
14102
+ const error = new Error(`Failed to fetch auth info: ${e.message || e.statusText}`);
14103
+ error.status = e.status; // Attach the status code to the error object
14104
+ throw error;
14105
+ };
14106
+ try {
14107
+ const response = await tokenizedFailureLoggedFetch(sessionInfoPath);
14108
+ return response;
14109
+ }
14110
+ catch (e) {
14111
+ handleError(e);
14112
+ return null;
14113
+ }
14114
+ }
14015
14115
  /**
14016
14116
  * Fetches the session info from the ThoughtSpot server.
14017
14117
  * @param thoughtspotHost
@@ -14063,6 +14163,62 @@ async function isActiveService(thoughtSpotHost) {
14063
14163
  }
14064
14164
 
14065
14165
  let sessionInfo = null;
14166
+ let preauthInfo = null;
14167
+ /**
14168
+ * Processes the session info response and returns the session info object.
14169
+ * @param preauthInfoResp {any} Response from the session info API.
14170
+ * @returns {PreauthInfo} The session info object.
14171
+ * @example ```js
14172
+ * const preauthInfoResp = await fetch(sessionInfoPath);
14173
+ * const sessionInfo = await formatPreauthInfo(preauthInfoResp);
14174
+ * console.log(sessionInfo);
14175
+ * ```
14176
+ * @version SDK: 1.28.3 | ThoughtSpot: *
14177
+ */
14178
+ const formatPreauthInfo = async (preauthInfoResp) => {
14179
+ var _a;
14180
+ try {
14181
+ // Convert Headers to a plain object
14182
+ const headers = {};
14183
+ (_a = preauthInfoResp === null || preauthInfoResp === void 0 ? void 0 : preauthInfoResp.headers) === null || _a === void 0 ? void 0 : _a.forEach((value, key) => {
14184
+ headers[key] = value;
14185
+ });
14186
+ const data = await preauthInfoResp.json();
14187
+ return {
14188
+ ...data,
14189
+ status: 200,
14190
+ headers,
14191
+ };
14192
+ }
14193
+ catch (error) {
14194
+ return null;
14195
+ }
14196
+ };
14197
+ /**
14198
+ * Returns the session info object and caches it for future use.
14199
+ * Once fetched the session info object is cached and returned from the cache on
14200
+ * subsequent calls.
14201
+ * @example ```js
14202
+ * const preauthInfo = await getPreauthInfo();
14203
+ * console.log(preauthInfo);
14204
+ * ```
14205
+ * @version SDK: 1.28.3 | ThoughtSpot: *
14206
+ * @returns {Promise<SessionInfo>} The session info object.
14207
+ */
14208
+ async function getPreauthInfo(allowCache = true) {
14209
+ if (!allowCache || !preauthInfo) {
14210
+ try {
14211
+ const host = getEmbedConfig().thoughtSpotHost;
14212
+ const sessionResponse = await fetchPreauthInfoService(host);
14213
+ const processedPreauthInfo = await formatPreauthInfo(sessionResponse);
14214
+ preauthInfo = processedPreauthInfo;
14215
+ }
14216
+ catch (error) {
14217
+ return null;
14218
+ }
14219
+ }
14220
+ return preauthInfo;
14221
+ }
14066
14222
  /**
14067
14223
  * Returns the session info object and caches it for future use.
14068
14224
  * Once fetched the session info object is cached and returned from the cache on
@@ -14146,6 +14302,11 @@ var AuthStatus;
14146
14302
  * Emits when the SDK authenticates successfully
14147
14303
  */
14148
14304
  AuthStatus["SDK_SUCCESS"] = "SDK_SUCCESS";
14305
+ /**
14306
+ * @hidden
14307
+ * Emits when iframe is loaded and session info is available
14308
+ */
14309
+ AuthStatus["SESSION_INFO_SUCCESS"] = "SESSION_INFO_SUCCESS";
14149
14310
  /**
14150
14311
  * Emits when the app sends an authentication success message
14151
14312
  */
@@ -14201,6 +14362,7 @@ async function notifyAuthSuccess() {
14201
14362
  return;
14202
14363
  }
14203
14364
  try {
14365
+ getPreauthInfo();
14204
14366
  const sessionInfo = await getSessionInfo();
14205
14367
  authEE.emit(AuthStatus.SUCCESS, sessionInfo);
14206
14368
  }
@@ -14255,6 +14417,7 @@ async function isLoggedIn(thoughtSpotHost) {
14255
14417
  */
14256
14418
  async function postLoginService() {
14257
14419
  try {
14420
+ getPreauthInfo();
14258
14421
  const sessionInfo = await getSessionInfo();
14259
14422
  releaseVersion = sessionInfo.releaseVersion;
14260
14423
  const embedConfig = getEmbedConfig();
@@ -14922,7 +15085,7 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
14922
15085
  return e;
14923
15086
  }
14924
15087
 
14925
- var name="@thoughtspot/visual-embed-sdk";var version$1="1.35.14";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={".":{"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","html-react-parser":"^1.4.12",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":"^3.1.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,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};
15088
+ 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={".":{"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,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};
14926
15089
 
14927
15090
  /**
14928
15091
  * Reloads the ThoughtSpot iframe.
@@ -15044,15 +15207,20 @@ class HostEventClient {
15044
15207
  return res;
15045
15208
  }
15046
15209
  async handlePinEvent(payload) {
15210
+ var _a, _b;
15047
15211
  if (!payload || !('newVizName' in payload)) {
15048
15212
  return this.hostEventFallback(HostEvent.Pin, payload);
15049
15213
  }
15050
15214
  const formattedPayload = {
15051
15215
  ...payload,
15052
- pinboardId: payload.liveboardId,
15053
- newPinboardName: payload.newLiveboardName,
15216
+ pinboardId: (_a = payload.liveboardId) !== null && _a !== void 0 ? _a : payload.pinboardId,
15217
+ newPinboardName: (_b = payload.newLiveboardName) !== null && _b !== void 0 ? _b : payload.newPinboardName,
15218
+ };
15219
+ const data = await this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload);
15220
+ return {
15221
+ ...data,
15222
+ liveboardId: data.pinboardId,
15054
15223
  };
15055
- return this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload);
15056
15224
  }
15057
15225
  async handleSaveAnswerEvent(payload) {
15058
15226
  var _a, _b, _c, _d;
@@ -15285,6 +15453,21 @@ class TsEmbed {
15285
15453
  }
15286
15454
  return null;
15287
15455
  }
15456
+ /**
15457
+ * Checks if preauth cache is enabled
15458
+ * from the view config and embed config
15459
+ * @returns boolean
15460
+ */
15461
+ isPreAuthCacheEnabled() {
15462
+ // Disable preauth cache when:
15463
+ // 1. overrideOrgId is present since:
15464
+ // - cached auth info would be for wrong org
15465
+ // - info call response changes for each different overrideOrgId
15466
+ // 2. disablePreauthCache is explicitly set to true
15467
+ const isDisabled = (this.viewConfig.overrideOrgId !== undefined
15468
+ || this.embedConfig.disablePreauthCache === true);
15469
+ return !isDisabled;
15470
+ }
15288
15471
  /**
15289
15472
  * fix for ts7.sep.cl
15290
15473
  * will be removed for ts7.oct.cl
@@ -15503,6 +15686,9 @@ class TsEmbed {
15503
15686
  if (overrideOrgId !== undefined) {
15504
15687
  queryParams[Param.OverrideOrgId] = overrideOrgId;
15505
15688
  }
15689
+ if (this.isPreAuthCacheEnabled()) {
15690
+ queryParams[Param.preAuthCache] = true;
15691
+ }
15506
15692
  queryParams[Param.OverrideNativeConsole] = true;
15507
15693
  queryParams[Param.ClientLogLevel] = this.embedConfig.logLevel;
15508
15694
  if (isObject_1(additionalFlags) && !isEmpty_1(additionalFlags)) {
@@ -15621,6 +15807,14 @@ class TsEmbed {
15621
15807
  elHeight: this.iFrame.clientHeight,
15622
15808
  timeTookToLoad: loadTimestamp - initTimestamp,
15623
15809
  });
15810
+ // Send info event if preauth cache is enabled
15811
+ if (this.isPreAuthCacheEnabled()) {
15812
+ getPreauthInfo().then((data) => {
15813
+ if (data === null || data === void 0 ? void 0 : data.info) {
15814
+ this.trigger(HostEvent.InfoSuccess, data);
15815
+ }
15816
+ });
15817
+ }
15624
15818
  });
15625
15819
  this.iFrame.addEventListener('error', () => {
15626
15820
  nextInQueue();