@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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
@@ -421,6 +421,12 @@
|
|
|
421
421
|
* @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
422
422
|
*/
|
|
423
423
|
HomeLeftNavItem["Spotter"] = "spotter";
|
|
424
|
+
/**
|
|
425
|
+
* Favorites option in the insights left navigation,
|
|
426
|
+
* available when new navigation V3 is enabled.
|
|
427
|
+
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
428
|
+
*/
|
|
429
|
+
HomeLeftNavItem["Favorites"] = "favorites";
|
|
424
430
|
})(exports.HomeLeftNavItem || (exports.HomeLeftNavItem = {}));
|
|
425
431
|
/**
|
|
426
432
|
* A map of the supported runtime filter operations
|
|
@@ -1607,6 +1613,12 @@
|
|
|
1607
1613
|
* @version SDK : 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
1608
1614
|
*/
|
|
1609
1615
|
EmbedEvent["ExitPresentMode"] = "exitPresentMode";
|
|
1616
|
+
/**
|
|
1617
|
+
* Emitted when a user requests the full height lazy load data.
|
|
1618
|
+
* @version SDK : 1.39.0 | ThoughtSpot : 10.10.0.cl
|
|
1619
|
+
* @hidden
|
|
1620
|
+
*/
|
|
1621
|
+
EmbedEvent["RequestVisibleEmbedCoordinates"] = "requestVisibleEmbedCoordinates";
|
|
1610
1622
|
})(exports.EmbedEvent || (exports.EmbedEvent = {}));
|
|
1611
1623
|
/**
|
|
1612
1624
|
* Event types that can be triggered by the host application
|
|
@@ -2691,6 +2703,19 @@
|
|
|
2691
2703
|
* @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
2692
2704
|
*/
|
|
2693
2705
|
HostEvent["ExitPresentMode"] = "exitPresentMode";
|
|
2706
|
+
/**
|
|
2707
|
+
* Triggers the full height lazy load data.
|
|
2708
|
+
* @example
|
|
2709
|
+
* ```js
|
|
2710
|
+
* liveboardEmbed.on(EmbedEvent.RequestVisibleEmbedCoordinates, (payload) => {
|
|
2711
|
+
* console.log(payload);
|
|
2712
|
+
* });
|
|
2713
|
+
* ```
|
|
2714
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
|
|
2715
|
+
*
|
|
2716
|
+
* @hidden
|
|
2717
|
+
*/
|
|
2718
|
+
HostEvent["VisibleEmbedCoordinates"] = "visibleEmbedCoordinates";
|
|
2694
2719
|
})(exports.HostEvent || (exports.HostEvent = {}));
|
|
2695
2720
|
/**
|
|
2696
2721
|
* The different visual modes that the data sources panel within
|
|
@@ -2796,6 +2821,7 @@
|
|
|
2796
2821
|
Param["Query"] = "query";
|
|
2797
2822
|
Param["HideHomepageLeftNav"] = "hideHomepageLeftNav";
|
|
2798
2823
|
Param["ModularHomeExperienceEnabled"] = "modularHomeExperience";
|
|
2824
|
+
Param["ListPageVersion"] = "listpageVersion";
|
|
2799
2825
|
Param["PendoTrackingKey"] = "additionalPendoKey";
|
|
2800
2826
|
Param["LiveboardHeaderSticky"] = "isLiveboardHeaderSticky";
|
|
2801
2827
|
Param["IsProductTour"] = "isProductTour";
|
|
@@ -2830,10 +2856,12 @@
|
|
|
2830
2856
|
Param["DataSourceId"] = "dataSourceId";
|
|
2831
2857
|
Param["preAuthCache"] = "preAuthCache";
|
|
2832
2858
|
Param["ShowSpotterLimitations"] = "showSpotterLimitations";
|
|
2833
|
-
Param["CoverAndFilterOptionInPDF"] = "
|
|
2859
|
+
Param["CoverAndFilterOptionInPDF"] = "arePdfCoverFilterPageCheckboxesEnabled";
|
|
2834
2860
|
Param["PrimaryAction"] = "primaryAction";
|
|
2835
2861
|
Param["isSpotterAgentEmbed"] = "isSpotterAgentEmbed";
|
|
2836
2862
|
Param["IsLiveboardStylingAndGroupingEnabled"] = "isLiveboardStylingAndGroupingEnabled";
|
|
2863
|
+
Param["IsLazyLoadingForEmbedEnabled"] = "isLazyLoadingForEmbedEnabled";
|
|
2864
|
+
Param["RootMarginForLazyLoad"] = "rootMarginForLazyLoad";
|
|
2837
2865
|
})(Param || (Param = {}));
|
|
2838
2866
|
/**
|
|
2839
2867
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -4056,6 +4084,22 @@
|
|
|
4056
4084
|
* @version SDK: 1.37.0 | ThoughtSpot Cloud: 10.8.0.cl
|
|
4057
4085
|
*/
|
|
4058
4086
|
Action["CoverAndFilterOptionInPDF"] = "coverAndFilterOptionInPDF";
|
|
4087
|
+
/**
|
|
4088
|
+
* Action ID for hide or disable the
|
|
4089
|
+
* Spotter in conversation training widget.
|
|
4090
|
+
* The Add to Coaching feature is currently in beta
|
|
4091
|
+
* and is disabled by default on embed deployments.
|
|
4092
|
+
* To enable this feature on your instance,
|
|
4093
|
+
* contact ThoughtSpot Support.
|
|
4094
|
+
* @example
|
|
4095
|
+
* ```js
|
|
4096
|
+
* hiddenAction: [Action.InConversationTraining]
|
|
4097
|
+
* disabledActions: [Action.InConversationTraining]
|
|
4098
|
+
*
|
|
4099
|
+
* ```
|
|
4100
|
+
* @version SDK: 1.39.0 | ThoughtSpot Cloud: 10.10.0.cl
|
|
4101
|
+
*/
|
|
4102
|
+
Action["InConversationTraining"] = "InConversationTraining";
|
|
4059
4103
|
})(exports.Action || (exports.Action = {}));
|
|
4060
4104
|
var PrefetchFeatures;
|
|
4061
4105
|
(function (PrefetchFeatures) {
|
|
@@ -4439,7 +4483,6 @@
|
|
|
4439
4483
|
function removeTypename(obj) {
|
|
4440
4484
|
if (!obj || typeof obj !== 'object')
|
|
4441
4485
|
return obj;
|
|
4442
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
4443
4486
|
for (const key in obj) {
|
|
4444
4487
|
if (key === '__typename') {
|
|
4445
4488
|
delete obj[key];
|
|
@@ -4468,7 +4511,11 @@
|
|
|
4468
4511
|
if (!(element === null || element === void 0 ? void 0 : element.style))
|
|
4469
4512
|
return;
|
|
4470
4513
|
Object.keys(styleProperties).forEach((styleProperty) => {
|
|
4471
|
-
|
|
4514
|
+
const styleKey = styleProperty;
|
|
4515
|
+
const value = styleProperties[styleKey];
|
|
4516
|
+
if (value !== undefined) {
|
|
4517
|
+
element.style[styleKey] = value.toString();
|
|
4518
|
+
}
|
|
4472
4519
|
});
|
|
4473
4520
|
};
|
|
4474
4521
|
/**
|
|
@@ -4596,6 +4643,22 @@
|
|
|
4596
4643
|
}
|
|
4597
4644
|
}
|
|
4598
4645
|
logger$3.warn('Exit fullscreen API is not supported by this browser.');
|
|
4646
|
+
};
|
|
4647
|
+
const calculateVisibleElementData = (element) => {
|
|
4648
|
+
const rect = element.getBoundingClientRect();
|
|
4649
|
+
const windowHeight = window.innerHeight;
|
|
4650
|
+
const windowWidth = window.innerWidth;
|
|
4651
|
+
const frameRelativeTop = Math.max(rect.top, 0);
|
|
4652
|
+
const frameRelativeLeft = Math.max(rect.left, 0);
|
|
4653
|
+
const frameRelativeBottom = Math.min(windowHeight, rect.bottom);
|
|
4654
|
+
const frameRelativeRight = Math.min(windowWidth, rect.right);
|
|
4655
|
+
const data = {
|
|
4656
|
+
top: Math.max(0, rect.top * -1),
|
|
4657
|
+
height: Math.max(0, frameRelativeBottom - frameRelativeTop),
|
|
4658
|
+
left: Math.max(0, rect.left * -1),
|
|
4659
|
+
width: Math.max(0, frameRelativeRight - frameRelativeLeft),
|
|
4660
|
+
};
|
|
4661
|
+
return data;
|
|
4599
4662
|
};
|
|
4600
4663
|
|
|
4601
4664
|
/**
|
|
@@ -6891,6 +6954,7 @@
|
|
|
6891
6954
|
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',
|
|
6892
6955
|
MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
|
|
6893
6956
|
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',
|
|
6957
|
+
SPOTTER_AGENT_NOT_INITIALIZED: 'SpotterAgent not initialized',
|
|
6894
6958
|
};
|
|
6895
6959
|
|
|
6896
6960
|
const EndPoints = {
|
|
@@ -7098,13 +7162,14 @@
|
|
|
7098
7162
|
*
|
|
7099
7163
|
* @example
|
|
7100
7164
|
* ```js
|
|
7165
|
+
* import { getInitConfig } from '@thoughtspot/visual-embed-sdk';
|
|
7166
|
+
* // Call the getInitConfig method to retrieve the embed configuration
|
|
7101
7167
|
* const config = getInitConfig();
|
|
7168
|
+
* // Log the configuration settings
|
|
7102
7169
|
* console.log(config);
|
|
7103
7170
|
* ```
|
|
7104
|
-
*
|
|
7105
|
-
*
|
|
7106
|
-
* Returns the `EmbedConfig` object, which
|
|
7107
|
-
* contains the configuration settings used to
|
|
7171
|
+
* Returns the link:https://developers.thoughtspot.com/docs/Interface_EmbedConfig[EmbedConfig]
|
|
7172
|
+
* object, which contains the configuration settings used to
|
|
7108
7173
|
* initialize the SDK, including the following:
|
|
7109
7174
|
*
|
|
7110
7175
|
* - `thoughtSpotHost` - ThoughtSpot host URL
|
|
@@ -7113,9 +7178,10 @@
|
|
|
7113
7178
|
* - `customizations` - Style, text, and icon customization settings
|
|
7114
7179
|
* that were applied during the SDK initialization.
|
|
7115
7180
|
*
|
|
7116
|
-
*
|
|
7117
|
-
*
|
|
7181
|
+
* The following JSON output shows the embed configuration
|
|
7182
|
+
* settings returned from the code in the previous example:
|
|
7118
7183
|
*
|
|
7184
|
+
* @example
|
|
7119
7185
|
* ```json
|
|
7120
7186
|
* {
|
|
7121
7187
|
* "thoughtSpotHost": "https://{ThoughtSpot-Host}",
|
|
@@ -7137,7 +7203,7 @@
|
|
|
7137
7203
|
* "authTriggerContainer": "#your-own-div"
|
|
7138
7204
|
* }
|
|
7139
7205
|
* ```
|
|
7140
|
-
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.
|
|
7206
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw, and later
|
|
7141
7207
|
* @group Global methods
|
|
7142
7208
|
*/
|
|
7143
7209
|
const getEmbedConfig = () => getValueFromWindow(configKey) || {};
|
|
@@ -15513,7 +15579,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15513
15579
|
return e;
|
|
15514
15580
|
}
|
|
15515
15581
|
|
|
15516
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.39.
|
|
15582
|
+
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$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={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$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
15517
15583
|
|
|
15518
15584
|
/**
|
|
15519
15585
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -15536,7 +15602,8 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15536
15602
|
* @param channel
|
|
15537
15603
|
*/
|
|
15538
15604
|
function postIframeMessage(iFrame, message, thoughtSpotHost, channel) {
|
|
15539
|
-
|
|
15605
|
+
var _a;
|
|
15606
|
+
return (_a = iFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message, thoughtSpotHost, [channel === null || channel === void 0 ? void 0 : channel.port2]);
|
|
15540
15607
|
}
|
|
15541
15608
|
const TRIGGER_TIMEOUT = 30000;
|
|
15542
15609
|
/**
|
|
@@ -15911,10 +15978,25 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15911
15978
|
// - cached auth info would be for wrong org
|
|
15912
15979
|
// - info call response changes for each different overrideOrgId
|
|
15913
15980
|
// 2. disablePreauthCache is explicitly set to true
|
|
15981
|
+
// 3. FullAppEmbed has primary navbar visible since:
|
|
15982
|
+
// - primary navbar requires fresh auth state for navigation
|
|
15983
|
+
// - cached auth may not reflect current user permissions
|
|
15914
15984
|
const isDisabled = (this.viewConfig.overrideOrgId !== undefined
|
|
15915
|
-
|| this.embedConfig.disablePreauthCache === true
|
|
15985
|
+
|| this.embedConfig.disablePreauthCache === true
|
|
15986
|
+
|| this.isFullAppEmbedWithVisiblePrimaryNavbar());
|
|
15916
15987
|
return !isDisabled;
|
|
15917
15988
|
}
|
|
15989
|
+
/**
|
|
15990
|
+
* Checks if current embed is FullAppEmbed with visible primary navbar
|
|
15991
|
+
* @returns boolean
|
|
15992
|
+
*/
|
|
15993
|
+
isFullAppEmbedWithVisiblePrimaryNavbar() {
|
|
15994
|
+
const appViewConfig = this.viewConfig;
|
|
15995
|
+
// Check if this is a FullAppEmbed (AppEmbed)
|
|
15996
|
+
// showPrimaryNavbar defaults to true if not explicitly set to false
|
|
15997
|
+
return (appViewConfig.embedComponentType === 'AppEmbed'
|
|
15998
|
+
&& appViewConfig.showPrimaryNavbar === true);
|
|
15999
|
+
}
|
|
15918
16000
|
/**
|
|
15919
16001
|
* fix for ts7.sep.cl
|
|
15920
16002
|
* will be removed for ts7.oct.cl
|
|
@@ -17234,7 +17316,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17234
17316
|
/**
|
|
17235
17317
|
* Pages within the ThoughtSpot app that can be embedded.
|
|
17236
17318
|
*/
|
|
17237
|
-
// eslint-disable-next-line no-shadow
|
|
17238
17319
|
exports.Page = void 0;
|
|
17239
17320
|
(function (Page) {
|
|
17240
17321
|
/**
|
|
@@ -17320,16 +17401,46 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17320
17401
|
*/
|
|
17321
17402
|
HomePage["Modular"] = "v2";
|
|
17322
17403
|
})(HomePage || (HomePage = {}));
|
|
17404
|
+
/**
|
|
17405
|
+
* Define the version of the list page
|
|
17406
|
+
* @version SDK: 1.40.0 | ThoughtSpot: 10.12.0.cl
|
|
17407
|
+
*/
|
|
17408
|
+
var ListPage;
|
|
17409
|
+
(function (ListPage) {
|
|
17410
|
+
/**
|
|
17411
|
+
* List (v2) is the traditional List Experience.
|
|
17412
|
+
* It serves as the foundational version of the list page.
|
|
17413
|
+
*/
|
|
17414
|
+
ListPage["List"] = "v2";
|
|
17415
|
+
/**
|
|
17416
|
+
* ListWithUXChanges (v3) introduces the new updated list page with UX changes.
|
|
17417
|
+
*/
|
|
17418
|
+
ListPage["ListWithUXChanges"] = "v3";
|
|
17419
|
+
})(ListPage || (ListPage = {}));
|
|
17323
17420
|
/**
|
|
17324
17421
|
* Embeds full ThoughtSpot experience in a host application.
|
|
17325
17422
|
* @group Embed components
|
|
17326
17423
|
*/
|
|
17327
17424
|
let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
17328
|
-
// eslint-disable-next-line no-useless-constructor
|
|
17329
17425
|
constructor(domSelector, viewConfig) {
|
|
17330
17426
|
viewConfig.embedComponentType = 'AppEmbed';
|
|
17331
17427
|
super(domSelector, viewConfig);
|
|
17332
17428
|
this.defaultHeight = '100%';
|
|
17429
|
+
this.sendFullHeightLazyLoadData = () => {
|
|
17430
|
+
const data = calculateVisibleElementData(this.iFrame);
|
|
17431
|
+
this.trigger(exports.HostEvent.VisibleEmbedCoordinates, data);
|
|
17432
|
+
};
|
|
17433
|
+
/**
|
|
17434
|
+
* This is a handler for the RequestVisibleEmbedCoordinates event.
|
|
17435
|
+
* It is used to send the visible coordinates data to the host application.
|
|
17436
|
+
* @param data The event payload
|
|
17437
|
+
* @param responder The responder function
|
|
17438
|
+
*/
|
|
17439
|
+
this.requestVisibleEmbedCoordinatesHandler = (data, responder) => {
|
|
17440
|
+
logger$3.info('Sending RequestVisibleEmbedCoordinates', data);
|
|
17441
|
+
const visibleCoordinatesData = calculateVisibleElementData(this.iFrame);
|
|
17442
|
+
responder({ type: exports.EmbedEvent.RequestVisibleEmbedCoordinates, data: visibleCoordinatesData });
|
|
17443
|
+
};
|
|
17333
17444
|
/**
|
|
17334
17445
|
* Set the iframe height as per the computed height received
|
|
17335
17446
|
* from the ThoughtSpot app.
|
|
@@ -17338,6 +17449,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17338
17449
|
this.updateIFrameHeight = (data) => {
|
|
17339
17450
|
var _a;
|
|
17340
17451
|
this.setIFrameHeight(Math.max(data.data, (_a = this.iFrame) === null || _a === void 0 ? void 0 : _a.scrollHeight));
|
|
17452
|
+
this.sendFullHeightLazyLoadData();
|
|
17341
17453
|
};
|
|
17342
17454
|
this.embedIframeCenter = (data, responder) => {
|
|
17343
17455
|
const obj = this.getIframeCenter();
|
|
@@ -17367,6 +17479,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17367
17479
|
this.on(exports.EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
17368
17480
|
this.on(exports.EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
17369
17481
|
this.on(exports.EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
17482
|
+
this.on(exports.EmbedEvent.RequestVisibleEmbedCoordinates, this.requestVisibleEmbedCoordinatesHandler);
|
|
17370
17483
|
}
|
|
17371
17484
|
}
|
|
17372
17485
|
/**
|
|
@@ -17374,9 +17487,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17374
17487
|
* embedded Liveboard or visualization.
|
|
17375
17488
|
*/
|
|
17376
17489
|
getEmbedParams() {
|
|
17377
|
-
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,
|
|
17378
|
-
/* eslint-disable-next-line max-len */
|
|
17379
|
-
dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
17490
|
+
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;
|
|
17380
17491
|
let params = {};
|
|
17381
17492
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
17382
17493
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
@@ -17392,6 +17503,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17392
17503
|
params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
|
|
17393
17504
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
17394
17505
|
params[Param.IsUnifiedSearchExperienceEnabled] = isUnifiedSearchExperienceEnabled;
|
|
17506
|
+
params[Param.CoverAndFilterOptionInPDF] = !!coverAndFilterOptionInPDF;
|
|
17395
17507
|
params = this.getBaseQueryParams(params);
|
|
17396
17508
|
if (hideObjectSearch) {
|
|
17397
17509
|
params[Param.HideObjectSearch] = !!hideObjectSearch;
|
|
@@ -17404,6 +17516,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17404
17516
|
}
|
|
17405
17517
|
if (fullHeight === true) {
|
|
17406
17518
|
params[Param.fullHeight] = true;
|
|
17519
|
+
if (this.viewConfig.lazyLoadingForFullHeight) {
|
|
17520
|
+
params[Param.IsLazyLoadingForEmbedEnabled] = true;
|
|
17521
|
+
params[Param.RootMarginForLazyLoad] = this.viewConfig.lazyLoadingMargin;
|
|
17522
|
+
}
|
|
17407
17523
|
}
|
|
17408
17524
|
if (tag) {
|
|
17409
17525
|
params[Param.Tag] = tag;
|
|
@@ -17424,7 +17540,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17424
17540
|
params[Param.enableAskSage] = enableAskSage;
|
|
17425
17541
|
}
|
|
17426
17542
|
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
17427
|
-
/* eslint-disable-next-line max-len */
|
|
17428
17543
|
params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
17429
17544
|
}
|
|
17430
17545
|
if (homePageSearchBarMode) {
|
|
@@ -17445,11 +17560,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17445
17560
|
=== DataPanelCustomColumnGroupsAccordionState.COLLAPSE_ALL
|
|
17446
17561
|
|| dataPanelCustomGroupsAccordionInitialState
|
|
17447
17562
|
=== DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST) {
|
|
17448
|
-
/* eslint-disable-next-line max-len */
|
|
17449
17563
|
params[Param.DataPanelCustomGroupsAccordionInitialState] = dataPanelCustomGroupsAccordionInitialState;
|
|
17450
17564
|
}
|
|
17451
17565
|
else {
|
|
17452
|
-
/* eslint-disable-next-line max-len */
|
|
17453
17566
|
params[Param.DataPanelCustomGroupsAccordionInitialState] = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL;
|
|
17454
17567
|
}
|
|
17455
17568
|
if (discoveryExperience) {
|
|
@@ -17462,6 +17575,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17462
17575
|
if (discoveryExperience.homePage === HomePage.Modular) {
|
|
17463
17576
|
params[Param.ModularHomeExperienceEnabled] = true;
|
|
17464
17577
|
}
|
|
17578
|
+
// listPageVersion v3 will enable the new list page
|
|
17579
|
+
if (discoveryExperience.listPageVersion === ListPage.ListWithUXChanges) {
|
|
17580
|
+
params[Param.ListPageVersion] = discoveryExperience.listPageVersion;
|
|
17581
|
+
}
|
|
17465
17582
|
}
|
|
17466
17583
|
const queryParams = getQueryParamString(params, true);
|
|
17467
17584
|
return queryParams;
|
|
@@ -17549,6 +17666,30 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17549
17666
|
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
17550
17667
|
}
|
|
17551
17668
|
}
|
|
17669
|
+
/**
|
|
17670
|
+
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
17671
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
|
|
17672
|
+
*/
|
|
17673
|
+
destroy() {
|
|
17674
|
+
super.destroy();
|
|
17675
|
+
this.unregisterLazyLoadEvents();
|
|
17676
|
+
}
|
|
17677
|
+
postRender() {
|
|
17678
|
+
this.registerLazyLoadEvents();
|
|
17679
|
+
}
|
|
17680
|
+
registerLazyLoadEvents() {
|
|
17681
|
+
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
17682
|
+
// TODO: Use passive: true, install modernizr to check for passive
|
|
17683
|
+
window.addEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
17684
|
+
window.addEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
17685
|
+
}
|
|
17686
|
+
}
|
|
17687
|
+
unregisterLazyLoadEvents() {
|
|
17688
|
+
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
17689
|
+
window.removeEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
17690
|
+
window.removeEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
17691
|
+
}
|
|
17692
|
+
}
|
|
17552
17693
|
/**
|
|
17553
17694
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
17554
17695
|
* @param renderOptions An object containing the page ID
|
|
@@ -17558,6 +17699,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17558
17699
|
await super.render();
|
|
17559
17700
|
const src = this.getIFrameSrc();
|
|
17560
17701
|
await this.renderV1Embed(src);
|
|
17702
|
+
this.postRender();
|
|
17561
17703
|
return this;
|
|
17562
17704
|
}
|
|
17563
17705
|
};
|
|
@@ -17662,6 +17804,21 @@ query GetEurekaVizSnapshots(
|
|
|
17662
17804
|
viewConfig.embedComponentType = 'LiveboardEmbed';
|
|
17663
17805
|
super(domSelector, viewConfig);
|
|
17664
17806
|
this.defaultHeight = 500;
|
|
17807
|
+
this.sendFullHeightLazyLoadData = () => {
|
|
17808
|
+
const data = calculateVisibleElementData(this.iFrame);
|
|
17809
|
+
this.trigger(exports.HostEvent.VisibleEmbedCoordinates, data);
|
|
17810
|
+
};
|
|
17811
|
+
/**
|
|
17812
|
+
* This is a handler for the RequestVisibleEmbedCoordinates event.
|
|
17813
|
+
* It is used to send the visible coordinates data to the host application.
|
|
17814
|
+
* @param data The event payload
|
|
17815
|
+
* @param responder The responder function
|
|
17816
|
+
*/
|
|
17817
|
+
this.requestVisibleEmbedCoordinatesHandler = (data, responder) => {
|
|
17818
|
+
logger$3.info('Sending RequestVisibleEmbedCoordinates', data);
|
|
17819
|
+
const visibleCoordinatesData = calculateVisibleElementData(this.iFrame);
|
|
17820
|
+
responder({ type: exports.EmbedEvent.RequestVisibleEmbedCoordinates, data: visibleCoordinatesData });
|
|
17821
|
+
};
|
|
17665
17822
|
/**
|
|
17666
17823
|
* Set the iframe height as per the computed height received
|
|
17667
17824
|
* from the ThoughtSpot app.
|
|
@@ -17669,6 +17826,7 @@ query GetEurekaVizSnapshots(
|
|
|
17669
17826
|
*/
|
|
17670
17827
|
this.updateIFrameHeight = (data) => {
|
|
17671
17828
|
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
|
|
17829
|
+
this.sendFullHeightLazyLoadData();
|
|
17672
17830
|
};
|
|
17673
17831
|
this.embedIframeCenter = (data, responder) => {
|
|
17674
17832
|
const obj = this.getIframeCenter();
|
|
@@ -17702,6 +17860,7 @@ query GetEurekaVizSnapshots(
|
|
|
17702
17860
|
this.on(exports.EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
17703
17861
|
this.on(exports.EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
17704
17862
|
this.on(exports.EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
17863
|
+
this.on(exports.EmbedEvent.RequestVisibleEmbedCoordinates, this.requestVisibleEmbedCoordinatesHandler);
|
|
17705
17864
|
}
|
|
17706
17865
|
}
|
|
17707
17866
|
/**
|
|
@@ -17711,11 +17870,15 @@ query GetEurekaVizSnapshots(
|
|
|
17711
17870
|
getEmbedParams() {
|
|
17712
17871
|
let params = {};
|
|
17713
17872
|
params = this.getBaseQueryParams(params);
|
|
17714
|
-
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;
|
|
17873
|
+
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;
|
|
17715
17874
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
17716
17875
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
17717
17876
|
if (fullHeight === true) {
|
|
17718
17877
|
params[Param.fullHeight] = true;
|
|
17878
|
+
if (this.viewConfig.lazyLoadingForFullHeight) {
|
|
17879
|
+
params[Param.IsLazyLoadingForEmbedEnabled] = true;
|
|
17880
|
+
params[Param.RootMarginForLazyLoad] = this.viewConfig.lazyLoadingMargin;
|
|
17881
|
+
}
|
|
17719
17882
|
}
|
|
17720
17883
|
if (defaultHeight) {
|
|
17721
17884
|
this.defaultHeight = defaultHeight;
|
|
@@ -17763,9 +17926,6 @@ query GetEurekaVizSnapshots(
|
|
|
17763
17926
|
if (dataSourceId !== undefined) {
|
|
17764
17927
|
params[Param.DataSourceId] = dataSourceId;
|
|
17765
17928
|
}
|
|
17766
|
-
if (coverAndFilterOptionInPDF !== undefined) {
|
|
17767
|
-
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
17768
|
-
}
|
|
17769
17929
|
if (isLiveboardStylingAndGroupingEnabled !== undefined) {
|
|
17770
17930
|
params[Param.IsLiveboardStylingAndGroupingEnabled] = isLiveboardStylingAndGroupingEnabled;
|
|
17771
17931
|
}
|
|
@@ -17776,6 +17936,7 @@ query GetEurekaVizSnapshots(
|
|
|
17776
17936
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
17777
17937
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
17778
17938
|
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
17939
|
+
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
17779
17940
|
const queryParams = getQueryParamString(params, true);
|
|
17780
17941
|
return queryParams;
|
|
17781
17942
|
}
|
|
@@ -17873,6 +18034,30 @@ query GetEurekaVizSnapshots(
|
|
|
17873
18034
|
}
|
|
17874
18035
|
return super.trigger(messageType, dataWithVizId);
|
|
17875
18036
|
}
|
|
18037
|
+
/**
|
|
18038
|
+
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
18039
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
|
|
18040
|
+
*/
|
|
18041
|
+
destroy() {
|
|
18042
|
+
super.destroy();
|
|
18043
|
+
this.unregisterLazyLoadEvents();
|
|
18044
|
+
}
|
|
18045
|
+
postRender() {
|
|
18046
|
+
this.registerLazyLoadEvents();
|
|
18047
|
+
}
|
|
18048
|
+
registerLazyLoadEvents() {
|
|
18049
|
+
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
18050
|
+
// TODO: Use passive: true, install modernizr to check for passive
|
|
18051
|
+
window.addEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
18052
|
+
window.addEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
18053
|
+
}
|
|
18054
|
+
}
|
|
18055
|
+
unregisterLazyLoadEvents() {
|
|
18056
|
+
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
18057
|
+
window.removeEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
18058
|
+
window.removeEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
18059
|
+
}
|
|
18060
|
+
}
|
|
17876
18061
|
/**
|
|
17877
18062
|
* Render an embedded ThoughtSpot Liveboard or visualization
|
|
17878
18063
|
* @param renderOptions An object specifying the Liveboard ID,
|
|
@@ -17883,6 +18068,7 @@ query GetEurekaVizSnapshots(
|
|
|
17883
18068
|
const src = this.getIFrameSrc();
|
|
17884
18069
|
await this.renderV1Embed(src);
|
|
17885
18070
|
this.showPreviewLoader();
|
|
18071
|
+
this.postRender();
|
|
17886
18072
|
return this;
|
|
17887
18073
|
}
|
|
17888
18074
|
navigateToLiveboard(liveboardId, vizId, activeTabId) {
|
|
@@ -18279,6 +18465,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18279
18465
|
});
|
|
18280
18466
|
const data = responses[0].data;
|
|
18281
18467
|
return {
|
|
18468
|
+
convId: this.conversationId,
|
|
18469
|
+
messageId: responses[0].msgId,
|
|
18282
18470
|
data: data.asstRespData.nlsAnsData.sageQuerySuggestions[0],
|
|
18283
18471
|
error: null,
|
|
18284
18472
|
};
|
|
@@ -18297,7 +18485,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18297
18485
|
}
|
|
18298
18486
|
}
|
|
18299
18487
|
|
|
18300
|
-
class ConversationMessage extends TsEmbed {
|
|
18488
|
+
let ConversationMessage$1 = class ConversationMessage extends TsEmbed {
|
|
18301
18489
|
constructor(container, viewConfig) {
|
|
18302
18490
|
viewConfig.embedComponentType = 'bodyless-conversation';
|
|
18303
18491
|
super(container, viewConfig);
|
|
@@ -18329,7 +18517,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18329
18517
|
await this.renderIFrame(src);
|
|
18330
18518
|
return this;
|
|
18331
18519
|
}
|
|
18332
|
-
}
|
|
18520
|
+
};
|
|
18333
18521
|
/**
|
|
18334
18522
|
* Create a conversation embed, which can be integrated inside
|
|
18335
18523
|
* chatbots or other conversational interfaces.
|
|
@@ -18349,7 +18537,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18349
18537
|
* @group Embed components
|
|
18350
18538
|
* @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl
|
|
18351
18539
|
*/
|
|
18352
|
-
|
|
18540
|
+
class SpotterAgentEmbed {
|
|
18353
18541
|
constructor(viewConfig) {
|
|
18354
18542
|
this.viewConfig = viewConfig;
|
|
18355
18543
|
const embedConfig = getEmbedConfig();
|
|
@@ -18361,10 +18549,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18361
18549
|
return { error };
|
|
18362
18550
|
}
|
|
18363
18551
|
const container = document.createElement('div');
|
|
18364
|
-
|
|
18365
|
-
container.className = this.viewConfig.containerClassName;
|
|
18366
|
-
}
|
|
18367
|
-
const embed = new ConversationMessage(container, {
|
|
18552
|
+
const embed = new ConversationMessage$1(container, {
|
|
18368
18553
|
...this.viewConfig,
|
|
18369
18554
|
sessionId: data.sessionId,
|
|
18370
18555
|
genNo: data.genNo,
|
|
@@ -18374,7 +18559,29 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18374
18559
|
await embed.render();
|
|
18375
18560
|
return { container, viz: embed };
|
|
18376
18561
|
}
|
|
18377
|
-
|
|
18562
|
+
/**
|
|
18563
|
+
* Send a message to the conversation service and return only the data.
|
|
18564
|
+
* @param userMessage - The message to send to the conversation service.
|
|
18565
|
+
* @returns The data from the conversation service.
|
|
18566
|
+
*/
|
|
18567
|
+
async sendMessageData(userMessage) {
|
|
18568
|
+
try {
|
|
18569
|
+
const { data, error } = await this.conversationService.sendMessage(userMessage);
|
|
18570
|
+
if (error) {
|
|
18571
|
+
return { error };
|
|
18572
|
+
}
|
|
18573
|
+
return { data: {
|
|
18574
|
+
sessionId: data.sessionId,
|
|
18575
|
+
genNo: data.genNo,
|
|
18576
|
+
acSessionId: data.stateKey.transactionId,
|
|
18577
|
+
acGenNo: data.stateKey.generationNumber,
|
|
18578
|
+
} };
|
|
18579
|
+
}
|
|
18580
|
+
catch (error) {
|
|
18581
|
+
return { error: error };
|
|
18582
|
+
}
|
|
18583
|
+
}
|
|
18584
|
+
}
|
|
18378
18585
|
|
|
18379
18586
|
/**
|
|
18380
18587
|
*
|
|
@@ -18749,55 +18956,34 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18749
18956
|
* ```
|
|
18750
18957
|
*/
|
|
18751
18958
|
const ConversationEmbed = componentFactory(ConversationEmbed$1);
|
|
18959
|
+
const ConversationMessage = componentFactory(ConversationMessage$1);
|
|
18752
18960
|
/**
|
|
18753
|
-
* React component for
|
|
18754
|
-
*
|
|
18961
|
+
* React component for displaying individual conversation messages from SpotterAgent.
|
|
18962
|
+
*
|
|
18963
|
+
* This component renders a single message response from your ThoughtSpot conversation,
|
|
18964
|
+
* showing charts, visualizations, or text responses based on the user's query.
|
|
18965
|
+
*
|
|
18755
18966
|
* @example
|
|
18756
18967
|
* ```tsx
|
|
18757
|
-
*
|
|
18758
|
-
*
|
|
18968
|
+
* const { sendMessage } = useSpotterAgent({ worksheetId: 'worksheetId' });
|
|
18969
|
+
* const result = await sendMessage('show me sales by region');
|
|
18759
18970
|
*
|
|
18760
|
-
*
|
|
18761
|
-
*
|
|
18762
|
-
*
|
|
18763
|
-
* document.body.appendChild(container);
|
|
18764
|
-
* }
|
|
18765
|
-
* };
|
|
18971
|
+
* if (!result.error) {
|
|
18972
|
+
* // Simple usage - just pass the message data
|
|
18973
|
+
* <SpotterMessage message={result.message} />
|
|
18766
18974
|
*
|
|
18767
|
-
*
|
|
18768
|
-
*
|
|
18769
|
-
*
|
|
18770
|
-
*
|
|
18771
|
-
*
|
|
18772
|
-
* );
|
|
18975
|
+
* // With optional query for context
|
|
18976
|
+
* <SpotterMessage
|
|
18977
|
+
* message={result.message}
|
|
18978
|
+
* query={result.query}
|
|
18979
|
+
* />
|
|
18773
18980
|
* }
|
|
18774
18981
|
* ```
|
|
18982
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.11.0.cl
|
|
18775
18983
|
*/
|
|
18776
|
-
const
|
|
18777
|
-
const {
|
|
18778
|
-
|
|
18779
|
-
useDeepCompareEffect(() => {
|
|
18780
|
-
if (serviceRef.current) {
|
|
18781
|
-
serviceRef.current = null;
|
|
18782
|
-
}
|
|
18783
|
-
const configProps = {
|
|
18784
|
-
...restProps,
|
|
18785
|
-
...(className ? { containerClassName: className } : {})
|
|
18786
|
-
};
|
|
18787
|
-
serviceRef.current = new SpotterAgentEmbed$1(configProps);
|
|
18788
|
-
if (ref) {
|
|
18789
|
-
if (typeof ref === 'function') {
|
|
18790
|
-
ref(serviceRef.current);
|
|
18791
|
-
}
|
|
18792
|
-
else {
|
|
18793
|
-
ref.current = serviceRef.current;
|
|
18794
|
-
}
|
|
18795
|
-
}
|
|
18796
|
-
return () => {
|
|
18797
|
-
serviceRef.current = null;
|
|
18798
|
-
};
|
|
18799
|
-
}, [props]);
|
|
18800
|
-
return null;
|
|
18984
|
+
const SpotterMessage = React.forwardRef((props, ref) => {
|
|
18985
|
+
const { message, query: _, ...otherProps } = props;
|
|
18986
|
+
return (React.createElement(ConversationMessage, { ref: ref, ...message, ...otherProps }));
|
|
18801
18987
|
});
|
|
18802
18988
|
/**
|
|
18803
18989
|
* React component for PreRendered Conversation embed.
|
|
@@ -18857,6 +19043,62 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18857
19043
|
ref.current = authEE;
|
|
18858
19044
|
}, [config]);
|
|
18859
19045
|
return ref;
|
|
19046
|
+
}
|
|
19047
|
+
/**
|
|
19048
|
+
* React hook for interacting with SpotterAgent AI conversations.
|
|
19049
|
+
*
|
|
19050
|
+
* This hook provides a sendMessage function that allows you to send natural language
|
|
19051
|
+
* queries to your data and get back AI-generated responses with visualizations.
|
|
19052
|
+
*
|
|
19053
|
+
* @param config - Configuration object containing worksheetId and other options
|
|
19054
|
+
* @returns Object with sendMessage function that returns conversation results
|
|
19055
|
+
* @example
|
|
19056
|
+
* ```tsx
|
|
19057
|
+
* const { sendMessage } = useSpotterAgent({ worksheetId: 'worksheetId' });
|
|
19058
|
+
*
|
|
19059
|
+
* const handleQuery = async () => {
|
|
19060
|
+
* const result = await sendMessage('show me sales by region');
|
|
19061
|
+
*
|
|
19062
|
+
* if (!result.error) {
|
|
19063
|
+
* // Display the message response
|
|
19064
|
+
* <SpotterMessage message={result.message} />
|
|
19065
|
+
* } else {
|
|
19066
|
+
* console.error('Error:', result.error);
|
|
19067
|
+
* }
|
|
19068
|
+
* };
|
|
19069
|
+
* ```
|
|
19070
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.11.0.cl
|
|
19071
|
+
*/
|
|
19072
|
+
function useSpotterAgent(config) {
|
|
19073
|
+
const serviceRef = React.useRef(null);
|
|
19074
|
+
useDeepCompareEffect(() => {
|
|
19075
|
+
if (serviceRef.current) {
|
|
19076
|
+
serviceRef.current = null;
|
|
19077
|
+
}
|
|
19078
|
+
serviceRef.current = new SpotterAgentEmbed(config);
|
|
19079
|
+
return () => {
|
|
19080
|
+
serviceRef.current = null;
|
|
19081
|
+
};
|
|
19082
|
+
}, [config]);
|
|
19083
|
+
const sendMessage = React.useCallback(async (query) => {
|
|
19084
|
+
if (!serviceRef.current) {
|
|
19085
|
+
return { error: new Error(ERROR_MESSAGE.SPOTTER_AGENT_NOT_INITIALIZED) };
|
|
19086
|
+
}
|
|
19087
|
+
const result = await serviceRef.current.sendMessageData(query);
|
|
19088
|
+
if (result.error) {
|
|
19089
|
+
return { error: result.error };
|
|
19090
|
+
}
|
|
19091
|
+
return {
|
|
19092
|
+
query: query,
|
|
19093
|
+
message: {
|
|
19094
|
+
...result.data,
|
|
19095
|
+
worksheetId: config.worksheetId,
|
|
19096
|
+
},
|
|
19097
|
+
};
|
|
19098
|
+
}, [config.worksheetId]);
|
|
19099
|
+
return {
|
|
19100
|
+
sendMessage,
|
|
19101
|
+
};
|
|
18860
19102
|
}
|
|
18861
19103
|
|
|
18862
19104
|
const ALIAS = Symbol.for('yaml.alias');
|
|
@@ -26263,6 +26505,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
26263
26505
|
|
|
26264
26506
|
exports.AppEmbed = AppEmbed;
|
|
26265
26507
|
exports.ConversationEmbed = ConversationEmbed;
|
|
26508
|
+
exports.ConversationMessage = ConversationMessage;
|
|
26266
26509
|
exports.LiveboardEmbed = LiveboardEmbed;
|
|
26267
26510
|
exports.PinboardEmbed = PinboardEmbed;
|
|
26268
26511
|
exports.PreRenderedAppEmbed = PreRenderedAppEmbed;
|
|
@@ -26275,10 +26518,11 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
26275
26518
|
exports.SageEmbed = SageEmbed;
|
|
26276
26519
|
exports.SearchBarEmbed = SearchBarEmbed;
|
|
26277
26520
|
exports.SearchEmbed = SearchEmbed;
|
|
26278
|
-
exports.SpotterAgentEmbed = SpotterAgentEmbed;
|
|
26279
26521
|
exports.SpotterEmbed = SpotterEmbed;
|
|
26522
|
+
exports.SpotterMessage = SpotterMessage;
|
|
26280
26523
|
exports.getSessionInfo = getSessionInfo;
|
|
26281
26524
|
exports.useEmbedRef = useEmbedRef;
|
|
26282
26525
|
exports.useInit = useInit;
|
|
26526
|
+
exports.useSpotterAgent = useSpotterAgent;
|
|
26283
26527
|
|
|
26284
26528
|
}));
|