@thoughtspot/visual-embed-sdk 1.24.0-sage.3 → 1.24.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/README.md +1 -1
- package/cjs/package.json +10 -3
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +3 -0
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/css-variables.d.ts +38 -0
- package/cjs/src/css-variables.d.ts.map +1 -1
- package/cjs/src/embed/app.d.ts +33 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +12 -8
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +46 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/base.d.ts +6 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +8 -3
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +6 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +6 -2
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +23 -7
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +1 -0
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +1 -0
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/search-bar.d.ts +7 -0
- package/cjs/src/embed/search-bar.d.ts.map +1 -1
- package/cjs/src/embed/search-bar.js +6 -2
- package/cjs/src/embed/search-bar.js.map +1 -1
- package/cjs/src/embed/search.d.ts +16 -2
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +9 -2
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/search.spec.js +49 -0
- package/cjs/src/embed/search.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +4 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +31 -8
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +186 -3
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +4 -3
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +5 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts +1 -0
- package/cjs/src/mixpanel-service.d.ts.map +1 -1
- package/cjs/src/mixpanel-service.js +12 -3
- package/cjs/src/mixpanel-service.js.map +1 -1
- package/cjs/src/mixpanel-service.spec.js +13 -3
- package/cjs/src/mixpanel-service.spec.js.map +1 -1
- package/cjs/src/react/index.d.ts +15 -15
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +7 -3
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +12 -0
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +216 -21
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +133 -13
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/answerService/answerService.d.ts +34 -0
- package/cjs/src/utils/answerService/answerService.d.ts.map +1 -0
- package/cjs/src/utils/answerService/answerService.js +142 -0
- package/cjs/src/utils/answerService/answerService.js.map +1 -0
- package/cjs/src/utils/answerService/answerService.spec.d.ts +1 -0
- package/cjs/src/utils/answerService/answerService.spec.d.ts.map +1 -0
- package/cjs/src/utils/answerService/answerService.spec.js +1 -0
- package/cjs/src/utils/answerService/answerService.spec.js.map +1 -0
- package/cjs/src/utils/answerService/graphql-queries.d.ts +6 -0
- package/cjs/src/utils/answerService/graphql-queries.d.ts.map +1 -0
- package/cjs/src/utils/answerService/graphql-queries.js +123 -0
- package/cjs/src/utils/answerService/graphql-queries.js.map +1 -0
- package/cjs/src/utils/graphql/answerService/answer-queries.d.ts +5 -0
- package/cjs/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -0
- package/cjs/src/utils/graphql/answerService/answer-queries.js +80 -0
- package/cjs/src/utils/graphql/answerService/answer-queries.js.map +1 -0
- package/cjs/src/utils/graphql/answerService/answerService.d.ts +61 -0
- package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -0
- package/cjs/src/utils/graphql/answerService/answerService.js +182 -0
- package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.d.ts +2 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.d.ts.map +1 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.js +201 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -0
- package/cjs/src/utils/graphql/answerService/graphql-queries.d.ts +5 -0
- package/cjs/src/utils/graphql/answerService/graphql-queries.d.ts.map +1 -0
- package/cjs/src/utils/graphql/answerService/graphql-queries.js +80 -0
- package/cjs/src/utils/graphql/answerService/graphql-queries.js.map +1 -0
- package/cjs/src/utils/graphql/graphql-request.d.ts +15 -0
- package/cjs/src/utils/graphql/graphql-request.d.ts.map +1 -0
- package/cjs/src/utils/graphql/graphql-request.js +40 -0
- package/cjs/src/utils/graphql/graphql-request.js.map +1 -0
- package/cjs/src/utils/graphql/sourceService.d.ts +8 -0
- package/cjs/src/utils/graphql/sourceService.d.ts.map +1 -0
- package/cjs/src/utils/graphql/sourceService.js +69 -0
- package/cjs/src/utils/graphql/sourceService.js.map +1 -0
- package/cjs/src/utils/graphql/sourceService.spec.d.ts +2 -0
- package/cjs/src/utils/graphql/sourceService.spec.d.ts.map +1 -0
- package/cjs/src/utils/graphql/sourceService.spec.js +12 -0
- package/cjs/src/utils/graphql/sourceService.spec.js.map +1 -0
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +7 -11
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +13 -17
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils.d.ts +13 -1
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +45 -1
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +24 -0
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/css-variables.d.ts +38 -0
- package/dist/src/css-variables.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +33 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +6 -1
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +6 -1
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +1 -0
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +7 -0
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +16 -2
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +4 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts +1 -0
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +15 -15
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +216 -21
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/graphql/answerService/answer-queries.d.ts +5 -0
- package/dist/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -0
- package/dist/src/utils/graphql/answerService/answerService.d.ts +61 -0
- package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -0
- package/dist/src/utils/graphql/answerService/answerService.spec.d.ts +2 -0
- package/dist/src/utils/graphql/answerService/answerService.spec.d.ts.map +1 -0
- package/dist/src/utils/graphql/graphql-request.d.ts +15 -0
- package/dist/src/utils/graphql/graphql-request.d.ts.map +1 -0
- package/dist/src/utils/graphql/sourceService.d.ts +8 -0
- package/dist/src/utils/graphql/sourceService.d.ts.map +1 -0
- package/dist/src/utils/graphql/sourceService.spec.d.ts +2 -0
- package/dist/src/utils/graphql/sourceService.spec.d.ts.map +1 -0
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/src/utils.d.ts +13 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +603 -96
- package/dist/tsembed-react.js +596 -95
- package/dist/tsembed.es.js +655 -100
- package/dist/tsembed.js +649 -99
- package/dist/visual-embed-sdk-react-full.d.ts +615 -260
- package/dist/visual-embed-sdk-react.d.ts +617 -262
- package/dist/visual-embed-sdk.d.ts +380 -26
- package/lib/package.json +10 -3
- package/lib/src/.index.d.ts.swp +0 -0
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +3 -0
- package/lib/src/auth.js.map +1 -1
- package/lib/src/css-variables.d.ts +38 -0
- package/lib/src/css-variables.d.ts.map +1 -1
- package/lib/src/embed/app.d.ts +33 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +12 -8
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +46 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +6 -1
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +8 -3
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +6 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +7 -3
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +23 -7
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/sage.d.ts +1 -0
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +1 -0
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts +7 -0
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +7 -3
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts +16 -2
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +10 -3
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +49 -0
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +4 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +32 -9
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +187 -4
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +4 -3
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +4 -3
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts +1 -0
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +12 -3
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/mixpanel-service.spec.js +13 -3
- package/lib/src/mixpanel-service.spec.js.map +1 -1
- package/lib/src/react/index.d.ts +15 -15
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +5 -3
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +13 -1
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +216 -21
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +132 -12
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/answerService/answerService.d.ts +34 -0
- package/lib/src/utils/answerService/answerService.d.ts.map +1 -0
- package/lib/src/utils/answerService/answerService.js +137 -0
- package/lib/src/utils/answerService/answerService.js.map +1 -0
- package/lib/src/utils/answerService/answerService.spec.d.ts +1 -0
- package/lib/src/utils/answerService/answerService.spec.d.ts.map +1 -0
- package/lib/src/utils/answerService/answerService.spec.js +1 -0
- package/lib/src/utils/answerService/answerService.spec.js.map +1 -0
- package/lib/src/utils/answerService/graphql-queries.d.ts +6 -0
- package/lib/src/utils/answerService/graphql-queries.d.ts.map +1 -0
- package/lib/src/utils/answerService/graphql-queries.js +120 -0
- package/lib/src/utils/answerService/graphql-queries.js.map +1 -0
- package/lib/src/utils/graphql/answerService/answer-queries.d.ts +5 -0
- package/lib/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -0
- package/lib/src/utils/graphql/answerService/answer-queries.js +77 -0
- package/lib/src/utils/graphql/answerService/answer-queries.js.map +1 -0
- package/lib/src/utils/graphql/answerService/answerService.d.ts +61 -0
- package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -0
- package/lib/src/utils/graphql/answerService/answerService.js +177 -0
- package/lib/src/utils/graphql/answerService/answerService.js.map +1 -0
- package/lib/src/utils/graphql/answerService/answerService.spec.d.ts +2 -0
- package/lib/src/utils/graphql/answerService/answerService.spec.d.ts.map +1 -0
- package/lib/src/utils/graphql/answerService/answerService.spec.js +199 -0
- package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -0
- package/lib/src/utils/graphql/answerService/graphql-queries.d.ts +5 -0
- package/lib/src/utils/graphql/answerService/graphql-queries.d.ts.map +1 -0
- package/lib/src/utils/graphql/answerService/graphql-queries.js +77 -0
- package/lib/src/utils/graphql/answerService/graphql-queries.js.map +1 -0
- package/lib/src/utils/graphql/graphql-request.d.ts +15 -0
- package/lib/src/utils/graphql/graphql-request.d.ts.map +1 -0
- package/lib/src/utils/graphql/graphql-request.js +36 -0
- package/lib/src/utils/graphql/graphql-request.js.map +1 -0
- package/lib/src/utils/graphql/sourceService.d.ts +8 -0
- package/lib/src/utils/graphql/sourceService.d.ts.map +1 -0
- package/lib/src/utils/graphql/sourceService.js +65 -0
- package/lib/src/utils/graphql/sourceService.js.map +1 -0
- package/lib/src/utils/graphql/sourceService.spec.d.ts +2 -0
- package/lib/src/utils/graphql/sourceService.spec.d.ts.map +1 -0
- package/lib/src/utils/graphql/sourceService.spec.js +10 -0
- package/lib/src/utils/graphql/sourceService.spec.js.map +1 -0
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +8 -12
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +14 -18
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils.d.ts +13 -1
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +41 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +25 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +389 -30
- package/package.json +10 -3
- package/src/auth.ts +6 -3
- package/src/css-variables.ts +47 -0
- package/src/embed/app.spec.ts +63 -0
- package/src/embed/app.ts +52 -15
- package/src/embed/base.ts +11 -6
- package/src/embed/liveboard.spec.ts +29 -10
- package/src/embed/liveboard.ts +13 -2
- package/src/embed/sage.ts +2 -0
- package/src/embed/search-bar.tsx +21 -6
- package/src/embed/search.spec.ts +61 -0
- package/src/embed/search.ts +36 -3
- package/src/embed/ts-embed.spec.ts +211 -8
- package/src/embed/ts-embed.ts +34 -9
- package/src/index.ts +9 -0
- package/src/mixpanel-service.spec.ts +13 -3
- package/src/mixpanel-service.ts +11 -3
- package/src/react/index.spec.tsx +33 -2
- package/src/react/index.tsx +37 -26
- package/src/types.ts +305 -103
- package/src/utils/graphql/answerService/answer-queries.ts +80 -0
- package/src/utils/graphql/answerService/answerService.spec.ts +231 -0
- package/src/utils/graphql/answerService/answerService.ts +234 -0
- package/src/utils/graphql/graphql-request.ts +45 -0
- package/src/utils/graphql/sourceService.spec.ts +10 -0
- package/src/utils/graphql/sourceService.ts +71 -0
- package/src/utils/processData.spec.ts +15 -25
- package/src/utils/processData.ts +13 -15
- package/src/utils.spec.ts +31 -0
- package/src/utils.ts +47 -0
- package/src/utils/answerService.spec.ts +0 -41
- package/src/utils/answerService.ts +0 -63
package/dist/tsembed-react.js
CHANGED
|
@@ -194,6 +194,24 @@
|
|
|
194
194
|
}
|
|
195
195
|
return null;
|
|
196
196
|
};
|
|
197
|
+
/**
|
|
198
|
+
* Construct a runtime parameter override query string from the given option.
|
|
199
|
+
*
|
|
200
|
+
* @param runtimeParameters
|
|
201
|
+
*/
|
|
202
|
+
const getRuntimeParameters = (runtimeParameters) => {
|
|
203
|
+
if (runtimeParameters && runtimeParameters.length) {
|
|
204
|
+
const params = runtimeParameters.map((param, valueIndex) => {
|
|
205
|
+
const index = valueIndex + 1;
|
|
206
|
+
const filterExpr = [];
|
|
207
|
+
filterExpr.push(`param${index}=${encodeURIComponent(param.name)}`);
|
|
208
|
+
filterExpr.push(`paramVal${index}=${encodeURIComponent(param.value)}`);
|
|
209
|
+
return filterExpr.join('&');
|
|
210
|
+
});
|
|
211
|
+
return `${params.join('&')}`;
|
|
212
|
+
}
|
|
213
|
+
return null;
|
|
214
|
+
};
|
|
197
215
|
/**
|
|
198
216
|
* Convert a value to a string representation to be sent as a query
|
|
199
217
|
* parameter to the ThoughtSpot app.
|
|
@@ -342,7 +360,30 @@
|
|
|
342
360
|
function getDOMNode(domSelector) {
|
|
343
361
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
344
362
|
}
|
|
345
|
-
const deepMerge = (target, source) => merge(target, source);
|
|
363
|
+
const deepMerge = (target, source) => merge(target, source);
|
|
364
|
+
const getOperationNameFromQuery = (query) => {
|
|
365
|
+
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
366
|
+
const matches = query.match(regex);
|
|
367
|
+
return matches === null || matches === void 0 ? void 0 : matches[1];
|
|
368
|
+
};
|
|
369
|
+
/**
|
|
370
|
+
*
|
|
371
|
+
* @param obj
|
|
372
|
+
*/
|
|
373
|
+
function removeTypename(obj) {
|
|
374
|
+
if (!obj || typeof obj !== 'object')
|
|
375
|
+
return obj;
|
|
376
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
377
|
+
for (const key in obj) {
|
|
378
|
+
if (key === '__typename') {
|
|
379
|
+
delete obj[key];
|
|
380
|
+
}
|
|
381
|
+
else if (typeof obj[key] === 'object') {
|
|
382
|
+
removeTypename(obj[key]);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return obj;
|
|
386
|
+
}
|
|
346
387
|
|
|
347
388
|
/**
|
|
348
389
|
* Copyright (c) 2023
|
|
@@ -521,6 +562,17 @@
|
|
|
521
562
|
*/
|
|
522
563
|
AuthType["Basic"] = "Basic";
|
|
523
564
|
})(AuthType || (AuthType = {}));
|
|
565
|
+
(function (HomeLeftNavItem) {
|
|
566
|
+
HomeLeftNavItem["QueryBuilder"] = "query-builder";
|
|
567
|
+
HomeLeftNavItem["Home"] = "insights-home";
|
|
568
|
+
HomeLeftNavItem["Liveboards"] = "liveboards";
|
|
569
|
+
HomeLeftNavItem["Answers"] = "answers";
|
|
570
|
+
HomeLeftNavItem["MonitorSubscription"] = "monitor-alerts";
|
|
571
|
+
HomeLeftNavItem["SpotIQAnalysis"] = "spotiq-analysis";
|
|
572
|
+
HomeLeftNavItem["Tutorials"] = "tutorials";
|
|
573
|
+
HomeLeftNavItem["Documentation"] = "documentation";
|
|
574
|
+
HomeLeftNavItem["Community"] = "community";
|
|
575
|
+
})(exports.HomeLeftNavItem || (exports.HomeLeftNavItem = {}));
|
|
524
576
|
(function (RuntimeFilterOp) {
|
|
525
577
|
/**
|
|
526
578
|
* Equals
|
|
@@ -579,6 +631,32 @@
|
|
|
579
631
|
*/
|
|
580
632
|
RuntimeFilterOp["IN"] = "IN";
|
|
581
633
|
})(exports.RuntimeFilterOp || (exports.RuntimeFilterOp = {}));
|
|
634
|
+
(function (HomepageModule) {
|
|
635
|
+
/**
|
|
636
|
+
* Search bar
|
|
637
|
+
*/
|
|
638
|
+
HomepageModule["Search"] = "SEARCH";
|
|
639
|
+
/**
|
|
640
|
+
* kPI watchlist module
|
|
641
|
+
*/
|
|
642
|
+
HomepageModule["Watchlist"] = "WATCHLIST";
|
|
643
|
+
/**
|
|
644
|
+
* favorite objects
|
|
645
|
+
*/
|
|
646
|
+
HomepageModule["Favorite"] = "FAVORITE";
|
|
647
|
+
/**
|
|
648
|
+
* List of answers and liveboards
|
|
649
|
+
*/
|
|
650
|
+
HomepageModule["MyLibrary"] = "MY_LIBRARY";
|
|
651
|
+
/**
|
|
652
|
+
* Trending list
|
|
653
|
+
*/
|
|
654
|
+
HomepageModule["Trending"] = "TRENDING";
|
|
655
|
+
/**
|
|
656
|
+
* Learning videos
|
|
657
|
+
*/
|
|
658
|
+
HomepageModule["Learning"] = "LEARNING";
|
|
659
|
+
})(exports.HomepageModule || (exports.HomepageModule = {}));
|
|
582
660
|
(function (EmbedEvent) {
|
|
583
661
|
/**
|
|
584
662
|
* Rendering has initialized.
|
|
@@ -983,23 +1061,74 @@
|
|
|
983
1061
|
*/
|
|
984
1062
|
EmbedEvent["InsertIntoSlide"] = "insertInToSlide";
|
|
985
1063
|
/**
|
|
1064
|
+
* @hidden
|
|
986
1065
|
* Emitted when a user changes any filter on a Liveboard.
|
|
987
|
-
*
|
|
988
1066
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
989
1067
|
*/
|
|
990
1068
|
EmbedEvent["FilterChanged"] = "filterChanged";
|
|
991
1069
|
/**
|
|
992
1070
|
* Emitted when a user click on Go button in Sage Embed
|
|
993
1071
|
*
|
|
994
|
-
* @version SDK : 1.
|
|
1072
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
995
1073
|
*/
|
|
996
1074
|
EmbedEvent["SageEmbedQuery"] = "sageEmbedQuery";
|
|
997
1075
|
/**
|
|
998
1076
|
* Emitten when a user select data source in Sage Embed
|
|
999
1077
|
*
|
|
1000
|
-
* @version SDK : 1.
|
|
1078
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
1001
1079
|
*/
|
|
1002
1080
|
EmbedEvent["SageWorksheetUpdated"] = "sageWorksheetUpdated";
|
|
1081
|
+
/**
|
|
1082
|
+
* Emitten when a user updates a connection in Data tab
|
|
1083
|
+
*
|
|
1084
|
+
* @version SDK : 1.27.0 | Thoughtspot: 9.8.0.cl
|
|
1085
|
+
*/
|
|
1086
|
+
EmbedEvent["UpdateConnection"] = "updateConnection";
|
|
1087
|
+
/**
|
|
1088
|
+
* Emitted when name, status (private or public) or filter values of a
|
|
1089
|
+
* PersonalisedView is updated.
|
|
1090
|
+
*
|
|
1091
|
+
* @returns viewName: string
|
|
1092
|
+
* @returns viewId: string
|
|
1093
|
+
* @returns liveboardId: string
|
|
1094
|
+
* @returns isPublic: boolean
|
|
1095
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
1096
|
+
*/
|
|
1097
|
+
EmbedEvent["UpdatePersonalisedView"] = "updatePersonalisedView";
|
|
1098
|
+
/**
|
|
1099
|
+
* Emitted when a PersonalisedView is saved.
|
|
1100
|
+
*
|
|
1101
|
+
* @returns viewName: string
|
|
1102
|
+
* @returns viewId: string
|
|
1103
|
+
* @returns liveboardId: string
|
|
1104
|
+
* @returns isPublic: boolean
|
|
1105
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
1106
|
+
*/
|
|
1107
|
+
EmbedEvent["SavePersonalisedView"] = "savePersonalisedView";
|
|
1108
|
+
/**
|
|
1109
|
+
* Emitted when a Liveboard is reset.
|
|
1110
|
+
*
|
|
1111
|
+
* @returns viewName: string
|
|
1112
|
+
* @returns viewId: string
|
|
1113
|
+
* @returns liveboardId: string
|
|
1114
|
+
* @returns isPublic: boolean
|
|
1115
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
1116
|
+
*/
|
|
1117
|
+
EmbedEvent["ResetLiveboard"] = "resetLiveboard";
|
|
1118
|
+
/**
|
|
1119
|
+
* Emitted when a PersonalisedView is deleted.
|
|
1120
|
+
*
|
|
1121
|
+
* @returns views: string[]
|
|
1122
|
+
* @returns liveboardId: string
|
|
1123
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
1124
|
+
*/
|
|
1125
|
+
EmbedEvent["DeletePersonalisedView"] = "deletePersonalisedView";
|
|
1126
|
+
/**
|
|
1127
|
+
* Emitten when a user creates a new worksheet
|
|
1128
|
+
*
|
|
1129
|
+
* @version SDK : 1.27.0 | Thoughtspot: 9.8.0.cl
|
|
1130
|
+
*/
|
|
1131
|
+
EmbedEvent["CreateWorksheet"] = "createWorksheet";
|
|
1003
1132
|
})(exports.EmbedEvent || (exports.EmbedEvent = {}));
|
|
1004
1133
|
(function (HostEvent) {
|
|
1005
1134
|
/**
|
|
@@ -1620,16 +1749,16 @@
|
|
|
1620
1749
|
*/
|
|
1621
1750
|
HostEvent["ResetSearch"] = "resetSearch";
|
|
1622
1751
|
/**
|
|
1752
|
+
* @hidden
|
|
1623
1753
|
* Gets the currents visible and runtime filters applied on a Liveboard
|
|
1624
|
-
*
|
|
1625
1754
|
* @example
|
|
1626
1755
|
* liveboardEmbed.trigger(HostEvent.GetFilters)
|
|
1627
1756
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
1628
1757
|
*/
|
|
1629
1758
|
HostEvent["GetFilters"] = "getFilters";
|
|
1630
1759
|
/**
|
|
1760
|
+
* @hidden
|
|
1631
1761
|
* Updates the visible filters on the Liveboard.
|
|
1632
|
-
*
|
|
1633
1762
|
* @param - filter: filter object containing column name and filter operation and values
|
|
1634
1763
|
* @example
|
|
1635
1764
|
*
|
|
@@ -1786,6 +1915,9 @@
|
|
|
1786
1915
|
Param["HideSampleQuestions"] = "hideSampleQuestions";
|
|
1787
1916
|
Param["WorksheetId"] = "worksheet";
|
|
1788
1917
|
Param["Query"] = "query";
|
|
1918
|
+
Param["HideHomepageLeftNav"] = "hideHomepageLeftNav";
|
|
1919
|
+
Param["ModularHomeExperienceEnabled"] = "modularHomeExperience";
|
|
1920
|
+
Param["PendoTrackingKey"] = "additionalPendoKey";
|
|
1789
1921
|
})(Param || (Param = {}));
|
|
1790
1922
|
(function (Action) {
|
|
1791
1923
|
/**
|
|
@@ -2261,7 +2393,7 @@
|
|
|
2261
2393
|
* disabledActions: [Action.QueryDetailsButtons]
|
|
2262
2394
|
* ```
|
|
2263
2395
|
*/
|
|
2264
|
-
Action["QueryDetailsButtons"] = "
|
|
2396
|
+
Action["QueryDetailsButtons"] = "queryDetailsButtons";
|
|
2265
2397
|
/**
|
|
2266
2398
|
* The **Delete** action for Answers.
|
|
2267
2399
|
*
|
|
@@ -2566,13 +2698,36 @@
|
|
|
2566
2698
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
2567
2699
|
*/
|
|
2568
2700
|
Action["ModifySageAnswer"] = "modifySageAnswer";
|
|
2701
|
+
/**
|
|
2702
|
+
* The **Move to Tab** menu action on visualizations in liveboard edit mode.
|
|
2703
|
+
* Allows moving a visualization to a different tab.
|
|
2704
|
+
*
|
|
2705
|
+
* @example
|
|
2706
|
+
* ```js
|
|
2707
|
+
* disabledActions: [Action.MoveToTab]
|
|
2708
|
+
* ```
|
|
2709
|
+
*/
|
|
2710
|
+
Action["MoveToTab"] = "onContainerMove";
|
|
2711
|
+
/**
|
|
2712
|
+
* The **Manage Alertsb** menu action on KPI visualizations.
|
|
2713
|
+
*
|
|
2714
|
+
* @example
|
|
2715
|
+
* ```js
|
|
2716
|
+
* disabledActions: [Action.ManageMonitor]
|
|
2717
|
+
* ```
|
|
2718
|
+
*/
|
|
2719
|
+
Action["ManageMonitor"] = "ManageMonitor";
|
|
2720
|
+
/**
|
|
2721
|
+
* Action ID for Liveboard Personalised Views dropdown
|
|
2722
|
+
*
|
|
2723
|
+
* @example
|
|
2724
|
+
* ```js
|
|
2725
|
+
* disabledActions: [Action.PersonalisedViewsDropdown]
|
|
2726
|
+
* ```
|
|
2727
|
+
* @version SDK : 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
2728
|
+
*/
|
|
2729
|
+
Action["PersonalisedViewsDropdown"] = "personalisedViewsDropdown";
|
|
2569
2730
|
})(exports.Action || (exports.Action = {}));
|
|
2570
|
-
// eslint-disable-next-line no-shadow
|
|
2571
|
-
var OperationType;
|
|
2572
|
-
(function (OperationType) {
|
|
2573
|
-
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
2574
|
-
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
2575
|
-
})(OperationType || (OperationType = {}));
|
|
2576
2731
|
var PrefetchFeatures;
|
|
2577
2732
|
(function (PrefetchFeatures) {
|
|
2578
2733
|
PrefetchFeatures["FullApp"] = "FullApp";
|
|
@@ -8645,6 +8800,7 @@
|
|
|
8645
8800
|
|
|
8646
8801
|
// Needed to avoid error in CJS builds on some bundlers.
|
|
8647
8802
|
const mixpanelLib = mixpanel_cjs || mixpanel$1;
|
|
8803
|
+
let mixpanelInstance;
|
|
8648
8804
|
const MIXPANEL_EVENT = {
|
|
8649
8805
|
VISUAL_SDK_RENDER_START: 'visual-sdk-render-start',
|
|
8650
8806
|
VISUAL_SDK_CALLED_INIT: 'visual-sdk-called-init',
|
|
@@ -8653,6 +8809,7 @@
|
|
|
8653
8809
|
VISUAL_SDK_TRIGGER: 'visual-sdk-trigger',
|
|
8654
8810
|
VISUAL_SDK_ON: 'visual-sdk-on',
|
|
8655
8811
|
VISUAL_SDK_IFRAME_LOAD_PERFORMANCE: 'visual-sdk-iframe-load-performance',
|
|
8812
|
+
VISUAL_SDK_EMBED_CREATE: 'visual-sdk-embed-create',
|
|
8656
8813
|
};
|
|
8657
8814
|
let isMixpanelInitialized = false;
|
|
8658
8815
|
let eventQueue = [];
|
|
@@ -8667,7 +8824,7 @@
|
|
|
8667
8824
|
eventQueue.push({ eventId, eventProps });
|
|
8668
8825
|
return;
|
|
8669
8826
|
}
|
|
8670
|
-
|
|
8827
|
+
mixpanelInstance.track(eventId, eventProps);
|
|
8671
8828
|
}
|
|
8672
8829
|
/**
|
|
8673
8830
|
*
|
|
@@ -8686,6 +8843,7 @@
|
|
|
8686
8843
|
* @param sessionInfo
|
|
8687
8844
|
*/
|
|
8688
8845
|
function initMixpanel(sessionInfo) {
|
|
8846
|
+
var _a;
|
|
8689
8847
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
8690
8848
|
return;
|
|
8691
8849
|
}
|
|
@@ -8695,10 +8853,16 @@
|
|
|
8695
8853
|
const token = sessionInfo.mixpanelToken;
|
|
8696
8854
|
try {
|
|
8697
8855
|
if (token) {
|
|
8698
|
-
mixpanelLib.init(token);
|
|
8856
|
+
mixpanelInstance = mixpanelLib.init(token, undefined, 'tsEmbed');
|
|
8699
8857
|
if (!isPublicCluster) {
|
|
8700
|
-
|
|
8858
|
+
mixpanelInstance.identify(sessionInfo.userGUID);
|
|
8701
8859
|
}
|
|
8860
|
+
mixpanelInstance.register_once({
|
|
8861
|
+
clusterId: sessionInfo.clusterId,
|
|
8862
|
+
clusterName: sessionInfo.clusterName,
|
|
8863
|
+
releaseVersion: sessionInfo.releaseVersion,
|
|
8864
|
+
hostAppUrl: ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '',
|
|
8865
|
+
});
|
|
8702
8866
|
isMixpanelInitialized = true;
|
|
8703
8867
|
emptyQueue();
|
|
8704
8868
|
}
|
|
@@ -9635,6 +9799,9 @@
|
|
|
9635
9799
|
userGUID: sessionInfoResp.userGUID,
|
|
9636
9800
|
mixpanelToken,
|
|
9637
9801
|
isPublicUser: sessionInfoResp.configInfo.isPublicUser,
|
|
9802
|
+
releaseVersion: sessionInfoResp.releaseVersion,
|
|
9803
|
+
clusterId: sessionInfoResp.configInfo.selfClusterId,
|
|
9804
|
+
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
9638
9805
|
...sessionInfoResp,
|
|
9639
9806
|
};
|
|
9640
9807
|
};
|
|
@@ -9956,58 +10123,351 @@
|
|
|
9956
10123
|
|
|
9957
10124
|
/**
|
|
9958
10125
|
*
|
|
9959
|
-
* @param
|
|
9960
|
-
* @param query
|
|
9961
|
-
* @param
|
|
10126
|
+
* @param root0
|
|
10127
|
+
* @param root0.query
|
|
10128
|
+
* @param root0.variables
|
|
10129
|
+
* @param root0.thoughtSpotHost
|
|
10130
|
+
* @param root0.isCompositeQuery
|
|
10131
|
+
*/
|
|
10132
|
+
async function graphqlQuery({ query, variables, thoughtSpotHost, isCompositeQuery = false, }) {
|
|
10133
|
+
const operationName = getOperationNameFromQuery(query);
|
|
10134
|
+
try {
|
|
10135
|
+
const response = await fetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
|
|
10136
|
+
method: 'POST',
|
|
10137
|
+
headers: {
|
|
10138
|
+
'content-type': 'application/json;charset=UTF-8',
|
|
10139
|
+
'x-requested-by': 'ThoughtSpot',
|
|
10140
|
+
accept: '*/*',
|
|
10141
|
+
'accept-language': 'en-us',
|
|
10142
|
+
},
|
|
10143
|
+
body: JSON.stringify({
|
|
10144
|
+
operationName,
|
|
10145
|
+
query,
|
|
10146
|
+
variables,
|
|
10147
|
+
}),
|
|
10148
|
+
credentials: 'include',
|
|
10149
|
+
});
|
|
10150
|
+
const result = await response.json();
|
|
10151
|
+
const dataValues = Object.values(result.data);
|
|
10152
|
+
return (isCompositeQuery) ? result.data : dataValues[0];
|
|
10153
|
+
}
|
|
10154
|
+
catch (error) {
|
|
10155
|
+
return error;
|
|
10156
|
+
}
|
|
10157
|
+
}
|
|
10158
|
+
|
|
10159
|
+
const getSourceDetailQuery = `
|
|
10160
|
+
query GetSourceDetail($ids: [GUID!]!) {
|
|
10161
|
+
getSourceDetailById(ids: $ids, type: LOGICAL_TABLE) {
|
|
10162
|
+
id
|
|
10163
|
+
name
|
|
10164
|
+
description
|
|
10165
|
+
authorName
|
|
10166
|
+
authorDisplayName
|
|
10167
|
+
isExternal
|
|
10168
|
+
type
|
|
10169
|
+
created
|
|
10170
|
+
modified
|
|
10171
|
+
columns {
|
|
10172
|
+
id
|
|
10173
|
+
name
|
|
10174
|
+
author
|
|
10175
|
+
authorDisplayName
|
|
10176
|
+
description
|
|
10177
|
+
dataType
|
|
10178
|
+
type
|
|
10179
|
+
modified
|
|
10180
|
+
ownerName
|
|
10181
|
+
owner
|
|
10182
|
+
dataRecency
|
|
10183
|
+
sources {
|
|
10184
|
+
tableId
|
|
10185
|
+
tableName
|
|
10186
|
+
columnId
|
|
10187
|
+
columnName
|
|
10188
|
+
__typename
|
|
10189
|
+
}
|
|
10190
|
+
synonyms
|
|
10191
|
+
cohortAnswerId
|
|
10192
|
+
__typename
|
|
10193
|
+
}
|
|
10194
|
+
relationships
|
|
10195
|
+
destinationRelationships
|
|
10196
|
+
dataSourceId
|
|
10197
|
+
__typename
|
|
10198
|
+
}
|
|
10199
|
+
}
|
|
10200
|
+
`;
|
|
10201
|
+
const sourceDetailCache = new Map();
|
|
10202
|
+
/**
|
|
10203
|
+
*
|
|
9962
10204
|
* @param thoughtSpotHost
|
|
10205
|
+
* @param sourceId
|
|
9963
10206
|
*/
|
|
9964
|
-
function
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
10207
|
+
async function getSourceDetail(thoughtSpotHost, sourceId) {
|
|
10208
|
+
if (sourceDetailCache.has(sourceId)) {
|
|
10209
|
+
return sourceDetailCache.get(sourceId);
|
|
10210
|
+
}
|
|
10211
|
+
const details = await graphqlQuery({
|
|
10212
|
+
query: getSourceDetailQuery,
|
|
10213
|
+
variables: {
|
|
10214
|
+
ids: [sourceId],
|
|
10215
|
+
},
|
|
10216
|
+
thoughtSpotHost,
|
|
10217
|
+
});
|
|
10218
|
+
const souceDetails = details[0];
|
|
10219
|
+
sourceDetailCache.set(sourceId, souceDetails);
|
|
10220
|
+
return souceDetails;
|
|
10221
|
+
}
|
|
10222
|
+
|
|
10223
|
+
const bachSessionId = `
|
|
10224
|
+
id {
|
|
10225
|
+
sessionId
|
|
10226
|
+
genNo
|
|
10227
|
+
acSession {
|
|
10228
|
+
sessionId
|
|
10229
|
+
genNo
|
|
10230
|
+
}
|
|
10231
|
+
}
|
|
10232
|
+
`;
|
|
10233
|
+
const getUnaggregatedAnswerSession = `
|
|
10234
|
+
mutation GetUnAggregatedAnswerSession($session: BachSessionIdInput!, $columns: [UserPointSelectionInput!]!) {
|
|
10235
|
+
Answer__getUnaggregatedAnswer(session: $session, columns: $columns) {
|
|
10236
|
+
${bachSessionId}
|
|
10237
|
+
answer {
|
|
10238
|
+
visualizations {
|
|
10239
|
+
... on TableViz {
|
|
10240
|
+
columns {
|
|
10241
|
+
column {
|
|
10242
|
+
id
|
|
10243
|
+
name
|
|
10244
|
+
referencedColumns {
|
|
10245
|
+
guid
|
|
10246
|
+
displayName
|
|
10247
|
+
}
|
|
10248
|
+
}
|
|
10249
|
+
}
|
|
10250
|
+
}
|
|
10251
|
+
}
|
|
10252
|
+
}
|
|
10253
|
+
}
|
|
10254
|
+
}
|
|
10255
|
+
`;
|
|
10256
|
+
const removeColumns = `
|
|
10257
|
+
mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!], $columnIds: [GUID!]) {
|
|
10258
|
+
Answer__removeColumns(
|
|
10259
|
+
session: $session
|
|
10260
|
+
logicalColumnIds: $logicalColumnIds
|
|
10261
|
+
columnIds: $columnIds
|
|
10262
|
+
) {
|
|
10263
|
+
${bachSessionId}
|
|
10264
|
+
}
|
|
10265
|
+
}
|
|
10266
|
+
`;
|
|
10267
|
+
const addColumns = `
|
|
10268
|
+
mutation AddColumns($session: BachSessionIdInput!, $columns: [AnswerColumnInfo!]!) {
|
|
10269
|
+
Answer__addColumn(session: $session, columns: $columns) {
|
|
10270
|
+
${bachSessionId}
|
|
10271
|
+
}
|
|
10272
|
+
}
|
|
10273
|
+
`;
|
|
10274
|
+
const getAnswerData = `
|
|
10275
|
+
query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
|
|
10276
|
+
getAnswer(session: $session) {
|
|
10277
|
+
${bachSessionId}
|
|
10278
|
+
answer {
|
|
10279
|
+
id
|
|
10280
|
+
visualizations {
|
|
10281
|
+
id
|
|
10282
|
+
... on TableViz {
|
|
10283
|
+
columns {
|
|
10284
|
+
column {
|
|
10285
|
+
id
|
|
10286
|
+
name
|
|
10287
|
+
type
|
|
10288
|
+
aggregationType
|
|
10289
|
+
dataType
|
|
10290
|
+
}
|
|
10291
|
+
}
|
|
10292
|
+
data(deadline: $deadline, pagination: $dataPaginationParams)
|
|
10293
|
+
}
|
|
10294
|
+
}
|
|
10295
|
+
}
|
|
10296
|
+
}
|
|
10297
|
+
}
|
|
10298
|
+
`;
|
|
10299
|
+
|
|
10300
|
+
// eslint-disable-next-line no-shadow
|
|
10301
|
+
var OperationType;
|
|
10302
|
+
(function (OperationType) {
|
|
10303
|
+
OperationType["GetChartWithData"] = "GetChartWithData";
|
|
10304
|
+
OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
|
|
10305
|
+
})(OperationType || (OperationType = {}));
|
|
10306
|
+
/**
|
|
10307
|
+
* Class representing the answer service provided with the
|
|
10308
|
+
* custom action payload. This service could be used to run
|
|
10309
|
+
* graphql queries in the context of the answer on which the
|
|
10310
|
+
* custom action was triggered.
|
|
10311
|
+
*
|
|
10312
|
+
* @example
|
|
10313
|
+
* ```js
|
|
10314
|
+
* embed.on(EmbedEvent.CustomAction, e => {
|
|
10315
|
+
* const underlying = await e.answerService.getUnderlyingDataForPoint([
|
|
10316
|
+
* 'col name 1'
|
|
10317
|
+
* ]);
|
|
10318
|
+
* const data = await underlying.fetchData(0, 100);
|
|
10319
|
+
* })
|
|
10320
|
+
* ```
|
|
10321
|
+
* @version
|
|
10322
|
+
* ThoughtSpot: 9.9.0.cl / SDK: 1.25.0
|
|
10323
|
+
*/
|
|
10324
|
+
class AnswerService {
|
|
10325
|
+
constructor(session, answer, thoughtSpotHost, selectedPoints) {
|
|
10326
|
+
this.session = session;
|
|
10327
|
+
this.answer = answer;
|
|
10328
|
+
this.thoughtSpotHost = thoughtSpotHost;
|
|
10329
|
+
this.selectedPoints = selectedPoints;
|
|
10330
|
+
this.session = removeTypename(session);
|
|
10331
|
+
}
|
|
10332
|
+
async getSourceDetail() {
|
|
10333
|
+
const sourceId = this.answer.sources[0].header.guid;
|
|
10334
|
+
return getSourceDetail(this.thoughtSpotHost, sourceId);
|
|
10335
|
+
}
|
|
10336
|
+
async removeColumns(columnIds) {
|
|
10337
|
+
return this.executeQuery(removeColumns, {
|
|
10338
|
+
logicalColumnIds: columnIds,
|
|
10339
|
+
});
|
|
10340
|
+
}
|
|
10341
|
+
async addColumns(columnIds) {
|
|
10342
|
+
return this.executeQuery(addColumns, {
|
|
10343
|
+
columns: columnIds.map((colId) => ({ logicalColumnId: colId })),
|
|
10344
|
+
});
|
|
10345
|
+
}
|
|
10346
|
+
async fetchData(offset = 0, size = 1000) {
|
|
10347
|
+
const { answer } = await this.executeQuery(getAnswerData, {
|
|
10348
|
+
deadline: 0,
|
|
10349
|
+
dataPaginationParams: {
|
|
10350
|
+
isClientPaginated: true,
|
|
10351
|
+
offset,
|
|
10352
|
+
size,
|
|
10353
|
+
},
|
|
10354
|
+
});
|
|
10355
|
+
const { columns, data } = answer.visualizations[0];
|
|
10356
|
+
return {
|
|
10357
|
+
columns,
|
|
10358
|
+
data,
|
|
10359
|
+
};
|
|
10360
|
+
}
|
|
10361
|
+
/**
|
|
10362
|
+
*
|
|
10363
|
+
* @param userLocale
|
|
10364
|
+
* @param omitInfo Omit the download Info on top of the CSV
|
|
10365
|
+
* @returns Response
|
|
10366
|
+
*/
|
|
10367
|
+
async fetchCSVBlob(userLocale = 'en-us', omitInfo = false) {
|
|
10368
|
+
if (omitInfo) {
|
|
10369
|
+
console.warn('omitInfo not supported yet.');
|
|
9985
10370
|
}
|
|
9986
|
-
|
|
9987
|
-
|
|
10371
|
+
const fetchUrl = `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&omitInfo=${omitInfo}`;
|
|
10372
|
+
return fetch(fetchUrl, {
|
|
10373
|
+
credentials: 'include',
|
|
10374
|
+
});
|
|
10375
|
+
}
|
|
10376
|
+
async getUnderlyingDataForPoint(outputColumnNames, selectedPoints) {
|
|
10377
|
+
if (!selectedPoints && !this.selectedPoints) {
|
|
10378
|
+
throw new Error('Needs to be triggered in context of a point');
|
|
9988
10379
|
}
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
10380
|
+
if (!selectedPoints) {
|
|
10381
|
+
selectedPoints = getSelectedPointsForUnderlyingDataQuery(this.selectedPoints);
|
|
10382
|
+
}
|
|
10383
|
+
const sourceDetail = await this.getSourceDetail();
|
|
10384
|
+
const ouputColumnGuids = getGuidsFromColumnNames(sourceDetail, outputColumnNames);
|
|
10385
|
+
const unAggAnswer = await graphqlQuery({
|
|
10386
|
+
query: getUnaggregatedAnswerSession,
|
|
10387
|
+
variables: {
|
|
10388
|
+
session: this.session,
|
|
10389
|
+
columns: selectedPoints,
|
|
10390
|
+
},
|
|
10391
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
10392
|
+
});
|
|
10393
|
+
const unaggAnswerSession = new AnswerService(unAggAnswer.id, unAggAnswer.answer, this.thoughtSpotHost);
|
|
10394
|
+
const currentColumns = new Set(unAggAnswer.answer.visualizations[0].columns
|
|
10395
|
+
.map((c) => c.column.referencedColumns[0].guid));
|
|
10396
|
+
const columnsToAdd = [...ouputColumnGuids].filter((col) => !currentColumns.has(col));
|
|
10397
|
+
if (columnsToAdd.length) {
|
|
10398
|
+
await unaggAnswerSession.addColumns(columnsToAdd);
|
|
10399
|
+
}
|
|
10400
|
+
const columnsToRemove = [...currentColumns].filter((col) => !ouputColumnGuids.has(col));
|
|
10401
|
+
if (columnsToRemove.length) {
|
|
10402
|
+
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
10403
|
+
}
|
|
10404
|
+
return unaggAnswerSession;
|
|
10405
|
+
}
|
|
10406
|
+
async executeQuery(query, variables) {
|
|
10407
|
+
const data = await graphqlQuery({
|
|
10408
|
+
query,
|
|
10409
|
+
variables: {
|
|
10410
|
+
session: this.session,
|
|
10411
|
+
...variables,
|
|
10412
|
+
},
|
|
10413
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
10414
|
+
isCompositeQuery: false,
|
|
10415
|
+
});
|
|
10416
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
10417
|
+
return data;
|
|
10418
|
+
}
|
|
10419
|
+
getSession() {
|
|
10420
|
+
return this.session;
|
|
10421
|
+
}
|
|
10422
|
+
}
|
|
10423
|
+
/**
|
|
10424
|
+
*
|
|
10425
|
+
* @param sourceDetail
|
|
10426
|
+
* @param colNames
|
|
10427
|
+
*/
|
|
10428
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
10429
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
10430
|
+
colSet[col.name] = col;
|
|
10431
|
+
return colSet;
|
|
10432
|
+
}, {});
|
|
10433
|
+
return new Set(colNames.map((colName) => {
|
|
10434
|
+
const col = cols[colName];
|
|
10435
|
+
return col.id;
|
|
10436
|
+
}));
|
|
10437
|
+
}
|
|
10438
|
+
/**
|
|
10439
|
+
*
|
|
10440
|
+
* @param selectedPoints
|
|
10441
|
+
*/
|
|
10442
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
10443
|
+
const underlyingDataPoint = [];
|
|
10444
|
+
/**
|
|
10445
|
+
*
|
|
10446
|
+
* @param colVal
|
|
10447
|
+
*/
|
|
10448
|
+
function addPointFromColVal(colVal) {
|
|
10449
|
+
const dataType = colVal.column.dataType;
|
|
10450
|
+
const id = colVal.column.id;
|
|
10451
|
+
let dataValue;
|
|
10452
|
+
if (dataType === 'DATE') {
|
|
10453
|
+
dataValue = [{
|
|
10454
|
+
epochRange: {
|
|
10455
|
+
startEpoch: colVal.value,
|
|
10456
|
+
},
|
|
10457
|
+
}];
|
|
9993
10458
|
}
|
|
9994
10459
|
else {
|
|
9995
|
-
|
|
9996
|
-
dataPaginationParams: {
|
|
9997
|
-
isClientPaginated: true,
|
|
9998
|
-
offset: offset * batchSize,
|
|
9999
|
-
size: batchSize,
|
|
10000
|
-
},
|
|
10001
|
-
};
|
|
10460
|
+
dataValue = [{ value: colVal.value }];
|
|
10002
10461
|
}
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10462
|
+
underlyingDataPoint.push({
|
|
10463
|
+
columnId: colVal.column.id,
|
|
10464
|
+
dataValue,
|
|
10006
10465
|
});
|
|
10007
|
-
}
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
};
|
|
10466
|
+
}
|
|
10467
|
+
selectedPoints.forEach((p) => {
|
|
10468
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
10469
|
+
});
|
|
10470
|
+
return underlyingDataPoint;
|
|
10011
10471
|
}
|
|
10012
10472
|
|
|
10013
10473
|
/**
|
|
@@ -10016,16 +10476,12 @@
|
|
|
10016
10476
|
* @param thoughtSpotHost
|
|
10017
10477
|
*/
|
|
10018
10478
|
function processCustomAction(e, thoughtSpotHost) {
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
answerService,
|
|
10026
|
-
};
|
|
10027
|
-
}
|
|
10028
|
-
return e;
|
|
10479
|
+
const { session, embedAnswerData, contextMenuPoints } = e.data;
|
|
10480
|
+
const answerService = new AnswerService(session, embedAnswerData, thoughtSpotHost, contextMenuPoints === null || contextMenuPoints === void 0 ? void 0 : contextMenuPoints.selectedPoints);
|
|
10481
|
+
return {
|
|
10482
|
+
...e,
|
|
10483
|
+
answerService,
|
|
10484
|
+
};
|
|
10029
10485
|
}
|
|
10030
10486
|
/**
|
|
10031
10487
|
*
|
|
@@ -10170,7 +10626,7 @@
|
|
|
10170
10626
|
});
|
|
10171
10627
|
}
|
|
10172
10628
|
|
|
10173
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.24.
|
|
10629
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.24.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^40.1.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"40 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
10174
10630
|
|
|
10175
10631
|
/**
|
|
10176
10632
|
* Copyright (c) 2022
|
|
@@ -10202,6 +10658,7 @@
|
|
|
10202
10658
|
class TsEmbed {
|
|
10203
10659
|
constructor(domSelector, viewConfig) {
|
|
10204
10660
|
this.isAppInitialized = false;
|
|
10661
|
+
this.embedComponentType = 'TsEmbed';
|
|
10205
10662
|
/**
|
|
10206
10663
|
* Should we encode URL Query Params using base64 encoding which thoughtspot
|
|
10207
10664
|
* will generate for embedding. This provides additional security to
|
|
@@ -10218,6 +10675,7 @@
|
|
|
10218
10675
|
* @param responder
|
|
10219
10676
|
*/
|
|
10220
10677
|
this.appInitCb = async (_, responder) => {
|
|
10678
|
+
var _a, _b;
|
|
10221
10679
|
let authToken = '';
|
|
10222
10680
|
if (this.embedConfig.authType === AuthType.TrustedAuthTokenCookieless) {
|
|
10223
10681
|
authToken = await getAuthenticaionToken(this.embedConfig);
|
|
@@ -10228,8 +10686,15 @@
|
|
|
10228
10686
|
data: {
|
|
10229
10687
|
customisations: getCustomisations(this.embedConfig, this.viewConfig),
|
|
10230
10688
|
authToken,
|
|
10231
|
-
runtimeFilterParams:
|
|
10689
|
+
runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
|
|
10690
|
+
? getRuntimeFilters(this.viewConfig.runtimeFilters)
|
|
10691
|
+
: null,
|
|
10692
|
+
hiddenHomepageModules: this.viewConfig.hiddenHomepageModules || [],
|
|
10693
|
+
reorderedHomepageModules: this.viewConfig.reorderedHomepageModules || [],
|
|
10232
10694
|
hostConfig: this.embedConfig.hostConfig,
|
|
10695
|
+
hiddenHomeLeftNavItems: ((_a = this.viewConfig) === null || _a === void 0 ? void 0 : _a.hiddenHomeLeftNavItems)
|
|
10696
|
+
? (_b = this.viewConfig) === null || _b === void 0 ? void 0 : _b.hiddenHomeLeftNavItems
|
|
10697
|
+
: [],
|
|
10233
10698
|
},
|
|
10234
10699
|
});
|
|
10235
10700
|
};
|
|
@@ -10257,8 +10722,8 @@
|
|
|
10257
10722
|
* Register APP_INIT event and sendback init payload
|
|
10258
10723
|
*/
|
|
10259
10724
|
this.registerAppInit = () => {
|
|
10260
|
-
this.on(exports.EmbedEvent.APP_INIT, this.appInitCb);
|
|
10261
|
-
this.on(exports.EmbedEvent.AuthExpire, this.updateAuthToken);
|
|
10725
|
+
this.on(exports.EmbedEvent.APP_INIT, this.appInitCb, { start: false }, true);
|
|
10726
|
+
this.on(exports.EmbedEvent.AuthExpire, this.updateAuthToken, { start: false }, true);
|
|
10262
10727
|
};
|
|
10263
10728
|
this.el = getDOMNode(domSelector);
|
|
10264
10729
|
// TODO: handle error
|
|
@@ -10273,6 +10738,10 @@
|
|
|
10273
10738
|
this.viewConfig = viewConfig;
|
|
10274
10739
|
this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
|
|
10275
10740
|
this.registerAppInit();
|
|
10741
|
+
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
10742
|
+
...viewConfig,
|
|
10743
|
+
embedComponentType: this.embedComponentType,
|
|
10744
|
+
});
|
|
10276
10745
|
}
|
|
10277
10746
|
/**
|
|
10278
10747
|
* Throws error encountered during initialization.
|
|
@@ -10403,6 +10872,9 @@
|
|
|
10403
10872
|
if (this.embedConfig.authType === AuthType.TrustedAuthTokenCookieless) {
|
|
10404
10873
|
queryParams[Param.cookieless] = true;
|
|
10405
10874
|
}
|
|
10875
|
+
if (this.embedConfig.pendoTrackingKey) {
|
|
10876
|
+
queryParams[Param.PendoTrackingKey] = this.embedConfig.pendoTrackingKey;
|
|
10877
|
+
}
|
|
10406
10878
|
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, hiddenTabs, visibleTabs, showAlerts, additionalFlags, locale, customizations, contextMenuTrigger, linkOverride, insertInToSlide, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, } = this.viewConfig;
|
|
10407
10879
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
10408
10880
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
@@ -10555,7 +11027,6 @@
|
|
|
10555
11027
|
this.insertIntoDOM(this.embedConfig.loginFailedMessage);
|
|
10556
11028
|
return;
|
|
10557
11029
|
}
|
|
10558
|
-
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE);
|
|
10559
11030
|
this.iFrame = this.iFrame || this.createIframeEl(url);
|
|
10560
11031
|
this.iFrame.addEventListener('load', () => {
|
|
10561
11032
|
nextInQueue();
|
|
@@ -10566,7 +11037,9 @@
|
|
|
10566
11037
|
},
|
|
10567
11038
|
type: exports.EmbedEvent.Load,
|
|
10568
11039
|
});
|
|
10569
|
-
uploadMixpanelEvent(MIXPANEL_EVENT.
|
|
11040
|
+
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE, {
|
|
11041
|
+
elWidth: this.iFrame.clientWidth,
|
|
11042
|
+
elHeight: this.iFrame.clientHeight,
|
|
10570
11043
|
timeTookToLoad: loadTimestamp - initTimestamp,
|
|
10571
11044
|
});
|
|
10572
11045
|
});
|
|
@@ -10709,6 +11182,8 @@
|
|
|
10709
11182
|
* @param messageType The message type
|
|
10710
11183
|
* @param callback A callback as a function
|
|
10711
11184
|
* @param options The message options
|
|
11185
|
+
* @param isSelf
|
|
11186
|
+
* @param isRegisteredBySDK
|
|
10712
11187
|
* @example
|
|
10713
11188
|
* ```js
|
|
10714
11189
|
* tsEmbed.on(EmbedEvent.Error, (data) => {
|
|
@@ -10724,7 +11199,10 @@
|
|
|
10724
11199
|
* });
|
|
10725
11200
|
* ```
|
|
10726
11201
|
*/
|
|
10727
|
-
on(messageType, callback, options = { start: false }) {
|
|
11202
|
+
on(messageType, callback, options = { start: false }, isRegisteredBySDK = false) {
|
|
11203
|
+
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_ON}-${messageType}`, {
|
|
11204
|
+
isRegisteredBySDK,
|
|
11205
|
+
});
|
|
10728
11206
|
if (this.isRendered) {
|
|
10729
11207
|
this.handleError('Please register event handlers before calling render');
|
|
10730
11208
|
}
|
|
@@ -10881,8 +11359,10 @@
|
|
|
10881
11359
|
let queryString = queryParams;
|
|
10882
11360
|
if (!this.viewConfig.excludeRuntimeFiltersfromURL) {
|
|
10883
11361
|
const runtimeFilters = this.viewConfig.runtimeFilters;
|
|
11362
|
+
const runtimeParameters = this.viewConfig.runtimeParameters;
|
|
11363
|
+
const parameterQuery = getRuntimeParameters(runtimeParameters || []);
|
|
10884
11364
|
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
10885
|
-
queryString = [filterQuery, queryParams].filter(Boolean).join('&');
|
|
11365
|
+
queryString = [parameterQuery, filterQuery, queryParams].filter(Boolean).join('&');
|
|
10886
11366
|
}
|
|
10887
11367
|
return this.getV1EmbedBasePath(queryString);
|
|
10888
11368
|
}
|
|
@@ -10905,7 +11385,6 @@
|
|
|
10905
11385
|
*/
|
|
10906
11386
|
on(messageType, callback, options = { start: false }) {
|
|
10907
11387
|
const eventType = this.getCompatibleEventType(messageType);
|
|
10908
|
-
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_ON}-${messageType}`);
|
|
10909
11388
|
return super.on(eventType, callback, options);
|
|
10910
11389
|
}
|
|
10911
11390
|
}
|
|
@@ -10919,6 +11398,7 @@
|
|
|
10919
11398
|
class SearchBarEmbed extends TsEmbed {
|
|
10920
11399
|
constructor(domSelector, viewConfig) {
|
|
10921
11400
|
super(domSelector);
|
|
11401
|
+
this.embedComponentType = 'SearchBarEmbed';
|
|
10922
11402
|
this.viewConfig = viewConfig;
|
|
10923
11403
|
}
|
|
10924
11404
|
/**
|
|
@@ -10929,7 +11409,7 @@
|
|
|
10929
11409
|
*/
|
|
10930
11410
|
getIFrameSrc() {
|
|
10931
11411
|
var _a;
|
|
10932
|
-
const { searchOptions, dataSource, dataSources } = this.viewConfig;
|
|
11412
|
+
const { searchOptions, dataSource, dataSources, useLastSelectedSources = false, } = this.viewConfig;
|
|
10933
11413
|
const path = 'search-bar-embed';
|
|
10934
11414
|
const queryParams = this.getBaseQueryParams();
|
|
10935
11415
|
queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
@@ -10945,7 +11425,10 @@
|
|
|
10945
11425
|
queryParams[Param.executeSearch] = true;
|
|
10946
11426
|
}
|
|
10947
11427
|
}
|
|
10948
|
-
queryParams[Param.UseLastSelectedDataSource] =
|
|
11428
|
+
queryParams[Param.UseLastSelectedDataSource] = useLastSelectedSources;
|
|
11429
|
+
if (dataSource || dataSources) {
|
|
11430
|
+
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
11431
|
+
}
|
|
10949
11432
|
queryParams[Param.searchEmbed] = true;
|
|
10950
11433
|
let query = '';
|
|
10951
11434
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
@@ -10994,6 +11477,7 @@
|
|
|
10994
11477
|
// eslint-disable-next-line no-useless-constructor
|
|
10995
11478
|
constructor(domSelector, viewConfig) {
|
|
10996
11479
|
super(domSelector, viewConfig);
|
|
11480
|
+
this.embedComponentType = 'SageEmbed';
|
|
10997
11481
|
}
|
|
10998
11482
|
/**
|
|
10999
11483
|
* Constructs a map of parameters to be passed on to the
|
|
@@ -11078,6 +11562,7 @@
|
|
|
11078
11562
|
class SearchEmbed extends TsEmbed {
|
|
11079
11563
|
constructor(domSelector, viewConfig) {
|
|
11080
11564
|
super(domSelector);
|
|
11565
|
+
this.embedComponentType = 'SearchEmbed';
|
|
11081
11566
|
this.viewConfig = viewConfig;
|
|
11082
11567
|
}
|
|
11083
11568
|
/**
|
|
@@ -11096,7 +11581,7 @@
|
|
|
11096
11581
|
}
|
|
11097
11582
|
getEmbedParams() {
|
|
11098
11583
|
var _a;
|
|
11099
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, dataPanelV2 = false, } = this.viewConfig;
|
|
11584
|
+
const { hideResults, expandAllDataSource, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, dataPanelV2 = false, useLastSelectedSources = false, runtimeParameters, } = this.viewConfig;
|
|
11100
11585
|
const queryParams = this.getBaseQueryParams();
|
|
11101
11586
|
queryParams[Param.HideActions] = [
|
|
11102
11587
|
...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
|
|
@@ -11125,13 +11610,19 @@
|
|
|
11125
11610
|
}
|
|
11126
11611
|
queryParams[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
11127
11612
|
queryParams[Param.DataSourceMode] = this.getDataSourceMode();
|
|
11128
|
-
queryParams[Param.UseLastSelectedDataSource] =
|
|
11613
|
+
queryParams[Param.UseLastSelectedDataSource] = useLastSelectedSources;
|
|
11614
|
+
if (dataSource || dataSources) {
|
|
11615
|
+
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
11616
|
+
}
|
|
11129
11617
|
queryParams[Param.searchEmbed] = true;
|
|
11130
11618
|
let query = '';
|
|
11131
11619
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
11132
11620
|
if (queryParamsString) {
|
|
11133
11621
|
query = `?${queryParamsString}`;
|
|
11134
11622
|
}
|
|
11623
|
+
const parameterQuery = getRuntimeParameters(runtimeParameters || []);
|
|
11624
|
+
if (parameterQuery)
|
|
11625
|
+
query += `&${parameterQuery}`;
|
|
11135
11626
|
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
11136
11627
|
if (filterQuery && !excludeRuntimeFiltersfromURL) {
|
|
11137
11628
|
query += `&${filterQuery}`;
|
|
@@ -11217,6 +11708,7 @@
|
|
|
11217
11708
|
constructor(domSelector, viewConfig) {
|
|
11218
11709
|
super(domSelector, viewConfig);
|
|
11219
11710
|
this.defaultHeight = '100%';
|
|
11711
|
+
this.embedComponentType = 'AppEmbed';
|
|
11220
11712
|
/**
|
|
11221
11713
|
* Set the iframe height as per the computed height received
|
|
11222
11714
|
* from the ThoughtSpot app.
|
|
@@ -11248,7 +11740,7 @@
|
|
|
11248
11740
|
* embedded Liveboard or visualization.
|
|
11249
11741
|
*/
|
|
11250
11742
|
getEmbedParams() {
|
|
11251
|
-
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, } = this.viewConfig;
|
|
11743
|
+
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideHomepageLeftNav = false, modularHomeExperience = false, } = this.viewConfig;
|
|
11252
11744
|
let params = {};
|
|
11253
11745
|
params[Param.EmbedApp] = true;
|
|
11254
11746
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
@@ -11272,6 +11764,8 @@
|
|
|
11272
11764
|
params[Param.EnableSearchAssist] = enableSearchAssist;
|
|
11273
11765
|
}
|
|
11274
11766
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
11767
|
+
params[Param.HideHomepageLeftNav] = hideHomepageLeftNav;
|
|
11768
|
+
params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
|
|
11275
11769
|
const queryParams = getQueryParamString(params, true);
|
|
11276
11770
|
return queryParams;
|
|
11277
11771
|
}
|
|
@@ -11281,8 +11775,8 @@
|
|
|
11281
11775
|
* @param pageId The ID of the page to be embedded.
|
|
11282
11776
|
*/
|
|
11283
11777
|
getIFrameSrc() {
|
|
11284
|
-
const { pageId, path } = this.viewConfig;
|
|
11285
|
-
const pageRoute = this.formatPath(path) || this.getPageRoute(pageId);
|
|
11778
|
+
const { pageId, path, modularHomeExperience } = this.viewConfig;
|
|
11779
|
+
const pageRoute = this.formatPath(path) || this.getPageRoute(pageId, modularHomeExperience);
|
|
11286
11780
|
let url = `${this.getRootIframeSrc()}/${pageRoute}`;
|
|
11287
11781
|
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
11288
11782
|
url = `${url}${tsPostHashParams}`;
|
|
@@ -11292,21 +11786,22 @@
|
|
|
11292
11786
|
* Gets the ThoughtSpot route of the page for a particular page ID.
|
|
11293
11787
|
*
|
|
11294
11788
|
* @param pageId The identifier for a page in the ThoughtSpot app.
|
|
11789
|
+
* @param modularHomeExperience
|
|
11295
11790
|
*/
|
|
11296
|
-
getPageRoute(pageId) {
|
|
11791
|
+
getPageRoute(pageId, modularHomeExperience = false) {
|
|
11297
11792
|
switch (pageId) {
|
|
11298
11793
|
case exports.Page.Search:
|
|
11299
11794
|
return 'answer';
|
|
11300
11795
|
case exports.Page.Answers:
|
|
11301
|
-
return 'answers';
|
|
11796
|
+
return modularHomeExperience ? 'home/answers' : 'answers';
|
|
11302
11797
|
case exports.Page.Liveboards:
|
|
11303
|
-
return 'pinboards';
|
|
11798
|
+
return modularHomeExperience ? 'home/liveboards' : 'pinboards';
|
|
11304
11799
|
case exports.Page.Pinboards:
|
|
11305
|
-
return 'pinboards';
|
|
11800
|
+
return modularHomeExperience ? 'home/liveboards' : 'pinboards';
|
|
11306
11801
|
case exports.Page.Data:
|
|
11307
11802
|
return 'data/tables';
|
|
11308
11803
|
case exports.Page.SpotIQ:
|
|
11309
|
-
return 'insights/results';
|
|
11804
|
+
return modularHomeExperience ? 'home/spotiq-analysis' : 'insights/results';
|
|
11310
11805
|
case exports.Page.Home:
|
|
11311
11806
|
default:
|
|
11312
11807
|
return 'home';
|
|
@@ -11403,6 +11898,7 @@
|
|
|
11403
11898
|
constructor(domSelector, viewConfig) {
|
|
11404
11899
|
super(domSelector, viewConfig);
|
|
11405
11900
|
this.defaultHeight = 500;
|
|
11901
|
+
this.embedComponentType = 'LiveboardEmbed';
|
|
11406
11902
|
/**
|
|
11407
11903
|
* Set the iframe height as per the computed height received
|
|
11408
11904
|
* from the ThoughtSpot app.
|
|
@@ -11435,7 +11931,7 @@
|
|
|
11435
11931
|
let params = {};
|
|
11436
11932
|
params[Param.EmbedApp] = true;
|
|
11437
11933
|
params = this.getBaseQueryParams(params);
|
|
11438
|
-
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, } = this.viewConfig;
|
|
11934
|
+
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, runtimeParameters, } = this.viewConfig;
|
|
11439
11935
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
11440
11936
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
11441
11937
|
if (fullHeight === true) {
|
|
@@ -11463,7 +11959,10 @@
|
|
|
11463
11959
|
if (hideTabPanel) {
|
|
11464
11960
|
params[Param.HideTabPanel] = hideTabPanel;
|
|
11465
11961
|
}
|
|
11466
|
-
|
|
11962
|
+
let queryParams = getQueryParamString(params, true);
|
|
11963
|
+
const parameterQuery = getRuntimeParameters(runtimeParameters || []);
|
|
11964
|
+
if (parameterQuery)
|
|
11965
|
+
queryParams += `&${parameterQuery}`;
|
|
11467
11966
|
return queryParams;
|
|
11468
11967
|
}
|
|
11469
11968
|
getIframeSuffixSrc(liveboardId, vizId, activeTabId) {
|
|
@@ -11679,9 +12178,11 @@
|
|
|
11679
12178
|
* return <LiveboardEmbed ref={ref} liveboardId={<id>} />
|
|
11680
12179
|
* }
|
|
11681
12180
|
* ```
|
|
11682
|
-
* @returns {React.MutableRefObject<TsEmbed>} ref
|
|
12181
|
+
* @returns {React.MutableRefObject<T extends TsEmbed>} ref
|
|
11683
12182
|
*/
|
|
11684
|
-
|
|
12183
|
+
function useEmbedRef() {
|
|
12184
|
+
return React__default['default'].useRef(null);
|
|
12185
|
+
}
|
|
11685
12186
|
|
|
11686
12187
|
exports.AppEmbed = AppEmbed$1;
|
|
11687
12188
|
exports.LiveboardEmbed = LiveboardEmbed$1;
|