chore(clerk-js,ui): Make OAuthConsent component public#8381
chore(clerk-js,ui): Make OAuthConsent component public#8381wobsoriano wants to merge 9 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 24a419f The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
- Rename __internal_OAuthConsentProps to OAuthConsentProps in @clerk/shared - Rename __internal_mountOAuthConsent / __internal_unmountOAuthConsent to mountOAuthConsent / unmountOAuthConsent on the Clerk interface and clerk-js - Add OAuthConsent and useOAuthConsent to the public exports of @clerk/react, @clerk/nextjs, @clerk/vue, @clerk/nuxt, and @clerk/astro - Add @deprecated JSDoc to the existing /internal re-exports in @clerk/react and @clerk/nextjs pointing consumers to the public paths - Update @clerk/ui type references to the renamed public types
b7eb222 to
2c33684
Compare
694e79b to
39afe25
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (3)
📝 WalkthroughWalkthroughThis pull request introduces the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Review rate limit: 4/5 reviews remaining, refill in 12 minutes. Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/clerk-js/src/core/clerk.ts (1)
1352-1392:⚠️ Potential issue | 🟠 MajorAdd explicit return type annotations for the new OAuthConsent public API methods.
Lines 1352, 1376, 1383, and 1390 define public methods without explicit return types. Public APIs in this repository must include explicit return type annotations (
: voidin this case).Suggested fix
- public mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => { + public mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps): void => { @@ - public unmountOAuthConsent = (node: HTMLDivElement) => { + public unmountOAuthConsent = (node: HTMLDivElement): void => { @@ - public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => { + public __internal_mountOAuthConsent = ( + node: HTMLDivElement, + props?: __internal_OAuthConsentProps, + ): void => { @@ - public __internal_unmountOAuthConsent = (node: HTMLDivElement) => { + public __internal_unmountOAuthConsent = (node: HTMLDivElement): void => {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/clerk-js/src/core/clerk.ts` around lines 1352 - 1392, The four public methods mountOAuthConsent, unmountOAuthConsent, __internal_mountOAuthConsent, and __internal_unmountOAuthConsent lack explicit return type annotations; update their function signatures to include an explicit ": void" return type (e.g., change "public mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps)" to "public mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps): void"), and do the same for unmountOAuthConsent, __internal_mountOAuthConsent, and __internal_unmountOAuthConsent so the public API has explicit void return types.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/clerk-js/src/core/clerk.ts`:
- Around line 1352-1392: The four public methods mountOAuthConsent,
unmountOAuthConsent, __internal_mountOAuthConsent, and
__internal_unmountOAuthConsent lack explicit return type annotations; update
their function signatures to include an explicit ": void" return type (e.g.,
change "public mountOAuthConsent = (node: HTMLDivElement, props?:
OAuthConsentProps)" to "public mountOAuthConsent = (node: HTMLDivElement,
props?: OAuthConsentProps): void"), and do the same for unmountOAuthConsent,
__internal_mountOAuthConsent, and __internal_unmountOAuthConsent so the public
API has explicit void return types.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 7fec644c-ae08-448a-a0e5-df62849dd863
📒 Files selected for processing (6)
packages/astro/src/astro-components/interactive/OAuthConsent.astropackages/astro/src/internal/mount-clerk-astro-js-components.tspackages/astro/src/react/uiComponents.tsxpackages/clerk-js/src/core/clerk.tspackages/shared/src/types/clerk.tspackages/vue/src/components/ui-components/OAuthConsent.vue
✅ Files skipped from review due to trivial changes (2)
- packages/astro/src/astro-components/interactive/OAuthConsent.astro
- packages/vue/src/components/ui-components/OAuthConsent.vue
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/astro/src/internal/mount-clerk-astro-js-components.ts
- packages/astro/src/react/uiComponents.tsx
- packages/shared/src/types/clerk.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/react/src/isomorphicClerk.ts`:
- Around line 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.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: c8838395-5182-44d7-af64-6be96e310198
📒 Files selected for processing (1)
packages/react/src/isomorphicClerk.ts
| mountOAuthConsent = (node: HTMLDivElement, props?: OAuthConsentProps) => { | ||
| this.__internal_mountOAuthConsent(node, props); | ||
| }; | ||
|
|
||
| unmountOAuthConsent = (node: HTMLDivElement) => { | ||
| this.__internal_unmountOAuthConsent(node); | ||
| }; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -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.
| 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.
There was a problem hiding this comment.
maybe it's safe just to remove this /internal export that was added just for OAuthConsent. Never used in any of our repos
There was a problem hiding this comment.
Description
This PR makes
OAuthConsentpublicly available across SDKs and keeps the legacy__internal_*OAuthConsentruntime methods in place for compatibility.Older published SDKs still call:
clerk.__internal_mountOAuthConsentclerk.__internal_unmountOAuthConsentWhen
clerk-jsis loaded from the CDN, users can end up with:clerk-jsruntime assetsIf we remove the legacy runtime methods now, those mixed-version deployments break at runtime with
... is not a function.To avoid that, this PR:
mountOAuthConsent/unmountOAuthConsentas the canonical API__internal_mountOAuthConsent/__internal_unmountOAuthConsentas deprecated aliasesFollow-up plan
mountOAuthConsent/unmountOAuthConsent__internal_*OAuthConsentcan be removed in a later major once we intentionally drop compatibility with older published wrappersChecklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change