1 | export const noFrontendApiError =
|
2 | 'Clerk: You must add the frontendApi prop to your <ClerkProvider>';
|
3 |
|
4 | export const noClerkProviderError =
|
5 | 'Clerk: You must wrap your application in a <ClerkProvider> component.';
|
6 |
|
7 | export const noGuaranteedLoadedError = (hookName: string) =>
|
8 | `Clerk: You're calling ${hookName} before there's a guarantee the client has been loaded. Call ${hookName} from a child of <SignedIn>, <SignedOut>, or <ClerkLoaded>, or use the withClerk() HOC.`;
|
9 |
|
10 | export const noGuaranteedUserError = (hookName: string) =>
|
11 | `Clerk: You're calling ${hookName} before there's a guarantee there's an active user. Call ${hookName} from a child of <SignedIn> or use the withUser() HOC.`;
|
12 |
|
13 | export const multipleClerkProvidersError =
|
14 | "Clerk: You've added multiple <ClerkProvider> components in your React component tree. Wrap your components in a single <ClerkProvider>.";
|
15 |
|
16 | export const hocChildrenNotAFunctionError =
|
17 | 'Clerk: Child of WithClerk must be a function.';
|
18 |
|
19 | export const multipleChildrenInButtonComponent = (name: string) =>
|
20 | `Clerk: You've passed multiple children components to <${name}/>. You can only pass a single child component or text.`;
|
21 |
|
22 | export const MagicLinkErrorCode = {
|
23 | Expired: 'expired',
|
24 | Failed: 'failed',
|
25 | };
|
26 |
|
27 | type MagicLinkError = {
|
28 | code: 'expired' | 'failed';
|
29 | };
|
30 |
|
31 | export function isMagicLinkError(err: any): err is MagicLinkError {
|
32 | return (
|
33 | !!err &&
|
34 | (err.code === MagicLinkErrorCode.Expired ||
|
35 | err.code === MagicLinkErrorCode.Failed)
|
36 | );
|
37 | }
|