@thoughtspot/visual-embed-sdk 1.10.0-alpha.0 → 1.10.0-alpha.3
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/CHANGELOG.md +48 -0
- package/README.md +50 -20
- package/dist/src/embed/app.d.ts +13 -1
- package/dist/src/embed/base.d.ts +1 -1
- package/dist/src/embed/liveboard.d.ts +15 -0
- package/dist/src/embed/pinboard.d.ts +91 -0
- package/dist/src/embed/ts-embed.d.ts +33 -4
- package/dist/src/react/index.d.ts +7 -5
- package/dist/src/react/util.d.ts +1 -1
- package/dist/src/types.d.ts +201 -7
- package/dist/src/utils/plugin.d.ts +0 -0
- package/dist/src/utils.d.ts +7 -0
- package/dist/src/v1/api.d.ts +19 -0
- package/dist/tsembed.es.js +262 -20
- package/dist/tsembed.js +262 -20
- package/lib/package.json +2 -2
- package/lib/src/embed/app.d.ts +13 -1
- package/lib/src/embed/app.js +11 -2
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +11 -10
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +1 -1
- package/lib/src/embed/base.js +1 -1
- package/lib/src/embed/base.spec.js +13 -1
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +15 -0
- package/lib/src/embed/liveboard.js +7 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +12 -1
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/pinboard.d.ts +91 -0
- package/lib/src/embed/pinboard.js +110 -0
- package/lib/src/embed/pinboard.js.map +1 -0
- package/lib/src/embed/pinboard.spec.js +1 -1
- package/lib/src/embed/pinboard.spec.js.map +1 -1
- package/lib/src/embed/search.js +2 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +33 -4
- package/lib/src/embed/ts-embed.js +61 -11
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +162 -8
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/react/index.d.ts +7 -5
- package/lib/src/react/index.js +10 -3
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +36 -6
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/react/util.d.ts +1 -1
- package/lib/src/react/util.js.map +1 -1
- package/lib/src/types.d.ts +201 -7
- package/lib/src/types.js +171 -4
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/plugin.d.ts +0 -0
- package/lib/src/utils/plugin.js +1 -0
- package/lib/src/utils/plugin.js.map +1 -0
- package/lib/src/utils.d.ts +7 -0
- package/lib/src/utils.js +9 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +263 -13
- package/package.json +2 -2
- package/src/embed/app.spec.ts +11 -10
- package/src/embed/app.ts +20 -2
- package/src/embed/base.spec.ts +14 -0
- package/src/embed/base.ts +1 -1
- package/src/embed/liveboard.spec.ts +14 -1
- package/src/embed/liveboard.ts +24 -0
- package/src/embed/pinboard.spec.ts +1 -1
- package/src/embed/search.ts +4 -1
- package/src/embed/ts-embed.spec.ts +228 -8
- package/src/embed/ts-embed.ts +97 -13
- package/src/react/index.spec.tsx +52 -5
- package/src/react/index.tsx +39 -22
- package/src/react/util.ts +2 -1
- package/src/types.ts +211 -5
- package/src/utils.ts +14 -0
package/dist/tsembed.es.js
CHANGED
|
@@ -108,6 +108,15 @@ const getEncodedQueryParamsString = (queryString) => {
|
|
|
108
108
|
const getOffsetTop = (element) => {
|
|
109
109
|
const rect = element.getBoundingClientRect();
|
|
110
110
|
return rect.top + window.scrollY;
|
|
111
|
+
};
|
|
112
|
+
const embedEventStatus = {
|
|
113
|
+
START: 'start',
|
|
114
|
+
END: 'end',
|
|
115
|
+
};
|
|
116
|
+
const setAttributes = (element, attributes) => {
|
|
117
|
+
Object.keys(attributes).forEach((key) => {
|
|
118
|
+
element.setAttribute(key, attributes[key].toString());
|
|
119
|
+
});
|
|
111
120
|
};
|
|
112
121
|
|
|
113
122
|
/**
|
|
@@ -277,6 +286,12 @@ var EmbedEvent;
|
|
|
277
286
|
* @version 1.5.0 or later
|
|
278
287
|
*/
|
|
279
288
|
EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick";
|
|
289
|
+
/**
|
|
290
|
+
* A click has been triggered on table/chart
|
|
291
|
+
* @return ContextMenuInputPoints - data point that is clicked
|
|
292
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
293
|
+
*/
|
|
294
|
+
EmbedEvent["VizPointClick"] = "vizPointClick";
|
|
280
295
|
/**
|
|
281
296
|
* An error has occurred.
|
|
282
297
|
* @return error - An error object or message
|
|
@@ -335,6 +350,108 @@ var EmbedEvent;
|
|
|
335
350
|
* @version 1.6.0 or later
|
|
336
351
|
*/
|
|
337
352
|
EmbedEvent["DialogClose"] = "dialog-close";
|
|
353
|
+
/**
|
|
354
|
+
* Emitted when a liveboard has completed rendering,
|
|
355
|
+
* this event can be used as a hook to trigger events on the
|
|
356
|
+
* rendered liveboard
|
|
357
|
+
* @version 1.9.1 or later
|
|
358
|
+
*/
|
|
359
|
+
EmbedEvent["LiveboardRendered"] = "PinboardRendered";
|
|
360
|
+
/**
|
|
361
|
+
* Emitted when answer is saved in the app
|
|
362
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
363
|
+
*/
|
|
364
|
+
EmbedEvent["Save"] = "save";
|
|
365
|
+
/**
|
|
366
|
+
* Emitted when the download action is triggered on an answer
|
|
367
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
368
|
+
*/
|
|
369
|
+
EmbedEvent["Download"] = "download";
|
|
370
|
+
/**
|
|
371
|
+
* Emitted when the Download as PDF action is triggered on an answer
|
|
372
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
373
|
+
*/
|
|
374
|
+
EmbedEvent["DownloadAsPdf"] = "downloadAsPdf";
|
|
375
|
+
/**
|
|
376
|
+
* Emitted when the Download as CSV action is triggered on an answer
|
|
377
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
378
|
+
*/
|
|
379
|
+
EmbedEvent["DownloadAsCsv"] = "downloadAsCsv";
|
|
380
|
+
/**
|
|
381
|
+
* Emitted when the Download as XLSX action is triggered on an answer
|
|
382
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
383
|
+
*/
|
|
384
|
+
EmbedEvent["DownloadAsXlsx"] = "downloadAsXlsx";
|
|
385
|
+
/**
|
|
386
|
+
* Emitted when an answer is deleted in the app
|
|
387
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
388
|
+
*/
|
|
389
|
+
EmbedEvent["AnswerDelete"] = "answerDelete";
|
|
390
|
+
/**
|
|
391
|
+
* Emitted when an answer is pinned to a Liveboard
|
|
392
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
393
|
+
*/
|
|
394
|
+
EmbedEvent["Pin"] = "pin";
|
|
395
|
+
/**
|
|
396
|
+
* Emitted when SpotIQ analysis is triggered
|
|
397
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
398
|
+
*/
|
|
399
|
+
EmbedEvent["SpotIQAnalyze"] = "spotIQAnalyze";
|
|
400
|
+
/**
|
|
401
|
+
* Emitted when a user shares an object with another user or group
|
|
402
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
403
|
+
*/
|
|
404
|
+
EmbedEvent["Share"] = "share";
|
|
405
|
+
/**
|
|
406
|
+
* Emitted when a user clicks the Include action to include a specific value or data on a chart or table
|
|
407
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
408
|
+
*/
|
|
409
|
+
EmbedEvent["DrillInclude"] = "context-menu-item-include";
|
|
410
|
+
/**
|
|
411
|
+
* Emitted when a user clicks the Exclude action to exclude a specific value or data on a chart or table
|
|
412
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
413
|
+
*/
|
|
414
|
+
EmbedEvent["DrillExclude"] = "context-menu-item-exclude";
|
|
415
|
+
/**
|
|
416
|
+
* Emitted when copied column value on the app
|
|
417
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
418
|
+
*/
|
|
419
|
+
EmbedEvent["CopyToClipboard"] = "context-menu-item-copy-to-clipboard";
|
|
420
|
+
/**
|
|
421
|
+
* Emitted when a user clicks the Update TML action
|
|
422
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
423
|
+
*/
|
|
424
|
+
EmbedEvent["UpdateTML"] = "updateTSL";
|
|
425
|
+
/**
|
|
426
|
+
* Emitted when a user clicks the Edit TML action
|
|
427
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
428
|
+
*/
|
|
429
|
+
EmbedEvent["EditTML"] = "editTSL";
|
|
430
|
+
/**
|
|
431
|
+
* Emitted when ExportTML trigger in answer on the app
|
|
432
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
433
|
+
*/
|
|
434
|
+
EmbedEvent["ExportTML"] = "exportTSL";
|
|
435
|
+
/**
|
|
436
|
+
* Emitted when an answer is saved as a view
|
|
437
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
438
|
+
*/
|
|
439
|
+
EmbedEvent["SaveAsView"] = "saveAsView";
|
|
440
|
+
/**
|
|
441
|
+
* Emitted when copy of existing answer on the app
|
|
442
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
443
|
+
*/
|
|
444
|
+
EmbedEvent["CopyAEdit"] = "copyAEdit";
|
|
445
|
+
/**
|
|
446
|
+
* Emitted when a user clicks Show underlying data on an answe
|
|
447
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
448
|
+
*/
|
|
449
|
+
EmbedEvent["ShowUnderlyingData"] = "showUnderlyingData";
|
|
450
|
+
/**
|
|
451
|
+
* Emitted when an answer is switched to a chart or table view
|
|
452
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
453
|
+
*/
|
|
454
|
+
EmbedEvent["AnswerChartSwitcher"] = "answerChartSwitcher";
|
|
338
455
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
339
456
|
/**
|
|
340
457
|
* Event types that can be triggered by the host application
|
|
@@ -438,6 +555,11 @@ var Param;
|
|
|
438
555
|
Param["ViewPortWidth"] = "viewPortWidth";
|
|
439
556
|
Param["VisibleActions"] = "visibleAction";
|
|
440
557
|
Param["CustomCSSUrl"] = "customCssUrl";
|
|
558
|
+
Param["DisableLoginRedirect"] = "disableLoginRedirect";
|
|
559
|
+
Param["visibleVizs"] = "pinboardVisibleVizs";
|
|
560
|
+
Param["LiveboardV2Enabled"] = "isPinboardV2Enabled";
|
|
561
|
+
Param["ShowAlerts"] = "showAlerts";
|
|
562
|
+
Param["Locale"] = "locale";
|
|
441
563
|
})(Param || (Param = {}));
|
|
442
564
|
/**
|
|
443
565
|
* The list of actions that can be performed on visual ThoughtSpot
|
|
@@ -447,30 +569,57 @@ var Param;
|
|
|
447
569
|
var Action;
|
|
448
570
|
(function (Action) {
|
|
449
571
|
Action["Save"] = "save";
|
|
572
|
+
/**
|
|
573
|
+
* @hidden
|
|
574
|
+
*/
|
|
450
575
|
Action["Update"] = "update";
|
|
576
|
+
/**
|
|
577
|
+
* @hidden
|
|
578
|
+
*/
|
|
451
579
|
Action["SaveUntitled"] = "saveUntitled";
|
|
452
580
|
Action["SaveAsView"] = "saveAsView";
|
|
453
581
|
Action["MakeACopy"] = "makeACopy";
|
|
454
582
|
Action["EditACopy"] = "editACopy";
|
|
455
583
|
Action["CopyLink"] = "embedDocument";
|
|
584
|
+
/**
|
|
585
|
+
* @hidden
|
|
586
|
+
*/
|
|
456
587
|
Action["ResetLayout"] = "resetLayout";
|
|
457
588
|
Action["Schedule"] = "subscription";
|
|
458
589
|
Action["SchedulesList"] = "schedule-list";
|
|
459
590
|
Action["Share"] = "share";
|
|
460
591
|
Action["AddFilter"] = "addFilter";
|
|
461
592
|
Action["ConfigureFilter"] = "configureFilter";
|
|
593
|
+
/**
|
|
594
|
+
* @hidden
|
|
595
|
+
*/
|
|
462
596
|
Action["AddFormula"] = "addFormula";
|
|
597
|
+
/**
|
|
598
|
+
* @hidden
|
|
599
|
+
*/
|
|
463
600
|
Action["SearchOnTop"] = "searchOnTop";
|
|
464
601
|
Action["SpotIQAnalyze"] = "spotIQAnalyze";
|
|
602
|
+
/**
|
|
603
|
+
* @hidden
|
|
604
|
+
*/
|
|
465
605
|
Action["ExplainInsight"] = "explainInsight";
|
|
606
|
+
/**
|
|
607
|
+
* @hidden
|
|
608
|
+
*/
|
|
466
609
|
Action["SpotIQFollow"] = "spotIQFollow";
|
|
467
610
|
Action["ShareViz"] = "shareViz";
|
|
611
|
+
/**
|
|
612
|
+
* @hidden
|
|
613
|
+
*/
|
|
468
614
|
Action["ReplaySearch"] = "replaySearch";
|
|
469
615
|
Action["ShowUnderlyingData"] = "showUnderlyingData";
|
|
470
616
|
Action["Download"] = "download";
|
|
471
617
|
Action["DownloadAsPdf"] = "downloadAsPdf";
|
|
472
618
|
Action["DownloadAsCsv"] = "downloadAsCSV";
|
|
473
619
|
Action["DownloadAsXlsx"] = "downloadAsXLSX";
|
|
620
|
+
/**
|
|
621
|
+
* @hidden
|
|
622
|
+
*/
|
|
474
623
|
Action["DownloadTrace"] = "downloadTrace";
|
|
475
624
|
Action["ExportTML"] = "exportTSL";
|
|
476
625
|
Action["ImportTML"] = "importTSL";
|
|
@@ -481,18 +630,39 @@ var Action;
|
|
|
481
630
|
Action["Edit"] = "edit";
|
|
482
631
|
Action["EditTitle"] = "editTitle";
|
|
483
632
|
Action["Remove"] = "delete";
|
|
633
|
+
/**
|
|
634
|
+
* @hidden
|
|
635
|
+
*/
|
|
484
636
|
Action["Ungroup"] = "ungroup";
|
|
637
|
+
/**
|
|
638
|
+
* @hidden
|
|
639
|
+
*/
|
|
485
640
|
Action["Describe"] = "describe";
|
|
641
|
+
/**
|
|
642
|
+
* @hidden
|
|
643
|
+
*/
|
|
486
644
|
Action["Relate"] = "relate";
|
|
645
|
+
/**
|
|
646
|
+
* @hidden
|
|
647
|
+
*/
|
|
487
648
|
Action["CustomizeHeadlines"] = "customizeHeadlines";
|
|
488
649
|
/**
|
|
489
650
|
* @hidden
|
|
490
651
|
*/
|
|
491
652
|
Action["PinboardInfo"] = "pinboardInfo";
|
|
492
653
|
Action["LiveboardInfo"] = "pinboardInfo";
|
|
654
|
+
/**
|
|
655
|
+
* @hidden
|
|
656
|
+
*/
|
|
493
657
|
Action["SendAnswerFeedback"] = "sendFeedback";
|
|
658
|
+
/**
|
|
659
|
+
* @hidden
|
|
660
|
+
*/
|
|
494
661
|
Action["DownloadEmbraceQueries"] = "downloadEmbraceQueries";
|
|
495
662
|
Action["Pin"] = "pin";
|
|
663
|
+
/**
|
|
664
|
+
* @hidden
|
|
665
|
+
*/
|
|
496
666
|
Action["AnalysisInfo"] = "analysisInfo";
|
|
497
667
|
Action["Subscription"] = "subscription";
|
|
498
668
|
Action["Explore"] = "explore";
|
|
@@ -500,16 +670,18 @@ var Action;
|
|
|
500
670
|
Action["DrillExclude"] = "context-menu-item-exclude";
|
|
501
671
|
Action["CopyToClipboard"] = "context-menu-item-copy-to-clipboard";
|
|
502
672
|
Action["CopyAndEdit"] = "context-menu-item-copy-and-edit";
|
|
673
|
+
/**
|
|
674
|
+
* @hidden
|
|
675
|
+
*/
|
|
503
676
|
Action["DrillEdit"] = "context-menu-item-edit";
|
|
504
677
|
Action["EditMeasure"] = "context-menu-item-edit-measure";
|
|
505
678
|
Action["Separator"] = "context-menu-item-separator";
|
|
679
|
+
/**
|
|
680
|
+
* @hidden
|
|
681
|
+
*/
|
|
506
682
|
Action["DrillDown"] = "DRILL";
|
|
507
683
|
Action["RequestAccess"] = "requestAccess";
|
|
508
684
|
Action["QueryDetailsButtons"] = "queryDetailsButtons";
|
|
509
|
-
/**
|
|
510
|
-
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
511
|
-
*/
|
|
512
|
-
Action["Monitor"] = "createMonitor";
|
|
513
685
|
/**
|
|
514
686
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
515
687
|
*/
|
|
@@ -526,6 +698,10 @@ var Action;
|
|
|
526
698
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
527
699
|
*/
|
|
528
700
|
Action["EditDetails"] = "editDetails";
|
|
701
|
+
/**
|
|
702
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
703
|
+
*/
|
|
704
|
+
Action["CreateMonitor"] = "createMonitor";
|
|
529
705
|
})(Action || (Action = {}));
|
|
530
706
|
// eslint-disable-next-line no-shadow
|
|
531
707
|
var OperationType;
|
|
@@ -8745,7 +8921,7 @@ const prefetch = (url) => {
|
|
|
8745
8921
|
}
|
|
8746
8922
|
};
|
|
8747
8923
|
/**
|
|
8748
|
-
* Initialize the ThoughtSpot embed
|
|
8924
|
+
* Initialize the ThoughtSpot embed SDK globally and perform
|
|
8749
8925
|
* authentication if applicable.
|
|
8750
8926
|
* @param embedConfig The configuration object containing ThoughtSpot host,
|
|
8751
8927
|
* authentication mechanism and so on.
|
|
@@ -8899,7 +9075,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
8899
9075
|
}
|
|
8900
9076
|
}
|
|
8901
9077
|
|
|
8902
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.10.0-alpha.
|
|
9078
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.10.0-alpha.3";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/**"];var exports={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",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":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",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","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","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","mixpanel-browser":"^2.41.0"};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","@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","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.1.0","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":"4.1.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-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",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-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","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,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};
|
|
8903
9079
|
|
|
8904
9080
|
/**
|
|
8905
9081
|
* Copyright (c) 2022
|
|
@@ -8910,6 +9086,10 @@ var name="@thoughtspot/visual-embed-sdk";var version="1.10.0-alpha.0";var descri
|
|
|
8910
9086
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8911
9087
|
*/
|
|
8912
9088
|
const { version: version$1 } = pkgInfo;
|
|
9089
|
+
/**
|
|
9090
|
+
* Global prefix for all Thoughtspot postHash Params.
|
|
9091
|
+
*/
|
|
9092
|
+
const THOUGHTSPOT_PARAM_PREFIX = 'ts-';
|
|
8913
9093
|
/**
|
|
8914
9094
|
* The event id map from v2 event names to v1 event id
|
|
8915
9095
|
* v1 events are the classic embed events implemented in Blink v1
|
|
@@ -9062,10 +9242,14 @@ class TsEmbed {
|
|
|
9062
9242
|
queryParams[Param.ViewPortHeight] = window.innerHeight;
|
|
9063
9243
|
queryParams[Param.ViewPortWidth] = window.innerWidth;
|
|
9064
9244
|
queryParams[Param.Version] = version$1;
|
|
9245
|
+
if (this.embedConfig.disableLoginRedirect === true ||
|
|
9246
|
+
this.embedConfig.autoLogin === true) {
|
|
9247
|
+
queryParams[Param.DisableLoginRedirect] = true;
|
|
9248
|
+
}
|
|
9065
9249
|
if (this.embedConfig.customCssUrl) {
|
|
9066
9250
|
queryParams[Param.CustomCSSUrl] = this.embedConfig.customCssUrl;
|
|
9067
9251
|
}
|
|
9068
|
-
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, additionalFlags, } = this.viewConfig;
|
|
9252
|
+
const { disabledActions, disabledActionReason, hiddenActions, visibleActions, showAlerts, additionalFlags, locale, } = this.viewConfig;
|
|
9069
9253
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
9070
9254
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
9071
9255
|
return queryParams;
|
|
@@ -9082,6 +9266,12 @@ class TsEmbed {
|
|
|
9082
9266
|
if (Array.isArray(visibleActions)) {
|
|
9083
9267
|
queryParams[Param.VisibleActions] = visibleActions;
|
|
9084
9268
|
}
|
|
9269
|
+
if (showAlerts !== undefined) {
|
|
9270
|
+
queryParams[Param.ShowAlerts] = showAlerts;
|
|
9271
|
+
}
|
|
9272
|
+
if (locale !== undefined) {
|
|
9273
|
+
queryParams[Param.Locale] = locale;
|
|
9274
|
+
}
|
|
9085
9275
|
if (additionalFlags && additionalFlags.constructor.name === 'Object') {
|
|
9086
9276
|
Object.assign(queryParams, additionalFlags);
|
|
9087
9277
|
}
|
|
@@ -9114,7 +9304,7 @@ class TsEmbed {
|
|
|
9114
9304
|
* @param url
|
|
9115
9305
|
* @param frameOptions
|
|
9116
9306
|
*/
|
|
9117
|
-
renderIFrame(url, frameOptions) {
|
|
9307
|
+
renderIFrame(url, frameOptions = {}) {
|
|
9118
9308
|
if (this.isError) {
|
|
9119
9309
|
return;
|
|
9120
9310
|
}
|
|
@@ -9145,8 +9335,10 @@ class TsEmbed {
|
|
|
9145
9335
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9146
9336
|
// @ts-ignore
|
|
9147
9337
|
this.iFrame.mozallowfullscreen = true;
|
|
9148
|
-
const
|
|
9149
|
-
const
|
|
9338
|
+
const { height: frameHeight, width: frameWidth, ...restParams } = frameOptions;
|
|
9339
|
+
const width = getCssDimension(frameWidth || DEFAULT_EMBED_WIDTH);
|
|
9340
|
+
const height = getCssDimension(frameWidth || DEFAULT_EMBED_HEIGHT);
|
|
9341
|
+
setAttributes(this.iFrame, restParams);
|
|
9150
9342
|
this.iFrame.style.width = `${width}`;
|
|
9151
9343
|
this.iFrame.style.height = `${height}`;
|
|
9152
9344
|
this.iFrame.style.border = '0';
|
|
@@ -9197,9 +9389,18 @@ class TsEmbed {
|
|
|
9197
9389
|
*/
|
|
9198
9390
|
executeCallbacks(eventType, data, eventPort) {
|
|
9199
9391
|
const callbacks = this.eventHandlerMap.get(eventType) || [];
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9392
|
+
const dataStatus = (data === null || data === void 0 ? void 0 : data.status) || embedEventStatus.END;
|
|
9393
|
+
callbacks.forEach((callbackObj) => {
|
|
9394
|
+
if ((callbackObj.options.start &&
|
|
9395
|
+
dataStatus === embedEventStatus.START) || // When start status is true it trigger only start releated payload
|
|
9396
|
+
(!callbackObj.options.start &&
|
|
9397
|
+
dataStatus === embedEventStatus.END) // When start status is false it trigger only end releated payload
|
|
9398
|
+
) {
|
|
9399
|
+
callbackObj.callback(data, (payload) => {
|
|
9400
|
+
this.triggerEventOnPort(eventPort, payload);
|
|
9401
|
+
});
|
|
9402
|
+
}
|
|
9403
|
+
});
|
|
9203
9404
|
}
|
|
9204
9405
|
/**
|
|
9205
9406
|
* Returns the ThoughtSpot hostname or IP address.
|
|
@@ -9256,14 +9457,15 @@ class TsEmbed {
|
|
|
9256
9457
|
* sends an event of a particular message type to the host application.
|
|
9257
9458
|
*
|
|
9258
9459
|
* @param messageType The message type
|
|
9259
|
-
* @param callback A callback function
|
|
9460
|
+
* @param callback A callback as a function
|
|
9461
|
+
* @param options The message options
|
|
9260
9462
|
*/
|
|
9261
|
-
on(messageType, callback) {
|
|
9463
|
+
on(messageType, callback, options = { start: false }) {
|
|
9262
9464
|
if (this.isRendered) {
|
|
9263
9465
|
this.handleError('Please register event handlers before calling render');
|
|
9264
9466
|
}
|
|
9265
9467
|
const callbacks = this.eventHandlerMap.get(messageType) || [];
|
|
9266
|
-
callbacks.push(callback);
|
|
9468
|
+
callbacks.push({ options, callback });
|
|
9267
9469
|
this.eventHandlerMap.set(messageType, callbacks);
|
|
9268
9470
|
return this;
|
|
9269
9471
|
}
|
|
@@ -9310,6 +9512,30 @@ class TsEmbed {
|
|
|
9310
9512
|
this.isRendered = true;
|
|
9311
9513
|
return this;
|
|
9312
9514
|
}
|
|
9515
|
+
/**
|
|
9516
|
+
* Get the Post Url Params for THOUGHTSPOT from the current
|
|
9517
|
+
* host app URL.
|
|
9518
|
+
* THOUGHTSPOT URL params starts with a prefix "ts-"
|
|
9519
|
+
*/
|
|
9520
|
+
getThoughtSpotPostUrlParams() {
|
|
9521
|
+
const urlHash = window.location.hash;
|
|
9522
|
+
const queryParams = window.location.search;
|
|
9523
|
+
const postHashParams = urlHash.split('?');
|
|
9524
|
+
const postURLParams = postHashParams[postHashParams.length - 1];
|
|
9525
|
+
const queryParamsObj = new URLSearchParams(queryParams);
|
|
9526
|
+
const postURLParamsObj = new URLSearchParams(postURLParams);
|
|
9527
|
+
const params = new URLSearchParams();
|
|
9528
|
+
const addKeyValuePairCb = (value, key) => {
|
|
9529
|
+
if (key.startsWith(THOUGHTSPOT_PARAM_PREFIX)) {
|
|
9530
|
+
params.append(key, value);
|
|
9531
|
+
}
|
|
9532
|
+
};
|
|
9533
|
+
queryParamsObj.forEach(addKeyValuePairCb);
|
|
9534
|
+
postURLParamsObj.forEach(addKeyValuePairCb);
|
|
9535
|
+
let tsParams = params.toString();
|
|
9536
|
+
tsParams = tsParams ? `?${tsParams}` : '';
|
|
9537
|
+
return tsParams;
|
|
9538
|
+
}
|
|
9313
9539
|
}
|
|
9314
9540
|
/**
|
|
9315
9541
|
* Base class for embedding v1 experience
|
|
@@ -9375,6 +9601,10 @@ var Page;
|
|
|
9375
9601
|
* Data management page
|
|
9376
9602
|
*/
|
|
9377
9603
|
Page["Data"] = "data";
|
|
9604
|
+
/**
|
|
9605
|
+
* SpotIQ listing page
|
|
9606
|
+
*/
|
|
9607
|
+
Page["SpotIQ"] = "spotiq";
|
|
9378
9608
|
})(Page || (Page = {}));
|
|
9379
9609
|
/**
|
|
9380
9610
|
* Embeds full ThoughtSpot experience in a host application.
|
|
@@ -9391,13 +9621,14 @@ class AppEmbed extends V1Embed {
|
|
|
9391
9621
|
*/
|
|
9392
9622
|
getEmbedParams() {
|
|
9393
9623
|
const params = this.getBaseQueryParams();
|
|
9394
|
-
const { tag, hideObjects } = this.viewConfig;
|
|
9624
|
+
const { tag, hideObjects, liveboardV2 = false } = this.viewConfig;
|
|
9395
9625
|
if (tag) {
|
|
9396
9626
|
params[Param.Tag] = tag;
|
|
9397
9627
|
}
|
|
9398
9628
|
if (hideObjects && hideObjects.length) {
|
|
9399
9629
|
params[Param.HideObjects] = JSON.stringify(hideObjects);
|
|
9400
9630
|
}
|
|
9631
|
+
params[Param.LiveboardV2Enabled] = liveboardV2;
|
|
9401
9632
|
const queryParams = getQueryParamString(params, true);
|
|
9402
9633
|
return queryParams;
|
|
9403
9634
|
}
|
|
@@ -9411,7 +9642,9 @@ class AppEmbed extends V1Embed {
|
|
|
9411
9642
|
const queryString = [filterQuery, queryParams]
|
|
9412
9643
|
.filter(Boolean)
|
|
9413
9644
|
.join('&');
|
|
9414
|
-
|
|
9645
|
+
let url = `${this.getV1EmbedBasePath(queryString, this.viewConfig.showPrimaryNavbar, this.viewConfig.disableProfileAndHelp, true)}/${pageId}`;
|
|
9646
|
+
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
9647
|
+
url = `${url}${tsPostHashParams}`;
|
|
9415
9648
|
return url;
|
|
9416
9649
|
}
|
|
9417
9650
|
/**
|
|
@@ -9430,6 +9663,8 @@ class AppEmbed extends V1Embed {
|
|
|
9430
9663
|
return 'pinboards';
|
|
9431
9664
|
case Page.Data:
|
|
9432
9665
|
return 'data/tables';
|
|
9666
|
+
case Page.SpotIQ:
|
|
9667
|
+
return 'insights/results';
|
|
9433
9668
|
case Page.Home:
|
|
9434
9669
|
default:
|
|
9435
9670
|
return 'home';
|
|
@@ -9525,7 +9760,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
9525
9760
|
*/
|
|
9526
9761
|
getEmbedParams() {
|
|
9527
9762
|
const params = this.getBaseQueryParams();
|
|
9528
|
-
const { enableVizTransformations, fullHeight, defaultHeight, } = this.viewConfig;
|
|
9763
|
+
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2 = false, } = this.viewConfig;
|
|
9529
9764
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval ||
|
|
9530
9765
|
this.viewConfig.preventPinboardFilterRemoval;
|
|
9531
9766
|
if (fullHeight === true) {
|
|
@@ -9540,7 +9775,11 @@ class LiveboardEmbed extends V1Embed {
|
|
|
9540
9775
|
if (preventLiveboardFilterRemoval) {
|
|
9541
9776
|
params[Param.preventLiveboardFilterRemoval] = true;
|
|
9542
9777
|
}
|
|
9778
|
+
if (visibleVizs) {
|
|
9779
|
+
params[Param.visibleVizs] = visibleVizs;
|
|
9780
|
+
}
|
|
9543
9781
|
params[Param.livedBoardEmbed] = true;
|
|
9782
|
+
params[Param.LiveboardV2Enabled] = liveboardV2;
|
|
9544
9783
|
const queryParams = getQueryParamString(params, true);
|
|
9545
9784
|
return queryParams;
|
|
9546
9785
|
}
|
|
@@ -9562,6 +9801,8 @@ class LiveboardEmbed extends V1Embed {
|
|
|
9562
9801
|
if (vizId) {
|
|
9563
9802
|
url = `${url}/${vizId}`;
|
|
9564
9803
|
}
|
|
9804
|
+
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
9805
|
+
url = `${url}${tsPostHashParams}`;
|
|
9565
9806
|
return url;
|
|
9566
9807
|
}
|
|
9567
9808
|
/**
|
|
@@ -9673,7 +9914,8 @@ class SearchEmbed extends TsEmbed {
|
|
|
9673
9914
|
if (queryParamsString) {
|
|
9674
9915
|
query = `?${queryParamsString}`;
|
|
9675
9916
|
}
|
|
9676
|
-
|
|
9917
|
+
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
9918
|
+
return `${this.getEmbedBasePath(query)}/${answerPath}${tsPostHashParams}`;
|
|
9677
9919
|
}
|
|
9678
9920
|
/**
|
|
9679
9921
|
* Render the embedded ThoughtSpot search
|