Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .cursor/rules/monorepo.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Framework-Specific Packages
- `@clerk/vue` - Vue.js composables and components
- `@clerk/astro` - Astro integration with SSR support
- `@clerk/nuxt` - Nuxt.js module
- `@clerk/remix` - Remix loader and action utilities
- `@clerk/express` - Express.js middleware
- `@clerk/fastify` - Fastify plugin
- `@clerk/expo` - React Native/Expo SDK
Expand Down
3 changes: 0 additions & 3 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ react:
react-router:
- packages/react-router/**

remix:
- packages/remix/**

tanstack:
- packages/tanstack-react-start/**

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ jobs:
matrix:
include:
- node-version: 20
test-filter: '--filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@clerk/nextjs --filter=@clerk/react --filter=@clerk/shared --filter=@clerk/remix --filter=@clerk/tanstack-react-start --filter=@clerk/elements --filter=@clerk/vue --filter=@clerk/nuxt --filter=@clerk/expo'
test-filter: '--filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@clerk/nextjs --filter=@clerk/react --filter=@clerk/shared --filter=@clerk/tanstack-react-start --filter=@clerk/elements --filter=@clerk/vue --filter=@clerk/nuxt --filter=@clerk/expo'
- node-version: 22
test-filter: '**'

Expand Down
3 changes: 0 additions & 3 deletions .jit/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ folders:
- path: /packages/react
exclude:
- ./**/*.test.ts
- path: /packages/remix
exclude:
- ./**/*.test.ts
- path: /packages/shared
exclude:
- ./**/*.test.ts
Expand Down
4 changes: 2 additions & 2 deletions .typedoc/__tests__/__snapshots__/file-structure.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ exports[`Typedoc output > should have a deliberate file structure 1`] = `
"react/use-reverification.mdx",
"react/use-session-list.mdx",
"react/use-session.mdx",
"react/use-sign-in-signal.mdx",
"react/use-sign-in-1.mdx",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something that we control ? what does 1 mean ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for Typedoc. Since there are now two useSignIn hooks (one from the root and one from the legacyit adds the-1` suffix. I don't know if this is controllable.

"react/use-sign-in.mdx",
"react/use-sign-up-signal.mdx",
"react/use-sign-up-1.mdx",
"react/use-sign-up.mdx",
"react/use-user.mdx",
"nextjs/auth.mdx",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { useUser } from '@clerk/react';
import { useSignInSignal } from '@clerk/react/experimental';
import { useSignIn, useUser } from '@clerk/react';
import { useState } from 'react';
import { NavLink, useNavigate } from 'react-router';

type AvailableStrategy = 'email_code' | 'phone_code' | 'password' | 'reset_password_email_code';

export function SignIn({ className, ...props }: React.ComponentProps<'div'>) {
const { signIn, errors, fetchStatus } = useSignInSignal();
const { signIn, errors, fetchStatus } = useSignIn();
const [selectedStrategy, setSelectedStrategy] = useState<AvailableStrategy | null>(null);
const { isSignedIn } = useUser();
const navigate = useNavigate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { useSignUpSignal } from '@clerk/react/experimental';
import { useSignUp } from '@clerk/react';
import { NavLink, useNavigate } from 'react-router';

export function SignUp({ className, ...props }: React.ComponentProps<'div'>) {
const { signUp, errors, fetchStatus } = useSignUpSignal();
const { signUp, errors, fetchStatus } = useSignUp();
const navigate = useNavigate();

const handleSubmit = async (formData: FormData) => {
Expand Down
1 change: 1 addition & 0 deletions integration/templates/expo-web/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default function RootLayout() {
<ClerkProvider
routerPush={(to: string) => router.push(to)}
routerReplace={to => router.replace(to)}
clerkJSUrl={process.env.EXPO_PUBLIC_CLERK_JS_URL}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this updated on purpose ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, previously the expo tests used the production version of clerk-js rather than the version from the current PR.

>
<ClerkLoaded>
<Stack>
Expand Down
29 changes: 8 additions & 21 deletions integration/templates/expo-web/app/custom-sign-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,22 @@ import { Text, TextInput, Button, View } from 'react-native';
import React from 'react';

export default function Page() {
const { signIn, setActive, isLoaded } = useSignIn();
const { signIn } = useSignIn();
const router = useRouter();

const [emailAddress, setEmailAddress] = React.useState('');
const [password, setPassword] = React.useState('');

const onSignInPress = React.useCallback(async () => {
if (!isLoaded) {
return;
}

try {
const signInAttempt = await signIn.create({
identifier: emailAddress,
password,
await signIn.password({ emailAddress, password });
if (signIn.status === 'complete') {
await signIn.finalize({
navigate: async () => {
router.replace('/');
},
});

if (signInAttempt.status === 'complete') {
await setActive({ session: signInAttempt.createdSessionId });
router.replace('/');
} else {
// See https://clerk.com/docs/custom-flows/error-handling
// for more info on error handling
console.error(JSON.stringify(signInAttempt, null, 2));
}
} catch (err: any) {
console.error(JSON.stringify(err, null, 2));
}
}, [isLoaded, emailAddress, password]);
}, [emailAddress, password]);

return (
<View>
Expand Down
47 changes: 10 additions & 37 deletions integration/templates/expo-web/app/custom-sign-up.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useSignUp } from '@clerk/expo';
import { useRouter } from 'expo-router';

export default function SignUpScreen() {
const { isLoaded, signUp, setActive } = useSignUp();
const { signUp } = useSignUp();
const router = useRouter();

const [emailAddress, setEmailAddress] = React.useState('');
Expand All @@ -13,46 +13,19 @@ export default function SignUpScreen() {
const [code, setCode] = React.useState('');

const onSignUpPress = async () => {
if (!isLoaded) {
return;
}

try {
await signUp.create({
emailAddress,
password,
});

await signUp.prepareEmailAddressVerification({ strategy: 'email_code' });

setPendingVerification(true);
} catch (err: any) {
// See https://clerk.com/docs/custom-flows/error-handling
// for more info on error handling
console.error(JSON.stringify(err, null, 2));
}
await signUp.password({ emailAddress, password });
await signUp.verifications.sendEmailCode({ emailAddress });
setPendingVerification(true);
};

const onPressVerify = async () => {
if (!isLoaded) {
return;
}

try {
const completeSignUp = await signUp.attemptEmailAddressVerification({
code,
await signUp.verifications.verifyEmailCode({ code });
if (signUp.status === 'complete') {
await signUp.finalize({
navigate: async () => {
router.replace('/');
},
});

if (completeSignUp.status === 'complete') {
await setActive({ session: completeSignUp.createdSessionId });
router.replace('/');
} else {
console.error(JSON.stringify(completeSignUp, null, 2));
}
} catch (err: any) {
// See https://clerk.com/docs/custom-flows/error-handling
// for more info on error handling
console.error(JSON.stringify(err, null, 2));
}
};

Expand Down
4 changes: 4 additions & 0 deletions integration/templates/expo-web/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const getClerkExpoPath = () => {
return clerkExpoPath.replace('file:', '');
}

if (clerkExpoPath?.startsWith('link:')) {
return clerkExpoPath.replace('link:', '');
}

Comment on lines +22 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 what does this unlock ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for local testing. Locally the package.json has the link: protocol. However I'm unable to get the tests to work correctly locally 😓

return undefined;
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"changeset": "changeset",
"changeset:empty": "pnpm changeset --empty",
"clean": "turbo clean",
"dev": "TURBO_UI=0 FORCE_COLOR=1 turbo dev --filter=@clerk/* --filter=!@clerk/expo --filter=!@clerk/tanstack-react-start --filter=!@clerk/elements --filter=!@clerk/remix --filter=!@clerk/chrome-extension",
"dev": "TURBO_UI=0 FORCE_COLOR=1 turbo dev --filter=@clerk/* --filter=!@clerk/expo --filter=!@clerk/tanstack-react-start --filter=!@clerk/elements --filter=!@clerk/chrome-extension",
"dev:js": "TURBO_UI=0 FORCE_COLOR=1 turbo dev:current --filter=@clerk/clerk-js",
"format": "turbo format && node scripts/format-non-workspace.mjs",
"format:check": "turbo format:check && node scripts/format-non-workspace.mjs --check",
Expand Down
8 changes: 7 additions & 1 deletion packages/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
"./experimental": {
"types": "./dist/experimental.d.ts",
"default": "./dist/experimental.js"
},
"./legacy": {
"types": "./dist/legacy.d.ts",
"default": "./dist/legacy.js"
}
},
"main": "./dist/index.js",
Expand All @@ -67,7 +71,9 @@
"passkeys",
"secure-store",
"resource-cache",
"token-cache"
"token-cache",
"experimental",
"legacy"
],
"scripts": {
"build": "tsup",
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/src/experimental.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { useSignInSignal, useSignUpSignal } from '@clerk/react/experimental';
export {};
2 changes: 1 addition & 1 deletion packages/expo/src/hooks/useOAuth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useSignIn, useSignUp } from '@clerk/react';
import { useSignIn, useSignUp } from '@clerk/react/legacy';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just for this PR, or are we leasing the package like that ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of right now this is the intent. If we have time I'll take a look and see if we need to update the API of the useOAuth hook.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should dogfood the new hooks as much as we can before the release. Usually that's the strategy.

import type { OAuthStrategy, SetActive, SignInResource, SignUpResource } from '@clerk/types';
import * as AuthSession from 'expo-auth-session';
import * as WebBrowser from 'expo-web-browser';
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/src/hooks/useSSO.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useSignIn, useSignUp } from '@clerk/react';
import { useSignIn, useSignUp } from '@clerk/react/legacy';
import type { EnterpriseSSOStrategy, OAuthStrategy, SetActive, SignInResource, SignUpResource } from '@clerk/types';
import * as AuthSession from 'expo-auth-session';
import * as WebBrowser from 'expo-web-browser';
Expand Down
1 change: 1 addition & 0 deletions packages/expo/src/legacy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useSignIn, useSignUp } from '@clerk/react/legacy';
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useClerk, useSignIn, useUser } from '@clerk/react';
import { useClerk, useUser } from '@clerk/react';
import { useSignIn } from '@clerk/react/legacy';
import type { SignInResource } from '@clerk/types';
import { AuthenticationType, isEnrolledAsync, supportedAuthenticationTypesAsync } from 'expo-local-authentication';
import {
Expand Down
5 changes: 5 additions & 0 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
"types": "./dist/types/experimental.d.ts",
"import": "./dist/esm/experimental.js",
"require": "./dist/cjs/experimental.js"
},
"./legacy": {
"types": "./dist/types/legacy.d.ts",
"import": "./dist/esm/legacy.js",
"require": "./dist/cjs/legacy.js"
}
},
"types": "./dist/types/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/legacy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useSignIn, useSignUp } from '@clerk/react/legacy';
4 changes: 4 additions & 0 deletions packages/react-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
"./webhooks": {
"types": "./dist/webhooks.d.ts",
"default": "./dist/webhooks.js"
},
"./legacy": {
"types": "./dist/legacy.d.ts",
"default": "./dist/legacy.js"
}
},
"main": "dist/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ exports[`deprecated ssr public exports > should not change unexpectedly 1`] = `
]
`;

exports[`legacy public exports > should not change unexpectedly 1`] = `
[
"useSignIn",
"useSignUp",
]
`;

exports[`root public exports > should not change unexpectedly 1`] = `
[
"APIKeys",
Expand Down
7 changes: 7 additions & 0 deletions packages/react-router/src/__tests__/exports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { logger } from '@clerk/shared/logger';
import { vi } from 'vitest';

import * as publicExports from '../index';
import * as legacyExports from '../legacy';
import * as serverExports from '../server/index';

describe('root public exports', () => {
Expand All @@ -25,3 +26,9 @@ describe('deprecated ssr public exports', () => {
warnOnceSpy.mockRestore();
});
});

describe('legacy public exports', () => {
it('should not change unexpectedly', () => {
expect(Object.keys(legacyExports).sort()).toMatchSnapshot();
});
});
1 change: 1 addition & 0 deletions packages/react-router/src/legacy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useSignIn, useSignUp } from '@clerk/react/legacy';
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```tsx {{ filename: 'app/sign-in/page.tsx' }}
'use client';

import { useSignIn } from '@clerk/nextjs';
import { useSignIn } from '@clerk/nextjs/legacy';

export default function SignInPage() {
const { isLoaded, signIn } = useSignIn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```tsx {{ filename: 'app/sign-up/page.tsx' }}
'use client';

import { useSignUp } from '@clerk/nextjs';
import { useSignUp } from '@clerk/nextjs/legacy';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we creating a new use-sign-up.md that wll use the new hook ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used in our typedoc comments. Our new comments don't (yet) use this example, so I haven't created one yet.


export default function SignUpPage() {
const { isLoaded, signUp } = useSignUp();
Expand Down
13 changes: 12 additions & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,25 @@
"default": "./dist/experimental.js"
}
},
"./legacy": {
"import": {
"types": "./dist/legacy.d.mts",
"default": "./dist/legacy.mjs"
},
"require": {
"types": "./dist/legacy.d.ts",
"default": "./dist/legacy.js"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"files": [
"dist",
"internal",
"errors",
"experimental"
"experimental",
"legacy"
],
"scripts": {
"build": "tsup",
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/experimental.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export { CheckoutButton } from './components/CheckoutButton';
export { PlanDetailsButton } from './components/PlanDetailsButton';
export { SubscriptionDetailsButton } from './components/SubscriptionDetailsButton';
export { useSignInSignal, useSignUpSignal } from './hooks/useClerkSignal';

export type {
__experimental_CheckoutButtonProps as CheckoutButtonProps,
Expand Down
3 changes: 1 addition & 2 deletions packages/react/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export { useAuth } from './useAuth';
export { useEmailLink } from './useEmailLink';
export { useSignIn } from './useSignIn';
export { useSignUp } from './useSignUp';
export { useSignIn, useSignUp } from './useClerkSignal';
export {
useClerk,
useOrganization,
Expand Down
Loading
Loading