@thoughtspot/visual-embed-sdk 1.20.0-prerender.2 → 1.20.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 (182) hide show
  1. package/README.md +1 -1
  2. package/dist/src/auth.d.ts +2 -38
  3. package/dist/src/auth.d.ts.map +1 -1
  4. package/dist/src/config.d.ts +0 -1
  5. package/dist/src/config.d.ts.map +1 -1
  6. package/dist/src/embed/app.d.ts +5 -17
  7. package/dist/src/embed/app.d.ts.map +1 -1
  8. package/dist/src/embed/base.d.ts +9 -20
  9. package/dist/src/embed/base.d.ts.map +1 -1
  10. package/dist/src/embed/liveboard.d.ts +5 -17
  11. package/dist/src/embed/liveboard.d.ts.map +1 -1
  12. package/dist/src/embed/search-bar.d.ts +0 -3
  13. package/dist/src/embed/search-bar.d.ts.map +1 -1
  14. package/dist/src/embed/search.d.ts +5 -9
  15. package/dist/src/embed/search.d.ts.map +1 -1
  16. package/dist/src/embed/ts-embed.d.ts +6 -43
  17. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  18. package/dist/src/errors.d.ts.map +1 -1
  19. package/dist/src/index.d.ts.map +1 -1
  20. package/dist/src/mixpanel-service.d.ts +0 -8
  21. package/dist/src/mixpanel-service.d.ts.map +1 -1
  22. package/dist/src/react/index.d.ts.map +1 -1
  23. package/dist/src/react/util.d.ts +0 -4
  24. package/dist/src/react/util.d.ts.map +1 -1
  25. package/dist/src/test/test-utils.d.ts +2 -11
  26. package/dist/src/test/test-utils.d.ts.map +1 -1
  27. package/dist/src/types.d.ts +76 -273
  28. package/dist/src/types.d.ts.map +1 -1
  29. package/dist/src/utils/answerService.d.ts +0 -7
  30. package/dist/src/utils/answerService.d.ts.map +1 -1
  31. package/dist/src/utils/authService.d.ts +0 -30
  32. package/dist/src/utils/authService.d.ts.map +1 -1
  33. package/dist/src/utils/processData.d.ts +0 -12
  34. package/dist/src/utils/processData.d.ts.map +1 -1
  35. package/dist/src/utils/processTrigger.d.ts +0 -7
  36. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  37. package/dist/src/utils.d.ts +0 -12
  38. package/dist/src/utils.d.ts.map +1 -1
  39. package/dist/tsembed.es.js +262 -637
  40. package/dist/tsembed.js +261 -629
  41. package/lib/package.json +8 -3
  42. package/lib/src/auth.d.ts +2 -38
  43. package/lib/src/auth.d.ts.map +1 -1
  44. package/lib/src/auth.js +25 -70
  45. package/lib/src/auth.js.map +1 -1
  46. package/lib/src/auth.spec.js +5 -14
  47. package/lib/src/auth.spec.js.map +1 -1
  48. package/lib/src/config.d.ts +0 -1
  49. package/lib/src/config.d.ts.map +1 -1
  50. package/lib/src/config.js +3 -5
  51. package/lib/src/config.js.map +1 -1
  52. package/lib/src/config.spec.js.map +1 -1
  53. package/lib/src/embed/app.d.ts +5 -17
  54. package/lib/src/embed/app.d.ts.map +1 -1
  55. package/lib/src/embed/app.js +15 -25
  56. package/lib/src/embed/app.js.map +1 -1
  57. package/lib/src/embed/app.spec.js +12 -12
  58. package/lib/src/embed/app.spec.js.map +1 -1
  59. package/lib/src/embed/base.d.ts +9 -20
  60. package/lib/src/embed/base.d.ts.map +1 -1
  61. package/lib/src/embed/base.js +15 -31
  62. package/lib/src/embed/base.js.map +1 -1
  63. package/lib/src/embed/base.spec.js.map +1 -1
  64. package/lib/src/embed/embed.spec.js +1 -1
  65. package/lib/src/embed/embed.spec.js.map +1 -1
  66. package/lib/src/embed/liveboard.d.ts +5 -17
  67. package/lib/src/embed/liveboard.d.ts.map +1 -1
  68. package/lib/src/embed/liveboard.js +37 -49
  69. package/lib/src/embed/liveboard.js.map +1 -1
  70. package/lib/src/embed/liveboard.spec.js +30 -37
  71. package/lib/src/embed/liveboard.spec.js.map +1 -1
  72. package/lib/src/embed/pinboard.spec.js +26 -14
  73. package/lib/src/embed/pinboard.spec.js.map +1 -1
  74. package/lib/src/embed/search-bar.d.ts +0 -3
  75. package/lib/src/embed/search-bar.d.ts.map +1 -1
  76. package/lib/src/embed/search-bar.js +6 -5
  77. package/lib/src/embed/search-bar.js.map +1 -1
  78. package/lib/src/embed/search.d.ts +5 -9
  79. package/lib/src/embed/search.d.ts.map +1 -1
  80. package/lib/src/embed/search.js +14 -18
  81. package/lib/src/embed/search.js.map +1 -1
  82. package/lib/src/embed/search.spec.js +19 -16
  83. package/lib/src/embed/search.spec.js.map +1 -1
  84. package/lib/src/embed/searchEmbed-basic-auth.spec.js +0 -4
  85. package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -1
  86. package/lib/src/embed/ts-embed.d.ts +6 -43
  87. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  88. package/lib/src/embed/ts-embed.js +72 -117
  89. package/lib/src/embed/ts-embed.js.map +1 -1
  90. package/lib/src/embed/ts-embed.spec.js +24 -23
  91. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  92. package/lib/src/errors.d.ts.map +1 -1
  93. package/lib/src/errors.js.map +1 -1
  94. package/lib/src/index.d.ts.map +1 -1
  95. package/lib/src/index.js +2 -2
  96. package/lib/src/index.js.map +1 -1
  97. package/lib/src/mixpanel-service.d.ts +0 -8
  98. package/lib/src/mixpanel-service.d.ts.map +1 -1
  99. package/lib/src/mixpanel-service.js +1 -13
  100. package/lib/src/mixpanel-service.js.map +1 -1
  101. package/lib/src/mixpanel-service.spec.js.map +1 -1
  102. package/lib/src/react/index.d.ts.map +1 -1
  103. package/lib/src/react/index.js +6 -6
  104. package/lib/src/react/index.js.map +1 -1
  105. package/lib/src/react/index.spec.js +6 -15
  106. package/lib/src/react/index.spec.js.map +1 -1
  107. package/lib/src/react/util.d.ts +0 -4
  108. package/lib/src/react/util.d.ts.map +1 -1
  109. package/lib/src/react/util.js +0 -4
  110. package/lib/src/react/util.js.map +1 -1
  111. package/lib/src/test/test-utils.d.ts +2 -11
  112. package/lib/src/test/test-utils.d.ts.map +1 -1
  113. package/lib/src/test/test-utils.js +25 -36
  114. package/lib/src/test/test-utils.js.map +1 -1
  115. package/lib/src/types.d.ts +76 -273
  116. package/lib/src/types.d.ts.map +1 -1
  117. package/lib/src/types.js +54 -200
  118. package/lib/src/types.js.map +1 -1
  119. package/lib/src/utils/answerService.d.ts +0 -7
  120. package/lib/src/utils/answerService.d.ts.map +1 -1
  121. package/lib/src/utils/answerService.js +0 -7
  122. package/lib/src/utils/answerService.js.map +1 -1
  123. package/lib/src/utils/answerService.spec.js.map +1 -1
  124. package/lib/src/utils/authService.d.ts +0 -30
  125. package/lib/src/utils/authService.d.ts.map +1 -1
  126. package/lib/src/utils/authService.js +2 -39
  127. package/lib/src/utils/authService.js.map +1 -1
  128. package/lib/src/utils/authService.spec.js.map +1 -1
  129. package/lib/src/utils/processData.d.ts +0 -12
  130. package/lib/src/utils/processData.d.ts.map +1 -1
  131. package/lib/src/utils/processData.js +5 -33
  132. package/lib/src/utils/processData.js.map +1 -1
  133. package/lib/src/utils/processData.spec.js.map +1 -1
  134. package/lib/src/utils/processTrigger.d.ts +0 -7
  135. package/lib/src/utils/processTrigger.d.ts.map +1 -1
  136. package/lib/src/utils/processTrigger.js +3 -17
  137. package/lib/src/utils/processTrigger.js.map +1 -1
  138. package/lib/src/utils/processTrigger.spec.js.map +1 -1
  139. package/lib/src/utils.d.ts +0 -12
  140. package/lib/src/utils.d.ts.map +1 -1
  141. package/lib/src/utils.js +19 -24
  142. package/lib/src/utils.js.map +1 -1
  143. package/lib/src/utils.spec.js.map +1 -1
  144. package/lib/src/visual-embed-sdk.d.ts +102 -406
  145. package/package.json +8 -3
  146. package/src/auth.spec.ts +150 -68
  147. package/src/auth.ts +108 -102
  148. package/src/config.spec.ts +4 -2
  149. package/src/config.ts +3 -5
  150. package/src/embed/app.spec.ts +14 -25
  151. package/src/embed/app.ts +35 -47
  152. package/src/embed/base.spec.ts +9 -3
  153. package/src/embed/base.ts +53 -51
  154. package/src/embed/embed.spec.ts +6 -5
  155. package/src/embed/liveboard.spec.ts +37 -56
  156. package/src/embed/liveboard.ts +64 -66
  157. package/src/embed/pinboard.spec.ts +29 -26
  158. package/src/embed/search-bar.tsx +8 -10
  159. package/src/embed/search.spec.ts +21 -31
  160. package/src/embed/search.ts +25 -26
  161. package/src/embed/searchEmbed-basic-auth.spec.ts +28 -22
  162. package/src/embed/ts-embed.spec.ts +148 -70
  163. package/src/embed/ts-embed.ts +157 -147
  164. package/src/errors.ts +6 -3
  165. package/src/index.ts +10 -4
  166. package/src/mixpanel-service.spec.ts +3 -1
  167. package/src/mixpanel-service.ts +1 -13
  168. package/src/react/index.spec.tsx +13 -37
  169. package/src/react/index.tsx +57 -38
  170. package/src/react/util.ts +4 -8
  171. package/src/test/test-utils.ts +39 -43
  172. package/src/types.ts +78 -270
  173. package/src/utils/answerService.spec.ts +5 -3
  174. package/src/utils/answerService.ts +17 -21
  175. package/src/utils/authService.spec.ts +41 -26
  176. package/src/utils/authService.ts +21 -47
  177. package/src/utils/processData.spec.ts +59 -26
  178. package/src/utils/processData.ts +14 -36
  179. package/src/utils/processTrigger.spec.ts +6 -1
  180. package/src/utils/processTrigger.ts +9 -18
  181. package/src/utils.spec.ts +12 -8
  182. package/src/utils.ts +26 -25
@@ -19,7 +19,6 @@ import {
19
19
  postMessageToParent,
20
20
  defaultParamsForPinboardEmbed,
21
21
  waitFor,
22
- expectUrlMatchesWithParams,
23
22
  } from '../test/test-utils';
24
23
  import * as config from '../config';
25
24
  import * as tsEmbedInstance from './ts-embed';
@@ -64,7 +63,10 @@ const customisationsView = {
64
63
  };
65
64
 
66
65
  describe('Unit test case for ts embed', () => {
67
- const mockMixPanelEvent = jest.spyOn(mixpanelInstance, 'uploadMixpanelEvent');
66
+ const mockMixPanelEvent = jest.spyOn(
67
+ mixpanelInstance,
68
+ 'uploadMixpanelEvent',
69
+ );
68
70
  beforeEach(() => {
69
71
  document.body.innerHTML = getDocumentBody();
70
72
  });
@@ -95,7 +97,11 @@ describe('Unit test case for ts embed', () => {
95
97
  };
96
98
  await executeAfterWait(() => {
97
99
  const iframe = getIFrameEl();
98
- postMessageToParent(iframe.contentWindow, mockEmbedEventPayload, mockPort);
100
+ postMessageToParent(
101
+ iframe.contentWindow,
102
+ mockEmbedEventPayload,
103
+ mockPort,
104
+ );
99
105
  });
100
106
  expect(mockPort.postMessage).toHaveBeenCalledWith({
101
107
  type: EmbedEvent.APP_INIT,
@@ -118,7 +124,11 @@ describe('Unit test case for ts embed', () => {
118
124
  };
119
125
  await executeAfterWait(() => {
120
126
  const iframe = getIFrameEl();
121
- postMessageToParent(iframe.contentWindow, mockEmbedEventPayload, mockPort);
127
+ postMessageToParent(
128
+ iframe.contentWindow,
129
+ mockEmbedEventPayload,
130
+ mockPort,
131
+ );
122
132
  });
123
133
  expect(mockPort.postMessage).toHaveBeenCalledWith({
124
134
  type: EmbedEvent.APP_INIT,
@@ -149,7 +159,10 @@ describe('Unit test case for ts embed', () => {
149
159
 
150
160
  executeAfterWait(() => {
151
161
  const iframe = getIFrameEl();
152
- postMessageToParent(iframe.contentWindow, mockEmbedEventPayload);
162
+ postMessageToParent(
163
+ iframe.contentWindow,
164
+ mockEmbedEventPayload,
165
+ );
153
166
  });
154
167
  });
155
168
 
@@ -169,8 +182,13 @@ describe('Unit test case for ts embed', () => {
169
182
  executeAfterWait(() => {
170
183
  const iframe = getIFrameEl();
171
184
  iframe.contentWindow.postMessage = jest.fn();
172
- postMessageToParent(iframe.contentWindow, mockEmbedEventPayload);
173
- expect(iframe.contentWindow.postMessage).toHaveBeenCalledTimes(0);
185
+ postMessageToParent(
186
+ iframe.contentWindow,
187
+ mockEmbedEventPayload,
188
+ );
189
+ expect(iframe.contentWindow.postMessage).toHaveBeenCalledTimes(
190
+ 0,
191
+ );
174
192
  });
175
193
  });
176
194
 
@@ -190,7 +208,10 @@ describe('Unit test case for ts embed', () => {
190
208
 
191
209
  executeAfterWait(() => {
192
210
  const iframe = getIFrameEl();
193
- postMessageToParent(iframe.contentWindow, mockEmbedEventPayload);
211
+ postMessageToParent(
212
+ iframe.contentWindow,
213
+ mockEmbedEventPayload,
214
+ );
194
215
  }, 1000);
195
216
  });
196
217
 
@@ -214,8 +235,13 @@ describe('Unit test case for ts embed', () => {
214
235
  executeAfterWait(() => {
215
236
  const iframe = getIFrameEl();
216
237
  iframe.contentWindow.postMessage = jest.fn();
217
- postMessageToParent(iframe.contentWindow, mockEmbedEventPayload);
218
- expect(iframe.contentWindow.postMessage).toHaveBeenCalledTimes(0);
238
+ postMessageToParent(
239
+ iframe.contentWindow,
240
+ mockEmbedEventPayload,
241
+ );
242
+ expect(iframe.contentWindow.postMessage).toHaveBeenCalledTimes(
243
+ 0,
244
+ );
219
245
  }, 1000);
220
246
  });
221
247
  });
@@ -243,7 +269,11 @@ describe('Unit test case for ts embed', () => {
243
269
  };
244
270
  await executeAfterWait(() => {
245
271
  const iframe = getIFrameEl();
246
- postMessageToParent(iframe.contentWindow, mockEmbedEventPayload, mockPort);
272
+ postMessageToParent(
273
+ iframe.contentWindow,
274
+ mockEmbedEventPayload,
275
+ mockPort,
276
+ );
247
277
  });
248
278
  await executeAfterWait(() => {
249
279
  expect(mockPort.postMessage).toHaveBeenCalledWith({
@@ -279,7 +309,11 @@ describe('Unit test case for ts embed', () => {
279
309
  };
280
310
  await executeAfterWait(() => {
281
311
  const iframe = getIFrameEl();
282
- postMessageToParent(iframe.contentWindow, mockEmbedEventPayload, mockPort);
312
+ postMessageToParent(
313
+ iframe.contentWindow,
314
+ mockEmbedEventPayload,
315
+ mockPort,
316
+ );
283
317
  });
284
318
  await executeAfterWait(() => {
285
319
  expect(baseInstance.notifyAuthFailure).toBeCalledWith(
@@ -315,7 +349,10 @@ describe('Unit test case for ts embed', () => {
315
349
  searchEmbed.render();
316
350
  await executeAfterWait(() => {
317
351
  const iframe = getIFrameEl();
318
- postMessageToParent(iframe.contentWindow, mockEmbedEventPayload);
352
+ postMessageToParent(
353
+ iframe.contentWindow,
354
+ mockEmbedEventPayload,
355
+ );
319
356
  });
320
357
  await executeAfterWait(() => {
321
358
  expect(baseInstance.notifyAuthFailure).toBeCalledWith(
@@ -343,7 +380,10 @@ describe('Unit test case for ts embed', () => {
343
380
  searchEmbed.render();
344
381
  await executeAfterWait(() => {
345
382
  const iframe = getIFrameEl();
346
- postMessageToParent(iframe.contentWindow, mockEmbedEventPayload);
383
+ postMessageToParent(
384
+ iframe.contentWindow,
385
+ mockEmbedEventPayload,
386
+ );
347
387
  });
348
388
  await executeAfterWait(() => {
349
389
  expect(baseInstance.notifyAuthFailure).toBeCalledWith(
@@ -376,7 +416,9 @@ describe('Unit test case for ts embed', () => {
376
416
  },
377
417
  );
378
418
  const iFrame: any = document.createElement('div');
379
- jest.spyOn(baseInstance, 'getAuthPromise').mockResolvedValueOnce(isLoggedIn);
419
+ jest.spyOn(baseInstance, 'getAuthPromise').mockResolvedValueOnce(
420
+ isLoggedIn,
421
+ );
380
422
  const tsEmbed = new SearchEmbed(getRootEl(), {});
381
423
  iFrame.contentWindow = null;
382
424
  tsEmbed.on(EmbedEvent.CustomAction, jest.fn());
@@ -391,13 +433,19 @@ describe('Unit test case for ts embed', () => {
391
433
 
392
434
  test('mixpanel should call with VISUAL_SDK_RENDER_COMPLETE', async () => {
393
435
  await setup(true);
394
- expect(mockMixPanelEvent).toBeCalledWith(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
395
- expect(mockMixPanelEvent).toBeCalledWith(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE);
436
+ expect(mockMixPanelEvent).toBeCalledWith(
437
+ MIXPANEL_EVENT.VISUAL_SDK_RENDER_START,
438
+ );
439
+ expect(mockMixPanelEvent).toBeCalledWith(
440
+ MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE,
441
+ );
396
442
  });
397
443
 
398
444
  test('Should remove prefetch iframe', async () => {
399
445
  await setup(true);
400
- const prefetchIframe = document.querySelectorAll<HTMLIFrameElement>('.prefetchIframe');
446
+ const prefetchIframe = document.querySelectorAll<HTMLIFrameElement>(
447
+ '.prefetchIframe',
448
+ );
401
449
  expect(prefetchIframe.length).toBe(0);
402
450
  });
403
451
 
@@ -419,7 +467,9 @@ describe('Unit test case for ts embed', () => {
419
467
  });
420
468
 
421
469
  beforeEach(() => {
422
- jest.spyOn(baseInstance, 'getAuthPromise').mockRejectedValueOnce(false);
470
+ jest.spyOn(baseInstance, 'getAuthPromise').mockRejectedValueOnce(
471
+ false,
472
+ );
423
473
  const tsEmbed = new SearchEmbed(getRootEl(), {});
424
474
  const iFrame: any = document.createElement('div');
425
475
  iFrame.contentWindow = null;
@@ -429,10 +479,15 @@ describe('Unit test case for ts embed', () => {
429
479
  });
430
480
 
431
481
  test('mixpanel should call with VISUAL_SDK_RENDER_FAILED', () => {
432
- expect(mockMixPanelEvent).toBeCalledWith(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
433
- expect(mockMixPanelEvent).toBeCalledWith(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, {
434
- error: 'false',
435
- });
482
+ expect(mockMixPanelEvent).toBeCalledWith(
483
+ MIXPANEL_EVENT.VISUAL_SDK_RENDER_START,
484
+ );
485
+ expect(mockMixPanelEvent).toBeCalledWith(
486
+ MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED,
487
+ {
488
+ error: 'false',
489
+ },
490
+ );
436
491
  });
437
492
  });
438
493
 
@@ -461,11 +516,6 @@ describe('Unit test case for ts embed', () => {
461
516
  expect(pinboardEmbed['isError']).toBe(false);
462
517
  });
463
518
 
464
- /**
465
- *
466
- * @param hiddenActions
467
- * @param visibleActions
468
- */
469
519
  async function testActionsForLiveboards(
470
520
  hiddenActions: Array<Action>,
471
521
  visibleActions: Array<Action>,
@@ -484,7 +534,10 @@ describe('Unit test case for ts embed', () => {
484
534
  );
485
535
  }
486
536
  test('should throw error when there are both visible and hidden action arrays', async () => {
487
- await testActionsForLiveboards([Action.DownloadAsCsv], [Action.DownloadAsCsv]);
537
+ await testActionsForLiveboards(
538
+ [Action.DownloadAsCsv],
539
+ [Action.DownloadAsCsv],
540
+ );
488
541
  });
489
542
  test('should throw error when there are both visible and hidden actions arrays as empty', async () => {
490
543
  await testActionsForLiveboards([], []);
@@ -515,7 +568,9 @@ describe('Unit test case for ts embed', () => {
515
568
 
516
569
  describe('when thoughtSpotHost is empty', () => {
517
570
  beforeAll(() => {
518
- jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(() => '');
571
+ jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(
572
+ () => '',
573
+ );
519
574
  init({
520
575
  thoughtSpotHost: '',
521
576
  authType: AuthType.None,
@@ -536,7 +591,10 @@ describe('Unit test case for ts embed', () => {
536
591
  describe('V1Embed ', () => {
537
592
  test('when isRendered is true than isError will be true', () => {
538
593
  spyOn(console, 'error');
539
- const viEmbedIns = new tsEmbedInstance.V1Embed(getRootEl(), defaultViewConfig);
594
+ const viEmbedIns = new tsEmbedInstance.V1Embed(
595
+ getRootEl(),
596
+ defaultViewConfig,
597
+ );
540
598
  expect(viEmbedIns['isError']).toBe(false);
541
599
  viEmbedIns.render();
542
600
  viEmbedIns.on(EmbedEvent.CustomAction, jest.fn()).render();
@@ -551,7 +609,9 @@ describe('Unit test case for ts embed', () => {
551
609
  const path = 'viz/e0836cad-4fdf-42d4-bd97-567a6b2a6058';
552
610
 
553
611
  beforeEach(() => {
554
- jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(() => 'http://tshost');
612
+ jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(
613
+ () => 'http://tshost',
614
+ );
555
615
  });
556
616
 
557
617
  test('when app is PinboardEmbed after navigateToPage function call, new path should be set to iframe', async () => {
@@ -560,8 +620,7 @@ describe('Unit test case for ts embed', () => {
560
620
  });
561
621
  await pinboardEmbed.render();
562
622
  // pinboardEmbed.navigateToPage(path);
563
- expectUrlMatchesWithParams(
564
- getIFrameSrc(),
623
+ expect(getIFrameSrc()).toBe(
565
624
  `http://${thoughtSpotHost}/?embedApp=true&${defaultParamsForPinboardEmbed}&isLiveboardEmbed=true${defaultParamsPost}#/embed/${path}`,
566
625
  );
567
626
  });
@@ -574,9 +633,8 @@ describe('Unit test case for ts embed', () => {
574
633
  },
575
634
  });
576
635
  await appEmbed.render();
577
- appEmbed.navigateToPage(path, false);
578
- expectUrlMatchesWithParams(
579
- getIFrameSrc(),
636
+ appEmbed.navigateToPage(path);
637
+ expect(getIFrameSrc()).toBe(
580
638
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}${defaultParamsPost}#/${path}`,
581
639
  );
582
640
  });
@@ -589,7 +647,7 @@ describe('Unit test case for ts embed', () => {
589
647
  height: '100%',
590
648
  },
591
649
  });
592
- appEmbed.navigateToPage(path, false);
650
+ appEmbed.navigateToPage(path);
593
651
  await appEmbed.render();
594
652
  expect(console.log).toHaveBeenCalledWith(
595
653
  'Please call render before invoking this method',
@@ -600,7 +658,9 @@ describe('Unit test case for ts embed', () => {
600
658
  const path = 'pinboard/e0836cad-4fdf-42d4-bd97-567a6b2a6058';
601
659
 
602
660
  beforeEach(() => {
603
- jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(() => 'http://tshost');
661
+ jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(
662
+ () => 'http://tshost',
663
+ );
604
664
  });
605
665
 
606
666
  test('when app is AppEmbed after navigateToPage function call, new path should be set to iframe', async () => {
@@ -611,9 +671,8 @@ describe('Unit test case for ts embed', () => {
611
671
  },
612
672
  });
613
673
  await appEmbed.render();
614
- appEmbed.navigateToPage(path, false);
615
- expectUrlMatchesWithParams(
616
- getIFrameSrc(),
674
+ appEmbed.navigateToPage(path);
675
+ expect(getIFrameSrc()).toBe(
617
676
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}${defaultParamsPost}#/${path}`,
618
677
  );
619
678
  });
@@ -641,7 +700,9 @@ describe('Unit test case for ts embed', () => {
641
700
  },
642
701
  });
643
702
  tsEmbed.render();
644
- waitFor(() => !!getIFrameEl()).then(() => {
703
+ waitFor(() => {
704
+ return !!getIFrameEl();
705
+ }).then(() => {
645
706
  expect(getIFrameSrc()).toContain('?base64UrlEncodedFlags');
646
707
  });
647
708
  });
@@ -653,14 +714,18 @@ describe('Unit test case for ts embed', () => {
653
714
  },
654
715
  });
655
716
  appEmbed.render();
656
- waitFor(() => !!getIFrameEl()).then(() => {
717
+ waitFor(() => {
718
+ return !!getIFrameEl();
719
+ }).then(() => {
657
720
  expect(getIFrameSrc()).toContain('?base64UrlEncodedFlags');
658
721
  });
659
722
  });
660
723
  });
661
724
  describe('Iframe flags', () => {
662
725
  beforeEach(() => {
663
- jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(() => 'http://tshost');
726
+ jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(
727
+ () => 'http://tshost',
728
+ );
664
729
  });
665
730
 
666
731
  test('Set Frame params to the iframe as attributes', async () => {
@@ -689,10 +754,9 @@ describe('Unit test case for ts embed', () => {
689
754
  },
690
755
  });
691
756
  await appEmbed.render();
692
- expectUrlMatchesWithParams(
693
- getIFrameSrc(),
694
- `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
695
- + `&foo=bar&baz=1&bool=true${defaultParamsPost}#/home`,
757
+ expect(getIFrameSrc()).toBe(
758
+ `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}` +
759
+ `&foo=bar&baz=1&bool=true${defaultParamsPost}#/home`,
696
760
  );
697
761
  });
698
762
 
@@ -705,10 +769,9 @@ describe('Unit test case for ts embed', () => {
705
769
  showAlerts: true,
706
770
  });
707
771
  await appEmbed.render();
708
- expectUrlMatchesWithParams(
709
- getIFrameSrc(),
710
- `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
711
- + `&showAlerts=true${defaultParamsPost}#/home`,
772
+ expect(getIFrameSrc()).toBe(
773
+ `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}` +
774
+ `&showAlerts=true${defaultParamsPost}#/home`,
712
775
  );
713
776
  });
714
777
  it('Sets the locale param', async () => {
@@ -720,10 +783,9 @@ describe('Unit test case for ts embed', () => {
720
783
  locale: 'ja-JP',
721
784
  });
722
785
  await appEmbed.render();
723
- expectUrlMatchesWithParams(
724
- getIFrameSrc(),
725
- `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
726
- + `&locale=ja-JP${defaultParamsPost}#/home`,
786
+ expect(getIFrameSrc()).toBe(
787
+ `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}` +
788
+ `&locale=ja-JP${defaultParamsPost}#/home`,
727
789
  );
728
790
  });
729
791
  it('Sets the iconSprite url', async () => {
@@ -737,10 +799,9 @@ describe('Unit test case for ts embed', () => {
737
799
  },
738
800
  });
739
801
  await appEmbed.render();
740
- expectUrlMatchesWithParams(
741
- getIFrameSrc(),
742
- `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
743
- + `&iconSprite=iconSprite.com${defaultParamsPost}#/home`,
802
+ expect(getIFrameSrc()).toBe(
803
+ `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}` +
804
+ `&iconSprite=iconSprite.com${defaultParamsPost}#/home`,
744
805
  );
745
806
  });
746
807
  it('inserts as sibling of root node if configured', async () => {
@@ -781,7 +842,9 @@ describe('Unit test case for ts embed', () => {
781
842
  },
782
843
  });
783
844
  appEmbed.render();
784
- waitFor(() => !!getIFrameEl()).then(() => {
845
+ waitFor(() => {
846
+ return !!getIFrameEl();
847
+ }).then(() => {
785
848
  expect(getIFrameSrc()).toContain('authType=EmbeddedSSO');
786
849
  expect(getIFrameSrc()).toContain('forceSAMLAutoRedirect=true');
787
850
  done();
@@ -818,7 +881,9 @@ describe('Unit test case for ts embed', () => {
818
881
  });
819
882
 
820
883
  it("Should remove the error message on destroy if it's present", async () => {
821
- jest.spyOn(baseInstance, 'getAuthPromise').mockResolvedValueOnce(false);
884
+ jest.spyOn(baseInstance, 'getAuthPromise').mockResolvedValueOnce(
885
+ false,
886
+ );
822
887
  const appEmbed = new AppEmbed(getRootEl(), {
823
888
  frameParams: {
824
889
  width: '100%',
@@ -827,7 +892,9 @@ describe('Unit test case for ts embed', () => {
827
892
  insertAsSibling: true,
828
893
  });
829
894
  await appEmbed.render();
830
- expect(getRootEl().nextElementSibling.innerHTML).toContain('Not logged in');
895
+ expect(getRootEl().nextElementSibling.innerHTML).toContain(
896
+ 'Not logged in',
897
+ );
831
898
  appEmbed.destroy();
832
899
  expect(getRootEl().nextElementSibling.innerHTML).toBe('');
833
900
  });
@@ -845,7 +912,9 @@ describe('Unit test case for ts embed', () => {
845
912
  });
846
913
 
847
914
  beforeEach(() => {
848
- jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(() => 'http://tshost');
915
+ jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(
916
+ () => 'http://tshost',
917
+ );
849
918
  });
850
919
 
851
920
  afterAll((): void => {
@@ -853,20 +922,29 @@ describe('Unit test case for ts embed', () => {
853
922
  });
854
923
 
855
924
  it('get url params for TS', () => {
856
- const tsEmbed = new tsEmbedInstance.TsEmbed(getRootEl(), defaultViewConfig);
857
- const urlHash = '#/analyze?ts-app=thoughtspot&ts-id=123&title=embed-sdk';
925
+ const tsEmbed = new tsEmbedInstance.TsEmbed(
926
+ getRootEl(),
927
+ defaultViewConfig,
928
+ );
929
+ const urlHash =
930
+ '#/analyze?ts-app=thoughtspot&ts-id=123&title=embed-sdk';
858
931
  window.location.hash = urlHash;
859
932
  const postHashParams = '?ts-app=thoughtspot&ts-id=123';
860
933
  expect(tsEmbed.getThoughtSpotPostUrlParams()).toBe(postHashParams);
861
934
  });
862
935
 
863
936
  it('validate query params and postHash params for TS', () => {
864
- const tsEmbed = new tsEmbedInstance.TsEmbed(getRootEl(), defaultViewConfig);
865
- const urlHash = '#/analyze?ts-app=thoughtspot&ts-id=123&title=embed-sdk';
937
+ const tsEmbed = new tsEmbedInstance.TsEmbed(
938
+ getRootEl(),
939
+ defaultViewConfig,
940
+ );
941
+ const urlHash =
942
+ '#/analyze?ts-app=thoughtspot&ts-id=123&title=embed-sdk';
866
943
  window.location.hash = urlHash;
867
944
  const urlSearch = '?ts-type=subscribe&search-title=abc';
868
945
  window.location.search = urlSearch;
869
- const postHashParams = '?ts-type=subscribe&ts-app=thoughtspot&ts-id=123';
946
+ const postHashParams =
947
+ '?ts-type=subscribe&ts-app=thoughtspot&ts-id=123';
870
948
  expect(tsEmbed.getThoughtSpotPostUrlParams()).toBe(postHashParams);
871
949
  });
872
950
  });