Skip to content
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

fix(clerk-js): Handle gracefully yet unknown to our components Web3 providers #4263

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
5 changes: 5 additions & 0 deletions .changeset/hot-pants-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/clerk-js": patch
---

Handle gracefully yet unknown to our components Web3 providers
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type ThirdPartyProviderToDataMap = {
};

const oauthStrategies = OAUTH_PROVIDERS.map(p => p.strategy);
const web3Strategies = WEB3_PROVIDERS.map(p => p.strategy);

const providerToDisplayData: ThirdPartyProviderToDataMap = fromEntries(
[...OAUTH_PROVIDERS, ...WEB3_PROVIDERS].map(p => {
Expand Down Expand Up @@ -89,9 +90,12 @@ export const useEnabledThirdPartyProviders = () => {
return aName.localeCompare(bName);
});

// Filter out any Web3 strategies that are not yet known, they are not included in our types.
const knownWeb3Strategies = web3FirstFactors.filter(s => web3Strategies.includes(s));

return {
strategies: [...knownSocialProviderStrategies, ...web3FirstFactors, ...customSocialProviderStrategies],
web3Strategies: [...web3FirstFactors],
strategies: [...knownSocialProviderStrategies, ...knownWeb3Strategies, ...customSocialProviderStrategies],
web3Strategies: knownWeb3Strategies,
authenticatableOauthStrategies,
strategyToDisplayData: strategyToDisplayData,
providerToDisplayData: providerToDisplayData,
Expand Down
Loading