mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-09 12:08:50 +01:00
⚖️ feat: Terms and Conditions Dialog (#3712)
* Added UI for Terms and Conditions Modal Dialogue * Handled the logout on not accepting * Added logic for terms acceptance * Add terms and conditions modal * Fixed bug on terms and conditions modal, clicking out of it won't close it now * Added acceptance of Terms to Database * Removed unnecessary api endpoints from index.js * Added NPM script to reset terms acceptance * Added translations, markdown terms and samples * Merged terms and conditions modal feature * feat/Modal Terms and Conditions Dialog * Amendments as requested by maintainers * Reset package-lock (again)
This commit is contained in:
parent
79f9cd5a4d
commit
618be4bf2b
35 changed files with 393 additions and 8 deletions
|
|
@ -1128,3 +1128,19 @@ export const useResendVerificationEmail = (
|
|||
...(options || {}),
|
||||
});
|
||||
};
|
||||
|
||||
export const useAcceptTermsMutation = (
|
||||
options?: t.AcceptTermsMutationOptions,
|
||||
): UseMutationResult<t.TAcceptTermsResponse, unknown, void, unknown> => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation(() => dataService.acceptTerms(), {
|
||||
onSuccess: (data, variables, context) => {
|
||||
queryClient.setQueryData<t.TUserTermsResponse>([QueryKeys.userTerms], {
|
||||
termsAccepted: true,
|
||||
});
|
||||
options?.onSuccess?.(data, variables, context);
|
||||
},
|
||||
onError: options?.onError,
|
||||
onMutate: options?.onMutate,
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ import type {
|
|||
TCheckUserKeyResponse,
|
||||
SharedLinkListParams,
|
||||
SharedLinksResponse,
|
||||
TUserTermsResponse,
|
||||
TAcceptTermsResponse,
|
||||
} from 'librechat-data-provider';
|
||||
import { findPageForConversation, addFileToCache } from '~/utils';
|
||||
|
||||
|
|
@ -564,3 +566,14 @@ export const useGetRandomPrompts = (
|
|||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const useUserTermsQuery = (
|
||||
config?: UseQueryOptions<t.TUserTermsResponse>,
|
||||
): QueryObserverResult<t.TUserTermsResponse> => {
|
||||
return useQuery<t.TUserTermsResponse>([QueryKeys.userTerms], () => dataService.getUserTerms(), {
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
refetchOnMount: false,
|
||||
...config,
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue