Add support chat (#1066)
* Add support chat Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Refactor the chat logic Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Add HMAC signing Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Update the button styles Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Update the button styles Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Refactor the chat logic Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Fix the chat not loading Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Fix the chat not loading Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Add requested changes Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Add requested changes Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Add requested changes Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Add requested changes Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Add requested changes Co-authored-by: v1b3m <vibenjamin6@gmail.com> --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com>
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { useRecoilState, useSetRecoilState } from 'recoil';
|
||||
|
||||
import { authProvidersState } from '@/client-config/states/authProvidersState';
|
||||
import { isDebugModeState } from '@/client-config/states/isDebugModeState';
|
||||
import { isSignInPrefilledState } from '@/client-config/states/isSignInPrefilledState';
|
||||
import { supportChatState } from '@/client-config/states/supportChatState';
|
||||
import { telemetryState } from '@/client-config/states/telemetryState';
|
||||
import { useGetClientConfigQuery } from '~/generated/graphql';
|
||||
|
||||
@ -15,6 +16,7 @@ export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
||||
const [, setSignInPrefilled] = useRecoilState(isSignInPrefilledState);
|
||||
const [, setTelemetry] = useRecoilState(telemetryState);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const setSupportChat = useSetRecoilState(supportChatState);
|
||||
|
||||
const { data, loading } = useGetClientConfigQuery();
|
||||
|
||||
@ -31,6 +33,7 @@ export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
||||
setDebugMode(data?.clientConfig.debugMode);
|
||||
setSignInPrefilled(data?.clientConfig.signInPrefilled);
|
||||
setTelemetry(data?.clientConfig.telemetry);
|
||||
setSupportChat(data?.clientConfig.supportChat);
|
||||
}
|
||||
}, [
|
||||
data,
|
||||
@ -40,6 +43,7 @@ export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
||||
setTelemetry,
|
||||
setIsLoading,
|
||||
loading,
|
||||
setSupportChat,
|
||||
]);
|
||||
|
||||
return isLoading ? <></> : <>{children}</>;
|
||||
|
||||
@ -13,6 +13,10 @@ export const GET_CLIENT_CONFIG = gql`
|
||||
enabled
|
||||
anonymizationEnabled
|
||||
}
|
||||
supportChat {
|
||||
supportDriver
|
||||
supportFrontendKey
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
11
front/src/modules/client-config/states/supportChatState.ts
Normal file
11
front/src/modules/client-config/states/supportChatState.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
import { SupportChat } from '~/generated/graphql';
|
||||
|
||||
export const supportChatState = atom<SupportChat>({
|
||||
key: 'supportChatState',
|
||||
default: {
|
||||
supportDriver: 'front',
|
||||
supportFrontendKey: null,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user