Skip to content

Commit

Permalink
(javascript) restructure sidenav (#1914)
Browse files Browse the repository at this point in the history
Co-authored-by: Vaggelis Yfantis <[email protected]>
Co-authored-by: vi <[email protected]>
  • Loading branch information
3 people authored Jan 21, 2025
1 parent 88ccef1 commit c240767
Show file tree
Hide file tree
Showing 57 changed files with 323 additions and 447 deletions.
2 changes: 1 addition & 1 deletion docs/custom-flows/add-email.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Every user has a [`User`](/docs/references/javascript/user/user) object that rep
The following example demonstrates how to build a custom user interface that allows users to add an email address to their account. The example:

1. Uses the [`useUser()`](/docs/references/react/use-user) hook to get the `User` object.
1. Uses the [`User.createEmailAddress()`](/docs/references/javascript/user/create-metadata#create-email-address) method to add the email address to the user's account. A new [`EmailAddress`](/docs/references/javascript/email-address) object is created and stored in `User.emailAddresses`.
1. Uses the [`User.createEmailAddress()`](/docs/references/javascript/user/create-metadata#create-email-address) method to add the email address to the user's account. A new [`EmailAddress`](/docs/references/javascript/types/email-address) object is created and stored in `User.emailAddresses`.
1. Uses the `prepareVerification()` method on the newly created `EmailAddress` object to send a verification code to the user.
1. Uses the `attemptVerification()` method on the same `EmailAddress` object with the verification code provided by the user to verify the email address.

Expand Down
2 changes: 1 addition & 1 deletion docs/custom-flows/add-phone.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Every user has a [`User`](/docs/references/javascript/user/user) object that rep
The following example demonstrates how to build a custom user interface that allows users to add a phone number to their account. The example:

1. Uses the [`useUser()`](/docs/references/react/use-user) hook to get the `User` object.
1. Uses the [`User.createPhoneNumber()`](/docs/references/javascript/user/create-metadata#create-phone-number) method to add the phone number to the user's account. A new [`PhoneNumber`](/docs/references/javascript/phone-number) object is created and stored in `User.phoneNumbers`.
1. Uses the [`User.createPhoneNumber()`](/docs/references/javascript/user/create-metadata#create-phone-number) method to add the phone number to the user's account. A new [`PhoneNumber`](/docs/references/javascript/types/phone-number) object is created and stored in `User.phoneNumbers`.
1. Uses the `prepareVerification()` method on the newly created `PhoneNumber` object to send a verification code to the user.
1. Uses the `attemptVerification()` method on the same `PhoneNumber` object with the verification code provided by the user to verify the phone number.

Expand Down
104 changes: 53 additions & 51 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@
"title": "Chrome Extension",
"href": "/docs/quickstarts/chrome-extension"
},
{ "title": "Vue", "href": "/docs/quickstarts/vue", "icon": "vue" }
{
"title": "Vue",
"href": "/docs/quickstarts/vue",
"icon": "vue"
}
]
]
},
Expand Down Expand Up @@ -2065,46 +2069,14 @@
]
]
},
{
"title": "Organization Invitation",
"href": "/docs/references/javascript/organization-invitation"
},
{
"title": "Organization Membership",
"href": "/docs/references/javascript/organization-membership"
},
{
"title": "Organization Domain",
"href": "/docs/references/javascript/organization-domain"
},
{
"title": "Organization Membership Request",
"href": "/docs/references/javascript/organization-membership-request"
},
{
"title": "Session",
"href": "/docs/references/javascript/session"
},
{
"title": "SessionWithActivities",
"href": "/docs/references/javascript/session-with-activities"
},
{
"title": "Client",
"href": "/docs/references/javascript/client"
},
{
"title": "ExternalAccount",
"href": "/docs/references/javascript/external-account"
},
{
"title": "Email Address",
"href": "/docs/references/javascript/email-address"
},
{
"title": "Phone Number",
"href": "/docs/references/javascript/phone-number"
},
{
"title": "Sign In",
"collapse": true,
Expand Down Expand Up @@ -2161,22 +2133,6 @@
]
]
},
{
"title": "Web3 Wallet",
"collapse": true,
"items": [
[
{
"title": "Web3 Wallet",
"href": "/docs/references/javascript/web3-wallet/web3-wallet"
},
{
"title": "Verification",
"href": "/docs/references/javascript/web3-wallet/verification"
}
]
]
},
{
"title": "Types",
"collapse": true,
Expand All @@ -2198,10 +2154,18 @@
"title": "`CustomPage`",
"href": "/docs/references/javascript/types/custom-page"
},
{
"title": "`EmailAddress`",
"href": "/docs/references/javascript/types/email-address"
},
{
"title": "`EmailLinkError`",
"href": "/docs/references/javascript/types/email-link-error"
},
{
"title": "`ExternalAccount`",
"href": "/docs/references/javascript/types/external-account"
},
{
"title": "`DeletedObject`",
"href": "/docs/references/javascript/types/deleted-object"
Expand All @@ -2214,10 +2178,34 @@
"title": "OAuth types",
"href": "/docs/references/javascript/types/oauth"
},
{
"title": "`OrganizationDomain`",
"href": "/docs/references/javascript/types/organization-domain"
},
{
"title": "`OrganizationInvitation`",
"href": "/docs/references/javascript/types/organization-invitation"
},
{
"title": "`OrganizationMembership`",
"href": "/docs/references/javascript/types/organization-membership"
},
{
"title": "`OrganizationMembershipRequest`",
"href": "/docs/references/javascript/types/organization-membership-request"
},
{
"title": "`OrganizationSuggestion`",
"href": "/docs/references/javascript/types/organization-suggestion"
},
{
"title": "`PasskeyResource`",
"href": "/docs/references/javascript/types/passkey-resource"
},
{
"title": "`PhoneNumber`",
"href": "/docs/references/javascript/types/phone-number"
},
{
"title": "`PublicUserData`",
"href": "/docs/references/javascript/types/public-user-data"
Expand All @@ -2230,6 +2218,10 @@
"title": "`SessionVerification`",
"href": "/docs/references/javascript/types/session-verification"
},
{
"title": "`SessionWithActivities`",
"href": "/docs/references/javascript/types/session-with-activities"
},
{
"title": "`SetActiveParams`",
"href": "/docs/references/javascript/types/set-active-params"
Expand Down Expand Up @@ -2265,6 +2257,10 @@
{
"title": "`Verification`",
"href": "/docs/references/javascript/types/verification"
},
{
"title": "Web3 Wallet",
"href": "/docs/references/javascript/types/web3-wallet"
}
]
]
Expand Down Expand Up @@ -2735,7 +2731,10 @@
"icon": "nuxt",
"items": [
[
{ "title": "Overview", "href": "/docs/references/nuxt/overview" },
{
"title": "Overview",
"href": "/docs/references/nuxt/overview"
},
{
"title": "Guides",
"items": [
Expand Down Expand Up @@ -2774,7 +2773,10 @@
"icon": "vue",
"items": [
[
{ "title": "Overview", "href": "/docs/references/vue/overview" },
{
"title": "Overview",
"href": "/docs/references/vue/overview"
},
{
"title": "Guides",
"items": [
Expand Down
4 changes: 2 additions & 2 deletions docs/organizations/custom-organization-switcher.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This guide will demonstrate how to use the Clerk API to build a custom flow for
<Tab>
The following example:

- Uses the [`useOrganizationList()`](/docs/references/react/use-organization-list) hook to get `memberships`, which is a list of the current user's organization memberships. `memberships` returns `data`, which is an array of [`OrganizationMembership`](/docs/references/javascript/organization-membership) objects.
- Uses the [`useOrganizationList()`](/docs/references/react/use-organization-list) hook to get `memberships`, which is a list of the current user's organization memberships. `memberships` returns `data`, which is an array of [`OrganizationMembership`](/docs/references/javascript/types/organization-membership) objects.
- Maps over the `data` array to display the user's organization memberships in a list.
- Provides a button that calls `setActive()` to set the selected organization as the active organization.
- Provides a button to load more organizations if there are more available. The `data` array is paginated and will only return the first 10 results, so the `fetchNext()` method is used to load more organizations if they are available.
Expand Down Expand Up @@ -58,7 +58,7 @@ This guide will demonstrate how to use the Clerk API to build a custom flow for
<Tab>
The following example:
1. Calls the [`getOrganizationMemberships()`](/docs/references/javascript/user/user#get-organization-memberships) method to retrieve the list of organizations the current user is a part of. This method returns `data`, which is an array of [`OrganizationMembership`](/docs/references/javascript/organization-membership) objects.
1. Calls the [`getOrganizationMemberships()`](/docs/references/javascript/user/user#get-organization-memberships) method to retrieve the list of organizations the current user is a part of. This method returns `data`, which is an array of [`OrganizationMembership`](/docs/references/javascript/types/organization-membership) objects.
1. Maps over the `data` array to display the user's organization memberships in a list.
1. Provides a button that calls [`setActive()`](/docs/references/javascript/clerk/session-methods#set-active) to set the selected organization as the active organization.
Expand Down
2 changes: 1 addition & 1 deletion docs/organizations/invitations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Once the user visits the invitation link, they will be redirected to the page yo
### Invitation metadata

You can also add metadata to an invitation when creating the invitation through the Backend API. Once the invited user signs up using the invitation link, the invitation metadata (`OrganizationInvitation.public_metadata`) will be stored in the organization membership's metadata (`OrganizationMembership.publicMetadata`). You can find more information about organization membership metadata in the [Organization Membership](/docs/references/javascript/organization-membership) docs.
You can also add metadata to an invitation when creating the invitation through the Backend API. Once the invited user signs up using the invitation link, the invitation metadata (`OrganizationInvitation.public_metadata`) will be stored in the organization membership's metadata (`OrganizationMembership.publicMetadata`). You can find more information about organization membership metadata in the [Organization Membership](/docs/references/javascript/types/organization-membership) docs.

To add metadata to an invitation, you can use the `public_metadata` property when the invitation is created.

Expand Down
4 changes: 2 additions & 2 deletions docs/organizations/inviting-users.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This guide will demonstrate how to use the Clerk API to build a custom flow for
To revoke an invitation:

1. Use the `useOrganization()` hook to get `invitations`, which is a list of invitations for the active organization.
1. `invitations` is an array of [`OrganizationInvitation`](/docs/references/javascript/organization-invitation) objects. Each `OrganizationInvitation` object has a [`revoke()`](/docs/references/javascript/organization-invitation#revoke) method that can be called to revoke the invitation.
1. `invitations` is an array of [`OrganizationInvitation`](/docs/references/javascript/types/organization-invitation) objects. Each `OrganizationInvitation` object has a [`revoke()`](/docs/references/javascript/types/organization-invitation#revoke) method that can be called to revoke the invitation.

The following example includes:

Expand Down Expand Up @@ -230,7 +230,7 @@ This guide will demonstrate how to use the Clerk API to build a custom flow for
To revoke an invitation:

1. Use the active `organization` object to call the [`getInvitations()`](/docs/references/javascript/organization/invitations#get-invitations) method to get an array of `OrganizationInvitation` objects.
1. Each `OrganizationInvitation` object has a [`revoke()`](/docs/references/javascript/organization-invitation#revoke) method that can be called to revoke the invitation.
1. Each `OrganizationInvitation` object has a [`revoke()`](/docs/references/javascript/types/organization-invitation#revoke) method that can be called to revoke the invitation.

The following example includes:

Expand Down
2 changes: 1 addition & 1 deletion docs/organizations/manage-invitations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This guide will demonstrate how to use the Clerk API to build a custom flow for

`userInvitations` is an object with `data` that contains an array of [`UserOrganizationInvitation`](/docs/references/javascript/types/user-organization-invitation) objects.

Each `UserOrganizationInvitation` object has an [`accept()`](/docs/references/javascript/organization-membership-request#accept) method that accepts the invitation to the organization.
Each `UserOrganizationInvitation` object has an [`accept()`](/docs/references/javascript/types/organization-membership-request#accept) method that accepts the invitation to the organization.

This example is written for Next.js App Router but can be adapted for any React meta framework, such as Remix.

Expand Down
8 changes: 4 additions & 4 deletions docs/organizations/manage-membership-requests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ This guide will demonstrate how to use the Clerk API to build a custom flow for
<Tab>
The following example uses the [`useOrganization()`](/docs/references/react/use-organization) hook to get `membershipRequests`, which is a list of the active organization's membership requests.

`membershipRequests` is an object with `data` that contains an array of [`OrganizationMembershipRequest`](/docs/references/javascript/organization-membership-request) objects.
`membershipRequests` is an object with `data` that contains an array of [`OrganizationMembershipRequest`](/docs/references/javascript/types/organization-membership-request) objects.

Each `OrganizationMembershipRequest` object has an [`accept()`](/docs/references/javascript/organization-membership-request#accept) and [`reject()`](/docs/references/javascript/organization-membership-request#reject) method to accept or reject the membership request, respectively.
Each `OrganizationMembershipRequest` object has an [`accept()`](/docs/references/javascript/types/organization-membership-request#accept) and [`reject()`](/docs/references/javascript/types/organization-membership-request#reject) method to accept or reject the membership request, respectively.

This example is written for Next.js App Router but can be adapted for any React meta framework, such as Remix.

Expand Down Expand Up @@ -98,9 +98,9 @@ This guide will demonstrate how to use the Clerk API to build a custom flow for
<Tab>
The following example:
1. Calls the [`getMembershipRequests()`](/docs/references/javascript/organization/membership-request#get-membership-requests) method to retrieve the list of membership requests for the active organization. This method returns `data`, which is an array of [`OrganizationMembershipRequest`](/docs/references/javascript/organization-membership-request) objects.
1. Calls the [`getMembershipRequests()`](/docs/references/javascript/organization/membership-request#get-membership-requests) method to retrieve the list of membership requests for the active organization. This method returns `data`, which is an array of [`OrganizationMembershipRequest`](/docs/references/javascript/types/organization-membership-request) objects.
1. Maps over the `data` array to display the membership requests in a table.
1. Provides an "Accept" and "Reject" button for each request that calls the [`accept()`](/docs/references/javascript/organization-membership-request#accept) and [`reject()`](/docs/references/javascript/organization-membership-request#reject) methods, respectively.
1. Provides an "Accept" and "Reject" button for each request that calls the [`accept()`](/docs/references/javascript/types/organization-membership-request#accept) and [`reject()`](/docs/references/javascript/types/organization-membership-request#reject) methods, respectively.
Use the tabs to view the code necessary for the `index.html` and `main.js` files.
Expand Down
Loading

0 comments on commit c240767

Please sign in to comment.