@thoughtspot/visual-embed-sdk 1.42.0 → 1.42.1-alpha.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 +2 -2
- package/cjs/src/api-intercept.d.ts +25 -0
- package/cjs/src/api-intercept.d.ts.map +1 -0
- package/cjs/src/api-intercept.js +115 -0
- package/cjs/src/api-intercept.js.map +1 -0
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +7 -2
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +20 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +11 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js +1 -0
- package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +4 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +22 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +3 -1
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +15 -0
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +94 -26
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +83 -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 +2 -1
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/types.d.ts +100 -4
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +39 -1
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/processData.d.ts +1 -1
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +8 -8
- package/cjs/src/utils/processData.js.map +1 -1
- package/dist/index-BEzW4MDA.js +7371 -0
- package/dist/{index-BpSohedu.js → index-DvNA626T.js} +1 -1
- package/dist/src/api-intercept.d.ts +25 -0
- package/dist/src/api-intercept.d.ts.map +1 -0
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts +11 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +15 -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/types.d.ts +100 -4
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/processData.d.ts +1 -1
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +266 -51
- package/dist/tsembed-react.js +265 -50
- package/dist/tsembed.es.js +267 -52
- package/dist/tsembed.js +265 -50
- package/dist/visual-embed-sdk-react-full.d.ts +124 -4
- package/dist/visual-embed-sdk-react.d.ts +121 -4
- package/dist/visual-embed-sdk.d.ts +124 -4
- package/lib/package.json +2 -2
- package/lib/src/api-intercept.d.ts +25 -0
- package/lib/src/api-intercept.d.ts.map +1 -0
- package/lib/src/api-intercept.js +108 -0
- package/lib/src/api-intercept.js.map +1 -0
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +7 -2
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +20 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +11 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js +1 -0
- package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +4 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +22 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +3 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +15 -0
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +94 -26
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +83 -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/types.d.ts +100 -4
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +38 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/processData.d.ts +1 -1
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +8 -8
- package/lib/src/utils/processData.js.map +1 -1
- package/package.json +2 -2
- package/src/api-intercept.ts +134 -0
- package/src/embed/app.spec.ts +28 -0
- package/src/embed/app.ts +9 -1
- package/src/embed/hostEventClient/contracts.ts +10 -0
- package/src/embed/liveboard.spec.ts +30 -0
- package/src/embed/liveboard.ts +5 -0
- package/src/embed/search.ts +3 -1
- package/src/embed/ts-embed.spec.ts +116 -5
- package/src/embed/ts-embed.ts +129 -43
- package/src/errors.ts +1 -0
- package/src/index.ts +2 -0
- package/src/react/all-types-export.ts +1 -0
- package/src/types.ts +102 -3
- package/src/utils/processData.ts +11 -11
|
@@ -1201,7 +1201,7 @@ export interface CustomisationsInterface {
|
|
|
1201
1201
|
* if a trusted authentication server is used.
|
|
1202
1202
|
* @group Authentication / Init
|
|
1203
1203
|
*/
|
|
1204
|
-
export interface EmbedConfig {
|
|
1204
|
+
export interface EmbedConfig extends InterceptV2Flags {
|
|
1205
1205
|
/**
|
|
1206
1206
|
* The ThoughtSpot cluster hostname or IP address.
|
|
1207
1207
|
*/
|
|
@@ -1574,7 +1574,7 @@ export interface FrameParams {
|
|
|
1574
1574
|
/**
|
|
1575
1575
|
* The common configuration object for an embedded view.
|
|
1576
1576
|
*/
|
|
1577
|
-
export interface BaseViewConfig {
|
|
1577
|
+
export interface BaseViewConfig extends InterceptV2Flags {
|
|
1578
1578
|
/**
|
|
1579
1579
|
* @hidden
|
|
1580
1580
|
*/
|
|
@@ -2356,6 +2356,21 @@ export interface LiveboardAppEmbedViewConfig {
|
|
|
2356
2356
|
* ```
|
|
2357
2357
|
*/
|
|
2358
2358
|
liveboardXLSXCSVDownload?: boolean;
|
|
2359
|
+
/**
|
|
2360
|
+
* This flag is used to enable or disable the link parameters in liveboard.
|
|
2361
|
+
*
|
|
2362
|
+
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
|
|
2363
|
+
* @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
|
|
2364
|
+
* @example
|
|
2365
|
+
* ```js
|
|
2366
|
+
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
|
|
2367
|
+
* const embed = new <EmbedComponent>('#tsEmbed', {
|
|
2368
|
+
* ... // other embed view config
|
|
2369
|
+
* isLinkParametersEnabled: true,
|
|
2370
|
+
* })
|
|
2371
|
+
* ```
|
|
2372
|
+
*/
|
|
2373
|
+
isLinkParametersEnabled?: boolean;
|
|
2359
2374
|
}
|
|
2360
2375
|
export interface AllEmbedViewConfig extends BaseViewConfig, SearchLiveboardCommonViewConfig, HomePageConfig, LiveboardAppEmbedViewConfig {
|
|
2361
2376
|
}
|
|
@@ -3699,7 +3714,22 @@ export declare enum EmbedEvent {
|
|
|
3699
3714
|
* ```
|
|
3700
3715
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
3701
3716
|
*/
|
|
3702
|
-
OrgSwitched = "orgSwitched"
|
|
3717
|
+
OrgSwitched = "orgSwitched",
|
|
3718
|
+
/**
|
|
3719
|
+
* Emitted when the user intercepts a URL.
|
|
3720
|
+
*
|
|
3721
|
+
* Supported on all embed types.
|
|
3722
|
+
*
|
|
3723
|
+
* @example
|
|
3724
|
+
* ```js
|
|
3725
|
+
* embed.on(EmbedEvent.ApiIntercept, (payload) => {
|
|
3726
|
+
* console.log('payload', payload);
|
|
3727
|
+
* })
|
|
3728
|
+
* ```
|
|
3729
|
+
*
|
|
3730
|
+
* @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
|
|
3731
|
+
*/
|
|
3732
|
+
ApiIntercept = "ApiIntercept"
|
|
3703
3733
|
}
|
|
3704
3734
|
/**
|
|
3705
3735
|
* Event types that can be triggered by the host application
|
|
@@ -6462,6 +6492,71 @@ export interface DefaultAppInitData {
|
|
|
6462
6492
|
hiddenListColumns: ListPageColumns[];
|
|
6463
6493
|
customActions: CustomAction[];
|
|
6464
6494
|
}
|
|
6495
|
+
/**
|
|
6496
|
+
* Enum for the type of API intercepted
|
|
6497
|
+
*/
|
|
6498
|
+
export declare enum InterceptedApiType {
|
|
6499
|
+
/**
|
|
6500
|
+
* The apis that are use to get the metadata for the embed
|
|
6501
|
+
*/
|
|
6502
|
+
METADATA = "METADATA",
|
|
6503
|
+
/**
|
|
6504
|
+
* The apis that are use to get the data for the embed
|
|
6505
|
+
*/
|
|
6506
|
+
ANSWER_DATA = "ANSWER_DATA",
|
|
6507
|
+
/**
|
|
6508
|
+
* This will intercept all the apis
|
|
6509
|
+
*/
|
|
6510
|
+
ALL = "ALL",
|
|
6511
|
+
/**
|
|
6512
|
+
* The apis that are use to get the data for the liveboard
|
|
6513
|
+
*/
|
|
6514
|
+
LIVEBOARD_DATA = "LIVEBOARD_DATA"
|
|
6515
|
+
}
|
|
6516
|
+
export type InterceptV2Flags = {
|
|
6517
|
+
/**
|
|
6518
|
+
* Enable intercepting the apis
|
|
6519
|
+
*
|
|
6520
|
+
* @example
|
|
6521
|
+
* ```js
|
|
6522
|
+
* const embed = new LiveboardEmbed('#embed', {
|
|
6523
|
+
* ...viewConfig,
|
|
6524
|
+
* enableApiIntercept: true,
|
|
6525
|
+
* interceptUrls: [InterceptedApiType.DATA],
|
|
6526
|
+
* })
|
|
6527
|
+
* ```
|
|
6528
|
+
*
|
|
6529
|
+
*/
|
|
6530
|
+
enableApiIntercept?: boolean;
|
|
6531
|
+
/**
|
|
6532
|
+
* The apis to intercept
|
|
6533
|
+
*
|
|
6534
|
+
* @example
|
|
6535
|
+
* ```js
|
|
6536
|
+
* const embed = new LiveboardEmbed('#embed', {
|
|
6537
|
+
* ...viewConfig,
|
|
6538
|
+
* enableApiIntercept: true,
|
|
6539
|
+
* interceptUrls: [InterceptedApiType.DATA],
|
|
6540
|
+
* })
|
|
6541
|
+
* ```
|
|
6542
|
+
*/
|
|
6543
|
+
interceptUrls?: (string | InterceptedApiType)[];
|
|
6544
|
+
/**
|
|
6545
|
+
* The timeout for the intercept, default is 30000ms
|
|
6546
|
+
* the api will error out if the timeout is reached
|
|
6547
|
+
*
|
|
6548
|
+
* @example
|
|
6549
|
+
* ```js
|
|
6550
|
+
* const embed = new LiveboardEmbed('#embed', {
|
|
6551
|
+
* ...viewConfig,
|
|
6552
|
+
* enableApiIntercept: true,
|
|
6553
|
+
* interceptUrls: [InterceptedApiType.ALL],
|
|
6554
|
+
* interceptTimeout: 1000,
|
|
6555
|
+
* })
|
|
6556
|
+
* ```
|
|
6557
|
+
*/
|
|
6558
|
+
interceptTimeout?: number;
|
|
6559
|
+
};
|
|
6465
6560
|
/**
|
|
6466
6561
|
* Enum for auth failure types. This is the parameter passed to the listner
|
|
6467
6562
|
* of {@link AuthStatus.FAILURE}.
|
|
@@ -6570,7 +6665,8 @@ export declare enum UIPassthroughEvent {
|
|
|
6570
6665
|
GetDiscoverabilityStatus = "getDiscoverabilityStatus",
|
|
6571
6666
|
GetAvailableUIPassthroughs = "getAvailableUiPassthroughs",
|
|
6572
6667
|
GetAnswerConfig = "getAnswerPageConfig",
|
|
6573
|
-
GetLiveboardConfig = "getPinboardPageConfig"
|
|
6668
|
+
GetLiveboardConfig = "getPinboardPageConfig",
|
|
6669
|
+
GetUnsavedAnswerTML = "getUnsavedAnswerTML"
|
|
6574
6670
|
}
|
|
6575
6671
|
export type UIPassthroughContractBase = {
|
|
6576
6672
|
[UIPassthroughEvent.PinAnswerToLiveboard]: {
|
|
@@ -6625,6 +6721,15 @@ export type UIPassthroughContractBase = {
|
|
|
6625
6721
|
request: any;
|
|
6626
6722
|
response: any;
|
|
6627
6723
|
};
|
|
6724
|
+
[UIPassthroughEvent.GetUnsavedAnswerTML]: {
|
|
6725
|
+
request: {
|
|
6726
|
+
sessionId?: string;
|
|
6727
|
+
vizId?: string;
|
|
6728
|
+
};
|
|
6729
|
+
response: {
|
|
6730
|
+
tml: string;
|
|
6731
|
+
};
|
|
6732
|
+
};
|
|
6628
6733
|
};
|
|
6629
6734
|
export type UIPassthroughRequest<T extends keyof UIPassthroughContractBase> = UIPassthroughContractBase[T]["request"];
|
|
6630
6735
|
export type UIPassthroughResponse<T extends keyof UIPassthroughContractBase> = UIPassthroughContractBase[T]["response"];
|
|
@@ -6776,12 +6881,26 @@ declare class TsEmbed {
|
|
|
6776
6881
|
private formatEventData;
|
|
6777
6882
|
private subscribedListeners;
|
|
6778
6883
|
/**
|
|
6884
|
+
* Subscribe to network events (online/offline) that should
|
|
6885
|
+
* work regardless of auth status
|
|
6886
|
+
*/
|
|
6887
|
+
private subscribeToNetworkEvents;
|
|
6888
|
+
private messageEventListener;
|
|
6889
|
+
/**
|
|
6890
|
+
* Subscribe to message events that depend on successful iframe setup
|
|
6891
|
+
*/
|
|
6892
|
+
private subscribeToMessageEvents;
|
|
6893
|
+
/**
|
|
6894
|
+
* Adds event listeners for both network and message events.
|
|
6895
|
+
* This maintains backward compatibility with the existing method.
|
|
6779
6896
|
* Adds a global event listener to window for "message" events.
|
|
6780
6897
|
* ThoughtSpot detects if a particular event is targeted to this
|
|
6781
6898
|
* embed instance through an identifier contained in the payload,
|
|
6782
6899
|
* and executes the registered callbacks accordingly.
|
|
6783
6900
|
*/
|
|
6784
6901
|
private subscribeToEvents;
|
|
6902
|
+
private unsubscribeToNetworkEvents;
|
|
6903
|
+
private unsubscribeToMessageEvents;
|
|
6785
6904
|
private unsubscribeToEvents;
|
|
6786
6905
|
protected getAuthTokenForCookielessInit(): Promise<string>;
|
|
6787
6906
|
protected getDefaultAppInitData(): Promise<DefaultAppInitData>;
|
|
@@ -6853,6 +6972,7 @@ declare class TsEmbed {
|
|
|
6853
6972
|
* @param height The height in pixels
|
|
6854
6973
|
*/
|
|
6855
6974
|
protected setIFrameHeight(height: number | string): void;
|
|
6975
|
+
protected createEmbedEventResponder: (eventPort: MessagePort | void, eventType: EmbedEvent) => (payload: any) => void;
|
|
6856
6976
|
/**
|
|
6857
6977
|
* Executes all registered event handlers for a particular event type
|
|
6858
6978
|
* @param eventType The event type
|
|
@@ -1204,7 +1204,7 @@ export interface CustomisationsInterface {
|
|
|
1204
1204
|
* if a trusted authentication server is used.
|
|
1205
1205
|
* @group Authentication / Init
|
|
1206
1206
|
*/
|
|
1207
|
-
export interface EmbedConfig {
|
|
1207
|
+
export interface EmbedConfig extends InterceptV2Flags {
|
|
1208
1208
|
/**
|
|
1209
1209
|
* The ThoughtSpot cluster hostname or IP address.
|
|
1210
1210
|
*/
|
|
@@ -1577,7 +1577,7 @@ export interface FrameParams {
|
|
|
1577
1577
|
/**
|
|
1578
1578
|
* The common configuration object for an embedded view.
|
|
1579
1579
|
*/
|
|
1580
|
-
export interface BaseViewConfig {
|
|
1580
|
+
export interface BaseViewConfig extends InterceptV2Flags {
|
|
1581
1581
|
/**
|
|
1582
1582
|
* @hidden
|
|
1583
1583
|
*/
|
|
@@ -2359,6 +2359,21 @@ export interface LiveboardAppEmbedViewConfig {
|
|
|
2359
2359
|
* ```
|
|
2360
2360
|
*/
|
|
2361
2361
|
liveboardXLSXCSVDownload?: boolean;
|
|
2362
|
+
/**
|
|
2363
|
+
* This flag is used to enable or disable the link parameters in liveboard.
|
|
2364
|
+
*
|
|
2365
|
+
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
|
|
2366
|
+
* @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
|
|
2367
|
+
* @example
|
|
2368
|
+
* ```js
|
|
2369
|
+
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
|
|
2370
|
+
* const embed = new <EmbedComponent>('#tsEmbed', {
|
|
2371
|
+
* ... // other embed view config
|
|
2372
|
+
* isLinkParametersEnabled: true,
|
|
2373
|
+
* })
|
|
2374
|
+
* ```
|
|
2375
|
+
*/
|
|
2376
|
+
isLinkParametersEnabled?: boolean;
|
|
2362
2377
|
}
|
|
2363
2378
|
export interface AllEmbedViewConfig extends BaseViewConfig, SearchLiveboardCommonViewConfig, HomePageConfig, LiveboardAppEmbedViewConfig {
|
|
2364
2379
|
}
|
|
@@ -3714,7 +3729,22 @@ export declare enum EmbedEvent {
|
|
|
3714
3729
|
* ```
|
|
3715
3730
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
3716
3731
|
*/
|
|
3717
|
-
OrgSwitched = "orgSwitched"
|
|
3732
|
+
OrgSwitched = "orgSwitched",
|
|
3733
|
+
/**
|
|
3734
|
+
* Emitted when the user intercepts a URL.
|
|
3735
|
+
*
|
|
3736
|
+
* Supported on all embed types.
|
|
3737
|
+
*
|
|
3738
|
+
* @example
|
|
3739
|
+
* ```js
|
|
3740
|
+
* embed.on(EmbedEvent.ApiIntercept, (payload) => {
|
|
3741
|
+
* console.log('payload', payload);
|
|
3742
|
+
* })
|
|
3743
|
+
* ```
|
|
3744
|
+
*
|
|
3745
|
+
* @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
|
|
3746
|
+
*/
|
|
3747
|
+
ApiIntercept = "ApiIntercept"
|
|
3718
3748
|
}
|
|
3719
3749
|
/**
|
|
3720
3750
|
* Event types that can be triggered by the host application
|
|
@@ -6463,6 +6493,68 @@ export interface DefaultAppInitData {
|
|
|
6463
6493
|
hiddenListColumns: ListPageColumns[];
|
|
6464
6494
|
customActions: CustomAction[];
|
|
6465
6495
|
}
|
|
6496
|
+
declare enum InterceptedApiType {
|
|
6497
|
+
/**
|
|
6498
|
+
* The apis that are use to get the metadata for the embed
|
|
6499
|
+
*/
|
|
6500
|
+
METADATA = "METADATA",
|
|
6501
|
+
/**
|
|
6502
|
+
* The apis that are use to get the data for the embed
|
|
6503
|
+
*/
|
|
6504
|
+
ANSWER_DATA = "ANSWER_DATA",
|
|
6505
|
+
/**
|
|
6506
|
+
* This will intercept all the apis
|
|
6507
|
+
*/
|
|
6508
|
+
ALL = "ALL",
|
|
6509
|
+
/**
|
|
6510
|
+
* The apis that are use to get the data for the liveboard
|
|
6511
|
+
*/
|
|
6512
|
+
LIVEBOARD_DATA = "LIVEBOARD_DATA"
|
|
6513
|
+
}
|
|
6514
|
+
export type InterceptV2Flags = {
|
|
6515
|
+
/**
|
|
6516
|
+
* Enable intercepting the apis
|
|
6517
|
+
*
|
|
6518
|
+
* @example
|
|
6519
|
+
* ```js
|
|
6520
|
+
* const embed = new LiveboardEmbed('#embed', {
|
|
6521
|
+
* ...viewConfig,
|
|
6522
|
+
* enableApiIntercept: true,
|
|
6523
|
+
* interceptUrls: [InterceptedApiType.DATA],
|
|
6524
|
+
* })
|
|
6525
|
+
* ```
|
|
6526
|
+
*
|
|
6527
|
+
*/
|
|
6528
|
+
enableApiIntercept?: boolean;
|
|
6529
|
+
/**
|
|
6530
|
+
* The apis to intercept
|
|
6531
|
+
*
|
|
6532
|
+
* @example
|
|
6533
|
+
* ```js
|
|
6534
|
+
* const embed = new LiveboardEmbed('#embed', {
|
|
6535
|
+
* ...viewConfig,
|
|
6536
|
+
* enableApiIntercept: true,
|
|
6537
|
+
* interceptUrls: [InterceptedApiType.DATA],
|
|
6538
|
+
* })
|
|
6539
|
+
* ```
|
|
6540
|
+
*/
|
|
6541
|
+
interceptUrls?: (string | InterceptedApiType)[];
|
|
6542
|
+
/**
|
|
6543
|
+
* The timeout for the intercept, default is 30000ms
|
|
6544
|
+
* the api will error out if the timeout is reached
|
|
6545
|
+
*
|
|
6546
|
+
* @example
|
|
6547
|
+
* ```js
|
|
6548
|
+
* const embed = new LiveboardEmbed('#embed', {
|
|
6549
|
+
* ...viewConfig,
|
|
6550
|
+
* enableApiIntercept: true,
|
|
6551
|
+
* interceptUrls: [InterceptedApiType.ALL],
|
|
6552
|
+
* interceptTimeout: 1000,
|
|
6553
|
+
* })
|
|
6554
|
+
* ```
|
|
6555
|
+
*/
|
|
6556
|
+
interceptTimeout?: number;
|
|
6557
|
+
};
|
|
6466
6558
|
declare enum AuthFailureType {
|
|
6467
6559
|
SDK = "SDK",
|
|
6468
6560
|
NO_COOKIE_ACCESS = "NO_COOKIE_ACCESS",
|
|
@@ -6558,7 +6650,8 @@ declare enum UIPassthroughEvent {
|
|
|
6558
6650
|
GetDiscoverabilityStatus = "getDiscoverabilityStatus",
|
|
6559
6651
|
GetAvailableUIPassthroughs = "getAvailableUiPassthroughs",
|
|
6560
6652
|
GetAnswerConfig = "getAnswerPageConfig",
|
|
6561
|
-
GetLiveboardConfig = "getPinboardPageConfig"
|
|
6653
|
+
GetLiveboardConfig = "getPinboardPageConfig",
|
|
6654
|
+
GetUnsavedAnswerTML = "getUnsavedAnswerTML"
|
|
6562
6655
|
}
|
|
6563
6656
|
export type UIPassthroughContractBase = {
|
|
6564
6657
|
[UIPassthroughEvent.PinAnswerToLiveboard]: {
|
|
@@ -6613,6 +6706,15 @@ export type UIPassthroughContractBase = {
|
|
|
6613
6706
|
request: any;
|
|
6614
6707
|
response: any;
|
|
6615
6708
|
};
|
|
6709
|
+
[UIPassthroughEvent.GetUnsavedAnswerTML]: {
|
|
6710
|
+
request: {
|
|
6711
|
+
sessionId?: string;
|
|
6712
|
+
vizId?: string;
|
|
6713
|
+
};
|
|
6714
|
+
response: {
|
|
6715
|
+
tml: string;
|
|
6716
|
+
};
|
|
6717
|
+
};
|
|
6616
6718
|
};
|
|
6617
6719
|
export type UIPassthroughRequest<T extends keyof UIPassthroughContractBase> = UIPassthroughContractBase[T]["request"];
|
|
6618
6720
|
export type UIPassthroughResponse<T extends keyof UIPassthroughContractBase> = UIPassthroughContractBase[T]["response"];
|
|
@@ -6764,12 +6866,26 @@ declare class TsEmbed {
|
|
|
6764
6866
|
private formatEventData;
|
|
6765
6867
|
private subscribedListeners;
|
|
6766
6868
|
/**
|
|
6869
|
+
* Subscribe to network events (online/offline) that should
|
|
6870
|
+
* work regardless of auth status
|
|
6871
|
+
*/
|
|
6872
|
+
private subscribeToNetworkEvents;
|
|
6873
|
+
private messageEventListener;
|
|
6874
|
+
/**
|
|
6875
|
+
* Subscribe to message events that depend on successful iframe setup
|
|
6876
|
+
*/
|
|
6877
|
+
private subscribeToMessageEvents;
|
|
6878
|
+
/**
|
|
6879
|
+
* Adds event listeners for both network and message events.
|
|
6880
|
+
* This maintains backward compatibility with the existing method.
|
|
6767
6881
|
* Adds a global event listener to window for "message" events.
|
|
6768
6882
|
* ThoughtSpot detects if a particular event is targeted to this
|
|
6769
6883
|
* embed instance through an identifier contained in the payload,
|
|
6770
6884
|
* and executes the registered callbacks accordingly.
|
|
6771
6885
|
*/
|
|
6772
6886
|
private subscribeToEvents;
|
|
6887
|
+
private unsubscribeToNetworkEvents;
|
|
6888
|
+
private unsubscribeToMessageEvents;
|
|
6773
6889
|
private unsubscribeToEvents;
|
|
6774
6890
|
protected getAuthTokenForCookielessInit(): Promise<string>;
|
|
6775
6891
|
protected getDefaultAppInitData(): Promise<DefaultAppInitData>;
|
|
@@ -6841,6 +6957,7 @@ declare class TsEmbed {
|
|
|
6841
6957
|
* @param height The height in pixels
|
|
6842
6958
|
*/
|
|
6843
6959
|
protected setIFrameHeight(height: number | string): void;
|
|
6960
|
+
protected createEmbedEventResponder: (eventPort: MessagePort | void, eventType: EmbedEvent) => (payload: any) => void;
|
|
6844
6961
|
/**
|
|
6845
6962
|
* Executes all registered event handlers for a particular event type
|
|
6846
6963
|
* @param eventType The event type
|
|
@@ -1255,7 +1255,7 @@ export interface CustomisationsInterface {
|
|
|
1255
1255
|
* if a trusted authentication server is used.
|
|
1256
1256
|
* @group Authentication / Init
|
|
1257
1257
|
*/
|
|
1258
|
-
export interface EmbedConfig {
|
|
1258
|
+
export interface EmbedConfig extends InterceptV2Flags {
|
|
1259
1259
|
/**
|
|
1260
1260
|
* The ThoughtSpot cluster hostname or IP address.
|
|
1261
1261
|
*/
|
|
@@ -1628,7 +1628,7 @@ export interface FrameParams {
|
|
|
1628
1628
|
/**
|
|
1629
1629
|
* The common configuration object for an embedded view.
|
|
1630
1630
|
*/
|
|
1631
|
-
export interface BaseViewConfig {
|
|
1631
|
+
export interface BaseViewConfig extends InterceptV2Flags {
|
|
1632
1632
|
/**
|
|
1633
1633
|
* @hidden
|
|
1634
1634
|
*/
|
|
@@ -2410,6 +2410,21 @@ export interface LiveboardAppEmbedViewConfig {
|
|
|
2410
2410
|
* ```
|
|
2411
2411
|
*/
|
|
2412
2412
|
liveboardXLSXCSVDownload?: boolean;
|
|
2413
|
+
/**
|
|
2414
|
+
* This flag is used to enable or disable the link parameters in liveboard.
|
|
2415
|
+
*
|
|
2416
|
+
* Supported embed types: `AppEmbed`, `LiveboardEmbed`
|
|
2417
|
+
* @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
|
|
2418
|
+
* @example
|
|
2419
|
+
* ```js
|
|
2420
|
+
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed or LiveboardEmbed
|
|
2421
|
+
* const embed = new <EmbedComponent>('#tsEmbed', {
|
|
2422
|
+
* ... // other embed view config
|
|
2423
|
+
* isLinkParametersEnabled: true,
|
|
2424
|
+
* })
|
|
2425
|
+
* ```
|
|
2426
|
+
*/
|
|
2427
|
+
isLinkParametersEnabled?: boolean;
|
|
2413
2428
|
}
|
|
2414
2429
|
export interface AllEmbedViewConfig extends BaseViewConfig, SearchLiveboardCommonViewConfig, HomePageConfig, LiveboardAppEmbedViewConfig {
|
|
2415
2430
|
}
|
|
@@ -3765,7 +3780,22 @@ export declare enum EmbedEvent {
|
|
|
3765
3780
|
* ```
|
|
3766
3781
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
3767
3782
|
*/
|
|
3768
|
-
OrgSwitched = "orgSwitched"
|
|
3783
|
+
OrgSwitched = "orgSwitched",
|
|
3784
|
+
/**
|
|
3785
|
+
* Emitted when the user intercepts a URL.
|
|
3786
|
+
*
|
|
3787
|
+
* Supported on all embed types.
|
|
3788
|
+
*
|
|
3789
|
+
* @example
|
|
3790
|
+
* ```js
|
|
3791
|
+
* embed.on(EmbedEvent.ApiIntercept, (payload) => {
|
|
3792
|
+
* console.log('payload', payload);
|
|
3793
|
+
* })
|
|
3794
|
+
* ```
|
|
3795
|
+
*
|
|
3796
|
+
* @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
|
|
3797
|
+
*/
|
|
3798
|
+
ApiIntercept = "ApiIntercept"
|
|
3769
3799
|
}
|
|
3770
3800
|
/**
|
|
3771
3801
|
* Event types that can be triggered by the host application
|
|
@@ -6568,13 +6598,79 @@ export interface DefaultAppInitData {
|
|
|
6568
6598
|
hiddenListColumns: ListPageColumns[];
|
|
6569
6599
|
customActions: CustomAction[];
|
|
6570
6600
|
}
|
|
6601
|
+
/**
|
|
6602
|
+
* Enum for the type of API intercepted
|
|
6603
|
+
*/
|
|
6604
|
+
export declare enum InterceptedApiType {
|
|
6605
|
+
/**
|
|
6606
|
+
* The apis that are use to get the metadata for the embed
|
|
6607
|
+
*/
|
|
6608
|
+
METADATA = "METADATA",
|
|
6609
|
+
/**
|
|
6610
|
+
* The apis that are use to get the data for the embed
|
|
6611
|
+
*/
|
|
6612
|
+
ANSWER_DATA = "ANSWER_DATA",
|
|
6613
|
+
/**
|
|
6614
|
+
* This will intercept all the apis
|
|
6615
|
+
*/
|
|
6616
|
+
ALL = "ALL",
|
|
6617
|
+
/**
|
|
6618
|
+
* The apis that are use to get the data for the liveboard
|
|
6619
|
+
*/
|
|
6620
|
+
LIVEBOARD_DATA = "LIVEBOARD_DATA"
|
|
6621
|
+
}
|
|
6622
|
+
export type InterceptV2Flags = {
|
|
6623
|
+
/**
|
|
6624
|
+
* Enable intercepting the apis
|
|
6625
|
+
*
|
|
6626
|
+
* @example
|
|
6627
|
+
* ```js
|
|
6628
|
+
* const embed = new LiveboardEmbed('#embed', {
|
|
6629
|
+
* ...viewConfig,
|
|
6630
|
+
* enableApiIntercept: true,
|
|
6631
|
+
* interceptUrls: [InterceptedApiType.DATA],
|
|
6632
|
+
* })
|
|
6633
|
+
* ```
|
|
6634
|
+
*
|
|
6635
|
+
*/
|
|
6636
|
+
enableApiIntercept?: boolean;
|
|
6637
|
+
/**
|
|
6638
|
+
* The apis to intercept
|
|
6639
|
+
*
|
|
6640
|
+
* @example
|
|
6641
|
+
* ```js
|
|
6642
|
+
* const embed = new LiveboardEmbed('#embed', {
|
|
6643
|
+
* ...viewConfig,
|
|
6644
|
+
* enableApiIntercept: true,
|
|
6645
|
+
* interceptUrls: [InterceptedApiType.DATA],
|
|
6646
|
+
* })
|
|
6647
|
+
* ```
|
|
6648
|
+
*/
|
|
6649
|
+
interceptUrls?: (string | InterceptedApiType)[];
|
|
6650
|
+
/**
|
|
6651
|
+
* The timeout for the intercept, default is 30000ms
|
|
6652
|
+
* the api will error out if the timeout is reached
|
|
6653
|
+
*
|
|
6654
|
+
* @example
|
|
6655
|
+
* ```js
|
|
6656
|
+
* const embed = new LiveboardEmbed('#embed', {
|
|
6657
|
+
* ...viewConfig,
|
|
6658
|
+
* enableApiIntercept: true,
|
|
6659
|
+
* interceptUrls: [InterceptedApiType.ALL],
|
|
6660
|
+
* interceptTimeout: 1000,
|
|
6661
|
+
* })
|
|
6662
|
+
* ```
|
|
6663
|
+
*/
|
|
6664
|
+
interceptTimeout?: number;
|
|
6665
|
+
};
|
|
6571
6666
|
export declare enum UIPassthroughEvent {
|
|
6572
6667
|
PinAnswerToLiveboard = "addVizToPinboard",
|
|
6573
6668
|
SaveAnswer = "saveAnswer",
|
|
6574
6669
|
GetDiscoverabilityStatus = "getDiscoverabilityStatus",
|
|
6575
6670
|
GetAvailableUIPassthroughs = "getAvailableUiPassthroughs",
|
|
6576
6671
|
GetAnswerConfig = "getAnswerPageConfig",
|
|
6577
|
-
GetLiveboardConfig = "getPinboardPageConfig"
|
|
6672
|
+
GetLiveboardConfig = "getPinboardPageConfig",
|
|
6673
|
+
GetUnsavedAnswerTML = "getUnsavedAnswerTML"
|
|
6578
6674
|
}
|
|
6579
6675
|
export type UIPassthroughContractBase = {
|
|
6580
6676
|
[UIPassthroughEvent.PinAnswerToLiveboard]: {
|
|
@@ -6629,6 +6725,15 @@ export type UIPassthroughContractBase = {
|
|
|
6629
6725
|
request: any;
|
|
6630
6726
|
response: any;
|
|
6631
6727
|
};
|
|
6728
|
+
[UIPassthroughEvent.GetUnsavedAnswerTML]: {
|
|
6729
|
+
request: {
|
|
6730
|
+
sessionId?: string;
|
|
6731
|
+
vizId?: string;
|
|
6732
|
+
};
|
|
6733
|
+
response: {
|
|
6734
|
+
tml: string;
|
|
6735
|
+
};
|
|
6736
|
+
};
|
|
6632
6737
|
};
|
|
6633
6738
|
export type UIPassthroughRequest<T extends keyof UIPassthroughContractBase> = UIPassthroughContractBase[T]["request"];
|
|
6634
6739
|
export type UIPassthroughResponse<T extends keyof UIPassthroughContractBase> = UIPassthroughContractBase[T]["response"];
|
|
@@ -6780,12 +6885,26 @@ declare class TsEmbed {
|
|
|
6780
6885
|
private formatEventData;
|
|
6781
6886
|
private subscribedListeners;
|
|
6782
6887
|
/**
|
|
6888
|
+
* Subscribe to network events (online/offline) that should
|
|
6889
|
+
* work regardless of auth status
|
|
6890
|
+
*/
|
|
6891
|
+
private subscribeToNetworkEvents;
|
|
6892
|
+
private messageEventListener;
|
|
6893
|
+
/**
|
|
6894
|
+
* Subscribe to message events that depend on successful iframe setup
|
|
6895
|
+
*/
|
|
6896
|
+
private subscribeToMessageEvents;
|
|
6897
|
+
/**
|
|
6898
|
+
* Adds event listeners for both network and message events.
|
|
6899
|
+
* This maintains backward compatibility with the existing method.
|
|
6783
6900
|
* Adds a global event listener to window for "message" events.
|
|
6784
6901
|
* ThoughtSpot detects if a particular event is targeted to this
|
|
6785
6902
|
* embed instance through an identifier contained in the payload,
|
|
6786
6903
|
* and executes the registered callbacks accordingly.
|
|
6787
6904
|
*/
|
|
6788
6905
|
private subscribeToEvents;
|
|
6906
|
+
private unsubscribeToNetworkEvents;
|
|
6907
|
+
private unsubscribeToMessageEvents;
|
|
6789
6908
|
private unsubscribeToEvents;
|
|
6790
6909
|
protected getAuthTokenForCookielessInit(): Promise<string>;
|
|
6791
6910
|
protected getDefaultAppInitData(): Promise<DefaultAppInitData>;
|
|
@@ -6857,6 +6976,7 @@ declare class TsEmbed {
|
|
|
6857
6976
|
* @param height The height in pixels
|
|
6858
6977
|
*/
|
|
6859
6978
|
protected setIFrameHeight(height: number | string): void;
|
|
6979
|
+
protected createEmbedEventResponder: (eventPort: MessagePort | void, eventType: EmbedEvent) => (payload: any) => void;
|
|
6860
6980
|
/**
|
|
6861
6981
|
* Executes all registered event handlers for a particular event type
|
|
6862
6982
|
* @param eventType The event type
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thoughtspot/visual-embed-sdk",
|
|
3
|
-
"version": "1.42.
|
|
3
|
+
"version": "1.42.1-alpha.1",
|
|
4
4
|
"description": "ThoughtSpot Embed SDK",
|
|
5
5
|
"module": "lib/src/index.js",
|
|
6
6
|
"main": "dist/tsembed.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"test": "npm run test-sdk",
|
|
58
58
|
"posttest": "cat ./coverage/sdk/lcov.info | npx coveralls-next",
|
|
59
59
|
"is-publish-allowed": "node scripts/is-publish-allowed.js",
|
|
60
|
-
"prepublishOnly": "npm run
|
|
60
|
+
"prepublishOnly": "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",
|
|
61
61
|
"check-size": "npm run build && size-limit",
|
|
62
62
|
"publish-dev": "npm publish --tag dev",
|
|
63
63
|
"publish-prod": "npm publish --tag latest",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseViewConfig, EmbedConfig, InterceptV2Flags, EmbedEvent } from "./types";
|
|
2
|
+
export declare const processApiIntercept: (eventData: any) => Promise<any>;
|
|
3
|
+
export declare const getInterceptInitData: (embedConfig: EmbedConfig, viewConfig: BaseViewConfig) => InterceptV2Flags;
|
|
4
|
+
export declare const handleInterceptEvent: (params: {
|
|
5
|
+
eventData: any;
|
|
6
|
+
executeEvent: (eventType: EmbedEvent, data: any) => void;
|
|
7
|
+
embedConfig: EmbedConfig;
|
|
8
|
+
viewConfig: BaseViewConfig;
|
|
9
|
+
getUnsavedAnswerTml: (props: {
|
|
10
|
+
sessionId?: string;
|
|
11
|
+
vizId?: string;
|
|
12
|
+
}) => Promise<{
|
|
13
|
+
tml: string;
|
|
14
|
+
}>;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
export declare const processLegacyInterceptResponse: (payload: any) => {
|
|
17
|
+
data: {};
|
|
18
|
+
errors: {
|
|
19
|
+
errorObj: {
|
|
20
|
+
title: any;
|
|
21
|
+
desc: any;
|
|
22
|
+
};
|
|
23
|
+
}[];
|
|
24
|
+
}[];
|
|
25
|
+
//# sourceMappingURL=api-intercept.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-intercept.d.ts","sourceRoot":"","sources":["../../src/api-intercept.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAwBxG,eAAO,MAAM,mBAAmB,cAAqB,GAAG,iBAGvD,CAAA;AAeD,eAAO,MAAM,oBAAoB,gBAAiB,WAAW,cAAc,cAAc,KAAG,gBAwB3F,CAAA;AAoBD,eAAO,MAAM,oBAAoB;eAA+B,GAAG;8BAA4B,UAAU,QAAQ,GAAG,KAAK,IAAI;iBAAe,WAAW;gBAAc,cAAc;iCAA+B;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,QAAQ;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;mBAyBpR,CAAA;AAED,eAAO,MAAM,8BAA8B,YAAa,GAAG;;;;;;;;GAkB1D,CAAA"}
|