@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.
- package/cjs/package.json +1 -1
- package/cjs/src/css-variables.d.ts +1 -1
- package/cjs/src/css-variables.d.ts.map +1 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +1 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/base.d.ts +4 -0
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +27 -1
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/cjs/src/embed/bodyless-conversation.js +1 -1
- package/cjs/src/embed/bodyless-conversation.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +1 -1
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/embedConfig.d.ts.map +1 -1
- package/cjs/src/embed/embedConfig.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +2 -2
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +4 -5
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +11 -11
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +1 -1
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/search-bar.d.ts.map +1 -1
- package/cjs/src/embed/search-bar.js +1 -1
- package/cjs/src/embed/search-bar.js.map +1 -1
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +1 -1
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +4 -3
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +25 -16
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +71 -5
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/errors.d.ts +1 -0
- package/cjs/src/errors.d.ts.map +1 -1
- package/cjs/src/errors.js +1 -0
- package/cjs/src/errors.js.map +1 -1
- package/cjs/src/react/all-types-export.d.ts +1 -1
- package/cjs/src/react/all-types-export.d.ts.map +1 -1
- package/cjs/src/react/all-types-export.js +2 -1
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/react/index.d.ts +16 -0
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +25 -2
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/types.d.ts +43 -19
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +43 -19
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/with-resolvers-polyfill.d.ts +1 -0
- package/cjs/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
- package/cjs/src/utils/with-resolvers-polyfill.js +12 -0
- package/cjs/src/utils/with-resolvers-polyfill.js.map +1 -0
- package/cjs/src/utils.d.ts +17 -2
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +27 -3
- package/cjs/src/utils.js.map +1 -1
- package/dist/{index-BJx3m5_V.js → index-Cyvfex-A.js} +1 -1
- package/dist/src/css-variables.d.ts +1 -1
- package/dist/src/css-variables.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +4 -0
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/embedConfig.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +2 -2
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +4 -3
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/dist/src/errors.d.ts +1 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/react/all-types-export.d.ts +1 -1
- package/dist/src/react/all-types-export.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +16 -0
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +43 -19
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/with-resolvers-polyfill.d.ts +1 -0
- package/dist/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
- package/dist/src/utils.d.ts +17 -2
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +392 -64
- package/dist/tsembed-react.js +390 -61
- package/dist/tsembed.es.js +128 -51
- package/dist/tsembed.js +127 -50
- package/dist/visual-embed-sdk-react-full.d.ts +1277 -1234
- package/dist/visual-embed-sdk-react.d.ts +711 -668
- package/dist/visual-embed-sdk.d.ts +53 -24
- package/lib/package.json +1 -1
- package/lib/src/css-variables.d.ts +1 -1
- package/lib/src/css-variables.d.ts.map +1 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +1 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/base.d.ts +4 -0
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +24 -1
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/lib/src/embed/bodyless-conversation.js +1 -1
- package/lib/src/embed/bodyless-conversation.js.map +1 -1
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +1 -1
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/embedConfig.d.ts.map +1 -1
- package/lib/src/embed/embedConfig.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +2 -2
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +4 -5
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +11 -11
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +1 -1
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +1 -1
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +1 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +4 -3
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +26 -17
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +71 -5
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts +1 -0
- package/lib/src/errors.d.ts.map +1 -1
- package/lib/src/errors.js +1 -0
- package/lib/src/errors.js.map +1 -1
- package/lib/src/react/all-types-export.d.ts +1 -1
- package/lib/src/react/all-types-export.d.ts.map +1 -1
- package/lib/src/react/all-types-export.js +1 -1
- package/lib/src/react/all-types-export.js.map +1 -1
- package/lib/src/react/index.d.ts +16 -0
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +23 -1
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/types.d.ts +43 -19
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +43 -19
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/with-resolvers-polyfill.d.ts +1 -0
- package/lib/src/utils/with-resolvers-polyfill.d.ts.map +1 -0
- package/lib/src/utils/with-resolvers-polyfill.js +12 -0
- package/lib/src/utils/with-resolvers-polyfill.js.map +1 -0
- package/lib/src/utils.d.ts +17 -2
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +25 -2
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +54 -25
- package/package.json +1 -1
- package/src/css-variables.ts +1 -1
- package/src/embed/app.ts +2 -1
- package/src/embed/base.ts +41 -1
- package/src/embed/bodyless-conversation.ts +2 -1
- package/src/embed/conversation.ts +2 -1
- package/src/embed/embedConfig.ts +1 -1
- package/src/embed/liveboard.spec.ts +11 -11
- package/src/embed/liveboard.ts +5 -6
- package/src/embed/sage.ts +1 -2
- package/src/embed/search-bar.tsx +1 -2
- package/src/embed/search.ts +1 -2
- package/src/embed/ts-embed.spec.ts +83 -5
- package/src/embed/ts-embed.ts +33 -17
- package/src/errors.ts +1 -0
- package/src/react/all-types-export.ts +1 -0
- package/src/react/index.tsx +27 -2
- package/src/types.ts +43 -19
- package/src/utils/with-resolvers-polyfill.ts +11 -0
- package/src/utils.ts +35 -4
package/dist/tsembed-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.36.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.36.5 */
|
|
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) :
|
|
@@ -483,13 +483,23 @@
|
|
|
483
483
|
* Stores a value in the global `window` object under the `_tsEmbedSDK` namespace.
|
|
484
484
|
* @param key - The key under which the value will be stored.
|
|
485
485
|
* @param value - The value to store.
|
|
486
|
+
* @param options - Additional options.
|
|
487
|
+
* @param options.ignoreIfAlreadyExists - Does not set if value for key is set.
|
|
488
|
+
*
|
|
489
|
+
* @returns The stored value.
|
|
490
|
+
*
|
|
491
|
+
* @version SDK: 1.36.2 | ThoughtSpot: *
|
|
486
492
|
*/
|
|
487
|
-
|
|
493
|
+
function storeValueInWindow(key, value, options = {}) {
|
|
488
494
|
if (!window[sdkWindowKey]) {
|
|
489
495
|
window[sdkWindowKey] = {};
|
|
490
496
|
}
|
|
497
|
+
if (options.ignoreIfAlreadyExists && key in window[sdkWindowKey]) {
|
|
498
|
+
return window[sdkWindowKey][key];
|
|
499
|
+
}
|
|
491
500
|
window[sdkWindowKey][key] = value;
|
|
492
|
-
|
|
501
|
+
return value;
|
|
502
|
+
}
|
|
493
503
|
/**
|
|
494
504
|
* Retrieves a stored value from the global `window` object under the `_tsEmbedSDK` namespace.
|
|
495
505
|
* @param key - The key whose value needs to be retrieved.
|
|
@@ -886,8 +896,9 @@
|
|
|
886
896
|
*/
|
|
887
897
|
EmbedEvent["Load"] = "load";
|
|
888
898
|
/**
|
|
889
|
-
* Data pertaining to an Answer or Liveboard is received
|
|
890
|
-
*
|
|
899
|
+
* Data pertaining to an Answer or Liveboard is received.
|
|
900
|
+
* The event payload includes the raw data of the object.
|
|
901
|
+
* @return data - Answer of Liveboard data
|
|
891
902
|
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
892
903
|
* @example
|
|
893
904
|
*```js
|
|
@@ -1791,17 +1802,39 @@
|
|
|
1791
1802
|
*/
|
|
1792
1803
|
EmbedEvent["ParameterChanged"] = "parameterChanged";
|
|
1793
1804
|
/**
|
|
1794
|
-
*
|
|
1795
|
-
*
|
|
1796
|
-
*
|
|
1805
|
+
* Emits when a table visualization is rendered in
|
|
1806
|
+
* the ThoughtSpot embedded app.
|
|
1807
|
+
* You can also use this event as a hook to trigger host events
|
|
1808
|
+
* such as `HostEvent.TransformTableVizData` on the table visualization.
|
|
1809
|
+
* The event payload contains the data used in the rendered table.
|
|
1810
|
+
* You can extract the relevant data from the payload
|
|
1811
|
+
* stored in `payload.data.data.columnDataLite`.
|
|
1812
|
+
* `columnDataLite` is a multidimensional array that contains
|
|
1813
|
+
* data values for each column, which was used in the query to
|
|
1814
|
+
* generate the table visualization. To find and modify specific cell data,
|
|
1815
|
+
* you can either loop through the array or directly access a cell if
|
|
1816
|
+
* you know its position and data index.
|
|
1817
|
+
* In the following code sample, the first cell in the first column
|
|
1818
|
+
* (`columnDataLite[0].dataValue[0]`) is set to `new fob`.
|
|
1819
|
+
* Note that any changes made to the data in the payload will only update the
|
|
1820
|
+
* visual presentation and do not affect the underlying data.
|
|
1821
|
+
* To persist data value modifications after a reload or during chart
|
|
1822
|
+
* interactions such as drill down, ensure that the modified
|
|
1823
|
+
* payload in the `columnDataLite` is passed on to
|
|
1824
|
+
* `HostEvent.TransformTableVizData` and trigger an update to
|
|
1825
|
+
* the table visualization.
|
|
1826
|
+
* If the Row-Level Security (RLS) rules are applied on the
|
|
1827
|
+
* Worksheet or Model, exercise caution when changing column
|
|
1828
|
+
* or table cell values to maintain data security.
|
|
1829
|
+
*
|
|
1797
1830
|
* @example
|
|
1798
1831
|
* ```js
|
|
1799
1832
|
* searchEmbed.on(EmbedEvent.TableVizRendered, (payload) => {
|
|
1800
|
-
*
|
|
1801
|
-
*
|
|
1802
|
-
*
|
|
1803
|
-
*
|
|
1804
|
-
*
|
|
1833
|
+
* console.log(payload);
|
|
1834
|
+
* const columnDataLite = payload.data.data.columnDataLite;
|
|
1835
|
+
* columnDataLite[0].dataValue[0]="new fob";
|
|
1836
|
+
* console.log('>>> new Data', columnDataLite);
|
|
1837
|
+
* searchEmbed.trigger(HostEvent.TransformTableVizData, columnDataLite);
|
|
1805
1838
|
* })
|
|
1806
1839
|
* ```
|
|
1807
1840
|
* @version SDK: 1.35.12 | ThoughtSpot: 10.7.0.cl
|
|
@@ -2840,19 +2873,20 @@
|
|
|
2840
2873
|
*/
|
|
2841
2874
|
HostEvent["UIPassthrough"] = "UiPassthrough";
|
|
2842
2875
|
/**
|
|
2843
|
-
* Triggers the table
|
|
2876
|
+
* Triggers the table visualization re-render with the updated data.
|
|
2844
2877
|
* Includes the following properties:
|
|
2845
|
-
* @param - columnDataLite - an array of object containing
|
|
2846
|
-
*
|
|
2847
|
-
* For example, { columnDataLite: []}
|
|
2878
|
+
* @param - `columnDataLite` - an array of object containing the
|
|
2879
|
+
* data value modifications retrieved from the `EmbedEvent.TableVizRendered`
|
|
2880
|
+
* payload.For example, { columnDataLite: []}`.
|
|
2881
|
+
*
|
|
2848
2882
|
* @example
|
|
2849
2883
|
* ```js
|
|
2850
2884
|
* searchEmbed.on(EmbedEvent.TableVizRendered, (payload) => {
|
|
2851
|
-
*
|
|
2852
|
-
*
|
|
2853
|
-
*
|
|
2854
|
-
*
|
|
2855
|
-
*
|
|
2885
|
+
* console.log(payload);
|
|
2886
|
+
* const columnDataLite = payload.data.data.columnDataLite;
|
|
2887
|
+
* columnDataLite[0].dataValue[0]="new fob";
|
|
2888
|
+
* console.log('>>> new Data', columnDataLite);
|
|
2889
|
+
* searchEmbed.trigger(HostEvent.TransformTableVizData, columnDataLite);
|
|
2856
2890
|
* })
|
|
2857
2891
|
* ```
|
|
2858
2892
|
* @version SDK: 1.35.12 | ThoughtSpot: 10.7.0.cl
|
|
@@ -6579,6 +6613,9 @@
|
|
|
6579
6613
|
[exports.LogLevel.TRACE]: console.trace,
|
|
6580
6614
|
};
|
|
6581
6615
|
let globalLogLevelOverride = exports.LogLevel.TRACE;
|
|
6616
|
+
const setGlobalLogLevelOverride = (logLevel) => {
|
|
6617
|
+
globalLogLevelOverride = logLevel;
|
|
6618
|
+
};
|
|
6582
6619
|
const logLevelToNumber = {
|
|
6583
6620
|
[exports.LogLevel.SILENT]: 0,
|
|
6584
6621
|
[exports.LogLevel.ERROR]: 1,
|
|
@@ -6655,6 +6692,7 @@
|
|
|
6655
6692
|
CSP_VIOLATION_ALERT: 'CSP violation detected. Please check the console errors for more details.',
|
|
6656
6693
|
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',
|
|
6657
6694
|
MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
|
|
6695
|
+
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',
|
|
6658
6696
|
};
|
|
6659
6697
|
|
|
6660
6698
|
const EndPoints = {
|
|
@@ -6861,7 +6899,18 @@
|
|
|
6861
6899
|
* @version SDK: 1.19.0 | ThoughtSpot: *
|
|
6862
6900
|
* @group Global methods
|
|
6863
6901
|
*/
|
|
6864
|
-
const getEmbedConfig = () => getValueFromWindow(configKey) || {};
|
|
6902
|
+
const getEmbedConfig = () => getValueFromWindow(configKey) || {};
|
|
6903
|
+
/**
|
|
6904
|
+
* Sets the configuration embed was initialized with.
|
|
6905
|
+
* And returns the new configuration.
|
|
6906
|
+
* @param newConfig The configuration to set.
|
|
6907
|
+
* @version SDK: 1.27.0 | ThoughtSpot: *
|
|
6908
|
+
* @group Global methods
|
|
6909
|
+
*/
|
|
6910
|
+
const setEmbedConfig = (newConfig) => {
|
|
6911
|
+
storeValueInWindow(configKey, newConfig);
|
|
6912
|
+
return getValueFromWindow(configKey);
|
|
6913
|
+
};
|
|
6865
6914
|
|
|
6866
6915
|
/**
|
|
6867
6916
|
* Fetch wrapper that adds the authentication token to the request.
|
|
@@ -13849,7 +13898,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
13849
13898
|
}
|
|
13850
13899
|
}
|
|
13851
13900
|
|
|
13852
|
-
createCommonjsModule(function (module) {
|
|
13901
|
+
var eventemitter3 = createCommonjsModule(function (module) {
|
|
13853
13902
|
|
|
13854
13903
|
var has = Object.prototype.hasOwnProperty
|
|
13855
13904
|
, prefix = '~';
|
|
@@ -14192,7 +14241,52 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14192
14241
|
ReportType["CSP_VIOLATION"] = "csp-violation";
|
|
14193
14242
|
ReportType["DEPRECATION"] = "deprecation";
|
|
14194
14243
|
ReportType["INTERVENTION"] = "intervention";
|
|
14195
|
-
})(ReportType || (ReportType = {}));
|
|
14244
|
+
})(ReportType || (ReportType = {}));
|
|
14245
|
+
let globalObserver = null;
|
|
14246
|
+
/**
|
|
14247
|
+
* Register a global ReportingObserver to capture all unhandled errors
|
|
14248
|
+
* @param overrideExisting boolean to override existing observer
|
|
14249
|
+
* @returns ReportingObserver | null
|
|
14250
|
+
*/
|
|
14251
|
+
function registerReportingObserver(overrideExisting = false) {
|
|
14252
|
+
if (!(window.ReportingObserver)) {
|
|
14253
|
+
logger$3.warn(ERROR_MESSAGE.MISSING_REPORTING_OBSERVER);
|
|
14254
|
+
return null;
|
|
14255
|
+
}
|
|
14256
|
+
if (overrideExisting) {
|
|
14257
|
+
resetGlobalReportingObserver();
|
|
14258
|
+
}
|
|
14259
|
+
if (globalObserver) {
|
|
14260
|
+
return globalObserver;
|
|
14261
|
+
}
|
|
14262
|
+
const embedConfig = getEmbedConfig();
|
|
14263
|
+
globalObserver = new ReportingObserver((reports) => {
|
|
14264
|
+
reports.forEach((report) => {
|
|
14265
|
+
const { type, url, body } = report;
|
|
14266
|
+
const reportBody = body;
|
|
14267
|
+
const isThoughtSpotHost = url
|
|
14268
|
+
&& url.startsWith(embedConfig.thoughtSpotHost);
|
|
14269
|
+
const isFrameHostError = type === ReportType.CSP_VIOLATION
|
|
14270
|
+
&& reportBody.effectiveDirective === 'frame-ancestors';
|
|
14271
|
+
if (isThoughtSpotHost && isFrameHostError) {
|
|
14272
|
+
if (!embedConfig.suppressErrorAlerts) {
|
|
14273
|
+
alert(ERROR_MESSAGE.CSP_VIOLATION_ALERT);
|
|
14274
|
+
}
|
|
14275
|
+
logger$3.error(ERROR_MESSAGE.CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE);
|
|
14276
|
+
}
|
|
14277
|
+
});
|
|
14278
|
+
}, { buffered: true });
|
|
14279
|
+
globalObserver.observe();
|
|
14280
|
+
return globalObserver;
|
|
14281
|
+
}
|
|
14282
|
+
/**
|
|
14283
|
+
* Resets the global ReportingObserver
|
|
14284
|
+
*/
|
|
14285
|
+
function resetGlobalReportingObserver() {
|
|
14286
|
+
if (globalObserver)
|
|
14287
|
+
globalObserver.disconnect();
|
|
14288
|
+
globalObserver = null;
|
|
14289
|
+
}
|
|
14196
14290
|
|
|
14197
14291
|
/**
|
|
14198
14292
|
*
|
|
@@ -14374,7 +14468,45 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14374
14468
|
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
14375
14469
|
...sessionInfoResp,
|
|
14376
14470
|
};
|
|
14377
|
-
};
|
|
14471
|
+
};
|
|
14472
|
+
/**
|
|
14473
|
+
* Resets the cached session info object and forces a new fetch on the next call.
|
|
14474
|
+
* @example ```js
|
|
14475
|
+
* resetCachedSessionInfo();
|
|
14476
|
+
* const sessionInfo = await getSessionInfo();
|
|
14477
|
+
* console.log(sessionInfo);
|
|
14478
|
+
* ```
|
|
14479
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
14480
|
+
* @returns {void}
|
|
14481
|
+
*/
|
|
14482
|
+
function resetCachedSessionInfo() {
|
|
14483
|
+
sessionInfo = null;
|
|
14484
|
+
}
|
|
14485
|
+
/**
|
|
14486
|
+
* Resets the cached preauth info object and forces a new fetch on the next call.
|
|
14487
|
+
* @example ```js
|
|
14488
|
+
* resetCachedPreauthInfo();
|
|
14489
|
+
* const preauthInfo = await getPreauthInfo();
|
|
14490
|
+
* console.log(preauthInfo);
|
|
14491
|
+
* ```
|
|
14492
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
14493
|
+
* @returns {void}
|
|
14494
|
+
*/
|
|
14495
|
+
function resetCachedPreauthInfo() {
|
|
14496
|
+
preauthInfo = null;
|
|
14497
|
+
}
|
|
14498
|
+
|
|
14499
|
+
/**
|
|
14500
|
+
* This function resets all the services that are cached in the SDK.
|
|
14501
|
+
* This is to be called when the user logs out of the application and also
|
|
14502
|
+
* when init is called again.
|
|
14503
|
+
* @version SDK: 1.30.2 | ThoughtSpot: *
|
|
14504
|
+
*/
|
|
14505
|
+
function resetAllCachedServices() {
|
|
14506
|
+
resetCachedAuthToken();
|
|
14507
|
+
resetCachedSessionInfo();
|
|
14508
|
+
resetCachedPreauthInfo();
|
|
14509
|
+
}
|
|
14378
14510
|
|
|
14379
14511
|
// eslint-disable-next-line import/no-mutable-exports
|
|
14380
14512
|
let loggedInStatus = false;
|
|
@@ -14444,42 +14576,61 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14444
14576
|
*/
|
|
14445
14577
|
AuthEvent["TRIGGER_SSO_POPUP"] = "TRIGGER_SSO_POPUP";
|
|
14446
14578
|
})(AuthEvent || (AuthEvent = {}));
|
|
14579
|
+
let authEE;
|
|
14580
|
+
/**
|
|
14581
|
+
*
|
|
14582
|
+
* @param eventEmitter
|
|
14583
|
+
*/
|
|
14584
|
+
function setAuthEE(eventEmitter) {
|
|
14585
|
+
authEE = eventEmitter;
|
|
14586
|
+
}
|
|
14447
14587
|
/**
|
|
14448
14588
|
*
|
|
14449
14589
|
*/
|
|
14450
14590
|
function notifyAuthSDKSuccess() {
|
|
14451
|
-
{
|
|
14591
|
+
if (!authEE) {
|
|
14452
14592
|
logger$3.error(ERROR_MESSAGE.SDK_NOT_INITIALIZED);
|
|
14453
14593
|
return;
|
|
14454
14594
|
}
|
|
14595
|
+
authEE.emit(AuthStatus.SDK_SUCCESS);
|
|
14455
14596
|
}
|
|
14456
14597
|
/**
|
|
14457
14598
|
*
|
|
14458
14599
|
*/
|
|
14459
14600
|
async function notifyAuthSuccess() {
|
|
14460
|
-
{
|
|
14601
|
+
if (!authEE) {
|
|
14461
14602
|
logger$3.error(ERROR_MESSAGE.SDK_NOT_INITIALIZED);
|
|
14462
14603
|
return;
|
|
14463
14604
|
}
|
|
14605
|
+
try {
|
|
14606
|
+
getPreauthInfo();
|
|
14607
|
+
const sessionInfo = await getSessionInfo();
|
|
14608
|
+
authEE.emit(AuthStatus.SUCCESS, sessionInfo);
|
|
14609
|
+
}
|
|
14610
|
+
catch (e) {
|
|
14611
|
+
logger$3.error(ERROR_MESSAGE.SESSION_INFO_FAILED);
|
|
14612
|
+
}
|
|
14464
14613
|
}
|
|
14465
14614
|
/**
|
|
14466
14615
|
*
|
|
14467
14616
|
* @param failureType
|
|
14468
14617
|
*/
|
|
14469
14618
|
function notifyAuthFailure(failureType) {
|
|
14470
|
-
{
|
|
14619
|
+
if (!authEE) {
|
|
14471
14620
|
logger$3.error(ERROR_MESSAGE.SDK_NOT_INITIALIZED);
|
|
14472
14621
|
return;
|
|
14473
14622
|
}
|
|
14623
|
+
authEE.emit(AuthStatus.FAILURE, failureType);
|
|
14474
14624
|
}
|
|
14475
14625
|
/**
|
|
14476
14626
|
*
|
|
14477
14627
|
*/
|
|
14478
14628
|
function notifyLogout() {
|
|
14479
|
-
{
|
|
14629
|
+
if (!authEE) {
|
|
14480
14630
|
logger$3.error(ERROR_MESSAGE.SDK_NOT_INITIALIZED);
|
|
14481
14631
|
return;
|
|
14482
14632
|
}
|
|
14633
|
+
authEE.emit(AuthStatus.LOGOUT);
|
|
14483
14634
|
}
|
|
14484
14635
|
/**
|
|
14485
14636
|
* Check if we are logged into the ThoughtSpot cluster
|
|
@@ -14640,6 +14791,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14640
14791
|
samlAuthWindow.focus();
|
|
14641
14792
|
}
|
|
14642
14793
|
};
|
|
14794
|
+
authEE === null || authEE === void 0 ? void 0 : authEE.emit(AuthStatus.WAITING_FOR_POPUP);
|
|
14643
14795
|
const containerEl = getDOMNode(triggerContainer);
|
|
14644
14796
|
if (containerEl) {
|
|
14645
14797
|
containerEl.innerHTML = '<button id="ts-auth-btn" class="ts-auth-btn" style="margin: auto;"></button>';
|
|
@@ -14655,6 +14807,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14655
14807
|
}
|
|
14656
14808
|
});
|
|
14657
14809
|
});
|
|
14810
|
+
authEE === null || authEE === void 0 ? void 0 : authEE.once(AuthEvent.TRIGGER_SSO_POPUP, openPopup);
|
|
14658
14811
|
return samlCompletionPromise;
|
|
14659
14812
|
}
|
|
14660
14813
|
/**
|
|
@@ -14738,6 +14891,18 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14738
14891
|
}
|
|
14739
14892
|
};
|
|
14740
14893
|
|
|
14894
|
+
if (typeof Promise.withResolvers === 'undefined') {
|
|
14895
|
+
Promise.withResolvers = () => {
|
|
14896
|
+
let resolve;
|
|
14897
|
+
let reject;
|
|
14898
|
+
const promise = new Promise((res, rej) => {
|
|
14899
|
+
resolve = res;
|
|
14900
|
+
reject = rej;
|
|
14901
|
+
});
|
|
14902
|
+
return { promise, resolve, reject };
|
|
14903
|
+
};
|
|
14904
|
+
}
|
|
14905
|
+
|
|
14741
14906
|
/* eslint-disable camelcase */
|
|
14742
14907
|
/* eslint-disable import/no-mutable-exports */
|
|
14743
14908
|
/**
|
|
@@ -14747,12 +14912,12 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14747
14912
|
* @summary Base classes
|
|
14748
14913
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
14749
14914
|
*/
|
|
14750
|
-
|
|
14915
|
+
const CONFIG_DEFAULTS = {
|
|
14751
14916
|
loginFailedMessage: 'Not logged in',
|
|
14752
14917
|
authTriggerText: 'Authorize',
|
|
14753
14918
|
authType: AuthType.None,
|
|
14754
14919
|
logLevel: exports.LogLevel.ERROR,
|
|
14755
|
-
}
|
|
14920
|
+
};
|
|
14756
14921
|
let authPromise;
|
|
14757
14922
|
const getAuthPromise = () => authPromise;
|
|
14758
14923
|
/**
|
|
@@ -14774,12 +14939,146 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14774
14939
|
});
|
|
14775
14940
|
return authPromise;
|
|
14776
14941
|
};
|
|
14777
|
-
|
|
14942
|
+
const hostUrlToFeatureUrl = {
|
|
14778
14943
|
[PrefetchFeatures.SearchEmbed]: (url, flags) => `${url}v2/?${flags}#/embed/answer`,
|
|
14779
14944
|
[PrefetchFeatures.LiveboardEmbed]: (url, flags) => `${url}?${flags}`,
|
|
14780
14945
|
[PrefetchFeatures.FullApp]: (url, flags) => `${url}?${flags}`,
|
|
14781
14946
|
[PrefetchFeatures.VizEmbed]: (url, flags) => `${url}?${flags}`,
|
|
14782
|
-
}
|
|
14947
|
+
};
|
|
14948
|
+
/**
|
|
14949
|
+
* Prefetches static resources from the specified URL. Web browsers can then cache the
|
|
14950
|
+
* prefetched resources and serve them from the user's local disk to provide faster access
|
|
14951
|
+
* to your app.
|
|
14952
|
+
* @param url The URL provided for prefetch
|
|
14953
|
+
* @param prefetchFeatures Specify features which needs to be prefetched.
|
|
14954
|
+
* @param additionalFlags This can be used to add any URL flag.
|
|
14955
|
+
* @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 7.2.1
|
|
14956
|
+
* @group Global methods
|
|
14957
|
+
*/
|
|
14958
|
+
const prefetch = (url, prefetchFeatures, additionalFlags) => {
|
|
14959
|
+
var _a;
|
|
14960
|
+
if (url === '') {
|
|
14961
|
+
// eslint-disable-next-line no-console
|
|
14962
|
+
logger$3.warn('The prefetch method does not have a valid URL');
|
|
14963
|
+
}
|
|
14964
|
+
else {
|
|
14965
|
+
const features = [PrefetchFeatures.FullApp];
|
|
14966
|
+
let hostUrl = url || getEmbedConfig().thoughtSpotHost;
|
|
14967
|
+
const prefetchFlags = {
|
|
14968
|
+
[Param.EmbedApp]: true,
|
|
14969
|
+
...(_a = getEmbedConfig()) === null || _a === void 0 ? void 0 : _a.additionalFlags,
|
|
14970
|
+
...additionalFlags,
|
|
14971
|
+
};
|
|
14972
|
+
hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
|
|
14973
|
+
Array.from(new Set(features
|
|
14974
|
+
.map((feature) => hostUrlToFeatureUrl[feature](hostUrl, getQueryParamString(prefetchFlags)))))
|
|
14975
|
+
.forEach((prefetchUrl, index) => {
|
|
14976
|
+
const iFrame = document.createElement('iframe');
|
|
14977
|
+
iFrame.src = prefetchUrl;
|
|
14978
|
+
iFrame.style.width = '0';
|
|
14979
|
+
iFrame.style.height = '0';
|
|
14980
|
+
iFrame.style.border = '0';
|
|
14981
|
+
iFrame.classList.add('prefetchIframe');
|
|
14982
|
+
iFrame.classList.add(`prefetchIframeNum-${index}`);
|
|
14983
|
+
document.body.appendChild(iFrame);
|
|
14984
|
+
});
|
|
14985
|
+
}
|
|
14986
|
+
};
|
|
14987
|
+
/**
|
|
14988
|
+
*
|
|
14989
|
+
* @param embedConfig
|
|
14990
|
+
*/
|
|
14991
|
+
function sanity(embedConfig) {
|
|
14992
|
+
if (embedConfig.thoughtSpotHost === undefined) {
|
|
14993
|
+
throw new Error('ThoughtSpot host not provided');
|
|
14994
|
+
}
|
|
14995
|
+
if (embedConfig.authType === AuthType.TrustedAuthToken) {
|
|
14996
|
+
if (!embedConfig.authEndpoint && typeof embedConfig.getAuthToken !== 'function') {
|
|
14997
|
+
throw new Error('Trusted auth should provide either authEndpoint or getAuthToken');
|
|
14998
|
+
}
|
|
14999
|
+
}
|
|
15000
|
+
}
|
|
15001
|
+
/**
|
|
15002
|
+
*
|
|
15003
|
+
* @param embedConfig
|
|
15004
|
+
*/
|
|
15005
|
+
function backwardCompat(embedConfig) {
|
|
15006
|
+
const newConfig = { ...embedConfig };
|
|
15007
|
+
if (embedConfig.noRedirect !== undefined && embedConfig.inPopup === undefined) {
|
|
15008
|
+
newConfig.inPopup = embedConfig.noRedirect;
|
|
15009
|
+
}
|
|
15010
|
+
return newConfig;
|
|
15011
|
+
}
|
|
15012
|
+
const initFlagKey = 'initFlagKey';
|
|
15013
|
+
const createAndSetInitPromise = () => {
|
|
15014
|
+
const { promise: initPromise, resolve: initPromiseResolve,
|
|
15015
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15016
|
+
// @ts-ignore
|
|
15017
|
+
} = Promise.withResolvers();
|
|
15018
|
+
const initFlagStore = {
|
|
15019
|
+
initPromise,
|
|
15020
|
+
isInitCalled: false,
|
|
15021
|
+
initPromiseResolve,
|
|
15022
|
+
};
|
|
15023
|
+
storeValueInWindow(initFlagKey, initFlagStore, {
|
|
15024
|
+
// In case of diff imports the promise might be already set
|
|
15025
|
+
ignoreIfAlreadyExists: true,
|
|
15026
|
+
});
|
|
15027
|
+
};
|
|
15028
|
+
createAndSetInitPromise();
|
|
15029
|
+
const getInitPromise = () => { var _a; return (_a = getValueFromWindow(initFlagKey)) === null || _a === void 0 ? void 0 : _a.initPromise; };
|
|
15030
|
+
const getIsInitCalled = () => { var _a; return !!((_a = getValueFromWindow(initFlagKey)) === null || _a === void 0 ? void 0 : _a.isInitCalled); };
|
|
15031
|
+
/**
|
|
15032
|
+
* Initializes the Visual Embed SDK globally and perform
|
|
15033
|
+
* authentication if applicable. This function needs to be called before any ThoughtSpot
|
|
15034
|
+
* component like Liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
|
|
15035
|
+
* to actually embed. That is handled internally.
|
|
15036
|
+
* @param embedConfig The configuration object containing ThoughtSpot host,
|
|
15037
|
+
* authentication mechanism and so on.
|
|
15038
|
+
* @example
|
|
15039
|
+
* ```js
|
|
15040
|
+
* const authStatus = init({
|
|
15041
|
+
* thoughtSpotHost: 'https://my.thoughtspot.cloud',
|
|
15042
|
+
* authType: AuthType.None,
|
|
15043
|
+
* });
|
|
15044
|
+
* authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
|
|
15045
|
+
* ```
|
|
15046
|
+
* @returns {@link AuthEventEmitter} event emitter which emits events on authentication success,
|
|
15047
|
+
* failure and logout. See {@link AuthStatus}
|
|
15048
|
+
* @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
|
|
15049
|
+
* @group Authentication / Init
|
|
15050
|
+
*/
|
|
15051
|
+
const init = (embedConfig) => {
|
|
15052
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
15053
|
+
sanity(embedConfig);
|
|
15054
|
+
resetAllCachedServices();
|
|
15055
|
+
embedConfig = setEmbedConfig(backwardCompat({
|
|
15056
|
+
...CONFIG_DEFAULTS,
|
|
15057
|
+
...embedConfig,
|
|
15058
|
+
thoughtSpotHost: getThoughtSpotHost(embedConfig),
|
|
15059
|
+
}));
|
|
15060
|
+
setGlobalLogLevelOverride(embedConfig.logLevel);
|
|
15061
|
+
registerReportingObserver();
|
|
15062
|
+
const authEE = new eventemitter3();
|
|
15063
|
+
setAuthEE(authEE);
|
|
15064
|
+
handleAuth();
|
|
15065
|
+
const { password, ...configToTrack } = getEmbedConfig();
|
|
15066
|
+
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
|
|
15067
|
+
...configToTrack,
|
|
15068
|
+
usedCustomizationSheet: ((_b = (_a = embedConfig.customizations) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.customCSSUrl) != null,
|
|
15069
|
+
usedCustomizationVariables: ((_e = (_d = (_c = embedConfig.customizations) === null || _c === void 0 ? void 0 : _c.style) === null || _d === void 0 ? void 0 : _d.customCSS) === null || _e === void 0 ? void 0 : _e.variables) != null,
|
|
15070
|
+
usedCustomizationRules: ((_h = (_g = (_f = embedConfig.customizations) === null || _f === void 0 ? void 0 : _f.style) === null || _g === void 0 ? void 0 : _g.customCSS) === null || _h === void 0 ? void 0 : _h.rules_UNSTABLE) != null,
|
|
15071
|
+
usedCustomizationStrings: !!((_k = (_j = embedConfig.customizations) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.strings),
|
|
15072
|
+
usedCustomizationIconSprite: !!((_l = embedConfig.customizations) === null || _l === void 0 ? void 0 : _l.iconSpriteUrl),
|
|
15073
|
+
});
|
|
15074
|
+
if (getEmbedConfig().callPrefetch) {
|
|
15075
|
+
prefetch(getEmbedConfig().thoughtSpotHost);
|
|
15076
|
+
}
|
|
15077
|
+
// Resolves the promise created in the initPromiseKey
|
|
15078
|
+
getValueFromWindow(initFlagKey).initPromiseResolve(authEE);
|
|
15079
|
+
getValueFromWindow(initFlagKey).isInitCalled = true;
|
|
15080
|
+
return authEE;
|
|
15081
|
+
};
|
|
14783
15082
|
/**
|
|
14784
15083
|
*
|
|
14785
15084
|
*/
|
|
@@ -14908,7 +15207,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
14908
15207
|
return e;
|
|
14909
15208
|
}
|
|
14910
15209
|
|
|
14911
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.36.
|
|
15210
|
+
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$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};
|
|
14912
15211
|
|
|
14913
15212
|
/**
|
|
14914
15213
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -15217,13 +15516,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15217
15516
|
}
|
|
15218
15517
|
};
|
|
15219
15518
|
this.el = getDOMNode(domSelector);
|
|
15220
|
-
// TODO: handle error
|
|
15221
|
-
this.embedConfig = getEmbedConfig();
|
|
15222
|
-
if (!this.embedConfig.authTriggerContainer && !this.embedConfig.useEventForSAMLPopup) {
|
|
15223
|
-
this.embedConfig.authTriggerContainer = domSelector;
|
|
15224
|
-
}
|
|
15225
|
-
this.thoughtSpotHost = getThoughtSpotHost(this.embedConfig);
|
|
15226
|
-
this.thoughtSpotV2Base = getV2BasePath(this.embedConfig);
|
|
15227
15519
|
this.eventHandlerMap = new Map();
|
|
15228
15520
|
this.isError = false;
|
|
15229
15521
|
this.viewConfig = {
|
|
@@ -15231,12 +15523,21 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15231
15523
|
excludeRuntimeParametersfromURL: false,
|
|
15232
15524
|
...viewConfig,
|
|
15233
15525
|
};
|
|
15234
|
-
this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
|
|
15235
15526
|
this.registerAppInit();
|
|
15236
15527
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
15237
15528
|
...viewConfig,
|
|
15238
15529
|
});
|
|
15239
15530
|
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
15531
|
+
this.isReadyForRenderPromise = getInitPromise().then(async () => {
|
|
15532
|
+
const embedConfig = getEmbedConfig();
|
|
15533
|
+
this.embedConfig = embedConfig;
|
|
15534
|
+
if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
|
|
15535
|
+
this.embedConfig.authTriggerContainer = domSelector;
|
|
15536
|
+
}
|
|
15537
|
+
this.thoughtSpotHost = getThoughtSpotHost(embedConfig);
|
|
15538
|
+
this.thoughtSpotV2Base = getV2BasePath(embedConfig);
|
|
15539
|
+
this.shouldEncodeUrlQueryParams = embedConfig.shouldEncodeUrlQueryParams;
|
|
15540
|
+
});
|
|
15240
15541
|
}
|
|
15241
15542
|
/**
|
|
15242
15543
|
* Throws error encountered during initialization.
|
|
@@ -15954,6 +16255,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15954
16255
|
* @param args
|
|
15955
16256
|
*/
|
|
15956
16257
|
async render() {
|
|
16258
|
+
if (!getIsInitCalled()) {
|
|
16259
|
+
logger$3.error(ERROR_MESSAGE.RENDER_CALLED_BEFORE_INIT);
|
|
16260
|
+
}
|
|
16261
|
+
await this.isReadyForRenderPromise;
|
|
15957
16262
|
this.isRendered = true;
|
|
15958
16263
|
return this;
|
|
15959
16264
|
}
|
|
@@ -15961,21 +16266,20 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15961
16266
|
return '';
|
|
15962
16267
|
}
|
|
15963
16268
|
handleRenderForPrerender() {
|
|
15964
|
-
this.render();
|
|
16269
|
+
return this.render();
|
|
15965
16270
|
}
|
|
15966
16271
|
/**
|
|
15967
16272
|
* Creates the preRender shell
|
|
15968
16273
|
* @param showPreRenderByDefault - Show the preRender after render, hidden by default
|
|
15969
16274
|
*/
|
|
15970
|
-
preRender(showPreRenderByDefault = false) {
|
|
16275
|
+
async preRender(showPreRenderByDefault = false) {
|
|
15971
16276
|
if (!this.viewConfig.preRenderId) {
|
|
15972
16277
|
logger$3.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
|
|
15973
16278
|
return this;
|
|
15974
16279
|
}
|
|
15975
16280
|
this.isPreRendered = true;
|
|
15976
16281
|
this.showPreRenderByDefault = showPreRenderByDefault;
|
|
15977
|
-
this.handleRenderForPrerender();
|
|
15978
|
-
return this;
|
|
16282
|
+
return this.handleRenderForPrerender();
|
|
15979
16283
|
}
|
|
15980
16284
|
/**
|
|
15981
16285
|
* Get the Post Url Params for THOUGHTSPOT from the current
|
|
@@ -16028,6 +16332,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16028
16332
|
* @returns
|
|
16029
16333
|
*/
|
|
16030
16334
|
async prerenderGeneric() {
|
|
16335
|
+
if (!getIsInitCalled()) {
|
|
16336
|
+
logger$3.error(ERROR_MESSAGE.RENDER_CALLED_BEFORE_INIT);
|
|
16337
|
+
}
|
|
16338
|
+
await this.isReadyForRenderPromise;
|
|
16031
16339
|
const prerenderFrameSrc = this.getRootIframeSrc();
|
|
16032
16340
|
this.isRendered = true;
|
|
16033
16341
|
return this.renderIFrame(prerenderFrameSrc);
|
|
@@ -16041,17 +16349,16 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16041
16349
|
* Also, synchronizes the style of the PreRender component with the embedding
|
|
16042
16350
|
* element.
|
|
16043
16351
|
*/
|
|
16044
|
-
showPreRender() {
|
|
16352
|
+
async showPreRender() {
|
|
16045
16353
|
if (!this.viewConfig.preRenderId) {
|
|
16046
16354
|
logger$3.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
|
|
16047
|
-
return;
|
|
16355
|
+
return this;
|
|
16048
16356
|
}
|
|
16049
16357
|
if (!this.isPreRenderAvailable()) {
|
|
16050
16358
|
const isAvailable = this.connectPreRendered();
|
|
16051
16359
|
if (!isAvailable) {
|
|
16052
16360
|
// if the Embed component is not preRendered , Render it now and
|
|
16053
|
-
this.preRender(true);
|
|
16054
|
-
return;
|
|
16361
|
+
return this.preRender(true);
|
|
16055
16362
|
}
|
|
16056
16363
|
this.validatePreRenderViewConfig(this.viewConfig);
|
|
16057
16364
|
}
|
|
@@ -16074,6 +16381,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16074
16381
|
this.beforePrerenderVisible();
|
|
16075
16382
|
removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
|
|
16076
16383
|
this.subscribeToEvents();
|
|
16384
|
+
return this;
|
|
16077
16385
|
}
|
|
16078
16386
|
/**
|
|
16079
16387
|
* Synchronizes the style properties of the PreRender component with the embedding
|
|
@@ -16259,7 +16567,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16259
16567
|
* Render the embedded ThoughtSpot search
|
|
16260
16568
|
*/
|
|
16261
16569
|
async render() {
|
|
16262
|
-
super.render();
|
|
16570
|
+
await super.render();
|
|
16263
16571
|
const src = this.getIFrameSrc();
|
|
16264
16572
|
await this.renderIFrame(src);
|
|
16265
16573
|
return this;
|
|
@@ -16346,7 +16654,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16346
16654
|
* @returns {SageEmbed} Eureka/Sage embed
|
|
16347
16655
|
*/
|
|
16348
16656
|
async render() {
|
|
16349
|
-
super.render();
|
|
16657
|
+
await super.render();
|
|
16350
16658
|
const src = this.getIFrameSrc();
|
|
16351
16659
|
await this.renderV1Embed(src);
|
|
16352
16660
|
return this;
|
|
@@ -16518,7 +16826,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16518
16826
|
* Render the embedded ThoughtSpot search
|
|
16519
16827
|
*/
|
|
16520
16828
|
async render() {
|
|
16521
|
-
super.render();
|
|
16829
|
+
await super.render();
|
|
16522
16830
|
this.viewConfig;
|
|
16523
16831
|
const src = this.getIFrameSrc();
|
|
16524
16832
|
await this.renderIFrame(src);
|
|
@@ -16817,7 +17125,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16817
17125
|
* to be embedded.
|
|
16818
17126
|
*/
|
|
16819
17127
|
async render() {
|
|
16820
|
-
super.render();
|
|
17128
|
+
await super.render();
|
|
16821
17129
|
const src = this.getIFrameSrc();
|
|
16822
17130
|
await this.renderV1Embed(src);
|
|
16823
17131
|
return this;
|
|
@@ -17096,12 +17404,11 @@ query GetEurekaVizSnapshots(
|
|
|
17096
17404
|
this.navigateToLiveboard(libId);
|
|
17097
17405
|
}
|
|
17098
17406
|
}
|
|
17099
|
-
handleRenderForPrerender() {
|
|
17407
|
+
async handleRenderForPrerender() {
|
|
17100
17408
|
if (isUndefined$1(this.viewConfig.liveboardId)) {
|
|
17101
|
-
this.prerenderGeneric();
|
|
17102
|
-
return;
|
|
17409
|
+
return this.prerenderGeneric();
|
|
17103
17410
|
}
|
|
17104
|
-
super.handleRenderForPrerender();
|
|
17411
|
+
return super.handleRenderForPrerender();
|
|
17105
17412
|
}
|
|
17106
17413
|
/**
|
|
17107
17414
|
* Triggers an event to the embedded app
|
|
@@ -17126,7 +17433,7 @@ query GetEurekaVizSnapshots(
|
|
|
17126
17433
|
* visualization ID and the runtime filters.
|
|
17127
17434
|
*/
|
|
17128
17435
|
async render() {
|
|
17129
|
-
super.render();
|
|
17436
|
+
await super.render();
|
|
17130
17437
|
const src = this.getIFrameSrc();
|
|
17131
17438
|
await this.renderV1Embed(src);
|
|
17132
17439
|
this.showPreviewLoader();
|
|
@@ -17263,7 +17570,7 @@ query GetEurekaVizSnapshots(
|
|
|
17263
17570
|
return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
|
|
17264
17571
|
}
|
|
17265
17572
|
async render() {
|
|
17266
|
-
super.render();
|
|
17573
|
+
await super.render();
|
|
17267
17574
|
const src = this.getIframeSrc();
|
|
17268
17575
|
await this.renderIFrame(src);
|
|
17269
17576
|
return this;
|
|
@@ -17532,6 +17839,27 @@ query GetEurekaVizSnapshots(
|
|
|
17532
17839
|
*/
|
|
17533
17840
|
function useEmbedRef() {
|
|
17534
17841
|
return React.useRef(null);
|
|
17842
|
+
}
|
|
17843
|
+
/**
|
|
17844
|
+
*
|
|
17845
|
+
* @param config - EmbedConfig
|
|
17846
|
+
* @returns AuthEventEmitter
|
|
17847
|
+
* @example
|
|
17848
|
+
* ```
|
|
17849
|
+
* function Component() {
|
|
17850
|
+
* const authEE = useInit({ ...initConfig });
|
|
17851
|
+
* return <LiveboardEmbed ref={ref} liveboardId={<id>} />
|
|
17852
|
+
* }
|
|
17853
|
+
* ```
|
|
17854
|
+
* @version SDK: 1.36.2 | ThoughtSpot: *
|
|
17855
|
+
*/
|
|
17856
|
+
function useInit(config) {
|
|
17857
|
+
const ref = React.useRef(null);
|
|
17858
|
+
useDeepCompareEffect(() => {
|
|
17859
|
+
const authEE = init(config);
|
|
17860
|
+
ref.current = authEE;
|
|
17861
|
+
}, [config]);
|
|
17862
|
+
return ref;
|
|
17535
17863
|
}
|
|
17536
17864
|
|
|
17537
17865
|
const ALIAS = Symbol.for('yaml.alias');
|
|
@@ -24952,5 +25280,6 @@ query GetEurekaVizSnapshots(
|
|
|
24952
25280
|
exports.SearchEmbed = SearchEmbed;
|
|
24953
25281
|
exports.getSessionInfo = getSessionInfo;
|
|
24954
25282
|
exports.useEmbedRef = useEmbedRef;
|
|
25283
|
+
exports.useInit = useInit;
|
|
24955
25284
|
|
|
24956
25285
|
}));
|