@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 (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
@@ -2079,16 +2079,63 @@
2079
2079
  */
2080
2080
  HostEvent["getExportRequestForCurrentPinboard"] = "getExportRequestForCurrentPinboard";
2081
2081
  /**
2082
- * Trigger the **Pin** action on an embedded object
2083
- * @param - Liveboard embed takes the `vizId` as a
2084
- * key. Can be left undefined when embedding Search, full app, or
2085
- * a visualization.
2082
+ * Trigger **Pin** action on an embedded object.
2083
+ * If no parameters are defined, the pin action is triggered
2084
+ * for the Answer that the user is currently on
2085
+ * and a modal opens for Liveboard selection.
2086
+ * To add an Answer or visualization to a Liveboard programmatically without
2087
+ * showing requiring additional user input via *Pin to Liveboard* modal, define
2088
+ * the following parameters:
2089
+ *
2090
+ * @param
2091
+ * `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
2092
+ * Optional when pinning a new chart or table generated from a Search query.
2093
+ * @param
2094
+ * `liveboardID` - GUID of the Liveboard to pin an Answer. If there is no Liveboard,
2095
+ * specify the `newLiveboardName` parameter to create a new Liveboard.
2096
+ * @param
2097
+ * `tabId` - GUID of the Liveboard tab. Adds the Answer to the Liveboard tab
2098
+ * specified in the code.
2099
+ * @param
2100
+ * `newVizName` - Name string for the Answer or visualization. If defined,
2101
+ * this parameter adds a new visualization object or creates a copy of the
2102
+ * Answer or visualization specified in `vizId`.
2103
+ * Required attribute.
2104
+ * @param
2105
+ * `newLiveboardName` - Name string for the Liveboard.
2106
+ * Creates a new Liveboard object with the specified name.
2107
+ * @param
2108
+ * `newTabName` - Name of the tab. Adds a new tab Liveboard specified
2109
+ * in the code.
2110
+ *
2086
2111
  * @example
2087
2112
  * ```js
2088
- * appEmbed.trigger(HostEvent.Pin)
2113
+ * const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
2114
+ * vizId: "123",
2115
+ * newVizName: "Sales by region",
2116
+ * liveboardId: "123",
2117
+ * tabId: "123"
2118
+ * });
2089
2119
  * ```
2120
+ * @example
2090
2121
  * ```js
2091
- * searchEmbed.trigger(HostEvent.Pin)
2122
+ * const pinResponse = await appEmbed.trigger(HostEvent.Pin, {
2123
+ * newVizName: "Total sales of Jackets",
2124
+ * liveboardId: "123"
2125
+ * });
2126
+ * ```
2127
+ *
2128
+ * @example
2129
+ * ```js
2130
+ * const pinResponse = await searchEmbed.trigger(HostEvent.Pin, {
2131
+ * newVizName: "Sales by state",
2132
+ * newLiveboardName: "Sales",
2133
+ * newTabName: "Products"
2134
+ * });
2135
+ * ```
2136
+ * @example
2137
+ * ```js
2138
+ * appEmbed.trigger(HostEvent.Pin)
2092
2139
  * ```
2093
2140
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2094
2141
  */
@@ -2735,7 +2782,33 @@
2735
2782
  */
2736
2783
  HostEvent["UpdatePersonalisedView"] = "UpdatePersonalisedView";
2737
2784
  /**
2738
- * Triggers the action to get the current view of the Liveboard.
2785
+ * @hidden
2786
+ * Notify when info call is completed successfully
2787
+ * ```js
2788
+ * liveboardEmbed.trigger(HostEvent.InfoSuccess, data);
2789
+ *```
2790
+ * @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
2791
+ */
2792
+ HostEvent["InfoSuccess"] = "InfoSuccess";
2793
+ /**
2794
+ * Trigger the save action for an Answer.
2795
+ * To programmatically save an answer without opening the
2796
+ * *Describe your Answer* modal, define the `name` and `description`
2797
+ * properties.
2798
+ * If no parameters are specified, the save action is
2799
+ * triggered with a modal to prompt users to
2800
+ * add a name and description for the Answer.
2801
+ * @param - optional attributes to set Answer properties.
2802
+ * `name` - Name string for the Answer.
2803
+ * `description` - Description text for the Answer.
2804
+ *
2805
+ * @example
2806
+ * ```js
2807
+ * const saveAnswerResponse = await searchEmbed.trigger(HostEvent.SaveAnswer, {
2808
+ * name: "Sales by states",
2809
+ * description: "Total sales by states in MidWest"
2810
+ * });
2811
+ * ```
2739
2812
  * @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
2740
2813
  */
2741
2814
  HostEvent["SaveAnswer"] = "saveAnswer";
@@ -2893,6 +2966,7 @@
2893
2966
  Param["OauthPollingInterval"] = "oAuthPollingInterval";
2894
2967
  Param["IsForceRedirect"] = "isForceRedirect";
2895
2968
  Param["DataSourceId"] = "dataSourceId";
2969
+ Param["preAuthCache"] = "preAuthCache";
2896
2970
  Param["ShowSpotterLimitations"] = "showSpotterLimitations";
2897
2971
  })(Param || (Param = {}));
2898
2972
  /**
@@ -6549,6 +6623,7 @@
6549
6623
  const EndPoints = {
6550
6624
  AUTH_VERIFICATION: '/callosum/v1/session/info',
6551
6625
  SESSION_INFO: '/callosum/v1/session/info',
6626
+ PREAUTH_INFO: '/prism/preauth/info',
6552
6627
  SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
6553
6628
  OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
6554
6629
  TOKEN_LOGIN: '/callosum/v1/session/login/token',
@@ -14090,6 +14165,31 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14090
14165
  return r;
14091
14166
  });
14092
14167
  }
14168
+ /**
14169
+ * Fetches the session info from the ThoughtSpot server.
14170
+ * @param thoughtspotHost
14171
+ * @returns {Promise<any>}
14172
+ * @example
14173
+ * ```js
14174
+ * const response = await sessionInfoService();
14175
+ * ```
14176
+ */
14177
+ async function fetchPreauthInfoService(thoughtspotHost) {
14178
+ const sessionInfoPath = `${thoughtspotHost}${EndPoints.PREAUTH_INFO}`;
14179
+ const handleError = (e) => {
14180
+ const error = new Error(`Failed to fetch auth info: ${e.message || e.statusText}`);
14181
+ error.status = e.status; // Attach the status code to the error object
14182
+ throw error;
14183
+ };
14184
+ try {
14185
+ const response = await tokenizedFailureLoggedFetch(sessionInfoPath);
14186
+ return response;
14187
+ }
14188
+ catch (e) {
14189
+ handleError(e);
14190
+ return null;
14191
+ }
14192
+ }
14093
14193
  /**
14094
14194
  * Fetches the session info from the ThoughtSpot server.
14095
14195
  * @param thoughtspotHost
@@ -14128,6 +14228,62 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14128
14228
  }
14129
14229
 
14130
14230
  let sessionInfo = null;
14231
+ let preauthInfo = null;
14232
+ /**
14233
+ * Processes the session info response and returns the session info object.
14234
+ * @param preauthInfoResp {any} Response from the session info API.
14235
+ * @returns {PreauthInfo} The session info object.
14236
+ * @example ```js
14237
+ * const preauthInfoResp = await fetch(sessionInfoPath);
14238
+ * const sessionInfo = await formatPreauthInfo(preauthInfoResp);
14239
+ * console.log(sessionInfo);
14240
+ * ```
14241
+ * @version SDK: 1.28.3 | ThoughtSpot: *
14242
+ */
14243
+ const formatPreauthInfo = async (preauthInfoResp) => {
14244
+ var _a;
14245
+ try {
14246
+ // Convert Headers to a plain object
14247
+ const headers = {};
14248
+ (_a = preauthInfoResp === null || preauthInfoResp === void 0 ? void 0 : preauthInfoResp.headers) === null || _a === void 0 ? void 0 : _a.forEach((value, key) => {
14249
+ headers[key] = value;
14250
+ });
14251
+ const data = await preauthInfoResp.json();
14252
+ return {
14253
+ ...data,
14254
+ status: 200,
14255
+ headers,
14256
+ };
14257
+ }
14258
+ catch (error) {
14259
+ return null;
14260
+ }
14261
+ };
14262
+ /**
14263
+ * Returns the session info object and caches it for future use.
14264
+ * Once fetched the session info object is cached and returned from the cache on
14265
+ * subsequent calls.
14266
+ * @example ```js
14267
+ * const preauthInfo = await getPreauthInfo();
14268
+ * console.log(preauthInfo);
14269
+ * ```
14270
+ * @version SDK: 1.28.3 | ThoughtSpot: *
14271
+ * @returns {Promise<SessionInfo>} The session info object.
14272
+ */
14273
+ async function getPreauthInfo(allowCache = true) {
14274
+ if (!allowCache || !preauthInfo) {
14275
+ try {
14276
+ const host = getEmbedConfig().thoughtSpotHost;
14277
+ const sessionResponse = await fetchPreauthInfoService(host);
14278
+ const processedPreauthInfo = await formatPreauthInfo(sessionResponse);
14279
+ preauthInfo = processedPreauthInfo;
14280
+ }
14281
+ catch (error) {
14282
+ return null;
14283
+ }
14284
+ }
14285
+ return preauthInfo;
14286
+ }
14131
14287
  /**
14132
14288
  * Returns the session info object and caches it for future use.
14133
14289
  * Once fetched the session info object is cached and returned from the cache on
@@ -14211,6 +14367,11 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14211
14367
  * Emits when the SDK authenticates successfully
14212
14368
  */
14213
14369
  AuthStatus["SDK_SUCCESS"] = "SDK_SUCCESS";
14370
+ /**
14371
+ * @hidden
14372
+ * Emits when iframe is loaded and session info is available
14373
+ */
14374
+ AuthStatus["SESSION_INFO_SUCCESS"] = "SESSION_INFO_SUCCESS";
14214
14375
  /**
14215
14376
  * Emits when the app sends an authentication success message
14216
14377
  */
@@ -14302,6 +14463,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14302
14463
  */
14303
14464
  async function postLoginService() {
14304
14465
  try {
14466
+ getPreauthInfo();
14305
14467
  const sessionInfo = await getSessionInfo();
14306
14468
  releaseVersion = sessionInfo.releaseVersion;
14307
14469
  const embedConfig = getEmbedConfig();
@@ -14702,7 +14864,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14702
14864
  return e;
14703
14865
  }
14704
14866
 
14705
- 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$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","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$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};
14867
+ 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};
14706
14868
 
14707
14869
  /**
14708
14870
  * Reloads the ThoughtSpot iframe.
@@ -14824,15 +14986,20 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14824
14986
  return res;
14825
14987
  }
14826
14988
  async handlePinEvent(payload) {
14989
+ var _a, _b;
14827
14990
  if (!payload || !('newVizName' in payload)) {
14828
14991
  return this.hostEventFallback(exports.HostEvent.Pin, payload);
14829
14992
  }
14830
14993
  const formattedPayload = {
14831
14994
  ...payload,
14832
- pinboardId: payload.liveboardId,
14833
- newPinboardName: payload.newLiveboardName,
14995
+ pinboardId: (_a = payload.liveboardId) !== null && _a !== void 0 ? _a : payload.pinboardId,
14996
+ newPinboardName: (_b = payload.newLiveboardName) !== null && _b !== void 0 ? _b : payload.newPinboardName,
14997
+ };
14998
+ const data = await this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload);
14999
+ return {
15000
+ ...data,
15001
+ liveboardId: data.pinboardId,
14834
15002
  };
14835
- return this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload);
14836
15003
  }
14837
15004
  async handleSaveAnswerEvent(payload) {
14838
15005
  var _a, _b, _c, _d;
@@ -15065,6 +15232,21 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15065
15232
  }
15066
15233
  return null;
15067
15234
  }
15235
+ /**
15236
+ * Checks if preauth cache is enabled
15237
+ * from the view config and embed config
15238
+ * @returns boolean
15239
+ */
15240
+ isPreAuthCacheEnabled() {
15241
+ // Disable preauth cache when:
15242
+ // 1. overrideOrgId is present since:
15243
+ // - cached auth info would be for wrong org
15244
+ // - info call response changes for each different overrideOrgId
15245
+ // 2. disablePreauthCache is explicitly set to true
15246
+ const isDisabled = (this.viewConfig.overrideOrgId !== undefined
15247
+ || this.embedConfig.disablePreauthCache === true);
15248
+ return !isDisabled;
15249
+ }
15068
15250
  /**
15069
15251
  * fix for ts7.sep.cl
15070
15252
  * will be removed for ts7.oct.cl
@@ -15283,6 +15465,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15283
15465
  if (overrideOrgId !== undefined) {
15284
15466
  queryParams[Param.OverrideOrgId] = overrideOrgId;
15285
15467
  }
15468
+ if (this.isPreAuthCacheEnabled()) {
15469
+ queryParams[Param.preAuthCache] = true;
15470
+ }
15286
15471
  queryParams[Param.OverrideNativeConsole] = true;
15287
15472
  queryParams[Param.ClientLogLevel] = this.embedConfig.logLevel;
15288
15473
  if (isObject_1(additionalFlags) && !isEmpty_1(additionalFlags)) {
@@ -15401,6 +15586,14 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15401
15586
  elHeight: this.iFrame.clientHeight,
15402
15587
  timeTookToLoad: loadTimestamp - initTimestamp,
15403
15588
  });
15589
+ // Send info event if preauth cache is enabled
15590
+ if (this.isPreAuthCacheEnabled()) {
15591
+ getPreauthInfo().then((data) => {
15592
+ if (data === null || data === void 0 ? void 0 : data.info) {
15593
+ this.trigger(exports.HostEvent.InfoSuccess, data);
15594
+ }
15595
+ });
15596
+ }
15404
15597
  });
15405
15598
  this.iFrame.addEventListener('error', () => {
15406
15599
  nextInQueue();