@thoughtspot/visual-embed-sdk 1.32.0 → 1.32.1
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/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +6 -5
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/authToken.d.ts.map +1 -1
- package/cjs/src/authToken.js +5 -7
- package/cjs/src/authToken.js.map +1 -1
- package/cjs/src/embed/app.d.ts +1 -0
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +2 -2
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +2 -0
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/search.d.ts +14 -0
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +5 -3
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +10 -6
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/errors.d.ts +11 -0
- package/cjs/src/errors.d.ts.map +1 -1
- package/cjs/src/errors.js +11 -0
- package/cjs/src/errors.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts.map +1 -1
- package/cjs/src/mixpanel-service.js +2 -1
- package/cjs/src/mixpanel-service.js.map +1 -1
- package/cjs/src/react/index.spec.js +1 -1
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +167 -6
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +140 -3
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +2 -1
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/reporting.d.ts +16 -0
- package/cjs/src/utils/reporting.d.ts.map +1 -0
- package/cjs/src/utils/reporting.js +68 -0
- package/cjs/src/utils/reporting.js.map +1 -0
- package/cjs/src/utils/reporting.spec.d.ts +2 -0
- package/cjs/src/utils/reporting.spec.d.ts.map +1 -0
- package/cjs/src/utils/reporting.spec.js +76 -0
- package/cjs/src/utils/reporting.spec.js.map +1 -0
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/authToken.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +1 -0
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +14 -0
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +1 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/errors.d.ts +11 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/types.d.ts +167 -6
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/src/utils/reporting.d.ts +16 -0
- package/dist/src/utils/reporting.d.ts.map +1 -0
- package/dist/src/utils/reporting.spec.d.ts +2 -0
- package/dist/src/utils/reporting.spec.d.ts.map +1 -0
- package/dist/tsembed-react.es.js +193 -36
- package/dist/tsembed-react.js +193 -36
- package/dist/tsembed.es.js +240 -37
- package/dist/tsembed.js +240 -37
- package/dist/visual-embed-sdk-react-full.d.ts +183 -7
- package/dist/visual-embed-sdk-react.d.ts +183 -7
- package/dist/visual-embed-sdk.d.ts +183 -7
- package/lib/package.json +1 -1
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +6 -5
- package/lib/src/auth.js.map +1 -1
- package/lib/src/authToken.d.ts.map +1 -1
- package/lib/src/authToken.js +5 -7
- package/lib/src/authToken.js.map +1 -1
- package/lib/src/embed/app.d.ts +1 -0
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +2 -2
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +2 -0
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/search.d.ts +14 -0
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +5 -3
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +10 -6
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/errors.d.ts +11 -0
- package/lib/src/errors.d.ts.map +1 -1
- package/lib/src/errors.js +11 -0
- package/lib/src/errors.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +2 -1
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/react/index.spec.js +1 -1
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +167 -6
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +140 -3
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +2 -1
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/reporting.d.ts +16 -0
- package/lib/src/utils/reporting.d.ts.map +1 -0
- package/lib/src/utils/reporting.js +62 -0
- package/lib/src/utils/reporting.js.map +1 -0
- package/lib/src/utils/reporting.spec.d.ts +2 -0
- package/lib/src/utils/reporting.spec.d.ts.map +1 -0
- package/lib/src/utils/reporting.spec.js +74 -0
- package/lib/src/utils/reporting.spec.js.map +1 -0
- package/lib/src/visual-embed-sdk.d.ts +183 -7
- package/package.json +1 -1
- package/src/auth.ts +6 -5
- package/src/authToken.ts +5 -9
- package/src/embed/app.ts +3 -1
- package/src/embed/base.ts +3 -1
- package/src/embed/search.ts +19 -2
- package/src/embed/ts-embed.ts +13 -6
- package/src/errors.ts +11 -0
- package/src/mixpanel-service.ts +2 -1
- package/src/react/index.spec.tsx +1 -1
- package/src/types.ts +170 -3
- package/src/utils/processData.ts +2 -3
- package/src/utils/reporting.spec.ts +91 -0
- package/src/utils/reporting.ts +71 -0
package/src/mixpanel-service.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as mixpanel from 'mixpanel-browser';
|
|
2
2
|
import { logger } from './utils/logger';
|
|
3
3
|
import { SessionInfo } from './utils/sessionInfoService';
|
|
4
|
+
import { ERROR_MESSAGE } from './errors';
|
|
4
5
|
|
|
5
6
|
export const EndPoints = {
|
|
6
7
|
CONFIG: '/callosum/v1/system/config',
|
|
@@ -57,7 +58,7 @@ function emptyQueue() {
|
|
|
57
58
|
*/
|
|
58
59
|
export function initMixpanel(sessionInfo: SessionInfo): void {
|
|
59
60
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
60
|
-
logger.error(
|
|
61
|
+
logger.error(ERROR_MESSAGE.MIXPANEL_TOKEN_NOT_FOUND);
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
64
|
// On a public cluster the user is anonymous, so don't set the identify to
|
package/src/react/index.spec.tsx
CHANGED
|
@@ -56,7 +56,7 @@ describe('React Components', () => {
|
|
|
56
56
|
),
|
|
57
57
|
).toBe(true);
|
|
58
58
|
expect(getIFrameSrc(container)).toBe(
|
|
59
|
-
`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&enableDataPanelV2=false&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true&collapseSearchBarInitially=
|
|
59
|
+
`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&enableDataPanelV2=false&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true&collapseSearchBarInitially=true&enableCustomColumnGroups=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_ALL#/embed/answer`,
|
|
60
60
|
);
|
|
61
61
|
});
|
|
62
62
|
|
package/src/types.ts
CHANGED
|
@@ -201,6 +201,10 @@ export enum HomeLeftNavItem {
|
|
|
201
201
|
* @version SDK: 1.28.0| ThoughtSpot: 9.12.5.cl
|
|
202
202
|
*/
|
|
203
203
|
SpotIQAnalysis = 'spotiq-analysis',
|
|
204
|
+
/**
|
|
205
|
+
* @version SDK: 1.34.0| ThoughtSpot: 10.3.0.cl
|
|
206
|
+
*/
|
|
207
|
+
LiveboardSchedules = 'liveboard-schedules'
|
|
204
208
|
}
|
|
205
209
|
export type DOMSelector = string | HTMLElement;
|
|
206
210
|
|
|
@@ -1012,6 +1016,30 @@ export interface ViewConfig {
|
|
|
1012
1016
|
*/
|
|
1013
1017
|
// eslint-disable-next-line camelcase
|
|
1014
1018
|
enableV2Shell_experimental?: boolean;
|
|
1019
|
+
/**
|
|
1020
|
+
* To set the initial state of the search bar in case of saved-answers.
|
|
1021
|
+
* @default true
|
|
1022
|
+
* @version SDK: 1.34.0 | Thoughtspot: 10.3.0.cl
|
|
1023
|
+
* @example
|
|
1024
|
+
* ```js
|
|
1025
|
+
* const embed = new LiveboardEmbed('#embed', {
|
|
1026
|
+
* liveboardId: '123',
|
|
1027
|
+
* collapseSearchBar: true
|
|
1028
|
+
* });
|
|
1029
|
+
*/
|
|
1030
|
+
collapseSearchBar?: boolean;
|
|
1031
|
+
/**
|
|
1032
|
+
* This flag can be used to disable links inside the embedded app,
|
|
1033
|
+
* and disables redirection of links in a new tab.
|
|
1034
|
+
* @example
|
|
1035
|
+
* ```js
|
|
1036
|
+
* const embed = new LiveboardEmbed('#embed', {
|
|
1037
|
+
* disableRedirectionLinksInNewTab: true
|
|
1038
|
+
* });
|
|
1039
|
+
* ```
|
|
1040
|
+
* @version SDK: 1.32.1 | ThoughtSpot: 10.3.0.cl
|
|
1041
|
+
*/
|
|
1042
|
+
disableRedirectionLinksInNewTab?: boolean;
|
|
1015
1043
|
}
|
|
1016
1044
|
|
|
1017
1045
|
/**
|
|
@@ -1773,6 +1801,7 @@ export enum EmbedEvent {
|
|
|
1773
1801
|
/**
|
|
1774
1802
|
* Emitted when a user clicks the **Update TML** action on
|
|
1775
1803
|
* embedded Liveboard.
|
|
1804
|
+
*
|
|
1776
1805
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1777
1806
|
* @example
|
|
1778
1807
|
*```js
|
|
@@ -1784,6 +1813,7 @@ export enum EmbedEvent {
|
|
|
1784
1813
|
/**
|
|
1785
1814
|
* Emitted when a user clicks the **Edit TML** action
|
|
1786
1815
|
* on an embedded Liveboard.
|
|
1816
|
+
*
|
|
1787
1817
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1788
1818
|
* @example
|
|
1789
1819
|
*```js
|
|
@@ -2393,16 +2423,20 @@ export enum HostEvent {
|
|
|
2393
2423
|
/**
|
|
2394
2424
|
* Trigger the **Export TML** action on an embedded Liveboard or
|
|
2395
2425
|
* Answer.
|
|
2426
|
+
*
|
|
2396
2427
|
* @example
|
|
2397
2428
|
* ```js
|
|
2398
2429
|
* liveboardEmbed.trigger(HostEvent.ExportTML)
|
|
2399
2430
|
* ```
|
|
2431
|
+
*
|
|
2400
2432
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2401
2433
|
*/
|
|
2402
2434
|
ExportTML = 'exportTSL',
|
|
2403
2435
|
/**
|
|
2404
2436
|
* Trigger the **Edit TML** action on an embedded Liveboard or
|
|
2405
2437
|
* saved Answers in the full application embedding.
|
|
2438
|
+
*
|
|
2439
|
+
*
|
|
2406
2440
|
* @example
|
|
2407
2441
|
* ```js
|
|
2408
2442
|
* liveboardEmbed.trigger(HostEvent.EditTML)
|
|
@@ -2493,13 +2527,15 @@ export enum HostEvent {
|
|
|
2493
2527
|
*
|
|
2494
2528
|
* @example
|
|
2495
2529
|
* ```js
|
|
2496
|
-
*
|
|
2530
|
+
* searchEmbed.trigger(HostEvent.CreateMonitor)
|
|
2497
2531
|
* ```
|
|
2498
2532
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2499
2533
|
*/
|
|
2500
2534
|
CreateMonitor = 'createMonitor',
|
|
2501
2535
|
/**
|
|
2502
|
-
* Trigger the **Manage alerts** action on a
|
|
2536
|
+
* Trigger the **Manage alerts** action on a KPI chart
|
|
2537
|
+
* in a visualization or saved Answer.
|
|
2538
|
+
*
|
|
2503
2539
|
* @param - an object with `vizId` as a key
|
|
2504
2540
|
* @example
|
|
2505
2541
|
* ```js
|
|
@@ -2507,6 +2543,16 @@ export enum HostEvent {
|
|
|
2507
2543
|
* vizId: '730496d6-6903-4601-937e-2c691821af3c'
|
|
2508
2544
|
* })
|
|
2509
2545
|
* ```
|
|
2546
|
+
*
|
|
2547
|
+
* @example
|
|
2548
|
+
* ```js
|
|
2549
|
+
* searchEmbed.trigger(HostEvent.ManageMonitor)
|
|
2550
|
+
* ```
|
|
2551
|
+
*
|
|
2552
|
+
* @example
|
|
2553
|
+
* ```js
|
|
2554
|
+
* vizEmbed.trigger(HostEvent.ManageMonitor)
|
|
2555
|
+
* ```
|
|
2510
2556
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2511
2557
|
*/
|
|
2512
2558
|
ManageMonitor = 'manageMonitor',
|
|
@@ -2517,6 +2563,7 @@ export enum HostEvent {
|
|
|
2517
2563
|
* This event is not supported in visualization embed and search embed.
|
|
2518
2564
|
* @param - object - To trigger the action for a specific visualization
|
|
2519
2565
|
* in Liveboard embed, pass in `vizId` as a key.
|
|
2566
|
+
*
|
|
2520
2567
|
* @example
|
|
2521
2568
|
* ```js
|
|
2522
2569
|
* liveboardEmbed.trigger(HostEvent.Edit)
|
|
@@ -2783,6 +2830,7 @@ export enum HostEvent {
|
|
|
2783
2830
|
/**
|
|
2784
2831
|
* Get details of filters applied on the Liveboard.
|
|
2785
2832
|
* Returns arrays containing Liveboard filter and runtime filter elements.
|
|
2833
|
+
*
|
|
2786
2834
|
* @example
|
|
2787
2835
|
* ```js
|
|
2788
2836
|
* const data = await liveboardEmbed.trigger(HostEvent.GetFilters);
|
|
@@ -3084,6 +3132,7 @@ export enum Param {
|
|
|
3084
3132
|
IsFullAppEmbed = 'isFullAppEmbed',
|
|
3085
3133
|
IsOnBeforeGetVizDataInterceptEnabled = 'isOnBeforeGetVizDataInterceptEnabled',
|
|
3086
3134
|
FocusSearchBarOnRender = 'focusSearchBarOnRender',
|
|
3135
|
+
DisableRedirectionLinksInNewTab = 'disableRedirectionLinksInNewTab',
|
|
3087
3136
|
}
|
|
3088
3137
|
|
|
3089
3138
|
/**
|
|
@@ -3135,6 +3184,7 @@ export enum Action {
|
|
|
3135
3184
|
* The **Save as View** action on the Answer
|
|
3136
3185
|
* page. Saves an Answer as a View object in the full
|
|
3137
3186
|
* application embedding mode.
|
|
3187
|
+
*
|
|
3138
3188
|
* @example
|
|
3139
3189
|
* ```js
|
|
3140
3190
|
* disabledActions: [Action.SaveAsView]
|
|
@@ -3234,6 +3284,7 @@ export enum Action {
|
|
|
3234
3284
|
*/
|
|
3235
3285
|
ConfigureFilter = 'configureFilter',
|
|
3236
3286
|
CollapseDataSources = 'collapseDataSources',
|
|
3287
|
+
CollapseDataPanel = 'collapseDataPanel',
|
|
3237
3288
|
/**
|
|
3238
3289
|
* The **Choose sources** button on Search page.
|
|
3239
3290
|
* Allows selecting data sources for search queries.
|
|
@@ -3592,6 +3643,7 @@ export enum Action {
|
|
|
3592
3643
|
/**
|
|
3593
3644
|
* The **Delete** action for Answers in the full application
|
|
3594
3645
|
* embedding mode.
|
|
3646
|
+
*
|
|
3595
3647
|
* @example
|
|
3596
3648
|
* ```js
|
|
3597
3649
|
* disabledActions: [Action.AnswerDelete]
|
|
@@ -3630,12 +3682,15 @@ export enum Action {
|
|
|
3630
3682
|
* The Create alert action on KPI charts.
|
|
3631
3683
|
* @example
|
|
3632
3684
|
* ```js
|
|
3633
|
-
* disabledActions: [Action.CreateMonitor
|
|
3685
|
+
* disabledActions: [Action.CreateMonitor]
|
|
3634
3686
|
* ```
|
|
3635
3687
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
3636
3688
|
*/
|
|
3637
3689
|
CreateMonitor = 'createMonitor',
|
|
3638
3690
|
/**
|
|
3691
|
+
* @deprecated
|
|
3692
|
+
* Reports errors
|
|
3693
|
+
*
|
|
3639
3694
|
* @example
|
|
3640
3695
|
* ```js
|
|
3641
3696
|
* disabledActions: [Action.ReportError]
|
|
@@ -3860,35 +3915,87 @@ export enum Action {
|
|
|
3860
3915
|
*/
|
|
3861
3916
|
RenameModalTitleDescription = 'renameModalTitleDescription',
|
|
3862
3917
|
/**
|
|
3918
|
+
*
|
|
3919
|
+
* The **Request Verification** action on the Liveboard.
|
|
3920
|
+
* Triggers a Liveboard verification request.
|
|
3921
|
+
*
|
|
3922
|
+
* @example
|
|
3923
|
+
* ```js
|
|
3924
|
+
* disabledActions: [Action.RequestVerification]
|
|
3925
|
+
* ```
|
|
3863
3926
|
*
|
|
3864
3927
|
* @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
|
|
3865
3928
|
*/
|
|
3866
3929
|
RequestVerification = 'requestVerification',
|
|
3867
3930
|
/**
|
|
3931
|
+
*
|
|
3932
|
+
* Allows users to mark a Liveboard as verified.
|
|
3933
|
+
*
|
|
3934
|
+
* @example
|
|
3935
|
+
* ```js
|
|
3936
|
+
* disabledActions: [Action.MarkAsVerified]
|
|
3937
|
+
* ```
|
|
3868
3938
|
* @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
|
|
3869
3939
|
*/
|
|
3870
3940
|
MarkAsVerified = 'markAsVerified',
|
|
3871
3941
|
/**
|
|
3942
|
+
* The **Add Tab** action on a Liveboard.
|
|
3943
|
+
* Allows adding a new tab to a Liveboard view.
|
|
3944
|
+
*
|
|
3945
|
+
* @example
|
|
3946
|
+
* ```js
|
|
3947
|
+
* disabledActions: [Action.AddTab]
|
|
3948
|
+
* ```
|
|
3872
3949
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
3873
3950
|
*/
|
|
3874
3951
|
AddTab = 'addTab',
|
|
3875
3952
|
/**
|
|
3953
|
+
*
|
|
3954
|
+
* Initiates contextual change analysis on KPI charts.
|
|
3955
|
+
*
|
|
3956
|
+
* @example
|
|
3957
|
+
* ```js
|
|
3958
|
+
* disabledActions: [Action.EnableContextualChangeAnalysis]
|
|
3959
|
+
* ```
|
|
3876
3960
|
* @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl
|
|
3877
3961
|
*/
|
|
3878
3962
|
EnableContextualChangeAnalysis = 'enableContextualChangeAnalysis',
|
|
3879
3963
|
/**
|
|
3964
|
+
*
|
|
3965
|
+
* @example
|
|
3966
|
+
* ```js
|
|
3967
|
+
* disabledActions: [Action.ShowSageQuery]
|
|
3968
|
+
* ```
|
|
3969
|
+
*
|
|
3880
3970
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
3881
3971
|
*/
|
|
3882
3972
|
ShowSageQuery = 'showSageQuery',
|
|
3883
3973
|
/**
|
|
3974
|
+
*
|
|
3975
|
+
* @example
|
|
3976
|
+
* ```js
|
|
3977
|
+
* disabledActions: [Action.EditSageAnswer]
|
|
3978
|
+
* ```
|
|
3884
3979
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
3885
3980
|
*/
|
|
3886
3981
|
EditSageAnswer = 'editSageAnswer',
|
|
3887
3982
|
/**
|
|
3983
|
+
*
|
|
3984
|
+
* This action allows users to send feedback on AI-generated Answers.
|
|
3985
|
+
*
|
|
3986
|
+
* @example
|
|
3987
|
+
* ```js
|
|
3988
|
+
* disabledActions: [Action.SageAnswerFeedback]
|
|
3989
|
+
* ```
|
|
3888
3990
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
3889
3991
|
*/
|
|
3890
3992
|
SageAnswerFeedback = 'sageAnswerFeedback',
|
|
3891
3993
|
/**
|
|
3994
|
+
*
|
|
3995
|
+
* @example
|
|
3996
|
+
* ```js
|
|
3997
|
+
* disabledActions: [Action.ModifySageAnswer]
|
|
3998
|
+
* ```
|
|
3892
3999
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
3893
4000
|
*/
|
|
3894
4001
|
ModifySageAnswer = 'modifySageAnswer',
|
|
@@ -4018,6 +4125,66 @@ export enum Action {
|
|
|
4018
4125
|
* @version SDK: 1.27.10 | Thoughtspot: 9.12.5.cl
|
|
4019
4126
|
*/
|
|
4020
4127
|
AIHighlights = 'AIHighlights',
|
|
4128
|
+
|
|
4129
|
+
/**
|
|
4130
|
+
* Action ID for edit schedule action on schedule on homepage
|
|
4131
|
+
* @example
|
|
4132
|
+
* ```js
|
|
4133
|
+
* disabledActions: [Action.EditScheduleHomepage]
|
|
4134
|
+
* ```
|
|
4135
|
+
* @version SDK: 1.34.0 | Thoughtspot: 10.3.0.cl
|
|
4136
|
+
*/
|
|
4137
|
+
EditScheduleHomepage = 'editScheduleHomepage',
|
|
4138
|
+
|
|
4139
|
+
/**
|
|
4140
|
+
* Action ID for pause schedule action on schedule on homepage
|
|
4141
|
+
* @example
|
|
4142
|
+
* ```js
|
|
4143
|
+
* disabledActions: [Action.PauseScheduleHomepage]
|
|
4144
|
+
* ```
|
|
4145
|
+
* @version SDK: 1.34.0 | Thoughtspot: 10.3.0.cl
|
|
4146
|
+
*/
|
|
4147
|
+
PauseScheduleHomepage = 'pauseScheduleHomepage',
|
|
4148
|
+
|
|
4149
|
+
/**
|
|
4150
|
+
* Action ID for view schedule run action on schedule on homepage
|
|
4151
|
+
* @example
|
|
4152
|
+
* ```js
|
|
4153
|
+
* disabledActions: [Action.ViewScheduleRunHomepage]
|
|
4154
|
+
* ```
|
|
4155
|
+
* @version SDK: 1.34.0 | Thoughtspot: 10.3.0.cl
|
|
4156
|
+
*/
|
|
4157
|
+
ViewScheduleRunHomepage = 'viewScheduleRunHomepage',
|
|
4158
|
+
|
|
4159
|
+
/**
|
|
4160
|
+
* Action ID for unsubscribe schedule action on schedule on homepage
|
|
4161
|
+
* @example
|
|
4162
|
+
* ```js
|
|
4163
|
+
* disabledActions: [Action.UnsubscribeScheduleHomepage]
|
|
4164
|
+
* ```
|
|
4165
|
+
* @version SDK: 1.34.0 | Thoughtspot: 10.3.0.cl
|
|
4166
|
+
*/
|
|
4167
|
+
UnsubscribeScheduleHomepage = 'unsubscribeScheduleHomepage',
|
|
4168
|
+
|
|
4169
|
+
/**
|
|
4170
|
+
* Action ID for delete schedule action on schedule on homepage
|
|
4171
|
+
* @example
|
|
4172
|
+
* ```js
|
|
4173
|
+
* disabledActions: [Action.DeleteScheduleHomepage]
|
|
4174
|
+
* ```
|
|
4175
|
+
* @version SDK: 1.34.0 | Thoughtspot: 10.3.0.cl
|
|
4176
|
+
*/
|
|
4177
|
+
DeleteScheduleHomepage = 'deleteScheduleHomepage',
|
|
4178
|
+
|
|
4179
|
+
/**
|
|
4180
|
+
* The **Analyze CTA** action on KPI chart.
|
|
4181
|
+
* @example
|
|
4182
|
+
* ```js
|
|
4183
|
+
* disabledActions: [Action.KPIAnalysisCTA]
|
|
4184
|
+
* ```
|
|
4185
|
+
* @version SDK: 1.34.0 | Thoughtspot: 10.3.0.cl
|
|
4186
|
+
*/
|
|
4187
|
+
KPIAnalysisCTA = 'kpiAnalysisCTA',
|
|
4021
4188
|
}
|
|
4022
4189
|
|
|
4023
4190
|
export interface AnswerServiceType {
|
package/src/utils/processData.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { AuthFailureType } from '../auth';
|
|
|
9
9
|
import { AuthType, CustomActionPayload, EmbedEvent } from '../types';
|
|
10
10
|
import { AnswerService } from './graphql/answerService/answerService';
|
|
11
11
|
import { resetCachedAuthToken } from '../authToken';
|
|
12
|
+
import { ERROR_MESSAGE } from '../errors';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
*
|
|
@@ -62,9 +63,7 @@ function processNoCookieAccess(e: any, containerEl: Element) {
|
|
|
62
63
|
if (!ignoreNoCookieAccess) {
|
|
63
64
|
if (!suppressNoCookieAccessAlert && !suppressErrorAlerts) {
|
|
64
65
|
// eslint-disable-next-line no-alert
|
|
65
|
-
alert(
|
|
66
|
-
'Third party cookie access is blocked on this browser, please allow third party cookies for this to work properly. \nYou can use `suppressNoCookieAccessAlert` to suppress this message.',
|
|
67
|
-
);
|
|
66
|
+
alert(ERROR_MESSAGE.THIRD_PARTY_COOKIE_BLOCKED_ALERT);
|
|
68
67
|
}
|
|
69
68
|
// eslint-disable-next-line no-param-reassign
|
|
70
69
|
containerEl.innerHTML = loginFailedMessage;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { setEmbedConfig } from '../embed/embedConfig';
|
|
2
|
+
import { registerReportingObserver, getGlobalReportingObserver, resetGlobalReportingObserver } from './reporting';
|
|
3
|
+
import { logger } from './logger';
|
|
4
|
+
import { AuthType } from '../types';
|
|
5
|
+
import { ERROR_MESSAGE } from '../errors';
|
|
6
|
+
|
|
7
|
+
jest.mock('./logger');
|
|
8
|
+
|
|
9
|
+
describe('ReportingObserver', () => {
|
|
10
|
+
let mockReportingObserver: jest.Mock;
|
|
11
|
+
|
|
12
|
+
beforeAll(() => {
|
|
13
|
+
// Mock the ReportingObserver
|
|
14
|
+
mockReportingObserver = jest.fn().mockImplementation((callback: any, options: any) => ({
|
|
15
|
+
observe: jest.fn(),
|
|
16
|
+
disconnect: jest.fn(),
|
|
17
|
+
takeRecords: jest.fn(),
|
|
18
|
+
}));
|
|
19
|
+
(window as any).ReportingObserver = mockReportingObserver;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
jest.clearAllMocks();
|
|
24
|
+
resetGlobalReportingObserver();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('should warn if ReportingObserver is not supported', () => {
|
|
28
|
+
(window as any).ReportingObserver = undefined;
|
|
29
|
+
const observer = registerReportingObserver();
|
|
30
|
+
expect(observer).toBeNull();
|
|
31
|
+
expect(logger.warn).toHaveBeenCalledWith('ReportingObserver not supported');
|
|
32
|
+
(window as any).ReportingObserver = mockReportingObserver;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('should return existing globalObserver if override is false', () => {
|
|
36
|
+
const firstObserver = registerReportingObserver();
|
|
37
|
+
const secondObserver = registerReportingObserver();
|
|
38
|
+
expect(firstObserver === secondObserver).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('should override existing globalObserver if override is true', () => {
|
|
42
|
+
const firstObserver = registerReportingObserver();
|
|
43
|
+
const secondObserver = registerReportingObserver(true);
|
|
44
|
+
expect(firstObserver).not.toBe(secondObserver);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('should return globalObserver', () => {
|
|
48
|
+
const observer = registerReportingObserver();
|
|
49
|
+
const globalObserver = getGlobalReportingObserver();
|
|
50
|
+
expect(globalObserver).toBe(observer);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('Should register a global observer with callback', () => {
|
|
54
|
+
let callBackPassed: any;
|
|
55
|
+
|
|
56
|
+
// Mock the ReportingObserver
|
|
57
|
+
const NewMockRO = jest.fn().mockImplementation((callback: any, options: any) => {
|
|
58
|
+
callBackPassed = callback;
|
|
59
|
+
return ({
|
|
60
|
+
observe: jest.fn(),
|
|
61
|
+
disconnect: jest.fn(),
|
|
62
|
+
takeRecords: jest.fn(),
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
const currentObserver = (window as any).ReportingObserver;
|
|
66
|
+
(window as any).ReportingObserver = NewMockRO;
|
|
67
|
+
|
|
68
|
+
setEmbedConfig({
|
|
69
|
+
thoughtSpotHost: 'testHost',
|
|
70
|
+
authType: AuthType.None,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const mockAlert = jest.fn();
|
|
74
|
+
window.alert = mockAlert;
|
|
75
|
+
|
|
76
|
+
const observer = registerReportingObserver();
|
|
77
|
+
expect(observer).toBeDefined();
|
|
78
|
+
expect(NewMockRO).toHaveBeenCalled();
|
|
79
|
+
expect(callBackPassed).toBeDefined();
|
|
80
|
+
|
|
81
|
+
// call the callback
|
|
82
|
+
callBackPassed([{ type: 'csp-violation', url: 'testHost', body: { effectiveDirective: 'frame-ancestors' } }]);
|
|
83
|
+
|
|
84
|
+
expect(mockAlert).toHaveBeenCalledWith(ERROR_MESSAGE.CSP_VIOLATION_ALERT);
|
|
85
|
+
expect(logger.error).toHaveBeenCalledWith(
|
|
86
|
+
ERROR_MESSAGE.CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
(window as any).ReportingObserver = currentObserver;
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { getEmbedConfig } from '../embed/embedConfig';
|
|
2
|
+
import { logger } from './logger';
|
|
3
|
+
import { ERROR_MESSAGE } from '../errors';
|
|
4
|
+
|
|
5
|
+
enum ReportType {
|
|
6
|
+
CSP_VIOLATION = 'csp-violation',
|
|
7
|
+
DEPRECATION = 'deprecation',
|
|
8
|
+
INTERVENTION = 'intervention',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let globalObserver: ReportingObserver | null = null;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Register a global ReportingObserver to capture all unhandled errors
|
|
15
|
+
* @param overrideExisting boolean to override existing observer
|
|
16
|
+
* @returns ReportingObserver | null
|
|
17
|
+
*/
|
|
18
|
+
export function registerReportingObserver(overrideExisting = false): ReportingObserver | null {
|
|
19
|
+
if (!((window as any).ReportingObserver)) {
|
|
20
|
+
logger.warn(ERROR_MESSAGE.MISSING_REPORTING_OBSERVER);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (overrideExisting) {
|
|
25
|
+
resetGlobalReportingObserver();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (globalObserver) {
|
|
29
|
+
return globalObserver;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const embedConfig = getEmbedConfig();
|
|
33
|
+
|
|
34
|
+
globalObserver = new ReportingObserver((reports) => {
|
|
35
|
+
reports.forEach((report) => {
|
|
36
|
+
const { type, url, body } = report;
|
|
37
|
+
const reportBody = body as any;
|
|
38
|
+
|
|
39
|
+
const isThoughtSpotHost = url
|
|
40
|
+
&& url.startsWith(embedConfig.thoughtSpotHost);
|
|
41
|
+
|
|
42
|
+
const isFrameHostError = type === ReportType.CSP_VIOLATION
|
|
43
|
+
&& reportBody.effectiveDirective === 'frame-ancestors';
|
|
44
|
+
|
|
45
|
+
if (isThoughtSpotHost && isFrameHostError) {
|
|
46
|
+
if (!embedConfig.suppressErrorAlerts) {
|
|
47
|
+
alert(ERROR_MESSAGE.CSP_VIOLATION_ALERT);
|
|
48
|
+
}
|
|
49
|
+
logger.error(ERROR_MESSAGE.CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}, { buffered: true });
|
|
53
|
+
globalObserver.observe();
|
|
54
|
+
return globalObserver;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get the global ReportingObserver
|
|
59
|
+
* @returns - ReportingObserver | null
|
|
60
|
+
*/
|
|
61
|
+
export function getGlobalReportingObserver(): ReportingObserver | null {
|
|
62
|
+
return globalObserver;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Resets the global ReportingObserver
|
|
67
|
+
*/
|
|
68
|
+
export function resetGlobalReportingObserver(): void {
|
|
69
|
+
if (globalObserver) globalObserver.disconnect();
|
|
70
|
+
globalObserver = null;
|
|
71
|
+
}
|