• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

thoughtspot / visual-embed-sdk / #3637

26 Mar 2026 05:05PM UTC coverage: 94.088% (-0.3%) from 94.357%
#3637

push

web-flow
Hide sdk tracking flag (#480)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

1886 of 2119 branches covered (89.0%)

Branch coverage included in aggregate %.

3541 of 3649 relevant lines covered (97.04%)

124.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

74.07
/src/tokenizedFetch.ts
1
import { getAuthenticationToken } from './authToken';
26✔
2
import { getEmbedConfig } from './embed/embedConfig';
26✔
3

4
import { AuthType } from './types';
26✔
5

26✔
6
/**
26✔
7
 * Fetch wrapper that adds the authentication token to the request.
8
 * Use this to call the ThoughtSpot APIs when using the visual embed sdk.
9
 * The interface for this method is the same as Web `Fetch`.
10
 * @param input
11
 * @param init
12
 * @example
13
 * ```js
14
 * tokenizedFetch("<TS_ORIGIN>/api/rest/2.0/auth/session/user", {
15
 *   // .. fetch options ..
16
 * });
17
 * ```
18
 * @version SDK: 1.28.0
19
 * @group Global methods
20
 */
21
export const tokenizedFetch: typeof fetch = async (input, init): Promise<Response> => {
22
    const embedConfig = getEmbedConfig();
23
    if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
26✔
24
        return fetch(input, {
130✔
25
            // ensure cookies are included for the non cookie-less api calls.
130✔
26
            credentials: 'include',
128✔
27
            ...init,
128!
28
        });
×
29
    }
×
30

×
31
    const req = new Request(input, init);
×
32
    const authToken = await getAuthenticationToken(embedConfig);
×
33
    if (authToken) {
34
        req.headers.append('Authorization', `Bearer ${authToken}`);
128✔
35
    }
36
    return fetch(req);
37
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc