@thoughtspot/visual-embed-sdk 1.13.0 → 1.14.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/dist/src/embed/app.d.ts +4 -3
  3. package/dist/src/embed/base.d.ts +1 -1
  4. package/dist/src/embed/liveboard.d.ts +6 -8
  5. package/dist/src/embed/pinboard.d.ts +91 -0
  6. package/dist/src/embed/search.d.ts +1 -1
  7. package/dist/src/embed/ts-embed.d.ts +4 -4
  8. package/dist/src/types.d.ts +83 -76
  9. package/dist/src/utils/authService.d.ts +1 -0
  10. package/dist/src/utils/plugin.d.ts +0 -0
  11. package/dist/src/v1/api.d.ts +19 -0
  12. package/dist/tsembed.es.js +103 -76
  13. package/dist/tsembed.js +103 -76
  14. package/lib/package.json +1 -1
  15. package/lib/src/auth.js +8 -2
  16. package/lib/src/auth.js.map +1 -1
  17. package/lib/src/auth.spec.js +18 -0
  18. package/lib/src/auth.spec.js.map +1 -1
  19. package/lib/src/embed/app.d.ts +4 -3
  20. package/lib/src/embed/app.js +2 -1
  21. package/lib/src/embed/app.js.map +1 -1
  22. package/lib/src/embed/base.d.ts +1 -1
  23. package/lib/src/embed/base.js +1 -1
  24. package/lib/src/embed/liveboard.d.ts +6 -8
  25. package/lib/src/embed/liveboard.js.map +1 -1
  26. package/lib/src/embed/pinboard.d.ts +91 -0
  27. package/lib/src/embed/pinboard.js +110 -0
  28. package/lib/src/embed/pinboard.js.map +1 -0
  29. package/lib/src/embed/search.d.ts +1 -1
  30. package/lib/src/embed/ts-embed.d.ts +4 -4
  31. package/lib/src/types.d.ts +83 -76
  32. package/lib/src/types.js +73 -68
  33. package/lib/src/types.js.map +1 -1
  34. package/lib/src/utils/authService.d.ts +1 -0
  35. package/lib/src/utils/authService.js +13 -0
  36. package/lib/src/utils/authService.js.map +1 -1
  37. package/lib/src/utils/authService.spec.js +15 -1
  38. package/lib/src/utils/authService.spec.js.map +1 -1
  39. package/lib/src/utils/plugin.d.ts +0 -0
  40. package/lib/src/utils/plugin.js +1 -0
  41. package/lib/src/utils/plugin.js.map +1 -0
  42. package/lib/src/utils/processData.js +7 -5
  43. package/lib/src/utils/processData.js.map +1 -1
  44. package/lib/src/utils/processData.spec.js +14 -0
  45. package/lib/src/utils/processData.spec.js.map +1 -1
  46. package/lib/src/visual-embed-sdk.d.ts +99 -93
  47. package/package.json +1 -1
  48. package/src/auth.spec.ts +39 -0
  49. package/src/auth.ts +11 -5
  50. package/src/embed/app.ts +4 -3
  51. package/src/embed/base.ts +1 -1
  52. package/src/embed/liveboard.ts +6 -8
  53. package/src/embed/search.ts +1 -1
  54. package/src/embed/ts-embed.ts +4 -4
  55. package/src/types.ts +83 -76
  56. package/src/utils/authService.spec.ts +21 -0
  57. package/src/utils/authService.ts +20 -0
  58. package/src/utils/processData.spec.ts +17 -0
  59. package/src/utils/processData.ts +7 -5
package/src/types.ts CHANGED
@@ -14,9 +14,13 @@
14
14
  // eslint-disable-next-line no-shadow
15
15
  export enum AuthType {
16
16
  /**
17
- * No authentication. Use this only for testing purposes.
17
+ * No authentication on the SDK. Passthrough to the embedded App. Alias for `Passthrough`.
18
18
  */
19
19
  None = 'None',
20
+ /**
21
+ * No authentication on the SDK. Passthrough to the embedded App.
22
+ */
23
+ Passthrough = 'None',
20
24
  /**
21
25
  * SSO using SAML
22
26
  * @deprecated Use {@link SAML} instead
@@ -130,7 +134,7 @@ export interface EmbedConfig {
130
134
  * terminated.
131
135
  *
132
136
  * Eg: "/dashboard", "#/foo" [Do not include the host]
133
- * @version SDK: 1.10.2 | ThoughtSpot: *
137
+ * @version SDK: 1.10.2 | 8.2.0.cl, 8.4.1-sw
134
138
  */
135
139
  redirectPath?: string;
136
140
 
@@ -163,14 +167,14 @@ export interface EmbedConfig {
163
167
  /**
164
168
  * Disable redirection to the login page when the embedded session expires
165
169
  * This flag is typically used alongside the combination of auth modes such as {@link AuthType.AuthServer} and auto login behavior {@link EmbedConfig.autoLogin}
166
- * @version SDK: 1.9.3 | ThoughtSpot: 8.1.0.cl
170
+ * @version SDK: 1.9.3 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
167
171
  * @default false
168
172
  */
169
173
  disableLoginRedirect?: boolean;
170
174
 
171
175
  /**
172
176
  * This message is displayed on the embed view when the login fails.
173
- * @version 1.10.1 | ThoughtSpot: *
177
+ * @version SDK: 1.10.1 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
174
178
  */
175
179
  loginFailedMessage?: string;
176
180
 
@@ -184,7 +188,7 @@ export interface EmbedConfig {
184
188
  * When there are multiple embeds, queue the render of embed to start
185
189
  * after the previous embed's render is complete. This helps in the load performance
186
190
  * by decreasing the load on the browser.
187
- * @version 1.5.0 or later
191
+ * @Version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
188
192
  * @default false
189
193
  */
190
194
  queueMultiRenders?: boolean;
@@ -192,7 +196,7 @@ export interface EmbedConfig {
192
196
  /**
193
197
  * Dynamic CSS Url to be injected in the loaded application.
194
198
  * You would also need to set `style-src` in the CSP settings.
195
- * @version 1.6.0 or later
199
+ * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
196
200
  * @default ''
197
201
  */
198
202
  customCssUrl?: string;
@@ -201,18 +205,20 @@ export interface EmbedConfig {
201
205
  * and should be avoided. Listen to the NO_COOKIE_ACCESS event to handle the situation.
202
206
  *
203
207
  * This is slightly slower than letting the browser handle the cookie check, as it involves an extra network call.
204
- * @version SDK: 1.10.4 | ThoughtSpot: *
208
+ * @version SDK: 1.10.4 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
205
209
  */
206
210
  detectCookieAccessSlow?: boolean;
207
211
  /**
208
212
  * Hide beta alert warning message for SearchEmbed.
209
213
  *
210
- * @version SDK: 1.12.0 | ThoughtSpot: *
214
+ * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw*
211
215
  */
212
216
  suppressSearchEmbedBetaWarning?: boolean;
213
217
 
214
218
  /**
215
- * Custom style params for embed Config
219
+ * Custom style params for embed Config.
220
+ *
221
+ * @version SDK: 1.16.0 | ThoughtSpot: 8.8.0.cl, 8.8.1-sw
216
222
  */
217
223
  customisations?: CustomisationsInterface;
218
224
  }
@@ -392,7 +398,7 @@ export enum EmbedEvent {
392
398
  /**
393
399
  * One or more data columns have been selected.
394
400
  * @return columnIds - the list of columns
395
- * @version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl
401
+ * @version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
396
402
  */
397
403
  AddRemoveColumns = 'addRemoveColumns',
398
404
  /**
@@ -404,13 +410,13 @@ export enum EmbedEvent {
404
410
  /**
405
411
  * A double click has been triggered on table/chart
406
412
  * @return ContextMenuInputPoints - data point that is double clicked
407
- * @version 1.5.0 or later
413
+ * @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
408
414
  */
409
415
  VizPointDoubleClick = 'vizPointDoubleClick',
410
416
  /**
411
417
  * A click has been triggered on table/chart
412
418
  * @return ContextMenuInputPoints - data point that is clicked
413
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
419
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
414
420
  */
415
421
  VizPointClick = 'vizPointClick',
416
422
  /**
@@ -462,7 +468,7 @@ export enum EmbedEvent {
462
468
  * Emitted when the embed does not have cookie access. This
463
469
  * happens on Safari where third-party cookies are blocked by default.
464
470
  *
465
- * @version 1.1.0 or later
471
+ * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
466
472
  */
467
473
  NoCookieAccess = 'noCookieAccess',
468
474
  /**
@@ -473,179 +479,180 @@ export enum EmbedEvent {
473
479
  SAMLComplete = 'samlComplete',
474
480
  /**
475
481
  * Emitted when any modal is opened in the app
476
- * @version 1.6.0 or later
482
+ * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
477
483
  */
478
484
  DialogOpen = 'dialog-open',
479
485
  /**
480
486
  * Emitted when any modal is closed in the app
481
- * @version 1.6.0 or later
487
+ * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
482
488
  */
483
489
  DialogClose = 'dialog-close',
484
490
  /**
485
491
  * Emitted when a liveboard has completed rendering,
486
492
  * this event can be used as a hook to trigger events on the
487
493
  * rendered liveboard
488
- * @version 1.9.1 or later
494
+ * @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
489
495
  */
490
496
  LiveboardRendered = 'PinboardRendered',
491
497
  /**
492
498
  * This can be used to register an event listener which
493
499
  * is triggered on all events.
494
- * @version SDK: 1.10.0 | ThoughtSpot: any
500
+ * @Version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
495
501
  */
496
502
  ALL = '*',
497
503
  /**
498
504
  * Emitted when answer is saved in the app
499
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
505
+ * @Version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
500
506
  */
501
507
  Save = 'save',
502
508
  /**
503
509
  * Emitted when the download action is triggered on an answer
504
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
510
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
505
511
  */
506
512
  Download = 'download',
507
513
  /**
508
514
  * Emitted when the Download as PDF action is triggered on an answer
509
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
515
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
510
516
  */
511
517
  DownloadAsPdf = 'downloadAsPdf',
512
518
  /**
513
519
  * Emitted when the Download as CSV action is triggered on an answer
514
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
520
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
515
521
  */
516
522
  DownloadAsCsv = 'downloadAsCsv',
517
523
  /**
518
524
  * Emitted when the Download as XLSX action is triggered on an answer
519
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
525
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
520
526
  */
521
527
  DownloadAsXlsx = 'downloadAsXlsx',
522
528
  /**
523
529
  * Emitted when an answer is deleted in the app
524
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
530
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
525
531
  */
526
532
  AnswerDelete = 'answerDelete',
527
533
  /**
528
534
  * Emitted when an answer is pinned to a Liveboard
529
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
535
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
530
536
  */
531
537
  Pin = 'pin',
532
538
  /**
533
539
  * Emitted when SpotIQ analysis is triggered
534
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
540
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
535
541
  */
536
542
  SpotIQAnalyze = 'spotIQAnalyze',
537
543
  /**
538
544
  * Emitted when a user shares an object with another user or group
539
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
545
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
540
546
  */
541
547
  Share = 'share',
542
548
  /**
543
549
  * Emitted when a user clicks the Include action to include a specific value or data on a chart or table
544
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
550
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
545
551
  */
546
552
  DrillInclude = 'context-menu-item-include',
547
553
  /**
548
554
  * Emitted when a user clicks the Exclude action to exclude a specific value or data on a chart or table
549
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
555
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
550
556
  */
551
557
  DrillExclude = 'context-menu-item-exclude',
552
558
  /**
553
559
  * Emitted when copied column value on the app
554
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
560
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
555
561
  */
556
562
  CopyToClipboard = 'context-menu-item-copy-to-clipboard',
557
563
  /**
558
564
  * Emitted when a user clicks the Update TML action
559
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
565
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
560
566
  */
561
567
  UpdateTML = 'updateTSL',
562
568
  /**
563
569
  * Emitted when a user clicks the Edit TML action
564
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
570
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
565
571
  */
566
572
  EditTML = 'editTSL',
567
573
  /**
568
574
  * Emitted when ExportTML trigger in answer on the app
569
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
575
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
570
576
  */
571
577
  ExportTML = 'exportTSL',
572
578
  /**
573
579
  * Emitted when an answer is saved as a view
574
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
580
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
575
581
  */
576
582
  SaveAsView = 'saveAsView',
577
583
  /**
578
584
  * Emitted when copy of existing answer on the app
579
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
585
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
580
586
  */
581
587
  CopyAEdit = 'copyAEdit',
582
588
  /**
583
589
  * Emitted when a user clicks Show underlying data on an answe
584
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
590
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
585
591
  */
586
592
  ShowUnderlyingData = 'showUnderlyingData',
587
593
  /**
588
594
  * Emitted when an answer is switched to a chart or table view
589
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
595
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
590
596
  */
591
597
  AnswerChartSwitcher = 'answerChartSwitcher',
592
598
  /**
593
- *
599
+ * Internal event to communicate the initial settings back to the TS APP
600
+ * @hidden
594
601
  */
595
602
  APP_INIT = 'appInit',
596
603
  /**
597
604
  * Emitted when a user clicks Show Liveboard details on a Liveboard
598
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
605
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
599
606
  */
600
607
  LiveboardInfo = 'pinboardInfo',
601
608
  /**
602
609
  * Emitted when a user clicks on the Favorite icon on a Liveboard
603
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
610
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
604
611
  */
605
612
  AddToFavorites = 'addToFavorites',
606
613
  /**
607
614
  * Emitted when a user clicks Schedule on a Liveboard
608
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
615
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
609
616
  */
610
617
  Schedule = 'subscription',
611
618
  /**
612
619
  * Emitted when a user clicks Edit on a Liveboard or visualization
613
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
620
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
614
621
  */
615
622
  Edit = 'edit',
616
623
  /**
617
624
  * Emitted when a user clicks Make a copy on a Liveboard
618
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
625
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
619
626
  */
620
627
  MakeACopy = 'makeACopy',
621
628
  /**
622
629
  * Emitted when a user clicks Present on a Liveboard or visualization
623
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
630
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
624
631
  */
625
632
  Present = 'present',
626
633
  /**
627
634
  * Emitted when a user clicks Delete on a Liveboard
628
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
635
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
629
636
  */
630
637
  Delete = 'delete',
631
638
  /**
632
639
  * Emitted when a user clicks Manage schedules on a Liveboard
633
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
640
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
634
641
  */
635
642
  SchedulesList = 'schedule-list',
636
643
  /**
637
644
  * Emitted when a user clicks Cancel in edit mode on a Liveboard
638
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
645
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
639
646
  */
640
647
  Cancel = 'cancel',
641
648
  /**
642
649
  * Emitted when a user clicks Explore on a visualization
643
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
650
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
644
651
  */
645
652
  Explore = 'explore',
646
653
  /**
647
654
  * Emitted when a user clicks Copy link action on a visualization
648
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
655
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
649
656
  */
650
657
  CopyLink = 'embedDocument',
651
658
  }
@@ -670,8 +677,8 @@ export enum HostEvent {
670
677
  * @param points - an object containing selectedPoints/clickedPoints
671
678
  * eg. { selectedPoints: []}
672
679
  * @param columnGuid - a string guid of the column to drill by. This is optional,
673
- * if not provided it will auto drill by the configured column. \
674
- * @version 1.5.0 or later
680
+ * if not provided it will auto drill by the configured column.
681
+ * @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
675
682
  */
676
683
  DrillDown = 'triggerDrillDown',
677
684
  /**
@@ -688,97 +695,97 @@ export enum HostEvent {
688
695
  * Set the visible visualizations on a Liveboard.
689
696
  * @param - an array of ids of visualizations to show, the ids not passed
690
697
  * will be hidden.
691
- * @version 1.6.0 or later
698
+ * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
692
699
  */
693
700
  SetVisibleVizs = 'SetPinboardVisibleVizs',
694
701
  /**
695
702
  * Update the runtime filters. The runtime filters passed here are extended
696
703
  * on to the existing runtime filters if they exist.
697
704
  * @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
698
- * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
705
+ * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
699
706
  */
700
707
  UpdateRuntimeFilters = 'UpdateRuntimeFilters',
701
708
  /**
702
709
  * Navigate to a specific page in App embed without any reload.
703
710
  * This is the same as calling `appEmbed.navigateToPage(path, true)`
704
711
  * @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
705
- * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
712
+ * @version SDK: 1.12.0 | ThoughtSpot 8.4.0.cl, 8.4.1-sw
706
713
  */
707
714
  Navigate = 'Navigate',
708
715
  /**
709
716
  * Gets the current pinboard content.
710
- * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
717
+ * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
711
718
  */
712
719
  getExportRequestForCurrentPinboard = 'getExportRequestForCurrentPinboard',
713
720
  /**
714
721
  * Triggers the Pin action on an embedded object
715
722
  * @param - incase of Liveboard embed, takes in an object with vizId as a key
716
723
  * can be left empty for search and visualization embeds
717
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
724
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
718
725
  */
719
726
  Pin = 'pin',
720
727
  /**
721
728
  * Triggers the Show Liveboard details action on a Liveboard
722
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
729
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
723
730
  */
724
731
  LiveboardInfo = 'pinboardInfo',
725
732
  /**
726
733
  * Triggers the Schedule action on a Liveboard
727
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
734
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
728
735
  */
729
736
  Schedule = 'subscription',
730
737
  /**
731
738
  * Triggers the Manage schedule action on a Liveboard
732
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
739
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
733
740
  */
734
741
  SchedulesList = 'schedule-list',
735
742
  /**
736
743
  * Triggers the Export TML action on a Liveboard
737
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
744
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
738
745
  */
739
746
  ExportTML = 'exportTSL',
740
747
  /**
741
748
  * Triggers the Edit TML action on a Liveboard
742
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
749
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
743
750
  */
744
751
  EditTML = 'editTSL',
745
752
  /**
746
753
  * Triggers the Update TML action on a Liveboard
747
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
754
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
748
755
  */
749
756
  UpdateTML = 'updateTSL',
750
757
  /**
751
758
  * Triggers the Download PDF action on a Liveboard
752
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
759
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
753
760
  */
754
761
  DownloadAsPdf = 'downloadAsPdf',
755
762
  /**
756
763
  * Triggers the Make a copy action on a Liveboard
757
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
764
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
758
765
  */
759
766
  MakeACopy = 'makeACopy',
760
767
  /**
761
768
  * Triggers the Delete action on a Liveboard
762
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
769
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
763
770
  */
764
771
  Remove = 'delete',
765
772
  /**
766
773
  * Triggers the Explore action on a visualization
767
774
  * @param - an object with vizId as a key
768
775
  * eg: {vizId: '730496d6-6903-4601-937e-2c691821af3c'}
769
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
776
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
770
777
  */
771
778
  Explore = 'explore',
772
779
  /**
773
780
  * Triggers the Create alert action on a visualization
774
781
  * @param - an object with vizId as a key
775
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
782
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
776
783
  */
777
784
  CreateMonitor = 'createMonitor',
778
785
  /**
779
786
  * Triggers the Manage alert action on a visualization
780
787
  * @param - an object with vizId as a key
781
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
788
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
782
789
  */
783
790
  ManageMonitor = 'manageMonitor',
784
791
  /**
@@ -788,7 +795,7 @@ export enum HostEvent {
788
795
  * liveboardEmbed.trigger(HostEvent.Edit)
789
796
  * liveboardEmbed.trigger(HostEvent.Edit, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
790
797
  * vizEmbed.trigger((HostEvent.Edit)
791
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
798
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
792
799
  */
793
800
  Edit = 'edit',
794
801
  /**
@@ -798,7 +805,7 @@ export enum HostEvent {
798
805
  * liveboardEmbed.trigger(HostEvent.CopyLink)
799
806
  * liveboardEmbed.trigger(HostEvent.CopyLink, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
800
807
  * vizEmbed.trigger((HostEvent.CopyLink)
801
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
808
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
802
809
  */
803
810
  CopyLink = 'embedDocument',
804
811
  /**
@@ -808,7 +815,7 @@ export enum HostEvent {
808
815
  * liveboardEmbed.trigger(HostEvent.Present)
809
816
  * liveboardEmbed.trigger(HostEvent.Present, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
810
817
  * vizEmbed.trigger((HostEvent.Present)
811
- * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
818
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
812
819
  */
813
820
  Present = 'present',
814
821
  }
@@ -994,27 +1001,27 @@ export enum Action {
994
1001
  RequestAccess = 'requestAccess',
995
1002
  QueryDetailsButtons = 'queryDetailsButtons',
996
1003
  /**
997
- * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
1004
+ * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
998
1005
  */
999
1006
  AnswerDelete = 'onDeleteAnswer',
1000
1007
  /**
1001
- * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
1008
+ * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
1002
1009
  */
1003
1010
  AnswerChartSwitcher = 'answerChartSwitcher',
1004
1011
  /**
1005
- * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
1012
+ * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
1006
1013
  */
1007
1014
  AddToFavorites = 'addToFavorites',
1008
1015
  /**
1009
- * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
1016
+ * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
1010
1017
  */
1011
1018
  EditDetails = 'editDetails',
1012
1019
  /**
1013
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
1020
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
1014
1021
  */
1015
1022
  CreateMonitor = 'createMonitor',
1016
1023
  /**
1017
- * @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl
1024
+ * @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
1018
1025
  */
1019
1026
  ReportError = 'reportError',
1020
1027
  }
@@ -3,6 +3,7 @@ import {
3
3
  fetchAuthTokenService,
4
4
  fetchAuthService,
5
5
  fetchBasicAuthService,
6
+ fetchAuthPostService,
6
7
  } from './authService';
7
8
  import { EndPoints } from '../auth';
8
9
 
@@ -56,6 +57,26 @@ describe('Unit test for authService', () => {
56
57
  );
57
58
  });
58
59
 
60
+ test('fetchAuthPostService', async () => {
61
+ global.fetch = jest.fn(() =>
62
+ Promise.resolve({ success: true, ok: true }),
63
+ );
64
+ await fetchAuthPostService(thoughtSpotHost, username, authToken);
65
+ expect(fetch).toBeCalledWith(
66
+ `${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`,
67
+ {
68
+ method: 'POST',
69
+ credentials: 'include',
70
+ redirect: 'manual',
71
+ body: 'username=tsuser&auth_token=token',
72
+ headers: {
73
+ 'content-type': 'application/x-www-form-urlencoded',
74
+ 'x-requested-by': 'ThoughtSpot',
75
+ },
76
+ },
77
+ );
78
+ });
79
+
59
80
  test('fetchBasicAuthService called with manual redirect', async () => {
60
81
  global.fetch = jest.fn(() =>
61
82
  Promise.resolve({ success: true, ok: true }),
@@ -42,6 +42,26 @@ export async function fetchAuthService(
42
42
  );
43
43
  }
44
44
 
45
+ export async function fetchAuthPostService(
46
+ thoughtSpotHost: string,
47
+ username: string,
48
+ authToken: string,
49
+ ): Promise<any> {
50
+ return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
51
+ method: 'POST',
52
+ headers: {
53
+ 'content-type': 'application/x-www-form-urlencoded',
54
+ 'x-requested-by': 'ThoughtSpot',
55
+ },
56
+ body: `username=${encodeURIComponent(
57
+ username,
58
+ )}&auth_token=${encodeURIComponent(authToken)}`,
59
+ credentials: 'include',
60
+ // We do not want to follow the redirect, as it starts giving a CORS error
61
+ redirect: 'manual',
62
+ });
63
+ }
64
+
45
65
  export async function fetchBasicAuthService(
46
66
  thoughtSpotHost: string,
47
67
  username: string,
@@ -191,6 +191,23 @@ describe('Unit test for process data', () => {
191
191
  expect(el.innerHTML).toBe('Hello');
192
192
  });
193
193
 
194
+ test('process authFailure AuthType=None', () => {
195
+ const e = { type: EmbedEvent.AuthFailure };
196
+ jest.spyOn(base, 'notifyAuthFailure');
197
+ jest.spyOn(base, 'getEmbedConfig').mockReturnValue({
198
+ loginFailedMessage: 'Hello',
199
+ authType: AuthType.None,
200
+ });
201
+ const el: any = {};
202
+ expect(processDataInstance.processEventData(e.type, e, '', el)).toEqual(
203
+ {
204
+ type: e.type,
205
+ },
206
+ );
207
+ expect(base.notifyAuthFailure).not.toBeCalled();
208
+ expect(el.innerHTML).not.toBe('Hello');
209
+ });
210
+
194
211
  test('process authLogout', () => {
195
212
  base.init({
196
213
  loginFailedMessage: 'Hello',
@@ -7,7 +7,7 @@ import {
7
7
  notifyLogout,
8
8
  } from '../embed/base';
9
9
  import { AuthFailureType, initSession } from '../auth';
10
- import { EmbedEvent, OperationType } from '../types';
10
+ import { AuthType, EmbedEvent, OperationType } from '../types';
11
11
  import { getAnswerServiceInstance } from './answerService';
12
12
 
13
13
  export function processCustomAction(e: any, thoughtSpotHost: string) {
@@ -73,10 +73,12 @@ function processNoCookieAccess(e: any, containerEl: Element) {
73
73
  }
74
74
 
75
75
  function processAuthFailure(e: any, containerEl: Element) {
76
- const { loginFailedMessage } = getEmbedConfig();
77
- // eslint-disable-next-line no-param-reassign
78
- containerEl.innerHTML = loginFailedMessage;
79
- notifyAuthFailure(AuthFailureType.OTHER);
76
+ const { loginFailedMessage, authType } = getEmbedConfig();
77
+ if (authType !== AuthType.None) {
78
+ // eslint-disable-next-line no-param-reassign
79
+ containerEl.innerHTML = loginFailedMessage;
80
+ notifyAuthFailure(AuthFailureType.OTHER);
81
+ }
80
82
  return e;
81
83
  }
82
84