@thoughtspot/visual-embed-sdk 1.11.0-auth.10 → 1.11.0-auth.13

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 (53) hide show
  1. package/dist/src/auth.d.ts +11 -0
  2. package/dist/src/embed/base.d.ts +18 -4
  3. package/dist/src/embed/ts-embed.d.ts +0 -1
  4. package/dist/src/index.d.ts +2 -1
  5. package/dist/src/types.d.ts +5 -0
  6. package/dist/src/utils/processData.d.ts +1 -1
  7. package/dist/tsembed.es.js +451 -42
  8. package/dist/tsembed.js +448 -41
  9. package/lib/package.json +2 -1
  10. package/lib/src/auth.d.ts +11 -0
  11. package/lib/src/auth.js +17 -8
  12. package/lib/src/auth.js.map +1 -1
  13. package/lib/src/auth.spec.js +54 -1
  14. package/lib/src/auth.spec.js.map +1 -1
  15. package/lib/src/embed/base.d.ts +18 -4
  16. package/lib/src/embed/base.js +60 -12
  17. package/lib/src/embed/base.js.map +1 -1
  18. package/lib/src/embed/base.spec.js +47 -2
  19. package/lib/src/embed/base.spec.js.map +1 -1
  20. package/lib/src/embed/embed.spec.js +1 -1
  21. package/lib/src/embed/embed.spec.js.map +1 -1
  22. package/lib/src/embed/ts-embed.d.ts +0 -1
  23. package/lib/src/embed/ts-embed.js +5 -16
  24. package/lib/src/embed/ts-embed.js.map +1 -1
  25. package/lib/src/index.d.ts +2 -1
  26. package/lib/src/index.js +2 -1
  27. package/lib/src/index.js.map +1 -1
  28. package/lib/src/types.d.ts +5 -0
  29. package/lib/src/types.js +5 -0
  30. package/lib/src/types.js.map +1 -1
  31. package/lib/src/utils/authService.js +4 -5
  32. package/lib/src/utils/authService.js.map +1 -1
  33. package/lib/src/utils/authService.spec.js +10 -0
  34. package/lib/src/utils/authService.spec.js.map +1 -1
  35. package/lib/src/utils/processData.d.ts +1 -1
  36. package/lib/src/utils/processData.js +27 -3
  37. package/lib/src/utils/processData.js.map +1 -1
  38. package/lib/src/utils/processData.spec.js +85 -4
  39. package/lib/src/utils/processData.spec.js.map +1 -1
  40. package/lib/src/visual-embed-sdk.d.ts +86 -5
  41. package/package.json +2 -1
  42. package/src/auth.spec.ts +67 -1
  43. package/src/auth.ts +17 -7
  44. package/src/embed/base.spec.ts +54 -3
  45. package/src/embed/base.ts +75 -16
  46. package/src/embed/embed.spec.ts +1 -1
  47. package/src/embed/ts-embed.ts +10 -19
  48. package/src/index.ts +3 -0
  49. package/src/types.ts +5 -0
  50. package/src/utils/authService.spec.ts +13 -0
  51. package/src/utils/authService.ts +3 -5
  52. package/src/utils/processData.spec.ts +114 -4
  53. package/src/utils/processData.ts +41 -4
@@ -12,6 +12,17 @@ export declare const EndPoints: {
12
12
  BASIC_LOGIN: string;
13
13
  LOGOUT: string;
14
14
  };
15
+ export declare enum AuthFailureType {
16
+ SDK = "SDK",
17
+ NO_COOKIE_ACCESS = "NO_COOKIE_ACCESS",
18
+ EXPIRY = "EXPIRY",
19
+ OTHER = "OTHER"
20
+ }
21
+ export declare enum AuthStatus {
22
+ FAILURE = "FAILURE",
23
+ SUCCESS = "SUCCESS",
24
+ LOGOUT = "LOGOUT"
25
+ }
15
26
  /**
16
27
  * Return sessionInfo if available else make a loggedIn check to fetch the sessionInfo
17
28
  */
@@ -1,11 +1,24 @@
1
+ /**
2
+ * Copyright (c) 2022
3
+ *
4
+ * Base classes
5
+ *
6
+ * @summary Base classes
7
+ * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
8
+ */
9
+ import EventEmitter from 'eventemitter3';
1
10
  import { EmbedConfig } from '../types';
11
+ import { AuthFailureType } from '../auth';
2
12
  export declare let authPromise: Promise<boolean>;
13
+ export declare const getEmbedConfig: () => EmbedConfig;
14
+ export declare const getAuthPromise: () => Promise<boolean>;
15
+ export declare function notifyAuthSuccess(): void;
16
+ export declare function notifyAuthFailure(failureType: AuthFailureType): void;
17
+ export declare function notifyLogout(): void;
3
18
  /**
4
19
  * Perform authentication on the ThoughtSpot app as applicable.
5
20
  */
6
21
  export declare const handleAuth: () => Promise<boolean>;
7
- export declare const getEmbedConfig: () => EmbedConfig;
8
- export declare const getAuthPromise: () => Promise<boolean>;
9
22
  /**
10
23
  * Prefetches static resources from the specified URL. Web browsers can then cache the prefetched resources and serve them from the user's local disk to provide faster access to your app.
11
24
  * @param url The URL provided for prefetch
@@ -19,10 +32,11 @@ export declare const prefetch: (url?: string) => void;
19
32
  *
20
33
  * @returns authPromise Promise which resolves when authentication is complete.
21
34
  */
22
- export declare const init: (embedConfig: EmbedConfig) => Promise<boolean>;
23
- export declare const logout: () => Promise<boolean>;
35
+ export declare const init: (embedConfig: EmbedConfig) => EventEmitter;
36
+ export declare const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolean>;
24
37
  /**
25
38
  * Renders functions in a queue, resolves to next function only after the callback next is called
26
39
  * @param fn The function being registered
27
40
  */
28
41
  export declare const renderInQueue: (fn: (next?: (val?: any) => void) => void) => void;
42
+ export declare function reset(): void;
@@ -143,7 +143,6 @@ export declare class TsEmbed {
143
143
  */
144
144
  private shouldEncodeUrlQueryParams;
145
145
  constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
146
- private getLoginFiledMessage;
147
146
  /**
148
147
  * Gets a reference to the root DOM node where
149
148
  * the embedded content will appear.
@@ -11,5 +11,6 @@ import { AppEmbed, Page, AppViewConfig } from './embed/app';
11
11
  import { init, prefetch, logout } from './embed/base';
12
12
  import { PinboardEmbed, LiveboardViewConfig, LiveboardEmbed } from './embed/liveboard';
13
13
  import { SearchEmbed, SearchViewConfig } from './embed/search';
14
+ import { AuthFailureType, AuthStatus } from './auth';
14
15
  import { AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig } from './types';
15
- export { init, logout, prefetch, SearchEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, SearchViewConfig, LiveboardViewConfig, AppViewConfig, };
16
+ export { init, logout, prefetch, SearchEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, AuthFailureType, AuthStatus, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, SearchViewConfig, LiveboardViewConfig, AppViewConfig, };
@@ -337,6 +337,11 @@ export declare enum EmbedEvent {
337
337
  * The ThoughtSpot auth session has expired.
338
338
  */
339
339
  AuthExpire = "ThoughtspotAuthExpired",
340
+ /**
341
+ * ThoughtSpot failed to validate the auth session.
342
+ * @hidden
343
+ */
344
+ AuthFailure = "ThoughtspotAuthFailure",
340
345
  /**
341
346
  * The height of the embedded Liveboard or visualization has been computed.
342
347
  * @return data - The height of the embedded Liveboard or visualization
@@ -1,3 +1,3 @@
1
1
  import { EmbedEvent } from '../types';
2
2
  export declare function processCustomAction(e: any, thoughtSpotHost: string): any;
3
- export declare function getProcessData(type: EmbedEvent, e: any, thoughtSpotHost: string): any;
3
+ export declare function processEventData(type: EmbedEvent, e: any, thoughtSpotHost: string, containerEl: Element): any;