Skip to content

Commit 0245573

Browse files
committed
Refactor matchesSocialProvider: enhance button text matching logic for social providers to improve detection accuracy
1 parent 3707df8 commit 0245573

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/react/src/components/presentation/auth/AuthOptionFactory.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ const matchesSocialProvider = (
110110
buttonText: string,
111111
provider: string,
112112
authType: AuthType,
113-
componentVariant?: string,
114113
): boolean => {
115114
const providerId: any = `${provider}_auth`;
116115
const providerMatches: any = actionId === providerId || eventType === providerId;
117116

118-
// For social variant, also check button text for provider name
119-
if (componentVariant?.toUpperCase() === EmbeddedFlowActionVariant.Social) {
120-
return buttonText.toLowerCase().includes(provider);
117+
// Social buttons usually have "Sign in with X" or "Continue with X" text,
118+
// so also check button text for the provider name to increase chances of correct detection (especially for signup flows where action IDs are less standardized)
119+
if (buttonText.toLowerCase().includes(provider)) {
120+
return true;
121121
}
122122

123123
// For signup, also check button text

0 commit comments

Comments
 (0)