-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
1,027 additions
and
423 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@clerk/clerk-react": patch | ||
--- | ||
|
||
Fix `signOutOptions` prop usage in `<SignOutButton />` component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@clerk/nextjs": minor | ||
--- | ||
|
||
Bug fix: For next>=14 applications resolve `__unstable__onBeforeSetActive` once `invalidateCacheAction` resolves. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
"@clerk/nextjs": minor | ||
"@clerk/clerk-react": minor | ||
--- | ||
|
||
Introduce a new experimental hook called `useReverification` that makes it easy to handle reverification errors. | ||
It returns a high order function (HOF) and allows developers to wrap any function that triggers a fetch request which might fail due to a user's session verification status. | ||
When such error is returned, the recommended UX is to offer a way to the user to recover by re-verifying their credentials. | ||
This helper will automatically handle this flow in the developer's behalf, by displaying a modal the end-user can interact with. | ||
Upon completion, the original request that previously failed, will be retried (only once). | ||
|
||
Example with clerk-js methods. | ||
```tsx | ||
import { __experimental_useReverification as useReverification } from '@clerk/nextjs'; | ||
|
||
function DeleteAccount() { | ||
const { user } = useUser(); | ||
const [deleteUserAccount] = useReverification(() => { | ||
if (!user) return; | ||
return user.delete() | ||
}); | ||
|
||
return <> | ||
<button | ||
onClick={async () => { | ||
await deleteUserAccount(); | ||
}}> | ||
Delete account | ||
</button> | ||
</> | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@clerk/nextjs": minor | ||
--- | ||
|
||
Replace `next/headers` with `ezheaders` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@clerk/shared": minor | ||
--- | ||
|
||
Introduce experimental reverification error helpers. | ||
- `reverificationMismatch` returns the error as an object which can later be used as a return value from a React Server Action. | ||
- `reverificationMismatchResponse` returns a Response with the above object serialized. It can be used in any Backend Javascript frameworks that supports `Response`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@clerk/elements": minor | ||
--- | ||
|
||
Added support for `__experimental_legalAccepted` field |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@clerk/nextjs": patch | ||
"@clerk/clerk-react": patch | ||
--- | ||
|
||
Updating peerDependencies for correct ranges |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@clerk/clerk-js": patch | ||
--- | ||
|
||
Chore: Replace beforeEmit with an explicit call after `setActive`, inside the experimental UserVerification. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@clerk/clerk-js": patch | ||
"@clerk/types": patch | ||
--- | ||
|
||
- Changed `__experimental_legalAccepted` checkbox Indicator element descriptor and element id | ||
- Changed `__experimental_legalAccepted` checkbox Label element descriptor and element id | ||
- Added two new element descriptors `formFieldCheckboxInput`, `formFieldCheckboxLabel`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...emplates/next-app-router/src/app/(reverification)/action-with-use-reverification/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use client'; | ||
import { useState, useTransition } from 'react'; | ||
import { __experimental_useReverification as useReverification } from '@clerk/nextjs'; | ||
import { logUserIdActionReverification } from '@/app/(reverification)/actions'; | ||
|
||
function Page() { | ||
const [logUserWithReverification] = useReverification(logUserIdActionReverification); | ||
const [pending, startTransition] = useTransition(); | ||
const [res, setRes] = useState(null); | ||
|
||
return ( | ||
<> | ||
<button | ||
disabled={pending} | ||
onClick={() => { | ||
startTransition(async () => { | ||
await logUserWithReverification().then(e => { | ||
setRes(e as any); | ||
}); | ||
}); | ||
}} | ||
> | ||
LogUserId | ||
</button> | ||
<pre>{JSON.stringify(res)}</pre> | ||
</> | ||
); | ||
} | ||
|
||
export default Page; |
27 changes: 27 additions & 0 deletions
27
integration/templates/next-app-router/src/app/(reverification)/actions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use server'; | ||
|
||
import { auth } from '@clerk/nextjs/server'; | ||
import { __experimental_reverificationMismatch as reverificationMismatch } from '@clerk/shared/authorization-errors'; | ||
|
||
const logUserIdActionReverification = async () => { | ||
const { userId, has } = await auth.protect(); | ||
|
||
const config = { | ||
level: 'secondFactor', | ||
afterMinutes: 1, | ||
} as const; | ||
|
||
const userNeedsReverification = !has({ | ||
__experimental_reverification: config, | ||
}); | ||
|
||
if (userNeedsReverification) { | ||
return reverificationMismatch(config); | ||
} | ||
|
||
return { | ||
userId, | ||
}; | ||
}; | ||
|
||
export { logUserIdActionReverification }; |
23 changes: 23 additions & 0 deletions
23
integration/templates/next-app-router/src/app/(reverification)/button-action.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
import { useState, useTransition } from 'react'; | ||
|
||
export function ButtonAction({ action }: { action: () => Promise<any> }) { | ||
const [pending, startTransition] = useTransition(); | ||
const [res, setRes] = useState(null); | ||
|
||
return ( | ||
<> | ||
<button | ||
disabled={pending} | ||
onClick={() => { | ||
startTransition(async () => { | ||
await action().then(setRes); | ||
}); | ||
}} | ||
> | ||
LogUserId | ||
</button> | ||
<pre>{JSON.stringify(res)}</pre> | ||
</> | ||
); | ||
} |
8 changes: 8 additions & 0 deletions
8
...tion/templates/next-app-router/src/app/(reverification)/requires-re-verification/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { logUserIdActionReverification } from '../actions'; | ||
import { ButtonAction } from '../button-action'; | ||
|
||
function Page() { | ||
return <ButtonAction action={logUserIdActionReverification} />; | ||
} | ||
|
||
export default Page; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { Browser, BrowserContext } from '@playwright/test'; | ||
|
||
import type { createAppPageObject } from './appPageObject'; | ||
import { common } from './commonPageObject'; | ||
|
||
export type EnchancedPage = ReturnType<typeof createAppPageObject>; | ||
export type TestArgs = { page: EnchancedPage; context: BrowserContext; browser: Browser }; | ||
|
||
export const createUserVerificationComponentPageObject = (testArgs: TestArgs) => { | ||
const { page } = testArgs; | ||
const self = { | ||
...common(testArgs), | ||
waitForMounted: (selector = '.cl-userVerification-root') => { | ||
return page.waitForSelector(selector, { state: 'attached' }); | ||
}, | ||
getUseAnotherMethodLink: () => { | ||
return page.getByRole('link', { name: /use another method/i }); | ||
}, | ||
getAltMethodsEmailCodeButton: () => { | ||
return page.getByRole('button', { name: /email code to/i }); | ||
}, | ||
getAltMethodsEmailLinkButton: () => { | ||
return page.getByRole('button', { name: /email link to/i }); | ||
}, | ||
}; | ||
return self; | ||
}; |
Oops, something went wrong.