@thoughtspot/visual-embed-sdk 1.36.3 → 1.36.5

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 (185) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/css-variables.d.ts +1 -1
  3. package/cjs/src/css-variables.d.ts.map +1 -1
  4. package/cjs/src/embed/app.d.ts.map +1 -1
  5. package/cjs/src/embed/app.js +1 -1
  6. package/cjs/src/embed/app.js.map +1 -1
  7. package/cjs/src/embed/base.d.ts +4 -0
  8. package/cjs/src/embed/base.d.ts.map +1 -1
  9. package/cjs/src/embed/base.js +27 -1
  10. package/cjs/src/embed/base.js.map +1 -1
  11. package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
  12. package/cjs/src/embed/bodyless-conversation.js +1 -1
  13. package/cjs/src/embed/bodyless-conversation.js.map +1 -1
  14. package/cjs/src/embed/conversation.d.ts.map +1 -1
  15. package/cjs/src/embed/conversation.js +1 -1
  16. package/cjs/src/embed/conversation.js.map +1 -1
  17. package/cjs/src/embed/embedConfig.d.ts.map +1 -1
  18. package/cjs/src/embed/embedConfig.js.map +1 -1
  19. package/cjs/src/embed/liveboard.d.ts +2 -2
  20. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  21. package/cjs/src/embed/liveboard.js +4 -5
  22. package/cjs/src/embed/liveboard.js.map +1 -1
  23. package/cjs/src/embed/liveboard.spec.js +11 -11
  24. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  25. package/cjs/src/embed/sage.d.ts.map +1 -1
  26. package/cjs/src/embed/sage.js +1 -1
  27. package/cjs/src/embed/sage.js.map +1 -1
  28. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  29. package/cjs/src/embed/search-bar.js +1 -1
  30. package/cjs/src/embed/search-bar.js.map +1 -1
  31. package/cjs/src/embed/search.d.ts.map +1 -1
  32. package/cjs/src/embed/search.js +1 -1
  33. package/cjs/src/embed/search.js.map +1 -1
  34. package/cjs/src/embed/ts-embed.d.ts +4 -3
  35. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  36. package/cjs/src/embed/ts-embed.js +25 -16
  37. package/cjs/src/embed/ts-embed.js.map +1 -1
  38. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  39. package/cjs/src/embed/ts-embed.spec.js +71 -5
  40. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  41. package/cjs/src/errors.d.ts +1 -0
  42. package/cjs/src/errors.d.ts.map +1 -1
  43. package/cjs/src/errors.js +1 -0
  44. package/cjs/src/errors.js.map +1 -1
  45. package/cjs/src/react/all-types-export.d.ts +1 -1
  46. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  47. package/cjs/src/react/all-types-export.js +2 -1
  48. package/cjs/src/react/all-types-export.js.map +1 -1
  49. package/cjs/src/react/index.d.ts +16 -0
  50. package/cjs/src/react/index.d.ts.map +1 -1
  51. package/cjs/src/react/index.js +25 -2
  52. package/cjs/src/react/index.js.map +1 -1
  53. package/cjs/src/types.d.ts +43 -19
  54. package/cjs/src/types.d.ts.map +1 -1
  55. package/cjs/src/types.js +43 -19
  56. package/cjs/src/types.js.map +1 -1
  57. package/cjs/src/utils/with-resolvers-polyfill.d.ts +1 -0
  58. package/cjs/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
  59. package/cjs/src/utils/with-resolvers-polyfill.js +12 -0
  60. package/cjs/src/utils/with-resolvers-polyfill.js.map +1 -0
  61. package/cjs/src/utils.d.ts +17 -2
  62. package/cjs/src/utils.d.ts.map +1 -1
  63. package/cjs/src/utils.js +27 -3
  64. package/cjs/src/utils.js.map +1 -1
  65. package/dist/{index-BJx3m5_V.js → index-Cyvfex-A.js} +1 -1
  66. package/dist/src/css-variables.d.ts +1 -1
  67. package/dist/src/css-variables.d.ts.map +1 -1
  68. package/dist/src/embed/app.d.ts.map +1 -1
  69. package/dist/src/embed/base.d.ts +4 -0
  70. package/dist/src/embed/base.d.ts.map +1 -1
  71. package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
  72. package/dist/src/embed/conversation.d.ts.map +1 -1
  73. package/dist/src/embed/embedConfig.d.ts.map +1 -1
  74. package/dist/src/embed/liveboard.d.ts +2 -2
  75. package/dist/src/embed/liveboard.d.ts.map +1 -1
  76. package/dist/src/embed/sage.d.ts.map +1 -1
  77. package/dist/src/embed/search-bar.d.ts.map +1 -1
  78. package/dist/src/embed/search.d.ts.map +1 -1
  79. package/dist/src/embed/ts-embed.d.ts +4 -3
  80. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  81. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  82. package/dist/src/errors.d.ts +1 -0
  83. package/dist/src/errors.d.ts.map +1 -1
  84. package/dist/src/react/all-types-export.d.ts +1 -1
  85. package/dist/src/react/all-types-export.d.ts.map +1 -1
  86. package/dist/src/react/index.d.ts +16 -0
  87. package/dist/src/react/index.d.ts.map +1 -1
  88. package/dist/src/types.d.ts +43 -19
  89. package/dist/src/types.d.ts.map +1 -1
  90. package/dist/src/utils/with-resolvers-polyfill.d.ts +1 -0
  91. package/dist/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
  92. package/dist/src/utils.d.ts +17 -2
  93. package/dist/src/utils.d.ts.map +1 -1
  94. package/dist/tsembed-react.es.js +392 -64
  95. package/dist/tsembed-react.js +390 -61
  96. package/dist/tsembed.es.js +128 -51
  97. package/dist/tsembed.js +127 -50
  98. package/dist/visual-embed-sdk-react-full.d.ts +1277 -1234
  99. package/dist/visual-embed-sdk-react.d.ts +711 -668
  100. package/dist/visual-embed-sdk.d.ts +53 -24
  101. package/lib/package.json +1 -1
  102. package/lib/src/css-variables.d.ts +1 -1
  103. package/lib/src/css-variables.d.ts.map +1 -1
  104. package/lib/src/embed/app.d.ts.map +1 -1
  105. package/lib/src/embed/app.js +1 -1
  106. package/lib/src/embed/app.js.map +1 -1
  107. package/lib/src/embed/base.d.ts +4 -0
  108. package/lib/src/embed/base.d.ts.map +1 -1
  109. package/lib/src/embed/base.js +24 -1
  110. package/lib/src/embed/base.js.map +1 -1
  111. package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
  112. package/lib/src/embed/bodyless-conversation.js +1 -1
  113. package/lib/src/embed/bodyless-conversation.js.map +1 -1
  114. package/lib/src/embed/conversation.d.ts.map +1 -1
  115. package/lib/src/embed/conversation.js +1 -1
  116. package/lib/src/embed/conversation.js.map +1 -1
  117. package/lib/src/embed/embedConfig.d.ts.map +1 -1
  118. package/lib/src/embed/embedConfig.js.map +1 -1
  119. package/lib/src/embed/liveboard.d.ts +2 -2
  120. package/lib/src/embed/liveboard.d.ts.map +1 -1
  121. package/lib/src/embed/liveboard.js +4 -5
  122. package/lib/src/embed/liveboard.js.map +1 -1
  123. package/lib/src/embed/liveboard.spec.js +11 -11
  124. package/lib/src/embed/liveboard.spec.js.map +1 -1
  125. package/lib/src/embed/sage.d.ts.map +1 -1
  126. package/lib/src/embed/sage.js +1 -1
  127. package/lib/src/embed/sage.js.map +1 -1
  128. package/lib/src/embed/search-bar.d.ts.map +1 -1
  129. package/lib/src/embed/search-bar.js +1 -1
  130. package/lib/src/embed/search-bar.js.map +1 -1
  131. package/lib/src/embed/search.d.ts.map +1 -1
  132. package/lib/src/embed/search.js +1 -1
  133. package/lib/src/embed/search.js.map +1 -1
  134. package/lib/src/embed/ts-embed.d.ts +4 -3
  135. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  136. package/lib/src/embed/ts-embed.js +26 -17
  137. package/lib/src/embed/ts-embed.js.map +1 -1
  138. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  139. package/lib/src/embed/ts-embed.spec.js +71 -5
  140. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  141. package/lib/src/errors.d.ts +1 -0
  142. package/lib/src/errors.d.ts.map +1 -1
  143. package/lib/src/errors.js +1 -0
  144. package/lib/src/errors.js.map +1 -1
  145. package/lib/src/react/all-types-export.d.ts +1 -1
  146. package/lib/src/react/all-types-export.d.ts.map +1 -1
  147. package/lib/src/react/all-types-export.js +1 -1
  148. package/lib/src/react/all-types-export.js.map +1 -1
  149. package/lib/src/react/index.d.ts +16 -0
  150. package/lib/src/react/index.d.ts.map +1 -1
  151. package/lib/src/react/index.js +23 -1
  152. package/lib/src/react/index.js.map +1 -1
  153. package/lib/src/types.d.ts +43 -19
  154. package/lib/src/types.d.ts.map +1 -1
  155. package/lib/src/types.js +43 -19
  156. package/lib/src/types.js.map +1 -1
  157. package/lib/src/utils/with-resolvers-polyfill.d.ts +1 -0
  158. package/lib/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
  159. package/lib/src/utils/with-resolvers-polyfill.js +12 -0
  160. package/lib/src/utils/with-resolvers-polyfill.js.map +1 -0
  161. package/lib/src/utils.d.ts +17 -2
  162. package/lib/src/utils.d.ts.map +1 -1
  163. package/lib/src/utils.js +25 -2
  164. package/lib/src/utils.js.map +1 -1
  165. package/lib/src/visual-embed-sdk.d.ts +54 -25
  166. package/package.json +1 -1
  167. package/src/css-variables.ts +1 -1
  168. package/src/embed/app.ts +2 -1
  169. package/src/embed/base.ts +41 -1
  170. package/src/embed/bodyless-conversation.ts +2 -1
  171. package/src/embed/conversation.ts +2 -1
  172. package/src/embed/embedConfig.ts +1 -1
  173. package/src/embed/liveboard.spec.ts +11 -11
  174. package/src/embed/liveboard.ts +5 -6
  175. package/src/embed/sage.ts +1 -2
  176. package/src/embed/search-bar.tsx +1 -2
  177. package/src/embed/search.ts +1 -2
  178. package/src/embed/ts-embed.spec.ts +83 -5
  179. package/src/embed/ts-embed.ts +33 -17
  180. package/src/errors.ts +1 -0
  181. package/src/react/all-types-export.ts +1 -0
  182. package/src/react/index.tsx +27 -2
  183. package/src/types.ts +43 -19
  184. package/src/utils/with-resolvers-polyfill.ts +11 -0
  185. package/src/utils.ts +35 -4
@@ -1,4 +1,4 @@
1
- /* @thoughtspot/visual-embed-sdk version 1.36.3 */
1
+ /* @thoughtspot/visual-embed-sdk version 1.36.5 */
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) {
@@ -346,13 +346,23 @@ const sdkWindowKey = '_tsEmbedSDK';
346
346
  * Stores a value in the global `window` object under the `_tsEmbedSDK` namespace.
347
347
  * @param key - The key under which the value will be stored.
348
348
  * @param value - The value to store.
349
+ * @param options - Additional options.
350
+ * @param options.ignoreIfAlreadyExists - Does not set if value for key is set.
351
+ *
352
+ * @returns The stored value.
353
+ *
354
+ * @version SDK: 1.36.2 | ThoughtSpot: *
349
355
  */
350
- const storeValueInWindow = (key, value) => {
356
+ function storeValueInWindow(key, value, options = {}) {
351
357
  if (!window[sdkWindowKey]) {
352
358
  window[sdkWindowKey] = {};
353
359
  }
360
+ if (options.ignoreIfAlreadyExists && key in window[sdkWindowKey]) {
361
+ return window[sdkWindowKey][key];
362
+ }
354
363
  window[sdkWindowKey][key] = value;
355
- };
364
+ return value;
365
+ }
356
366
  /**
357
367
  * Retrieves a stored value from the global `window` object under the `_tsEmbedSDK` namespace.
358
368
  * @param key - The key whose value needs to be retrieved.
@@ -749,8 +759,9 @@ var EmbedEvent;
749
759
  */
750
760
  EmbedEvent["Load"] = "load";
751
761
  /**
752
- * Data pertaining to an Answer or Liveboard is received
753
- * @return data - The Answer or Liveboard data
762
+ * Data pertaining to an Answer or Liveboard is received.
763
+ * The event payload includes the raw data of the object.
764
+ * @return data - Answer of Liveboard data
754
765
  * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
755
766
  * @example
756
767
  *```js
@@ -1654,17 +1665,39 @@ var EmbedEvent;
1654
1665
  */
1655
1666
  EmbedEvent["ParameterChanged"] = "parameterChanged";
1656
1667
  /**
1657
- * Emitted when the table viz renders.
1658
- * You can use this event as a hook to trigger
1659
- * other events on the rendered table viz data.
1668
+ * Emits when a table visualization is rendered in
1669
+ * the ThoughtSpot embedded app.
1670
+ * You can also use this event as a hook to trigger host events
1671
+ * such as `HostEvent.TransformTableVizData` on the table visualization.
1672
+ * The event payload contains the data used in the rendered table.
1673
+ * You can extract the relevant data from the payload
1674
+ * stored in `payload.data.data.columnDataLite`.
1675
+ * `columnDataLite` is a multidimensional array that contains
1676
+ * data values for each column, which was used in the query to
1677
+ * generate the table visualization. To find and modify specific cell data,
1678
+ * you can either loop through the array or directly access a cell if
1679
+ * you know its position and data index.
1680
+ * In the following code sample, the first cell in the first column
1681
+ * (`columnDataLite[0].dataValue[0]`) is set to `new fob`.
1682
+ * Note that any changes made to the data in the payload will only update the
1683
+ * visual presentation and do not affect the underlying data.
1684
+ * To persist data value modifications after a reload or during chart
1685
+ * interactions such as drill down, ensure that the modified
1686
+ * payload in the `columnDataLite` is passed on to
1687
+ * `HostEvent.TransformTableVizData` and trigger an update to
1688
+ * the table visualization.
1689
+ * If the Row-Level Security (RLS) rules are applied on the
1690
+ * Worksheet or Model, exercise caution when changing column
1691
+ * or table cell values to maintain data security.
1692
+ *
1660
1693
  * @example
1661
1694
  * ```js
1662
1695
  * searchEmbed.on(EmbedEvent.TableVizRendered, (payload) => {
1663
- * console.log(payload);
1664
- * const columnDataLite = payload.data.data.columnDataLite;
1665
- * columnDataLite[0].dataValue[0]="new fob";
1666
- * console.log('>>> new Data', columnDataLite);
1667
- * searchEmbed.trigger(HostEvent.TransformTableVizData, columnDataLite);
1696
+ * console.log(payload);
1697
+ * const columnDataLite = payload.data.data.columnDataLite;
1698
+ * columnDataLite[0].dataValue[0]="new fob";
1699
+ * console.log('>>> new Data', columnDataLite);
1700
+ * searchEmbed.trigger(HostEvent.TransformTableVizData, columnDataLite);
1668
1701
  * })
1669
1702
  * ```
1670
1703
  * @version SDK: 1.35.12 | ThoughtSpot: 10.7.0.cl
@@ -2703,19 +2736,20 @@ var HostEvent;
2703
2736
  */
2704
2737
  HostEvent["UIPassthrough"] = "UiPassthrough";
2705
2738
  /**
2706
- * Triggers the table viz rerender with the updated data.
2739
+ * Triggers the table visualization re-render with the updated data.
2707
2740
  * Includes the following properties:
2708
- * @param - columnDataLite - an array of object containing data
2709
- * transformed from data picked from TableVizRendered event.
2710
- * For example, { columnDataLite: []}
2741
+ * @param - `columnDataLite` - an array of object containing the
2742
+ * data value modifications retrieved from the `EmbedEvent.TableVizRendered`
2743
+ * payload.For example, { columnDataLite: []}`.
2744
+ *
2711
2745
  * @example
2712
2746
  * ```js
2713
2747
  * searchEmbed.on(EmbedEvent.TableVizRendered, (payload) => {
2714
- * console.log(payload);
2715
- * const columnDataLite = payload.data.data.columnDataLite;
2716
- * columnDataLite[0].dataValue[0]="new fob";
2717
- * console.log('>>> new Data', columnDataLite);
2718
- * searchEmbed.trigger(HostEvent.TransformTableVizData, columnDataLite);
2748
+ * console.log(payload);
2749
+ * const columnDataLite = payload.data.data.columnDataLite;
2750
+ * columnDataLite[0].dataValue[0]="new fob";
2751
+ * console.log('>>> new Data', columnDataLite);
2752
+ * searchEmbed.trigger(HostEvent.TransformTableVizData, columnDataLite);
2719
2753
  * })
2720
2754
  * ```
2721
2755
  * @version SDK: 1.35.12 | ThoughtSpot: 10.7.0.cl
@@ -6521,6 +6555,7 @@ const ERROR_MESSAGE = {
6521
6555
  CSP_VIOLATION_ALERT: 'CSP violation detected. Please check the console errors for more details.',
6522
6556
  CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE: 'Please set up CSP correctly for the application to start working. For more information, see https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts. \n If the issue persists, refer to https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts',
6523
6557
  MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
6558
+ RENDER_CALLED_BEFORE_INIT: 'Looks like render was called before calling init, the render won\'t start until init is called.\nFor more info check\n1. https://developers.thoughtspot.com/docs/Function_init#_init\n2.https://developers.thoughtspot.com/docs/getting-started#initSdk',
6524
6559
  };
6525
6560
 
6526
6561
  const EndPoints = {
@@ -7345,7 +7380,7 @@ class AnswerService {
7345
7380
  async getTML() {
7346
7381
  const { object } = await this.executeQuery(getAnswerTML, {});
7347
7382
  const edoc = object[0].edoc;
7348
- const YAML = await import('./index-BJx3m5_V.js');
7383
+ const YAML = await import('./index-Cyvfex-A.js');
7349
7384
  const parsedDoc = YAML.parse(edoc);
7350
7385
  return {
7351
7386
  answer: {
@@ -14745,6 +14780,18 @@ const authenticate = async (embedConfig) => {
14745
14780
  }
14746
14781
  };
14747
14782
 
14783
+ if (typeof Promise.withResolvers === 'undefined') {
14784
+ Promise.withResolvers = () => {
14785
+ let resolve;
14786
+ let reject;
14787
+ const promise = new Promise((res, rej) => {
14788
+ resolve = res;
14789
+ reject = rej;
14790
+ });
14791
+ return { promise, resolve, reject };
14792
+ };
14793
+ }
14794
+
14748
14795
  /* eslint-disable camelcase */
14749
14796
  /* eslint-disable import/no-mutable-exports */
14750
14797
  /**
@@ -14851,6 +14898,25 @@ function backwardCompat(embedConfig) {
14851
14898
  }
14852
14899
  return newConfig;
14853
14900
  }
14901
+ const initFlagKey = 'initFlagKey';
14902
+ const createAndSetInitPromise = () => {
14903
+ const { promise: initPromise, resolve: initPromiseResolve,
14904
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
14905
+ // @ts-ignore
14906
+ } = Promise.withResolvers();
14907
+ const initFlagStore = {
14908
+ initPromise,
14909
+ isInitCalled: false,
14910
+ initPromiseResolve,
14911
+ };
14912
+ storeValueInWindow(initFlagKey, initFlagStore, {
14913
+ // In case of diff imports the promise might be already set
14914
+ ignoreIfAlreadyExists: true,
14915
+ });
14916
+ };
14917
+ createAndSetInitPromise();
14918
+ const getInitPromise = () => { var _a; return (_a = getValueFromWindow(initFlagKey)) === null || _a === void 0 ? void 0 : _a.initPromise; };
14919
+ const getIsInitCalled = () => { var _a; return !!((_a = getValueFromWindow(initFlagKey)) === null || _a === void 0 ? void 0 : _a.isInitCalled); };
14854
14920
  /**
14855
14921
  * Initializes the Visual Embed SDK globally and perform
14856
14922
  * authentication if applicable. This function needs to be called before any ThoughtSpot
@@ -14897,6 +14963,9 @@ const init = (embedConfig) => {
14897
14963
  if (getEmbedConfig().callPrefetch) {
14898
14964
  prefetch(getEmbedConfig().thoughtSpotHost);
14899
14965
  }
14966
+ // Resolves the promise created in the initPromiseKey
14967
+ getValueFromWindow(initFlagKey).initPromiseResolve(authEE);
14968
+ getValueFromWindow(initFlagKey).isInitCalled = true;
14900
14969
  return authEE;
14901
14970
  };
14902
14971
  /**
@@ -15167,7 +15236,7 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
15167
15236
  return e;
15168
15237
  }
15169
15238
 
15170
- var name="@thoughtspot/visual-embed-sdk";var version$1="1.36.3";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};
15239
+ var name="@thoughtspot/visual-embed-sdk";var version$1="1.36.5";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};
15171
15240
 
15172
15241
  /**
15173
15242
  * Reloads the ThoughtSpot iframe.
@@ -15476,13 +15545,6 @@ class TsEmbed {
15476
15545
  }
15477
15546
  };
15478
15547
  this.el = getDOMNode(domSelector);
15479
- // TODO: handle error
15480
- this.embedConfig = getEmbedConfig();
15481
- if (!this.embedConfig.authTriggerContainer && !this.embedConfig.useEventForSAMLPopup) {
15482
- this.embedConfig.authTriggerContainer = domSelector;
15483
- }
15484
- this.thoughtSpotHost = getThoughtSpotHost(this.embedConfig);
15485
- this.thoughtSpotV2Base = getV2BasePath(this.embedConfig);
15486
15548
  this.eventHandlerMap = new Map();
15487
15549
  this.isError = false;
15488
15550
  this.viewConfig = {
@@ -15490,12 +15552,21 @@ class TsEmbed {
15490
15552
  excludeRuntimeParametersfromURL: false,
15491
15553
  ...viewConfig,
15492
15554
  };
15493
- this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
15494
15555
  this.registerAppInit();
15495
15556
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
15496
15557
  ...viewConfig,
15497
15558
  });
15498
15559
  this.hostEventClient = new HostEventClient(this.iFrame);
15560
+ this.isReadyForRenderPromise = getInitPromise().then(async () => {
15561
+ const embedConfig = getEmbedConfig();
15562
+ this.embedConfig = embedConfig;
15563
+ if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
15564
+ this.embedConfig.authTriggerContainer = domSelector;
15565
+ }
15566
+ this.thoughtSpotHost = getThoughtSpotHost(embedConfig);
15567
+ this.thoughtSpotV2Base = getV2BasePath(embedConfig);
15568
+ this.shouldEncodeUrlQueryParams = embedConfig.shouldEncodeUrlQueryParams;
15569
+ });
15499
15570
  }
15500
15571
  /**
15501
15572
  * Throws error encountered during initialization.
@@ -16213,6 +16284,10 @@ class TsEmbed {
16213
16284
  * @param args
16214
16285
  */
16215
16286
  async render() {
16287
+ if (!getIsInitCalled()) {
16288
+ logger$3.error(ERROR_MESSAGE.RENDER_CALLED_BEFORE_INIT);
16289
+ }
16290
+ await this.isReadyForRenderPromise;
16216
16291
  this.isRendered = true;
16217
16292
  return this;
16218
16293
  }
@@ -16220,21 +16295,20 @@ class TsEmbed {
16220
16295
  return '';
16221
16296
  }
16222
16297
  handleRenderForPrerender() {
16223
- this.render();
16298
+ return this.render();
16224
16299
  }
16225
16300
  /**
16226
16301
  * Creates the preRender shell
16227
16302
  * @param showPreRenderByDefault - Show the preRender after render, hidden by default
16228
16303
  */
16229
- preRender(showPreRenderByDefault = false) {
16304
+ async preRender(showPreRenderByDefault = false) {
16230
16305
  if (!this.viewConfig.preRenderId) {
16231
16306
  logger$3.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
16232
16307
  return this;
16233
16308
  }
16234
16309
  this.isPreRendered = true;
16235
16310
  this.showPreRenderByDefault = showPreRenderByDefault;
16236
- this.handleRenderForPrerender();
16237
- return this;
16311
+ return this.handleRenderForPrerender();
16238
16312
  }
16239
16313
  /**
16240
16314
  * Get the Post Url Params for THOUGHTSPOT from the current
@@ -16287,6 +16361,10 @@ class TsEmbed {
16287
16361
  * @returns
16288
16362
  */
16289
16363
  async prerenderGeneric() {
16364
+ if (!getIsInitCalled()) {
16365
+ logger$3.error(ERROR_MESSAGE.RENDER_CALLED_BEFORE_INIT);
16366
+ }
16367
+ await this.isReadyForRenderPromise;
16290
16368
  const prerenderFrameSrc = this.getRootIframeSrc();
16291
16369
  this.isRendered = true;
16292
16370
  return this.renderIFrame(prerenderFrameSrc);
@@ -16300,17 +16378,16 @@ class TsEmbed {
16300
16378
  * Also, synchronizes the style of the PreRender component with the embedding
16301
16379
  * element.
16302
16380
  */
16303
- showPreRender() {
16381
+ async showPreRender() {
16304
16382
  if (!this.viewConfig.preRenderId) {
16305
16383
  logger$3.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
16306
- return;
16384
+ return this;
16307
16385
  }
16308
16386
  if (!this.isPreRenderAvailable()) {
16309
16387
  const isAvailable = this.connectPreRendered();
16310
16388
  if (!isAvailable) {
16311
16389
  // if the Embed component is not preRendered , Render it now and
16312
- this.preRender(true);
16313
- return;
16390
+ return this.preRender(true);
16314
16391
  }
16315
16392
  this.validatePreRenderViewConfig(this.viewConfig);
16316
16393
  }
@@ -16333,6 +16410,7 @@ class TsEmbed {
16333
16410
  this.beforePrerenderVisible();
16334
16411
  removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
16335
16412
  this.subscribeToEvents();
16413
+ return this;
16336
16414
  }
16337
16415
  /**
16338
16416
  * Synchronizes the style properties of the PreRender component with the embedding
@@ -16750,7 +16828,7 @@ class AppEmbed extends V1Embed {
16750
16828
  * to be embedded.
16751
16829
  */
16752
16830
  async render() {
16753
- super.render();
16831
+ await super.render();
16754
16832
  const src = this.getIFrameSrc();
16755
16833
  await this.renderV1Embed(src);
16756
16834
  return this;
@@ -17029,12 +17107,11 @@ class LiveboardEmbed extends V1Embed {
17029
17107
  this.navigateToLiveboard(libId);
17030
17108
  }
17031
17109
  }
17032
- handleRenderForPrerender() {
17110
+ async handleRenderForPrerender() {
17033
17111
  if (isUndefined$1(this.viewConfig.liveboardId)) {
17034
- this.prerenderGeneric();
17035
- return;
17112
+ return this.prerenderGeneric();
17036
17113
  }
17037
- super.handleRenderForPrerender();
17114
+ return super.handleRenderForPrerender();
17038
17115
  }
17039
17116
  /**
17040
17117
  * Triggers an event to the embedded app
@@ -17059,7 +17136,7 @@ class LiveboardEmbed extends V1Embed {
17059
17136
  * visualization ID and the runtime filters.
17060
17137
  */
17061
17138
  async render() {
17062
- super.render();
17139
+ await super.render();
17063
17140
  const src = this.getIFrameSrc();
17064
17141
  await this.renderV1Embed(src);
17065
17142
  this.showPreviewLoader();
@@ -17267,7 +17344,7 @@ class SearchEmbed extends TsEmbed {
17267
17344
  * Render the embedded ThoughtSpot search
17268
17345
  */
17269
17346
  async render() {
17270
- super.render();
17347
+ await super.render();
17271
17348
  this.viewConfig;
17272
17349
  const src = this.getIFrameSrc();
17273
17350
  await this.renderIFrame(src);
@@ -17334,7 +17411,7 @@ class SearchBarEmbed extends TsEmbed {
17334
17411
  * Render the embedded ThoughtSpot search
17335
17412
  */
17336
17413
  async render() {
17337
- super.render();
17414
+ await super.render();
17338
17415
  const src = this.getIFrameSrc();
17339
17416
  await this.renderIFrame(src);
17340
17417
  return this;
@@ -17758,7 +17835,7 @@ class ConversationMessage extends TsEmbed {
17758
17835
  return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
17759
17836
  }
17760
17837
  async render() {
17761
- super.render();
17838
+ await super.render();
17762
17839
  const src = this.getIframeSrc();
17763
17840
  await this.renderIFrame(src);
17764
17841
  return this;
@@ -17886,7 +17963,7 @@ class ConversationEmbed extends TsEmbed {
17886
17963
  return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
17887
17964
  }
17888
17965
  async render() {
17889
- super.render();
17966
+ await super.render();
17890
17967
  const src = this.getIframeSrc();
17891
17968
  await this.renderIFrame(src);
17892
17969
  return this;
@@ -17962,7 +18039,7 @@ class SageEmbed extends V1Embed {
17962
18039
  * @returns {SageEmbed} Eureka/Sage embed
17963
18040
  */
17964
18041
  async render() {
17965
- super.render();
18042
+ await super.render();
17966
18043
  const src = this.getIFrameSrc();
17967
18044
  await this.renderV1Embed(src);
17968
18045
  return this;