Skip to content

Commit

Permalink
chore(web): Remove Clerk sign-in patch
Browse files Browse the repository at this point in the history
  • Loading branch information
SokratisVidros committed Nov 7, 2024
1 parent 580f650 commit d668f1e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 201 deletions.
1 change: 0 additions & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"@babel/plugin-proposal-optional-chaining": "^7.20.7",
"@babel/plugin-transform-react-display-name": "^7.18.6",
"@babel/plugin-transform-runtime": "^7.23.2",
"@clerk/clerk-js": "^5.10.0",
"@clerk/clerk-react": "^5.2.5",
"@clerk/themes": "^2.1.10",
"@editorjs/editorjs": "^2.19.3",
Expand Down
20 changes: 2 additions & 18 deletions apps/web/src/ee/clerk/providers/ClerkProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { PropsWithChildren, useEffect, useState } from 'react';
import { PropsWithChildren } from 'react';
import { useNavigate } from 'react-router-dom';
import { ClerkProp, ClerkProvider as _ClerkProvider } from '@clerk/clerk-react';
import { ClerkProvider as _ClerkProvider } from '@clerk/clerk-react';
import { useColorScheme } from '@novu/design-system';
import { dark } from '@clerk/themes';
import { Variables } from '@clerk/types';
import { buildClerk } from './clerk-singleton';
import { CLERK_PUBLISHABLE_KEY, IS_EE_AUTH_ENABLED } from '../../../config/index';

const CLERK_LOCALIZATION = {
Expand Down Expand Up @@ -271,29 +270,14 @@ const ALLOWED_REDIRECT_ORIGINS = ['http://localhost:*', window.location.origin];
export const ClerkProvider: React.FC<PropsWithChildren<{}>> = ({ children }) => {
const { colorScheme } = useColorScheme();

const [clerkInstance, setClerkInstance] = useState<ClerkProp>();

const navigate = useNavigate();

useEffect(() => {
(async () => {
if (IS_EE_AUTH_ENABLED) {
setClerkInstance(await buildClerk({ publishableKey: CLERK_PUBLISHABLE_KEY }));
}
})();
}, []);

if (!IS_EE_AUTH_ENABLED) {
return <>{children}</>;
}

if (IS_EE_AUTH_ENABLED && !clerkInstance) {
return null;
}

return (
<_ClerkProvider
Clerk={clerkInstance}
routerPush={(to) => navigate(to)}
routerReplace={(to) => navigate(to, { replace: true })}
publishableKey={CLERK_PUBLISHABLE_KEY}
Expand Down
48 changes: 0 additions & 48 deletions apps/web/src/ee/clerk/providers/clerk-singleton.ts

This file was deleted.

Loading

0 comments on commit d668f1e

Please sign in to comment.