@thoughtspot/visual-embed-sdk 1.42.1-alpha.6 → 1.42.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 +3 -2
- package/cjs/src/css-variables.d.ts +0 -48
- package/cjs/src/css-variables.d.ts.map +1 -1
- package/cjs/src/embed/app.d.ts +20 -0
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +9 -4
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +62 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.d.ts +1 -1
- package/cjs/src/embed/conversation.d.ts +16 -0
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +5 -2
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +25 -1
- package/cjs/src/embed/conversation.spec.js.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +1 -11
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js +0 -1
- 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 +5 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +46 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +4 -4
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +1 -3
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +0 -2
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +14 -42
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/errors.js +1 -1
- 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 +1 -2
- 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/util.d.ts +1 -0
- package/cjs/src/react/util.d.ts.map +1 -1
- package/cjs/src/types.d.ts +58 -93
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +21 -46
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/custom-actions.d.ts.map +1 -1
- package/cjs/src/utils/custom-actions.js +9 -0
- package/cjs/src/utils/custom-actions.js.map +1 -1
- package/cjs/src/utils/custom-actions.spec.js +20 -0
- package/cjs/src/utils/custom-actions.spec.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/cjs/src/utils/processData.spec.js.map +1 -1
- package/dist/{index-DvNA626T.js → index-CjbriUI0.js} +1 -1
- package/dist/src/css-variables.d.ts +0 -48
- package/dist/src/css-variables.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +20 -0
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/bodyless-conversation.d.ts +1 -1
- package/dist/src/embed/conversation.d.ts +16 -0
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts +1 -11
- 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/sage.d.ts +4 -4
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +0 -2
- package/dist/src/embed/ts-embed.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/util.d.ts +1 -0
- package/dist/src/react/util.d.ts.map +1 -1
- package/dist/src/types.d.ts +58 -93
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/custom-actions.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 +84 -219
- package/dist/tsembed-react.js +228 -439
- package/dist/tsembed.es.js +85 -220
- package/dist/tsembed.js +228 -439
- package/dist/visual-embed-sdk-react-full.d.ts +104 -160
- package/dist/visual-embed-sdk-react.d.ts +95 -155
- package/dist/visual-embed-sdk.d.ts +95 -158
- package/lib/package.json +3 -2
- package/lib/src/css-variables.d.ts +0 -48
- package/lib/src/css-variables.d.ts.map +1 -1
- package/lib/src/embed/app.d.ts +20 -0
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +9 -4
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +62 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.d.ts +1 -1
- package/lib/src/embed/conversation.d.ts +16 -0
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +5 -2
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +25 -1
- package/lib/src/embed/conversation.spec.js.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +1 -11
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js +0 -1
- 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 +5 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +47 -1
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/sage.d.ts +4 -4
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +1 -3
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +0 -2
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +14 -42
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.js +1 -1
- 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/util.d.ts +1 -0
- package/lib/src/react/util.d.ts.map +1 -1
- package/lib/src/types.d.ts +58 -93
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +20 -45
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/custom-actions.d.ts.map +1 -1
- package/lib/src/utils/custom-actions.js +9 -0
- package/lib/src/utils/custom-actions.js.map +1 -1
- package/lib/src/utils/custom-actions.spec.js +20 -0
- package/lib/src/utils/custom-actions.spec.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/lib/src/utils/processData.spec.js.map +1 -1
- package/package.json +3 -2
- package/src/css-variables.ts +0 -58
- package/src/embed/app.spec.ts +87 -0
- package/src/embed/app.ts +35 -4
- package/src/embed/bodyless-conversation.ts +1 -1
- package/src/embed/conversation.spec.ts +35 -1
- package/src/embed/conversation.ts +22 -0
- package/src/embed/hostEventClient/contracts.ts +0 -10
- package/src/embed/liveboard.spec.ts +60 -0
- package/src/embed/liveboard.ts +9 -0
- package/src/embed/sage.ts +4 -4
- package/src/embed/search.ts +1 -3
- package/src/embed/ts-embed.spec.ts +7 -7
- package/src/embed/ts-embed.ts +31 -67
- package/src/errors.ts +1 -1
- package/src/index.ts +0 -2
- package/src/react/all-types-export.ts +2 -1
- package/src/types.ts +56 -94
- package/src/utils/custom-actions.spec.ts +22 -0
- package/src/utils/custom-actions.ts +11 -0
- package/src/utils/processData.spec.ts +1 -0
- package/src/utils/processData.ts +11 -11
- package/cjs/src/api-intercept.d.ts +0 -31
- package/cjs/src/api-intercept.d.ts.map +0 -1
- package/cjs/src/api-intercept.js +0 -117
- package/cjs/src/api-intercept.js.map +0 -1
- package/cjs/src/api-intercept.spec.d.ts +0 -2
- package/cjs/src/api-intercept.spec.d.ts.map +0 -1
- package/cjs/src/api-intercept.spec.js +0 -122
- package/cjs/src/api-intercept.spec.js.map +0 -1
- package/dist/index-BCC3Z072.js +0 -7371
- package/dist/index-BEzW4MDA.js +0 -7371
- package/dist/index-BaESA9rq.js +0 -7371
- package/dist/index-CFNZIcKr.js +0 -7447
- package/dist/index-DFnPKcjZ.js +0 -7447
- package/dist/index-DhFH7b7U.js +0 -7447
- package/dist/src/api-intercept.d.ts +0 -31
- package/dist/src/api-intercept.d.ts.map +0 -1
- package/dist/src/api-intercept.spec.d.ts +0 -2
- package/dist/src/api-intercept.spec.d.ts.map +0 -1
- package/lib/src/api-intercept.d.ts +0 -31
- package/lib/src/api-intercept.d.ts.map +0 -1
- package/lib/src/api-intercept.js +0 -110
- package/lib/src/api-intercept.js.map +0 -1
- package/lib/src/api-intercept.spec.d.ts +0 -2
- package/lib/src/api-intercept.spec.d.ts.map +0 -1
- package/lib/src/api-intercept.spec.js +0 -119
- package/lib/src/api-intercept.spec.js.map +0 -1
- package/src/api-intercept.ts +0 -136
|
@@ -164,6 +164,22 @@ export interface SpotterEmbedViewConfig extends Omit<BaseViewConfig, 'primaryAct
|
|
|
164
164
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.13.0.cl
|
|
165
165
|
*/
|
|
166
166
|
excludeRuntimeParametersfromURL?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* enablePastConversationsSidebar : Controls the visibility of the past conversations
|
|
169
|
+
* sidebar.
|
|
170
|
+
*
|
|
171
|
+
* Supported embed types: `SpotterEmbed`
|
|
172
|
+
* @default false
|
|
173
|
+
* @example
|
|
174
|
+
* ```js
|
|
175
|
+
* const embed = new SpotterEmbed('#tsEmbed', {
|
|
176
|
+
* ... //other embed view config
|
|
177
|
+
* enablePastConversationsSidebar : true,
|
|
178
|
+
* })
|
|
179
|
+
* ```
|
|
180
|
+
* @version SDK: 1.43.0 | ThoughtSpot: 10.14.0.cl
|
|
181
|
+
*/
|
|
182
|
+
enablePastConversationsSidebar?: boolean;
|
|
167
183
|
}
|
|
168
184
|
|
|
169
185
|
/**
|
|
@@ -205,6 +221,7 @@ export class SpotterEmbed extends TsEmbed {
|
|
|
205
221
|
dataPanelV2,
|
|
206
222
|
showSpotterLimitations,
|
|
207
223
|
hideSampleQuestions,
|
|
224
|
+
enablePastConversationsSidebar,
|
|
208
225
|
runtimeFilters,
|
|
209
226
|
excludeRuntimeFiltersfromURL,
|
|
210
227
|
runtimeParameters,
|
|
@@ -246,10 +263,15 @@ export class SpotterEmbed extends TsEmbed {
|
|
|
246
263
|
excludeRuntimeFiltersfromURL,
|
|
247
264
|
runtimeParameters,
|
|
248
265
|
excludeRuntimeParametersfromURL,
|
|
266
|
+
enablePastConversationsSidebar
|
|
249
267
|
} = this.viewConfig;
|
|
250
268
|
const path = 'insights/conv-assist';
|
|
251
269
|
const queryParams = this.getEmbedParamsObject();
|
|
252
270
|
|
|
271
|
+
if (!isUndefined(enablePastConversationsSidebar)) {
|
|
272
|
+
queryParams[Param.EnablePastConversationsSidebar] = !!enablePastConversationsSidebar;
|
|
273
|
+
}
|
|
274
|
+
|
|
253
275
|
let query = '';
|
|
254
276
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
255
277
|
if (queryParamsString) {
|
|
@@ -7,7 +7,6 @@ export enum UIPassthroughEvent {
|
|
|
7
7
|
GetAvailableUIPassthroughs = 'getAvailableUiPassthroughs',
|
|
8
8
|
GetAnswerConfig = 'getAnswerPageConfig',
|
|
9
9
|
GetLiveboardConfig = 'getPinboardPageConfig',
|
|
10
|
-
GetUnsavedAnswerTML = 'getUnsavedAnswerTML',
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
// UI Passthrough Contract
|
|
@@ -64,15 +63,6 @@ export type UIPassthroughContractBase = {
|
|
|
64
63
|
request: any;
|
|
65
64
|
response: any;
|
|
66
65
|
};
|
|
67
|
-
[UIPassthroughEvent.GetUnsavedAnswerTML]: {
|
|
68
|
-
request: {
|
|
69
|
-
sessionId?: string;
|
|
70
|
-
vizId?: string;
|
|
71
|
-
};
|
|
72
|
-
response: {
|
|
73
|
-
tml: string;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
66
|
};
|
|
77
67
|
|
|
78
68
|
// UI Passthrough Request and Response
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
defaultParams,
|
|
17
17
|
defaultParamsWithoutHiddenActions,
|
|
18
18
|
expectUrlMatchesWithParams,
|
|
19
|
+
expectUrlToHaveParamsWithValues,
|
|
19
20
|
postMessageToParent,
|
|
20
21
|
getIFrameEl,
|
|
21
22
|
mockMessageChannel,
|
|
@@ -138,6 +139,20 @@ describe('Liveboard/viz embed tests', () => {
|
|
|
138
139
|
});
|
|
139
140
|
});
|
|
140
141
|
|
|
142
|
+
test('should set LiveboardStylePanel in visible actions', async () => {
|
|
143
|
+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
144
|
+
visibleActions: [Action.LiveboardStylePanel],
|
|
145
|
+
...defaultViewConfig,
|
|
146
|
+
liveboardId,
|
|
147
|
+
} as LiveboardViewConfig);
|
|
148
|
+
liveboardEmbed.render();
|
|
149
|
+
await executeAfterWait(() => {
|
|
150
|
+
expectUrlToHaveParamsWithValues(getIFrameSrc(), {
|
|
151
|
+
visibleAction: JSON.stringify([Action.LiveboardStylePanel]),
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
|
|
141
156
|
test('should set enable2ColumnLayout to true in url', async () => {
|
|
142
157
|
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
143
158
|
enable2ColumnLayout: true,
|
|
@@ -168,6 +183,21 @@ describe('Liveboard/viz embed tests', () => {
|
|
|
168
183
|
});
|
|
169
184
|
});
|
|
170
185
|
|
|
186
|
+
test('should set isLiveboardPermissionV2Enabled to true in url', async () => {
|
|
187
|
+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
188
|
+
isEnhancedFilterInteractivityEnabled: true,
|
|
189
|
+
...defaultViewConfig,
|
|
190
|
+
liveboardId,
|
|
191
|
+
} as LiveboardViewConfig);
|
|
192
|
+
liveboardEmbed.render();
|
|
193
|
+
await executeAfterWait(() => {
|
|
194
|
+
expectUrlMatchesWithParams(
|
|
195
|
+
getIFrameSrc(),
|
|
196
|
+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isLiveboardPermissionV2Enabled=true${prefixParams}#/embed/viz/${liveboardId}`,
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
171
201
|
test('should set isPNGInScheduledEmailsEnabled to true in url', async () => {
|
|
172
202
|
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
173
203
|
isPNGInScheduledEmailsEnabled: true,
|
|
@@ -453,6 +483,36 @@ describe('Liveboard/viz embed tests', () => {
|
|
|
453
483
|
});
|
|
454
484
|
});
|
|
455
485
|
|
|
486
|
+
test('should add isCentralizedLiveboardFilterUXEnabled flag and set value to true to the iframe src', async () => {
|
|
487
|
+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
488
|
+
...defaultViewConfig,
|
|
489
|
+
liveboardId,
|
|
490
|
+
isCentralizedLiveboardFilterUXEnabled: true,
|
|
491
|
+
} as LiveboardViewConfig);
|
|
492
|
+
liveboardEmbed.render();
|
|
493
|
+
await executeAfterWait(() => {
|
|
494
|
+
expectUrlMatchesWithParams(
|
|
495
|
+
getIFrameSrc(),
|
|
496
|
+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isCentralizedLiveboardFilterUXEnabled=true${prefixParams}#/embed/viz/${liveboardId}`,
|
|
497
|
+
);
|
|
498
|
+
});
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
test('should add isCentralizedLiveboardFilterUXEnabled flag and set value to false to the iframe src', async () => {
|
|
502
|
+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
503
|
+
...defaultViewConfig,
|
|
504
|
+
liveboardId,
|
|
505
|
+
isCentralizedLiveboardFilterUXEnabled: false,
|
|
506
|
+
} as LiveboardViewConfig);
|
|
507
|
+
liveboardEmbed.render();
|
|
508
|
+
await executeAfterWait(() => {
|
|
509
|
+
expectUrlMatchesWithParams(
|
|
510
|
+
getIFrameSrc(),
|
|
511
|
+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}&isCentralizedLiveboardFilterUXEnabled=false${prefixParams}#/embed/viz/${liveboardId}`,
|
|
512
|
+
);
|
|
513
|
+
});
|
|
514
|
+
});
|
|
515
|
+
|
|
456
516
|
test('should not append runtime filters in URL if excludeRuntimeFiltersfromURL is true', async () => {
|
|
457
517
|
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
458
518
|
...defaultViewConfig,
|
package/src/embed/liveboard.ts
CHANGED
|
@@ -465,6 +465,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
465
465
|
showLiveboardVerifiedBadge = true,
|
|
466
466
|
showLiveboardReverifyBanner = true,
|
|
467
467
|
hideIrrelevantChipsInLiveboardTabs = false,
|
|
468
|
+
isEnhancedFilterInteractivityEnabled = false,
|
|
468
469
|
enableAskSage,
|
|
469
470
|
enable2ColumnLayout,
|
|
470
471
|
dataPanelV2 = true,
|
|
@@ -477,6 +478,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
477
478
|
isLiveboardStylingAndGroupingEnabled,
|
|
478
479
|
isPNGInScheduledEmailsEnabled = false,
|
|
479
480
|
showSpotterLimitations,
|
|
481
|
+
isCentralizedLiveboardFilterUXEnabled = false,
|
|
480
482
|
isLinkParametersEnabled,
|
|
481
483
|
} = this.viewConfig;
|
|
482
484
|
|
|
@@ -557,11 +559,18 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
557
559
|
params[Param.isLinkParametersEnabled] = isLinkParametersEnabled;
|
|
558
560
|
}
|
|
559
561
|
|
|
562
|
+
if (isCentralizedLiveboardFilterUXEnabled !== undefined) {
|
|
563
|
+
params[
|
|
564
|
+
Param.isCentralizedLiveboardFilterUXEnabled
|
|
565
|
+
] = isCentralizedLiveboardFilterUXEnabled;
|
|
566
|
+
}
|
|
567
|
+
|
|
560
568
|
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
|
|
561
569
|
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
|
|
562
570
|
params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
|
|
563
571
|
params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
|
|
564
572
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
573
|
+
params[Param.IsEnhancedFilterInteractivityEnabled] = isEnhancedFilterInteractivityEnabled;
|
|
565
574
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
566
575
|
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
567
576
|
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
package/src/embed/sage.ts
CHANGED
|
@@ -69,12 +69,12 @@ export interface SageViewConfig
|
|
|
69
69
|
*/
|
|
70
70
|
hideSageAnswerHeader?: boolean;
|
|
71
71
|
/**
|
|
72
|
-
* Disable the
|
|
72
|
+
* Disable the data source selection option.
|
|
73
73
|
* @version SDK: 1.26.0 | ThoughtSpot: 9.8.0.cl, 9.8.0.sw
|
|
74
74
|
*/
|
|
75
75
|
disableWorksheetChange?: boolean;
|
|
76
76
|
/**
|
|
77
|
-
* Hide the
|
|
77
|
+
* Hide the data source selection panel.
|
|
78
78
|
* @version SDK: 1.26.0 | ThoughtSpot: 9.8.0.cl, 9.8.0.sw
|
|
79
79
|
*/
|
|
80
80
|
hideWorksheetSelector?: boolean;
|
|
@@ -92,7 +92,7 @@ export interface SageViewConfig
|
|
|
92
92
|
showObjectSuggestions?: boolean;
|
|
93
93
|
/**
|
|
94
94
|
* Show or hide sample questions.
|
|
95
|
-
* The sample questions are autogenerated based on the
|
|
95
|
+
* The sample questions are autogenerated based on the data Model.
|
|
96
96
|
* selected for the search operation.
|
|
97
97
|
*
|
|
98
98
|
* Supported embed types: `SageEmbed`
|
|
@@ -107,7 +107,7 @@ export interface SageViewConfig
|
|
|
107
107
|
*/
|
|
108
108
|
hideSampleQuestions?: boolean;
|
|
109
109
|
/**
|
|
110
|
-
* The data source GUID (
|
|
110
|
+
* The data source GUID (Model GUID) to set on load.
|
|
111
111
|
*/
|
|
112
112
|
dataSource?: string;
|
|
113
113
|
/**
|
package/src/embed/search.ts
CHANGED
|
@@ -26,7 +26,6 @@ import { ERROR_MESSAGE } from '../errors';
|
|
|
26
26
|
import { getAuthPromise } from './base';
|
|
27
27
|
import { getReleaseVersion } from '../auth';
|
|
28
28
|
import { getEmbedConfig } from './embedConfig';
|
|
29
|
-
import { getInterceptInitData } from '../api-intercept';
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
31
|
* Configuration for search options.
|
|
@@ -443,8 +442,7 @@ export class SearchEmbed extends TsEmbed {
|
|
|
443
442
|
queryParams[Param.HideSearchBar] = true;
|
|
444
443
|
}
|
|
445
444
|
|
|
446
|
-
|
|
447
|
-
if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
|
|
445
|
+
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
448
446
|
|
|
449
447
|
queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
450
448
|
}
|
|
@@ -1045,7 +1045,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1045
1045
|
type: EmbedEvent.APP_INIT,
|
|
1046
1046
|
data: {},
|
|
1047
1047
|
};
|
|
1048
|
-
|
|
1048
|
+
|
|
1049
1049
|
// Create a SearchEmbed with valid custom actions to test
|
|
1050
1050
|
// CustomActionsValidationResult
|
|
1051
1051
|
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
@@ -1067,7 +1067,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1067
1067
|
}
|
|
1068
1068
|
]
|
|
1069
1069
|
});
|
|
1070
|
-
|
|
1070
|
+
|
|
1071
1071
|
searchEmbed.render();
|
|
1072
1072
|
const mockPort: any = {
|
|
1073
1073
|
postMessage: jest.fn(),
|
|
@@ -1116,7 +1116,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1116
1116
|
customVariablesForThirdPartyTools: {},
|
|
1117
1117
|
},
|
|
1118
1118
|
});
|
|
1119
|
-
|
|
1119
|
+
|
|
1120
1120
|
// Verify that CustomActionsValidationResult structure is
|
|
1121
1121
|
// correct
|
|
1122
1122
|
const appInitData = mockPort.postMessage.mock.calls[0][0].data;
|
|
@@ -1137,7 +1137,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1137
1137
|
})
|
|
1138
1138
|
])
|
|
1139
1139
|
);
|
|
1140
|
-
|
|
1140
|
+
|
|
1141
1141
|
// Verify actions are sorted by name (alphabetically)
|
|
1142
1142
|
expect(appInitData.customActions[0].name).toBe('Another Valid Action');
|
|
1143
1143
|
expect(appInitData.customActions[1].name).toBe('Valid Action');
|
|
@@ -2488,7 +2488,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
2488
2488
|
});
|
|
2489
2489
|
|
|
2490
2490
|
afterAll((): void => {
|
|
2491
|
-
|
|
2491
|
+
window.location = location as any;
|
|
2492
2492
|
});
|
|
2493
2493
|
|
|
2494
2494
|
it('get url params for TS', () => {
|
|
@@ -3406,7 +3406,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
3406
3406
|
new Error('Auth failed'),
|
|
3407
3407
|
);
|
|
3408
3408
|
const searchEmbed = new SearchEmbed(getRootEl(), defaultViewConfig);
|
|
3409
|
-
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {
|
|
3409
|
+
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
3410
3410
|
await searchEmbed.render();
|
|
3411
3411
|
await executeAfterWait(() => {
|
|
3412
3412
|
expect(getRootEl().innerHTML).toContain('Not logged in');
|
|
@@ -3415,7 +3415,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
3415
3415
|
window.dispatchEvent(onlineEvent);
|
|
3416
3416
|
}).not.toThrow();
|
|
3417
3417
|
});
|
|
3418
|
-
|
|
3418
|
+
|
|
3419
3419
|
errorSpy.mockReset();
|
|
3420
3420
|
});
|
|
3421
3421
|
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -71,7 +71,6 @@ import { getEmbedConfig } from './embedConfig';
|
|
|
71
71
|
import { ERROR_MESSAGE } from '../errors';
|
|
72
72
|
import { getPreauthInfo } from '../utils/sessionInfoService';
|
|
73
73
|
import { HostEventClient } from './hostEventClient/host-event-client';
|
|
74
|
-
import { getInterceptInitData, handleInterceptEvent, processLegacyInterceptResponse } from '../api-intercept';
|
|
75
74
|
|
|
76
75
|
const { version } = pkgInfo;
|
|
77
76
|
|
|
@@ -202,7 +201,7 @@ export class TsEmbed {
|
|
|
202
201
|
});
|
|
203
202
|
const embedConfig = getEmbedConfig();
|
|
204
203
|
this.embedConfig = embedConfig;
|
|
205
|
-
|
|
204
|
+
|
|
206
205
|
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
207
206
|
this.isReadyForRenderPromise = getInitPromise().then(async () => {
|
|
208
207
|
if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
|
|
@@ -337,50 +336,33 @@ export class TsEmbed {
|
|
|
337
336
|
this.subscribedListeners.offline = offlineEventListener;
|
|
338
337
|
}
|
|
339
338
|
|
|
340
|
-
private messageEventListener = async (event: MessageEvent<any>) => {
|
|
341
|
-
const eventType = this.getEventType(event);
|
|
342
|
-
const eventPort = this.getEventPort(event);
|
|
343
|
-
const eventData = this.formatEventData(event, eventType);
|
|
344
|
-
if (event.source === this.iFrame.contentWindow) {
|
|
345
|
-
const processedEventData = await processEventData(
|
|
346
|
-
eventType,
|
|
347
|
-
eventData,
|
|
348
|
-
this.thoughtSpotHost,
|
|
349
|
-
this.isPreRendered ? this.preRenderWrapper : this.el,
|
|
350
|
-
);
|
|
351
|
-
|
|
352
|
-
const executeEvent = (_eventType: EmbedEvent, data: any) => {
|
|
353
|
-
this.executeCallbacks(_eventType, data, eventPort);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
if (eventType === EmbedEvent.ApiIntercept && this.viewConfig.enableApiIntercept) {
|
|
357
|
-
const getUnsavedAnswerTml = async (props: { sessionId?: string, vizId?: string }) => {
|
|
358
|
-
const response = await this.triggerUIPassThrough(UIPassthroughEvent.GetUnsavedAnswerTML, props);
|
|
359
|
-
return response[0]?.value;
|
|
360
|
-
}
|
|
361
|
-
handleInterceptEvent({ eventData: processedEventData, executeEvent, embedConfig: this.embedConfig, viewConfig: this.viewConfig, getUnsavedAnswerTml });
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
this.executeCallbacks(
|
|
366
|
-
eventType,
|
|
367
|
-
processedEventData,
|
|
368
|
-
eventPort,
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
};
|
|
372
339
|
/**
|
|
373
340
|
* Subscribe to message events that depend on successful iframe setup
|
|
374
341
|
*/
|
|
375
342
|
private subscribeToMessageEvents() {
|
|
376
343
|
this.unsubscribeToMessageEvents();
|
|
377
344
|
|
|
378
|
-
|
|
345
|
+
const messageEventListener = (event: MessageEvent<any>) => {
|
|
346
|
+
const eventType = this.getEventType(event);
|
|
347
|
+
const eventPort = this.getEventPort(event);
|
|
348
|
+
const eventData = this.formatEventData(event, eventType);
|
|
349
|
+
if (event.source === this.iFrame.contentWindow) {
|
|
350
|
+
this.executeCallbacks(
|
|
351
|
+
eventType,
|
|
352
|
+
processEventData(
|
|
353
|
+
eventType,
|
|
354
|
+
eventData,
|
|
355
|
+
this.thoughtSpotHost,
|
|
356
|
+
this.isPreRendered ? this.preRenderWrapper : this.el,
|
|
357
|
+
),
|
|
358
|
+
eventPort,
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
window.addEventListener('message', messageEventListener);
|
|
379
363
|
|
|
380
|
-
this.subscribedListeners.message =
|
|
364
|
+
this.subscribedListeners.message = messageEventListener;
|
|
381
365
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
366
|
/**
|
|
385
367
|
* Adds event listeners for both network and message events.
|
|
386
368
|
* This maintains backward compatibility with the existing method.
|
|
@@ -394,7 +376,6 @@ export class TsEmbed {
|
|
|
394
376
|
this.subscribeToMessageEvents();
|
|
395
377
|
}
|
|
396
378
|
|
|
397
|
-
|
|
398
379
|
private unsubscribeToNetworkEvents() {
|
|
399
380
|
if (this.subscribedListeners.online) {
|
|
400
381
|
window.removeEventListener('online', this.subscribedListeners.online);
|
|
@@ -445,7 +426,7 @@ export class TsEmbed {
|
|
|
445
426
|
message: customActionsResult.errors,
|
|
446
427
|
});
|
|
447
428
|
}
|
|
448
|
-
|
|
429
|
+
return {
|
|
449
430
|
customisations: getCustomisations(this.embedConfig, this.viewConfig),
|
|
450
431
|
authToken,
|
|
451
432
|
runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
|
|
@@ -464,10 +445,7 @@ export class TsEmbed {
|
|
|
464
445
|
this.embedConfig.customVariablesForThirdPartyTools || {},
|
|
465
446
|
hiddenListColumns: this.viewConfig.hiddenListColumns || [],
|
|
466
447
|
customActions: customActionsResult.actions,
|
|
467
|
-
...getInterceptInitData(this.embedConfig, this.viewConfig),
|
|
468
448
|
};
|
|
469
|
-
|
|
470
|
-
return baseInitData;
|
|
471
449
|
}
|
|
472
450
|
|
|
473
451
|
protected async getAppInitData() {
|
|
@@ -1045,21 +1023,6 @@ export class TsEmbed {
|
|
|
1045
1023
|
this.iFrame.style.height = getCssDimension(height);
|
|
1046
1024
|
}
|
|
1047
1025
|
|
|
1048
|
-
protected createEmbedEventResponder = (eventPort: MessagePort | void, eventType: EmbedEvent) => {
|
|
1049
|
-
|
|
1050
|
-
const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
|
|
1051
|
-
if (eventType === EmbedEvent.OnBeforeGetVizDataIntercept && enableApiIntercept) {
|
|
1052
|
-
return (payload: any) => {
|
|
1053
|
-
const payloadToSend = processLegacyInterceptResponse(payload);
|
|
1054
|
-
this.triggerEventOnPort(eventPort, payloadToSend);
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
return (payload: any) => {
|
|
1059
|
-
this.triggerEventOnPort(eventPort, payload);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
1026
|
/**
|
|
1064
1027
|
* Executes all registered event handlers for a particular event type
|
|
1065
1028
|
* @param eventType The event type
|
|
@@ -1084,8 +1047,9 @@ export class TsEmbed {
|
|
|
1084
1047
|
// payload
|
|
1085
1048
|
|| (!callbackObj.options.start && dataStatus === embedEventStatus.END)
|
|
1086
1049
|
) {
|
|
1087
|
-
|
|
1088
|
-
|
|
1050
|
+
callbackObj.callback(data, (payload) => {
|
|
1051
|
+
this.triggerEventOnPort(eventPort, payload);
|
|
1052
|
+
});
|
|
1089
1053
|
}
|
|
1090
1054
|
});
|
|
1091
1055
|
}
|
|
@@ -1227,12 +1191,12 @@ export class TsEmbed {
|
|
|
1227
1191
|
}
|
|
1228
1192
|
}
|
|
1229
1193
|
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1194
|
+
/**
|
|
1195
|
+
* @hidden
|
|
1196
|
+
* Internal state to track if the embed container is loaded.
|
|
1197
|
+
* This is used to trigger events after the embed container is loaded.
|
|
1198
|
+
*/
|
|
1199
|
+
public isEmbedContainerLoaded = false;
|
|
1236
1200
|
|
|
1237
1201
|
/**
|
|
1238
1202
|
* @hidden
|
|
@@ -1384,7 +1348,7 @@ export class TsEmbed {
|
|
|
1384
1348
|
}
|
|
1385
1349
|
this.isPreRendered = true;
|
|
1386
1350
|
this.showPreRenderByDefault = showPreRenderByDefault;
|
|
1387
|
-
|
|
1351
|
+
|
|
1388
1352
|
const isAlreadyRendered = this.connectPreRendered();
|
|
1389
1353
|
if (isAlreadyRendered && !replaceExistingPreRender) {
|
|
1390
1354
|
return this;
|
package/src/errors.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const ERROR_MESSAGE = {
|
|
2
2
|
INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
|
|
3
|
-
SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a
|
|
3
|
+
SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a Model to get started',
|
|
4
4
|
LIVEBOARD_VIZ_ID_VALIDATION: 'Please select a Liveboard to embed.',
|
|
5
5
|
TRIGGER_TIMED_OUT: 'Trigger timed-out in getting a response',
|
|
6
6
|
SEARCHEMBED_BETA_WRANING_MESSAGE: 'SearchEmbed is in Beta in this release.',
|
package/src/index.ts
CHANGED
|
@@ -64,7 +64,6 @@ import {
|
|
|
64
64
|
ListPageColumns,
|
|
65
65
|
CustomActionsPosition,
|
|
66
66
|
CustomActionTarget,
|
|
67
|
-
InterceptedApiType,
|
|
68
67
|
} from './types';
|
|
69
68
|
import { CustomCssVariables } from './css-variables';
|
|
70
69
|
import { SageEmbed, SageViewConfig } from './embed/sage';
|
|
@@ -153,7 +152,6 @@ export {
|
|
|
153
152
|
DataPanelCustomColumnGroupsAccordionState,
|
|
154
153
|
CustomActionsPosition,
|
|
155
154
|
CustomActionTarget,
|
|
156
|
-
InterceptedApiType,
|
|
157
155
|
};
|
|
158
156
|
|
|
159
157
|
export { resetCachedAuthToken } from './authToken';
|