@thoughtspot/visual-embed-sdk 1.39.1 → 1.39.2-alpha.2
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/config.spec.js +9 -0
- package/cjs/src/config.spec.js.map +1 -1
- package/cjs/src/embed/app.d.ts +75 -15
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +69 -9
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +374 -12
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.d.ts +19 -7
- package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/cjs/src/embed/bodyless-conversation.js +24 -4
- package/cjs/src/embed/bodyless-conversation.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.spec.js +8 -190
- package/cjs/src/embed/bodyless-conversation.spec.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +28 -0
- package/cjs/src/embed/conversation.spec.js.map +1 -1
- package/cjs/src/embed/embedConfig.d.ts +9 -7
- package/cjs/src/embed/embedConfig.d.ts.map +1 -1
- package/cjs/src/embed/embedConfig.js +9 -7
- package/cjs/src/embed/embedConfig.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +56 -17
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +48 -4
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +215 -11
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +5 -0
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +16 -1
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +164 -0
- 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/index.d.ts +2 -2
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +2 -1
- package/cjs/src/index.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 +3 -2
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/react/index.d.ts +71 -20
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +79 -42
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +436 -100
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +80 -6
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +45 -1
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/graphql/nlsService/conversation-service.d.ts.map +1 -1
- package/cjs/src/utils/graphql/nlsService/conversation-service.js +2 -0
- package/cjs/src/utils/graphql/nlsService/conversation-service.js.map +1 -1
- package/cjs/src/utils/processTrigger.js +2 -1
- package/cjs/src/utils/processTrigger.js.map +1 -1
- package/cjs/src/utils.d.ts +6 -0
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +23 -3
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +237 -1
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/{index-JaFaxrvQ.js → index-CmEQfuE3.js} +1 -1
- package/dist/index-DeFzsyFF.js +7371 -0
- package/dist/index-Dpf0rd6w.js +7371 -0
- package/dist/index-UuEbsISo.js +7447 -0
- package/dist/index-e3Uw3YFO.js +7371 -0
- package/dist/src/embed/app.d.ts +75 -15
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/bodyless-conversation.d.ts +19 -7
- package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/dist/src/embed/embedConfig.d.ts +9 -7
- package/dist/src/embed/embedConfig.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +56 -17
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +5 -0
- package/dist/src/embed/ts-embed.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/index.d.ts +2 -2
- package/dist/src/index.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 +71 -20
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +80 -6
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/graphql/nlsService/conversation-service.d.ts.map +1 -1
- package/dist/src/utils.d.ts +6 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +320 -78
- package/dist/tsembed-react.js +320 -76
- package/dist/tsembed.es.js +238 -31
- package/dist/tsembed.js +236 -29
- package/dist/visual-embed-sdk-react-full.d.ts +288 -72
- package/dist/visual-embed-sdk-react.d.ts +288 -72
- package/dist/visual-embed-sdk.d.ts +218 -53
- package/lib/package.json +1 -1
- package/lib/src/config.spec.js +9 -0
- package/lib/src/config.spec.js.map +1 -1
- package/lib/src/embed/app.d.ts +75 -15
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +69 -9
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +376 -14
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.d.ts +19 -7
- package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/lib/src/embed/bodyless-conversation.js +23 -4
- package/lib/src/embed/bodyless-conversation.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.spec.js +9 -191
- package/lib/src/embed/bodyless-conversation.spec.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +30 -2
- package/lib/src/embed/conversation.spec.js.map +1 -1
- package/lib/src/embed/embedConfig.d.ts +9 -7
- package/lib/src/embed/embedConfig.d.ts.map +1 -1
- package/lib/src/embed/embedConfig.js +9 -7
- package/lib/src/embed/embedConfig.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +56 -17
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +49 -5
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +215 -11
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +5 -0
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +16 -1
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +164 -0
- 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/index.d.ts +2 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -2
- package/lib/src/index.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 +71 -20
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +79 -43
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +439 -103
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +80 -6
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +45 -1
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/graphql/nlsService/conversation-service.d.ts.map +1 -1
- package/lib/src/utils/graphql/nlsService/conversation-service.js +2 -0
- package/lib/src/utils/graphql/nlsService/conversation-service.js.map +1 -1
- package/lib/src/utils/processTrigger.js +2 -1
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils.d.ts +6 -0
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +21 -2
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +238 -2
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +219 -54
- package/package.json +1 -1
- package/src/config.spec.ts +11 -0
- package/src/embed/app.spec.ts +479 -26
- package/src/embed/app.ts +133 -27
- package/src/embed/bodyless-conversation.spec.ts +9 -203
- package/src/embed/bodyless-conversation.ts +24 -10
- package/src/embed/conversation.spec.ts +40 -2
- package/src/embed/embedConfig.ts +10 -8
- package/src/embed/liveboard.spec.ts +256 -5
- package/src/embed/liveboard.ts +99 -27
- package/src/embed/ts-embed.spec.ts +225 -0
- package/src/embed/ts-embed.ts +19 -0
- package/src/errors.ts +1 -0
- package/src/index.ts +2 -0
- package/src/react/all-types-export.ts +2 -1
- package/src/react/index.spec.tsx +556 -157
- package/src/react/index.tsx +117 -51
- package/src/types.ts +117 -43
- package/src/utils/graphql/nlsService/conversation-service.ts +2 -0
- package/src/utils/processTrigger.ts +1 -1
- package/src/utils.spec.ts +279 -2
- package/src/utils.ts +28 -2
package/dist/tsembed-react.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.39.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.39.2-alpha.2 */
|
|
2
2
|
'use client';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import React__default, { useRef } from 'react';
|
|
4
|
+
import React__default, { useRef, useCallback } from 'react';
|
|
5
5
|
|
|
6
6
|
function _mergeNamespaces(n, m) {
|
|
7
7
|
m.forEach(function (e) {
|
|
@@ -399,6 +399,12 @@ var HomeLeftNavItem;
|
|
|
399
399
|
* @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
400
400
|
*/
|
|
401
401
|
HomeLeftNavItem["Spotter"] = "spotter";
|
|
402
|
+
/**
|
|
403
|
+
* Favorites option in the insights left navigation,
|
|
404
|
+
* available when new navigation V3 is enabled.
|
|
405
|
+
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
406
|
+
*/
|
|
407
|
+
HomeLeftNavItem["Favorites"] = "favorites";
|
|
402
408
|
})(HomeLeftNavItem || (HomeLeftNavItem = {}));
|
|
403
409
|
/**
|
|
404
410
|
* A map of the supported runtime filter operations
|
|
@@ -1585,6 +1591,12 @@ var EmbedEvent;
|
|
|
1585
1591
|
* @version SDK : 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
1586
1592
|
*/
|
|
1587
1593
|
EmbedEvent["ExitPresentMode"] = "exitPresentMode";
|
|
1594
|
+
/**
|
|
1595
|
+
* Emitted when a user requests the full height lazy load data.
|
|
1596
|
+
* @version SDK : 1.39.0 | ThoughtSpot : 10.10.0.cl
|
|
1597
|
+
* @hidden
|
|
1598
|
+
*/
|
|
1599
|
+
EmbedEvent["RequestVisibleEmbedCoordinates"] = "requestVisibleEmbedCoordinates";
|
|
1588
1600
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
1589
1601
|
/**
|
|
1590
1602
|
* Event types that can be triggered by the host application
|
|
@@ -2669,6 +2681,19 @@ var HostEvent;
|
|
|
2669
2681
|
* @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
2670
2682
|
*/
|
|
2671
2683
|
HostEvent["ExitPresentMode"] = "exitPresentMode";
|
|
2684
|
+
/**
|
|
2685
|
+
* Triggers the full height lazy load data.
|
|
2686
|
+
* @example
|
|
2687
|
+
* ```js
|
|
2688
|
+
* liveboardEmbed.on(EmbedEvent.RequestVisibleEmbedCoordinates, (payload) => {
|
|
2689
|
+
* console.log(payload);
|
|
2690
|
+
* });
|
|
2691
|
+
* ```
|
|
2692
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
|
|
2693
|
+
*
|
|
2694
|
+
* @hidden
|
|
2695
|
+
*/
|
|
2696
|
+
HostEvent["VisibleEmbedCoordinates"] = "visibleEmbedCoordinates";
|
|
2672
2697
|
})(HostEvent || (HostEvent = {}));
|
|
2673
2698
|
/**
|
|
2674
2699
|
* The different visual modes that the data sources panel within
|
|
@@ -2774,6 +2799,7 @@ var Param;
|
|
|
2774
2799
|
Param["Query"] = "query";
|
|
2775
2800
|
Param["HideHomepageLeftNav"] = "hideHomepageLeftNav";
|
|
2776
2801
|
Param["ModularHomeExperienceEnabled"] = "modularHomeExperience";
|
|
2802
|
+
Param["ListPageVersion"] = "listpageVersion";
|
|
2777
2803
|
Param["PendoTrackingKey"] = "additionalPendoKey";
|
|
2778
2804
|
Param["LiveboardHeaderSticky"] = "isLiveboardHeaderSticky";
|
|
2779
2805
|
Param["IsProductTour"] = "isProductTour";
|
|
@@ -2808,10 +2834,12 @@ var Param;
|
|
|
2808
2834
|
Param["DataSourceId"] = "dataSourceId";
|
|
2809
2835
|
Param["preAuthCache"] = "preAuthCache";
|
|
2810
2836
|
Param["ShowSpotterLimitations"] = "showSpotterLimitations";
|
|
2811
|
-
Param["CoverAndFilterOptionInPDF"] = "
|
|
2837
|
+
Param["CoverAndFilterOptionInPDF"] = "arePdfCoverFilterPageCheckboxesEnabled";
|
|
2812
2838
|
Param["PrimaryAction"] = "primaryAction";
|
|
2813
2839
|
Param["isSpotterAgentEmbed"] = "isSpotterAgentEmbed";
|
|
2814
2840
|
Param["IsLiveboardStylingAndGroupingEnabled"] = "isLiveboardStylingAndGroupingEnabled";
|
|
2841
|
+
Param["IsLazyLoadingForEmbedEnabled"] = "isLazyLoadingForEmbedEnabled";
|
|
2842
|
+
Param["RootMarginForLazyLoad"] = "rootMarginForLazyLoad";
|
|
2815
2843
|
})(Param || (Param = {}));
|
|
2816
2844
|
/**
|
|
2817
2845
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -4034,6 +4062,22 @@ var Action;
|
|
|
4034
4062
|
* @version SDK: 1.37.0 | ThoughtSpot Cloud: 10.8.0.cl
|
|
4035
4063
|
*/
|
|
4036
4064
|
Action["CoverAndFilterOptionInPDF"] = "coverAndFilterOptionInPDF";
|
|
4065
|
+
/**
|
|
4066
|
+
* Action ID for hide or disable the
|
|
4067
|
+
* Spotter in conversation training widget.
|
|
4068
|
+
* The Add to Coaching feature is currently in beta
|
|
4069
|
+
* and is disabled by default on embed deployments.
|
|
4070
|
+
* To enable this feature on your instance,
|
|
4071
|
+
* contact ThoughtSpot Support.
|
|
4072
|
+
* @example
|
|
4073
|
+
* ```js
|
|
4074
|
+
* hiddenAction: [Action.InConversationTraining]
|
|
4075
|
+
* disabledActions: [Action.InConversationTraining]
|
|
4076
|
+
*
|
|
4077
|
+
* ```
|
|
4078
|
+
* @version SDK: 1.39.0 | ThoughtSpot Cloud: 10.10.0.cl
|
|
4079
|
+
*/
|
|
4080
|
+
Action["InConversationTraining"] = "InConversationTraining";
|
|
4037
4081
|
})(Action || (Action = {}));
|
|
4038
4082
|
var PrefetchFeatures;
|
|
4039
4083
|
(function (PrefetchFeatures) {
|
|
@@ -4417,7 +4461,6 @@ const getOperationNameFromQuery = (query) => {
|
|
|
4417
4461
|
function removeTypename(obj) {
|
|
4418
4462
|
if (!obj || typeof obj !== 'object')
|
|
4419
4463
|
return obj;
|
|
4420
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
4421
4464
|
for (const key in obj) {
|
|
4422
4465
|
if (key === '__typename') {
|
|
4423
4466
|
delete obj[key];
|
|
@@ -4446,7 +4489,11 @@ const setStyleProperties = (element, styleProperties) => {
|
|
|
4446
4489
|
if (!(element === null || element === void 0 ? void 0 : element.style))
|
|
4447
4490
|
return;
|
|
4448
4491
|
Object.keys(styleProperties).forEach((styleProperty) => {
|
|
4449
|
-
|
|
4492
|
+
const styleKey = styleProperty;
|
|
4493
|
+
const value = styleProperties[styleKey];
|
|
4494
|
+
if (value !== undefined) {
|
|
4495
|
+
element.style[styleKey] = value.toString();
|
|
4496
|
+
}
|
|
4450
4497
|
});
|
|
4451
4498
|
};
|
|
4452
4499
|
/**
|
|
@@ -4574,6 +4621,22 @@ const handleExitPresentMode = async () => {
|
|
|
4574
4621
|
}
|
|
4575
4622
|
}
|
|
4576
4623
|
logger$3.warn('Exit fullscreen API is not supported by this browser.');
|
|
4624
|
+
};
|
|
4625
|
+
const calculateVisibleElementData = (element) => {
|
|
4626
|
+
const rect = element.getBoundingClientRect();
|
|
4627
|
+
const windowHeight = window.innerHeight;
|
|
4628
|
+
const windowWidth = window.innerWidth;
|
|
4629
|
+
const frameRelativeTop = Math.max(rect.top, 0);
|
|
4630
|
+
const frameRelativeLeft = Math.max(rect.left, 0);
|
|
4631
|
+
const frameRelativeBottom = Math.min(windowHeight, rect.bottom);
|
|
4632
|
+
const frameRelativeRight = Math.min(windowWidth, rect.right);
|
|
4633
|
+
const data = {
|
|
4634
|
+
top: Math.max(0, rect.top * -1),
|
|
4635
|
+
height: Math.max(0, frameRelativeBottom - frameRelativeTop),
|
|
4636
|
+
left: Math.max(0, rect.left * -1),
|
|
4637
|
+
width: Math.max(0, frameRelativeRight - frameRelativeLeft),
|
|
4638
|
+
};
|
|
4639
|
+
return data;
|
|
4577
4640
|
};
|
|
4578
4641
|
|
|
4579
4642
|
/**
|
|
@@ -6869,6 +6932,7 @@ const ERROR_MESSAGE = {
|
|
|
6869
6932
|
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',
|
|
6870
6933
|
MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
|
|
6871
6934
|
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',
|
|
6935
|
+
SPOTTER_AGENT_NOT_INITIALIZED: 'SpotterAgent not initialized',
|
|
6872
6936
|
};
|
|
6873
6937
|
|
|
6874
6938
|
const EndPoints = {
|
|
@@ -7076,13 +7140,14 @@ const configKey = 'embedConfig';
|
|
|
7076
7140
|
*
|
|
7077
7141
|
* @example
|
|
7078
7142
|
* ```js
|
|
7143
|
+
* import { getInitConfig } from '@thoughtspot/visual-embed-sdk';
|
|
7144
|
+
* // Call the getInitConfig method to retrieve the embed configuration
|
|
7079
7145
|
* const config = getInitConfig();
|
|
7146
|
+
* // Log the configuration settings
|
|
7080
7147
|
* console.log(config);
|
|
7081
7148
|
* ```
|
|
7082
|
-
*
|
|
7083
|
-
*
|
|
7084
|
-
* Returns the `EmbedConfig` object, which
|
|
7085
|
-
* contains the configuration settings used to
|
|
7149
|
+
* Returns the link:https://developers.thoughtspot.com/docs/Interface_EmbedConfig[EmbedConfig]
|
|
7150
|
+
* object, which contains the configuration settings used to
|
|
7086
7151
|
* initialize the SDK, including the following:
|
|
7087
7152
|
*
|
|
7088
7153
|
* - `thoughtSpotHost` - ThoughtSpot host URL
|
|
@@ -7091,9 +7156,10 @@ const configKey = 'embedConfig';
|
|
|
7091
7156
|
* - `customizations` - Style, text, and icon customization settings
|
|
7092
7157
|
* that were applied during the SDK initialization.
|
|
7093
7158
|
*
|
|
7094
|
-
*
|
|
7095
|
-
*
|
|
7159
|
+
* The following JSON output shows the embed configuration
|
|
7160
|
+
* settings returned from the code in the previous example:
|
|
7096
7161
|
*
|
|
7162
|
+
* @example
|
|
7097
7163
|
* ```json
|
|
7098
7164
|
* {
|
|
7099
7165
|
* "thoughtSpotHost": "https://{ThoughtSpot-Host}",
|
|
@@ -7115,7 +7181,7 @@ const configKey = 'embedConfig';
|
|
|
7115
7181
|
* "authTriggerContainer": "#your-own-div"
|
|
7116
7182
|
* }
|
|
7117
7183
|
* ```
|
|
7118
|
-
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.
|
|
7184
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw, and later
|
|
7119
7185
|
* @group Global methods
|
|
7120
7186
|
*/
|
|
7121
7187
|
const getEmbedConfig = () => getValueFromWindow(configKey) || {};
|
|
@@ -7757,7 +7823,7 @@ class AnswerService {
|
|
|
7757
7823
|
async getTML() {
|
|
7758
7824
|
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
7759
7825
|
const edoc = object[0].edoc;
|
|
7760
|
-
const YAML = await import('./index-
|
|
7826
|
+
const YAML = await import('./index-e3Uw3YFO.js');
|
|
7761
7827
|
const parsedDoc = YAML.parse(edoc);
|
|
7762
7828
|
return {
|
|
7763
7829
|
answer: {
|
|
@@ -15491,7 +15557,7 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
|
15491
15557
|
return e;
|
|
15492
15558
|
}
|
|
15493
15559
|
|
|
15494
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.39.
|
|
15560
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.39.2-alpha.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",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":"^8.28.0","@typescript-eslint/parser":"^8.28.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:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.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",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","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
15495
15561
|
|
|
15496
15562
|
/**
|
|
15497
15563
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -15514,7 +15580,8 @@ const reload = (iFrame) => {
|
|
|
15514
15580
|
* @param channel
|
|
15515
15581
|
*/
|
|
15516
15582
|
function postIframeMessage(iFrame, message, thoughtSpotHost, channel) {
|
|
15517
|
-
|
|
15583
|
+
var _a;
|
|
15584
|
+
return (_a = iFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message, thoughtSpotHost, [channel === null || channel === void 0 ? void 0 : channel.port2]);
|
|
15518
15585
|
}
|
|
15519
15586
|
const TRIGGER_TIMEOUT = 30000;
|
|
15520
15587
|
/**
|
|
@@ -15889,10 +15956,25 @@ class TsEmbed {
|
|
|
15889
15956
|
// - cached auth info would be for wrong org
|
|
15890
15957
|
// - info call response changes for each different overrideOrgId
|
|
15891
15958
|
// 2. disablePreauthCache is explicitly set to true
|
|
15959
|
+
// 3. FullAppEmbed has primary navbar visible since:
|
|
15960
|
+
// - primary navbar requires fresh auth state for navigation
|
|
15961
|
+
// - cached auth may not reflect current user permissions
|
|
15892
15962
|
const isDisabled = (this.viewConfig.overrideOrgId !== undefined
|
|
15893
|
-
|| this.embedConfig.disablePreauthCache === true
|
|
15963
|
+
|| this.embedConfig.disablePreauthCache === true
|
|
15964
|
+
|| this.isFullAppEmbedWithVisiblePrimaryNavbar());
|
|
15894
15965
|
return !isDisabled;
|
|
15895
15966
|
}
|
|
15967
|
+
/**
|
|
15968
|
+
* Checks if current embed is FullAppEmbed with visible primary navbar
|
|
15969
|
+
* @returns boolean
|
|
15970
|
+
*/
|
|
15971
|
+
isFullAppEmbedWithVisiblePrimaryNavbar() {
|
|
15972
|
+
const appViewConfig = this.viewConfig;
|
|
15973
|
+
// Check if this is a FullAppEmbed (AppEmbed)
|
|
15974
|
+
// showPrimaryNavbar defaults to true if not explicitly set to false
|
|
15975
|
+
return (appViewConfig.embedComponentType === 'AppEmbed'
|
|
15976
|
+
&& appViewConfig.showPrimaryNavbar === true);
|
|
15977
|
+
}
|
|
15896
15978
|
/**
|
|
15897
15979
|
* fix for ts7.sep.cl
|
|
15898
15980
|
* will be removed for ts7.oct.cl
|
|
@@ -17212,7 +17294,6 @@ let SearchEmbed$1 = class SearchEmbed extends TsEmbed {
|
|
|
17212
17294
|
/**
|
|
17213
17295
|
* Pages within the ThoughtSpot app that can be embedded.
|
|
17214
17296
|
*/
|
|
17215
|
-
// eslint-disable-next-line no-shadow
|
|
17216
17297
|
var Page;
|
|
17217
17298
|
(function (Page) {
|
|
17218
17299
|
/**
|
|
@@ -17298,16 +17379,46 @@ var HomePage;
|
|
|
17298
17379
|
*/
|
|
17299
17380
|
HomePage["Modular"] = "v2";
|
|
17300
17381
|
})(HomePage || (HomePage = {}));
|
|
17382
|
+
/**
|
|
17383
|
+
* Define the version of the list page
|
|
17384
|
+
* @version SDK: 1.40.0 | ThoughtSpot: 10.12.0.cl
|
|
17385
|
+
*/
|
|
17386
|
+
var ListPage;
|
|
17387
|
+
(function (ListPage) {
|
|
17388
|
+
/**
|
|
17389
|
+
* List (v2) is the traditional List Experience.
|
|
17390
|
+
* It serves as the foundational version of the list page.
|
|
17391
|
+
*/
|
|
17392
|
+
ListPage["List"] = "v2";
|
|
17393
|
+
/**
|
|
17394
|
+
* ListWithUXChanges (v3) introduces the new updated list page with UX changes.
|
|
17395
|
+
*/
|
|
17396
|
+
ListPage["ListWithUXChanges"] = "v3";
|
|
17397
|
+
})(ListPage || (ListPage = {}));
|
|
17301
17398
|
/**
|
|
17302
17399
|
* Embeds full ThoughtSpot experience in a host application.
|
|
17303
17400
|
* @group Embed components
|
|
17304
17401
|
*/
|
|
17305
17402
|
let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
17306
|
-
// eslint-disable-next-line no-useless-constructor
|
|
17307
17403
|
constructor(domSelector, viewConfig) {
|
|
17308
17404
|
viewConfig.embedComponentType = 'AppEmbed';
|
|
17309
17405
|
super(domSelector, viewConfig);
|
|
17310
17406
|
this.defaultHeight = '100%';
|
|
17407
|
+
this.sendFullHeightLazyLoadData = () => {
|
|
17408
|
+
const data = calculateVisibleElementData(this.iFrame);
|
|
17409
|
+
this.trigger(HostEvent.VisibleEmbedCoordinates, data);
|
|
17410
|
+
};
|
|
17411
|
+
/**
|
|
17412
|
+
* This is a handler for the RequestVisibleEmbedCoordinates event.
|
|
17413
|
+
* It is used to send the visible coordinates data to the host application.
|
|
17414
|
+
* @param data The event payload
|
|
17415
|
+
* @param responder The responder function
|
|
17416
|
+
*/
|
|
17417
|
+
this.requestVisibleEmbedCoordinatesHandler = (data, responder) => {
|
|
17418
|
+
logger$3.info('Sending RequestVisibleEmbedCoordinates', data);
|
|
17419
|
+
const visibleCoordinatesData = calculateVisibleElementData(this.iFrame);
|
|
17420
|
+
responder({ type: EmbedEvent.RequestVisibleEmbedCoordinates, data: visibleCoordinatesData });
|
|
17421
|
+
};
|
|
17311
17422
|
/**
|
|
17312
17423
|
* Set the iframe height as per the computed height received
|
|
17313
17424
|
* from the ThoughtSpot app.
|
|
@@ -17316,6 +17427,7 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17316
17427
|
this.updateIFrameHeight = (data) => {
|
|
17317
17428
|
var _a;
|
|
17318
17429
|
this.setIFrameHeight(Math.max(data.data, (_a = this.iFrame) === null || _a === void 0 ? void 0 : _a.scrollHeight));
|
|
17430
|
+
this.sendFullHeightLazyLoadData();
|
|
17319
17431
|
};
|
|
17320
17432
|
this.embedIframeCenter = (data, responder) => {
|
|
17321
17433
|
const obj = this.getIframeCenter();
|
|
@@ -17345,6 +17457,7 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17345
17457
|
this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
17346
17458
|
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
17347
17459
|
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
17460
|
+
this.on(EmbedEvent.RequestVisibleEmbedCoordinates, this.requestVisibleEmbedCoordinatesHandler);
|
|
17348
17461
|
}
|
|
17349
17462
|
}
|
|
17350
17463
|
/**
|
|
@@ -17352,9 +17465,7 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17352
17465
|
* embedded Liveboard or visualization.
|
|
17353
17466
|
*/
|
|
17354
17467
|
getEmbedParams() {
|
|
17355
|
-
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
|
|
17356
|
-
/* eslint-disable-next-line max-len */
|
|
17357
|
-
dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
17468
|
+
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
17358
17469
|
let params = {};
|
|
17359
17470
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
17360
17471
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
@@ -17370,6 +17481,7 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17370
17481
|
params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
|
|
17371
17482
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
17372
17483
|
params[Param.IsUnifiedSearchExperienceEnabled] = isUnifiedSearchExperienceEnabled;
|
|
17484
|
+
params[Param.CoverAndFilterOptionInPDF] = !!coverAndFilterOptionInPDF;
|
|
17373
17485
|
params = this.getBaseQueryParams(params);
|
|
17374
17486
|
if (hideObjectSearch) {
|
|
17375
17487
|
params[Param.HideObjectSearch] = !!hideObjectSearch;
|
|
@@ -17382,6 +17494,10 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17382
17494
|
}
|
|
17383
17495
|
if (fullHeight === true) {
|
|
17384
17496
|
params[Param.fullHeight] = true;
|
|
17497
|
+
if (this.viewConfig.lazyLoadingForFullHeight) {
|
|
17498
|
+
params[Param.IsLazyLoadingForEmbedEnabled] = true;
|
|
17499
|
+
params[Param.RootMarginForLazyLoad] = this.viewConfig.lazyLoadingMargin;
|
|
17500
|
+
}
|
|
17385
17501
|
}
|
|
17386
17502
|
if (tag) {
|
|
17387
17503
|
params[Param.Tag] = tag;
|
|
@@ -17402,7 +17518,6 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17402
17518
|
params[Param.enableAskSage] = enableAskSage;
|
|
17403
17519
|
}
|
|
17404
17520
|
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
17405
|
-
/* eslint-disable-next-line max-len */
|
|
17406
17521
|
params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
17407
17522
|
}
|
|
17408
17523
|
if (homePageSearchBarMode) {
|
|
@@ -17423,11 +17538,9 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17423
17538
|
=== DataPanelCustomColumnGroupsAccordionState.COLLAPSE_ALL
|
|
17424
17539
|
|| dataPanelCustomGroupsAccordionInitialState
|
|
17425
17540
|
=== DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST) {
|
|
17426
|
-
/* eslint-disable-next-line max-len */
|
|
17427
17541
|
params[Param.DataPanelCustomGroupsAccordionInitialState] = dataPanelCustomGroupsAccordionInitialState;
|
|
17428
17542
|
}
|
|
17429
17543
|
else {
|
|
17430
|
-
/* eslint-disable-next-line max-len */
|
|
17431
17544
|
params[Param.DataPanelCustomGroupsAccordionInitialState] = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL;
|
|
17432
17545
|
}
|
|
17433
17546
|
if (discoveryExperience) {
|
|
@@ -17440,6 +17553,10 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17440
17553
|
if (discoveryExperience.homePage === HomePage.Modular) {
|
|
17441
17554
|
params[Param.ModularHomeExperienceEnabled] = true;
|
|
17442
17555
|
}
|
|
17556
|
+
// listPageVersion v3 will enable the new list page
|
|
17557
|
+
if (discoveryExperience.listPageVersion === ListPage.ListWithUXChanges) {
|
|
17558
|
+
params[Param.ListPageVersion] = discoveryExperience.listPageVersion;
|
|
17559
|
+
}
|
|
17443
17560
|
}
|
|
17444
17561
|
const queryParams = getQueryParamString(params, true);
|
|
17445
17562
|
return queryParams;
|
|
@@ -17527,6 +17644,30 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17527
17644
|
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
17528
17645
|
}
|
|
17529
17646
|
}
|
|
17647
|
+
/**
|
|
17648
|
+
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
17649
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
|
|
17650
|
+
*/
|
|
17651
|
+
destroy() {
|
|
17652
|
+
super.destroy();
|
|
17653
|
+
this.unregisterLazyLoadEvents();
|
|
17654
|
+
}
|
|
17655
|
+
postRender() {
|
|
17656
|
+
this.registerLazyLoadEvents();
|
|
17657
|
+
}
|
|
17658
|
+
registerLazyLoadEvents() {
|
|
17659
|
+
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
17660
|
+
// TODO: Use passive: true, install modernizr to check for passive
|
|
17661
|
+
window.addEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
17662
|
+
window.addEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
17663
|
+
}
|
|
17664
|
+
}
|
|
17665
|
+
unregisterLazyLoadEvents() {
|
|
17666
|
+
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
17667
|
+
window.removeEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
17668
|
+
window.removeEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
17669
|
+
}
|
|
17670
|
+
}
|
|
17530
17671
|
/**
|
|
17531
17672
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
17532
17673
|
* @param renderOptions An object containing the page ID
|
|
@@ -17536,6 +17677,7 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
17536
17677
|
await super.render();
|
|
17537
17678
|
const src = this.getIFrameSrc();
|
|
17538
17679
|
await this.renderV1Embed(src);
|
|
17680
|
+
this.postRender();
|
|
17539
17681
|
return this;
|
|
17540
17682
|
}
|
|
17541
17683
|
};
|
|
@@ -17640,6 +17782,21 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
|
17640
17782
|
viewConfig.embedComponentType = 'LiveboardEmbed';
|
|
17641
17783
|
super(domSelector, viewConfig);
|
|
17642
17784
|
this.defaultHeight = 500;
|
|
17785
|
+
this.sendFullHeightLazyLoadData = () => {
|
|
17786
|
+
const data = calculateVisibleElementData(this.iFrame);
|
|
17787
|
+
this.trigger(HostEvent.VisibleEmbedCoordinates, data);
|
|
17788
|
+
};
|
|
17789
|
+
/**
|
|
17790
|
+
* This is a handler for the RequestVisibleEmbedCoordinates event.
|
|
17791
|
+
* It is used to send the visible coordinates data to the host application.
|
|
17792
|
+
* @param data The event payload
|
|
17793
|
+
* @param responder The responder function
|
|
17794
|
+
*/
|
|
17795
|
+
this.requestVisibleEmbedCoordinatesHandler = (data, responder) => {
|
|
17796
|
+
logger$3.info('Sending RequestVisibleEmbedCoordinates', data);
|
|
17797
|
+
const visibleCoordinatesData = calculateVisibleElementData(this.iFrame);
|
|
17798
|
+
responder({ type: EmbedEvent.RequestVisibleEmbedCoordinates, data: visibleCoordinatesData });
|
|
17799
|
+
};
|
|
17643
17800
|
/**
|
|
17644
17801
|
* Set the iframe height as per the computed height received
|
|
17645
17802
|
* from the ThoughtSpot app.
|
|
@@ -17647,6 +17804,7 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
|
17647
17804
|
*/
|
|
17648
17805
|
this.updateIFrameHeight = (data) => {
|
|
17649
17806
|
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
|
|
17807
|
+
this.sendFullHeightLazyLoadData();
|
|
17650
17808
|
};
|
|
17651
17809
|
this.embedIframeCenter = (data, responder) => {
|
|
17652
17810
|
const obj = this.getIframeCenter();
|
|
@@ -17680,6 +17838,7 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
|
17680
17838
|
this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
17681
17839
|
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
17682
17840
|
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
17841
|
+
this.on(EmbedEvent.RequestVisibleEmbedCoordinates, this.requestVisibleEmbedCoordinatesHandler);
|
|
17683
17842
|
}
|
|
17684
17843
|
}
|
|
17685
17844
|
/**
|
|
@@ -17689,11 +17848,15 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
|
17689
17848
|
getEmbedParams() {
|
|
17690
17849
|
let params = {};
|
|
17691
17850
|
params = this.getBaseQueryParams(params);
|
|
17692
|
-
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, isLiveboardHeaderSticky = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, enableAskSage, enable2ColumnLayout, dataPanelV2 = false, enableCustomColumnGroups = false, oAuthPollingInterval, isForceRedirect, dataSourceId, coverAndFilterOptionInPDF, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
17851
|
+
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, isLiveboardHeaderSticky = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, enableAskSage, enable2ColumnLayout, dataPanelV2 = false, enableCustomColumnGroups = false, oAuthPollingInterval, isForceRedirect, dataSourceId, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
17693
17852
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
17694
17853
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
17695
17854
|
if (fullHeight === true) {
|
|
17696
17855
|
params[Param.fullHeight] = true;
|
|
17856
|
+
if (this.viewConfig.lazyLoadingForFullHeight) {
|
|
17857
|
+
params[Param.IsLazyLoadingForEmbedEnabled] = true;
|
|
17858
|
+
params[Param.RootMarginForLazyLoad] = this.viewConfig.lazyLoadingMargin;
|
|
17859
|
+
}
|
|
17697
17860
|
}
|
|
17698
17861
|
if (defaultHeight) {
|
|
17699
17862
|
this.defaultHeight = defaultHeight;
|
|
@@ -17741,9 +17904,6 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
|
17741
17904
|
if (dataSourceId !== undefined) {
|
|
17742
17905
|
params[Param.DataSourceId] = dataSourceId;
|
|
17743
17906
|
}
|
|
17744
|
-
if (coverAndFilterOptionInPDF !== undefined) {
|
|
17745
|
-
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
17746
|
-
}
|
|
17747
17907
|
if (isLiveboardStylingAndGroupingEnabled !== undefined) {
|
|
17748
17908
|
params[Param.IsLiveboardStylingAndGroupingEnabled] = isLiveboardStylingAndGroupingEnabled;
|
|
17749
17909
|
}
|
|
@@ -17754,6 +17914,7 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
|
17754
17914
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
17755
17915
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
17756
17916
|
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
17917
|
+
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
17757
17918
|
const queryParams = getQueryParamString(params, true);
|
|
17758
17919
|
return queryParams;
|
|
17759
17920
|
}
|
|
@@ -17851,6 +18012,30 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
|
17851
18012
|
}
|
|
17852
18013
|
return super.trigger(messageType, dataWithVizId);
|
|
17853
18014
|
}
|
|
18015
|
+
/**
|
|
18016
|
+
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
18017
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
|
|
18018
|
+
*/
|
|
18019
|
+
destroy() {
|
|
18020
|
+
super.destroy();
|
|
18021
|
+
this.unregisterLazyLoadEvents();
|
|
18022
|
+
}
|
|
18023
|
+
postRender() {
|
|
18024
|
+
this.registerLazyLoadEvents();
|
|
18025
|
+
}
|
|
18026
|
+
registerLazyLoadEvents() {
|
|
18027
|
+
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
18028
|
+
// TODO: Use passive: true, install modernizr to check for passive
|
|
18029
|
+
window.addEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
18030
|
+
window.addEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
18031
|
+
}
|
|
18032
|
+
}
|
|
18033
|
+
unregisterLazyLoadEvents() {
|
|
18034
|
+
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
18035
|
+
window.removeEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
18036
|
+
window.removeEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
18037
|
+
}
|
|
18038
|
+
}
|
|
17854
18039
|
/**
|
|
17855
18040
|
* Render an embedded ThoughtSpot Liveboard or visualization
|
|
17856
18041
|
* @param renderOptions An object specifying the Liveboard ID,
|
|
@@ -17861,6 +18046,7 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
|
17861
18046
|
const src = this.getIFrameSrc();
|
|
17862
18047
|
await this.renderV1Embed(src);
|
|
17863
18048
|
this.showPreviewLoader();
|
|
18049
|
+
this.postRender();
|
|
17864
18050
|
return this;
|
|
17865
18051
|
}
|
|
17866
18052
|
navigateToLiveboard(liveboardId, vizId, activeTabId) {
|
|
@@ -18257,6 +18443,8 @@ class Conversation {
|
|
|
18257
18443
|
});
|
|
18258
18444
|
const data = responses[0].data;
|
|
18259
18445
|
return {
|
|
18446
|
+
convId: this.conversationId,
|
|
18447
|
+
messageId: responses[0].msgId,
|
|
18260
18448
|
data: data.asstRespData.nlsAnsData.sageQuerySuggestions[0],
|
|
18261
18449
|
error: null,
|
|
18262
18450
|
};
|
|
@@ -18275,7 +18463,7 @@ class Conversation {
|
|
|
18275
18463
|
}
|
|
18276
18464
|
}
|
|
18277
18465
|
|
|
18278
|
-
class ConversationMessage extends TsEmbed {
|
|
18466
|
+
let ConversationMessage$1 = class ConversationMessage extends TsEmbed {
|
|
18279
18467
|
constructor(container, viewConfig) {
|
|
18280
18468
|
viewConfig.embedComponentType = 'bodyless-conversation';
|
|
18281
18469
|
super(container, viewConfig);
|
|
@@ -18307,7 +18495,7 @@ class ConversationMessage extends TsEmbed {
|
|
|
18307
18495
|
await this.renderIFrame(src);
|
|
18308
18496
|
return this;
|
|
18309
18497
|
}
|
|
18310
|
-
}
|
|
18498
|
+
};
|
|
18311
18499
|
/**
|
|
18312
18500
|
* Create a conversation embed, which can be integrated inside
|
|
18313
18501
|
* chatbots or other conversational interfaces.
|
|
@@ -18327,7 +18515,7 @@ class ConversationMessage extends TsEmbed {
|
|
|
18327
18515
|
* @group Embed components
|
|
18328
18516
|
* @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl
|
|
18329
18517
|
*/
|
|
18330
|
-
|
|
18518
|
+
class SpotterAgentEmbed {
|
|
18331
18519
|
constructor(viewConfig) {
|
|
18332
18520
|
this.viewConfig = viewConfig;
|
|
18333
18521
|
const embedConfig = getEmbedConfig();
|
|
@@ -18339,10 +18527,7 @@ let SpotterAgentEmbed$1 = class SpotterAgentEmbed {
|
|
|
18339
18527
|
return { error };
|
|
18340
18528
|
}
|
|
18341
18529
|
const container = document.createElement('div');
|
|
18342
|
-
|
|
18343
|
-
container.className = this.viewConfig.containerClassName;
|
|
18344
|
-
}
|
|
18345
|
-
const embed = new ConversationMessage(container, {
|
|
18530
|
+
const embed = new ConversationMessage$1(container, {
|
|
18346
18531
|
...this.viewConfig,
|
|
18347
18532
|
sessionId: data.sessionId,
|
|
18348
18533
|
genNo: data.genNo,
|
|
@@ -18352,7 +18537,29 @@ let SpotterAgentEmbed$1 = class SpotterAgentEmbed {
|
|
|
18352
18537
|
await embed.render();
|
|
18353
18538
|
return { container, viz: embed };
|
|
18354
18539
|
}
|
|
18355
|
-
|
|
18540
|
+
/**
|
|
18541
|
+
* Send a message to the conversation service and return only the data.
|
|
18542
|
+
* @param userMessage - The message to send to the conversation service.
|
|
18543
|
+
* @returns The data from the conversation service.
|
|
18544
|
+
*/
|
|
18545
|
+
async sendMessageData(userMessage) {
|
|
18546
|
+
try {
|
|
18547
|
+
const { data, error } = await this.conversationService.sendMessage(userMessage);
|
|
18548
|
+
if (error) {
|
|
18549
|
+
return { error };
|
|
18550
|
+
}
|
|
18551
|
+
return { data: {
|
|
18552
|
+
sessionId: data.sessionId,
|
|
18553
|
+
genNo: data.genNo,
|
|
18554
|
+
acSessionId: data.stateKey.transactionId,
|
|
18555
|
+
acGenNo: data.stateKey.generationNumber,
|
|
18556
|
+
} };
|
|
18557
|
+
}
|
|
18558
|
+
catch (error) {
|
|
18559
|
+
return { error: error };
|
|
18560
|
+
}
|
|
18561
|
+
}
|
|
18562
|
+
}
|
|
18356
18563
|
|
|
18357
18564
|
/**
|
|
18358
18565
|
*
|
|
@@ -18727,55 +18934,34 @@ const SpotterEmbed = componentFactory(SpotterEmbed$1);
|
|
|
18727
18934
|
* ```
|
|
18728
18935
|
*/
|
|
18729
18936
|
const ConversationEmbed = componentFactory(ConversationEmbed$1);
|
|
18937
|
+
const ConversationMessage = componentFactory(ConversationMessage$1);
|
|
18730
18938
|
/**
|
|
18731
|
-
* React component for
|
|
18732
|
-
*
|
|
18939
|
+
* React component for displaying individual conversation messages from SpotterAgent.
|
|
18940
|
+
*
|
|
18941
|
+
* This component renders a single message response from your ThoughtSpot conversation,
|
|
18942
|
+
* showing charts, visualizations, or text responses based on the user's query.
|
|
18943
|
+
*
|
|
18733
18944
|
* @example
|
|
18734
18945
|
* ```tsx
|
|
18735
|
-
*
|
|
18736
|
-
*
|
|
18946
|
+
* const { sendMessage } = useSpotterAgent({ worksheetId: 'worksheetId' });
|
|
18947
|
+
* const result = await sendMessage('show me sales by region');
|
|
18737
18948
|
*
|
|
18738
|
-
*
|
|
18739
|
-
*
|
|
18740
|
-
*
|
|
18741
|
-
* document.body.appendChild(container);
|
|
18742
|
-
* }
|
|
18743
|
-
* };
|
|
18949
|
+
* if (!result.error) {
|
|
18950
|
+
* // Simple usage - just pass the message data
|
|
18951
|
+
* <SpotterMessage message={result.message} />
|
|
18744
18952
|
*
|
|
18745
|
-
*
|
|
18746
|
-
*
|
|
18747
|
-
*
|
|
18748
|
-
*
|
|
18749
|
-
*
|
|
18750
|
-
* );
|
|
18953
|
+
* // With optional query for context
|
|
18954
|
+
* <SpotterMessage
|
|
18955
|
+
* message={result.message}
|
|
18956
|
+
* query={result.query}
|
|
18957
|
+
* />
|
|
18751
18958
|
* }
|
|
18752
18959
|
* ```
|
|
18960
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.11.0.cl
|
|
18753
18961
|
*/
|
|
18754
|
-
const
|
|
18755
|
-
const {
|
|
18756
|
-
|
|
18757
|
-
useDeepCompareEffect(() => {
|
|
18758
|
-
if (serviceRef.current) {
|
|
18759
|
-
serviceRef.current = null;
|
|
18760
|
-
}
|
|
18761
|
-
const configProps = {
|
|
18762
|
-
...restProps,
|
|
18763
|
-
...(className ? { containerClassName: className } : {})
|
|
18764
|
-
};
|
|
18765
|
-
serviceRef.current = new SpotterAgentEmbed$1(configProps);
|
|
18766
|
-
if (ref) {
|
|
18767
|
-
if (typeof ref === 'function') {
|
|
18768
|
-
ref(serviceRef.current);
|
|
18769
|
-
}
|
|
18770
|
-
else {
|
|
18771
|
-
ref.current = serviceRef.current;
|
|
18772
|
-
}
|
|
18773
|
-
}
|
|
18774
|
-
return () => {
|
|
18775
|
-
serviceRef.current = null;
|
|
18776
|
-
};
|
|
18777
|
-
}, [props]);
|
|
18778
|
-
return null;
|
|
18962
|
+
const SpotterMessage = React__default.forwardRef((props, ref) => {
|
|
18963
|
+
const { message, query: _, ...otherProps } = props;
|
|
18964
|
+
return (React__default.createElement(ConversationMessage, { ref: ref, ...message, ...otherProps }));
|
|
18779
18965
|
});
|
|
18780
18966
|
/**
|
|
18781
18967
|
* React component for PreRendered Conversation embed.
|
|
@@ -18835,6 +19021,62 @@ function useInit(config) {
|
|
|
18835
19021
|
ref.current = authEE;
|
|
18836
19022
|
}, [config]);
|
|
18837
19023
|
return ref;
|
|
19024
|
+
}
|
|
19025
|
+
/**
|
|
19026
|
+
* React hook for interacting with SpotterAgent AI conversations.
|
|
19027
|
+
*
|
|
19028
|
+
* This hook provides a sendMessage function that allows you to send natural language
|
|
19029
|
+
* queries to your data and get back AI-generated responses with visualizations.
|
|
19030
|
+
*
|
|
19031
|
+
* @param config - Configuration object containing worksheetId and other options
|
|
19032
|
+
* @returns Object with sendMessage function that returns conversation results
|
|
19033
|
+
* @example
|
|
19034
|
+
* ```tsx
|
|
19035
|
+
* const { sendMessage } = useSpotterAgent({ worksheetId: 'worksheetId' });
|
|
19036
|
+
*
|
|
19037
|
+
* const handleQuery = async () => {
|
|
19038
|
+
* const result = await sendMessage('show me sales by region');
|
|
19039
|
+
*
|
|
19040
|
+
* if (!result.error) {
|
|
19041
|
+
* // Display the message response
|
|
19042
|
+
* <SpotterMessage message={result.message} />
|
|
19043
|
+
* } else {
|
|
19044
|
+
* console.error('Error:', result.error);
|
|
19045
|
+
* }
|
|
19046
|
+
* };
|
|
19047
|
+
* ```
|
|
19048
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.11.0.cl
|
|
19049
|
+
*/
|
|
19050
|
+
function useSpotterAgent(config) {
|
|
19051
|
+
const serviceRef = useRef(null);
|
|
19052
|
+
useDeepCompareEffect(() => {
|
|
19053
|
+
if (serviceRef.current) {
|
|
19054
|
+
serviceRef.current = null;
|
|
19055
|
+
}
|
|
19056
|
+
serviceRef.current = new SpotterAgentEmbed(config);
|
|
19057
|
+
return () => {
|
|
19058
|
+
serviceRef.current = null;
|
|
19059
|
+
};
|
|
19060
|
+
}, [config]);
|
|
19061
|
+
const sendMessage = useCallback(async (query) => {
|
|
19062
|
+
if (!serviceRef.current) {
|
|
19063
|
+
return { error: new Error(ERROR_MESSAGE.SPOTTER_AGENT_NOT_INITIALIZED) };
|
|
19064
|
+
}
|
|
19065
|
+
const result = await serviceRef.current.sendMessageData(query);
|
|
19066
|
+
if (result.error) {
|
|
19067
|
+
return { error: result.error };
|
|
19068
|
+
}
|
|
19069
|
+
return {
|
|
19070
|
+
query: query,
|
|
19071
|
+
message: {
|
|
19072
|
+
...result.data,
|
|
19073
|
+
worksheetId: config.worksheetId,
|
|
19074
|
+
},
|
|
19075
|
+
};
|
|
19076
|
+
}, [config.worksheetId]);
|
|
19077
|
+
return {
|
|
19078
|
+
sendMessage,
|
|
19079
|
+
};
|
|
18838
19080
|
}
|
|
18839
19081
|
|
|
18840
|
-
export { Action, AppEmbed, ConversationEmbed, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, ListPageColumns, LiveboardEmbed, LogLevel, Page, PinboardEmbed, PreRenderedAppEmbed, PreRenderedConversationEmbed, PreRenderedLiveboardEmbed, PreRenderedPinboardEmbed, PreRenderedSageEmbed, PreRenderedSearchBarEmbed, PreRenderedSearchEmbed, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed,
|
|
19082
|
+
export { Action, AppEmbed, ConversationEmbed, ConversationMessage, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, ListPageColumns, LiveboardEmbed, LogLevel, Page, PinboardEmbed, PreRenderedAppEmbed, PreRenderedConversationEmbed, PreRenderedLiveboardEmbed, PreRenderedPinboardEmbed, PreRenderedSageEmbed, PreRenderedSearchBarEmbed, PreRenderedSearchEmbed, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, SpotterEmbed, SpotterMessage, getSessionInfo, useEmbedRef, useInit, useSpotterAgent };
|