@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
  import * as React from 'react';
3
3
  import React__default from 'react';
4
4
 
@@ -2057,16 +2057,63 @@ var HostEvent;
2057
2057
  */
2058
2058
  HostEvent["getExportRequestForCurrentPinboard"] = "getExportRequestForCurrentPinboard";
2059
2059
  /**
2060
- * Trigger the **Pin** action on an embedded object
2061
- * @param - Liveboard embed takes the `vizId` as a
2062
- * key. Can be left undefined when embedding Search, full app, or
2063
- * a visualization.
2060
+ * Trigger **Pin** action on an embedded object.
2061
+ * If no parameters are defined, the pin action is triggered
2062
+ * for the Answer that the user is currently on
2063
+ * and a modal opens for Liveboard selection.
2064
+ * To add an Answer or visualization to a Liveboard programmatically without
2065
+ * showing requiring additional user input via *Pin to Liveboard* modal, define
2066
+ * the following parameters:
2067
+ *
2068
+ * @param
2069
+ * `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
2070
+ * Optional when pinning a new chart or table generated from a Search query.
2071
+ * @param
2072
+ * `liveboardID` - GUID of the Liveboard to pin an Answer. If there is no Liveboard,
2073
+ * specify the `newLiveboardName` parameter to create a new Liveboard.
2074
+ * @param
2075
+ * `tabId` - GUID of the Liveboard tab. Adds the Answer to the Liveboard tab
2076
+ * specified in the code.
2077
+ * @param
2078
+ * `newVizName` - Name string for the Answer or visualization. If defined,
2079
+ * this parameter adds a new visualization object or creates a copy of the
2080
+ * Answer or visualization specified in `vizId`.
2081
+ * Required attribute.
2082
+ * @param
2083
+ * `newLiveboardName` - Name string for the Liveboard.
2084
+ * Creates a new Liveboard object with the specified name.
2085
+ * @param
2086
+ * `newTabName` - Name of the tab. Adds a new tab Liveboard specified
2087
+ * in the code.
2088
+ *
2064
2089
  * @example
2065
2090
  * ```js
2066
- * appEmbed.trigger(HostEvent.Pin)
2091
+ * const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
2092
+ * vizId: "123",
2093
+ * newVizName: "Sales by region",
2094
+ * liveboardId: "123",
2095
+ * tabId: "123"
2096
+ * });
2067
2097
  * ```
2098
+ * @example
2068
2099
  * ```js
2069
- * searchEmbed.trigger(HostEvent.Pin)
2100
+ * const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
2101
+ * newVizName: "Total sales of Jackets",
2102
+ * liveboardId: "123"
2103
+ * });
2104
+ * ```
2105
+ *
2106
+ * @example
2107
+ * ```js
2108
+ * const pinResponse = await searchEmbed.trigger(HostEvent.Pin, {
2109
+ * newVizName: "Sales by state",
2110
+ * newLiveboardName: "Sales",
2111
+ * newTabName: "Products"
2112
+ * });
2113
+ * ```
2114
+ * @example
2115
+ * ```js
2116
+ * appEmbed.trigger(HostEvent.Pin)
2070
2117
  * ```
2071
2118
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2072
2119
  */
@@ -2713,7 +2760,33 @@ var HostEvent;
2713
2760
  */
2714
2761
  HostEvent["UpdatePersonalisedView"] = "UpdatePersonalisedView";
2715
2762
  /**
2716
- * Triggers the action to get the current view of the Liveboard.
2763
+ * @hidden
2764
+ * Notify when info call is completed successfully
2765
+ * ```js
2766
+ * liveboardEmbed.trigger(HostEvent.InfoSuccess, data);
2767
+ *```
2768
+ * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
2769
+ */
2770
+ HostEvent["InfoSuccess"] = "InfoSuccess";
2771
+ /**
2772
+ * Trigger the save action for an Answer.
2773
+ * To programmatically save an answer without opening the
2774
+ * *Describe your Answer* modal, define the `name` and `description`
2775
+ * properties.
2776
+ * If no parameters are specified, the save action is
2777
+ * triggered with a modal to prompt users to
2778
+ * add a name and description for the Answer.
2779
+ * @param - optional attributes to set Answer properties.
2780
+ * `name` - Name string for the Answer.
2781
+ * `description` - Description text for the Answer.
2782
+ *
2783
+ * @example
2784
+ * ```js
2785
+ * const saveAnswerResponse = await searchEmbed.trigger(HostEvent.SaveAnswer, {
2786
+ * name: "Sales by states",
2787
+ * description: "Total sales by states in MidWest"
2788
+ * });
2789
+ * ```
2717
2790
  * @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
2718
2791
  */
2719
2792
  HostEvent["SaveAnswer"] = "saveAnswer";
@@ -2871,6 +2944,7 @@ var Param;
2871
2944
  Param["OauthPollingInterval"] = "oAuthPollingInterval";
2872
2945
  Param["IsForceRedirect"] = "isForceRedirect";
2873
2946
  Param["DataSourceId"] = "dataSourceId";
2947
+ Param["preAuthCache"] = "preAuthCache";
2874
2948
  Param["ShowSpotterLimitations"] = "showSpotterLimitations";
2875
2949
  })(Param || (Param = {}));
2876
2950
  /**
@@ -6527,6 +6601,7 @@ const ERROR_MESSAGE = {
6527
6601
  const EndPoints = {
6528
6602
  AUTH_VERIFICATION: '/callosum/v1/session/info',
6529
6603
  SESSION_INFO: '/callosum/v1/session/info',
6604
+ PREAUTH_INFO: '/prism/preauth/info',
6530
6605
  SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
6531
6606
  OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
6532
6607
  TOKEN_LOGIN: '/callosum/v1/session/login/token',
@@ -7328,7 +7403,7 @@ class AnswerService {
7328
7403
  async getTML() {
7329
7404
  const { object } = await this.executeQuery(getAnswerTML, {});
7330
7405
  const edoc = object[0].edoc;
7331
- const YAML = await import('./index-vxW97_xb.js');
7406
+ const YAML = await import('./index-CR5u7BMC.js');
7332
7407
  const parsedDoc = YAML.parse(edoc);
7333
7408
  return {
7334
7409
  answer: {
@@ -14068,6 +14143,31 @@ function tokenizedFailureLoggedFetch(url, options = {}) {
14068
14143
  return r;
14069
14144
  });
14070
14145
  }
14146
+ /**
14147
+ * Fetches the session info from the ThoughtSpot server.
14148
+ * @param thoughtspotHost
14149
+ * @returns {Promise<any>}
14150
+ * @example
14151
+ * ```js
14152
+ * const response = await sessionInfoService();
14153
+ * ```
14154
+ */
14155
+ async function fetchPreauthInfoService(thoughtspotHost) {
14156
+ const sessionInfoPath = `${thoughtspotHost}${EndPoints.PREAUTH_INFO}`;
14157
+ const handleError = (e) => {
14158
+ const error = new Error(`Failed to fetch auth info: ${e.message || e.statusText}`);
14159
+ error.status = e.status; // Attach the status code to the error object
14160
+ throw error;
14161
+ };
14162
+ try {
14163
+ const response = await tokenizedFailureLoggedFetch(sessionInfoPath);
14164
+ return response;
14165
+ }
14166
+ catch (e) {
14167
+ handleError(e);
14168
+ return null;
14169
+ }
14170
+ }
14071
14171
  /**
14072
14172
  * Fetches the session info from the ThoughtSpot server.
14073
14173
  * @param thoughtspotHost
@@ -14106,6 +14206,62 @@ async function isActiveService(thoughtSpotHost) {
14106
14206
  }
14107
14207
 
14108
14208
  let sessionInfo = null;
14209
+ let preauthInfo = null;
14210
+ /**
14211
+ * Processes the session info response and returns the session info object.
14212
+ * @param preauthInfoResp {any} Response from the session info API.
14213
+ * @returns {PreauthInfo} The session info object.
14214
+ * @example ```js
14215
+ * const preauthInfoResp = await fetch(sessionInfoPath);
14216
+ * const sessionInfo = await formatPreauthInfo(preauthInfoResp);
14217
+ * console.log(sessionInfo);
14218
+ * ```
14219
+ * @version SDK: 1.28.3 | ThoughtSpot: *
14220
+ */
14221
+ const formatPreauthInfo = async (preauthInfoResp) => {
14222
+ var _a;
14223
+ try {
14224
+ // Convert Headers to a plain object
14225
+ const headers = {};
14226
+ (_a = preauthInfoResp === null || preauthInfoResp === void 0 ? void 0 : preauthInfoResp.headers) === null || _a === void 0 ? void 0 : _a.forEach((value, key) => {
14227
+ headers[key] = value;
14228
+ });
14229
+ const data = await preauthInfoResp.json();
14230
+ return {
14231
+ ...data,
14232
+ status: 200,
14233
+ headers,
14234
+ };
14235
+ }
14236
+ catch (error) {
14237
+ return null;
14238
+ }
14239
+ };
14240
+ /**
14241
+ * Returns the session info object and caches it for future use.
14242
+ * Once fetched the session info object is cached and returned from the cache on
14243
+ * subsequent calls.
14244
+ * @example ```js
14245
+ * const preauthInfo = await getPreauthInfo();
14246
+ * console.log(preauthInfo);
14247
+ * ```
14248
+ * @version SDK: 1.28.3 | ThoughtSpot: *
14249
+ * @returns {Promise<SessionInfo>} The session info object.
14250
+ */
14251
+ async function getPreauthInfo(allowCache = true) {
14252
+ if (!allowCache || !preauthInfo) {
14253
+ try {
14254
+ const host = getEmbedConfig().thoughtSpotHost;
14255
+ const sessionResponse = await fetchPreauthInfoService(host);
14256
+ const processedPreauthInfo = await formatPreauthInfo(sessionResponse);
14257
+ preauthInfo = processedPreauthInfo;
14258
+ }
14259
+ catch (error) {
14260
+ return null;
14261
+ }
14262
+ }
14263
+ return preauthInfo;
14264
+ }
14109
14265
  /**
14110
14266
  * Returns the session info object and caches it for future use.
14111
14267
  * Once fetched the session info object is cached and returned from the cache on
@@ -14189,6 +14345,11 @@ var AuthStatus;
14189
14345
  * Emits when the SDK authenticates successfully
14190
14346
  */
14191
14347
  AuthStatus["SDK_SUCCESS"] = "SDK_SUCCESS";
14348
+ /**
14349
+ * @hidden
14350
+ * Emits when iframe is loaded and session info is available
14351
+ */
14352
+ AuthStatus["SESSION_INFO_SUCCESS"] = "SESSION_INFO_SUCCESS";
14192
14353
  /**
14193
14354
  * Emits when the app sends an authentication success message
14194
14355
  */
@@ -14280,6 +14441,7 @@ async function isLoggedIn(thoughtSpotHost) {
14280
14441
  */
14281
14442
  async function postLoginService() {
14282
14443
  try {
14444
+ getPreauthInfo();
14283
14445
  const sessionInfo = await getSessionInfo();
14284
14446
  releaseVersion = sessionInfo.releaseVersion;
14285
14447
  const embedConfig = getEmbedConfig();
@@ -14680,7 +14842,7 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
14680
14842
  return e;
14681
14843
  }
14682
14844
 
14683
- 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};
14845
+ 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};
14684
14846
 
14685
14847
  /**
14686
14848
  * Reloads the ThoughtSpot iframe.
@@ -14802,15 +14964,20 @@ class HostEventClient {
14802
14964
  return res;
14803
14965
  }
14804
14966
  async handlePinEvent(payload) {
14967
+ var _a, _b;
14805
14968
  if (!payload || !('newVizName' in payload)) {
14806
14969
  return this.hostEventFallback(HostEvent.Pin, payload);
14807
14970
  }
14808
14971
  const formattedPayload = {
14809
14972
  ...payload,
14810
- pinboardId: payload.liveboardId,
14811
- newPinboardName: payload.newLiveboardName,
14973
+ pinboardId: (_a = payload.liveboardId) !== null && _a !== void 0 ? _a : payload.pinboardId,
14974
+ newPinboardName: (_b = payload.newLiveboardName) !== null && _b !== void 0 ? _b : payload.newPinboardName,
14975
+ };
14976
+ const data = await this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload);
14977
+ return {
14978
+ ...data,
14979
+ liveboardId: data.pinboardId,
14812
14980
  };
14813
- return this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload);
14814
14981
  }
14815
14982
  async handleSaveAnswerEvent(payload) {
14816
14983
  var _a, _b, _c, _d;
@@ -15043,6 +15210,21 @@ class TsEmbed {
15043
15210
  }
15044
15211
  return null;
15045
15212
  }
15213
+ /**
15214
+ * Checks if preauth cache is enabled
15215
+ * from the view config and embed config
15216
+ * @returns boolean
15217
+ */
15218
+ isPreAuthCacheEnabled() {
15219
+ // Disable preauth cache when:
15220
+ // 1. overrideOrgId is present since:
15221
+ // - cached auth info would be for wrong org
15222
+ // - info call response changes for each different overrideOrgId
15223
+ // 2. disablePreauthCache is explicitly set to true
15224
+ const isDisabled = (this.viewConfig.overrideOrgId !== undefined
15225
+ || this.embedConfig.disablePreauthCache === true);
15226
+ return !isDisabled;
15227
+ }
15046
15228
  /**
15047
15229
  * fix for ts7.sep.cl
15048
15230
  * will be removed for ts7.oct.cl
@@ -15261,6 +15443,9 @@ class TsEmbed {
15261
15443
  if (overrideOrgId !== undefined) {
15262
15444
  queryParams[Param.OverrideOrgId] = overrideOrgId;
15263
15445
  }
15446
+ if (this.isPreAuthCacheEnabled()) {
15447
+ queryParams[Param.preAuthCache] = true;
15448
+ }
15264
15449
  queryParams[Param.OverrideNativeConsole] = true;
15265
15450
  queryParams[Param.ClientLogLevel] = this.embedConfig.logLevel;
15266
15451
  if (isObject_1(additionalFlags) && !isEmpty_1(additionalFlags)) {
@@ -15379,6 +15564,14 @@ class TsEmbed {
15379
15564
  elHeight: this.iFrame.clientHeight,
15380
15565
  timeTookToLoad: loadTimestamp - initTimestamp,
15381
15566
  });
15567
+ // Send info event if preauth cache is enabled
15568
+ if (this.isPreAuthCacheEnabled()) {
15569
+ getPreauthInfo().then((data) => {
15570
+ if (data === null || data === void 0 ? void 0 : data.info) {
15571
+ this.trigger(HostEvent.InfoSuccess, data);
15572
+ }
15573
+ });
15574
+ }
15382
15575
  });
15383
15576
  this.iFrame.addEventListener('error', () => {
15384
15577
  nextInQueue();