Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/nice-seas-vue-nuxt-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
---
"@clerk/nuxt": minor
"@clerk/vue": minor
---

Expose `OAuthConsent` as a public component export for Vue and Nuxt.

Example:

```vue
<script setup lang="ts">
import { OAuthConsent } from '@clerk/vue';
</script>

<template>
<OAuthConsent />
</template>
```
15 changes: 15 additions & 0 deletions .changeset/small-planets-astro-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
---
"@clerk/astro": minor
---

Expose `OAuthConsent` as a public component export for Astro.

Example:

```astro
---
import { OAuthConsent } from '@clerk/astro/components';
---

<OAuthConsent />
```
21 changes: 21 additions & 0 deletions .changeset/three-rabbits-react-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
---
"@clerk/clerk-js": minor
"@clerk/nextjs": minor
"@clerk/react": minor
"@clerk/react-router": minor
"@clerk/shared": minor
"@clerk/tanstack-react-start": minor
"@clerk/ui": minor
---

Expose `OAuthConsent` as a public component export across React-based SDKs.

Example:

```tsx
import { OAuthConsent } from '@clerk/react';

export default function Page() {
return <OAuthConsent />;
}
```
1 change: 1 addition & 0 deletions packages/astro/src/astro-components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,5 +28,6 @@ export { default as OrganizationList } from './interactive/OrganizationList.astr
export { default as CreateOrganization } from './interactive/CreateOrganization.astro';
export { default as GoogleOneTap } from './interactive/GoogleOneTap.astro';
export { default as Waitlist } from './interactive/Waitlist.astro';
export { default as OAuthConsent } from './interactive/OAuthConsent.astro';
export { default as PricingTable } from './interactive/PricingTable.astro';
export { default as APIKeys } from './interactive/APIKeys.astro';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
---
import type { OAuthConsentProps } from '@clerk/shared/types';
type Props = OAuthConsentProps;

import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro';
---

<InternalUIComponentRenderer
{...Astro.props}
component='oauth-consent'
/>
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,7 @@ const mountAllClerkAstroJSComponents = () => {
waitlist: 'mountWaitlist',
'pricing-table': 'mountPricingTable',
'api-keys': 'mountAPIKeys',
'oauth-consent': 'mountOAuthConsent',
} as const satisfies Record<InternalUIComponentId, keyof Clerk>;

Object.entries(mountFns).forEach(([category, mountFn]) => {
Expand Down
11 changes: 11 additions & 0 deletions packages/astro/src/react/uiComponents.tsx
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import type {
GoogleOneTapProps,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationSwitcherProps,
Expand DownExpand Up@@ -196,3 +197,13 @@ export const PricingTable = withClerk(({ clerk, ...props }: WithClerkProp<Pricin
/>
);
}, 'PricingTable');

export const OAuthConsent = withClerk(({ clerk, ...props }: WithClerkProp<OAuthConsentProps>) => {
return (
<Portal
mount={clerk?.mountOAuthConsent}
unmount={clerk?.unmountOAuthConsent}
props={props}
/>
);
}, 'OAuthConsent');
3 changes: 2 additions & 1 deletion packages/astro/src/types.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,4 +119,5 @@ export type InternalUIComponentId =
| 'google-one-tap'
| 'waitlist'
| 'pricing-table'
| 'api-keys';
| 'api-keys'
| 'oauth-consent';
2 changes: 1 addition & 1 deletion packages/clerk-js/sandbox/app.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -475,7 +475,7 @@ void (async () => {
description: scope === 'offline_access' ? null : `Grants access to your ${scope}`,
requires_consent: true,
}));
Clerk.__internal_mountOAuthConsent(
Clerk.mountOAuthConsent(
app,
componentControls.oauthConsent.getProps() ?? {
scopes,
Expand Down
19 changes: 17 additions & 2 deletions packages/clerk-js/src/core/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,6 +95,7 @@ import type {
LoadedClerk,
NavigateOptions,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1348,7 +1349,7 @@ export class Clerk implements ClerkInterface {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
public mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
if (noUserExists(this)) {
if (this.#instanceType === 'development') {
throw new ClerkRuntimeError(warnings.cannotRenderOAuthConsentComponentWhenUserDoesNotExist, {
Expand All@@ -1372,10 +1373,24 @@ export class Clerk implements ClerkInterface {
);
};

public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
public unmountOAuthConsent = (node: HTMLDivElement) => {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

/**
* @deprecated Use mountOAuthConsent instead.
*/
public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
return this.mountOAuthConsent(node, props);
};

/**
* @deprecated Use unmountOAuthConsent instead.
*/
public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
return this.unmountOAuthConsent(node);
};

/**
* Mount an API keys component at the target element.
* @param targetNode Target to mount the APIKeys component.
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/client-boundary/hooks.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationList,
useOrganizationCreationDefaults,
Expand Down
5 changes: 2 additions & 3 deletions packages/nextjs/src/client-boundary/uiComponents.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,8 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
HandleSSOCallback,
OAuthConsent,
OrganizationList,
OrganizationSwitcher,
PricingTable,
Expand All@@ -28,11 +30,8 @@ export {
UserAvatar,
UserButton,
Waitlist,
HandleSSOCallback,
} from '@clerk/react';

export { OAuthConsent } from '@clerk/react/internal';

// The assignment of UserProfile with BaseUserProfile props is used
// to support the CustomPage functionality (eg UserProfile.Page)
// Also the `typeof BaseUserProfile` is used to resolve the following error:
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand DownExpand Up@@ -52,6 +53,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationCreationDefaults,
useOrganizationList,
Expand Down
18 changes: 16 additions & 2 deletions packages/nextjs/src/internal.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,20 @@
* These need to be explicitly listed. Do not use an * here.
* If you do, app router will break.
*/
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';

import { OAuthConsent as OAuthConsentOriginal } from './client-boundary/uiComponents';

export { MultisessionAppSupport } from './client-boundary/controlComponents';
export { OAuthConsent } from './client-boundary/uiComponents';
export { useOAuthConsent } from '@clerk/shared/react';

/**
* @deprecated Import `OAuthConsent` from `@clerk/nextjs` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

/**
* @deprecated Import `useOAuthConsent` from `@clerk/nextjs` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };
1 change: 1 addition & 0 deletions packages/nuxt/src/runtime/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@ export {
UserButton,
OrganizationSwitcher,
GoogleOneTap,
OAuthConsent,
Waitlist,
// Control components
ClerkLoaded,
Expand Down
7 changes: 0 additions & 7 deletions packages/react-router/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,10 +42,6 @@
"types": "./dist/api/index.d.ts",
"default": "./dist/api/index.js"
},
"./internal": {
"types": "./dist/internal.d.ts",
"default": "./dist/internal.js"
},
"./errors": {
"types": "./dist/errors.d.ts",
"default": "./dist/errors.js"
Expand DownExpand Up@@ -77,9 +73,6 @@
"api.server": [
"dist/api/index.d.ts"
],
"internal": [
"dist/internal.d.ts"
],
"webhooks": [
"dist/webhooks.d.ts"
],
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"CreateOrganization",
"GoogleOneTap",
"HandleSSOCallback",
"OAuthConsent",
"OrganizationList",
"OrganizationProfile",
"OrganizationSwitcher",
Expand DownExpand Up@@ -61,6 +62,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"useAuth",
"useClerk",
"useEmailLink",
"useOAuthConsent",
"useOrganization",
"useOrganizationCreationDefaults",
"useOrganizationList",
Expand Down
1 change: 0 additions & 1 deletion packages/react-router/src/internal.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/react/src/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/hooks/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,7 @@ export {
useSession,
useReverification,
useAPIKeys,
useOAuthConsent,
__experimental_useCheckout,
__experimental_CheckoutProvider,
__experimental_usePaymentElement,
Expand Down
17 changes: 15 additions & 2 deletions packages/react/src/internal.ts
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';
import type { InternalClerkScriptProps } from '@clerk/shared/types';
import type { Ui } from '@clerk/ui/internal';
import type React from 'react';

import { OAuthConsent as OAuthConsentOriginal } from './components/uiComponents';
import { ClerkProvider } from './contexts/ClerkProvider';
import type { ClerkProviderProps } from './types';

export { publishableKeyFromHost } from '@clerk/shared/keys';
export { setErrorThrowerOptions } from './errors/errorThrower';
export { MultisessionAppSupport } from './components/controlComponents';
export { useOAuthConsent } from '@clerk/shared/react';
export { OAuthConsent } from './components/uiComponents';

/**
* @deprecated Import `useOAuthConsent` from `@clerk/react` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };

/**
* @deprecated Import `OAuthConsent` from `@clerk/react` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

export { useRoutingProps } from './hooks/useRoutingProps';
export { useDerivedAuth } from './hooks/useAuth';
export { IS_REACT_SHARED_VARIANT_COMPATIBLE } from './utils/versionCheck';
Expand Down
9 changes: 9 additions & 0 deletions packages/react/src/isomorphicClerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,7 @@ import type {
ListenerOptions,
LoadedClerk,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1298,6 +1299,14 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
}
};

mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
this.__internal_mountOAuthConsent(node, props);
};

unmountOAuthConsent = (node: HTMLDivElement) => {
this.__internal_unmountOAuthConsent(node);
};
Comment on lines +1302 to +1308

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bashset -euo pipefail
FILE="packages/react/src/isomorphicClerk.ts"# Verify newly added methods currently omit explicit return types
rg -n "mountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement, props\\?: OAuthConsentProps\\)\\s*=>""$FILE"
rg -n "unmountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement\\)\\s*=>""$FILE"# Compare with existing explicit-void public mount/unmount methods in same file
rg -n "mountAPIKeys\\s*=\\s*\\(node: HTMLDivElement, props\\?: APIKeysProps\\): void""$FILE"
rg -n "unmountAPIKeys\\s*=\\s*\\(node: HTMLDivElement\\): void""$FILE"

Repository: clerk/javascript

Length of output: 403


Add explicit return type annotations to the new public OAuth consent methods.

Lines 1302 and 1306 introduce public API methods without explicit return type annotations. Declare : void to match existing methods in the same file (mountAPIKeys, unmountAPIKeys) and comply with the guideline requiring explicit return types for public APIs.

Proposed fix
- mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {+ mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps): void => {
this.__internal_mountOAuthConsent(node, props);
};
- unmountOAuthConsent = (node: HTMLDivElement) => {+ unmountOAuthConsent = (node: HTMLDivElement): void => {
this.__internal_unmountOAuthConsent(node);
};
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps)=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement)=>{
this.__internal_unmountOAuthConsent(node);
};
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps): void=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement): void=>{
this.__internal_unmountOAuthConsent(node);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/react/src/isomorphicClerk.ts` around lines 1302 - 1308, The new
public methods mountOAuthConsent and unmountOAuthConsent lack explicit return
types; update their signatures to include ": void" (e.g., change
mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => { ... }
to declare a void return and similarly for unmountOAuthConsent) to match
existing public methods like mountAPIKeys and unmountAPIKeys and satisfy the
public API return-type guideline.


mountTaskChooseOrganization = (node: HTMLDivElement, props?: TaskChooseOrganizationProps): void => {
if (this.clerkjs && this.loaded) {
this.clerkjs.mountTaskChooseOrganization(node, props);
Expand Down
20 changes: 19 additions & 1 deletion packages/shared/src/types/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -676,6 +676,21 @@ export interface Clerk {
*/
__internal_unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a OAuth consent component at the target element.
*
* @param targetNode - Target node to mount the OAuth consent component.
* @param oauthConsentProps - OAuth consent configuration parameters.
*/
mountOAuthConsent: (targetNode: HTMLDivElement, oauthConsentProps?: OAuthConsentProps) => void;

/**
* Unmounts a OAuth consent component from the target element.
*
* @param targetNode - Target node to unmount the OAuth consent component from.
*/
unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a TaskChooseOrganization component at the target element.
*
Expand DownExpand Up@@ -2275,7 +2290,7 @@ export type __experimental_SubscriptionDetailsButtonProps = {
};
};

export type __internal_OAuthConsentProps = {
export type OAuthConsentProps = {
/**
* Customize the appearance of the component.
*/
Expand DownExpand Up@@ -2338,6 +2353,9 @@ export type __internal_OAuthConsentProps = {
onDeny?: () => void;
};

/** @deprecated Use OAuthConsentProps instead. */
export type __internal_OAuthConsentProps = OAuthConsentProps;

export interface HandleEmailLinkVerificationParams {
/**
* Full URL or path to navigate to after successful magic link verification
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/nice-seas-vue-nuxt-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
---
"@clerk/nuxt": minor
"@clerk/vue": minor
---

Expose `OAuthConsent` as a public component export for Vue and Nuxt.

Example:

```vue
<script setup lang="ts">
import { OAuthConsent } from '@clerk/vue';
</script>

<template>
<OAuthConsent />
</template>
```
15 changes: 15 additions & 0 deletions .changeset/small-planets-astro-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
---
"@clerk/astro": minor
---

Expose `OAuthConsent` as a public component export for Astro.

Example:

```astro
---
import { OAuthConsent } from '@clerk/astro/components';
---

<OAuthConsent />
```
21 changes: 21 additions & 0 deletions .changeset/three-rabbits-react-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
---
"@clerk/clerk-js": minor
"@clerk/nextjs": minor
"@clerk/react": minor
"@clerk/react-router": minor
"@clerk/shared": minor
"@clerk/tanstack-react-start": minor
"@clerk/ui": minor
---

Expose `OAuthConsent` as a public component export across React-based SDKs.

Example:

```tsx
import { OAuthConsent } from '@clerk/react';

export default function Page() {
return <OAuthConsent />;
}
```
1 change: 1 addition & 0 deletions packages/astro/src/astro-components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,5 +28,6 @@ export { default as OrganizationList } from './interactive/OrganizationList.astr
export { default as CreateOrganization } from './interactive/CreateOrganization.astro';
export { default as GoogleOneTap } from './interactive/GoogleOneTap.astro';
export { default as Waitlist } from './interactive/Waitlist.astro';
export { default as OAuthConsent } from './interactive/OAuthConsent.astro';
export { default as PricingTable } from './interactive/PricingTable.astro';
export { default as APIKeys } from './interactive/APIKeys.astro';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
---
import type { OAuthConsentProps } from '@clerk/shared/types';
type Props = OAuthConsentProps;

import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro';
---

<InternalUIComponentRenderer
{...Astro.props}
component='oauth-consent'
/>
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,7 @@ const mountAllClerkAstroJSComponents = () => {
waitlist: 'mountWaitlist',
'pricing-table': 'mountPricingTable',
'api-keys': 'mountAPIKeys',
'oauth-consent': 'mountOAuthConsent',
} as const satisfies Record<InternalUIComponentId, keyof Clerk>;

Object.entries(mountFns).forEach(([category, mountFn]) => {
Expand Down
11 changes: 11 additions & 0 deletions packages/astro/src/react/uiComponents.tsx
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import type {
GoogleOneTapProps,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationSwitcherProps,
Expand DownExpand Up@@ -196,3 +197,13 @@ export const PricingTable = withClerk(({ clerk, ...props }: WithClerkProp<Pricin
/>
);
}, 'PricingTable');

export const OAuthConsent = withClerk(({ clerk, ...props }: WithClerkProp<OAuthConsentProps>) => {
return (
<Portal
mount={clerk?.mountOAuthConsent}
unmount={clerk?.unmountOAuthConsent}
props={props}
/>
);
}, 'OAuthConsent');
3 changes: 2 additions & 1 deletion packages/astro/src/types.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,4 +119,5 @@ export type InternalUIComponentId =
| 'google-one-tap'
| 'waitlist'
| 'pricing-table'
| 'api-keys';
| 'api-keys'
| 'oauth-consent';
2 changes: 1 addition & 1 deletion packages/clerk-js/sandbox/app.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -475,7 +475,7 @@ void (async () => {
description: scope === 'offline_access' ? null : `Grants access to your ${scope}`,
requires_consent: true,
}));
Clerk.__internal_mountOAuthConsent(
Clerk.mountOAuthConsent(
app,
componentControls.oauthConsent.getProps() ?? {
scopes,
Expand Down
19 changes: 17 additions & 2 deletions packages/clerk-js/src/core/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,6 +95,7 @@ import type {
LoadedClerk,
NavigateOptions,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1348,7 +1349,7 @@ export class Clerk implements ClerkInterface {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
public mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
if (noUserExists(this)) {
if (this.#instanceType === 'development') {
throw new ClerkRuntimeError(warnings.cannotRenderOAuthConsentComponentWhenUserDoesNotExist, {
Expand All@@ -1372,10 +1373,24 @@ export class Clerk implements ClerkInterface {
);
};

public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
public unmountOAuthConsent = (node: HTMLDivElement) => {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

/**
* @deprecated Use mountOAuthConsent instead.
*/
public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
return this.mountOAuthConsent(node, props);
};

/**
* @deprecated Use unmountOAuthConsent instead.
*/
public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
return this.unmountOAuthConsent(node);
};

/**
* Mount an API keys component at the target element.
* @param targetNode Target to mount the APIKeys component.
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/client-boundary/hooks.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationList,
useOrganizationCreationDefaults,
Expand Down
5 changes: 2 additions & 3 deletions packages/nextjs/src/client-boundary/uiComponents.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,8 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
HandleSSOCallback,
OAuthConsent,
OrganizationList,
OrganizationSwitcher,
PricingTable,
Expand All@@ -28,11 +30,8 @@ export {
UserAvatar,
UserButton,
Waitlist,
HandleSSOCallback,
} from '@clerk/react';

export { OAuthConsent } from '@clerk/react/internal';

// The assignment of UserProfile with BaseUserProfile props is used
// to support the CustomPage functionality (eg UserProfile.Page)
// Also the `typeof BaseUserProfile` is used to resolve the following error:
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand DownExpand Up@@ -52,6 +53,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationCreationDefaults,
useOrganizationList,
Expand Down
18 changes: 16 additions & 2 deletions packages/nextjs/src/internal.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,20 @@
* These need to be explicitly listed. Do not use an * here.
* If you do, app router will break.
*/
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';

import { OAuthConsent as OAuthConsentOriginal } from './client-boundary/uiComponents';

export { MultisessionAppSupport } from './client-boundary/controlComponents';
export { OAuthConsent } from './client-boundary/uiComponents';
export { useOAuthConsent } from '@clerk/shared/react';

/**
* @deprecated Import `OAuthConsent` from `@clerk/nextjs` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

/**
* @deprecated Import `useOAuthConsent` from `@clerk/nextjs` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };
1 change: 1 addition & 0 deletions packages/nuxt/src/runtime/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@ export {
UserButton,
OrganizationSwitcher,
GoogleOneTap,
OAuthConsent,
Waitlist,
// Control components
ClerkLoaded,
Expand Down
7 changes: 0 additions & 7 deletions packages/react-router/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,10 +42,6 @@
"types": "./dist/api/index.d.ts",
"default": "./dist/api/index.js"
},
"./internal": {
"types": "./dist/internal.d.ts",
"default": "./dist/internal.js"
},
"./errors": {
"types": "./dist/errors.d.ts",
"default": "./dist/errors.js"
Expand DownExpand Up@@ -77,9 +73,6 @@
"api.server": [
"dist/api/index.d.ts"
],
"internal": [
"dist/internal.d.ts"
],
"webhooks": [
"dist/webhooks.d.ts"
],
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"CreateOrganization",
"GoogleOneTap",
"HandleSSOCallback",
"OAuthConsent",
"OrganizationList",
"OrganizationProfile",
"OrganizationSwitcher",
Expand DownExpand Up@@ -61,6 +62,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"useAuth",
"useClerk",
"useEmailLink",
"useOAuthConsent",
"useOrganization",
"useOrganizationCreationDefaults",
"useOrganizationList",
Expand Down
1 change: 0 additions & 1 deletion packages/react-router/src/internal.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/react/src/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/hooks/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,7 @@ export {
useSession,
useReverification,
useAPIKeys,
useOAuthConsent,
__experimental_useCheckout,
__experimental_CheckoutProvider,
__experimental_usePaymentElement,
Expand Down
17 changes: 15 additions & 2 deletions packages/react/src/internal.ts
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';
import type { InternalClerkScriptProps } from '@clerk/shared/types';
import type { Ui } from '@clerk/ui/internal';
import type React from 'react';

import { OAuthConsent as OAuthConsentOriginal } from './components/uiComponents';
import { ClerkProvider } from './contexts/ClerkProvider';
import type { ClerkProviderProps } from './types';

export { publishableKeyFromHost } from '@clerk/shared/keys';
export { setErrorThrowerOptions } from './errors/errorThrower';
export { MultisessionAppSupport } from './components/controlComponents';
export { useOAuthConsent } from '@clerk/shared/react';
export { OAuthConsent } from './components/uiComponents';

/**
* @deprecated Import `useOAuthConsent` from `@clerk/react` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };

/**
* @deprecated Import `OAuthConsent` from `@clerk/react` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

export { useRoutingProps } from './hooks/useRoutingProps';
export { useDerivedAuth } from './hooks/useAuth';
export { IS_REACT_SHARED_VARIANT_COMPATIBLE } from './utils/versionCheck';
Expand Down
9 changes: 9 additions & 0 deletions packages/react/src/isomorphicClerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,7 @@ import type {
ListenerOptions,
LoadedClerk,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1298,6 +1299,14 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
}
};

mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
this.__internal_mountOAuthConsent(node, props);
};

unmountOAuthConsent = (node: HTMLDivElement) => {
this.__internal_unmountOAuthConsent(node);
};
Comment on lines +1302 to +1308

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bashset -euo pipefail
FILE="packages/react/src/isomorphicClerk.ts"# Verify newly added methods currently omit explicit return types
rg -n "mountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement, props\\?: OAuthConsentProps\\)\\s*=>""$FILE"
rg -n "unmountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement\\)\\s*=>""$FILE"# Compare with existing explicit-void public mount/unmount methods in same file
rg -n "mountAPIKeys\\s*=\\s*\\(node: HTMLDivElement, props\\?: APIKeysProps\\): void""$FILE"
rg -n "unmountAPIKeys\\s*=\\s*\\(node: HTMLDivElement\\): void""$FILE"

Repository: clerk/javascript

Length of output: 403


Add explicit return type annotations to the new public OAuth consent methods.

Lines 1302 and 1306 introduce public API methods without explicit return type annotations. Declare : void to match existing methods in the same file (mountAPIKeys, unmountAPIKeys) and comply with the guideline requiring explicit return types for public APIs.

Proposed fix
- mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {+ mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps): void => {
this.__internal_mountOAuthConsent(node, props);
};
- unmountOAuthConsent = (node: HTMLDivElement) => {+ unmountOAuthConsent = (node: HTMLDivElement): void => {
this.__internal_unmountOAuthConsent(node);
};
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps)=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement)=>{
this.__internal_unmountOAuthConsent(node);
};
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps): void=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement): void=>{
this.__internal_unmountOAuthConsent(node);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/react/src/isomorphicClerk.ts` around lines 1302 - 1308, The new
public methods mountOAuthConsent and unmountOAuthConsent lack explicit return
types; update their signatures to include ": void" (e.g., change
mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => { ... }
to declare a void return and similarly for unmountOAuthConsent) to match
existing public methods like mountAPIKeys and unmountAPIKeys and satisfy the
public API return-type guideline.


mountTaskChooseOrganization = (node: HTMLDivElement, props?: TaskChooseOrganizationProps): void => {
if (this.clerkjs && this.loaded) {
this.clerkjs.mountTaskChooseOrganization(node, props);
Expand Down
20 changes: 19 additions & 1 deletion packages/shared/src/types/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -676,6 +676,21 @@ export interface Clerk {
*/
__internal_unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a OAuth consent component at the target element.
*
* @param targetNode - Target node to mount the OAuth consent component.
* @param oauthConsentProps - OAuth consent configuration parameters.
*/
mountOAuthConsent: (targetNode: HTMLDivElement, oauthConsentProps?: OAuthConsentProps) => void;

/**
* Unmounts a OAuth consent component from the target element.
*
* @param targetNode - Target node to unmount the OAuth consent component from.
*/
unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a TaskChooseOrganization component at the target element.
*
Expand DownExpand Up@@ -2275,7 +2290,7 @@ export type __experimental_SubscriptionDetailsButtonProps = {
};
};

export type __internal_OAuthConsentProps = {
export type OAuthConsentProps = {
/**
* Customize the appearance of the component.
*/
Expand DownExpand Up@@ -2338,6 +2353,9 @@ export type __internal_OAuthConsentProps = {
onDeny?: () => void;
};

/** @deprecated Use OAuthConsentProps instead. */
export type __internal_OAuthConsentProps = OAuthConsentProps;

export interface HandleEmailLinkVerificationParams {
/**
* Full URL or path to navigate to after successful magic link verification
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/nice-seas-vue-nuxt-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
---
"@clerk/nuxt": minor
"@clerk/vue": minor
---

Expose `OAuthConsent` as a public component export for Vue and Nuxt.

Example:

```vue
<script setup lang="ts">
import { OAuthConsent } from '@clerk/vue';
</script>

<template>
<OAuthConsent />
</template>
```
15 changes: 15 additions & 0 deletions .changeset/small-planets-astro-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
---
"@clerk/astro": minor
---

Expose `OAuthConsent` as a public component export for Astro.

Example:

```astro
---
import { OAuthConsent } from '@clerk/astro/components';
---

<OAuthConsent />
```
21 changes: 21 additions & 0 deletions .changeset/three-rabbits-react-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
---
"@clerk/clerk-js": minor
"@clerk/nextjs": minor
"@clerk/react": minor
"@clerk/react-router": minor
"@clerk/shared": minor
"@clerk/tanstack-react-start": minor
"@clerk/ui": minor
---

Expose `OAuthConsent` as a public component export across React-based SDKs.

Example:

```tsx
import { OAuthConsent } from '@clerk/react';

export default function Page() {
return <OAuthConsent />;
}
```
1 change: 1 addition & 0 deletions packages/astro/src/astro-components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,5 +28,6 @@ export { default as OrganizationList } from './interactive/OrganizationList.astr
export { default as CreateOrganization } from './interactive/CreateOrganization.astro';
export { default as GoogleOneTap } from './interactive/GoogleOneTap.astro';
export { default as Waitlist } from './interactive/Waitlist.astro';
export { default as OAuthConsent } from './interactive/OAuthConsent.astro';
export { default as PricingTable } from './interactive/PricingTable.astro';
export { default as APIKeys } from './interactive/APIKeys.astro';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
---
import type { OAuthConsentProps } from '@clerk/shared/types';
type Props = OAuthConsentProps;

import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro';
---

<InternalUIComponentRenderer
{...Astro.props}
component='oauth-consent'
/>
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,7 @@ const mountAllClerkAstroJSComponents = () => {
waitlist: 'mountWaitlist',
'pricing-table': 'mountPricingTable',
'api-keys': 'mountAPIKeys',
'oauth-consent': 'mountOAuthConsent',
} as const satisfies Record<InternalUIComponentId, keyof Clerk>;

Object.entries(mountFns).forEach(([category, mountFn]) => {
Expand Down
11 changes: 11 additions & 0 deletions packages/astro/src/react/uiComponents.tsx
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import type {
GoogleOneTapProps,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationSwitcherProps,
Expand DownExpand Up@@ -196,3 +197,13 @@ export const PricingTable = withClerk(({ clerk, ...props }: WithClerkProp<Pricin
/>
);
}, 'PricingTable');

export const OAuthConsent = withClerk(({ clerk, ...props }: WithClerkProp<OAuthConsentProps>) => {
return (
<Portal
mount={clerk?.mountOAuthConsent}
unmount={clerk?.unmountOAuthConsent}
props={props}
/>
);
}, 'OAuthConsent');
3 changes: 2 additions & 1 deletion packages/astro/src/types.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,4 +119,5 @@ export type InternalUIComponentId =
| 'google-one-tap'
| 'waitlist'
| 'pricing-table'
| 'api-keys';
| 'api-keys'
| 'oauth-consent';
2 changes: 1 addition & 1 deletion packages/clerk-js/sandbox/app.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -475,7 +475,7 @@ void (async () => {
description: scope === 'offline_access' ? null : `Grants access to your ${scope}`,
requires_consent: true,
}));
Clerk.__internal_mountOAuthConsent(
Clerk.mountOAuthConsent(
app,
componentControls.oauthConsent.getProps() ?? {
scopes,
Expand Down
19 changes: 17 additions & 2 deletions packages/clerk-js/src/core/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,6 +95,7 @@ import type {
LoadedClerk,
NavigateOptions,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1348,7 +1349,7 @@ export class Clerk implements ClerkInterface {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
public mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
if (noUserExists(this)) {
if (this.#instanceType === 'development') {
throw new ClerkRuntimeError(warnings.cannotRenderOAuthConsentComponentWhenUserDoesNotExist, {
Expand All@@ -1372,10 +1373,24 @@ export class Clerk implements ClerkInterface {
);
};

public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
public unmountOAuthConsent = (node: HTMLDivElement) => {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

/**
* @deprecated Use mountOAuthConsent instead.
*/
public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
return this.mountOAuthConsent(node, props);
};

/**
* @deprecated Use unmountOAuthConsent instead.
*/
public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
return this.unmountOAuthConsent(node);
};

/**
* Mount an API keys component at the target element.
* @param targetNode Target to mount the APIKeys component.
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/client-boundary/hooks.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationList,
useOrganizationCreationDefaults,
Expand Down
5 changes: 2 additions & 3 deletions packages/nextjs/src/client-boundary/uiComponents.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,8 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
HandleSSOCallback,
OAuthConsent,
OrganizationList,
OrganizationSwitcher,
PricingTable,
Expand All@@ -28,11 +30,8 @@ export {
UserAvatar,
UserButton,
Waitlist,
HandleSSOCallback,
} from '@clerk/react';

export { OAuthConsent } from '@clerk/react/internal';

// The assignment of UserProfile with BaseUserProfile props is used
// to support the CustomPage functionality (eg UserProfile.Page)
// Also the `typeof BaseUserProfile` is used to resolve the following error:
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand DownExpand Up@@ -52,6 +53,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationCreationDefaults,
useOrganizationList,
Expand Down
18 changes: 16 additions & 2 deletions packages/nextjs/src/internal.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,20 @@
* These need to be explicitly listed. Do not use an * here.
* If you do, app router will break.
*/
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';

import { OAuthConsent as OAuthConsentOriginal } from './client-boundary/uiComponents';

export { MultisessionAppSupport } from './client-boundary/controlComponents';
export { OAuthConsent } from './client-boundary/uiComponents';
export { useOAuthConsent } from '@clerk/shared/react';

/**
* @deprecated Import `OAuthConsent` from `@clerk/nextjs` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

/**
* @deprecated Import `useOAuthConsent` from `@clerk/nextjs` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };
1 change: 1 addition & 0 deletions packages/nuxt/src/runtime/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@ export {
UserButton,
OrganizationSwitcher,
GoogleOneTap,
OAuthConsent,
Waitlist,
// Control components
ClerkLoaded,
Expand Down
7 changes: 0 additions & 7 deletions packages/react-router/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,10 +42,6 @@
"types": "./dist/api/index.d.ts",
"default": "./dist/api/index.js"
},
"./internal": {
"types": "./dist/internal.d.ts",
"default": "./dist/internal.js"
},
"./errors": {
"types": "./dist/errors.d.ts",
"default": "./dist/errors.js"
Expand DownExpand Up@@ -77,9 +73,6 @@
"api.server": [
"dist/api/index.d.ts"
],
"internal": [
"dist/internal.d.ts"
],
"webhooks": [
"dist/webhooks.d.ts"
],
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"CreateOrganization",
"GoogleOneTap",
"HandleSSOCallback",
"OAuthConsent",
"OrganizationList",
"OrganizationProfile",
"OrganizationSwitcher",
Expand DownExpand Up@@ -61,6 +62,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"useAuth",
"useClerk",
"useEmailLink",
"useOAuthConsent",
"useOrganization",
"useOrganizationCreationDefaults",
"useOrganizationList",
Expand Down
1 change: 0 additions & 1 deletion packages/react-router/src/internal.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/react/src/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/hooks/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,7 @@ export {
useSession,
useReverification,
useAPIKeys,
useOAuthConsent,
__experimental_useCheckout,
__experimental_CheckoutProvider,
__experimental_usePaymentElement,
Expand Down
17 changes: 15 additions & 2 deletions packages/react/src/internal.ts
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';
import type { InternalClerkScriptProps } from '@clerk/shared/types';
import type { Ui } from '@clerk/ui/internal';
import type React from 'react';

import { OAuthConsent as OAuthConsentOriginal } from './components/uiComponents';
import { ClerkProvider } from './contexts/ClerkProvider';
import type { ClerkProviderProps } from './types';

export { publishableKeyFromHost } from '@clerk/shared/keys';
export { setErrorThrowerOptions } from './errors/errorThrower';
export { MultisessionAppSupport } from './components/controlComponents';
export { useOAuthConsent } from '@clerk/shared/react';
export { OAuthConsent } from './components/uiComponents';

/**
* @deprecated Import `useOAuthConsent` from `@clerk/react` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };

/**
* @deprecated Import `OAuthConsent` from `@clerk/react` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

export { useRoutingProps } from './hooks/useRoutingProps';
export { useDerivedAuth } from './hooks/useAuth';
export { IS_REACT_SHARED_VARIANT_COMPATIBLE } from './utils/versionCheck';
Expand Down
9 changes: 9 additions & 0 deletions packages/react/src/isomorphicClerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,7 @@ import type {
ListenerOptions,
LoadedClerk,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1298,6 +1299,14 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
}
};

mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
this.__internal_mountOAuthConsent(node, props);
};

unmountOAuthConsent = (node: HTMLDivElement) => {
this.__internal_unmountOAuthConsent(node);
};
Comment on lines +1302 to +1308

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bashset -euo pipefail
FILE="packages/react/src/isomorphicClerk.ts"# Verify newly added methods currently omit explicit return types
rg -n "mountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement, props\\?: OAuthConsentProps\\)\\s*=>""$FILE"
rg -n "unmountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement\\)\\s*=>""$FILE"# Compare with existing explicit-void public mount/unmount methods in same file
rg -n "mountAPIKeys\\s*=\\s*\\(node: HTMLDivElement, props\\?: APIKeysProps\\): void""$FILE"
rg -n "unmountAPIKeys\\s*=\\s*\\(node: HTMLDivElement\\): void""$FILE"

Repository: clerk/javascript

Length of output: 403


Add explicit return type annotations to the new public OAuth consent methods.

Lines 1302 and 1306 introduce public API methods without explicit return type annotations. Declare : void to match existing methods in the same file (mountAPIKeys, unmountAPIKeys) and comply with the guideline requiring explicit return types for public APIs.

Proposed fix
- mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {+ mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps): void => {
this.__internal_mountOAuthConsent(node, props);
};
- unmountOAuthConsent = (node: HTMLDivElement) => {+ unmountOAuthConsent = (node: HTMLDivElement): void => {
this.__internal_unmountOAuthConsent(node);
};
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps)=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement)=>{
this.__internal_unmountOAuthConsent(node);
};
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps): void=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement): void=>{
this.__internal_unmountOAuthConsent(node);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/react/src/isomorphicClerk.ts` around lines 1302 - 1308, The new
public methods mountOAuthConsent and unmountOAuthConsent lack explicit return
types; update their signatures to include ": void" (e.g., change
mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => { ... }
to declare a void return and similarly for unmountOAuthConsent) to match
existing public methods like mountAPIKeys and unmountAPIKeys and satisfy the
public API return-type guideline.


mountTaskChooseOrganization = (node: HTMLDivElement, props?: TaskChooseOrganizationProps): void => {
if (this.clerkjs && this.loaded) {
this.clerkjs.mountTaskChooseOrganization(node, props);
Expand Down
20 changes: 19 additions & 1 deletion packages/shared/src/types/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -676,6 +676,21 @@ export interface Clerk {
*/
__internal_unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a OAuth consent component at the target element.
*
* @param targetNode - Target node to mount the OAuth consent component.
* @param oauthConsentProps - OAuth consent configuration parameters.
*/
mountOAuthConsent: (targetNode: HTMLDivElement, oauthConsentProps?: OAuthConsentProps) => void;

/**
* Unmounts a OAuth consent component from the target element.
*
* @param targetNode - Target node to unmount the OAuth consent component from.
*/
unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a TaskChooseOrganization component at the target element.
*
Expand DownExpand Up@@ -2275,7 +2290,7 @@ export type __experimental_SubscriptionDetailsButtonProps = {
};
};

export type __internal_OAuthConsentProps = {
export type OAuthConsentProps = {
/**
* Customize the appearance of the component.
*/
Expand DownExpand Up@@ -2338,6 +2353,9 @@ export type __internal_OAuthConsentProps = {
onDeny?: () => void;
};

/** @deprecated Use OAuthConsentProps instead. */
export type __internal_OAuthConsentProps = OAuthConsentProps;

export interface HandleEmailLinkVerificationParams {
/**
* Full URL or path to navigate to after successful magic link verification
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/nice-seas-vue-nuxt-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
---
"@clerk/nuxt": minor
"@clerk/vue": minor
---

Expose `OAuthConsent` as a public component export for Vue and Nuxt.

Example:

```vue
<script setup lang="ts">
import { OAuthConsent } from '@clerk/vue';
</script>

<template>
<OAuthConsent />
</template>
```
15 changes: 15 additions & 0 deletions .changeset/small-planets-astro-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
---
"@clerk/astro": minor
---

Expose `OAuthConsent` as a public component export for Astro.

Example:

```astro
---
import { OAuthConsent } from '@clerk/astro/components';
---

<OAuthConsent />
```
21 changes: 21 additions & 0 deletions .changeset/three-rabbits-react-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
---
"@clerk/clerk-js": minor
"@clerk/nextjs": minor
"@clerk/react": minor
"@clerk/react-router": minor
"@clerk/shared": minor
"@clerk/tanstack-react-start": minor
"@clerk/ui": minor
---

Expose `OAuthConsent` as a public component export across React-based SDKs.

Example:

```tsx
import { OAuthConsent } from '@clerk/react';

export default function Page() {
return <OAuthConsent />;
}
```
1 change: 1 addition & 0 deletions packages/astro/src/astro-components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,5 +28,6 @@ export { default as OrganizationList } from './interactive/OrganizationList.astr
export { default as CreateOrganization } from './interactive/CreateOrganization.astro';
export { default as GoogleOneTap } from './interactive/GoogleOneTap.astro';
export { default as Waitlist } from './interactive/Waitlist.astro';
export { default as OAuthConsent } from './interactive/OAuthConsent.astro';
export { default as PricingTable } from './interactive/PricingTable.astro';
export { default as APIKeys } from './interactive/APIKeys.astro';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
---
import type { OAuthConsentProps } from '@clerk/shared/types';
type Props = OAuthConsentProps;

import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro';
---

<InternalUIComponentRenderer
{...Astro.props}
component='oauth-consent'
/>
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,7 @@ const mountAllClerkAstroJSComponents = () => {
waitlist: 'mountWaitlist',
'pricing-table': 'mountPricingTable',
'api-keys': 'mountAPIKeys',
'oauth-consent': 'mountOAuthConsent',
} as const satisfies Record<InternalUIComponentId, keyof Clerk>;

Object.entries(mountFns).forEach(([category, mountFn]) => {
Expand Down
11 changes: 11 additions & 0 deletions packages/astro/src/react/uiComponents.tsx
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import type {
GoogleOneTapProps,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationSwitcherProps,
Expand DownExpand Up@@ -196,3 +197,13 @@ export const PricingTable = withClerk(({ clerk, ...props }: WithClerkProp<Pricin
/>
);
}, 'PricingTable');

export const OAuthConsent = withClerk(({ clerk, ...props }: WithClerkProp<OAuthConsentProps>) => {
return (
<Portal
mount={clerk?.mountOAuthConsent}
unmount={clerk?.unmountOAuthConsent}
props={props}
/>
);
}, 'OAuthConsent');
3 changes: 2 additions & 1 deletion packages/astro/src/types.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,4 +119,5 @@ export type InternalUIComponentId =
| 'google-one-tap'
| 'waitlist'
| 'pricing-table'
| 'api-keys';
| 'api-keys'
| 'oauth-consent';
2 changes: 1 addition & 1 deletion packages/clerk-js/sandbox/app.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -475,7 +475,7 @@ void (async () => {
description: scope === 'offline_access' ? null : `Grants access to your ${scope}`,
requires_consent: true,
}));
Clerk.__internal_mountOAuthConsent(
Clerk.mountOAuthConsent(
app,
componentControls.oauthConsent.getProps() ?? {
scopes,
Expand Down
19 changes: 17 additions & 2 deletions packages/clerk-js/src/core/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,6 +95,7 @@ import type {
LoadedClerk,
NavigateOptions,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1348,7 +1349,7 @@ export class Clerk implements ClerkInterface {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
public mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
if (noUserExists(this)) {
if (this.#instanceType === 'development') {
throw new ClerkRuntimeError(warnings.cannotRenderOAuthConsentComponentWhenUserDoesNotExist, {
Expand All@@ -1372,10 +1373,24 @@ export class Clerk implements ClerkInterface {
);
};

public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
public unmountOAuthConsent = (node: HTMLDivElement) => {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

/**
* @deprecated Use mountOAuthConsent instead.
*/
public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
return this.mountOAuthConsent(node, props);
};

/**
* @deprecated Use unmountOAuthConsent instead.
*/
public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
return this.unmountOAuthConsent(node);
};

/**
* Mount an API keys component at the target element.
* @param targetNode Target to mount the APIKeys component.
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/client-boundary/hooks.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationList,
useOrganizationCreationDefaults,
Expand Down
5 changes: 2 additions & 3 deletions packages/nextjs/src/client-boundary/uiComponents.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,8 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
HandleSSOCallback,
OAuthConsent,
OrganizationList,
OrganizationSwitcher,
PricingTable,
Expand All@@ -28,11 +30,8 @@ export {
UserAvatar,
UserButton,
Waitlist,
HandleSSOCallback,
} from '@clerk/react';

export { OAuthConsent } from '@clerk/react/internal';

// The assignment of UserProfile with BaseUserProfile props is used
// to support the CustomPage functionality (eg UserProfile.Page)
// Also the `typeof BaseUserProfile` is used to resolve the following error:
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand DownExpand Up@@ -52,6 +53,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationCreationDefaults,
useOrganizationList,
Expand Down
18 changes: 16 additions & 2 deletions packages/nextjs/src/internal.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,20 @@
* These need to be explicitly listed. Do not use an * here.
* If you do, app router will break.
*/
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';

import { OAuthConsent as OAuthConsentOriginal } from './client-boundary/uiComponents';

export { MultisessionAppSupport } from './client-boundary/controlComponents';
export { OAuthConsent } from './client-boundary/uiComponents';
export { useOAuthConsent } from '@clerk/shared/react';

/**
* @deprecated Import `OAuthConsent` from `@clerk/nextjs` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

/**
* @deprecated Import `useOAuthConsent` from `@clerk/nextjs` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };
1 change: 1 addition & 0 deletions packages/nuxt/src/runtime/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@ export {
UserButton,
OrganizationSwitcher,
GoogleOneTap,
OAuthConsent,
Waitlist,
// Control components
ClerkLoaded,
Expand Down
7 changes: 0 additions & 7 deletions packages/react-router/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,10 +42,6 @@
"types": "./dist/api/index.d.ts",
"default": "./dist/api/index.js"
},
"./internal": {
"types": "./dist/internal.d.ts",
"default": "./dist/internal.js"
},
"./errors": {
"types": "./dist/errors.d.ts",
"default": "./dist/errors.js"
Expand DownExpand Up@@ -77,9 +73,6 @@
"api.server": [
"dist/api/index.d.ts"
],
"internal": [
"dist/internal.d.ts"
],
"webhooks": [
"dist/webhooks.d.ts"
],
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"CreateOrganization",
"GoogleOneTap",
"HandleSSOCallback",
"OAuthConsent",
"OrganizationList",
"OrganizationProfile",
"OrganizationSwitcher",
Expand DownExpand Up@@ -61,6 +62,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"useAuth",
"useClerk",
"useEmailLink",
"useOAuthConsent",
"useOrganization",
"useOrganizationCreationDefaults",
"useOrganizationList",
Expand Down
1 change: 0 additions & 1 deletion packages/react-router/src/internal.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/react/src/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/hooks/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,7 @@ export {
useSession,
useReverification,
useAPIKeys,
useOAuthConsent,
__experimental_useCheckout,
__experimental_CheckoutProvider,
__experimental_usePaymentElement,
Expand Down
17 changes: 15 additions & 2 deletions packages/react/src/internal.ts
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';
import type { InternalClerkScriptProps } from '@clerk/shared/types';
import type { Ui } from '@clerk/ui/internal';
import type React from 'react';

import { OAuthConsent as OAuthConsentOriginal } from './components/uiComponents';
import { ClerkProvider } from './contexts/ClerkProvider';
import type { ClerkProviderProps } from './types';

export { publishableKeyFromHost } from '@clerk/shared/keys';
export { setErrorThrowerOptions } from './errors/errorThrower';
export { MultisessionAppSupport } from './components/controlComponents';
export { useOAuthConsent } from '@clerk/shared/react';
export { OAuthConsent } from './components/uiComponents';

/**
* @deprecated Import `useOAuthConsent` from `@clerk/react` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };

/**
* @deprecated Import `OAuthConsent` from `@clerk/react` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

export { useRoutingProps } from './hooks/useRoutingProps';
export { useDerivedAuth } from './hooks/useAuth';
export { IS_REACT_SHARED_VARIANT_COMPATIBLE } from './utils/versionCheck';
Expand Down
9 changes: 9 additions & 0 deletions packages/react/src/isomorphicClerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,7 @@ import type {
ListenerOptions,
LoadedClerk,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1298,6 +1299,14 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
}
};

mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
this.__internal_mountOAuthConsent(node, props);
};

unmountOAuthConsent = (node: HTMLDivElement) => {
this.__internal_unmountOAuthConsent(node);
};
Comment on lines +1302 to +1308

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bashset -euo pipefail
FILE="packages/react/src/isomorphicClerk.ts"# Verify newly added methods currently omit explicit return types
rg -n "mountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement, props\\?: OAuthConsentProps\\)\\s*=>""$FILE"
rg -n "unmountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement\\)\\s*=>""$FILE"# Compare with existing explicit-void public mount/unmount methods in same file
rg -n "mountAPIKeys\\s*=\\s*\\(node: HTMLDivElement, props\\?: APIKeysProps\\): void""$FILE"
rg -n "unmountAPIKeys\\s*=\\s*\\(node: HTMLDivElement\\): void""$FILE"

Repository: clerk/javascript

Length of output: 403


Add explicit return type annotations to the new public OAuth consent methods.

Lines 1302 and 1306 introduce public API methods without explicit return type annotations. Declare : void to match existing methods in the same file (mountAPIKeys, unmountAPIKeys) and comply with the guideline requiring explicit return types for public APIs.

Proposed fix
- mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {+ mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps): void => {
this.__internal_mountOAuthConsent(node, props);
};
- unmountOAuthConsent = (node: HTMLDivElement) => {+ unmountOAuthConsent = (node: HTMLDivElement): void => {
this.__internal_unmountOAuthConsent(node);
};
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps)=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement)=>{
this.__internal_unmountOAuthConsent(node);
};
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps): void=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement): void=>{
this.__internal_unmountOAuthConsent(node);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/react/src/isomorphicClerk.ts` around lines 1302 - 1308, The new
public methods mountOAuthConsent and unmountOAuthConsent lack explicit return
types; update their signatures to include ": void" (e.g., change
mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => { ... }
to declare a void return and similarly for unmountOAuthConsent) to match
existing public methods like mountAPIKeys and unmountAPIKeys and satisfy the
public API return-type guideline.


mountTaskChooseOrganization = (node: HTMLDivElement, props?: TaskChooseOrganizationProps): void => {
if (this.clerkjs && this.loaded) {
this.clerkjs.mountTaskChooseOrganization(node, props);
Expand Down
20 changes: 19 additions & 1 deletion packages/shared/src/types/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -676,6 +676,21 @@ export interface Clerk {
*/
__internal_unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a OAuth consent component at the target element.
*
* @param targetNode - Target node to mount the OAuth consent component.
* @param oauthConsentProps - OAuth consent configuration parameters.
*/
mountOAuthConsent: (targetNode: HTMLDivElement, oauthConsentProps?: OAuthConsentProps) => void;

/**
* Unmounts a OAuth consent component from the target element.
*
* @param targetNode - Target node to unmount the OAuth consent component from.
*/
unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a TaskChooseOrganization component at the target element.
*
Expand DownExpand Up@@ -2275,7 +2290,7 @@ export type __experimental_SubscriptionDetailsButtonProps = {
};
};

export type __internal_OAuthConsentProps = {
export type OAuthConsentProps = {
/**
* Customize the appearance of the component.
*/
Expand DownExpand Up@@ -2338,6 +2353,9 @@ export type __internal_OAuthConsentProps = {
onDeny?: () => void;
};

/** @deprecated Use OAuthConsentProps instead. */
export type __internal_OAuthConsentProps = OAuthConsentProps;

export interface HandleEmailLinkVerificationParams {
/**
* Full URL or path to navigate to after successful magic link verification
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/nice-seas-vue-nuxt-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
---
"@clerk/nuxt": minor
"@clerk/vue": minor
---

Expose `OAuthConsent` as a public component export for Vue and Nuxt.

Example:

```vue
<script setup lang="ts">
import { OAuthConsent } from '@clerk/vue';
</script>

<template>
<OAuthConsent />
</template>
```
15 changes: 15 additions & 0 deletions .changeset/small-planets-astro-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
---
"@clerk/astro": minor
---

Expose `OAuthConsent` as a public component export for Astro.

Example:

```astro
---
import { OAuthConsent } from '@clerk/astro/components';
---

<OAuthConsent />
```
21 changes: 21 additions & 0 deletions .changeset/three-rabbits-react-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
---
"@clerk/clerk-js": minor
"@clerk/nextjs": minor
"@clerk/react": minor
"@clerk/react-router": minor
"@clerk/shared": minor
"@clerk/tanstack-react-start": minor
"@clerk/ui": minor
---

Expose `OAuthConsent` as a public component export across React-based SDKs.

Example:

```tsx
import { OAuthConsent } from '@clerk/react';

export default function Page() {
return <OAuthConsent />;
}
```
1 change: 1 addition & 0 deletions packages/astro/src/astro-components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,5 +28,6 @@ export { default as OrganizationList } from './interactive/OrganizationList.astr
export { default as CreateOrganization } from './interactive/CreateOrganization.astro';
export { default as GoogleOneTap } from './interactive/GoogleOneTap.astro';
export { default as Waitlist } from './interactive/Waitlist.astro';
export { default as OAuthConsent } from './interactive/OAuthConsent.astro';
export { default as PricingTable } from './interactive/PricingTable.astro';
export { default as APIKeys } from './interactive/APIKeys.astro';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
---
import type { OAuthConsentProps } from '@clerk/shared/types';
type Props = OAuthConsentProps;

import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro';
---

<InternalUIComponentRenderer
{...Astro.props}
component='oauth-consent'
/>
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,7 @@ const mountAllClerkAstroJSComponents = () => {
waitlist: 'mountWaitlist',
'pricing-table': 'mountPricingTable',
'api-keys': 'mountAPIKeys',
'oauth-consent': 'mountOAuthConsent',
} as const satisfies Record<InternalUIComponentId, keyof Clerk>;

Object.entries(mountFns).forEach(([category, mountFn]) => {
Expand Down
11 changes: 11 additions & 0 deletions packages/astro/src/react/uiComponents.tsx
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import type {
GoogleOneTapProps,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationSwitcherProps,
Expand DownExpand Up@@ -196,3 +197,13 @@ export const PricingTable = withClerk(({ clerk, ...props }: WithClerkProp<Pricin
/>
);
}, 'PricingTable');

export const OAuthConsent = withClerk(({ clerk, ...props }: WithClerkProp<OAuthConsentProps>) => {
return (
<Portal
mount={clerk?.mountOAuthConsent}
unmount={clerk?.unmountOAuthConsent}
props={props}
/>
);
}, 'OAuthConsent');
3 changes: 2 additions & 1 deletion packages/astro/src/types.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,4 +119,5 @@ export type InternalUIComponentId =
| 'google-one-tap'
| 'waitlist'
| 'pricing-table'
| 'api-keys';
| 'api-keys'
| 'oauth-consent';
2 changes: 1 addition & 1 deletion packages/clerk-js/sandbox/app.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -475,7 +475,7 @@ void (async () => {
description: scope === 'offline_access' ? null : `Grants access to your ${scope}`,
requires_consent: true,
}));
Clerk.__internal_mountOAuthConsent(
Clerk.mountOAuthConsent(
app,
componentControls.oauthConsent.getProps() ?? {
scopes,
Expand Down
19 changes: 17 additions & 2 deletions packages/clerk-js/src/core/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,6 +95,7 @@ import type {
LoadedClerk,
NavigateOptions,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1348,7 +1349,7 @@ export class Clerk implements ClerkInterface {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
public mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
if (noUserExists(this)) {
if (this.#instanceType === 'development') {
throw new ClerkRuntimeError(warnings.cannotRenderOAuthConsentComponentWhenUserDoesNotExist, {
Expand All@@ -1372,10 +1373,24 @@ export class Clerk implements ClerkInterface {
);
};

public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
public unmountOAuthConsent = (node: HTMLDivElement) => {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

/**
* @deprecated Use mountOAuthConsent instead.
*/
public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
return this.mountOAuthConsent(node, props);
};

/**
* @deprecated Use unmountOAuthConsent instead.
*/
public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
return this.unmountOAuthConsent(node);
};

/**
* Mount an API keys component at the target element.
* @param targetNode Target to mount the APIKeys component.
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/client-boundary/hooks.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationList,
useOrganizationCreationDefaults,
Expand Down
5 changes: 2 additions & 3 deletions packages/nextjs/src/client-boundary/uiComponents.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,8 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
HandleSSOCallback,
OAuthConsent,
OrganizationList,
OrganizationSwitcher,
PricingTable,
Expand All@@ -28,11 +30,8 @@ export {
UserAvatar,
UserButton,
Waitlist,
HandleSSOCallback,
} from '@clerk/react';

export { OAuthConsent } from '@clerk/react/internal';

// The assignment of UserProfile with BaseUserProfile props is used
// to support the CustomPage functionality (eg UserProfile.Page)
// Also the `typeof BaseUserProfile` is used to resolve the following error:
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand DownExpand Up@@ -52,6 +53,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationCreationDefaults,
useOrganizationList,
Expand Down
18 changes: 16 additions & 2 deletions packages/nextjs/src/internal.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,20 @@
* These need to be explicitly listed. Do not use an * here.
* If you do, app router will break.
*/
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';

import { OAuthConsent as OAuthConsentOriginal } from './client-boundary/uiComponents';

export { MultisessionAppSupport } from './client-boundary/controlComponents';
export { OAuthConsent } from './client-boundary/uiComponents';
export { useOAuthConsent } from '@clerk/shared/react';

/**
* @deprecated Import `OAuthConsent` from `@clerk/nextjs` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

/**
* @deprecated Import `useOAuthConsent` from `@clerk/nextjs` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };
1 change: 1 addition & 0 deletions packages/nuxt/src/runtime/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@ export {
UserButton,
OrganizationSwitcher,
GoogleOneTap,
OAuthConsent,
Waitlist,
// Control components
ClerkLoaded,
Expand Down
7 changes: 0 additions & 7 deletions packages/react-router/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,10 +42,6 @@
"types": "./dist/api/index.d.ts",
"default": "./dist/api/index.js"
},
"./internal": {
"types": "./dist/internal.d.ts",
"default": "./dist/internal.js"
},
"./errors": {
"types": "./dist/errors.d.ts",
"default": "./dist/errors.js"
Expand DownExpand Up@@ -77,9 +73,6 @@
"api.server": [
"dist/api/index.d.ts"
],
"internal": [
"dist/internal.d.ts"
],
"webhooks": [
"dist/webhooks.d.ts"
],
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"CreateOrganization",
"GoogleOneTap",
"HandleSSOCallback",
"OAuthConsent",
"OrganizationList",
"OrganizationProfile",
"OrganizationSwitcher",
Expand DownExpand Up@@ -61,6 +62,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"useAuth",
"useClerk",
"useEmailLink",
"useOAuthConsent",
"useOrganization",
"useOrganizationCreationDefaults",
"useOrganizationList",
Expand Down
1 change: 0 additions & 1 deletion packages/react-router/src/internal.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/react/src/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/hooks/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,7 @@ export {
useSession,
useReverification,
useAPIKeys,
useOAuthConsent,
__experimental_useCheckout,
__experimental_CheckoutProvider,
__experimental_usePaymentElement,
Expand Down
17 changes: 15 additions & 2 deletions packages/react/src/internal.ts
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';
import type { InternalClerkScriptProps } from '@clerk/shared/types';
import type { Ui } from '@clerk/ui/internal';
import type React from 'react';

import { OAuthConsent as OAuthConsentOriginal } from './components/uiComponents';
import { ClerkProvider } from './contexts/ClerkProvider';
import type { ClerkProviderProps } from './types';

export { publishableKeyFromHost } from '@clerk/shared/keys';
export { setErrorThrowerOptions } from './errors/errorThrower';
export { MultisessionAppSupport } from './components/controlComponents';
export { useOAuthConsent } from '@clerk/shared/react';
export { OAuthConsent } from './components/uiComponents';

/**
* @deprecated Import `useOAuthConsent` from `@clerk/react` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };

/**
* @deprecated Import `OAuthConsent` from `@clerk/react` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

export { useRoutingProps } from './hooks/useRoutingProps';
export { useDerivedAuth } from './hooks/useAuth';
export { IS_REACT_SHARED_VARIANT_COMPATIBLE } from './utils/versionCheck';
Expand Down
9 changes: 9 additions & 0 deletions packages/react/src/isomorphicClerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,7 @@ import type {
ListenerOptions,
LoadedClerk,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1298,6 +1299,14 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
}
};

mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
this.__internal_mountOAuthConsent(node, props);
};

unmountOAuthConsent = (node: HTMLDivElement) => {
this.__internal_unmountOAuthConsent(node);
};
Comment on lines +1302 to +1308

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bashset -euo pipefail
FILE="packages/react/src/isomorphicClerk.ts"# Verify newly added methods currently omit explicit return types
rg -n "mountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement, props\\?: OAuthConsentProps\\)\\s*=>""$FILE"
rg -n "unmountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement\\)\\s*=>""$FILE"# Compare with existing explicit-void public mount/unmount methods in same file
rg -n "mountAPIKeys\\s*=\\s*\\(node: HTMLDivElement, props\\?: APIKeysProps\\): void""$FILE"
rg -n "unmountAPIKeys\\s*=\\s*\\(node: HTMLDivElement\\): void""$FILE"

Repository: clerk/javascript

Length of output: 403


Add explicit return type annotations to the new public OAuth consent methods.

Lines 1302 and 1306 introduce public API methods without explicit return type annotations. Declare : void to match existing methods in the same file (mountAPIKeys, unmountAPIKeys) and comply with the guideline requiring explicit return types for public APIs.

Proposed fix
- mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {+ mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps): void => {
this.__internal_mountOAuthConsent(node, props);
};
- unmountOAuthConsent = (node: HTMLDivElement) => {+ unmountOAuthConsent = (node: HTMLDivElement): void => {
this.__internal_unmountOAuthConsent(node);
};
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps)=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement)=>{
this.__internal_unmountOAuthConsent(node);
};
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps): void=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement): void=>{
this.__internal_unmountOAuthConsent(node);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/react/src/isomorphicClerk.ts` around lines 1302 - 1308, The new
public methods mountOAuthConsent and unmountOAuthConsent lack explicit return
types; update their signatures to include ": void" (e.g., change
mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => { ... }
to declare a void return and similarly for unmountOAuthConsent) to match
existing public methods like mountAPIKeys and unmountAPIKeys and satisfy the
public API return-type guideline.


mountTaskChooseOrganization = (node: HTMLDivElement, props?: TaskChooseOrganizationProps): void => {
if (this.clerkjs && this.loaded) {
this.clerkjs.mountTaskChooseOrganization(node, props);
Expand Down
20 changes: 19 additions & 1 deletion packages/shared/src/types/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -676,6 +676,21 @@ export interface Clerk {
*/
__internal_unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a OAuth consent component at the target element.
*
* @param targetNode - Target node to mount the OAuth consent component.
* @param oauthConsentProps - OAuth consent configuration parameters.
*/
mountOAuthConsent: (targetNode: HTMLDivElement, oauthConsentProps?: OAuthConsentProps) => void;

/**
* Unmounts a OAuth consent component from the target element.
*
* @param targetNode - Target node to unmount the OAuth consent component from.
*/
unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a TaskChooseOrganization component at the target element.
*
Expand DownExpand Up@@ -2275,7 +2290,7 @@ export type __experimental_SubscriptionDetailsButtonProps = {
};
};

export type __internal_OAuthConsentProps = {
export type OAuthConsentProps = {
/**
* Customize the appearance of the component.
*/
Expand DownExpand Up@@ -2338,6 +2353,9 @@ export type __internal_OAuthConsentProps = {
onDeny?: () => void;
};

/** @deprecated Use OAuthConsentProps instead. */
export type __internal_OAuthConsentProps = OAuthConsentProps;

export interface HandleEmailLinkVerificationParams {
/**
* Full URL or path to navigate to after successful magic link verification
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/nice-seas-vue-nuxt-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
---
"@clerk/nuxt": minor
"@clerk/vue": minor
---

Expose `OAuthConsent` as a public component export for Vue and Nuxt.

Example:

```vue
<script setup lang="ts">
import { OAuthConsent } from '@clerk/vue';
</script>

<template>
<OAuthConsent />
</template>
```
15 changes: 15 additions & 0 deletions .changeset/small-planets-astro-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
---
"@clerk/astro": minor
---

Expose `OAuthConsent` as a public component export for Astro.

Example:

```astro
---
import { OAuthConsent } from '@clerk/astro/components';
---

<OAuthConsent />
```
21 changes: 21 additions & 0 deletions .changeset/three-rabbits-react-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
---
"@clerk/clerk-js": minor
"@clerk/nextjs": minor
"@clerk/react": minor
"@clerk/react-router": minor
"@clerk/shared": minor
"@clerk/tanstack-react-start": minor
"@clerk/ui": minor
---

Expose `OAuthConsent` as a public component export across React-based SDKs.

Example:

```tsx
import { OAuthConsent } from '@clerk/react';

export default function Page() {
return <OAuthConsent />;
}
```
1 change: 1 addition & 0 deletions packages/astro/src/astro-components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,5 +28,6 @@ export { default as OrganizationList } from './interactive/OrganizationList.astr
export { default as CreateOrganization } from './interactive/CreateOrganization.astro';
export { default as GoogleOneTap } from './interactive/GoogleOneTap.astro';
export { default as Waitlist } from './interactive/Waitlist.astro';
export { default as OAuthConsent } from './interactive/OAuthConsent.astro';
export { default as PricingTable } from './interactive/PricingTable.astro';
export { default as APIKeys } from './interactive/APIKeys.astro';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
---
import type { OAuthConsentProps } from '@clerk/shared/types';
type Props = OAuthConsentProps;

import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro';
---

<InternalUIComponentRenderer
{...Astro.props}
component='oauth-consent'
/>
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,7 @@ const mountAllClerkAstroJSComponents = () => {
waitlist: 'mountWaitlist',
'pricing-table': 'mountPricingTable',
'api-keys': 'mountAPIKeys',
'oauth-consent': 'mountOAuthConsent',
} as const satisfies Record<InternalUIComponentId, keyof Clerk>;

Object.entries(mountFns).forEach(([category, mountFn]) => {
Expand Down
11 changes: 11 additions & 0 deletions packages/astro/src/react/uiComponents.tsx
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import type {
GoogleOneTapProps,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationSwitcherProps,
Expand DownExpand Up@@ -196,3 +197,13 @@ export const PricingTable = withClerk(({ clerk, ...props }: WithClerkProp<Pricin
/>
);
}, 'PricingTable');

export const OAuthConsent = withClerk(({ clerk, ...props }: WithClerkProp<OAuthConsentProps>) => {
return (
<Portal
mount={clerk?.mountOAuthConsent}
unmount={clerk?.unmountOAuthConsent}
props={props}
/>
);
}, 'OAuthConsent');
3 changes: 2 additions & 1 deletion packages/astro/src/types.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,4 +119,5 @@ export type InternalUIComponentId =
| 'google-one-tap'
| 'waitlist'
| 'pricing-table'
| 'api-keys';
| 'api-keys'
| 'oauth-consent';
2 changes: 1 addition & 1 deletion packages/clerk-js/sandbox/app.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -475,7 +475,7 @@ void (async () => {
description: scope === 'offline_access' ? null : `Grants access to your ${scope}`,
requires_consent: true,
}));
Clerk.__internal_mountOAuthConsent(
Clerk.mountOAuthConsent(
app,
componentControls.oauthConsent.getProps() ?? {
scopes,
Expand Down
19 changes: 17 additions & 2 deletions packages/clerk-js/src/core/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,6 +95,7 @@ import type {
LoadedClerk,
NavigateOptions,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1348,7 +1349,7 @@ export class Clerk implements ClerkInterface {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
public mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
if (noUserExists(this)) {
if (this.#instanceType === 'development') {
throw new ClerkRuntimeError(warnings.cannotRenderOAuthConsentComponentWhenUserDoesNotExist, {
Expand All@@ -1372,10 +1373,24 @@ export class Clerk implements ClerkInterface {
);
};

public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
public unmountOAuthConsent = (node: HTMLDivElement) => {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

/**
* @deprecated Use mountOAuthConsent instead.
*/
public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
return this.mountOAuthConsent(node, props);
};

/**
* @deprecated Use unmountOAuthConsent instead.
*/
public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
return this.unmountOAuthConsent(node);
};

/**
* Mount an API keys component at the target element.
* @param targetNode Target to mount the APIKeys component.
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/client-boundary/hooks.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationList,
useOrganizationCreationDefaults,
Expand Down
5 changes: 2 additions & 3 deletions packages/nextjs/src/client-boundary/uiComponents.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,8 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
HandleSSOCallback,
OAuthConsent,
OrganizationList,
OrganizationSwitcher,
PricingTable,
Expand All@@ -28,11 +30,8 @@ export {
UserAvatar,
UserButton,
Waitlist,
HandleSSOCallback,
} from '@clerk/react';

export { OAuthConsent } from '@clerk/react/internal';

// The assignment of UserProfile with BaseUserProfile props is used
// to support the CustomPage functionality (eg UserProfile.Page)
// Also the `typeof BaseUserProfile` is used to resolve the following error:
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand DownExpand Up@@ -52,6 +53,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationCreationDefaults,
useOrganizationList,
Expand Down
18 changes: 16 additions & 2 deletions packages/nextjs/src/internal.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,20 @@
* These need to be explicitly listed. Do not use an * here.
* If you do, app router will break.
*/
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';

import { OAuthConsent as OAuthConsentOriginal } from './client-boundary/uiComponents';

export { MultisessionAppSupport } from './client-boundary/controlComponents';
export { OAuthConsent } from './client-boundary/uiComponents';
export { useOAuthConsent } from '@clerk/shared/react';

/**
* @deprecated Import `OAuthConsent` from `@clerk/nextjs` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

/**
* @deprecated Import `useOAuthConsent` from `@clerk/nextjs` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };
1 change: 1 addition & 0 deletions packages/nuxt/src/runtime/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@ export {
UserButton,
OrganizationSwitcher,
GoogleOneTap,
OAuthConsent,
Waitlist,
// Control components
ClerkLoaded,
Expand Down
7 changes: 0 additions & 7 deletions packages/react-router/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,10 +42,6 @@
"types": "./dist/api/index.d.ts",
"default": "./dist/api/index.js"
},
"./internal": {
"types": "./dist/internal.d.ts",
"default": "./dist/internal.js"
},
"./errors": {
"types": "./dist/errors.d.ts",
"default": "./dist/errors.js"
Expand DownExpand Up@@ -77,9 +73,6 @@
"api.server": [
"dist/api/index.d.ts"
],
"internal": [
"dist/internal.d.ts"
],
"webhooks": [
"dist/webhooks.d.ts"
],
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"CreateOrganization",
"GoogleOneTap",
"HandleSSOCallback",
"OAuthConsent",
"OrganizationList",
"OrganizationProfile",
"OrganizationSwitcher",
Expand DownExpand Up@@ -61,6 +62,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"useAuth",
"useClerk",
"useEmailLink",
"useOAuthConsent",
"useOrganization",
"useOrganizationCreationDefaults",
"useOrganizationList",
Expand Down
1 change: 0 additions & 1 deletion packages/react-router/src/internal.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/react/src/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/hooks/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,7 @@ export {
useSession,
useReverification,
useAPIKeys,
useOAuthConsent,
__experimental_useCheckout,
__experimental_CheckoutProvider,
__experimental_usePaymentElement,
Expand Down
17 changes: 15 additions & 2 deletions packages/react/src/internal.ts
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';
import type { InternalClerkScriptProps } from '@clerk/shared/types';
import type { Ui } from '@clerk/ui/internal';
import type React from 'react';

import { OAuthConsent as OAuthConsentOriginal } from './components/uiComponents';
import { ClerkProvider } from './contexts/ClerkProvider';
import type { ClerkProviderProps } from './types';

export { publishableKeyFromHost } from '@clerk/shared/keys';
export { setErrorThrowerOptions } from './errors/errorThrower';
export { MultisessionAppSupport } from './components/controlComponents';
export { useOAuthConsent } from '@clerk/shared/react';
export { OAuthConsent } from './components/uiComponents';

/**
* @deprecated Import `useOAuthConsent` from `@clerk/react` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };

/**
* @deprecated Import `OAuthConsent` from `@clerk/react` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

export { useRoutingProps } from './hooks/useRoutingProps';
export { useDerivedAuth } from './hooks/useAuth';
export { IS_REACT_SHARED_VARIANT_COMPATIBLE } from './utils/versionCheck';
Expand Down
9 changes: 9 additions & 0 deletions packages/react/src/isomorphicClerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,7 @@ import type {
ListenerOptions,
LoadedClerk,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1298,6 +1299,14 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
}
};

mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
this.__internal_mountOAuthConsent(node, props);
};

unmountOAuthConsent = (node: HTMLDivElement) => {
this.__internal_unmountOAuthConsent(node);
};
Comment on lines +1302 to +1308

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bashset -euo pipefail
FILE="packages/react/src/isomorphicClerk.ts"# Verify newly added methods currently omit explicit return types
rg -n "mountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement, props\\?: OAuthConsentProps\\)\\s*=>""$FILE"
rg -n "unmountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement\\)\\s*=>""$FILE"# Compare with existing explicit-void public mount/unmount methods in same file
rg -n "mountAPIKeys\\s*=\\s*\\(node: HTMLDivElement, props\\?: APIKeysProps\\): void""$FILE"
rg -n "unmountAPIKeys\\s*=\\s*\\(node: HTMLDivElement\\): void""$FILE"

Repository: clerk/javascript

Length of output: 403


Add explicit return type annotations to the new public OAuth consent methods.

Lines 1302 and 1306 introduce public API methods without explicit return type annotations. Declare : void to match existing methods in the same file (mountAPIKeys, unmountAPIKeys) and comply with the guideline requiring explicit return types for public APIs.

Proposed fix
- mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {+ mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps): void => {
this.__internal_mountOAuthConsent(node, props);
};
- unmountOAuthConsent = (node: HTMLDivElement) => {+ unmountOAuthConsent = (node: HTMLDivElement): void => {
this.__internal_unmountOAuthConsent(node);
};
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps)=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement)=>{
this.__internal_unmountOAuthConsent(node);
};
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps): void=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement): void=>{
this.__internal_unmountOAuthConsent(node);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/react/src/isomorphicClerk.ts` around lines 1302 - 1308, The new
public methods mountOAuthConsent and unmountOAuthConsent lack explicit return
types; update their signatures to include ": void" (e.g., change
mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => { ... }
to declare a void return and similarly for unmountOAuthConsent) to match
existing public methods like mountAPIKeys and unmountAPIKeys and satisfy the
public API return-type guideline.


mountTaskChooseOrganization = (node: HTMLDivElement, props?: TaskChooseOrganizationProps): void => {
if (this.clerkjs && this.loaded) {
this.clerkjs.mountTaskChooseOrganization(node, props);
Expand Down
20 changes: 19 additions & 1 deletion packages/shared/src/types/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -676,6 +676,21 @@ export interface Clerk {
*/
__internal_unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a OAuth consent component at the target element.
*
* @param targetNode - Target node to mount the OAuth consent component.
* @param oauthConsentProps - OAuth consent configuration parameters.
*/
mountOAuthConsent: (targetNode: HTMLDivElement, oauthConsentProps?: OAuthConsentProps) => void;

/**
* Unmounts a OAuth consent component from the target element.
*
* @param targetNode - Target node to unmount the OAuth consent component from.
*/
unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a TaskChooseOrganization component at the target element.
*
Expand DownExpand Up@@ -2275,7 +2290,7 @@ export type __experimental_SubscriptionDetailsButtonProps = {
};
};

export type __internal_OAuthConsentProps = {
export type OAuthConsentProps = {
/**
* Customize the appearance of the component.
*/
Expand DownExpand Up@@ -2338,6 +2353,9 @@ export type __internal_OAuthConsentProps = {
onDeny?: () => void;
};

/** @deprecated Use OAuthConsentProps instead. */
export type __internal_OAuthConsentProps = OAuthConsentProps;

export interface HandleEmailLinkVerificationParams {
/**
* Full URL or path to navigate to after successful magic link verification
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/nice-seas-vue-nuxt-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
---
"@clerk/nuxt": minor
"@clerk/vue": minor
---

Expose `OAuthConsent` as a public component export for Vue and Nuxt.

Example:

```vue
<script setup lang="ts">
import { OAuthConsent } from '@clerk/vue';
</script>

<template>
<OAuthConsent />
</template>
```
15 changes: 15 additions & 0 deletions .changeset/small-planets-astro-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
---
"@clerk/astro": minor
---

Expose `OAuthConsent` as a public component export for Astro.

Example:

```astro
---
import { OAuthConsent } from '@clerk/astro/components';
---

<OAuthConsent />
```
21 changes: 21 additions & 0 deletions .changeset/three-rabbits-react-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
---
"@clerk/clerk-js": minor
"@clerk/nextjs": minor
"@clerk/react": minor
"@clerk/react-router": minor
"@clerk/shared": minor
"@clerk/tanstack-react-start": minor
"@clerk/ui": minor
---

Expose `OAuthConsent` as a public component export across React-based SDKs.

Example:

```tsx
import { OAuthConsent } from '@clerk/react';

export default function Page() {
return <OAuthConsent />;
}
```
1 change: 1 addition & 0 deletions packages/astro/src/astro-components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,5 +28,6 @@ export { default as OrganizationList } from './interactive/OrganizationList.astr
export { default as CreateOrganization } from './interactive/CreateOrganization.astro';
export { default as GoogleOneTap } from './interactive/GoogleOneTap.astro';
export { default as Waitlist } from './interactive/Waitlist.astro';
export { default as OAuthConsent } from './interactive/OAuthConsent.astro';
export { default as PricingTable } from './interactive/PricingTable.astro';
export { default as APIKeys } from './interactive/APIKeys.astro';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
---
import type { OAuthConsentProps } from '@clerk/shared/types';
type Props = OAuthConsentProps;

import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro';
---

<InternalUIComponentRenderer
{...Astro.props}
component='oauth-consent'
/>
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,7 @@ const mountAllClerkAstroJSComponents = () => {
waitlist: 'mountWaitlist',
'pricing-table': 'mountPricingTable',
'api-keys': 'mountAPIKeys',
'oauth-consent': 'mountOAuthConsent',
} as const satisfies Record<InternalUIComponentId, keyof Clerk>;

Object.entries(mountFns).forEach(([category, mountFn]) => {
Expand Down
11 changes: 11 additions & 0 deletions packages/astro/src/react/uiComponents.tsx
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import type {
GoogleOneTapProps,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationSwitcherProps,
Expand DownExpand Up@@ -196,3 +197,13 @@ export const PricingTable = withClerk(({ clerk, ...props }: WithClerkProp<Pricin
/>
);
}, 'PricingTable');

export const OAuthConsent = withClerk(({ clerk, ...props }: WithClerkProp<OAuthConsentProps>) => {
return (
<Portal
mount={clerk?.mountOAuthConsent}
unmount={clerk?.unmountOAuthConsent}
props={props}
/>
);
}, 'OAuthConsent');
3 changes: 2 additions & 1 deletion packages/astro/src/types.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,4 +119,5 @@ export type InternalUIComponentId =
| 'google-one-tap'
| 'waitlist'
| 'pricing-table'
| 'api-keys';
| 'api-keys'
| 'oauth-consent';
2 changes: 1 addition & 1 deletion packages/clerk-js/sandbox/app.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -475,7 +475,7 @@ void (async () => {
description: scope === 'offline_access' ? null : `Grants access to your ${scope}`,
requires_consent: true,
}));
Clerk.__internal_mountOAuthConsent(
Clerk.mountOAuthConsent(
app,
componentControls.oauthConsent.getProps() ?? {
scopes,
Expand Down
19 changes: 17 additions & 2 deletions packages/clerk-js/src/core/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,6 +95,7 @@ import type {
LoadedClerk,
NavigateOptions,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1348,7 +1349,7 @@ export class Clerk implements ClerkInterface {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
public mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
if (noUserExists(this)) {
if (this.#instanceType === 'development') {
throw new ClerkRuntimeError(warnings.cannotRenderOAuthConsentComponentWhenUserDoesNotExist, {
Expand All@@ -1372,10 +1373,24 @@ export class Clerk implements ClerkInterface {
);
};

public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
public unmountOAuthConsent = (node: HTMLDivElement) => {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

/**
* @deprecated Use mountOAuthConsent instead.
*/
public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
return this.mountOAuthConsent(node, props);
};

/**
* @deprecated Use unmountOAuthConsent instead.
*/
public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
return this.unmountOAuthConsent(node);
};

/**
* Mount an API keys component at the target element.
* @param targetNode Target to mount the APIKeys component.
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/client-boundary/hooks.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationList,
useOrganizationCreationDefaults,
Expand Down
5 changes: 2 additions & 3 deletions packages/nextjs/src/client-boundary/uiComponents.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,8 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
HandleSSOCallback,
OAuthConsent,
OrganizationList,
OrganizationSwitcher,
PricingTable,
Expand All@@ -28,11 +30,8 @@ export {
UserAvatar,
UserButton,
Waitlist,
HandleSSOCallback,
} from '@clerk/react';

export { OAuthConsent } from '@clerk/react/internal';

// The assignment of UserProfile with BaseUserProfile props is used
// to support the CustomPage functionality (eg UserProfile.Page)
// Also the `typeof BaseUserProfile` is used to resolve the following error:
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand DownExpand Up@@ -52,6 +53,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationCreationDefaults,
useOrganizationList,
Expand Down
18 changes: 16 additions & 2 deletions packages/nextjs/src/internal.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,20 @@
* These need to be explicitly listed. Do not use an * here.
* If you do, app router will break.
*/
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';

import { OAuthConsent as OAuthConsentOriginal } from './client-boundary/uiComponents';

export { MultisessionAppSupport } from './client-boundary/controlComponents';
export { OAuthConsent } from './client-boundary/uiComponents';
export { useOAuthConsent } from '@clerk/shared/react';

/**
* @deprecated Import `OAuthConsent` from `@clerk/nextjs` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

/**
* @deprecated Import `useOAuthConsent` from `@clerk/nextjs` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };
1 change: 1 addition & 0 deletions packages/nuxt/src/runtime/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@ export {
UserButton,
OrganizationSwitcher,
GoogleOneTap,
OAuthConsent,
Waitlist,
// Control components
ClerkLoaded,
Expand Down
7 changes: 0 additions & 7 deletions packages/react-router/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,10 +42,6 @@
"types": "./dist/api/index.d.ts",
"default": "./dist/api/index.js"
},
"./internal": {
"types": "./dist/internal.d.ts",
"default": "./dist/internal.js"
},
"./errors": {
"types": "./dist/errors.d.ts",
"default": "./dist/errors.js"
Expand DownExpand Up@@ -77,9 +73,6 @@
"api.server": [
"dist/api/index.d.ts"
],
"internal": [
"dist/internal.d.ts"
],
"webhooks": [
"dist/webhooks.d.ts"
],
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"CreateOrganization",
"GoogleOneTap",
"HandleSSOCallback",
"OAuthConsent",
"OrganizationList",
"OrganizationProfile",
"OrganizationSwitcher",
Expand DownExpand Up@@ -61,6 +62,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"useAuth",
"useClerk",
"useEmailLink",
"useOAuthConsent",
"useOrganization",
"useOrganizationCreationDefaults",
"useOrganizationList",
Expand Down
1 change: 0 additions & 1 deletion packages/react-router/src/internal.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/react/src/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/hooks/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,7 @@ export {
useSession,
useReverification,
useAPIKeys,
useOAuthConsent,
__experimental_useCheckout,
__experimental_CheckoutProvider,
__experimental_usePaymentElement,
Expand Down
17 changes: 15 additions & 2 deletions packages/react/src/internal.ts
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';
import type { InternalClerkScriptProps } from '@clerk/shared/types';
import type { Ui } from '@clerk/ui/internal';
import type React from 'react';

import { OAuthConsent as OAuthConsentOriginal } from './components/uiComponents';
import { ClerkProvider } from './contexts/ClerkProvider';
import type { ClerkProviderProps } from './types';

export { publishableKeyFromHost } from '@clerk/shared/keys';
export { setErrorThrowerOptions } from './errors/errorThrower';
export { MultisessionAppSupport } from './components/controlComponents';
export { useOAuthConsent } from '@clerk/shared/react';
export { OAuthConsent } from './components/uiComponents';

/**
* @deprecated Import `useOAuthConsent` from `@clerk/react` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };

/**
* @deprecated Import `OAuthConsent` from `@clerk/react` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

export { useRoutingProps } from './hooks/useRoutingProps';
export { useDerivedAuth } from './hooks/useAuth';
export { IS_REACT_SHARED_VARIANT_COMPATIBLE } from './utils/versionCheck';
Expand Down
9 changes: 9 additions & 0 deletions packages/react/src/isomorphicClerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,7 @@ import type {
ListenerOptions,
LoadedClerk,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1298,6 +1299,14 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
}
};

mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
this.__internal_mountOAuthConsent(node, props);
};

unmountOAuthConsent = (node: HTMLDivElement) => {
this.__internal_unmountOAuthConsent(node);
};
Comment on lines +1302 to +1308

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bashset -euo pipefail
FILE="packages/react/src/isomorphicClerk.ts"# Verify newly added methods currently omit explicit return types
rg -n "mountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement, props\\?: OAuthConsentProps\\)\\s*=>""$FILE"
rg -n "unmountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement\\)\\s*=>""$FILE"# Compare with existing explicit-void public mount/unmount methods in same file
rg -n "mountAPIKeys\\s*=\\s*\\(node: HTMLDivElement, props\\?: APIKeysProps\\): void""$FILE"
rg -n "unmountAPIKeys\\s*=\\s*\\(node: HTMLDivElement\\): void""$FILE"

Repository: clerk/javascript

Length of output: 403


Add explicit return type annotations to the new public OAuth consent methods.

Lines 1302 and 1306 introduce public API methods without explicit return type annotations. Declare : void to match existing methods in the same file (mountAPIKeys, unmountAPIKeys) and comply with the guideline requiring explicit return types for public APIs.

Proposed fix
- mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {+ mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps): void => {
this.__internal_mountOAuthConsent(node, props);
};
- unmountOAuthConsent = (node: HTMLDivElement) => {+ unmountOAuthConsent = (node: HTMLDivElement): void => {
this.__internal_unmountOAuthConsent(node);
};
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps)=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement)=>{
this.__internal_unmountOAuthConsent(node);
};
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps): void=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement): void=>{
this.__internal_unmountOAuthConsent(node);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/react/src/isomorphicClerk.ts` around lines 1302 - 1308, The new
public methods mountOAuthConsent and unmountOAuthConsent lack explicit return
types; update their signatures to include ": void" (e.g., change
mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => { ... }
to declare a void return and similarly for unmountOAuthConsent) to match
existing public methods like mountAPIKeys and unmountAPIKeys and satisfy the
public API return-type guideline.


mountTaskChooseOrganization = (node: HTMLDivElement, props?: TaskChooseOrganizationProps): void => {
if (this.clerkjs && this.loaded) {
this.clerkjs.mountTaskChooseOrganization(node, props);
Expand Down
20 changes: 19 additions & 1 deletion packages/shared/src/types/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -676,6 +676,21 @@ export interface Clerk {
*/
__internal_unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a OAuth consent component at the target element.
*
* @param targetNode - Target node to mount the OAuth consent component.
* @param oauthConsentProps - OAuth consent configuration parameters.
*/
mountOAuthConsent: (targetNode: HTMLDivElement, oauthConsentProps?: OAuthConsentProps) => void;

/**
* Unmounts a OAuth consent component from the target element.
*
* @param targetNode - Target node to unmount the OAuth consent component from.
*/
unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a TaskChooseOrganization component at the target element.
*
Expand DownExpand Up@@ -2275,7 +2290,7 @@ export type __experimental_SubscriptionDetailsButtonProps = {
};
};

export type __internal_OAuthConsentProps = {
export type OAuthConsentProps = {
/**
* Customize the appearance of the component.
*/
Expand DownExpand Up@@ -2338,6 +2353,9 @@ export type __internal_OAuthConsentProps = {
onDeny?: () => void;
};

/** @deprecated Use OAuthConsentProps instead. */
export type __internal_OAuthConsentProps = OAuthConsentProps;

export interface HandleEmailLinkVerificationParams {
/**
* Full URL or path to navigate to after successful magic link verification
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/nice-seas-vue-nuxt-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
---
"@clerk/nuxt": minor
"@clerk/vue": minor
---

Expose `OAuthConsent` as a public component export for Vue and Nuxt.

Example:

```vue
<script setup lang="ts">
import { OAuthConsent } from '@clerk/vue';
</script>

<template>
<OAuthConsent />
</template>
```
15 changes: 15 additions & 0 deletions .changeset/small-planets-astro-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
---
"@clerk/astro": minor
---

Expose `OAuthConsent` as a public component export for Astro.

Example:

```astro
---
import { OAuthConsent } from '@clerk/astro/components';
---

<OAuthConsent />
```
21 changes: 21 additions & 0 deletions .changeset/three-rabbits-react-oauth-consent.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
---
"@clerk/clerk-js": minor
"@clerk/nextjs": minor
"@clerk/react": minor
"@clerk/react-router": minor
"@clerk/shared": minor
"@clerk/tanstack-react-start": minor
"@clerk/ui": minor
---

Expose `OAuthConsent` as a public component export across React-based SDKs.

Example:

```tsx
import { OAuthConsent } from '@clerk/react';

export default function Page() {
return <OAuthConsent />;
}
```
1 change: 1 addition & 0 deletions packages/astro/src/astro-components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,5 +28,6 @@ export { default as OrganizationList } from './interactive/OrganizationList.astr
export { default as CreateOrganization } from './interactive/CreateOrganization.astro';
export { default as GoogleOneTap } from './interactive/GoogleOneTap.astro';
export { default as Waitlist } from './interactive/Waitlist.astro';
export { default as OAuthConsent } from './interactive/OAuthConsent.astro';
export { default as PricingTable } from './interactive/PricingTable.astro';
export { default as APIKeys } from './interactive/APIKeys.astro';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
---
import type { OAuthConsentProps } from '@clerk/shared/types';
type Props = OAuthConsentProps;

import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro';
---

<InternalUIComponentRenderer
{...Astro.props}
component='oauth-consent'
/>
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,7 @@ const mountAllClerkAstroJSComponents = () => {
waitlist: 'mountWaitlist',
'pricing-table': 'mountPricingTable',
'api-keys': 'mountAPIKeys',
'oauth-consent': 'mountOAuthConsent',
} as const satisfies Record<InternalUIComponentId, keyof Clerk>;

Object.entries(mountFns).forEach(([category, mountFn]) => {
Expand Down
11 changes: 11 additions & 0 deletions packages/astro/src/react/uiComponents.tsx
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import type {
GoogleOneTapProps,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationSwitcherProps,
Expand DownExpand Up@@ -196,3 +197,13 @@ export const PricingTable = withClerk(({ clerk, ...props }: WithClerkProp<Pricin
/>
);
}, 'PricingTable');

export const OAuthConsent = withClerk(({ clerk, ...props }: WithClerkProp<OAuthConsentProps>) => {
return (
<Portal
mount={clerk?.mountOAuthConsent}
unmount={clerk?.unmountOAuthConsent}
props={props}
/>
);
}, 'OAuthConsent');
3 changes: 2 additions & 1 deletion packages/astro/src/types.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,4 +119,5 @@ export type InternalUIComponentId =
| 'google-one-tap'
| 'waitlist'
| 'pricing-table'
| 'api-keys';
| 'api-keys'
| 'oauth-consent';
2 changes: 1 addition & 1 deletion packages/clerk-js/sandbox/app.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -475,7 +475,7 @@ void (async () => {
description: scope === 'offline_access' ? null : `Grants access to your ${scope}`,
requires_consent: true,
}));
Clerk.__internal_mountOAuthConsent(
Clerk.mountOAuthConsent(
app,
componentControls.oauthConsent.getProps() ?? {
scopes,
Expand Down
19 changes: 17 additions & 2 deletions packages/clerk-js/src/core/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,6 +95,7 @@ import type {
LoadedClerk,
NavigateOptions,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1348,7 +1349,7 @@ export class Clerk implements ClerkInterface {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
public mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
if (noUserExists(this)) {
if (this.#instanceType === 'development') {
throw new ClerkRuntimeError(warnings.cannotRenderOAuthConsentComponentWhenUserDoesNotExist, {
Expand All@@ -1372,10 +1373,24 @@ export class Clerk implements ClerkInterface {
);
};

public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
public unmountOAuthConsent = (node: HTMLDivElement) => {
void this.#clerkUI?.then(ui => ui.ensureMounted()).then(controls => controls.unmountComponent({ node }));
};

/**
* @deprecated Use mountOAuthConsent instead.
*/
public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
return this.mountOAuthConsent(node, props);
};

/**
* @deprecated Use unmountOAuthConsent instead.
*/
public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
return this.unmountOAuthConsent(node);
};

/**
* Mount an API keys component at the target element.
* @param targetNode Target to mount the APIKeys component.
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/client-boundary/hooks.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationList,
useOrganizationCreationDefaults,
Expand Down
5 changes: 2 additions & 3 deletions packages/nextjs/src/client-boundary/uiComponents.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,8 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
HandleSSOCallback,
OAuthConsent,
OrganizationList,
OrganizationSwitcher,
PricingTable,
Expand All@@ -28,11 +30,8 @@ export {
UserAvatar,
UserButton,
Waitlist,
HandleSSOCallback,
} from '@clerk/react';

export { OAuthConsent } from '@clerk/react/internal';

// The assignment of UserProfile with BaseUserProfile props is used
// to support the CustomPage functionality (eg UserProfile.Page)
// Also the `typeof BaseUserProfile` is used to resolve the following error:
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand DownExpand Up@@ -52,6 +53,7 @@ export {
useAuth,
useClerk,
useEmailLink,
useOAuthConsent,
useOrganization,
useOrganizationCreationDefaults,
useOrganizationList,
Expand Down
18 changes: 16 additions & 2 deletions packages/nextjs/src/internal.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,20 @@
* These need to be explicitly listed. Do not use an * here.
* If you do, app router will break.
*/
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';

import { OAuthConsent as OAuthConsentOriginal } from './client-boundary/uiComponents';

export { MultisessionAppSupport } from './client-boundary/controlComponents';
export { OAuthConsent } from './client-boundary/uiComponents';
export { useOAuthConsent } from '@clerk/shared/react';

/**
* @deprecated Import `OAuthConsent` from `@clerk/nextjs` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

/**
* @deprecated Import `useOAuthConsent` from `@clerk/nextjs` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };
1 change: 1 addition & 0 deletions packages/nuxt/src/runtime/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@ export {
UserButton,
OrganizationSwitcher,
GoogleOneTap,
OAuthConsent,
Waitlist,
// Control components
ClerkLoaded,
Expand Down
7 changes: 0 additions & 7 deletions packages/react-router/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,10 +42,6 @@
"types": "./dist/api/index.d.ts",
"default": "./dist/api/index.js"
},
"./internal": {
"types": "./dist/internal.d.ts",
"default": "./dist/internal.js"
},
"./errors": {
"types": "./dist/errors.d.ts",
"default": "./dist/errors.js"
Expand DownExpand Up@@ -77,9 +73,6 @@
"api.server": [
"dist/api/index.d.ts"
],
"internal": [
"dist/internal.d.ts"
],
"webhooks": [
"dist/webhooks.d.ts"
],
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"CreateOrganization",
"GoogleOneTap",
"HandleSSOCallback",
"OAuthConsent",
"OrganizationList",
"OrganizationProfile",
"OrganizationSwitcher",
Expand DownExpand Up@@ -61,6 +62,7 @@ exports[`root public exports > should not change unexpectedly 1`] = `
"useAuth",
"useClerk",
"useEmailLink",
"useOAuthConsent",
"useOrganization",
"useOrganizationCreationDefaults",
"useOrganizationList",
Expand Down
1 change: 0 additions & 1 deletion packages/react-router/src/internal.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/react/src/components/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ export {
APIKeys,
CreateOrganization,
GoogleOneTap,
OAuthConsent,
OrganizationList,
OrganizationProfile,
OrganizationSwitcher,
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/hooks/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,7 @@ export {
useSession,
useReverification,
useAPIKeys,
useOAuthConsent,
__experimental_useCheckout,
__experimental_CheckoutProvider,
__experimental_usePaymentElement,
Expand Down
17 changes: 15 additions & 2 deletions packages/react/src/internal.ts
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
import { useOAuthConsent as useOAuthConsentOriginal } from '@clerk/shared/react';
import type { InternalClerkScriptProps } from '@clerk/shared/types';
import type { Ui } from '@clerk/ui/internal';
import type React from 'react';

import { OAuthConsent as OAuthConsentOriginal } from './components/uiComponents';
import { ClerkProvider } from './contexts/ClerkProvider';
import type { ClerkProviderProps } from './types';

export { publishableKeyFromHost } from '@clerk/shared/keys';
export { setErrorThrowerOptions } from './errors/errorThrower';
export { MultisessionAppSupport } from './components/controlComponents';
export { useOAuthConsent } from '@clerk/shared/react';
export { OAuthConsent } from './components/uiComponents';

/**
* @deprecated Import `useOAuthConsent` from `@clerk/react` instead.
*/
const useOAuthConsent = useOAuthConsentOriginal;
export { useOAuthConsent };

/**
* @deprecated Import `OAuthConsent` from `@clerk/react` instead.
*/
const OAuthConsent = OAuthConsentOriginal;
export { OAuthConsent };

export { useRoutingProps } from './hooks/useRoutingProps';
export { useDerivedAuth } from './hooks/useAuth';
export { IS_REACT_SHARED_VARIANT_COMPATIBLE } from './utils/versionCheck';
Expand Down
9 changes: 9 additions & 0 deletions packages/react/src/isomorphicClerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,7 @@ import type {
ListenerOptions,
LoadedClerk,
OAuthApplicationNamespace,
OAuthConsentProps,
OrganizationListProps,
OrganizationProfileProps,
OrganizationResource,
Expand DownExpand Up@@ -1298,6 +1299,14 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk {
}
};

mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {
this.__internal_mountOAuthConsent(node, props);
};

unmountOAuthConsent = (node: HTMLDivElement) => {
this.__internal_unmountOAuthConsent(node);
};
Comment on lines +1302 to +1308

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bashset -euo pipefail
FILE="packages/react/src/isomorphicClerk.ts"# Verify newly added methods currently omit explicit return types
rg -n "mountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement, props\\?: OAuthConsentProps\\)\\s*=>""$FILE"
rg -n "unmountOAuthConsent\\s*=\\s*\\(node: HTMLDivElement\\)\\s*=>""$FILE"# Compare with existing explicit-void public mount/unmount methods in same file
rg -n "mountAPIKeys\\s*=\\s*\\(node: HTMLDivElement, props\\?: APIKeysProps\\): void""$FILE"
rg -n "unmountAPIKeys\\s*=\\s*\\(node: HTMLDivElement\\): void""$FILE"

Repository: clerk/javascript

Length of output: 403


Add explicit return type annotations to the new public OAuth consent methods.

Lines 1302 and 1306 introduce public API methods without explicit return type annotations. Declare : void to match existing methods in the same file (mountAPIKeys, unmountAPIKeys) and comply with the guideline requiring explicit return types for public APIs.

Proposed fix
- mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => {+ mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps): void => {
this.__internal_mountOAuthConsent(node, props);
};
- unmountOAuthConsent = (node: HTMLDivElement) => {+ unmountOAuthConsent = (node: HTMLDivElement): void => {
this.__internal_unmountOAuthConsent(node);
};
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps)=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement)=>{
this.__internal_unmountOAuthConsent(node);
};
mountOAuthConsent=(node: HTMLDivElement,props?: OAuthConsentProps): void=>{
this.__internal_mountOAuthConsent(node,props);
};
unmountOAuthConsent=(node: HTMLDivElement): void=>{
this.__internal_unmountOAuthConsent(node);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/react/src/isomorphicClerk.ts` around lines 1302 - 1308, The new
public methods mountOAuthConsent and unmountOAuthConsent lack explicit return
types; update their signatures to include ": void" (e.g., change
mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => { ... }
to declare a void return and similarly for unmountOAuthConsent) to match
existing public methods like mountAPIKeys and unmountAPIKeys and satisfy the
public API return-type guideline.


mountTaskChooseOrganization = (node: HTMLDivElement, props?: TaskChooseOrganizationProps): void => {
if (this.clerkjs && this.loaded) {
this.clerkjs.mountTaskChooseOrganization(node, props);
Expand Down
20 changes: 19 additions & 1 deletion packages/shared/src/types/clerk.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -676,6 +676,21 @@ export interface Clerk {
*/
__internal_unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a OAuth consent component at the target element.
*
* @param targetNode - Target node to mount the OAuth consent component.
* @param oauthConsentProps - OAuth consent configuration parameters.
*/
mountOAuthConsent: (targetNode: HTMLDivElement, oauthConsentProps?: OAuthConsentProps) => void;

/**
* Unmounts a OAuth consent component from the target element.
*
* @param targetNode - Target node to unmount the OAuth consent component from.
*/
unmountOAuthConsent: (targetNode: HTMLDivElement) => void;

/**
* Mounts a TaskChooseOrganization component at the target element.
*
Expand DownExpand Up@@ -2275,7 +2290,7 @@ export type __experimental_SubscriptionDetailsButtonProps = {
};
};

export type __internal_OAuthConsentProps = {
export type OAuthConsentProps = {
/**
* Customize the appearance of the component.
*/
Expand DownExpand Up@@ -2338,6 +2353,9 @@ export type __internal_OAuthConsentProps = {
onDeny?: () => void;
};

/** @deprecated Use OAuthConsentProps instead. */
export type __internal_OAuthConsentProps = OAuthConsentProps;

export interface HandleEmailLinkVerificationParams {
/**
* Full URL or path to navigate to after successful magic link verification
Expand Down
Loading
Loading