-
Notifications
You must be signed in to change notification settings - Fork 0
YPE-1051 redirectUrl is now optional on YouVersionAuthButton #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… useYVAuth falls back to authRedirectUrl configured in YouVersionProvider.
|
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Greptile OverviewGreptile SummaryMade the
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Button as YouVersionAuthButton
participant Hook as useYVAuth
participant Provider as YouVersionProvider
participant API as YouVersionAPIUsers
User->>Button: Click
Button->>Hook: signIn(options)
alt URL in options
Hook->>API: Use options.redirectUrl
else No URL in options
Hook->>Provider: Fallback to config
Provider-->>Hook: authRedirectUrl
Hook->>API: Use authRedirectUrl
end
API-->>User: Redirect to OAuth
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
|
@greptileai, what would it take to mark |
|
To mark the 1. Make the prop optional and add deprecation JSDocUpdate the interface SignInAuthProps {
/**
* Called when the sign-in flow fails.
* @param error - The error thrown by the sign-in flow.
*/
onAuthError?: (error: Error) => void;
scopes?: AuthenticationScopes[];
/**
* @deprecated Use the `authRedirectUrl` prop on YouVersionProvider instead.
* This prop will be removed in a future version.
*
* The redirect URL for the authentication flow.
*/
redirectUrl?: string;
}2. Add console warning for deprecated usageUpdate the const handleClick = async (e: React.MouseEvent<HTMLButtonElement>): Promise<void> => {
e.preventDefault();
if (onClick) {
onClick(e);
}
// Warn about deprecated prop usage
if (redirectUrl && process.env.NODE_ENV !== 'production') {
console.warn(
'YouVersionAuthButton: The `redirectUrl` prop is deprecated. ' +
'Use the `authRedirectUrl` prop on YouVersionProvider instead. ' +
'This prop will be removed in a future version.'
);
}
try {
if (mode === 'signOut' || auth.isAuthenticated) {
signOut();
} else {
await signIn({
redirectUrl,
scopes,
});
}
} catch (error) {
if (onAuthError) {
onAuthError(error as Error);
}
}
};3. Update the JSDoc exampleUpdate the main component JSDoc to show the new recommended pattern: /**
* @example
* // Recommended: Configure redirect URL in provider
* <YouVersionProvider authRedirectUrl="https://myapp.com/callback">
* <YouVersionAuthButton onAuthError={(err) => console.error(err)} />
* </YouVersionProvider>
*
* @example
* // Deprecated: Direct redirectUrl prop (still works but will be removed)
* <YouVersionAuthButton
* redirectUrl="https://myapp.com/callback" // deprecated
* onAuthError={(err) => console.error(err)}
* />
*/These changes will:
The fallback behavior in |
…ecate its usage in favor of authRedirectUrl in YouVersionProvider.
bmanquen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add changeset
useYVAuth falls back to authRedirectUrl configured in YouVersionProvider so the prop isn't needed.