Skip to content

Commit ec4521b

Browse files
chore(react,types): Update typedoc comments for react hooks and clerkprovider (#5457)
Co-authored-by: Lennart <lekoarts@gmail.com>
1 parent 3465c35 commit ec4521b

9 files changed

Lines changed: 50 additions & 43 deletions

File tree

.changeset/rare-ladybugs-chew.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@clerk/clerk-react": patch
3+
"@clerk/types": patch
4+
---
5+
6+
Improve JSDoc comments

packages/react/src/hooks/useAuth.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ import { createGetToken, createSignOut } from './utils';
1212
/**
1313
* The `useAuth()` hook provides access to the current user's authentication state and methods to manage the active session.
1414
*
15+
* <If sdk="nextjs">
16+
* By default, Next.js opts all routes into static rendering. If you need to opt a route or routes into dynamic rendering because you need to access the authentication data at request time, you can create a boundary by passing the `dynamic` prop to `<ClerkProvider>`. See the [guide on rendering modes](https://clerk.com/docs/references/nextjs/rendering-modes) for more information, including code examples.
17+
* </If>
18+
*
1519
* @param [initialAuthState] - An object containing the initial authentication state. If not provided, the hook will attempt to derive the state from the context.
1620
*
1721
* @example
1822
*
19-
* > [!NOTE]
20-
* > For frameworks like Next.js that support multiple ways of rendering its content, it might be preferable to use the [`auth()`](https://clerk.com/docs/references/nextjs/auth) helper instead of `useAuth()`. This depends on if you want to use React Server Components, SSR, or client-side rendering. Learn more in the [rendering modes](https://clerk.com/docs/references/nextjs/rendering-modes) guide. If you only want to access data on the client-side, `useAuth()` is sufficient.
21-
*
2223
* The following example demonstrates how to use the `useAuth()` hook to access the current auth state, like whether the user is signed in or not. It also includes a basic example for using the `getToken()` method to retrieve a session token for fetching data from an external resource.
2324
*
2425
* <Tabs items='React,Next.js'>

packages/react/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export type IsomorphicClerkOptions = Without<ClerkOptions, 'isSatellite'> & {
2828
*/
2929
clerkJSUrl?: string;
3030
/**
31-
* If your web application only uses Control components, you can set this value to `'headless'` and load a minimal ClerkJS bundle for optimal page performance.
31+
* If your web application only uses [Control Components](https://clerk.com/docs/components/overview#control-components), you can set this value to `'headless'` and load a minimal ClerkJS bundle for optimal page performance.
3232
*/
3333
clerkJSVariant?: 'headless' | '';
3434
/**

packages/types/src/clerk.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export type SignOutOptions = {
7676
*/
7777
sessionId?: string;
7878
/**
79-
* Specify a redirect URL to navigate after sign out is complete.
79+
* Specify a redirect URL to navigate to after sign out is complete.
8080
*/
8181
redirectUrl?: string;
8282
};
@@ -677,30 +677,30 @@ export type HandleOAuthCallbackParams = TransferableOption &
677677
*/
678678
signUpUrl?: string;
679679
/**
680-
* Full URL or path to navigate during sign in,
680+
* Full URL or path to navigate to during sign in,
681681
* if identifier verification is required.
682682
*/
683683
firstFactorUrl?: string;
684684
/**
685-
* Full URL or path to navigate during sign in,
685+
* Full URL or path to navigate to during sign in,
686686
* if 2FA is enabled.
687687
*/
688688
secondFactorUrl?: string;
689689
/**
690-
* Full URL or path to navigate during sign in,
690+
* Full URL or path to navigate to during sign in,
691691
* if the user is required to reset their password.
692692
*/
693693
resetPasswordUrl?: string;
694694
/**
695-
* Full URL or path to navigate after an incomplete sign up.
695+
* Full URL or path to navigate to after an incomplete sign up.
696696
*/
697697
continueSignUpUrl?: string | null;
698698
/**
699-
* Full URL or path to navigate after requesting email verification.
699+
* Full URL or path to navigate to after requesting email verification.
700700
*/
701701
verifyEmailAddressUrl?: string | null;
702702
/**
703-
* Full URL or path to navigate after requesting phone verification.
703+
* Full URL or path to navigate to after requesting phone verification.
704704
*/
705705
verifyPhoneNumberUrl?: string | null;
706706
};
@@ -980,14 +980,14 @@ export type RoutingOptions =
980980

981981
export type SignInProps = RoutingOptions & {
982982
/**
983-
* Full URL or path to navigate after successful sign in.
983+
* Full URL or path to navigate to after successful sign in.
984984
* This value has precedence over other redirect props, environment variables or search params.
985985
* Use this prop to override the redirect URL when needed.
986986
* @default undefined
987987
*/
988988
forceRedirectUrl?: string | null;
989989
/**
990-
* Full URL or path to navigate after successful sign in.
990+
* Full URL or path to navigate to after successful sign in.
991991
* This value is used when no other redirect props, environment variables or search params are present.
992992
* @default undefined
993993
*/
@@ -1125,14 +1125,14 @@ export type GoogleOneTapProps = GoogleOneTapRedirectUrlProps & {
11251125

11261126
export type SignUpProps = RoutingOptions & {
11271127
/**
1128-
* Full URL or path to navigate after successful sign up.
1128+
* Full URL or path to navigate to after successful sign up.
11291129
* This value has precedence over other redirect props, environment variables or search params.
11301130
* Use this prop to override the redirect URL when needed.
11311131
* @default undefined
11321132
*/
11331133
forceRedirectUrl?: string | null;
11341134
/**
1135-
* Full URL or path to navigate after successful sign up.
1135+
* Full URL or path to navigate to after successful sign up.
11361136
* This value is used when no other redirect props, environment variables or search params are present.
11371137
* @default undefined
11381138
*/
@@ -1224,7 +1224,7 @@ export type OrganizationProfileModalProps = WithoutRouting<OrganizationProfilePr
12241224

12251225
export type CreateOrganizationProps = RoutingOptions & {
12261226
/**
1227-
* Full URL or path to navigate after creating a new organization.
1227+
* Full URL or path to navigate to after creating a new organization.
12281228
* @default undefined
12291229
*/
12301230
afterCreateOrganizationUrl?:
@@ -1282,23 +1282,23 @@ export type UserButtonProps = UserButtonProfileMode & {
12821282
__experimental_asStandalone?: boolean | ((opened: boolean) => void);
12831283

12841284
/**
1285-
* Full URL or path to navigate after sign out is complete
1285+
* Full URL or path to navigate to after sign out is complete
12861286
* @deprecated Configure `afterSignOutUrl` as a global configuration, either in <ClerkProvider/> or in await Clerk.load()
12871287
*/
12881288
afterSignOutUrl?: string;
12891289
/**
1290-
* Full URL or path to navigate after signing out the current user is complete.
1290+
* Full URL or path to navigate to after signing out the current user is complete.
12911291
* This option applies to multi-session applications.
12921292
* @deprecated Configure `afterMultiSessionSingleSignOutUrl` as a global configuration, either in <ClerkProvider/> or in await Clerk.load()
12931293
*/
12941294
afterMultiSessionSingleSignOutUrl?: string;
12951295
/**
1296-
* Full URL or path to navigate on "Add another account" action.
1296+
* Full URL or path to navigate to on "Add another account" action.
12971297
* Multi-session mode only.
12981298
*/
12991299
signInUrl?: string;
13001300
/**
1301-
* Full URL or path to navigate after successful account change.
1301+
* Full URL or path to navigate to after successful account change.
13021302
* Multi-session mode only.
13031303
*/
13041304
afterSwitchSessionUrl?: string;
@@ -1360,28 +1360,28 @@ export type OrganizationSwitcherProps = CreateOrganizationMode &
13601360
*/
13611361
hidePersonal?: boolean;
13621362
/**
1363-
* Full URL or path to navigate after a successful organization switch.
1363+
* Full URL or path to navigate to after a successful organization switch.
13641364
* @default undefined
13651365
* @deprecated use `afterSelectOrganizationUrl` or `afterSelectPersonalUrl`
13661366
*/
13671367
afterSwitchOrganizationUrl?: string;
13681368
/**
1369-
* Full URL or path to navigate after creating a new organization.
1369+
* Full URL or path to navigate to after creating a new organization.
13701370
* @default undefined
13711371
*/
13721372
afterCreateOrganizationUrl?:
13731373
| ((organization: OrganizationResource) => string)
13741374
| LooseExtractedParams<PrimitiveKeys<OrganizationResource>>;
13751375
/**
1376-
* Full URL or path to navigate after a successful organization selection.
1376+
* Full URL or path to navigate to after a successful organization selection.
13771377
* Accepts a function that returns URL or path
13781378
* @default undefined`
13791379
*/
13801380
afterSelectOrganizationUrl?:
13811381
| ((organization: OrganizationResource) => string)
13821382
| LooseExtractedParams<PrimitiveKeys<OrganizationResource>>;
13831383
/**
1384-
* Full URL or path to navigate after a successful selection of personal workspace.
1384+
* Full URL or path to navigate to after a successful selection of personal workspace.
13851385
* Accepts a function that returns URL or path
13861386
* @default undefined
13871387
*/
@@ -1417,14 +1417,14 @@ export type OrganizationSwitcherProps = CreateOrganizationMode &
14171417

14181418
export type OrganizationListProps = {
14191419
/**
1420-
* Full URL or path to navigate after creating a new organization.
1420+
* Full URL or path to navigate to after creating a new organization.
14211421
* @default undefined
14221422
*/
14231423
afterCreateOrganizationUrl?:
14241424
| ((organization: OrganizationResource) => string)
14251425
| LooseExtractedParams<PrimitiveKeys<OrganizationResource>>;
14261426
/**
1427-
* Full URL or path to navigate after a successful organization selection.
1427+
* Full URL or path to navigate to after a successful organization selection.
14281428
* Accepts a function that returns URL or path
14291429
* @default undefined`
14301430
*/
@@ -1452,7 +1452,7 @@ export type OrganizationListProps = {
14521452
*/
14531453
hidePersonal?: boolean;
14541454
/**
1455-
* Full URL or path to navigate after a successful selection of personal workspace.
1455+
* Full URL or path to navigate to after a successful selection of personal workspace.
14561456
* Accepts a function that returns URL or path
14571457
* @default undefined`
14581458
*/
@@ -1466,7 +1466,7 @@ export type OrganizationListProps = {
14661466

14671467
export type WaitlistProps = {
14681468
/**
1469-
* Full URL or path to navigate after join waitlist.
1469+
* Full URL or path to navigate to after join waitlist.
14701470
*/
14711471
afterJoinWaitlistUrl?: string;
14721472
/**
@@ -1512,12 +1512,12 @@ export type __experimental_CheckoutProps = {
15121512

15131513
export interface HandleEmailLinkVerificationParams {
15141514
/**
1515-
* Full URL or path to navigate after successful magic link verification
1515+
* Full URL or path to navigate to after successful magic link verification
15161516
* on completed sign up or sign in on the same device.
15171517
*/
15181518
redirectUrlComplete?: string;
15191519
/**
1520-
* Full URL or path to navigate after successful magic link verification
1520+
* Full URL or path to navigate to after successful magic link verification
15211521
* on the same device, but not completed sign in or sign up.
15221522
*/
15231523
redirectUrl?: string;
@@ -1626,7 +1626,7 @@ export interface AuthenticateWithGoogleOneTapParams {
16261626

16271627
export interface NextTaskParams {
16281628
/**
1629-
* Full URL or path to navigate after successfully resolving all tasks
1629+
* Full URL or path to navigate to after successfully resolving all tasks
16301630
* @default undefined
16311631
*/
16321632
redirectUrlComplete?: string;

packages/types/src/hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export type UseAuthReturn =
3737
*/
3838
sessionId: undefined;
3939
/**
40-
* JWT Actor - [RFC8693](https://www.rfc-editor.org/rfc/rfc8693.html#name-act-actor-claim).
40+
* The JWT actor for the session. Holds identifier for the user that is impersonating the current user. Read more about [impersonation](https://clerk.com/docs/users/user-impersonation).
4141
*/
4242
actor: undefined;
4343
/**

packages/types/src/jwt.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export interface ClerkJWTClaims {
8282
act?: ActClaim;
8383

8484
/**
85-
* Active organization id.
85+
* Active organization ID.
8686
*/
8787
org_id?: string;
8888

@@ -92,7 +92,7 @@ export interface ClerkJWTClaims {
9292
org_slug?: string;
9393

9494
/**
95-
* Active organization role
95+
* Active organization role.
9696
*/
9797
org_role?: OrganizationCustomRoleKey;
9898

packages/types/src/jwtv2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export interface JwtPayload extends CustomJwtSessionClaims {
8383
act?: ActClaim;
8484

8585
/**
86-
* Active organization id.
86+
* Active organization ID.
8787
*/
8888
org_id?: string;
8989

@@ -93,7 +93,7 @@ export interface JwtPayload extends CustomJwtSessionClaims {
9393
org_slug?: string;
9494

9595
/**
96-
* Active organization role
96+
* Active organization role.
9797
*/
9898
org_role?: OrganizationCustomRoleKey;
9999

packages/types/src/multiDomain.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export type MultiDomainAndOrProxy =
1515
*/
1616
isSatellite?: never;
1717
/**
18-
* The URL that Clerk will proxy requests to. Required for applications that run behind a reverse proxy. Can be either a relative path (`/__clerk`) or a full URL (`https://<your-domain>/__clerk`).
18+
* **Required for applications that run behind a reverse proxy**. The URL that Clerk will proxy requests to. Can be either a relative path (`/__clerk`) or a full URL (`https://<your-domain>/__clerk`).
1919
*/
2020
proxyUrl?: never | string | ((url: URL) => string);
2121
/**
@@ -41,7 +41,7 @@ export type MultiDomainAndOrProxyPrimitives =
4141
*/
4242
isSatellite?: never;
4343
/**
44-
* The URL that Clerk will proxy requests to. Required for applications that run behind a reverse proxy. Can be either a relative path (`/__clerk`) or a full URL (`https://<your-domain>/__clerk`).
44+
* **Required for applications that run behind a reverse proxy**. The URL that Clerk will proxy requests to. Can be either a relative path (`/__clerk`) or a full URL (`https://<your-domain>/__clerk`).
4545
*/
4646
proxyUrl?: never | string;
4747
/**
@@ -63,7 +63,7 @@ export type MultiDomainAndOrProxyPrimitives =
6363
export type DomainOrProxyUrl =
6464
| {
6565
/**
66-
* The URL that Clerk will proxy requests to. Required for applications that run behind a reverse proxy. Can be either a relative path (`/__clerk`) or a full URL (`https://<your-domain>/__clerk`).
66+
* **Required for applications that run behind a reverse proxy**. The URL that Clerk will proxy requests to. Can be either a relative path (`/__clerk`) or a full URL (`https://<your-domain>/__clerk`).
6767
*/
6868
proxyUrl?: never;
6969
/**

packages/types/src/redirects.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import type { EnterpriseSSOStrategy, OAuthStrategy, SamlStrategy } from './strat
22

33
export type AfterSignOutUrl = {
44
/**
5-
* Full URL or path to navigate after successful sign out.
5+
* Full URL or path to navigate to after successful sign out.
66
*/
77
afterSignOutUrl?: string | null;
88
};
99

1010
export type AfterMultiSessionSingleSignOutUrl = {
1111
/**
12-
* Full URL or path to navigate after signing out the current user is complete.
12+
* Full URL or path to navigate to after signing out the current user is complete.
1313
* This option applies to multi-session applications.
1414
*/
1515
afterMultiSessionSingleSignOutUrl?: string | null;
@@ -52,7 +52,7 @@ export type AuthenticateWithRedirectParams = {
5252
redirectUrl: string;
5353

5454
/**
55-
* Full URL or path to navigate after the OAuth or SAML flow completes.
55+
* Full URL or path to navigate to after the OAuth or SAML flow completes.
5656
*/
5757
redirectUrlComplete: string;
5858

@@ -87,7 +87,7 @@ export type AuthenticateWithPopupParams = AuthenticateWithRedirectParams & { pop
8787

8888
export type RedirectUrlProp = {
8989
/**
90-
* Full URL or path to navigate after a successful action.
90+
* Full URL or path to navigate to after a successful action.
9191
*/
9292
redirectUrl?: string | null;
9393
};

0 commit comments

Comments
 (0)