BREAKING CHANGE: Fix broken support button (#12648)

## Context 

Support button was missing for configuration having support enabled
(FrontApp)

<img width="1253" alt="image"
src="https://github.com/user-attachments/assets/930e3e0c-05a1-4a5b-820b-bb257f19fdde"
/>


## How

Recently, we changed some enums from lowercase to uppercase in graphql

## Problem resolution

supportDriver was typed as a string where we could have used
SupportDriver type. I'm exposing it in the graphql generated files to
re-use in the front so this issue cannot happen anymore
This commit is contained in:
Charles Bochet
2025-06-17 10:26:22 +02:00
committed by GitHub
parent ccd16fb27f
commit 0043665202
10 changed files with 82 additions and 46 deletions

View File

@ -15,6 +15,7 @@ import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWork
import { renderHook } from '@testing-library/react';
import { iconsState } from 'twenty-ui/display';
import { email, mocks, password, results, token } from '../__mocks__/useAuth';
import { SupportDriver } from '~/generated/graphql';
const redirectSpy = jest.fn();
@ -160,7 +161,7 @@ describe('useAuth', () => {
expect(state.billing).toBeNull();
expect(state.isDeveloperDefaultSignInPrefilled).toBe(false);
expect(state.supportChat).toEqual({
supportDriver: 'none',
supportDriver: SupportDriver.NONE,
supportFrontChatId: null,
});
});

View File

@ -1,10 +1,10 @@
import { Support } from '~/generated/graphql';
import { createState } from 'twenty-ui/utilities';
import { Support, SupportDriver } from '~/generated/graphql';
export const supportChatState = createState<Support>({
key: 'supportChatState',
defaultValue: {
supportDriver: 'none',
supportDriver: SupportDriver.NONE,
supportFrontChatId: null,
},
});

View File

@ -15,6 +15,7 @@ import {
} from '~/testing/mock-data/users';
import { SupportDropdown } from '@/support/components/SupportDropdown';
import { SupportDriver } from '~/generated-metadata/graphql';
import { PrefetchLoadedDecorator } from '~/testing/decorators/PrefetchLoadedDecorator';
const meta: Meta<typeof SupportDropdown> = {
@ -32,7 +33,10 @@ const meta: Meta<typeof SupportDropdown> = {
setCurrentWorkspace(mockCurrentWorkspace);
setCurrentWorkspaceMember(mockedWorkspaceMemberData);
setCurrentUser(mockedUserData);
setSupportChat({ supportDriver: 'front', supportFrontChatId: '1234' });
setSupportChat({
supportDriver: SupportDriver.FRONT,
supportFrontChatId: '1234',
});
return <Story />;
},

View File

@ -5,8 +5,8 @@ import { useIsPrefetchLoading } from '@/prefetch/hooks/useIsPrefetchLoading';
import { isNonEmptyString } from '@sniptt/guards';
import { useCallback, useEffect, useState } from 'react';
import { useRecoilValue } from 'recoil';
import { User, WorkspaceMember } from '~/generated-metadata/graphql';
import { isDefined } from 'twenty-shared/utils';
import { User, WorkspaceMember } from '~/generated-metadata/graphql';
const insertScript = ({
src,
@ -74,7 +74,7 @@ export const useSupportChat = () => {
useEffect(() => {
if (
supportChat?.supportDriver === 'front' &&
supportChat?.supportDriver === 'FRONT' &&
isNonEmptyString(supportChat.supportFrontChatId) &&
isNonEmptyString(currentUser?.email) &&
isDefined(currentWorkspaceMember) &&