@thoughtspot/visual-embed-sdk 1.50.0 → 1.50.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/css-variables.d.ts +59 -0
- package/cjs/src/css-variables.d.ts.map +1 -1
- package/cjs/src/embed/app.d.ts +31 -2
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +13 -2
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +101 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +26 -0
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +12 -2
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +23 -0
- package/cjs/src/embed/conversation.spec.js.map +1 -1
- package/cjs/src/embed/events.spec.js +593 -0
- package/cjs/src/embed/events.spec.js.map +1 -1
- package/cjs/src/embed/host-events.spec.js +106 -0
- package/cjs/src/embed/host-events.spec.js.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +36 -14
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js +10 -1
- package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts +1 -0
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.js +8 -0
- package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js +209 -0
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/cjs/src/embed/hostEventClient/utils.d.ts +2 -0
- package/cjs/src/embed/hostEventClient/utils.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/utils.js +32 -2
- package/cjs/src/embed/hostEventClient/utils.js.map +1 -1
- package/cjs/src/embed/hostEventClient/utils.spec.js +178 -0
- package/cjs/src/embed/hostEventClient/utils.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +6 -0
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/spotter-viz-utils.d.ts +34 -0
- package/cjs/src/embed/spotter-viz-utils.d.ts.map +1 -1
- package/cjs/src/embed/spotter-viz-utils.js.map +1 -1
- package/cjs/src/embed/spotter-viz-utils.spec.js +17 -0
- package/cjs/src/embed/spotter-viz-utils.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +14 -7
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +146 -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 +3 -2
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/react/util.spec.js +251 -0
- package/cjs/src/react/util.spec.js.map +1 -1
- package/cjs/src/types.d.ts +119 -2
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +97 -0
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +93 -0
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils/processTrigger.spec.js +61 -0
- package/cjs/src/utils/processTrigger.spec.js.map +1 -1
- package/dist/{index-B5xoN6Cp.js → index-fCne7kmU.js} +1 -1
- package/dist/src/css-variables.d.ts +59 -0
- package/dist/src/css-variables.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +31 -2
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +26 -0
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts +36 -14
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/host-event-client.d.ts +1 -0
- package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/utils.d.ts +2 -0
- package/dist/src/embed/hostEventClient/utils.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +6 -0
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/spotter-viz-utils.d.ts +34 -0
- package/dist/src/embed/spotter-viz-utils.d.ts.map +1 -1
- 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/types.d.ts +119 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +389 -84
- package/dist/tsembed-react.js +388 -83
- package/dist/tsembed.es.js +390 -85
- package/dist/tsembed.js +388 -83
- package/dist/visual-embed-sdk-react-full.d.ts +302 -17
- package/dist/visual-embed-sdk-react.d.ts +302 -17
- package/dist/visual-embed-sdk.d.ts +306 -17
- package/lib/package.json +1 -1
- package/lib/src/css-variables.d.ts +59 -0
- package/lib/src/css-variables.d.ts.map +1 -1
- package/lib/src/embed/app.d.ts +31 -2
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +13 -2
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +101 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +26 -0
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +11 -1
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +24 -1
- package/lib/src/embed/conversation.spec.js.map +1 -1
- package/lib/src/embed/events.spec.js +593 -0
- package/lib/src/embed/events.spec.js.map +1 -1
- package/lib/src/embed/host-events.spec.js +107 -1
- package/lib/src/embed/host-events.spec.js.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +36 -14
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js +9 -0
- package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.d.ts +1 -0
- package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.js +9 -1
- package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.spec.js +209 -0
- package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/lib/src/embed/hostEventClient/utils.d.ts +2 -0
- package/lib/src/embed/hostEventClient/utils.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/utils.js +28 -1
- package/lib/src/embed/hostEventClient/utils.js.map +1 -1
- package/lib/src/embed/hostEventClient/utils.spec.js +179 -1
- package/lib/src/embed/hostEventClient/utils.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +6 -0
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/spotter-viz-utils.d.ts +34 -0
- package/lib/src/embed/spotter-viz-utils.d.ts.map +1 -1
- package/lib/src/embed/spotter-viz-utils.js.map +1 -1
- package/lib/src/embed/spotter-viz-utils.spec.js +17 -0
- package/lib/src/embed/spotter-viz-utils.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +14 -7
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +146 -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/util.spec.js +251 -0
- package/lib/src/react/util.spec.js.map +1 -1
- package/lib/src/types.d.ts +119 -2
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +97 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/processData.spec.js +93 -0
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils/processTrigger.spec.js +61 -0
- package/lib/src/utils/processTrigger.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +306 -17
- package/package.json +1 -1
- package/src/css-variables.ts +73 -0
- package/src/embed/app.spec.ts +140 -0
- package/src/embed/app.ts +38 -2
- package/src/embed/conversation.spec.ts +32 -1
- package/src/embed/conversation.ts +29 -0
- package/src/embed/events.spec.ts +705 -1
- package/src/embed/host-events.spec.ts +124 -0
- package/src/embed/hostEventClient/contracts.ts +41 -14
- package/src/embed/hostEventClient/host-event-client.spec.ts +326 -0
- package/src/embed/hostEventClient/host-event-client.ts +15 -0
- package/src/embed/hostEventClient/utils.spec.ts +204 -0
- package/src/embed/hostEventClient/utils.ts +37 -10
- package/src/embed/liveboard.ts +6 -0
- package/src/embed/spotter-viz-utils.spec.ts +17 -0
- package/src/embed/spotter-viz-utils.ts +34 -0
- package/src/embed/ts-embed.spec.ts +186 -0
- package/src/embed/ts-embed.ts +12 -4
- package/src/errors.ts +1 -0
- package/src/index.ts +2 -1
- package/src/react/util.spec.tsx +255 -0
- package/src/types.ts +119 -0
- package/src/utils/processData.spec.ts +97 -0
- package/src/utils/processTrigger.spec.ts +91 -0
package/src/react/util.spec.tsx
CHANGED
|
@@ -84,5 +84,260 @@ describe('React util functions', () => {
|
|
|
84
84
|
[EmbedEvent.QueryChanged]: onQueryChanged,
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
|
+
|
|
88
|
+
test('all onX props map to their correct EmbedEvent listener keys', () => {
|
|
89
|
+
const onDrilldown: MessageCallback = jest.fn();
|
|
90
|
+
const onDataSourceSelected: MessageCallback = jest.fn();
|
|
91
|
+
const onAddRemoveColumns: MessageCallback = jest.fn();
|
|
92
|
+
const onVizPointDoubleClick: MessageCallback = jest.fn();
|
|
93
|
+
const onVizPointClick: MessageCallback = jest.fn();
|
|
94
|
+
const onAlert: MessageCallback = jest.fn();
|
|
95
|
+
const onGetDataClick: MessageCallback = jest.fn();
|
|
96
|
+
const onDialogClose: MessageCallback = jest.fn();
|
|
97
|
+
const onDownload: MessageCallback = jest.fn();
|
|
98
|
+
const onDownloadAsPng: MessageCallback = jest.fn();
|
|
99
|
+
const onDownloadAsPdf: MessageCallback = jest.fn();
|
|
100
|
+
const onDownloadAsCsv: MessageCallback = jest.fn();
|
|
101
|
+
const onDownloadAsXlsx: MessageCallback = jest.fn();
|
|
102
|
+
const onDownloadLiveboardAsContinuousPDF: MessageCallback = jest.fn();
|
|
103
|
+
const onAnswerDelete: MessageCallback = jest.fn();
|
|
104
|
+
const onAIHighlights: MessageCallback = jest.fn();
|
|
105
|
+
const onPin: MessageCallback = jest.fn();
|
|
106
|
+
const onSpotIQAnalyze: MessageCallback = jest.fn();
|
|
107
|
+
const onShare: MessageCallback = jest.fn();
|
|
108
|
+
const onDrillInclude: MessageCallback = jest.fn();
|
|
109
|
+
const onDrillExclude: MessageCallback = jest.fn();
|
|
110
|
+
const onCopyToClipboard: MessageCallback = jest.fn();
|
|
111
|
+
const onUpdateTML: MessageCallback = jest.fn();
|
|
112
|
+
const onEditTML: MessageCallback = jest.fn();
|
|
113
|
+
const onExportTML: MessageCallback = jest.fn();
|
|
114
|
+
const onSaveAsView: MessageCallback = jest.fn();
|
|
115
|
+
const onCopyAEdit: MessageCallback = jest.fn();
|
|
116
|
+
const onShowUnderlyingData: MessageCallback = jest.fn();
|
|
117
|
+
const onAnswerChartSwitcher: MessageCallback = jest.fn();
|
|
118
|
+
const onLiveboardInfo: MessageCallback = jest.fn();
|
|
119
|
+
const onAddToFavorites: MessageCallback = jest.fn();
|
|
120
|
+
const onSchedule: MessageCallback = jest.fn();
|
|
121
|
+
const onEdit: MessageCallback = jest.fn();
|
|
122
|
+
const onMakeACopy: MessageCallback = jest.fn();
|
|
123
|
+
const onPresent: MessageCallback = jest.fn();
|
|
124
|
+
const onDelete: MessageCallback = jest.fn();
|
|
125
|
+
const onSchedulesList: MessageCallback = jest.fn();
|
|
126
|
+
const onCancel: MessageCallback = jest.fn();
|
|
127
|
+
const onExplore: MessageCallback = jest.fn();
|
|
128
|
+
const onCopyLink: MessageCallback = jest.fn();
|
|
129
|
+
const onCrossFilterChanged: MessageCallback = jest.fn();
|
|
130
|
+
const onVizPointRightClick: MessageCallback = jest.fn();
|
|
131
|
+
const onInsertIntoSlide: MessageCallback = jest.fn();
|
|
132
|
+
const onFilterChanged: MessageCallback = jest.fn();
|
|
133
|
+
const onUpdateConnection: MessageCallback = jest.fn();
|
|
134
|
+
const onCreateConnection: MessageCallback = jest.fn();
|
|
135
|
+
const onResetLiveboard: MessageCallback = jest.fn();
|
|
136
|
+
const onChangePersonalizedView: MessageCallback = jest.fn();
|
|
137
|
+
const onCreateWorksheet: MessageCallback = jest.fn();
|
|
138
|
+
const onAskSageInit: MessageCallback = jest.fn();
|
|
139
|
+
const onRename: MessageCallback = jest.fn();
|
|
140
|
+
const onParameterChanged: MessageCallback = jest.fn();
|
|
141
|
+
const onTableVizRendered: MessageCallback = jest.fn();
|
|
142
|
+
const onCreateLiveboard: MessageCallback = jest.fn();
|
|
143
|
+
const onCreateModel: MessageCallback = jest.fn();
|
|
144
|
+
const onSpotterData: MessageCallback = jest.fn();
|
|
145
|
+
const onPreviewSpotterData: MessageCallback = jest.fn();
|
|
146
|
+
const onAddToCoaching: MessageCallback = jest.fn();
|
|
147
|
+
const onDataModelInstructions: MessageCallback = jest.fn();
|
|
148
|
+
const onSpotterQueryTriggered: MessageCallback = jest.fn();
|
|
149
|
+
const onLastPromptEdited: MessageCallback = jest.fn();
|
|
150
|
+
const onLastPromptDeleted: MessageCallback = jest.fn();
|
|
151
|
+
const onResetSpotterConversation: MessageCallback = jest.fn();
|
|
152
|
+
const onSpotterInit: MessageCallback = jest.fn();
|
|
153
|
+
const onSpotterLoadComplete: MessageCallback = jest.fn();
|
|
154
|
+
const onOrgSwitched: MessageCallback = jest.fn();
|
|
155
|
+
const onSpotterConversationRenamed: MessageCallback = jest.fn();
|
|
156
|
+
const onSpotterConversationDeleted: MessageCallback = jest.fn();
|
|
157
|
+
const onSpotterConversationSelected: MessageCallback = jest.fn();
|
|
158
|
+
const onEmbedPageContextChanged: MessageCallback = jest.fn();
|
|
159
|
+
const onSubscribed: MessageCallback = jest.fn();
|
|
160
|
+
const onSendTestScheduleEmail: MessageCallback = jest.fn();
|
|
161
|
+
const onSpotterVizInit: MessageCallback = jest.fn();
|
|
162
|
+
const onSpotterVizQueryTriggered: MessageCallback = jest.fn();
|
|
163
|
+
const onSpotterVizResponseComplete: MessageCallback = jest.fn();
|
|
164
|
+
const onSpotterVizCheckpointCreated: MessageCallback = jest.fn();
|
|
165
|
+
const onSpotterVizCheckpointRestored: MessageCallback = jest.fn();
|
|
166
|
+
const onSpotterVizError: MessageCallback = jest.fn();
|
|
167
|
+
const onSpotterVizClosed: MessageCallback = jest.fn();
|
|
168
|
+
const onRefreshLiveboardBrowserCache: MessageCallback = jest.fn();
|
|
169
|
+
const onV1Data: MessageCallback = jest.fn();
|
|
170
|
+
|
|
171
|
+
const props = {
|
|
172
|
+
onDrilldown,
|
|
173
|
+
onDataSourceSelected,
|
|
174
|
+
onAddRemoveColumns,
|
|
175
|
+
onVizPointDoubleClick,
|
|
176
|
+
onVizPointClick,
|
|
177
|
+
onAlert,
|
|
178
|
+
onGetDataClick,
|
|
179
|
+
onDialogClose,
|
|
180
|
+
onDownload,
|
|
181
|
+
onDownloadAsPng,
|
|
182
|
+
onDownloadAsPdf,
|
|
183
|
+
onDownloadAsCsv,
|
|
184
|
+
onDownloadAsXlsx,
|
|
185
|
+
onDownloadLiveboardAsContinuousPDF,
|
|
186
|
+
onAnswerDelete,
|
|
187
|
+
onAIHighlights,
|
|
188
|
+
onPin,
|
|
189
|
+
onSpotIQAnalyze,
|
|
190
|
+
onShare,
|
|
191
|
+
onDrillInclude,
|
|
192
|
+
onDrillExclude,
|
|
193
|
+
onCopyToClipboard,
|
|
194
|
+
onUpdateTML,
|
|
195
|
+
onEditTML,
|
|
196
|
+
onExportTML,
|
|
197
|
+
onSaveAsView,
|
|
198
|
+
onCopyAEdit,
|
|
199
|
+
onShowUnderlyingData,
|
|
200
|
+
onAnswerChartSwitcher,
|
|
201
|
+
onLiveboardInfo,
|
|
202
|
+
onAddToFavorites,
|
|
203
|
+
onSchedule,
|
|
204
|
+
onEdit,
|
|
205
|
+
onMakeACopy,
|
|
206
|
+
onPresent,
|
|
207
|
+
onDelete,
|
|
208
|
+
onSchedulesList,
|
|
209
|
+
onCancel,
|
|
210
|
+
onExplore,
|
|
211
|
+
onCopyLink,
|
|
212
|
+
onCrossFilterChanged,
|
|
213
|
+
onVizPointRightClick,
|
|
214
|
+
onInsertIntoSlide,
|
|
215
|
+
onFilterChanged,
|
|
216
|
+
onUpdateConnection,
|
|
217
|
+
onCreateConnection,
|
|
218
|
+
onResetLiveboard,
|
|
219
|
+
onChangePersonalizedView,
|
|
220
|
+
onCreateWorksheet,
|
|
221
|
+
onAskSageInit,
|
|
222
|
+
onRename,
|
|
223
|
+
onParameterChanged,
|
|
224
|
+
onTableVizRendered,
|
|
225
|
+
onCreateLiveboard,
|
|
226
|
+
onCreateModel,
|
|
227
|
+
onSpotterData,
|
|
228
|
+
onPreviewSpotterData,
|
|
229
|
+
onAddToCoaching,
|
|
230
|
+
onDataModelInstructions,
|
|
231
|
+
onSpotterQueryTriggered,
|
|
232
|
+
onLastPromptEdited,
|
|
233
|
+
onLastPromptDeleted,
|
|
234
|
+
onResetSpotterConversation,
|
|
235
|
+
onSpotterInit,
|
|
236
|
+
onSpotterLoadComplete,
|
|
237
|
+
onOrgSwitched,
|
|
238
|
+
onSpotterConversationRenamed,
|
|
239
|
+
onSpotterConversationDeleted,
|
|
240
|
+
onSpotterConversationSelected,
|
|
241
|
+
onEmbedPageContextChanged,
|
|
242
|
+
onSubscribed,
|
|
243
|
+
onSendTestScheduleEmail,
|
|
244
|
+
onSpotterVizInit,
|
|
245
|
+
onSpotterVizQueryTriggered,
|
|
246
|
+
onSpotterVizResponseComplete,
|
|
247
|
+
onSpotterVizCheckpointCreated,
|
|
248
|
+
onSpotterVizCheckpointRestored,
|
|
249
|
+
onSpotterVizError,
|
|
250
|
+
onSpotterVizClosed,
|
|
251
|
+
onRefreshLiveboardBrowserCache,
|
|
252
|
+
onV1Data,
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
const result = getViewPropsAndListeners(props);
|
|
256
|
+
|
|
257
|
+
expect(result.viewConfig).toEqual({});
|
|
258
|
+
expect(result.listeners).toEqual({
|
|
259
|
+
[EmbedEvent.Drilldown]: onDrilldown,
|
|
260
|
+
[EmbedEvent.DataSourceSelected]: onDataSourceSelected,
|
|
261
|
+
[EmbedEvent.AddRemoveColumns]: onAddRemoveColumns,
|
|
262
|
+
[EmbedEvent.VizPointDoubleClick]: onVizPointDoubleClick,
|
|
263
|
+
[EmbedEvent.VizPointClick]: onVizPointClick,
|
|
264
|
+
[EmbedEvent.Alert]: onAlert,
|
|
265
|
+
[EmbedEvent.GetDataClick]: onGetDataClick,
|
|
266
|
+
[EmbedEvent.DialogClose]: onDialogClose,
|
|
267
|
+
[EmbedEvent.Download]: onDownload,
|
|
268
|
+
[EmbedEvent.DownloadAsPng]: onDownloadAsPng,
|
|
269
|
+
[EmbedEvent.DownloadAsPdf]: onDownloadAsPdf,
|
|
270
|
+
[EmbedEvent.DownloadAsCsv]: onDownloadAsCsv,
|
|
271
|
+
[EmbedEvent.DownloadAsXlsx]: onDownloadAsXlsx,
|
|
272
|
+
[EmbedEvent.DownloadLiveboardAsContinuousPDF]: onDownloadLiveboardAsContinuousPDF,
|
|
273
|
+
[EmbedEvent.AnswerDelete]: onAnswerDelete,
|
|
274
|
+
[EmbedEvent.AIHighlights]: onAIHighlights,
|
|
275
|
+
[EmbedEvent.Pin]: onPin,
|
|
276
|
+
[EmbedEvent.SpotIQAnalyze]: onSpotIQAnalyze,
|
|
277
|
+
[EmbedEvent.Share]: onShare,
|
|
278
|
+
[EmbedEvent.DrillInclude]: onDrillInclude,
|
|
279
|
+
[EmbedEvent.DrillExclude]: onDrillExclude,
|
|
280
|
+
[EmbedEvent.CopyToClipboard]: onCopyToClipboard,
|
|
281
|
+
[EmbedEvent.UpdateTML]: onUpdateTML,
|
|
282
|
+
[EmbedEvent.EditTML]: onEditTML,
|
|
283
|
+
[EmbedEvent.ExportTML]: onExportTML,
|
|
284
|
+
[EmbedEvent.SaveAsView]: onSaveAsView,
|
|
285
|
+
[EmbedEvent.CopyAEdit]: onCopyAEdit,
|
|
286
|
+
[EmbedEvent.ShowUnderlyingData]: onShowUnderlyingData,
|
|
287
|
+
[EmbedEvent.AnswerChartSwitcher]: onAnswerChartSwitcher,
|
|
288
|
+
[EmbedEvent.LiveboardInfo]: onLiveboardInfo,
|
|
289
|
+
[EmbedEvent.AddToFavorites]: onAddToFavorites,
|
|
290
|
+
[EmbedEvent.Schedule]: onSchedule,
|
|
291
|
+
[EmbedEvent.Edit]: onEdit,
|
|
292
|
+
[EmbedEvent.MakeACopy]: onMakeACopy,
|
|
293
|
+
[EmbedEvent.Present]: onPresent,
|
|
294
|
+
[EmbedEvent.Delete]: onDelete,
|
|
295
|
+
[EmbedEvent.SchedulesList]: onSchedulesList,
|
|
296
|
+
[EmbedEvent.Cancel]: onCancel,
|
|
297
|
+
[EmbedEvent.Explore]: onExplore,
|
|
298
|
+
[EmbedEvent.CopyLink]: onCopyLink,
|
|
299
|
+
[EmbedEvent.CrossFilterChanged]: onCrossFilterChanged,
|
|
300
|
+
[EmbedEvent.VizPointRightClick]: onVizPointRightClick,
|
|
301
|
+
[EmbedEvent.InsertIntoSlide]: onInsertIntoSlide,
|
|
302
|
+
[EmbedEvent.FilterChanged]: onFilterChanged,
|
|
303
|
+
[EmbedEvent.UpdateConnection]: onUpdateConnection,
|
|
304
|
+
[EmbedEvent.CreateConnection]: onCreateConnection,
|
|
305
|
+
[EmbedEvent.ResetLiveboard]: onResetLiveboard,
|
|
306
|
+
[EmbedEvent.ChangePersonalizedView]: onChangePersonalizedView,
|
|
307
|
+
[EmbedEvent.CreateWorksheet]: onCreateWorksheet,
|
|
308
|
+
[EmbedEvent.AskSageInit]: onAskSageInit,
|
|
309
|
+
[EmbedEvent.Rename]: onRename,
|
|
310
|
+
[EmbedEvent.ParameterChanged]: onParameterChanged,
|
|
311
|
+
[EmbedEvent.TableVizRendered]: onTableVizRendered,
|
|
312
|
+
[EmbedEvent.CreateLiveboard]: onCreateLiveboard,
|
|
313
|
+
[EmbedEvent.CreateModel]: onCreateModel,
|
|
314
|
+
[EmbedEvent.SpotterData]: onSpotterData,
|
|
315
|
+
[EmbedEvent.PreviewSpotterData]: onPreviewSpotterData,
|
|
316
|
+
[EmbedEvent.AddToCoaching]: onAddToCoaching,
|
|
317
|
+
[EmbedEvent.DataModelInstructions]: onDataModelInstructions,
|
|
318
|
+
[EmbedEvent.SpotterQueryTriggered]: onSpotterQueryTriggered,
|
|
319
|
+
[EmbedEvent.LastPromptEdited]: onLastPromptEdited,
|
|
320
|
+
[EmbedEvent.LastPromptDeleted]: onLastPromptDeleted,
|
|
321
|
+
[EmbedEvent.ResetSpotterConversation]: onResetSpotterConversation,
|
|
322
|
+
[EmbedEvent.SpotterInit]: onSpotterInit,
|
|
323
|
+
[EmbedEvent.SpotterLoadComplete]: onSpotterLoadComplete,
|
|
324
|
+
[EmbedEvent.OrgSwitched]: onOrgSwitched,
|
|
325
|
+
[EmbedEvent.SpotterConversationRenamed]: onSpotterConversationRenamed,
|
|
326
|
+
[EmbedEvent.SpotterConversationDeleted]: onSpotterConversationDeleted,
|
|
327
|
+
[EmbedEvent.SpotterConversationSelected]: onSpotterConversationSelected,
|
|
328
|
+
[EmbedEvent.EmbedPageContextChanged]: onEmbedPageContextChanged,
|
|
329
|
+
[EmbedEvent.Subscribed]: onSubscribed,
|
|
330
|
+
[EmbedEvent.SendTestScheduleEmail]: onSendTestScheduleEmail,
|
|
331
|
+
[EmbedEvent.SpotterVizInit]: onSpotterVizInit,
|
|
332
|
+
[EmbedEvent.SpotterVizQueryTriggered]: onSpotterVizQueryTriggered,
|
|
333
|
+
[EmbedEvent.SpotterVizResponseComplete]: onSpotterVizResponseComplete,
|
|
334
|
+
[EmbedEvent.SpotterVizCheckpointCreated]: onSpotterVizCheckpointCreated,
|
|
335
|
+
[EmbedEvent.SpotterVizCheckpointRestored]: onSpotterVizCheckpointRestored,
|
|
336
|
+
[EmbedEvent.SpotterVizError]: onSpotterVizError,
|
|
337
|
+
[EmbedEvent.SpotterVizClosed]: onSpotterVizClosed,
|
|
338
|
+
[EmbedEvent.RefreshLiveboardBrowserCache]: onRefreshLiveboardBrowserCache,
|
|
339
|
+
[EmbedEvent.V1Data]: onV1Data,
|
|
340
|
+
});
|
|
341
|
+
});
|
|
87
342
|
});
|
|
88
343
|
});
|
package/src/types.ts
CHANGED
|
@@ -244,6 +244,13 @@ export enum HomeLeftNavItem {
|
|
|
244
244
|
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
245
245
|
*/
|
|
246
246
|
Favorites = 'favorites',
|
|
247
|
+
/**
|
|
248
|
+
* The *Collections* menu option in
|
|
249
|
+
* the *Insights* left navigation panel.
|
|
250
|
+
* Shown when collections are enabled on the cluster.
|
|
251
|
+
* @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
|
|
252
|
+
*/
|
|
253
|
+
Collections = 'collections',
|
|
247
254
|
}
|
|
248
255
|
export type DOMSelector = string | HTMLElement;
|
|
249
256
|
|
|
@@ -1220,6 +1227,26 @@ export interface BaseViewConfig extends ApiInterceptFlags {
|
|
|
1220
1227
|
* ```
|
|
1221
1228
|
*/
|
|
1222
1229
|
overrideOrgId?: number;
|
|
1230
|
+
/**
|
|
1231
|
+
* Overrides the browser history behavior for embedding application users.
|
|
1232
|
+
* This parameter changes standard history navigation (pushState) into a
|
|
1233
|
+
* state replacement (replaceState), preventing users from getting trapped in
|
|
1234
|
+
* back-button loops inside the embedded iframe environment.
|
|
1235
|
+
* The overrideHistoryState setting is honored only if the
|
|
1236
|
+
* application is running within an embedded context.
|
|
1237
|
+
*
|
|
1238
|
+
* Supported embed types: `AppEmbed`, `LiveboardEmbed`, `SearchEmbed`, `SpotterAgentEmbed`, `SpotterEmbed`, `SearchBarEmbed`
|
|
1239
|
+
* @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
|
|
1240
|
+
* @example
|
|
1241
|
+
* ```js
|
|
1242
|
+
* // Replace <EmbedComponent> with embed component name. For example, AppEmbed, SearchEmbed, or LiveboardEmbed
|
|
1243
|
+
* const embed = new <EmbedComponent>('#tsEmbed', {
|
|
1244
|
+
* // ... other embed view config
|
|
1245
|
+
* overrideHistoryState: true,
|
|
1246
|
+
* });
|
|
1247
|
+
* ```
|
|
1248
|
+
*/
|
|
1249
|
+
overrideHistoryState?: boolean;
|
|
1223
1250
|
/**
|
|
1224
1251
|
* Flag to override the *Open Link in New Tab* context
|
|
1225
1252
|
* menu option.
|
|
@@ -3736,6 +3763,31 @@ export enum EmbedEvent {
|
|
|
3736
3763
|
*/
|
|
3737
3764
|
SpotterConversationSelected = 'spotterConversationSelected',
|
|
3738
3765
|
|
|
3766
|
+
/**
|
|
3767
|
+
* Emitted when the Spotter agent finishes streaming/rendering a response.
|
|
3768
|
+
* Includes the conversation and message identifiers so the host app can
|
|
3769
|
+
* fetch the full conversation history via the REST API if needed.
|
|
3770
|
+
*
|
|
3771
|
+
* The payload data has the shape `{ convId: string, messageId: string }`.
|
|
3772
|
+
*
|
|
3773
|
+
* Works with SpotterEmbed as well as AppEmbed (when Spotter is reached
|
|
3774
|
+
* inside the full application).
|
|
3775
|
+
* @example
|
|
3776
|
+
* ```js
|
|
3777
|
+
* spotterEmbed.on(EmbedEvent.SpotterResponseComplete, (payload) => {
|
|
3778
|
+
* console.log('Spotter response complete', payload);
|
|
3779
|
+
* })
|
|
3780
|
+
* ```
|
|
3781
|
+
* @example
|
|
3782
|
+
* ```js
|
|
3783
|
+
* appEmbed.on(EmbedEvent.SpotterResponseComplete, (payload) => {
|
|
3784
|
+
* console.log('Spotter response complete', payload);
|
|
3785
|
+
* })
|
|
3786
|
+
* ```
|
|
3787
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.9.0.cl
|
|
3788
|
+
*/
|
|
3789
|
+
SpotterResponseComplete = 'spotterResponseComplete',
|
|
3790
|
+
|
|
3739
3791
|
/**
|
|
3740
3792
|
* @hidden
|
|
3741
3793
|
* Emitted when the auth token is about to get expired and needs to be refreshed.
|
|
@@ -5312,6 +5364,14 @@ export enum HostEvent {
|
|
|
5312
5364
|
/**
|
|
5313
5365
|
* Get details of filters applied on the Liveboard.
|
|
5314
5366
|
* Returns arrays containing Liveboard filter and runtime filter elements.
|
|
5367
|
+
* Each Liveboard filter may include an `applicability` attribute
|
|
5368
|
+
* indicating the scope of the filter. It contains a `level`
|
|
5369
|
+
* (`LIVEBOARD`, `TAB`, or `GROUP`) and, when `level` is `TAB` or
|
|
5370
|
+
* `GROUP`, a `targetId` with the GUID of the target. At `LIVEBOARD`
|
|
5371
|
+
* level there is no `targetId`, since the filter applies to the
|
|
5372
|
+
* whole Liveboard.
|
|
5373
|
+
* The `applicability` attribute is available from SDK: 1.51.0 |
|
|
5374
|
+
* ThoughtSpot: 26.10.0.cl.
|
|
5315
5375
|
* @example
|
|
5316
5376
|
* ```js
|
|
5317
5377
|
* const data = await liveboardEmbed.trigger(HostEvent.GetFilters);
|
|
@@ -5351,6 +5411,16 @@ export enum HostEvent {
|
|
|
5351
5411
|
*
|
|
5352
5412
|
* `type` - To update filters for date time, specify the date format type.
|
|
5353
5413
|
* For more information and examples, see link:https://developers.thoughtspot.com/docs/embed-liveboard#_date_filters[Date filters].
|
|
5414
|
+
*
|
|
5415
|
+
* `applicability` - Optional. Scopes the filter to a specific target,
|
|
5416
|
+
* for example, a single Liveboard tab. Available from SDK: 1.51.0 |
|
|
5417
|
+
* ThoughtSpot: 26.10.0.cl. Includes the following attributes:
|
|
5418
|
+
*
|
|
5419
|
+
* - `level`: The scope of the filter: `LIVEBOARD`, `TAB`, or `GROUP`.
|
|
5420
|
+
* - `targetId`: The GUID of the target, for example, the tab GUID.
|
|
5421
|
+
* Required when `level` is `TAB` or `GROUP`. Do not pass it when
|
|
5422
|
+
* `level` is `LIVEBOARD`, since the filter applies to the whole
|
|
5423
|
+
* Liveboard.
|
|
5354
5424
|
* @example
|
|
5355
5425
|
* ```js
|
|
5356
5426
|
*
|
|
@@ -5427,6 +5497,21 @@ export enum HostEvent {
|
|
|
5427
5497
|
* }
|
|
5428
5498
|
* }, ContextType.Liveboard);
|
|
5429
5499
|
* ```
|
|
5500
|
+
* @example
|
|
5501
|
+
* ```js
|
|
5502
|
+
* // Scope the filter to a specific Liveboard tab
|
|
5503
|
+
* liveboardEmbed.trigger(HostEvent.UpdateFilters, {
|
|
5504
|
+
* filter: {
|
|
5505
|
+
* column: "item type",
|
|
5506
|
+
* oper: "IN",
|
|
5507
|
+
* values: ["bags", "shirts"],
|
|
5508
|
+
* applicability: {
|
|
5509
|
+
* level: "TAB",
|
|
5510
|
+
* targetId: "e0836cad-4fdf-42d4-bd97-567a6b2a6058"
|
|
5511
|
+
* }
|
|
5512
|
+
* }
|
|
5513
|
+
* });
|
|
5514
|
+
* ```
|
|
5430
5515
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
5431
5516
|
*/
|
|
5432
5517
|
UpdateFilters = 'updateFilters',
|
|
@@ -5578,6 +5663,15 @@ export enum HostEvent {
|
|
|
5578
5663
|
* - `name`: Name of the parameter.
|
|
5579
5664
|
* - `value`: The value to set for the parameter.
|
|
5580
5665
|
* - `isVisibleToUser`: Optional. To control the visibility of the parameter chip.
|
|
5666
|
+
* - `applicability`: Optional. Scopes the parameter to a specific target,
|
|
5667
|
+
* for example, a single Liveboard tab. Available from SDK: 1.51.0 |
|
|
5668
|
+
* ThoughtSpot: 26.10.0.cl. Includes the following attributes:
|
|
5669
|
+
*
|
|
5670
|
+
* - `level`: The scope of the parameter: `LIVEBOARD`, `TAB`, or `GROUP`.
|
|
5671
|
+
* - `targetId`: The GUID of the target, for example, the tab GUID.
|
|
5672
|
+
* Required when `level` is `TAB` or `GROUP`. Do not pass it when
|
|
5673
|
+
* `level` is `LIVEBOARD`, since the parameter applies to the whole
|
|
5674
|
+
* Liveboard.
|
|
5581
5675
|
*
|
|
5582
5676
|
* @example
|
|
5583
5677
|
* ```js
|
|
@@ -5589,6 +5683,18 @@ export enum HostEvent {
|
|
|
5589
5683
|
* ```
|
|
5590
5684
|
* @example
|
|
5591
5685
|
* ```js
|
|
5686
|
+
* // Scope the parameter to a specific Liveboard tab
|
|
5687
|
+
* liveboardEmbed.trigger(HostEvent.UpdateParameters, [{
|
|
5688
|
+
* name: "Integer Range Param",
|
|
5689
|
+
* value: 10,
|
|
5690
|
+
* applicability: {
|
|
5691
|
+
* level: "TAB",
|
|
5692
|
+
* targetId: "e0836cad-4fdf-42d4-bd97-567a6b2a6058"
|
|
5693
|
+
* }
|
|
5694
|
+
* }])
|
|
5695
|
+
* ```
|
|
5696
|
+
* @example
|
|
5697
|
+
* ```js
|
|
5592
5698
|
* // Update parameters from liveboard context
|
|
5593
5699
|
* import { ContextType } from '@thoughtspot/visual-embed-sdk';
|
|
5594
5700
|
* liveboardEmbed.trigger(HostEvent.UpdateParameters, [{
|
|
@@ -5602,6 +5708,14 @@ export enum HostEvent {
|
|
|
5602
5708
|
UpdateParameters = 'UpdateParameters',
|
|
5603
5709
|
/**
|
|
5604
5710
|
* Triggers GetParameters to fetch the runtime Parameters.
|
|
5711
|
+
* Each parameter may include an `applicability` attribute
|
|
5712
|
+
* indicating the scope of the parameter. It contains a `level`
|
|
5713
|
+
* (`LIVEBOARD`, `TAB`, or `GROUP`) and, when `level` is `TAB` or
|
|
5714
|
+
* `GROUP`, a `targetId` with the GUID of the target. At `LIVEBOARD`
|
|
5715
|
+
* level there is no `targetId`, since the parameter applies to the
|
|
5716
|
+
* whole Liveboard.
|
|
5717
|
+
* The `applicability` attribute is available from SDK: 1.51.0 |
|
|
5718
|
+
* ThoughtSpot: 26.10.0.cl.
|
|
5605
5719
|
* @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
|
|
5606
5720
|
* ```js
|
|
5607
5721
|
* liveboardEmbed.trigger(HostEvent.GetParameters).then((parameter) => {
|
|
@@ -6193,6 +6307,7 @@ export enum Param {
|
|
|
6193
6307
|
SpotterEnabled = 'isSpotterExperienceEnabled',
|
|
6194
6308
|
IsUnifiedSearchExperienceEnabled = 'isUnifiedSearchExperienceEnabled',
|
|
6195
6309
|
OverrideOrgId = 'orgId',
|
|
6310
|
+
OverrideHistoryState = 'overrideHistoryState',
|
|
6196
6311
|
OauthPollingInterval = 'oAuthPollingInterval',
|
|
6197
6312
|
IsForceRedirect = 'isForceRedirect',
|
|
6198
6313
|
DataSourceId = 'dataSourceId',
|
|
@@ -6213,6 +6328,7 @@ export enum Param {
|
|
|
6213
6328
|
isLinkParametersEnabled = 'isLinkParametersEnabled',
|
|
6214
6329
|
EnablePastConversationsSidebar = 'enablePastConversationsSidebar',
|
|
6215
6330
|
UpdatedSpotterChatPrompt = 'updatedSpotterChatPrompt',
|
|
6331
|
+
DefaultQueryMode = 'defaultQueryMode',
|
|
6216
6332
|
EnableStopAnswerGenerationEmbed = 'enableStopAnswerGenerationEmbed',
|
|
6217
6333
|
SpotterSidebarTitle = 'spotterSidebarTitle',
|
|
6218
6334
|
SpotterSidebarDefaultExpanded = 'spotterSidebarDefaultExpanded',
|
|
@@ -8436,6 +8552,9 @@ export enum EmbedErrorCodes {
|
|
|
8436
8552
|
|
|
8437
8553
|
/** DrillDown payload is invalid - missing or malformed points */
|
|
8438
8554
|
DRILLDOWN_INVALID_PAYLOAD = 'DRILLDOWN_INVALID_PAYLOAD',
|
|
8555
|
+
|
|
8556
|
+
/** UpdateParameters payload is invalid - malformed applicability */
|
|
8557
|
+
UPDATEPARAMETERS_INVALID_PAYLOAD = 'UPDATEPARAMETERS_INVALID_PAYLOAD',
|
|
8439
8558
|
}
|
|
8440
8559
|
|
|
8441
8560
|
/**
|
|
@@ -80,6 +80,11 @@ describe('Unit test for process data', () => {
|
|
|
80
80
|
);
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
+
test('ProcessData QueryChanged default branch returns payload unchanged', () => {
|
|
84
|
+
const e = { type: EmbedEvent.QueryChanged, data: { query: 'revenue by region' } };
|
|
85
|
+
expect(processDataInstance.processEventData(EmbedEvent.QueryChanged, e, thoughtSpotHost, null)).toEqual(e);
|
|
86
|
+
});
|
|
87
|
+
|
|
83
88
|
test('ProcessData, when Action is non CustomAction', () => {
|
|
84
89
|
const processedData = { type: EmbedEvent.Data };
|
|
85
90
|
jest.spyOn(processDataInstance, 'processCustomAction').mockImplementation(async () => ({}));
|
|
@@ -311,6 +316,98 @@ describe('Unit test for process data', () => {
|
|
|
311
316
|
expect(base.notifyAuthFailure).not.toHaveBeenCalled();
|
|
312
317
|
});
|
|
313
318
|
|
|
319
|
+
test('processEventData default branch returns payload unchanged for non-special events', () => {
|
|
320
|
+
const events = [
|
|
321
|
+
EmbedEvent.Drilldown,
|
|
322
|
+
EmbedEvent.DataSourceSelected,
|
|
323
|
+
EmbedEvent.AddRemoveColumns,
|
|
324
|
+
EmbedEvent.VizPointDoubleClick,
|
|
325
|
+
EmbedEvent.VizPointClick,
|
|
326
|
+
EmbedEvent.Alert,
|
|
327
|
+
EmbedEvent.GetDataClick,
|
|
328
|
+
EmbedEvent.DialogClose,
|
|
329
|
+
EmbedEvent.Download,
|
|
330
|
+
EmbedEvent.DownloadAsPng,
|
|
331
|
+
EmbedEvent.DownloadAsPdf,
|
|
332
|
+
EmbedEvent.DownloadAsCsv,
|
|
333
|
+
EmbedEvent.DownloadAsXlsx,
|
|
334
|
+
EmbedEvent.DownloadLiveboardAsContinuousPDF,
|
|
335
|
+
EmbedEvent.AnswerDelete,
|
|
336
|
+
EmbedEvent.AIHighlights,
|
|
337
|
+
EmbedEvent.Pin,
|
|
338
|
+
EmbedEvent.SpotIQAnalyze,
|
|
339
|
+
EmbedEvent.Share,
|
|
340
|
+
EmbedEvent.DrillInclude,
|
|
341
|
+
EmbedEvent.DrillExclude,
|
|
342
|
+
EmbedEvent.CopyToClipboard,
|
|
343
|
+
EmbedEvent.UpdateTML,
|
|
344
|
+
EmbedEvent.EditTML,
|
|
345
|
+
EmbedEvent.ExportTML,
|
|
346
|
+
EmbedEvent.SaveAsView,
|
|
347
|
+
EmbedEvent.CopyAEdit,
|
|
348
|
+
EmbedEvent.ShowUnderlyingData,
|
|
349
|
+
EmbedEvent.AnswerChartSwitcher,
|
|
350
|
+
EmbedEvent.LiveboardInfo,
|
|
351
|
+
EmbedEvent.AddToFavorites,
|
|
352
|
+
EmbedEvent.Schedule,
|
|
353
|
+
EmbedEvent.Edit,
|
|
354
|
+
EmbedEvent.MakeACopy,
|
|
355
|
+
EmbedEvent.Present,
|
|
356
|
+
EmbedEvent.Delete,
|
|
357
|
+
EmbedEvent.SchedulesList,
|
|
358
|
+
EmbedEvent.Cancel,
|
|
359
|
+
EmbedEvent.Explore,
|
|
360
|
+
EmbedEvent.CopyLink,
|
|
361
|
+
EmbedEvent.CrossFilterChanged,
|
|
362
|
+
EmbedEvent.VizPointRightClick,
|
|
363
|
+
EmbedEvent.InsertIntoSlide,
|
|
364
|
+
EmbedEvent.FilterChanged,
|
|
365
|
+
EmbedEvent.UpdateConnection,
|
|
366
|
+
EmbedEvent.CreateConnection,
|
|
367
|
+
EmbedEvent.ResetLiveboard,
|
|
368
|
+
EmbedEvent.ChangePersonalizedView,
|
|
369
|
+
EmbedEvent.CreateWorksheet,
|
|
370
|
+
EmbedEvent.AskSageInit,
|
|
371
|
+
EmbedEvent.Rename,
|
|
372
|
+
EmbedEvent.ParameterChanged,
|
|
373
|
+
EmbedEvent.TableVizRendered,
|
|
374
|
+
EmbedEvent.CreateLiveboard,
|
|
375
|
+
EmbedEvent.CreateModel,
|
|
376
|
+
EmbedEvent.SpotterData,
|
|
377
|
+
EmbedEvent.PreviewSpotterData,
|
|
378
|
+
EmbedEvent.AddToCoaching,
|
|
379
|
+
EmbedEvent.DataModelInstructions,
|
|
380
|
+
EmbedEvent.SpotterQueryTriggered,
|
|
381
|
+
EmbedEvent.LastPromptEdited,
|
|
382
|
+
EmbedEvent.LastPromptDeleted,
|
|
383
|
+
EmbedEvent.ResetSpotterConversation,
|
|
384
|
+
EmbedEvent.SpotterInit,
|
|
385
|
+
EmbedEvent.SpotterLoadComplete,
|
|
386
|
+
EmbedEvent.OrgSwitched,
|
|
387
|
+
EmbedEvent.SpotterConversationRenamed,
|
|
388
|
+
EmbedEvent.SpotterConversationDeleted,
|
|
389
|
+
EmbedEvent.SpotterConversationSelected,
|
|
390
|
+
EmbedEvent.EmbedPageContextChanged,
|
|
391
|
+
EmbedEvent.Subscribed,
|
|
392
|
+
EmbedEvent.SendTestScheduleEmail,
|
|
393
|
+
EmbedEvent.SpotterVizInit,
|
|
394
|
+
EmbedEvent.SpotterVizQueryTriggered,
|
|
395
|
+
EmbedEvent.SpotterVizResponseComplete,
|
|
396
|
+
EmbedEvent.SpotterVizCheckpointCreated,
|
|
397
|
+
EmbedEvent.SpotterVizCheckpointRestored,
|
|
398
|
+
EmbedEvent.SpotterVizError,
|
|
399
|
+
EmbedEvent.SpotterVizClosed,
|
|
400
|
+
EmbedEvent.RefreshLiveboardBrowserCache,
|
|
401
|
+
EmbedEvent.V1Data,
|
|
402
|
+
];
|
|
403
|
+
events.forEach((eventType) => {
|
|
404
|
+
const e = { type: eventType, data: 'test-payload' };
|
|
405
|
+
expect(
|
|
406
|
+
processDataInstance.processEventData(eventType, e, thoughtSpotHost, null),
|
|
407
|
+
).toEqual(e);
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
|
|
314
411
|
test('should handle ClearInfoCache', () => {
|
|
315
412
|
const mockResetCachedPreauthInfo = jest.spyOn(sessionInfoService, 'resetCachedPreauthInfo').mockImplementation(() => {});
|
|
316
413
|
const mockResetCachedSessionInfo = jest.spyOn(sessionInfoService, 'resetCachedSessionInfo').mockImplementation(() => {});
|
|
@@ -216,5 +216,96 @@ describe('Unit test for processTrigger', () => {
|
|
|
216
216
|
'Fullscreen presentation mode is disabled. Set disableFullscreenPresentation: false to enable this feature.',
|
|
217
217
|
);
|
|
218
218
|
});
|
|
219
|
+
|
|
220
|
+
test('postMessage is called with type=present when disableFullscreenPresentation is false', () => {
|
|
221
|
+
mockGetEmbedConfig.mockReturnValue({ disableFullscreenPresentation: false });
|
|
222
|
+
const thoughtSpotHost = 'https://example.thoughtspot.com';
|
|
223
|
+
_processTriggerInstance.processTrigger(iFrame, HostEvent.Present, thoughtSpotHost, {});
|
|
224
|
+
expect(iFrame.contentWindow.postMessage).toHaveBeenCalledWith(
|
|
225
|
+
expect.objectContaining({ type: HostEvent.Present }),
|
|
226
|
+
thoughtSpotHost,
|
|
227
|
+
expect.anything(),
|
|
228
|
+
);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test('postMessage is still called with type=present when disableFullscreenPresentation is true', () => {
|
|
232
|
+
mockGetEmbedConfig.mockReturnValue({ disableFullscreenPresentation: true });
|
|
233
|
+
const thoughtSpotHost = 'https://example.thoughtspot.com';
|
|
234
|
+
_processTriggerInstance.processTrigger(iFrame, HostEvent.Present, thoughtSpotHost, {});
|
|
235
|
+
expect(iFrame.contentWindow.postMessage).toHaveBeenCalledWith(
|
|
236
|
+
expect.objectContaining({ type: HostEvent.Present }),
|
|
237
|
+
thoughtSpotHost,
|
|
238
|
+
expect.anything(),
|
|
239
|
+
);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
test('handlePresentEvent receives the exact iFrame reference passed to processTrigger', () => {
|
|
243
|
+
mockGetEmbedConfig.mockReturnValue({ disableFullscreenPresentation: false });
|
|
244
|
+
_processTriggerInstance.processTrigger(
|
|
245
|
+
iFrame, HostEvent.Present, 'https://example.thoughtspot.com', {},
|
|
246
|
+
);
|
|
247
|
+
expect(mockHandlePresentEvent).toHaveBeenCalledWith(iFrame);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
test('nested responseData.data.error causes promise rejection', async () => {
|
|
252
|
+
const messageType = HostEvent.Search;
|
|
253
|
+
const thoughtSpotHost = 'http://localhost:3000';
|
|
254
|
+
mockMessageChannel();
|
|
255
|
+
const triggerPromise = _processTriggerInstance.processTrigger(
|
|
256
|
+
iFrame, messageType, thoughtSpotHost, {},
|
|
257
|
+
);
|
|
258
|
+
messageChannelMock.port1.onmessage({ data: { data: { error: 'nested-error' } } });
|
|
259
|
+
await expect(triggerPromise).rejects.toEqual('nested-error');
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
test('context parameter is forwarded as context field in the postMessage payload', async () => {
|
|
263
|
+
const messageType = HostEvent.Search;
|
|
264
|
+
const thoughtSpotHost = 'http://localhost:3000';
|
|
265
|
+
const context = 'Liveboard' as any;
|
|
266
|
+
mockMessageChannel();
|
|
267
|
+
_processTriggerInstance.processTrigger(iFrame, messageType, thoughtSpotHost, {}, context);
|
|
268
|
+
expect(iFrame.contentWindow.postMessage).toHaveBeenCalledWith(
|
|
269
|
+
expect.objectContaining({ context }),
|
|
270
|
+
thoughtSpotHost,
|
|
271
|
+
expect.anything(),
|
|
272
|
+
);
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
describe('Reload timing and side-effects', () => {
|
|
276
|
+
test('src is cleared immediately but not restored until exactly 100ms', () => {
|
|
277
|
+
jest.useFakeTimers();
|
|
278
|
+
const iFrameElement = document.createElement('iframe');
|
|
279
|
+
iFrameElement.src = 'http://localhost:3000';
|
|
280
|
+
const originalSrc = iFrameElement.src; // normalized by jsdom
|
|
281
|
+
|
|
282
|
+
_processTriggerInstance.reload(iFrameElement);
|
|
283
|
+
|
|
284
|
+
expect(iFrameElement.src).not.toBe(originalSrc); // cleared
|
|
285
|
+
jest.advanceTimersByTime(99);
|
|
286
|
+
expect(iFrameElement.src).not.toBe(originalSrc); // not yet restored
|
|
287
|
+
jest.advanceTimersByTime(1);
|
|
288
|
+
expect(iFrameElement.src).toBe(originalSrc); // restored at 100ms
|
|
289
|
+
jest.useRealTimers();
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
test('processTrigger(Reload) does not call iFrame.contentWindow.postMessage', () => {
|
|
293
|
+
jest.useFakeTimers();
|
|
294
|
+
// Use the outer iFrame mock which has a mockable contentWindow
|
|
295
|
+
jest.clearAllMocks();
|
|
296
|
+
_processTriggerInstance.processTrigger(
|
|
297
|
+
iFrame, HostEvent.Reload, 'http://localhost:3000', {},
|
|
298
|
+
);
|
|
299
|
+
jest.advanceTimersByTime(200);
|
|
300
|
+
expect(iFrame.contentWindow.postMessage).not.toHaveBeenCalled();
|
|
301
|
+
jest.useRealTimers();
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
test('processTrigger(Reload) resolves with null', async () => {
|
|
305
|
+
const result = await _processTriggerInstance.processTrigger(
|
|
306
|
+
iFrame, HostEvent.Reload, 'http://localhost:3000', {},
|
|
307
|
+
);
|
|
308
|
+
expect(result).toBeNull();
|
|
309
|
+
});
|
|
219
310
|
});
|
|
220
311
|
});
|