-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into brk.feat/render-ui-in-clerk-js
- Loading branch information
Showing
47 changed files
with
755 additions
and
167 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,26 @@ | ||
--- | ||
"@clerk/clerk-react": minor | ||
--- | ||
|
||
Introducing experimental `asProvider`, `asStandalone`, and `<X.Outlet />` for `<UserButton />` and `<OrganizationSwitcher />` components. | ||
- `asProvider` converts `<UserButton />` and `<OrganizationSwitcher />` to a provider that defers rendering until `<Outlet />` is mounted. | ||
- `<Outlet />` also accepts a `asStandalone` prop. It will skip the trigger of these components and display only the UI which was previously inside the popover. This allows developers to create their own triggers. | ||
|
||
Example usage: | ||
```tsx | ||
<UserButton __experimental_asProvider afterSignOutUrl='/'> | ||
<UserButton.UserProfilePage label="Custom Page" url="/custom-page"> | ||
<h1> This is my page available to all children </h1> | ||
</UserButton.UserProfilePage> | ||
<UserButton.__experimental_Outlet __experimental_asStandalone /> | ||
</UserButton> | ||
``` | ||
|
||
```tsx | ||
<OrganizationSwitcher __experimental_asProvider afterSignOutUrl='/'> | ||
<OrganizationSwitcher.OrganizationProfilePage label="Custom Page" url="/custom-page"> | ||
<h1> This is my page available to all children </h1> | ||
</OrganizationSwitcher.OrganizationProfilePage> | ||
<OrganizationSwitcher.__experimental_Outlet __experimental_asStandalone /> | ||
</OrganizationSwitcher> | ||
``` |
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/clerk-js": minor | ||
"@clerk/types": minor | ||
--- | ||
|
||
Drop `maxAgeMinutes` from `__experimental_startVerification`. | ||
Drop types `__experimental_SessionVerificationConfig` and `__experimental_SessionVerificationMaxAgeMinutes`. |
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,11 @@ | ||
--- | ||
"@clerk/express": minor | ||
--- | ||
|
||
Export [`authenticateRequest` method](https://clerk.com/docs/references/backend/authenticate-request) from `@clerk/express` (in case you want to go low-level and implement flows to your specific needs). You can use it like so: | ||
|
||
```ts | ||
import { authenticateRequest } from "@clerk/express" | ||
``` | ||
|
||
This function is adapted to Express' Request wrapper and as such notably different to the exported function from `@clerk/backend`. If you need to use it, be sure to import from `@clerk/express`. |
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/localizations": minor | ||
"@clerk/clerk-js": minor | ||
"@clerk/types": minor | ||
--- | ||
|
||
The "Restricted access" screen has been improved for visual consistency and the ability to contact support. The displayed texts have been made more clear and the sign-in button has been moved to the bottom. |
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,12 @@ | ||
--- | ||
'@clerk/clerk-js': minor | ||
'@clerk/types': minor | ||
--- | ||
|
||
Add experimental standalone mode for `<UserButton />` and `<OrganizationSwitcher />`. | ||
When `__experimental_asStandalone: true` the component will not render its trigger, and instead it will render only the contents of the popover in place. | ||
|
||
APIs that changed: | ||
- (For internal usage) Added `__experimental_prefetchOrganizationSwitcher` as a way to mount an internal component that will render the `useOrganizationList()` hook and prefetch the necessary data for the popover of `<OrganizationSwitcher />`. This enhances the UX since no loading state will be visible and keeps CLS to the minimum. | ||
- New property for `mountOrganizationSwitcher(node, { __experimental_asStandalone: true })` | ||
- New property for `mountUserButton(node, { __experimental_asStandalone: true })` |
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/clerk-js": minor | ||
"@clerk/backend": minor | ||
"@clerk/types": minor | ||
--- | ||
|
||
Use EIP-4361 message spec for Web3 wallets sign in signature requests |
100 changes: 100 additions & 0 deletions
100
integration/templates/react-vite/src/custom-user-button-trigger/index.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,100 @@ | ||
import { UserButton } from '@clerk/clerk-react'; | ||
import { PropsWithChildren, useContext, useState } from 'react'; | ||
import { PageContext, PageContextProvider } from '../PageContext.tsx'; | ||
|
||
function Page1() { | ||
const { counter, setCounter } = useContext(PageContext); | ||
|
||
return ( | ||
<> | ||
<h1 data-page={1}>Page 1</h1> | ||
<p data-page={1}>Counter: {counter}</p> | ||
<button | ||
data-page={1} | ||
onClick={() => setCounter(a => a + 1)} | ||
> | ||
Update | ||
</button> | ||
</> | ||
); | ||
} | ||
|
||
function ToggleChildren(props: PropsWithChildren) { | ||
const [isMounted, setMounted] = useState(false); | ||
|
||
return ( | ||
<> | ||
<button | ||
data-toggle-btn | ||
onClick={() => setMounted(v => !v)} | ||
> | ||
Toggle | ||
</button> | ||
{isMounted ? props.children : null} | ||
</> | ||
); | ||
} | ||
|
||
export default function Page() { | ||
return ( | ||
<PageContextProvider> | ||
<UserButton __experimental_asProvider> | ||
<UserButton.UserProfilePage | ||
label={'Page 1'} | ||
labelIcon={<p data-label-icon={'page-1'}>🙃</p>} | ||
url='page-1' | ||
> | ||
<Page1 /> | ||
</UserButton.UserProfilePage> | ||
<UserButton.UserProfilePage label={'security'} /> | ||
<UserButton.UserProfilePage | ||
label={'Page 2'} | ||
labelIcon={<p data-label-icon={'page-2'}>🙃</p>} | ||
url='page-2' | ||
> | ||
<h1>Page 2</h1> | ||
</UserButton.UserProfilePage> | ||
<p data-leaked-child>This is leaking</p> | ||
<UserButton.UserProfileLink | ||
url={'https://clerk.com'} | ||
label={'Visit Clerk'} | ||
labelIcon={<p data-label-icon={'page-3'}>🌐</p>} | ||
/> | ||
<UserButton.MenuItems> | ||
<UserButton.Action | ||
label={'page-1'} | ||
labelIcon={<span>🙃</span>} | ||
open={'page-1'} | ||
/> | ||
<UserButton.Action label={'manageAccount'} /> | ||
<UserButton.Action label={'signOut'} /> | ||
<UserButton.Link | ||
href={'http://clerk.com'} | ||
label={'Visit Clerk'} | ||
labelIcon={<span>🌐</span>} | ||
/> | ||
|
||
<UserButton.Link | ||
href={'/user'} | ||
label={'Visit User page'} | ||
labelIcon={<span>🌐</span>} | ||
/> | ||
|
||
<UserButton.Action | ||
label={'Custom Alert'} | ||
labelIcon={<span>🔔</span>} | ||
onClick={() => alert('custom-alert')} | ||
/> | ||
</UserButton.MenuItems> | ||
<UserButton.UserProfileLink | ||
url={'/user'} | ||
label={'Visit User page'} | ||
labelIcon={<p data-label-icon={'page-4'}>🌐</p>} | ||
/> | ||
<ToggleChildren> | ||
<UserButton.__experimental_Outlet __experimental_asStandalone /> | ||
</ToggleChildren> | ||
</UserButton> | ||
</PageContextProvider> | ||
); | ||
} |
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
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
Oops, something went wrong.