diff --git a/.changeset/dry-mice-begin.md b/.changeset/dry-mice-begin.md new file mode 100644 index 00000000000..23bd3d23eb0 --- /dev/null +++ b/.changeset/dry-mice-begin.md @@ -0,0 +1,6 @@ +--- +"@clerk/backend": patch +"@clerk/shared": patch +--- + +Fix OAuth consent component and hook related types. diff --git a/.typedoc/custom-plugin.mjs b/.typedoc/custom-plugin.mjs index cfe5e8c2c85..e7132279b63 100644 --- a/.typedoc/custom-plugin.mjs +++ b/.typedoc/custom-plugin.mjs @@ -36,6 +36,8 @@ const FILES_WITHOUT_HEADINGS = [ 'payment-element-props.mdx', 'use-organization-creation-defaults-return.mdx', 'use-organization-creation-defaults-params.mdx', + 'use-o-auth-consent-params.mdx', + 'use-o-auth-consent-return.mdx', ]; /** @@ -66,6 +68,8 @@ const LINK_REPLACEMENTS = [ ['organization-domain-resource', '/docs/reference/types/organization-domain-resource'], ['organization-invitation-resource', '/docs/reference/types/organization-invitation'], ['organization-membership-request-resource', '/docs/reference/types/organization-membership-request'], + ['o-auth-consent-info', '/docs/reference/types/oauth-consent-info'], + ['o-auth-consent-scope', '/docs/reference/types/oauth-consent-scope'], ['session', '/docs/reference/backend/types/backend-session'], ['session-activity', '/docs/reference/backend/types/backend-session-activity'], ['organization', '/docs/reference/backend/types/backend-organization'], @@ -76,6 +80,9 @@ const LINK_REPLACEMENTS = [ ['email-address', '/docs/reference/backend/types/backend-email-address'], ['enterprise-account', '/docs/reference/backend/types/backend-enterprise-account'], ['enterprise-account-connection', '/docs/reference/backend/types/backend-enterprise-account-connection'], + ['enterprise-connection', '/docs/reference/backend/types/backend-enterprise-connection'], + ['enterprise-connection-oauth-config', '/docs/reference/backend/types/backend-enterprise-connection-oauth-config'], + ['enterprise-connection-saml-connection', '/docs/reference/backend/types/backend-enterprise-connection-saml-connection'], ['external-account', '/docs/reference/backend/types/backend-external-account'], ['phone-number', '/docs/reference/backend/types/backend-phone-number'], ['saml-account', '/docs/reference/backend/types/backend-saml-account'], @@ -101,6 +108,7 @@ const LINK_REPLACEMENTS = [ ['billing-statement-resource', '/docs/reference/types/billing-statement-resource'], ['billing-subscription-resource', '/docs/reference/types/billing-subscription-resource'], ['clerk-api-response-error', '/docs/reference/types/clerk-api-response-error'], + ['clerk-api-error', '/docs/reference/types/clerk-api-error'], ['billing-statement-totals', '/docs/reference/types/billing-statement-totals'], ['billing-payment-resource', '/docs/reference/types/billing-payment-resource'], ['deleted-object-resource', '/docs/reference/types/deleted-object-resource'], @@ -134,6 +142,10 @@ function getRelativeLinkReplacements() { function getCatchAllReplacements() { return [ + { + pattern: /(?/g, replace: '[`Appearance`](/docs/guides/customizing-clerk/appearance-prop/overview)', diff --git a/packages/backend/src/api/resources/EnterpriseAccount.ts b/packages/backend/src/api/resources/EnterpriseAccount.ts index d20e52c9d0d..06608da84b4 100644 --- a/packages/backend/src/api/resources/EnterpriseAccount.ts +++ b/packages/backend/src/api/resources/EnterpriseAccount.ts @@ -2,7 +2,7 @@ import type { EnterpriseAccountConnectionJSON, EnterpriseAccountJSON } from './J import { Verification } from './Verification'; /** - * Represents an enterprise SSO connection associated with an enterprise account. + * The Backend `EnterpriseAccountConnection` object represents an enterprise SSO connection associated with an enterprise account. */ export class EnterpriseAccountConnection { constructor( diff --git a/packages/backend/src/api/resources/EnterpriseConnection.ts b/packages/backend/src/api/resources/EnterpriseConnection.ts index 03bfeb50a82..9a63afa49e4 100644 --- a/packages/backend/src/api/resources/EnterpriseConnection.ts +++ b/packages/backend/src/api/resources/EnterpriseConnection.ts @@ -4,6 +4,9 @@ import type { EnterpriseConnectionSamlConnectionJSON, } from './JSON'; +/** + * The Backend `EnterpriseConnectionSamlConnection` object holds information about a SAML enterprise connection for an instance or organization. + */ export class EnterpriseConnectionSamlConnection { constructor( /** diff --git a/packages/shared/src/react/hooks/useOAuthConsent.tsx b/packages/shared/src/react/hooks/useOAuthConsent.tsx index b35da37dfd4..674654a8bea 100644 --- a/packages/shared/src/react/hooks/useOAuthConsent.tsx +++ b/packages/shared/src/react/hooks/useOAuthConsent.tsx @@ -14,12 +14,6 @@ const HOOK_NAME = 'useOAuthConsent'; * (`GET /me/oauth/consent/{oauthClientId}`). Ensure the user is authenticated before relying on this hook * (for example, redirect to sign-in on your custom consent route). * - * The hook is a pure data fetcher: it takes an explicit `oauthClientId` and optional `scope` and - * issues the fetch when both the user is signed in and `oauthClientId` is non-empty. The query is - * disabled when `oauthClientId` is empty or omitted. - * - * @internal - * * @example * ```tsx * import { useOAuthConsent } from '@clerk/react/internal' @@ -30,7 +24,7 @@ const HOOK_NAME = 'useOAuthConsent'; * }) * ``` */ -export function useOAuthConsent(params: UseOAuthConsentParams = {}): UseOAuthConsentReturn { +export function useOAuthConsent(params: UseOAuthConsentParams): UseOAuthConsentReturn { useAssertWrappedByClerkProvider(HOOK_NAME); const { oauthClientId: oauthClientIdParam, scope, keepPreviousData = true, enabled = true } = params; diff --git a/packages/shared/src/react/hooks/useOAuthConsent.types.ts b/packages/shared/src/react/hooks/useOAuthConsent.types.ts index c8972cd483b..8fde2f44516 100644 --- a/packages/shared/src/react/hooks/useOAuthConsent.types.ts +++ b/packages/shared/src/react/hooks/useOAuthConsent.types.ts @@ -2,16 +2,9 @@ import type { ClerkAPIResponseError } from '../../errors/clerkApiResponseError'; import type { GetOAuthConsentInfoParams, OAuthConsentInfo } from '../../types'; /** - * Options for {@link useOAuthConsent}. - * - * Pass `oauthClientId` and `scope` explicitly. The hook does not read from `window.location` or - * any other ambient source. The hook is disabled when `oauthClientId` is empty or omitted. - * - * @internal - * * @interface */ -export type UseOAuthConsentParams = Partial> & { +export type UseOAuthConsentParams = Pick & { /** * If `true`, the previous data will be kept in the cache until new data is fetched. * @@ -27,14 +20,11 @@ export type UseOAuthConsentParams = Partial