@thoughtspot/visual-embed-sdk 1.36.2 → 1.36.4
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/authToken.d.ts.map +1 -1
- package/cjs/src/authToken.js +10 -3
- package/cjs/src/authToken.js.map +1 -1
- package/cjs/src/embed/app.d.ts +14 -0
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +5 -2
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +17 -0
- package/cjs/src/embed/app.spec.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 +1 -1
- package/cjs/src/embed/embedConfig.d.ts.map +1 -1
- package/cjs/src/embed/embedConfig.js +5 -4
- package/cjs/src/embed/embedConfig.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +6 -3
- 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 +85 -66
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +78 -59
- 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 +27 -0
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +45 -1
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +15 -0
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/{index-B3hd6DTM.js → index-NZYq1Tu3.js} +1 -1
- package/dist/src/authToken.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +14 -0
- 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 +1 -1
- package/dist/src/embed/embedConfig.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +6 -3
- 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 +85 -66
- 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 +27 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +458 -108
- package/dist/tsembed-react.js +456 -105
- package/dist/tsembed.es.js +197 -98
- package/dist/tsembed.js +196 -97
- package/dist/visual-embed-sdk-react-full.d.ts +1324 -1269
- package/dist/visual-embed-sdk-react.d.ts +814 -759
- package/dist/visual-embed-sdk.d.ts +113 -72
- package/lib/package.json +1 -1
- package/lib/src/authToken.d.ts.map +1 -1
- package/lib/src/authToken.js +10 -3
- package/lib/src/authToken.js.map +1 -1
- package/lib/src/embed/app.d.ts +14 -0
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +5 -2
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +17 -0
- package/lib/src/embed/app.spec.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 +1 -1
- package/lib/src/embed/embedConfig.d.ts.map +1 -1
- package/lib/src/embed/embedConfig.js +5 -4
- package/lib/src/embed/embedConfig.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +6 -3
- 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 +85 -66
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +78 -59
- 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 +27 -0
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +41 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +16 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +114 -73
- package/package.json +1 -1
- package/src/authToken.ts +11 -3
- package/src/embed/app.spec.ts +27 -0
- package/src/embed/app.ts +21 -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 +5 -4
- package/src/embed/liveboard.spec.ts +11 -11
- package/src/embed/liveboard.ts +9 -7
- 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 +89 -70
- package/src/utils/with-resolvers-polyfill.ts +11 -0
- package/src/utils.spec.ts +21 -0
- package/src/utils.ts +52 -0
- package/cjs/src/embed/searchEmbed-basic-auth.spec.d.ts +0 -2
- package/cjs/src/embed/searchEmbed-basic-auth.spec.d.ts.map +0 -1
- package/cjs/src/embed/searchEmbed-basic-auth.spec.js +0 -104
- package/cjs/src/embed/searchEmbed-basic-auth.spec.js.map +0 -1
- package/cjs/src/hostEventsTypeMapping.d.ts +0 -2
- package/cjs/src/hostEventsTypeMapping.d.ts.map +0 -1
- package/cjs/src/hostEventsTypeMapping.js +0 -4
- package/cjs/src/hostEventsTypeMapping.js.map +0 -1
- package/cjs/src/utils/embedApi/contracts.d.ts +0 -101
- package/cjs/src/utils/embedApi/contracts.d.ts.map +0 -1
- package/cjs/src/utils/embedApi/contracts.js +0 -17
- package/cjs/src/utils/embedApi/contracts.js.map +0 -1
- package/cjs/src/utils/embedApi/embedApiClient.d.ts +0 -12
- package/cjs/src/utils/embedApi/embedApiClient.d.ts.map +0 -1
- package/cjs/src/utils/embedApi/embedApiClient.js +0 -46
- package/cjs/src/utils/embedApi/embedApiClient.js.map +0 -1
- package/cjs/src/utils/embedApi/processEmbedApi.d.ts +0 -9
- package/cjs/src/utils/embedApi/processEmbedApi.d.ts.map +0 -1
- package/cjs/src/utils/embedApi/processEmbedApi.js +0 -18
- package/cjs/src/utils/embedApi/processEmbedApi.js.map +0 -1
- package/dist/index-BBBimG1x.js +0 -7370
- package/dist/index-BGnxP5NY.js +0 -7370
- package/dist/index-CENLvayL.js +0 -7370
- package/dist/index-CR5u7BMC.js +0 -7370
- package/dist/index-CbltIawo.js +0 -7370
- package/dist/index-CoQfqaHj.js +0 -7370
- package/dist/index-CzwzS0P4.js +0 -7370
- package/dist/index-D-9WUCUl.js +0 -7370
- package/dist/index-DFwi_pV_.js +0 -7370
- package/dist/index-DOIjN0N_.js +0 -7370
- package/dist/index-DYBx8SuE.js +0 -7370
- package/dist/index-DaLHJaLd.js +0 -7370
- package/dist/index-DnJX-gN2.js +0 -7370
- package/dist/index-DpuhnTj2.js +0 -7370
- package/dist/index-IDmSUe93.js +0 -7370
- package/dist/index-nWevLycs.js +0 -7370
- package/dist/index-vxW97_xb.js +0 -7370
- package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts +0 -2
- package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts.map +0 -1
- package/dist/src/hostEventsTypeMapping.d.ts +0 -2
- package/dist/src/hostEventsTypeMapping.d.ts.map +0 -1
- package/dist/src/utils/embedApi/contracts.d.ts +0 -101
- package/dist/src/utils/embedApi/contracts.d.ts.map +0 -1
- package/dist/src/utils/embedApi/embedApiClient.d.ts +0 -12
- package/dist/src/utils/embedApi/embedApiClient.d.ts.map +0 -1
- package/dist/src/utils/embedApi/processEmbedApi.d.ts +0 -9
- package/dist/src/utils/embedApi/processEmbedApi.d.ts.map +0 -1
- package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts +0 -2
- package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts.map +0 -1
- package/lib/src/embed/searchEmbed-basic-auth.spec.js +0 -101
- package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +0 -1
- package/lib/src/hostEventsTypeMapping.d.ts +0 -2
- package/lib/src/hostEventsTypeMapping.d.ts.map +0 -1
- package/lib/src/hostEventsTypeMapping.js +0 -2
- package/lib/src/hostEventsTypeMapping.js.map +0 -1
- package/lib/src/utils/embedApi/contracts.d.ts +0 -101
- package/lib/src/utils/embedApi/contracts.d.ts.map +0 -1
- package/lib/src/utils/embedApi/contracts.js +0 -14
- package/lib/src/utils/embedApi/contracts.js.map +0 -1
- package/lib/src/utils/embedApi/embedApiClient.d.ts +0 -12
- package/lib/src/utils/embedApi/embedApiClient.d.ts.map +0 -1
- package/lib/src/utils/embedApi/embedApiClient.js +0 -42
- package/lib/src/utils/embedApi/embedApiClient.js.map +0 -1
- package/lib/src/utils/embedApi/processEmbedApi.d.ts +0 -9
- package/lib/src/utils/embedApi/processEmbedApi.d.ts.map +0 -1
- package/lib/src/utils/embedApi/processEmbedApi.js +0 -14
- package/lib/src/utils/embedApi/processEmbedApi.js.map +0 -1
package/src/types.ts
CHANGED
|
@@ -213,12 +213,12 @@ export type DOMSelector = string | HTMLElement;
|
|
|
213
213
|
* Use {@link CustomCssVariables} or css rules.
|
|
214
214
|
*/
|
|
215
215
|
export interface customCssInterface {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
216
|
+
/**
|
|
217
|
+
* The custom css variables, which can be set.
|
|
218
|
+
* The variables are available in the {@link CustomCssVariables}
|
|
219
|
+
* interface. For more information, see
|
|
220
|
+
* link:https://developers.thoughtspot.com/docs/css-variables-reference[CSS variable reference].
|
|
221
|
+
*/
|
|
222
222
|
variables?: CustomCssVariables;
|
|
223
223
|
/**
|
|
224
224
|
* Can be used to define a custom font face
|
|
@@ -770,7 +770,7 @@ export interface ViewConfig {
|
|
|
770
770
|
*/
|
|
771
771
|
showAlerts?: boolean;
|
|
772
772
|
/**
|
|
773
|
-
* The list of runtime filters to apply to a search
|
|
773
|
+
* The list of runtime filters to apply to a search Answer,
|
|
774
774
|
* visualization, or Liveboard.
|
|
775
775
|
* @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1.sw
|
|
776
776
|
* @example
|
|
@@ -789,7 +789,7 @@ export interface ViewConfig {
|
|
|
789
789
|
*/
|
|
790
790
|
runtimeFilters?: RuntimeFilter[];
|
|
791
791
|
/**
|
|
792
|
-
* The list of parameter override to apply to a search
|
|
792
|
+
* The list of parameter override to apply to a search Answer,
|
|
793
793
|
* visualization, or Liveboard.
|
|
794
794
|
* @version SDK : 1.25.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw
|
|
795
795
|
* @example
|
|
@@ -807,7 +807,7 @@ export interface ViewConfig {
|
|
|
807
807
|
*/
|
|
808
808
|
runtimeParameters?: RuntimeParameter[];
|
|
809
809
|
/**
|
|
810
|
-
* The locale
|
|
810
|
+
* The locale settings to apply to the embedded view.
|
|
811
811
|
* @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1.sw
|
|
812
812
|
* @example
|
|
813
813
|
* ```js
|
|
@@ -872,7 +872,7 @@ export interface ViewConfig {
|
|
|
872
872
|
*/
|
|
873
873
|
contextMenuTrigger?: ContextMenuTriggerOptions;
|
|
874
874
|
/**
|
|
875
|
-
* Flag to override
|
|
875
|
+
* Flag to override the *Open Link in New Tab* context menu option.
|
|
876
876
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
|
|
877
877
|
* @example
|
|
878
878
|
* ```js
|
|
@@ -1012,7 +1012,7 @@ export interface ViewConfig {
|
|
|
1012
1012
|
preRenderId?: string;
|
|
1013
1013
|
|
|
1014
1014
|
/**
|
|
1015
|
-
* Determines
|
|
1015
|
+
* Determines if the PreRender component should dynamically track the size
|
|
1016
1016
|
* of its embedding element and adjust its own size accordingly.
|
|
1017
1017
|
* Enabling this option allows the PreRender component to automatically adapt
|
|
1018
1018
|
* its dimensions based on changes to the size of the embedding element.
|
|
@@ -1402,8 +1402,8 @@ export enum EmbedEvent {
|
|
|
1402
1402
|
*/
|
|
1403
1403
|
Load = 'load',
|
|
1404
1404
|
/**
|
|
1405
|
-
* Data pertaining to
|
|
1406
|
-
* @return data - The
|
|
1405
|
+
* Data pertaining to an Answer or Liveboard is received
|
|
1406
|
+
* @return data - The Answer or Liveboard data
|
|
1407
1407
|
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
1408
1408
|
* @example
|
|
1409
1409
|
*```js
|
|
@@ -1577,7 +1577,7 @@ export enum EmbedEvent {
|
|
|
1577
1577
|
*/
|
|
1578
1578
|
Alert = 'alert',
|
|
1579
1579
|
/**
|
|
1580
|
-
* The ThoughtSpot
|
|
1580
|
+
* The ThoughtSpot authentication session has expired.
|
|
1581
1581
|
* @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 8.4.1.sw
|
|
1582
1582
|
* @example
|
|
1583
1583
|
*```js
|
|
@@ -1649,7 +1649,7 @@ export enum EmbedEvent {
|
|
|
1649
1649
|
/**
|
|
1650
1650
|
* Emitted when the embed does not have cookie access. This happens
|
|
1651
1651
|
* when Safari and other Web browsers block third-party cookies
|
|
1652
|
-
* are blocked by default. `NoCookieAccess` can trigger
|
|
1652
|
+
* are blocked by default. `NoCookieAccess` can trigger.
|
|
1653
1653
|
* @example
|
|
1654
1654
|
*```js
|
|
1655
1655
|
* appEmbed.on(EmbedEvent.NoCookieAccess)
|
|
@@ -1737,7 +1737,7 @@ export enum EmbedEvent {
|
|
|
1737
1737
|
*/
|
|
1738
1738
|
Save = 'save',
|
|
1739
1739
|
/**
|
|
1740
|
-
* Emitted when the download action is triggered on an
|
|
1740
|
+
* Emitted when the download action is triggered on an Answer.
|
|
1741
1741
|
*
|
|
1742
1742
|
* **Note**: This event is deprecated in v1.21.0.
|
|
1743
1743
|
* To fire an event when a download action is initiated on a chart or table,
|
|
@@ -1753,7 +1753,7 @@ export enum EmbedEvent {
|
|
|
1753
1753
|
*/
|
|
1754
1754
|
Download = 'download',
|
|
1755
1755
|
/**
|
|
1756
|
-
* Emitted when the download action is triggered on an
|
|
1756
|
+
* Emitted when the download action is triggered on an Answer.
|
|
1757
1757
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.0.sw
|
|
1758
1758
|
* @example
|
|
1759
1759
|
*```js
|
|
@@ -1767,7 +1767,7 @@ export enum EmbedEvent {
|
|
|
1767
1767
|
*/
|
|
1768
1768
|
DownloadAsPng = 'downloadAsPng',
|
|
1769
1769
|
/**
|
|
1770
|
-
* Emitted when the Download as PDF action is triggered on an
|
|
1770
|
+
* Emitted when the Download as PDF action is triggered on an Answer
|
|
1771
1771
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1772
1772
|
* @example
|
|
1773
1773
|
*```js
|
|
@@ -1781,7 +1781,7 @@ export enum EmbedEvent {
|
|
|
1781
1781
|
*/
|
|
1782
1782
|
DownloadAsPdf = 'downloadAsPdf',
|
|
1783
1783
|
/**
|
|
1784
|
-
* Emitted when the Download as CSV action is triggered on an
|
|
1784
|
+
* Emitted when the Download as CSV action is triggered on an Answer.
|
|
1785
1785
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1786
1786
|
* @example
|
|
1787
1787
|
*```js
|
|
@@ -1795,7 +1795,7 @@ export enum EmbedEvent {
|
|
|
1795
1795
|
*/
|
|
1796
1796
|
DownloadAsCsv = 'downloadAsCsv',
|
|
1797
1797
|
/**
|
|
1798
|
-
* Emitted when the Download as XLSX action is triggered on an
|
|
1798
|
+
* Emitted when the Download as XLSX action is triggered on an Answer.
|
|
1799
1799
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1800
1800
|
* @example
|
|
1801
1801
|
*```js
|
|
@@ -1823,7 +1823,8 @@ export enum EmbedEvent {
|
|
|
1823
1823
|
*/
|
|
1824
1824
|
AnswerDelete = 'answerDelete',
|
|
1825
1825
|
/**
|
|
1826
|
-
* Emitted when
|
|
1826
|
+
* Emitted when a user initiates the Pin action to
|
|
1827
|
+
* add an Answer to a Liveboard.
|
|
1827
1828
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1828
1829
|
* @example
|
|
1829
1830
|
*```js
|
|
@@ -1961,7 +1962,7 @@ export enum EmbedEvent {
|
|
|
1961
1962
|
*/
|
|
1962
1963
|
SaveAsView = 'saveAsView',
|
|
1963
1964
|
/**
|
|
1964
|
-
* Emitted when the user creates a copy of an Answer
|
|
1965
|
+
* Emitted when the user creates a copy of an Answer.
|
|
1965
1966
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1966
1967
|
* @example
|
|
1967
1968
|
*```js
|
|
@@ -1975,7 +1976,7 @@ export enum EmbedEvent {
|
|
|
1975
1976
|
*/
|
|
1976
1977
|
CopyAEdit = 'copyAEdit',
|
|
1977
1978
|
/**
|
|
1978
|
-
* Emitted when a user clicks Show underlying data on an Answer
|
|
1979
|
+
* Emitted when a user clicks *Show underlying data* on an Answer.
|
|
1979
1980
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1980
1981
|
* @example
|
|
1981
1982
|
*```js
|
|
@@ -1986,7 +1987,7 @@ export enum EmbedEvent {
|
|
|
1986
1987
|
*/
|
|
1987
1988
|
ShowUnderlyingData = 'showUnderlyingData',
|
|
1988
1989
|
/**
|
|
1989
|
-
* Emitted when an
|
|
1990
|
+
* Emitted when an Answer is switched to a chart or table view.
|
|
1990
1991
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1991
1992
|
* @example
|
|
1992
1993
|
*```js
|
|
@@ -2120,11 +2121,12 @@ export enum EmbedEvent {
|
|
|
2120
2121
|
*/
|
|
2121
2122
|
CopyLink = 'embedDocument',
|
|
2122
2123
|
/**
|
|
2123
|
-
* Emitted when a user interacts with cross filters on a
|
|
2124
|
+
* Emitted when a user interacts with cross filters on a
|
|
2125
|
+
* visualization or Liveboard.
|
|
2124
2126
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw
|
|
2125
2127
|
* @example
|
|
2126
2128
|
*```js
|
|
2127
|
-
* liveboardEmbed.
|
|
2129
|
+
* liveboardEmbed.on(EmbedEvent.CrossFilterChanged, {
|
|
2128
2130
|
* vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
2129
2131
|
*```
|
|
2130
2132
|
*/
|
|
@@ -2218,8 +2220,8 @@ export enum EmbedEvent {
|
|
|
2218
2220
|
*/
|
|
2219
2221
|
DeletePersonalisedView = 'deletePersonalisedView',
|
|
2220
2222
|
/**
|
|
2221
|
-
* Emitted when a user creates a
|
|
2222
|
-
* @version SDK : 1.27.0 | ThoughtSpot
|
|
2223
|
+
* Emitted when a user creates a Worksheet.
|
|
2224
|
+
* @version SDK : 1.27.0 | ThoughtSpot: 9.8.0.cl, 9.8.0.sw
|
|
2223
2225
|
*/
|
|
2224
2226
|
CreateWorksheet = 'createWorksheet',
|
|
2225
2227
|
/**
|
|
@@ -2232,8 +2234,8 @@ export enum EmbedEvent {
|
|
|
2232
2234
|
*/
|
|
2233
2235
|
AskSageInit = 'AskSageInit',
|
|
2234
2236
|
/**
|
|
2235
|
-
* Emitted when a
|
|
2236
|
-
* @version SDK : 1.28.0 | ThoughtSpot: 9.10.5.cl
|
|
2237
|
+
* Emitted when a Liveboard or visualization is renamed.
|
|
2238
|
+
* @version SDK : 1.28.0 | ThoughtSpot: 9.10.5.cl, 10.1.0.sw
|
|
2237
2239
|
*/
|
|
2238
2240
|
Rename = 'rename',
|
|
2239
2241
|
/**
|
|
@@ -2297,8 +2299,7 @@ export enum EmbedEvent {
|
|
|
2297
2299
|
OnBeforeGetVizDataIntercept = 'onBeforeGetVizDataIntercept',
|
|
2298
2300
|
/**
|
|
2299
2301
|
* Emitted when parameter changes in an Answer
|
|
2300
|
-
* or Liveboard
|
|
2301
|
-
*
|
|
2302
|
+
* or Liveboard.
|
|
2302
2303
|
* ```js
|
|
2303
2304
|
* liveboardEmbed.on(EmbedEvent.ParameterChanged, (payload) => {
|
|
2304
2305
|
* console.log('payload', payload);
|
|
@@ -2325,7 +2326,7 @@ export enum EmbedEvent {
|
|
|
2325
2326
|
*/
|
|
2326
2327
|
TableVizRendered = 'TableVizRendered',
|
|
2327
2328
|
/**
|
|
2328
|
-
* Emitted when the liveboard is created from pin modal or
|
|
2329
|
+
* Emitted when the liveboard is created from pin modal or Liveboard list page.
|
|
2329
2330
|
* You can use this event as a hook to trigger
|
|
2330
2331
|
* other events on liveboard creation.
|
|
2331
2332
|
*
|
|
@@ -2470,7 +2471,7 @@ export enum HostEvent {
|
|
|
2470
2471
|
*/
|
|
2471
2472
|
Filter = 'filter',
|
|
2472
2473
|
/**
|
|
2473
|
-
* Reload the
|
|
2474
|
+
* Reload the Answer or visualization
|
|
2474
2475
|
* @hidden
|
|
2475
2476
|
*/
|
|
2476
2477
|
Reload = 'reload',
|
|
@@ -2520,12 +2521,10 @@ export enum HostEvent {
|
|
|
2520
2521
|
* and `AppEmbed` only. In full application embedding, this event updates
|
|
2521
2522
|
* the runtime filters applied on the Liveboard and saved Answer objects.
|
|
2522
2523
|
*
|
|
2523
|
-
*
|
|
2524
|
-
* Pass an array of runtime filters with the following attributes:
|
|
2525
|
-
*
|
|
2524
|
+
* @param - Pass an array of {@link RuntimeFilter} with the following attributes:
|
|
2526
2525
|
* `columnName` - _String_. The name of the column to filter on.
|
|
2527
2526
|
*
|
|
2528
|
-
* `operator` -
|
|
2527
|
+
* `operator` - {@link RuntimeFilterOp} to apply. For more information,
|
|
2529
2528
|
* see link:https://developers.thoughtspot.com/docs/?pageid=runtime-filters#rtOperator[Developer Documentation].
|
|
2530
2529
|
*
|
|
2531
2530
|
* `values` - List of operands. Some operators such as EQ and LE allow a
|
|
@@ -2537,7 +2536,7 @@ export enum HostEvent {
|
|
|
2537
2536
|
* will be cleared, restoring the original visualization
|
|
2538
2537
|
* with the updated filters.
|
|
2539
2538
|
*
|
|
2540
|
-
|
|
2539
|
+
|
|
2541
2540
|
* @example
|
|
2542
2541
|
* ```js
|
|
2543
2542
|
* liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
|
|
@@ -2776,6 +2775,11 @@ export enum HostEvent {
|
|
|
2776
2775
|
* appEmbed.trigger(HostEvent.Remove)
|
|
2777
2776
|
* ```
|
|
2778
2777
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2778
|
+
* * @example
|
|
2779
|
+
* ```js
|
|
2780
|
+
* liveboardEmbed.trigger(HostEvent.Remove)
|
|
2781
|
+
* ```
|
|
2782
|
+
* @version SDK: 1.37.0 | ThoughtSpot: 10.8.0.cl, 10.10.0.sw
|
|
2779
2783
|
*/
|
|
2780
2784
|
Remove = 'delete',
|
|
2781
2785
|
/**
|
|
@@ -3186,7 +3190,7 @@ export enum HostEvent {
|
|
|
3186
3190
|
* ```js
|
|
3187
3191
|
* liveboardEmbed.trigger(HostEvent.GetTabs).then((tabDetails) => {
|
|
3188
3192
|
* console.log(
|
|
3189
|
-
* tabDetails // TabDetails of current
|
|
3193
|
+
* tabDetails // TabDetails of current Liveboard
|
|
3190
3194
|
* );
|
|
3191
3195
|
* })
|
|
3192
3196
|
* ```
|
|
@@ -3234,7 +3238,7 @@ export enum HostEvent {
|
|
|
3234
3238
|
*/
|
|
3235
3239
|
UpdateSageQuery = 'updateSageQuery',
|
|
3236
3240
|
/**
|
|
3237
|
-
* Get the
|
|
3241
|
+
* Get the Answer session for a Search or
|
|
3238
3242
|
* Liveboard visualization.
|
|
3239
3243
|
* @example
|
|
3240
3244
|
* ```js
|
|
@@ -3413,6 +3417,7 @@ export enum Param {
|
|
|
3413
3417
|
HostAppUrl = 'hostAppUrl',
|
|
3414
3418
|
EnableVizTransformations = 'enableVizTransform',
|
|
3415
3419
|
EnableSearchAssist = 'enableSearchAssist',
|
|
3420
|
+
EnablePendoHelp = 'enablePendoHelp',
|
|
3416
3421
|
HideResult = 'hideResult',
|
|
3417
3422
|
UseLastSelectedDataSource = 'useLastSelectedSources',
|
|
3418
3423
|
Tag = 'tag',
|
|
@@ -3645,9 +3650,10 @@ export enum Action {
|
|
|
3645
3650
|
*/
|
|
3646
3651
|
AddDataPanelObjects = 'addDataPanelObjects',
|
|
3647
3652
|
/**
|
|
3648
|
-
*
|
|
3649
|
-
*
|
|
3650
|
-
* Liveboard.
|
|
3653
|
+
* The filter configuration options for a Liveboard.
|
|
3654
|
+
* The configuration options are available when adding
|
|
3655
|
+
* filters on a Liveboard.
|
|
3656
|
+
*
|
|
3651
3657
|
* @example
|
|
3652
3658
|
* ```js
|
|
3653
3659
|
* disabledActions: [Action.ConfigureFilter]
|
|
@@ -3745,14 +3751,17 @@ export enum Action {
|
|
|
3745
3751
|
* @hidden
|
|
3746
3752
|
*/
|
|
3747
3753
|
SpotIQFollow = 'spotIQFollow',
|
|
3754
|
+
/**
|
|
3755
|
+
* The Share action for a Liveboard visualization.
|
|
3756
|
+
*/
|
|
3748
3757
|
ShareViz = 'shareViz',
|
|
3749
3758
|
/**
|
|
3750
3759
|
* @hidden
|
|
3751
3760
|
*/
|
|
3752
3761
|
ReplaySearch = 'replaySearch',
|
|
3753
3762
|
/**
|
|
3754
|
-
* The **Show underlying data** menu action on a
|
|
3755
|
-
* Answer page.
|
|
3763
|
+
* The **Show underlying data** menu action on a
|
|
3764
|
+
* visualization or Answer page.
|
|
3756
3765
|
* Displays detailed information and raw data
|
|
3757
3766
|
* for a given visualization.
|
|
3758
3767
|
* @example
|
|
@@ -3762,8 +3771,8 @@ export enum Action {
|
|
|
3762
3771
|
*/
|
|
3763
3772
|
ShowUnderlyingData = 'showUnderlyingData',
|
|
3764
3773
|
/**
|
|
3765
|
-
* The **Download** menu action on Liveboard
|
|
3766
|
-
* and Answers.
|
|
3774
|
+
* The **Download** menu action on Liveboard
|
|
3775
|
+
* visualizations and Answers.
|
|
3767
3776
|
* Allows downloading a visualization or Answer.
|
|
3768
3777
|
* @example
|
|
3769
3778
|
* ```js
|
|
@@ -3784,11 +3793,10 @@ export enum Action {
|
|
|
3784
3793
|
/**
|
|
3785
3794
|
*
|
|
3786
3795
|
*The **Download PDF** action that downloads a Liveboard,
|
|
3787
|
-
*visualization, or Answer as a PDF file.
|
|
3796
|
+
* visualization, or Answer as a PDF file.
|
|
3788
3797
|
*
|
|
3789
|
-
*
|
|
3790
|
-
|
|
3791
|
-
*visualizations and Answers if the data is in tabular format.
|
|
3798
|
+
* **NOTE**: The **Download** > **PDF** option is available for
|
|
3799
|
+
* tables in visualizations and Answers.
|
|
3792
3800
|
* @example
|
|
3793
3801
|
* ```js
|
|
3794
3802
|
* disabledActions: [Action.DownloadAsPdf]
|
|
@@ -3820,9 +3828,11 @@ export enum Action {
|
|
|
3820
3828
|
*/
|
|
3821
3829
|
DownloadTrace = 'downloadTrace',
|
|
3822
3830
|
/**
|
|
3823
|
-
* The **Export TML** menu action on Liveboard,
|
|
3824
|
-
*
|
|
3825
|
-
*
|
|
3831
|
+
* The **Export TML** menu action on a Liveboard, Answer, and
|
|
3832
|
+
* the Data Workspace pages for data objects and connections.
|
|
3833
|
+
*
|
|
3834
|
+
* Allows exporting an object as a TML file.
|
|
3835
|
+
*
|
|
3826
3836
|
* @example
|
|
3827
3837
|
* ```js
|
|
3828
3838
|
* disabledActions: [Action.ExportTML]
|
|
@@ -3830,7 +3840,8 @@ export enum Action {
|
|
|
3830
3840
|
*/
|
|
3831
3841
|
ExportTML = 'exportTSL',
|
|
3832
3842
|
/**
|
|
3833
|
-
* The **Import TML** menu action
|
|
3843
|
+
* The **Import TML** menu action on the
|
|
3844
|
+
* *Data Workspace* > *Utilities* page.
|
|
3834
3845
|
* Imports TML representation of ThoughtSpot objects.
|
|
3835
3846
|
* @example
|
|
3836
3847
|
* ```js
|
|
@@ -3840,7 +3851,7 @@ export enum Action {
|
|
|
3840
3851
|
ImportTML = 'importTSL',
|
|
3841
3852
|
/**
|
|
3842
3853
|
* The **Update TML** menu action for Liveboards and Answers.
|
|
3843
|
-
*
|
|
3854
|
+
* Updates TML representation of ThoughtSpot objects.
|
|
3844
3855
|
* @example
|
|
3845
3856
|
* ```js
|
|
3846
3857
|
* disabledActions: [Action.UpdateTML]
|
|
@@ -3867,8 +3878,11 @@ export enum Action {
|
|
|
3867
3878
|
*/
|
|
3868
3879
|
Present = 'present',
|
|
3869
3880
|
/**
|
|
3870
|
-
* The tile resize
|
|
3871
|
-
*
|
|
3881
|
+
* The visualization tile resize option.
|
|
3882
|
+
* Also available via More `...` options menu on a visualization.
|
|
3883
|
+
* Allows resizing visualization tiles and switching
|
|
3884
|
+
* between different preset layout option.
|
|
3885
|
+
*
|
|
3872
3886
|
* @example
|
|
3873
3887
|
* ```js
|
|
3874
3888
|
* disabledActions: [Action.ToggleSize]
|
|
@@ -3894,8 +3908,9 @@ export enum Action {
|
|
|
3894
3908
|
*/
|
|
3895
3909
|
EditTitle = 'editTitle',
|
|
3896
3910
|
/**
|
|
3897
|
-
* The **Delete**
|
|
3898
|
-
*
|
|
3911
|
+
* The **Delete** action on a Liveboard, *Liveboards* and
|
|
3912
|
+
* *Answers* list pages in full application embedding.
|
|
3913
|
+
*
|
|
3899
3914
|
* @example
|
|
3900
3915
|
* ```js
|
|
3901
3916
|
* disabledActions: [Action.Remove]
|
|
@@ -3972,8 +3987,9 @@ export enum Action {
|
|
|
3972
3987
|
*/
|
|
3973
3988
|
Explore = 'explore',
|
|
3974
3989
|
/**
|
|
3975
|
-
* The action to include
|
|
3976
|
-
* or
|
|
3990
|
+
* The contextual menu action to include a specific data point
|
|
3991
|
+
* when drilling down a table or chart on an Answer.
|
|
3992
|
+
*
|
|
3977
3993
|
* @example
|
|
3978
3994
|
* ```js
|
|
3979
3995
|
* disabledActions: [Action.DrillInclude]
|
|
@@ -3982,8 +3998,8 @@ export enum Action {
|
|
|
3982
3998
|
|
|
3983
3999
|
DrillInclude = 'context-menu-item-include',
|
|
3984
4000
|
/**
|
|
3985
|
-
* The action to exclude
|
|
3986
|
-
* or
|
|
4001
|
+
* The contextual menu action to exclude a specific data point
|
|
4002
|
+
* when drilling down a table or chart on an Answer.
|
|
3987
4003
|
* @example
|
|
3988
4004
|
* ```js
|
|
3989
4005
|
* disabledActions: [Action.DrillInclude]
|
|
@@ -4130,7 +4146,7 @@ export enum Action {
|
|
|
4130
4146
|
* Allows users to manage data sync pipelines to third-party apps.
|
|
4131
4147
|
* @example
|
|
4132
4148
|
* ```js
|
|
4133
|
-
* disabledActions: [Action.
|
|
4149
|
+
* disabledActions: [Action.ManagePipelines]
|
|
4134
4150
|
* ```
|
|
4135
4151
|
* @version SDK: 1.18.0| ThoughtSpot: 8.10.0.cl, 9.0.1.sw
|
|
4136
4152
|
*/
|
|
@@ -4450,7 +4466,7 @@ export enum Action {
|
|
|
4450
4466
|
/**
|
|
4451
4467
|
* Action ID for the Parent TML action
|
|
4452
4468
|
* The parent action **TML** must be included to access TML-related options
|
|
4453
|
-
* within the cascading menu (specific to the
|
|
4469
|
+
* within the cascading menu (specific to the Answer page)
|
|
4454
4470
|
* @example
|
|
4455
4471
|
* ```js
|
|
4456
4472
|
* // to include specific TML actions
|
|
@@ -4491,8 +4507,10 @@ export enum Action {
|
|
|
4491
4507
|
VerifiedLiveboard = 'verifiedLiveboard',
|
|
4492
4508
|
|
|
4493
4509
|
/**
|
|
4494
|
-
*
|
|
4495
|
-
*
|
|
4510
|
+
* Action ID for the *Ask Sage* In Natural Language Search embed,
|
|
4511
|
+
* *Spotter* in Liveboard, full app, and Spotter embed.
|
|
4512
|
+
*
|
|
4513
|
+
* Allows initiating a conversation with ThoughtSpot AI analyst.
|
|
4496
4514
|
*
|
|
4497
4515
|
* @example
|
|
4498
4516
|
* ```js
|
|
@@ -4701,7 +4719,8 @@ export enum Action {
|
|
|
4701
4719
|
*/
|
|
4702
4720
|
DeletePreviousPrompt = 'deletePreviousPrompt',
|
|
4703
4721
|
/**
|
|
4704
|
-
* Action ID for hide
|
|
4722
|
+
* Action ID for hide or disable editing tokens generated from
|
|
4723
|
+
* Spotter results.
|
|
4705
4724
|
* @example
|
|
4706
4725
|
* ```js
|
|
4707
4726
|
* hiddenAction: [Action.EditTokens]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
if (typeof (Promise as any).withResolvers === 'undefined') {
|
|
2
|
+
(Promise as any).withResolvers = () => {
|
|
3
|
+
let resolve;
|
|
4
|
+
let reject;
|
|
5
|
+
const promise = new Promise((res, rej) => {
|
|
6
|
+
resolve = res;
|
|
7
|
+
reject = rej;
|
|
8
|
+
});
|
|
9
|
+
return { promise, resolve, reject };
|
|
10
|
+
};
|
|
11
|
+
}
|
package/src/utils.spec.ts
CHANGED
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
removeStyleProperties,
|
|
12
12
|
setStyleProperties,
|
|
13
13
|
isUndefined,
|
|
14
|
+
storeValueInWindow,
|
|
15
|
+
getValueFromWindow,
|
|
14
16
|
} from './utils';
|
|
15
17
|
import { RuntimeFilterOp } from './types';
|
|
16
18
|
|
|
@@ -272,4 +274,23 @@ describe('unit test for utils', () => {
|
|
|
272
274
|
expect(isUndefined(undefined)).toBe(true);
|
|
273
275
|
expect(isUndefined({})).toBe(false);
|
|
274
276
|
});
|
|
277
|
+
|
|
278
|
+
describe('getValueFromWindow and storeValueInWindow', () => {
|
|
279
|
+
test('Store and retrieve', () => {
|
|
280
|
+
storeValueInWindow('test', 'testValue');
|
|
281
|
+
expect(getValueFromWindow('test')).toBe('testValue');
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
test('Object should be set if not', () => {
|
|
285
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
286
|
+
(window as any)._tsEmbedSDK = null;
|
|
287
|
+
|
|
288
|
+
storeValueInWindow('test', 'testValue');
|
|
289
|
+
expect(getValueFromWindow('test')).toBe('testValue');
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
test('Return undefined if key is not found', () => {
|
|
293
|
+
expect(getValueFromWindow('notFound')).toBe(undefined);
|
|
294
|
+
});
|
|
295
|
+
});
|
|
275
296
|
});
|
package/src/utils.ts
CHANGED
|
@@ -335,3 +335,55 @@ export const getTypeFromValue = (value: any): [string, string] => {
|
|
|
335
335
|
}
|
|
336
336
|
return ['', ''];
|
|
337
337
|
};
|
|
338
|
+
|
|
339
|
+
const sdkWindowKey = '_tsEmbedSDK' as any;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Stores a value in the global `window` object under the `_tsEmbedSDK` namespace.
|
|
343
|
+
* @param key - The key under which the value will be stored.
|
|
344
|
+
* @param value - The value to store.
|
|
345
|
+
* @param options - Additional options.
|
|
346
|
+
* @param options.ignoreIfAlreadyExists - Does not set if value for key is set.
|
|
347
|
+
*
|
|
348
|
+
* @returns The stored value.
|
|
349
|
+
*
|
|
350
|
+
* @version SDK: 1.36.2 | ThoughtSpot: *
|
|
351
|
+
*/
|
|
352
|
+
export function storeValueInWindow<T>(
|
|
353
|
+
key: string,
|
|
354
|
+
value: T,
|
|
355
|
+
options: { ignoreIfAlreadyExists?: boolean } = {},
|
|
356
|
+
): T {
|
|
357
|
+
if (!window[sdkWindowKey]) {
|
|
358
|
+
(window as any)[sdkWindowKey] = {};
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (options.ignoreIfAlreadyExists && key in (window as any)[sdkWindowKey]) {
|
|
362
|
+
return (window as any)[sdkWindowKey][key];
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
(window as any)[sdkWindowKey][key] = value;
|
|
366
|
+
return value;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Retrieves a stored value from the global `window` object under the `_tsEmbedSDK` namespace.
|
|
371
|
+
* @param key - The key whose value needs to be retrieved.
|
|
372
|
+
* @returns The stored value or `undefined` if the key is not found.
|
|
373
|
+
*/
|
|
374
|
+
export const getValueFromWindow = <T = any>
|
|
375
|
+
(key: string): T => (window as any)?.[sdkWindowKey]?.[key];
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Resets the key if it exists in the `window` object under the `_tsEmbedSDK` key.
|
|
379
|
+
* Returns true if the key was reset, false otherwise.
|
|
380
|
+
* @param key - Key to reset
|
|
381
|
+
* @returns - boolean indicating if the key was reset
|
|
382
|
+
*/
|
|
383
|
+
export function resetValueFromWindow(key: string): boolean {
|
|
384
|
+
if (key in window[sdkWindowKey]) {
|
|
385
|
+
delete (window as any)[sdkWindowKey][key];
|
|
386
|
+
return true;
|
|
387
|
+
}
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"searchEmbed-basic-auth.spec.d.ts","sourceRoot":"","sources":["../../../src/embed/searchEmbed-basic-auth.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const search_1 = require("./search");
|
|
5
|
-
const baseInstance = tslib_1.__importStar(require("./base"));
|
|
6
|
-
const authService = tslib_1.__importStar(require("../utils/authService"));
|
|
7
|
-
const authInstance = tslib_1.__importStar(require("../auth"));
|
|
8
|
-
const config = tslib_1.__importStar(require("../config"));
|
|
9
|
-
const embedConfigInstance = tslib_1.__importStar(require("./embedConfig"));
|
|
10
|
-
const index_1 = require("../index");
|
|
11
|
-
const types_1 = require("../types");
|
|
12
|
-
const test_utils_1 = require("../test/test-utils");
|
|
13
|
-
const auth_spec_1 = require("../auth.spec");
|
|
14
|
-
const thoughtSpotHost = 'tshost';
|
|
15
|
-
(0, index_1.init)({
|
|
16
|
-
thoughtSpotHost,
|
|
17
|
-
authType: types_1.AuthType.Basic,
|
|
18
|
-
username: 'tsadmin',
|
|
19
|
-
password: 'admin',
|
|
20
|
-
});
|
|
21
|
-
describe('Search embed tests when authType is Basic', () => {
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @param version
|
|
25
|
-
*/
|
|
26
|
-
function setupVersion(version) {
|
|
27
|
-
jest.spyOn(window, 'addEventListener').mockImplementation((event, handler, options) => {
|
|
28
|
-
handler({
|
|
29
|
-
data: {
|
|
30
|
-
type: 'xyz',
|
|
31
|
-
},
|
|
32
|
-
ports: [3000],
|
|
33
|
-
source: null,
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(async () => ({
|
|
37
|
-
json: () => ({
|
|
38
|
-
...auth_spec_1.mockSessionInfo,
|
|
39
|
-
releaseVersion: version,
|
|
40
|
-
}),
|
|
41
|
-
status: 200,
|
|
42
|
-
}));
|
|
43
|
-
jest.spyOn(authInstance, 'getReleaseVersion').mockReturnValue(version);
|
|
44
|
-
}
|
|
45
|
-
beforeEach(() => {
|
|
46
|
-
document.body.innerHTML = (0, test_utils_1.getDocumentBody)();
|
|
47
|
-
jest.spyOn(baseInstance, 'getAuthPromise').mockResolvedValue(true);
|
|
48
|
-
});
|
|
49
|
-
afterEach(() => {
|
|
50
|
-
jest.clearAllMocks();
|
|
51
|
-
});
|
|
52
|
-
test('when releaseVersion is empty', async () => {
|
|
53
|
-
setupVersion('');
|
|
54
|
-
const mockAlert = spyOn(window, 'alert');
|
|
55
|
-
const searchEmbed = new search_1.SearchEmbed((0, test_utils_1.getRootEl)(), {});
|
|
56
|
-
await searchEmbed.render();
|
|
57
|
-
expect(mockAlert).not.toBeCalled();
|
|
58
|
-
});
|
|
59
|
-
test("when releaseVersion is '7.0.1.cl' ", async () => {
|
|
60
|
-
setupVersion('7.0.1.cl');
|
|
61
|
-
const mockAlert = jest.spyOn(window, 'alert');
|
|
62
|
-
const searchEmbed = new search_1.SearchEmbed((0, test_utils_1.getRootEl)(), {});
|
|
63
|
-
await searchEmbed.render();
|
|
64
|
-
expect(mockAlert).not.toBeCalled();
|
|
65
|
-
});
|
|
66
|
-
test('when releaseVersion is above 8.4.0.sw', async () => {
|
|
67
|
-
setupVersion('8.4.0.sw');
|
|
68
|
-
const mockAlert = jest.spyOn(window, 'alert');
|
|
69
|
-
const searchEmbed = new search_1.SearchEmbed((0, test_utils_1.getRootEl)(), {});
|
|
70
|
-
await searchEmbed.render();
|
|
71
|
-
expect(mockAlert).not.toBeCalled();
|
|
72
|
-
});
|
|
73
|
-
test('releaseVersion is above 8.4.0.sw', async () => {
|
|
74
|
-
setupVersion('8.8.0.sw');
|
|
75
|
-
jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(() => 'http://tshost');
|
|
76
|
-
const mockAlert = jest.spyOn(window, 'alert');
|
|
77
|
-
const searchEmbed = new search_1.SearchEmbed((0, test_utils_1.getRootEl)(), {});
|
|
78
|
-
await searchEmbed.render();
|
|
79
|
-
expect(mockAlert).not.toBeCalled();
|
|
80
|
-
});
|
|
81
|
-
test('Alert should not appear when suppressSearchEmbedBetaWarning is true and releaseVersion is ts7.dec.cl', async () => {
|
|
82
|
-
setupVersion('ts7.dec.cl');
|
|
83
|
-
jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(() => 'http://tshost');
|
|
84
|
-
jest.spyOn(embedConfigInstance, 'getEmbedConfig').mockReturnValue({
|
|
85
|
-
suppressSearchEmbedBetaWarning: true,
|
|
86
|
-
});
|
|
87
|
-
const mockAlert = jest.spyOn(window, 'alert');
|
|
88
|
-
const searchEmbed = new search_1.SearchEmbed((0, test_utils_1.getRootEl)(), {});
|
|
89
|
-
await searchEmbed.render();
|
|
90
|
-
expect(mockAlert).not.toBeCalled();
|
|
91
|
-
});
|
|
92
|
-
test('Alert should not appear when suppressSearchEmbedBetaWarning is true and releaseVersion is 8.4.0.sw', async () => {
|
|
93
|
-
setupVersion('8.4.0.sw');
|
|
94
|
-
jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(() => 'http://tshost');
|
|
95
|
-
jest.spyOn(embedConfigInstance, 'getEmbedConfig').mockReturnValue({
|
|
96
|
-
suppressSearchEmbedBetaWarning: true,
|
|
97
|
-
});
|
|
98
|
-
const mockAlert = jest.spyOn(window, 'alert');
|
|
99
|
-
const searchEmbed = new search_1.SearchEmbed((0, test_utils_1.getRootEl)(), {});
|
|
100
|
-
await searchEmbed.render();
|
|
101
|
-
expect(mockAlert).not.toBeCalled();
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
//# sourceMappingURL=searchEmbed-basic-auth.spec.js.map
|