@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.
- package/CHANGELOG.md +7 -2
- package/dist/src/embed/app.d.ts +4 -3
- package/dist/src/embed/base.d.ts +1 -1
- package/dist/src/embed/liveboard.d.ts +6 -8
- package/dist/src/embed/pinboard.d.ts +91 -0
- package/dist/src/embed/search.d.ts +1 -1
- package/dist/src/embed/ts-embed.d.ts +4 -4
- package/dist/src/types.d.ts +83 -76
- package/dist/src/utils/authService.d.ts +1 -0
- package/dist/src/utils/plugin.d.ts +0 -0
- package/dist/src/v1/api.d.ts +19 -0
- package/dist/tsembed.es.js +103 -76
- package/dist/tsembed.js +103 -76
- package/lib/package.json +1 -1
- package/lib/src/auth.js +8 -2
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.js +18 -0
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/embed/app.d.ts +4 -3
- package/lib/src/embed/app.js +2 -1
- package/lib/src/embed/app.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/liveboard.d.ts +6 -8
- package/lib/src/embed/liveboard.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/search.d.ts +1 -1
- package/lib/src/embed/ts-embed.d.ts +4 -4
- package/lib/src/types.d.ts +83 -76
- package/lib/src/types.js +73 -68
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/authService.d.ts +1 -0
- package/lib/src/utils/authService.js +13 -0
- package/lib/src/utils/authService.js.map +1 -1
- package/lib/src/utils/authService.spec.js +15 -1
- package/lib/src/utils/authService.spec.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/processData.js +7 -5
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +14 -0
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +99 -93
- package/package.json +1 -1
- package/src/auth.spec.ts +39 -0
- package/src/auth.ts +11 -5
- package/src/embed/app.ts +4 -3
- package/src/embed/base.ts +1 -1
- package/src/embed/liveboard.ts +6 -8
- package/src/embed/search.ts +1 -1
- package/src/embed/ts-embed.ts +4 -4
- package/src/types.ts +83 -76
- package/src/utils/authService.spec.ts +21 -0
- package/src/utils/authService.ts +20 -0
- package/src/utils/processData.spec.ts +17 -0
- package/src/utils/processData.ts +7 -5
package/dist/tsembed.js
CHANGED
|
@@ -159,9 +159,13 @@
|
|
|
159
159
|
*/
|
|
160
160
|
(function (AuthType) {
|
|
161
161
|
/**
|
|
162
|
-
* No authentication.
|
|
162
|
+
* No authentication on the SDK. Passthrough to the embedded App. Alias for `Passthrough`.
|
|
163
163
|
*/
|
|
164
164
|
AuthType["None"] = "None";
|
|
165
|
+
/**
|
|
166
|
+
* No authentication on the SDK. Passthrough to the embedded App.
|
|
167
|
+
*/
|
|
168
|
+
AuthType["Passthrough"] = "None";
|
|
165
169
|
/**
|
|
166
170
|
* SSO using SAML
|
|
167
171
|
* @deprecated Use {@link SAML} instead
|
|
@@ -290,7 +294,7 @@
|
|
|
290
294
|
/**
|
|
291
295
|
* One or more data columns have been selected.
|
|
292
296
|
* @return columnIds - the list of columns
|
|
293
|
-
* @version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl
|
|
297
|
+
* @version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
|
|
294
298
|
*/
|
|
295
299
|
EmbedEvent["AddRemoveColumns"] = "addRemoveColumns";
|
|
296
300
|
/**
|
|
@@ -302,13 +306,13 @@
|
|
|
302
306
|
/**
|
|
303
307
|
* A double click has been triggered on table/chart
|
|
304
308
|
* @return ContextMenuInputPoints - data point that is double clicked
|
|
305
|
-
* @version 1.5.0
|
|
309
|
+
* @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
|
|
306
310
|
*/
|
|
307
311
|
EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick";
|
|
308
312
|
/**
|
|
309
313
|
* A click has been triggered on table/chart
|
|
310
314
|
* @return ContextMenuInputPoints - data point that is clicked
|
|
311
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
315
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
312
316
|
*/
|
|
313
317
|
EmbedEvent["VizPointClick"] = "vizPointClick";
|
|
314
318
|
/**
|
|
@@ -360,7 +364,7 @@
|
|
|
360
364
|
* Emitted when the embed does not have cookie access. This
|
|
361
365
|
* happens on Safari where third-party cookies are blocked by default.
|
|
362
366
|
*
|
|
363
|
-
* @version 1.1.0
|
|
367
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
|
|
364
368
|
*/
|
|
365
369
|
EmbedEvent["NoCookieAccess"] = "noCookieAccess";
|
|
366
370
|
/**
|
|
@@ -371,179 +375,180 @@
|
|
|
371
375
|
EmbedEvent["SAMLComplete"] = "samlComplete";
|
|
372
376
|
/**
|
|
373
377
|
* Emitted when any modal is opened in the app
|
|
374
|
-
* @version 1.6.0
|
|
378
|
+
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
|
|
375
379
|
*/
|
|
376
380
|
EmbedEvent["DialogOpen"] = "dialog-open";
|
|
377
381
|
/**
|
|
378
382
|
* Emitted when any modal is closed in the app
|
|
379
|
-
* @version 1.6.0
|
|
383
|
+
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
|
|
380
384
|
*/
|
|
381
385
|
EmbedEvent["DialogClose"] = "dialog-close";
|
|
382
386
|
/**
|
|
383
387
|
* Emitted when a liveboard has completed rendering,
|
|
384
388
|
* this event can be used as a hook to trigger events on the
|
|
385
389
|
* rendered liveboard
|
|
386
|
-
* @version 1.9.1
|
|
390
|
+
* @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
387
391
|
*/
|
|
388
392
|
EmbedEvent["LiveboardRendered"] = "PinboardRendered";
|
|
389
393
|
/**
|
|
390
394
|
* This can be used to register an event listener which
|
|
391
395
|
* is triggered on all events.
|
|
392
|
-
* @
|
|
396
|
+
* @Version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
|
|
393
397
|
*/
|
|
394
398
|
EmbedEvent["ALL"] = "*";
|
|
395
399
|
/**
|
|
396
400
|
* Emitted when answer is saved in the app
|
|
397
|
-
* @
|
|
401
|
+
* @Version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
398
402
|
*/
|
|
399
403
|
EmbedEvent["Save"] = "save";
|
|
400
404
|
/**
|
|
401
405
|
* Emitted when the download action is triggered on an answer
|
|
402
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
406
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
403
407
|
*/
|
|
404
408
|
EmbedEvent["Download"] = "download";
|
|
405
409
|
/**
|
|
406
410
|
* Emitted when the Download as PDF action is triggered on an answer
|
|
407
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
411
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
408
412
|
*/
|
|
409
413
|
EmbedEvent["DownloadAsPdf"] = "downloadAsPdf";
|
|
410
414
|
/**
|
|
411
415
|
* Emitted when the Download as CSV action is triggered on an answer
|
|
412
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
416
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
413
417
|
*/
|
|
414
418
|
EmbedEvent["DownloadAsCsv"] = "downloadAsCsv";
|
|
415
419
|
/**
|
|
416
420
|
* Emitted when the Download as XLSX action is triggered on an answer
|
|
417
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
421
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
418
422
|
*/
|
|
419
423
|
EmbedEvent["DownloadAsXlsx"] = "downloadAsXlsx";
|
|
420
424
|
/**
|
|
421
425
|
* Emitted when an answer is deleted in the app
|
|
422
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
426
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
423
427
|
*/
|
|
424
428
|
EmbedEvent["AnswerDelete"] = "answerDelete";
|
|
425
429
|
/**
|
|
426
430
|
* Emitted when an answer is pinned to a Liveboard
|
|
427
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
431
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
428
432
|
*/
|
|
429
433
|
EmbedEvent["Pin"] = "pin";
|
|
430
434
|
/**
|
|
431
435
|
* Emitted when SpotIQ analysis is triggered
|
|
432
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
436
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
433
437
|
*/
|
|
434
438
|
EmbedEvent["SpotIQAnalyze"] = "spotIQAnalyze";
|
|
435
439
|
/**
|
|
436
440
|
* Emitted when a user shares an object with another user or group
|
|
437
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
441
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
438
442
|
*/
|
|
439
443
|
EmbedEvent["Share"] = "share";
|
|
440
444
|
/**
|
|
441
445
|
* Emitted when a user clicks the Include action to include a specific value or data on a chart or table
|
|
442
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
446
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
443
447
|
*/
|
|
444
448
|
EmbedEvent["DrillInclude"] = "context-menu-item-include";
|
|
445
449
|
/**
|
|
446
450
|
* Emitted when a user clicks the Exclude action to exclude a specific value or data on a chart or table
|
|
447
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
451
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
448
452
|
*/
|
|
449
453
|
EmbedEvent["DrillExclude"] = "context-menu-item-exclude";
|
|
450
454
|
/**
|
|
451
455
|
* Emitted when copied column value on the app
|
|
452
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
456
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
453
457
|
*/
|
|
454
458
|
EmbedEvent["CopyToClipboard"] = "context-menu-item-copy-to-clipboard";
|
|
455
459
|
/**
|
|
456
460
|
* Emitted when a user clicks the Update TML action
|
|
457
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
461
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
458
462
|
*/
|
|
459
463
|
EmbedEvent["UpdateTML"] = "updateTSL";
|
|
460
464
|
/**
|
|
461
465
|
* Emitted when a user clicks the Edit TML action
|
|
462
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
466
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
463
467
|
*/
|
|
464
468
|
EmbedEvent["EditTML"] = "editTSL";
|
|
465
469
|
/**
|
|
466
470
|
* Emitted when ExportTML trigger in answer on the app
|
|
467
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
471
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
468
472
|
*/
|
|
469
473
|
EmbedEvent["ExportTML"] = "exportTSL";
|
|
470
474
|
/**
|
|
471
475
|
* Emitted when an answer is saved as a view
|
|
472
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
476
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
473
477
|
*/
|
|
474
478
|
EmbedEvent["SaveAsView"] = "saveAsView";
|
|
475
479
|
/**
|
|
476
480
|
* Emitted when copy of existing answer on the app
|
|
477
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
481
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
478
482
|
*/
|
|
479
483
|
EmbedEvent["CopyAEdit"] = "copyAEdit";
|
|
480
484
|
/**
|
|
481
485
|
* Emitted when a user clicks Show underlying data on an answe
|
|
482
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
486
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
483
487
|
*/
|
|
484
488
|
EmbedEvent["ShowUnderlyingData"] = "showUnderlyingData";
|
|
485
489
|
/**
|
|
486
490
|
* Emitted when an answer is switched to a chart or table view
|
|
487
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
491
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
488
492
|
*/
|
|
489
493
|
EmbedEvent["AnswerChartSwitcher"] = "answerChartSwitcher";
|
|
490
494
|
/**
|
|
491
|
-
*
|
|
495
|
+
* Internal event to communicate the initial settings back to the TS APP
|
|
496
|
+
* @hidden
|
|
492
497
|
*/
|
|
493
498
|
EmbedEvent["APP_INIT"] = "appInit";
|
|
494
499
|
/**
|
|
495
500
|
* Emitted when a user clicks Show Liveboard details on a Liveboard
|
|
496
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
501
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
497
502
|
*/
|
|
498
503
|
EmbedEvent["LiveboardInfo"] = "pinboardInfo";
|
|
499
504
|
/**
|
|
500
505
|
* Emitted when a user clicks on the Favorite icon on a Liveboard
|
|
501
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
506
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
502
507
|
*/
|
|
503
508
|
EmbedEvent["AddToFavorites"] = "addToFavorites";
|
|
504
509
|
/**
|
|
505
510
|
* Emitted when a user clicks Schedule on a Liveboard
|
|
506
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
511
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
507
512
|
*/
|
|
508
513
|
EmbedEvent["Schedule"] = "subscription";
|
|
509
514
|
/**
|
|
510
515
|
* Emitted when a user clicks Edit on a Liveboard or visualization
|
|
511
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
516
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
512
517
|
*/
|
|
513
518
|
EmbedEvent["Edit"] = "edit";
|
|
514
519
|
/**
|
|
515
520
|
* Emitted when a user clicks Make a copy on a Liveboard
|
|
516
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
521
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
517
522
|
*/
|
|
518
523
|
EmbedEvent["MakeACopy"] = "makeACopy";
|
|
519
524
|
/**
|
|
520
525
|
* Emitted when a user clicks Present on a Liveboard or visualization
|
|
521
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
526
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
522
527
|
*/
|
|
523
528
|
EmbedEvent["Present"] = "present";
|
|
524
529
|
/**
|
|
525
530
|
* Emitted when a user clicks Delete on a Liveboard
|
|
526
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
531
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
527
532
|
*/
|
|
528
533
|
EmbedEvent["Delete"] = "delete";
|
|
529
534
|
/**
|
|
530
535
|
* Emitted when a user clicks Manage schedules on a Liveboard
|
|
531
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
536
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
532
537
|
*/
|
|
533
538
|
EmbedEvent["SchedulesList"] = "schedule-list";
|
|
534
539
|
/**
|
|
535
540
|
* Emitted when a user clicks Cancel in edit mode on a Liveboard
|
|
536
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
541
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
537
542
|
*/
|
|
538
543
|
EmbedEvent["Cancel"] = "cancel";
|
|
539
544
|
/**
|
|
540
545
|
* Emitted when a user clicks Explore on a visualization
|
|
541
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
546
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
542
547
|
*/
|
|
543
548
|
EmbedEvent["Explore"] = "explore";
|
|
544
549
|
/**
|
|
545
550
|
* Emitted when a user clicks Copy link action on a visualization
|
|
546
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
551
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
547
552
|
*/
|
|
548
553
|
EmbedEvent["CopyLink"] = "embedDocument";
|
|
549
554
|
})(exports.EmbedEvent || (exports.EmbedEvent = {}));
|
|
@@ -559,8 +564,8 @@
|
|
|
559
564
|
* @param points - an object containing selectedPoints/clickedPoints
|
|
560
565
|
* eg. { selectedPoints: []}
|
|
561
566
|
* @param columnGuid - a string guid of the column to drill by. This is optional,
|
|
562
|
-
* if not provided it will auto drill by the configured column.
|
|
563
|
-
* @version 1.5.0
|
|
567
|
+
* if not provided it will auto drill by the configured column.
|
|
568
|
+
* @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
|
|
564
569
|
*/
|
|
565
570
|
HostEvent["DrillDown"] = "triggerDrillDown";
|
|
566
571
|
/**
|
|
@@ -577,97 +582,97 @@
|
|
|
577
582
|
* Set the visible visualizations on a Liveboard.
|
|
578
583
|
* @param - an array of ids of visualizations to show, the ids not passed
|
|
579
584
|
* will be hidden.
|
|
580
|
-
* @version 1.6.0
|
|
585
|
+
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
|
|
581
586
|
*/
|
|
582
587
|
HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
|
|
583
588
|
/**
|
|
584
589
|
* Update the runtime filters. The runtime filters passed here are extended
|
|
585
590
|
* on to the existing runtime filters if they exist.
|
|
586
591
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
587
|
-
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
592
|
+
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
588
593
|
*/
|
|
589
594
|
HostEvent["UpdateRuntimeFilters"] = "UpdateRuntimeFilters";
|
|
590
595
|
/**
|
|
591
596
|
* Navigate to a specific page in App embed without any reload.
|
|
592
597
|
* This is the same as calling `appEmbed.navigateToPage(path, true)`
|
|
593
598
|
* @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
594
|
-
* @version SDK: 1.12.0 | ThoughtSpot
|
|
599
|
+
* @version SDK: 1.12.0 | ThoughtSpot 8.4.0.cl, 8.4.1-sw
|
|
595
600
|
*/
|
|
596
601
|
HostEvent["Navigate"] = "Navigate";
|
|
597
602
|
/**
|
|
598
603
|
* Gets the current pinboard content.
|
|
599
|
-
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
|
|
604
|
+
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
|
|
600
605
|
*/
|
|
601
606
|
HostEvent["getExportRequestForCurrentPinboard"] = "getExportRequestForCurrentPinboard";
|
|
602
607
|
/**
|
|
603
608
|
* Triggers the Pin action on an embedded object
|
|
604
609
|
* @param - incase of Liveboard embed, takes in an object with vizId as a key
|
|
605
610
|
* can be left empty for search and visualization embeds
|
|
606
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
611
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
607
612
|
*/
|
|
608
613
|
HostEvent["Pin"] = "pin";
|
|
609
614
|
/**
|
|
610
615
|
* Triggers the Show Liveboard details action on a Liveboard
|
|
611
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
616
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
612
617
|
*/
|
|
613
618
|
HostEvent["LiveboardInfo"] = "pinboardInfo";
|
|
614
619
|
/**
|
|
615
620
|
* Triggers the Schedule action on a Liveboard
|
|
616
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
621
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
617
622
|
*/
|
|
618
623
|
HostEvent["Schedule"] = "subscription";
|
|
619
624
|
/**
|
|
620
625
|
* Triggers the Manage schedule action on a Liveboard
|
|
621
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
626
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
622
627
|
*/
|
|
623
628
|
HostEvent["SchedulesList"] = "schedule-list";
|
|
624
629
|
/**
|
|
625
630
|
* Triggers the Export TML action on a Liveboard
|
|
626
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
631
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
627
632
|
*/
|
|
628
633
|
HostEvent["ExportTML"] = "exportTSL";
|
|
629
634
|
/**
|
|
630
635
|
* Triggers the Edit TML action on a Liveboard
|
|
631
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
636
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
632
637
|
*/
|
|
633
638
|
HostEvent["EditTML"] = "editTSL";
|
|
634
639
|
/**
|
|
635
640
|
* Triggers the Update TML action on a Liveboard
|
|
636
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
641
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
637
642
|
*/
|
|
638
643
|
HostEvent["UpdateTML"] = "updateTSL";
|
|
639
644
|
/**
|
|
640
645
|
* Triggers the Download PDF action on a Liveboard
|
|
641
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
646
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
642
647
|
*/
|
|
643
648
|
HostEvent["DownloadAsPdf"] = "downloadAsPdf";
|
|
644
649
|
/**
|
|
645
650
|
* Triggers the Make a copy action on a Liveboard
|
|
646
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
651
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
647
652
|
*/
|
|
648
653
|
HostEvent["MakeACopy"] = "makeACopy";
|
|
649
654
|
/**
|
|
650
655
|
* Triggers the Delete action on a Liveboard
|
|
651
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
656
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
652
657
|
*/
|
|
653
658
|
HostEvent["Remove"] = "delete";
|
|
654
659
|
/**
|
|
655
660
|
* Triggers the Explore action on a visualization
|
|
656
661
|
* @param - an object with vizId as a key
|
|
657
662
|
* eg: {vizId: '730496d6-6903-4601-937e-2c691821af3c'}
|
|
658
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
663
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
659
664
|
*/
|
|
660
665
|
HostEvent["Explore"] = "explore";
|
|
661
666
|
/**
|
|
662
667
|
* Triggers the Create alert action on a visualization
|
|
663
668
|
* @param - an object with vizId as a key
|
|
664
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
669
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
665
670
|
*/
|
|
666
671
|
HostEvent["CreateMonitor"] = "createMonitor";
|
|
667
672
|
/**
|
|
668
673
|
* Triggers the Manage alert action on a visualization
|
|
669
674
|
* @param - an object with vizId as a key
|
|
670
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
675
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
671
676
|
*/
|
|
672
677
|
HostEvent["ManageMonitor"] = "manageMonitor";
|
|
673
678
|
/**
|
|
@@ -677,7 +682,7 @@
|
|
|
677
682
|
* liveboardEmbed.trigger(HostEvent.Edit)
|
|
678
683
|
* liveboardEmbed.trigger(HostEvent.Edit, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
679
684
|
* vizEmbed.trigger((HostEvent.Edit)
|
|
680
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
685
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
681
686
|
*/
|
|
682
687
|
HostEvent["Edit"] = "edit";
|
|
683
688
|
/**
|
|
@@ -687,7 +692,7 @@
|
|
|
687
692
|
* liveboardEmbed.trigger(HostEvent.CopyLink)
|
|
688
693
|
* liveboardEmbed.trigger(HostEvent.CopyLink, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
689
694
|
* vizEmbed.trigger((HostEvent.CopyLink)
|
|
690
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
695
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
691
696
|
*/
|
|
692
697
|
HostEvent["CopyLink"] = "embedDocument";
|
|
693
698
|
/**
|
|
@@ -697,7 +702,7 @@
|
|
|
697
702
|
* liveboardEmbed.trigger(HostEvent.Present)
|
|
698
703
|
* liveboardEmbed.trigger(HostEvent.Present, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
699
704
|
* vizEmbed.trigger((HostEvent.Present)
|
|
700
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
705
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
701
706
|
*/
|
|
702
707
|
HostEvent["Present"] = "present";
|
|
703
708
|
})(exports.HostEvent || (exports.HostEvent = {}));
|
|
@@ -871,27 +876,27 @@
|
|
|
871
876
|
Action["RequestAccess"] = "requestAccess";
|
|
872
877
|
Action["QueryDetailsButtons"] = "queryDetailsButtons";
|
|
873
878
|
/**
|
|
874
|
-
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
879
|
+
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
875
880
|
*/
|
|
876
881
|
Action["AnswerDelete"] = "onDeleteAnswer";
|
|
877
882
|
/**
|
|
878
|
-
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
883
|
+
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
879
884
|
*/
|
|
880
885
|
Action["AnswerChartSwitcher"] = "answerChartSwitcher";
|
|
881
886
|
/**
|
|
882
|
-
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
887
|
+
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
883
888
|
*/
|
|
884
889
|
Action["AddToFavorites"] = "addToFavorites";
|
|
885
890
|
/**
|
|
886
|
-
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
|
|
891
|
+
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
887
892
|
*/
|
|
888
893
|
Action["EditDetails"] = "editDetails";
|
|
889
894
|
/**
|
|
890
|
-
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
895
|
+
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
891
896
|
*/
|
|
892
897
|
Action["CreateMonitor"] = "createMonitor";
|
|
893
898
|
/**
|
|
894
|
-
* @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl
|
|
899
|
+
* @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
895
900
|
*/
|
|
896
901
|
Action["ReportError"] = "reportError";
|
|
897
902
|
})(exports.Action || (exports.Action = {}));
|
|
@@ -7367,6 +7372,19 @@
|
|
|
7367
7372
|
redirect: 'manual',
|
|
7368
7373
|
});
|
|
7369
7374
|
}
|
|
7375
|
+
async function fetchAuthPostService(thoughtSpotHost, username, authToken) {
|
|
7376
|
+
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}`, {
|
|
7377
|
+
method: 'POST',
|
|
7378
|
+
headers: {
|
|
7379
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
7380
|
+
'x-requested-by': 'ThoughtSpot',
|
|
7381
|
+
},
|
|
7382
|
+
body: `username=${encodeURIComponent(username)}&auth_token=${encodeURIComponent(authToken)}`,
|
|
7383
|
+
credentials: 'include',
|
|
7384
|
+
// We do not want to follow the redirect, as it starts giving a CORS error
|
|
7385
|
+
redirect: 'manual',
|
|
7386
|
+
});
|
|
7387
|
+
}
|
|
7370
7388
|
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
7371
7389
|
return failureLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
7372
7390
|
method: 'POST',
|
|
@@ -7503,7 +7521,13 @@
|
|
|
7503
7521
|
const response = await fetchAuthTokenService(authEndpoint);
|
|
7504
7522
|
authToken = await response.text();
|
|
7505
7523
|
}
|
|
7506
|
-
|
|
7524
|
+
let resp;
|
|
7525
|
+
try {
|
|
7526
|
+
resp = await fetchAuthPostService(thoughtSpotHost, username, authToken);
|
|
7527
|
+
}
|
|
7528
|
+
catch (e) {
|
|
7529
|
+
resp = await fetchAuthService(thoughtSpotHost, username, authToken);
|
|
7530
|
+
}
|
|
7507
7531
|
// token login issues a 302 when successful
|
|
7508
7532
|
loggedInStatus = resp.ok || resp.type === 'opaqueredirect';
|
|
7509
7533
|
if (loggedInStatus && embedConfig.detectCookieAccessSlow) {
|
|
@@ -7755,7 +7779,7 @@
|
|
|
7755
7779
|
*
|
|
7756
7780
|
* @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
|
|
7757
7781
|
* @returns Promise which resolves when logout completes.
|
|
7758
|
-
* @version SDK: 1.10.1 | ThoughtSpot:
|
|
7782
|
+
* @version SDK: 1.10.1 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
|
|
7759
7783
|
*/
|
|
7760
7784
|
const logout$1 = (doNotDisableAutoLogin = false) => {
|
|
7761
7785
|
if (!doNotDisableAutoLogin) {
|
|
@@ -7879,10 +7903,12 @@
|
|
|
7879
7903
|
return e;
|
|
7880
7904
|
}
|
|
7881
7905
|
function processAuthFailure(e, containerEl) {
|
|
7882
|
-
const { loginFailedMessage } = getEmbedConfig();
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7906
|
+
const { loginFailedMessage, authType } = getEmbedConfig();
|
|
7907
|
+
if (authType !== exports.AuthType.None) {
|
|
7908
|
+
// eslint-disable-next-line no-param-reassign
|
|
7909
|
+
containerEl.innerHTML = loginFailedMessage;
|
|
7910
|
+
notifyAuthFailure(exports.AuthFailureType.OTHER);
|
|
7911
|
+
}
|
|
7886
7912
|
return e;
|
|
7887
7913
|
}
|
|
7888
7914
|
function processAuthLogout(e, containerEl) {
|
|
@@ -7954,7 +7980,7 @@
|
|
|
7954
7980
|
});
|
|
7955
7981
|
}
|
|
7956
7982
|
|
|
7957
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.
|
|
7983
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.14.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/**"];var exports$1={".":"./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",eventemitter3:"^4.0.7","html-react-parser":"^1.4.12","mixpanel-browser":"^2.45.0","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","@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$1,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};
|
|
7958
7984
|
|
|
7959
7985
|
/**
|
|
7960
7986
|
* Copyright (c) 2022
|
|
@@ -8588,7 +8614,8 @@
|
|
|
8588
8614
|
* @param path string | number The string, set to iframe src and navigate to new page
|
|
8589
8615
|
* eg: appEmbed.navigateToPage('pinboards')
|
|
8590
8616
|
* When used with `noReload` this can also be a number like 1/-1 to go forward/back.
|
|
8591
|
-
* @param noReload boolean Trigger the navigation without reloading the page
|
|
8617
|
+
* @param noReload boolean Trigger the navigation without reloading the page
|
|
8618
|
+
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
|
|
8592
8619
|
*/
|
|
8593
8620
|
navigateToPage(path, noReload = false) {
|
|
8594
8621
|
if (!this.iFrame) {
|
package/lib/package.json
CHANGED
package/lib/src/auth.js
CHANGED
|
@@ -2,7 +2,7 @@ import { initMixpanel } from './mixpanel-service';
|
|
|
2
2
|
import { AuthType, EmbedEvent } from './types';
|
|
3
3
|
import { getRedirectUrl } from './utils';
|
|
4
4
|
// eslint-disable-next-line import/no-cycle
|
|
5
|
-
import { fetchSessionInfoService, fetchAuthTokenService, fetchAuthService, fetchBasicAuthService, fetchLogoutService, } from './utils/authService';
|
|
5
|
+
import { fetchSessionInfoService, fetchAuthTokenService, fetchAuthService, fetchBasicAuthService, fetchLogoutService, fetchAuthPostService, } from './utils/authService';
|
|
6
6
|
// eslint-disable-next-line import/no-mutable-exports
|
|
7
7
|
export let loggedInStatus = false;
|
|
8
8
|
// eslint-disable-next-line import/no-mutable-exports
|
|
@@ -126,7 +126,13 @@ export const doTokenAuth = async (embedConfig) => {
|
|
|
126
126
|
const response = await fetchAuthTokenService(authEndpoint);
|
|
127
127
|
authToken = await response.text();
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
let resp;
|
|
130
|
+
try {
|
|
131
|
+
resp = await fetchAuthPostService(thoughtSpotHost, username, authToken);
|
|
132
|
+
}
|
|
133
|
+
catch (e) {
|
|
134
|
+
resp = await fetchAuthService(thoughtSpotHost, username, authToken);
|
|
135
|
+
}
|
|
130
136
|
// token login issues a 302 when successful
|
|
131
137
|
loggedInStatus = resp.ok || resp.type === 'opaqueredirect';
|
|
132
138
|
if (loggedInStatus && embedConfig.detectCookieAccessSlow) {
|
package/lib/src/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/au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mB,CAChD,kBAAkB,CAAC,cAAc,CAAC,CACrC,EAAE,CAAC;IAEJ,MAAM,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC1C,OAAO,cAAc,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,WAAwB,EAAoB,EAAE;IACvE,MAAM,EAAE,eAAe,EAAE,GAAG,WAAW,CAAC;IACxC,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAC3D,cAAc,GAAG,KAAK,CAAC;IACvB,OAAO,cAAc,CAAC;AAC1B,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAC7B,WAAwB,EACR,EAAE;IAClB,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IACjC,QAAQ,QAAQ,EAAE;QACd,KAAK,QAAQ,CAAC,GAAG,CAAC;QAClB,KAAK,QAAQ,CAAC,IAAI;YACd,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;QACnC,KAAK,QAAQ,CAAC,IAAI;YACd,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;QACnC,KAAK,QAAQ,CAAC,UAAU;YACpB,OAAO,WAAW,CAAC,WAAW,CAAC,CAAC;QACpC,KAAK,QAAQ,CAAC,KAAK;YACf,OAAO,WAAW,CAAC,WAAW,CAAC,CAAC;QACpC;YACI,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACpC;AACL,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAY,EAAE,CAAC,cAAc,CAAC"}
|
package/lib/src/auth.spec.js
CHANGED
|
@@ -175,6 +175,24 @@ describe('Unit test for auth', () => {
|
|
|
175
175
|
expect(authService.fetchSessionInfoService).toHaveBeenCalledTimes(2);
|
|
176
176
|
expect(isLoggedIn).toBe(false);
|
|
177
177
|
});
|
|
178
|
+
test('doTokenAuth: when user is not loggedIn & fetchAuthPostService failed than fetchAuthService should call', async () => {
|
|
179
|
+
jest.spyOn(window, 'alert').mockImplementation(() => undefined);
|
|
180
|
+
jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(() => false);
|
|
181
|
+
jest.spyOn(authService, 'fetchAuthTokenService').mockImplementation(() => ({ text: () => Promise.resolve('abc') }));
|
|
182
|
+
jest.spyOn(authService, 'fetchAuthPostService').mockImplementation(() =>
|
|
183
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
184
|
+
Promise.reject({
|
|
185
|
+
status: 500,
|
|
186
|
+
}));
|
|
187
|
+
jest.spyOn(authService, 'fetchAuthService').mockImplementation(() => Promise.resolve({
|
|
188
|
+
status: 200,
|
|
189
|
+
type: 'opaqueredirect',
|
|
190
|
+
}));
|
|
191
|
+
expect(await authInstance.doTokenAuth(embedConfig.doTokenAuthSuccess('authToken2'))).toBe(true);
|
|
192
|
+
expect(authService.fetchSessionInfoService).toBeCalled();
|
|
193
|
+
expect(authService.fetchAuthPostService).toBeCalledWith(thoughtSpotHost, username, 'authToken2');
|
|
194
|
+
expect(authService.fetchAuthService).toBeCalledWith(thoughtSpotHost, username, 'authToken2');
|
|
195
|
+
});
|
|
178
196
|
describe('doBasicAuth', () => {
|
|
179
197
|
beforeEach(() => {
|
|
180
198
|
global.fetch = window.fetch;
|