Skip to content

Commit 8823c21

Browse files
chore(clerk-react): Improve JSDoc coverage on ClerkProvider (#4098)
Co-authored-by: Laura Beatris <48022589+LauraBeatris@users.noreply.github.com>
1 parent 786b554 commit 8823c21

File tree

4 files changed

+80
-9
lines changed

4 files changed

+80
-9
lines changed

.changeset/few-schools-invent.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 coverage on `<ClerkProvider>` properties

packages/react/src/types.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type {
77
LoadedClerk,
88
MultiDomainAndOrProxy,
99
RedirectUrlProp,
10-
SDKMetadata,
1110
SignInProps,
1211
SignInRedirectOptions,
1312
SignUpProps,
@@ -26,11 +25,27 @@ declare global {
2625

2726
export type IsomorphicClerkOptions = Without<ClerkOptions, 'isSatellite'> & {
2827
Clerk?: ClerkProp;
28+
/**
29+
* Define the URL that `@clerk/clerk-js` should be hot-loaded from
30+
*/
2931
clerkJSUrl?: string;
32+
/**
33+
* 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.
34+
*/
3035
clerkJSVariant?: 'headless' | '';
36+
/**
37+
* Define the npm version for `@clerk/clerk-js`
38+
*/
3139
clerkJSVersion?: string;
32-
sdkMetadata?: SDKMetadata;
40+
/**
41+
* The Clerk publishable key for your instance
42+
* @note This can be found in your Clerk Dashboard on the [API Keys](https://dashboard.clerk.com/last-active?path=api-keys) page
43+
*/
3344
publishableKey: string;
45+
/**
46+
* This nonce value will be passed through to the `@clerk/clerk-js` script tag.
47+
* @note You can use this to implement [strict-dynamic CSP](https://clerk.com/docs/security/clerk-csp#implementing-a-strict-dynamic-csp)
48+
*/
3449
nonce?: string;
3550
} & MultiDomainAndOrProxy;
3651

packages/types/src/clerk.ts

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,22 @@ import type { Web3Strategy } from './strategies';
4040
import type { UserResource } from './user';
4141
import type { Autocomplete, DeepPartial, DeepSnakeToCamel } from './utils';
4242

43+
/**
44+
* Contains information about the SDK that the host application is using.
45+
* For example, if Clerk is loaded through `@clerk/nextjs`, this would be `{ name: '@clerk/nextjs', version: '1.0.0' }`
46+
*/
4347
export type SDKMetadata = {
48+
/**
49+
* The npm package name of the SDK
50+
*/
4451
name: string;
52+
/**
53+
* The npm package version of the SDK
54+
*/
4555
version: string;
56+
/**
57+
* Typically this will be the NODE_ENV that the SDK is currently running in
58+
*/
4659
environment?: string;
4760
};
4861

@@ -608,12 +621,24 @@ export type ClerkThemeOptions = DeepSnakeToCamel<DeepPartial<DisplayThemeJSON>>;
608621
*/
609622
type ClerkOptionsNavigation =
610623
| {
624+
/**
625+
* A function which takes the destination path as an argument and performs a "push" navigation.
626+
*/
611627
routerPush?: never;
612-
routerDebug?: boolean;
628+
/**
629+
* A function which takes the destination path as an argument and performs a "replace" navigation.
630+
*/
613631
routerReplace?: never;
632+
routerDebug?: boolean;
614633
}
615634
| {
635+
/**
636+
* A function which takes the destination path as an argument and performs a "push" navigation.
637+
*/
616638
routerPush: RouterFn;
639+
/**
640+
* A function which takes the destination path as an argument and performs a "replace" navigation.
641+
*/
617642
routerReplace: RouterFn;
618643
routerDebug?: boolean;
619644
};
@@ -626,29 +651,53 @@ export type ClerkOptions = ClerkOptionsNavigation &
626651
LegacyRedirectProps &
627652
AfterSignOutUrl &
628653
AfterMultiSessionSingleSignOutUrl & {
654+
/**
655+
* Optional object to style your components. Will only affect [Clerk Components](https://clerk.com/docs/components/overview) and not [Account Portal](https://clerk.com/docs/customization/account-portal/overview) pages.
656+
*/
629657
appearance?: Appearance;
658+
/**
659+
* Optional object to localize your components. Will only affect [Clerk Components](https://clerk.com/docs/components/overview) and not [Account Portal](https://clerk.com/docs/customization/account-portal/overview) pages.
660+
*/
630661
localization?: LocalizationResource;
631662
polling?: boolean;
632663
selectInitialSession?: (client: ClientResource) => ActiveSessionResource | null;
633664
/** Controls if ClerkJS will load with the standard browser setup using Clerk cookies */
634665
standardBrowser?: boolean;
635-
/** Optional support email for display in authentication screens */
666+
/**
667+
* Optional support email for display in authentication screens. Will only affect [Clerk Components](https://clerk.com/docs/components/overview) and not [Account Portal](https://clerk.com/docs/customization/account-portal/overview) pages.
668+
*/
636669
supportEmail?: string;
637670
touchSession?: boolean;
671+
/**
672+
* This URL will be used for any redirects that might happen and needs to point to your primary application on the client-side. This option is optional for production instances. It's required for development instances if you a use satellite application.
673+
*/
638674
signInUrl?: string;
675+
/** This URL will be used for any redirects that might happen and needs to point to your primary application on the client-side. This option is optional for production instances and required for development instances. */
639676
signUpUrl?: string;
677+
/**
678+
* Optional array of domains used to validate against the query param of an auth redirect. If no match is made, the redirect is considered unsafe and the default redirect will be used with a warning passed to the console.
679+
*/
640680
allowedRedirectOrigins?: Array<string | RegExp>;
681+
/**
682+
* This option defines that the application is a satellite application.
683+
*/
641684
isSatellite?: boolean | ((url: URL) => boolean);
642685
/**
643-
* Telemetry options
686+
* Controls whether or not Clerk will collect [telemetry data](https://clerk.com/docs/telemetry)
644687
*/
645688
telemetry?:
646689
| false
647690
| {
648691
disabled?: boolean;
692+
/**
693+
* Telemetry events are only logged to the console and not sent to Clerk
694+
*/
649695
debug?: boolean;
650696
};
651697

698+
/**
699+
* Contains information about the SDK that the host application is using. You don't need to set this value yourself unless you're [developing an SDK](https://clerk.com/docs/references/sdk/overview).
700+
*/
652701
sdkMetadata?: SDKMetadata;
653702

654703
/**

packages/types/src/multiDomain.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import type { ClerkOptions } from './clerk';
33
type StringOrURLFnToString = string | ((url: URL) => string);
44

55
/**
6-
* DomainOrProxyUrl supports the following cases
6+
* You can configure proxy and satellite domains in a few ways:
7+
*
78
* 1) none of them are set
8-
* 2) only proxyUrl is set
9-
* 3) isSatellite and proxy is set
10-
* 4) isSatellite and domain is set
9+
* 2) only `proxyUrl` is set
10+
* 3) `isSatellite` and `proxyUrl` are set
11+
* 4) `isSatellite` and `domain` are set
1112
*/
1213
export type MultiDomainAndOrProxy =
1314
| {

0 commit comments

Comments
 (0)