Skip to content

Commit

Permalink
fix(clerk-js): Handle gracefully yet unknown to our components Web3 p…
Browse files Browse the repository at this point in the history
…roviders (#4263)
  • Loading branch information
chanioxaris authored Oct 1, 2024
1 parent a361200 commit 8568534
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
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

0 comments on commit 8568534

Please sign in to comment.