-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(shared,types): Move constants from types to shared (#4716)
- Loading branch information
1 parent
2a3462e
commit 0bc3ccc
Showing
12 changed files
with
259 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@clerk/clerk-js': minor | ||
'@clerk/elements': minor | ||
'@clerk/ui': minor | ||
--- | ||
|
||
Replace usage of `OAUTH_PROVIDERS` and `WEB3_PROVIDERS` from `@clerk/types` to `@clerk/shared`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@clerk/shared': minor | ||
--- | ||
|
||
Introduce new submodules: | ||
- Export `OAUTH_PROVIDERS` from `@clerk/shared/oauth` | ||
- Export `WEB3_PROVIDERS` from `@clerk/shared/web3` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
'@clerk/types': minor | ||
--- | ||
|
||
Deprecate the following constants and functions: | ||
- `OAUTH_PROVIDERS` | ||
- `getOAuthProviderData()` | ||
- `sortedOAuthProviders()` | ||
- `WEB3_PROVIDERS` | ||
- `getWeb3ProviderData()` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/clerk-js/src/ui/hooks/useEnabledThirdPartyProviders.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
import type { OAuthProvider, OAuthProviderData, OAuthStrategy } from '@clerk/types'; | ||
|
||
export const OAUTH_PROVIDERS: OAuthProviderData[] = [ | ||
{ | ||
provider: 'google', | ||
strategy: 'oauth_google', | ||
name: 'Google', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/google', | ||
}, | ||
{ | ||
provider: 'discord', | ||
strategy: 'oauth_discord', | ||
name: 'Discord', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/discord', | ||
}, | ||
{ | ||
provider: 'facebook', | ||
strategy: 'oauth_facebook', | ||
name: 'Facebook', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/facebook', | ||
}, | ||
{ | ||
provider: 'twitch', | ||
strategy: 'oauth_twitch', | ||
name: 'Twitch', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/twitch', | ||
}, | ||
{ | ||
provider: 'twitter', | ||
strategy: 'oauth_twitter', | ||
name: 'Twitter', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/twitter', | ||
}, | ||
{ | ||
provider: 'microsoft', | ||
strategy: 'oauth_microsoft', | ||
name: 'Microsoft', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/microsoft', | ||
}, | ||
{ | ||
provider: 'tiktok', | ||
strategy: 'oauth_tiktok', | ||
name: 'TikTok', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/tiktok', | ||
}, | ||
{ | ||
provider: 'linkedin', | ||
strategy: 'oauth_linkedin', | ||
name: 'LinkedIn', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/linkedin', | ||
}, | ||
{ | ||
provider: 'linkedin_oidc', | ||
strategy: 'oauth_linkedin_oidc', | ||
name: 'LinkedIn', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/linkedin-oidc', | ||
}, | ||
{ | ||
provider: 'github', | ||
strategy: 'oauth_github', | ||
name: 'GitHub', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/github', | ||
}, | ||
{ | ||
provider: 'gitlab', | ||
strategy: 'oauth_gitlab', | ||
name: 'GitLab', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/gitlab', | ||
}, | ||
{ | ||
provider: 'dropbox', | ||
strategy: 'oauth_dropbox', | ||
name: 'Dropbox', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/dropbox', | ||
}, | ||
{ | ||
provider: 'atlassian', | ||
strategy: 'oauth_atlassian', | ||
name: 'Atlassian', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/atlassian', | ||
}, | ||
{ | ||
provider: 'bitbucket', | ||
strategy: 'oauth_bitbucket', | ||
name: 'Bitbucket', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/bitbucket', | ||
}, | ||
{ | ||
provider: 'hubspot', | ||
strategy: 'oauth_hubspot', | ||
name: 'HubSpot', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/hubspot', | ||
}, | ||
{ | ||
provider: 'notion', | ||
strategy: 'oauth_notion', | ||
name: 'Notion', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/notion', | ||
}, | ||
{ | ||
provider: 'apple', | ||
strategy: 'oauth_apple', | ||
name: 'Apple', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/apple', | ||
}, | ||
{ | ||
provider: 'line', | ||
strategy: 'oauth_line', | ||
name: 'LINE', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/line', | ||
}, | ||
{ | ||
provider: 'instagram', | ||
strategy: 'oauth_instagram', | ||
name: 'Instagram', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/instagram', | ||
}, | ||
{ | ||
provider: 'coinbase', | ||
strategy: 'oauth_coinbase', | ||
name: 'Coinbase', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/coinbase', | ||
}, | ||
{ | ||
provider: 'spotify', | ||
strategy: 'oauth_spotify', | ||
name: 'Spotify', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/spotify', | ||
}, | ||
{ | ||
provider: 'xero', | ||
strategy: 'oauth_xero', | ||
name: 'Xero', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/xero', | ||
}, | ||
{ | ||
provider: 'box', | ||
strategy: 'oauth_box', | ||
name: 'Box', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/box', | ||
}, | ||
{ | ||
provider: 'slack', | ||
strategy: 'oauth_slack', | ||
name: 'Slack', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/slack', | ||
}, | ||
{ | ||
provider: 'linear', | ||
strategy: 'oauth_linear', | ||
name: 'Linear', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/linear', | ||
}, | ||
{ | ||
provider: 'x', | ||
strategy: 'oauth_x', | ||
name: 'X / Twitter', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/x-twitter-v2', | ||
}, | ||
{ | ||
provider: 'enstall', | ||
strategy: 'oauth_enstall', | ||
name: 'Enstall', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/enstall', | ||
}, | ||
{ | ||
provider: 'huggingface', | ||
strategy: 'oauth_huggingface', | ||
name: 'Hugging Face', | ||
docsUrl: 'https://clerk.com/docs/authentication/social-connections/huggingface', | ||
}, | ||
]; | ||
|
||
interface getOAuthProviderDataProps { | ||
provider?: OAuthProvider; | ||
strategy?: OAuthStrategy; | ||
} | ||
|
||
export function getOAuthProviderData({ | ||
provider, | ||
strategy, | ||
}: getOAuthProviderDataProps): OAuthProviderData | undefined | null { | ||
if (provider) { | ||
return OAUTH_PROVIDERS.find(oauth_provider => oauth_provider.provider == provider); | ||
} | ||
|
||
return OAUTH_PROVIDERS.find(oauth_provider => oauth_provider.strategy == strategy); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { Web3ProviderData } from '@clerk/types'; | ||
|
||
export const WEB3_PROVIDERS: Web3ProviderData[] = [ | ||
{ | ||
provider: 'metamask', | ||
strategy: 'web3_metamask_signature', | ||
name: 'MetaMask', | ||
}, | ||
{ | ||
provider: 'coinbase_wallet', | ||
strategy: 'web3_coinbase_wallet_signature', | ||
name: 'Coinbase Wallet', | ||
}, | ||
{ | ||
provider: 'okx_wallet', | ||
strategy: 'web3_okx_wallet_signature', | ||
name: 'OKX Wallet', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters