From f404510a9c496f5b754bbee343d1f8fb5c6a72f6 Mon Sep 17 00:00:00 2001 From: "bhanu.jupally" Date: Tue, 24 Sep 2024 16:41:44 -0700 Subject: [PATCH 1/6] SCAL-225725 - Fixed failing /info for non-cookieless calls --- package-lock.json | 4 ++-- package.json | 2 +- src/tokenizedFetch.ts | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index bc725cda..3183ab5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@thoughtspot/visual-embed-sdk", - "version": "1.32.3", + "version": "1.32.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@thoughtspot/visual-embed-sdk", - "version": "1.32.3", + "version": "1.32.8", "license": "ThoughtSpot Development Tools End User License Agreement", "dependencies": { "algoliasearch": "^4.10.5", diff --git a/package.json b/package.json index fcb420b5..37187d24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@thoughtspot/visual-embed-sdk", - "version": "1.32.7", + "version": "1.32.8", "description": "ThoughtSpot Embed SDK", "module": "lib/src/index.js", "main": "dist/tsembed.js", diff --git a/src/tokenizedFetch.ts b/src/tokenizedFetch.ts index 8c8edb77..d4d1bfa3 100644 --- a/src/tokenizedFetch.ts +++ b/src/tokenizedFetch.ts @@ -22,7 +22,11 @@ import { AuthType } from './types'; export const tokenizedFetch: typeof fetch = async (input, init): Promise => { const embedConfig = getEmbedConfig(); if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) { - return fetch(input, init); + return fetch(input, { + ...init, + // ensure cookies are included for the non cookie-less api calls. + credentials: 'include', + }); } const req = new Request(input, init); From ee0b9e516868988cdd1efabca5fa09ff0efe2dad Mon Sep 17 00:00:00 2001 From: "bhanu.jupally" Date: Tue, 24 Sep 2024 16:45:53 -0700 Subject: [PATCH 2/6] Addressed comments --- src/tokenizedFetch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tokenizedFetch.ts b/src/tokenizedFetch.ts index d4d1bfa3..69bf462b 100644 --- a/src/tokenizedFetch.ts +++ b/src/tokenizedFetch.ts @@ -23,9 +23,9 @@ export const tokenizedFetch: typeof fetch = async (input, init): Promise Date: Tue, 24 Sep 2024 16:48:45 -0700 Subject: [PATCH 3/6] Bumped mixpanel --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3183ab5a..a06db62f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "gatsby-plugin-vercel": "^1.0.3", "html-react-parser": "^1.4.12", "lodash": "^4.17.21", - "mixpanel-browser": "^2.45.0", + "mixpanel-browser": "2.47.0", "ts-deepmerge": "^6.0.2", "tslib": "^2.5.3", "use-deep-compare-effect": "^1.8.1" @@ -14356,9 +14356,9 @@ } }, "node_modules/mixpanel-browser": { - "version": "2.45.0", - "resolved": "https://registry.npmjs.org/mixpanel-browser/-/mixpanel-browser-2.45.0.tgz", - "integrity": "sha512-PQ1DaTk68yyYtLA0iejmzPA9iNDhT4uIZpqZjRTw7HWpYfl123fydHb2laKanaKjm8YDmrGGz3+xZ4Q6joogyg==" + "version": "2.47.0", + "resolved": "https://registry.npmjs.org/mixpanel-browser/-/mixpanel-browser-2.47.0.tgz", + "integrity": "sha512-Ldrva0fRBEIFWmEibBQO1PulfpJVF3pf28Guk09lDirDaSQqqU/xs9zQLwN2rL5VwVtsP1aD3JaCgaa98EjojQ==" }, "node_modules/mkdirp": { "version": "0.5.6", diff --git a/package.json b/package.json index 37187d24..7dda197b 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "gatsby-plugin-vercel": "^1.0.3", "html-react-parser": "^1.4.12", "lodash": "^4.17.21", - "mixpanel-browser": "^2.45.0", + "mixpanel-browser": "2.47.0", "ts-deepmerge": "^6.0.2", "tslib": "^2.5.3", "use-deep-compare-effect": "^1.8.1" From 1535cdf83c2fc8cbaa4c92815e5f632e7d1068b7 Mon Sep 17 00:00:00 2001 From: "bhanu.jupally" Date: Tue, 24 Sep 2024 16:55:53 -0700 Subject: [PATCH 4/6] Fixed tests --- src/utils/authService/authService.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/authService/authService.spec.ts b/src/utils/authService/authService.spec.ts index 957a57a1..f485aedf 100644 --- a/src/utils/authService/authService.spec.ts +++ b/src/utils/authService/authService.spec.ts @@ -29,7 +29,9 @@ describe('Unit test for authService', () => { const response = await fetchSessionInfoService(thoughtSpotHost); expect(response.success).toBe(true); expect(fetch).toHaveBeenCalledTimes(1); - expect(fetch).toBeCalledWith(`${thoughtSpotHost}${EndPoints.SESSION_INFO}`, {}); + expect(fetch).toBeCalledWith(`${thoughtSpotHost}${EndPoints.SESSION_INFO}`, { + "credentials": "include" + }); }); test('fetchAuthTokenService', async () => { From e8c29cbfba862f5a4d1763ca51968431927bc3dc Mon Sep 17 00:00:00 2001 From: Aditya Mittal <114516106+adityamittal3107@users.noreply.github.com> Date: Wed, 25 Sep 2024 10:32:21 +0530 Subject: [PATCH 5/6] Update authService.spec.ts --- src/utils/authService/authService.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/authService/authService.spec.ts b/src/utils/authService/authService.spec.ts index f485aedf..90fa7a43 100644 --- a/src/utils/authService/authService.spec.ts +++ b/src/utils/authService/authService.spec.ts @@ -30,7 +30,7 @@ describe('Unit test for authService', () => { expect(response.success).toBe(true); expect(fetch).toHaveBeenCalledTimes(1); expect(fetch).toBeCalledWith(`${thoughtSpotHost}${EndPoints.SESSION_INFO}`, { - "credentials": "include" + credentials: 'include', }); }); From 2478083a61156aabe42cf9a5f1fde05ee1716b3a Mon Sep 17 00:00:00 2001 From: Aditya Mittal <114516106+adityamittal3107@users.noreply.github.com> Date: Wed, 25 Sep 2024 10:37:09 +0530 Subject: [PATCH 6/6] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7dda197b..477f386a 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "size-limit": [ { "path": "dist/tsembed.js", - "limit": "48 kB" + "limit": "49 kB" } ], "scripts": {